Contract 0xb7da95ec908cba7587b2243ca45d5a2fa92ce618

 

Contract Overview

Balance:
173.261128457298477578 ETH

ETH Value:
$309,453.04 (@ $1,786.05/ETH)
Txn Hash Method
Block
From
To
Value [Txn Fee]
0xb71e7cccf09a7e32229d62c8679605d2ce0933cf2a64640c50f53f63291832b2Register With Co...733197152023-03-24 22:11:305 days 19 hrs ago0xeb8fb342481549a3eaf9b259cbc42097cbdcff0c IN  0xb7da95ec908cba7587b2243ca45d5a2fa92ce6180.002859803793146 ETH0.000159620.1
0x47e0843db1e4db25301180a81a244ec907aa9e9dd395f5e5b586e77a7049f08cCommit733169512023-03-24 22:00:095 days 19 hrs ago0xeb8fb342481549a3eaf9b259cbc42097cbdcff0c IN  0xb7da95ec908cba7587b2243ca45d5a2fa92ce6180 ETH0.00006240.1
0x001c829095a2f950ef36f4b5d029b7c0947433aec4db20e8b998bc3caa2a2e46Register With Co...732693912023-03-24 18:44:405 days 22 hrs ago0x899314d793aa160163f508cb4fd680b60e499fbd IN  0xb7da95ec908cba7587b2243ca45d5a2fa92ce6180.002855898655551 ETH0.000121520.1
0x7f3dd1946331035d634e347f16b41851c92e5d3fe57ac37e6d1a88ef3e4bc9e5Commit732693412023-03-24 18:44:285 days 22 hrs ago0x899314d793aa160163f508cb4fd680b60e499fbd IN  0xb7da95ec908cba7587b2243ca45d5a2fa92ce6180 ETH0.000041570.1
0xa3d56c6de7f0b9324dfffcee66f12bf781cceacfe7c28505e2af503084143c0fRegister With Co...732379042023-03-24 16:35:196 days 40 mins ago0x09b9c96e86189684e10bf713b7a9282f36899c06 IN  0xb7da95ec908cba7587b2243ca45d5a2fa92ce6180.002833872488535 ETH0.000149840.1
0x9c2ab42c7cda2310d27aa773d3846b06dafacc16318d452218f81fc2b0359019Commit732378502023-03-24 16:35:066 days 40 mins ago0x09b9c96e86189684e10bf713b7a9282f36899c06 IN  0xb7da95ec908cba7587b2243ca45d5a2fa92ce6180 ETH0.000053840.1
0xfed7561bbbcc0b95100eed71e7b4a923d936a28020b93c57e9eb3f08f3261b65Register With Co...732241242023-03-24 15:38:396 days 1 hr ago0x190ea8a4aecf81e116235e13db9c4c572cbabb64 IN  0xb7da95ec908cba7587b2243ca45d5a2fa92ce6180.002830322864236 ETH0.000153630.1
0x711fc4dfa1f5dc1aa816e679d92969f21693c0c7496297a5ba9d397f1fd05d36Commit732240692023-03-24 15:38:256 days 1 hr ago0x190ea8a4aecf81e116235e13db9c4c572cbabb64 IN  0xb7da95ec908cba7587b2243ca45d5a2fa92ce6180 ETH0.000056110.1
0xf3cc90947b8936a9c56bc3f9263f73ccf22ffecd7986ae4c6a34d134317fc6ebCommit732235642023-03-24 15:36:286 days 1 hr ago0x190ea8a4aecf81e116235e13db9c4c572cbabb64 IN  0xb7da95ec908cba7587b2243ca45d5a2fa92ce6180 ETH0.000060780.1
0xb555c7d4b1413150a6d43ee45795679d01b3bfced221c7a6a052b6b1eee74d46Register With Co...731212752023-03-24 8:36:296 days 8 hrs ago0x874bc89fdafccea3aaf044a805921e26a217af32 IN  0xb7da95ec908cba7587b2243ca45d5a2fa92ce6180.003039400635 ETH0.000107530.1
0xccb75883a3202e584cd80ba3637a037bd26143dd3158f0c8af41fb922b95473fCommit731212172023-03-24 8:36:146 days 8 hrs ago0x874bc89fdafccea3aaf044a805921e26a217af32 IN  0xb7da95ec908cba7587b2243ca45d5a2fa92ce6180 ETH0.000022790.1
0xc6af43b0db9ced93aef527e19c2a20512f83b1e0dc9a2aaa37140be427eadc01Register With Co...731211542023-03-24 8:35:596 days 8 hrs ago0x95c978a32198c9730d9880e3b12fe2f9629d55c4 IN  0xb7da95ec908cba7587b2243ca45d5a2fa92ce6180.003039400635 ETH0.000108820.1
0x809d4c122d5579b3499c09d86324ec374a6b8d90bc44d70199e318c4aae52867Register With Co...731211452023-03-24 8:35:566 days 8 hrs ago0x977b0d1238eb93329aba8f8b3464b2650db82da0 IN  0xb7da95ec908cba7587b2243ca45d5a2fa92ce6180.003039400635 ETH0.000107910.1
0xdb9728dbbfc4408e17a9c0383ecdd8997deb9a39a8763a2f1aab2cce85bc2d87Register With Co...731211082023-03-24 8:35:476 days 8 hrs ago0xb15b7c032befa229443a4750665ae93b2c7bba5d IN  0xb7da95ec908cba7587b2243ca45d5a2fa92ce6180.003039400635 ETH0.000109280.1
0x59566dc5652ef6f5529dd91a150ba2bc3a847ae39c20baa45e67409fb118b1e0Commit731210962023-03-24 8:35:446 days 8 hrs ago0x95c978a32198c9730d9880e3b12fe2f9629d55c4 IN  0xb7da95ec908cba7587b2243ca45d5a2fa92ce6180 ETH0.000022790.1
0xbd981bf1a04b791befdcb50b3907baf736ad3ae7f8d7c5d399782240c4d2f33fCommit731210872023-03-24 8:35:426 days 8 hrs ago0x977b0d1238eb93329aba8f8b3464b2650db82da0 IN  0xb7da95ec908cba7587b2243ca45d5a2fa92ce6180 ETH0.000022790.1
0x8aa6d98219ddc761c509fc43f52cbd2d7b260692011fc702853fcc134dd70ab3Register With Co...731210772023-03-24 8:35:396 days 8 hrs ago0xf854ba0ebe4cec93c4023b8c00d8999df7475858 IN  0xb7da95ec908cba7587b2243ca45d5a2fa92ce6180.003039400635 ETH0.000109070.1
0xb54d62af7e25529501d614c35dcaeb16f493cd5383bf2dc929c59d72000292fdRegister With Co...731210272023-03-24 8:35:386 days 8 hrs ago0x8d2121fbcae37a0253945e0f1909d2f1fc5fcbf6 IN  0xb7da95ec908cba7587b2243ca45d5a2fa92ce6180.003039400635 ETH0.000138020.1
0xe081c83d3236192cf7a9570d774c7b84bb46f72055488cebee96670e042efb75Commit731210062023-03-24 8:35:336 days 8 hrs ago0xb15b7c032befa229443a4750665ae93b2c7bba5d IN  0xb7da95ec908cba7587b2243ca45d5a2fa92ce6180 ETH0.000030570.1
0x8816f060ab1614006bf7d7ad50fd9a6aa4d01466978706a2705f8e28c42158e4Register With Co...731210012023-03-24 8:35:316 days 8 hrs ago0xa4b2610ce6da48d8b683a7eb1f4cb8769c2f67f7 IN  0xb7da95ec908cba7587b2243ca45d5a2fa92ce6180.003039400635 ETH0.000138910.1
0x360aa21a0323dde8fbc56b3a424438648143972a72a2fdf1acccc59c410ae518Register With Co...731209902023-03-24 8:35:296 days 8 hrs ago0xc87036deefee26bb47b5e0a34a3ffe2d886ff808 IN  0xb7da95ec908cba7587b2243ca45d5a2fa92ce6180.003039400635 ETH0.000139070.1
0xf934990a225fbc8ab3d208d49f7624eec6039bdd73b2ae7443471d23699f4c59Register With Co...731209872023-03-24 8:35:286 days 8 hrs ago0xba984ba00cfa36b4f79ba8edc5ee7787fb7ec48e IN  0xb7da95ec908cba7587b2243ca45d5a2fa92ce6180.003039400635 ETH0.000138950.1
0x9a1970781091a7e977d42b337db86d6c1ba7ba7b2e9e6fa3120a28deaffcbd3eRegister With Co...731209812023-03-24 8:35:266 days 8 hrs ago0xf84d9a090c35c2354e4e090ec360a64bf73de735 IN  0xb7da95ec908cba7587b2243ca45d5a2fa92ce6180.003039400635 ETH0.000138170.1
0x0000d90073528aa04f37587f97b45dde5a6df9c4158dc34bfa91ea2210125d8dCommit731209752023-03-24 8:35:256 days 8 hrs ago0xf854ba0ebe4cec93c4023b8c00d8999df7475858 IN  0xb7da95ec908cba7587b2243ca45d5a2fa92ce6180 ETH0.000030570.1
0x59dde25baa40fafad7b191cf5e644d420d76d639b5bef4842be6406b1b36ae81Commit731209682023-03-24 8:35:236 days 8 hrs ago0x8d2121fbcae37a0253945e0f1909d2f1fc5fcbf6 IN  0xb7da95ec908cba7587b2243ca45d5a2fa92ce6180 ETH0.000030570.1
[ Download CSV Export 
Latest 25 internal transaction
Parent Txn Hash Block From To Value
0x39f20f502c7363f13fdf45e9d8bd3d973d579ed7b338ab675b89d75259d22de5752439692023-03-30 12:08:495 hrs 7 mins ago 0xe281066e8e4c730ac04d4f2a54fcb5025cd8403a 0xb7da95ec908cba7587b2243ca45d5a2fa92ce6180.002773717385304277 ETH
0x865b3d129ed6f07f18a52c661d193bcfe9cc67ec04379a188c45aea3d1082403752437602023-03-30 12:07:575 hrs 7 mins ago 0xe281066e8e4c730ac04d4f2a54fcb5025cd8403a 0xb7da95ec908cba7587b2243ca45d5a2fa92ce6180.002773717385304277 ETH
0xaa243def3a759739657d4526403635d4fb9d270804de0c501218c0b72be85acb752430922023-03-30 12:05:135 hrs 10 mins ago 0xe281066e8e4c730ac04d4f2a54fcb5025cd8403a 0xb7da95ec908cba7587b2243ca45d5a2fa92ce6180.002773717385304277 ETH
0x1b2a469788f2c3643257658f29b7984f11675b400b176d7e722309c519787b88752425832023-03-30 12:03:065 hrs 12 mins ago 0xe281066e8e4c730ac04d4f2a54fcb5025cd8403a 0xb7da95ec908cba7587b2243ca45d5a2fa92ce6180.002772131622984915 ETH
0x74a49088c71dbe85565a47fc85b2528ba785ab57875cf0508d1b06c60ae889eb752418592023-03-30 12:00:085 hrs 15 mins ago 0xe281066e8e4c730ac04d4f2a54fcb5025cd8403a 0xb7da95ec908cba7587b2243ca45d5a2fa92ce6180.002767771006738821 ETH
0x08e798f54c01b4a3aeaa3076481f3c13b46add24da19ca293edf2d7a729d9804752415972023-03-30 11:59:035 hrs 16 mins ago 0xe281066e8e4c730ac04d4f2a54fcb5025cd8403a 0xb7da95ec908cba7587b2243ca45d5a2fa92ce6180.002767771006738821 ETH
0x2a07a6793af57e3ca91e241c2a742768c6f5bfffb07ef7150f3e9fe4d0167517752400712023-03-30 11:52:465 hrs 23 mins ago 0xe281066e8e4c730ac04d4f2a54fcb5025cd8403a 0xb7da95ec908cba7587b2243ca45d5a2fa92ce6180.002768028167453633 ETH
0x51638972bcbae03eda0657aa8beb97cb1c6e6b2f4c7ab877b9c8df343e44c208752393762023-03-30 11:49:525 hrs 26 mins ago 0xe281066e8e4c730ac04d4f2a54fcb5025cd8403a 0xb7da95ec908cba7587b2243ca45d5a2fa92ce6180.002768028167453633 ETH
0x71d72a0874d66a0048abbb1865beef44039adc1967f2154fd4302425acc80fde752392722023-03-30 11:49:265 hrs 26 mins ago 0xe281066e8e4c730ac04d4f2a54fcb5025cd8403a 0xb7da95ec908cba7587b2243ca45d5a2fa92ce6180.002768028167453633 ETH
0x231da993de05c25142c3fe3bd76f17ebb89436e95f11fb549d01cf3e0c216c57752391312023-03-30 11:48:505 hrs 27 mins ago 0xe281066e8e4c730ac04d4f2a54fcb5025cd8403a 0xb7da95ec908cba7587b2243ca45d5a2fa92ce6180.002768028167453633 ETH
0x44ce7123eda6853ab0274891618a356b17478b401af9a5969621e4f52630ebe3752388542023-03-30 11:47:465 hrs 28 mins ago 0xe281066e8e4c730ac04d4f2a54fcb5025cd8403a 0xb7da95ec908cba7587b2243ca45d5a2fa92ce6180.002768028167453633 ETH
0x855b2c0a3f9c7d39251750d67927b84ff67e0cf1345882e8d496b1cb8c6174ec752379532023-03-30 11:44:005 hrs 31 mins ago 0xe281066e8e4c730ac04d4f2a54fcb5025cd8403a 0xb7da95ec908cba7587b2243ca45d5a2fa92ce6180.002768011025917766 ETH
0x24de2bdc26c5ef3c018afc3a989fa296a1850101871151f7adfe9cad261c1aad752371732023-03-30 11:40:495 hrs 35 mins ago 0xe281066e8e4c730ac04d4f2a54fcb5025cd8403a 0xb7da95ec908cba7587b2243ca45d5a2fa92ce6180.002769682044460831 ETH
0x0dae3cc14783c805c38a242957464a0b6b1f890edfa8bffd6588bb738574a6c8747388302023-03-29 0:55:401 day 16 hrs ago 0xb7da95ec908cba7587b2243ca45d5a2fa92ce618 0x9fa006eed523407f55f1257a76aa9bdee994b1160.000140708720897396 ETH
0x0dae3cc14783c805c38a242957464a0b6b1f890edfa8bffd6588bb738574a6c8747388302023-03-29 0:55:401 day 16 hrs ago 0xe281066e8e4c730ac04d4f2a54fcb5025cd8403a 0xb7da95ec908cba7587b2243ca45d5a2fa92ce6180.002814174417947933 ETH
0x5f3be513837588249238310d2e9d16efb453913fcd20deb65d118fa78c103d4d746361792023-03-28 17:37:131 day 23 hrs ago 0xb7da95ec908cba7587b2243ca45d5a2fa92ce618 0x9fa006eed523407f55f1257a76aa9bdee994b1160.00043333814820149 ETH
0x5f3be513837588249238310d2e9d16efb453913fcd20deb65d118fa78c103d4d746361792023-03-28 17:37:131 day 23 hrs ago 0xe281066e8e4c730ac04d4f2a54fcb5025cd8403a 0xb7da95ec908cba7587b2243ca45d5a2fa92ce6180.002888920988009935 ETH
0xfdcee747e75ea2addaf139cfed46215f3ddc18069cb0049d79f94f3a348015d2746360532023-03-28 17:36:411 day 23 hrs ago 0xb7da95ec908cba7587b2243ca45d5a2fa92ce618 0x9fa006eed523407f55f1257a76aa9bdee994b1160.00043333814820149 ETH
0xfdcee747e75ea2addaf139cfed46215f3ddc18069cb0049d79f94f3a348015d2746360532023-03-28 17:36:411 day 23 hrs ago 0xe281066e8e4c730ac04d4f2a54fcb5025cd8403a 0xb7da95ec908cba7587b2243ca45d5a2fa92ce6180.002888920988009935 ETH
0x002b5d60c4f771660a5262de0633533b911654108785376314ffe1e87ff413d5746359042023-03-28 17:36:031 day 23 hrs ago 0xb7da95ec908cba7587b2243ca45d5a2fa92ce618 0x9fa006eed523407f55f1257a76aa9bdee994b1160.00043333814820149 ETH
0x002b5d60c4f771660a5262de0633533b911654108785376314ffe1e87ff413d5746359042023-03-28 17:36:031 day 23 hrs ago 0xe281066e8e4c730ac04d4f2a54fcb5025cd8403a 0xb7da95ec908cba7587b2243ca45d5a2fa92ce6180.002888920988009935 ETH
0x3089c15011ad9fa9d302aefbb5126aafa55d0ff883d142a8d34b4eefc2405e0b746357702023-03-28 17:35:291 day 23 hrs ago 0xb7da95ec908cba7587b2243ca45d5a2fa92ce618 0x9fa006eed523407f55f1257a76aa9bdee994b1160.00043333814820149 ETH
0x3089c15011ad9fa9d302aefbb5126aafa55d0ff883d142a8d34b4eefc2405e0b746357702023-03-28 17:35:291 day 23 hrs ago 0xe281066e8e4c730ac04d4f2a54fcb5025cd8403a 0xb7da95ec908cba7587b2243ca45d5a2fa92ce6180.002888920988009935 ETH
0x980b49c8eec286804927c71d03145a695cff1ec0ae028923e780e0018a6ae676746356122023-03-28 17:34:491 day 23 hrs ago 0xb7da95ec908cba7587b2243ca45d5a2fa92ce618 0x9fa006eed523407f55f1257a76aa9bdee994b1160.000433093894005367 ETH
0x980b49c8eec286804927c71d03145a695cff1ec0ae028923e780e0018a6ae676746356122023-03-28 17:34:491 day 23 hrs ago 0xe281066e8e4c730ac04d4f2a54fcb5025cd8403a 0xb7da95ec908cba7587b2243ca45d5a2fa92ce6180.002887292626702453 ETH
[ Download CSV Export 
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
ARBRegistrarControllerV5

Compiler Version
v0.8.12+commit.f00d7308

Optimization Enabled:
Yes with 10000 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 50 : ARBRegistrarControllerV5.sol
//SPDX-License-Identifier: MIT
pragma solidity >=0.8.4;
import "../price-oracle/ISidPriceOracle.sol";
import "../giftcard/SidGiftCardLedger.sol";

import {BaseRegistrarImplementation} from "./BaseRegistrarImplementation.sol";
import {StringUtils} from "../common/StringUtils.sol";
import {Resolver} from "../resolvers/Resolver.sol";
import {IARBRegistrarControllerV3, ISidPriceOracle} from "./IARBRegistrarControllerV3.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 {ReentrancyGuard} from "@openzeppelin/contracts/security/ReentrancyGuard.sol";

import {ReferralInfo} from "../struct/SidStruct.sol";
import {ReferralHub} from "../referral/ReferralHub.sol";
import {ReferralVerifier} from "../referral/ReferralVerifier.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();
error InvalidOwner(address owner);

/**
 * @dev A registrar controller for registering and renewing on public phase.
 */
contract ARBRegistrarControllerV5 is
    Ownable,
    IARBRegistrarControllerV3,
    IERC165,
    ReentrancyGuard
{
    using StringUtils for *;
    using Address for address;

    uint256 public constant MIN_REGISTRATION_DURATION = 365 days;
    uint256 private constant COIN_TYPE_ARB1 = 2147525809;
    uint256 private constant COIN_TYPE_ARB_NOVA = 2147525818;
    BaseRegistrarImplementation immutable base;
    ISidPriceOracle public immutable prices;
    uint256 public immutable minCommitmentAge;
    uint256 public immutable maxCommitmentAge;
    SidGiftCardLedger public immutable giftCardLedger;
    ReferralHub public immutable referralHub;
    ReferralVerifier public immutable referralVerifier;

    mapping(bytes32 => uint256) public commitments;

    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
    );

    event Referral();

    constructor(
        BaseRegistrarImplementation _base,
        ISidPriceOracle _prices,
        SidGiftCardLedger _giftCardLedger,
        ReferralHub _referralHub,
        ReferralVerifier _referralVerifier,
        uint256 _minCommitmentAge,
        uint256 _maxCommitmentAge
    ) {
        if (_maxCommitmentAge <= _minCommitmentAge) {
            revert MaxCommitmentAgeTooLow();
        }

        if (_maxCommitmentAge > block.timestamp) {
            revert MaxCommitmentAgeTooHigh();
        }

        base = _base;
        prices = _prices;
        giftCardLedger = _giftCardLedger;
        minCommitmentAge = _minCommitmentAge;
        maxCommitmentAge = _maxCommitmentAge;
        referralHub = _referralHub;
        referralVerifier = _referralVerifier;
    }

    function rentPrice(
        string memory name,
        uint256 duration
    ) public view override returns (ISidPriceOracle.Price memory price) {
        bytes32 label = keccak256(bytes(name));
        price = prices.domain(name, base.nameExpires(uint256(label)), duration);
    }

    function rentPrice(
        string memory name,
        uint256 duration,
        address registerAddress
    ) public view returns (ISidPriceOracle.Price memory price) {
        bytes32 label = keccak256(bytes(name));
        price = prices.domainWithPoint(
            name,
            base.nameExpires(uint256(label)),
            duration,
            registerAddress
        );
    }

    function valid(string memory name) public pure returns (bool) {
        // check unicode rune count, if rune count is >=3, byte length must be >=3.
        if (name.strlen() < 3) {
            return false;
        }
        bytes memory nb = bytes(name);
        // zero width for /u200b /u200c /u200d and U+FEFF
        for (uint256 i; i < nb.length - 2; i++) {
            if (bytes1(nb[i]) == 0xe2 && bytes1(nb[i + 1]) == 0x80) {
                if (
                    bytes1(nb[i + 2]) == 0x8b ||
                    bytes1(nb[i + 2]) == 0x8c ||
                    bytes1(nb[i + 2]) == 0x8d
                ) {
                    return false;
                }
            } else if (bytes1(nb[i]) == 0xef) {
                if (bytes1(nb[i + 1]) == 0xbb && bytes1(nb[i + 2]) == 0xbf)
                    return false;
            }
        }
        return true;
    }

    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,
        bytes32 secret
    ) public pure override returns (bytes32) {
        bytes32 label = keccak256(bytes(name));
        return keccak256(abi.encodePacked(label, owner, secret));
    }

    function commit(bytes32 commitment) public override {
        if (commitments[commitment] + maxCommitmentAge >= block.timestamp) {
            revert UnexpiredCommitmentExists(commitment);
        }
        commitments[commitment] = block.timestamp;
    }

    function registerWithConfigAndPoint(
        string memory name,
        address owner,
        uint duration,
        bytes32 secret,
        address resolver,
        bool isUsePoints,
        ReferralInfo memory referralInfo
    ) public payable override nonReentrant {
        ISidPriceOracle.Price memory price;
        if (isUsePoints) {
            price = rentPrice(name, duration, owner);
            //deduct points from gift card ledger
            giftCardLedger.deduct(owner, price.usedPoint);
        } else {
            price = rentPrice(name, duration);
        }

        if (msg.value < price.base + price.premium) {
            revert InsufficientValue();
        }

        if (owner == address(0)) {
            revert InvalidOwner(owner);
        }

        _consumeCommitment(name, duration, makeCommitment(name, owner, secret));

        bytes32 label = keccak256(bytes(name));
        uint256 tokenId = uint256(label);

        // Set this contract as the (temporary) owner, giving it
        // permission to set up the resolver.
        uint256 expires = base.register(tokenId, address(this), duration);

        // The nodehash of this label
        bytes32 nodehash = keccak256(abi.encodePacked(base.baseNode(), label));

        // Set the resolver
        base.arbid().setResolver(nodehash, resolver);

        // Configure the resolver with Arbitrum One and Arbitrum Nova
        if (owner != address(0)) {
            Resolver(resolver).setAddr(nodehash, COIN_TYPE_ARB1, owner);
            Resolver(resolver).setAddr(nodehash, COIN_TYPE_ARB_NOVA, owner);
        }

        // Now transfer full ownership to the expeceted owner
        base.reclaim(tokenId, owner);
        base.transferFrom(address(this), owner, tokenId);

        emit NameRegistered(
            name,
            keccak256(bytes(name)),
            owner,
            price.base,
            price.premium,
            expires
        );
        
        uint256 cost = price.base + price.premium;
        if (referralInfo.referrerAddress != address(0)) {
            cost = _handleReferral(
                cost,
                referralInfo.referrerAddress,
                referralInfo.referrerNodehash,
                referralInfo.referralAmount,
                referralInfo.signedAt,
                referralInfo.signature
            );
        }

        if (msg.value > (cost)) {
            (bool sent, ) = msg.sender.call{value: msg.value - (cost)}("");
            require(sent, "Failed to send Ether");
        }
    }

    function registerWithConfig(
        string calldata name,
        address owner,
        uint256 duration,
        bytes32 secret,
        address resolver,
        bool reverseRecord
    ) public payable override {
        registerWithConfigAndPoint(
            name,
            owner,
            duration,
            secret,
            resolver,
            reverseRecord,
            ReferralInfo(address(0), bytes32(0), 0, 0, bytes(""))
        );
    }

    function renew(
        string calldata name,
        uint duration
    ) external payable override nonReentrant {
        renewWithPoint(name, duration, false);
    }

    function renewWithPoint(
        string calldata name,
        uint duration,
        bool isUsePoints
    ) public payable nonReentrant {
        ISidPriceOracle.Price memory price;
        if (isUsePoints) {
            price = rentPrice(name, duration, msg.sender);
            //deduct points from gift card ledger
            giftCardLedger.deduct(msg.sender, price.usedPoint);
        } else {
            price = rentPrice(name, duration);
        }
        uint256 cost = (price.base + price.premium);
        require(msg.value >= cost);
        bytes32 label = keccak256(bytes(name));
        uint expires = base.renew(uint256(label), duration);

        // Refund any extra payment
        if (msg.value > cost) {
            (bool sent, ) = msg.sender.call{value: msg.value - cost}("");
            require(sent, "Failed to send Ether");
        }

        emit NameRenewed(name, label, cost, expires);
    }

    function withdraw() public onlyOwner nonReentrant {
        (bool sent, ) = owner().call{value: address(this).balance}("");
        require(sent, "Failed to send Ether");
    }

    function supportsInterface(
        bytes4 interfaceID
    ) external pure returns (bool) {
        return
            interfaceID == type(IERC165).interfaceId ||
            interfaceID == type(IARBRegistrarControllerV3).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 < MIN_REGISTRATION_DURATION) {
            revert DurationTooShort(duration);
        }
    }

    function _handleReferral(
        uint cost,
        address referrerAddress,
        bytes32 referrerNodehash,
        uint256 referralAmount,
        uint256 signedAt,
        bytes memory signature
    ) internal returns (uint) {
        require(
            referralVerifier.verifyReferral(
                referrerAddress,
                referrerNodehash,
                referralAmount,
                signedAt,
                signature
            ),
            "Invalid referral signature"
        );
        uint256 referrerFee = 0;
        uint256 refereeFee = 0;
        if (referralHub.isPartner(referrerNodehash)) {
            (referrerFee, refereeFee) = referralHub.getReferralCommisionFee(
                cost,
                referrerNodehash
            );
        } else {
            (referrerFee, refereeFee) = referralVerifier
                .getReferralCommisionFee(cost, referralAmount);
        }
        referralHub.addNewReferralRecord(referrerNodehash);
        if (referrerFee > 0) {
            referralHub.deposit{value: referrerFee}(referrerAddress);
        }
        return cost - refereeFee;
    }
}

File 2 of 50 : ISidPriceOracle.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.4;

interface ISidPriceOracle {
    struct Price {
        uint256 base;
        uint256 premium;
        uint256 usedPoint;
    }

    function giftcard(
        uint256[] memory ids,
        uint256[] memory amounts
    ) external view returns (Price calldata);

    function domain(
        string memory name,
        uint256 expires,
        uint256 duration
    ) external view returns (Price calldata);

    function domainWithPoint(
        string memory name,
        uint256 expires,
        uint256 duration,
        address owner
    ) external view returns (Price calldata);
}

File 3 of 50 : BaseRegistrarImplementation.sol
pragma solidity >=0.8.4;

import "../registry/ARBID.sol";
import "./IBaseRegistrar.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Strings.sol";

contract BaseRegistrarImplementation is ERC721, IBaseRegistrar, Ownable {
    // A map of expiry times
    mapping(uint256 => uint) expiries;
    // The arbid registry
    ARBID public arbid;
    // The namehash of the TLD this registrar owns (eg, .arb)
    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 = 90 days;
    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)"));
    string public baseUri;
    uint256 supplyAmount = 0;  

    /**
     * v2.1.3 version of _isApprovedOrOwner which calls ownerOf(tokenId) and takes grace period into conarbideration 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(ARBID _arbid, bytes32 _baseNode) ERC721("SPACE ID .arb Name", "SIDARB ") {
        arbid = _arbid;
        baseNode = _baseNode;
    }

    modifier live() {
        require(arbid.owner(baseNode) == address(this));
        _;
    }

    modifier onlyController() {
        require(controllers[msg.sender]);
        _;
    }

    function totalSupply() external view returns (uint256) {
        return supplyAmount;
    }
    
    function _mint(address _to, uint256 _tokenId) internal virtual override {
        super._mint(_to, _tokenId);
        supplyAmount = supplyAmount + 1;
    }

    function _burn(uint256 _tokenId) internal virtual override {
        super._burn(_tokenId);
        supplyAmount = supplyAmount - 1;
    }

    /**
     * @dev See {IERC721-transferFrom}.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public override(ERC721, IERC721) {
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not approved or owner");

        _transfer(from, to, tokenId);
        arbid.setSubnodeOwner(baseNode, bytes32(tokenId), to);
    }

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) public override(ERC721, IERC721) {
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not approved or owner");
        _safeTransfer(from, to, tokenId, _data);
        arbid.setSubnodeOwner(baseNode, bytes32(tokenId), to);
    }

    /**
     * @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 {
        require(controller != address(0), "address can not be zero!");
        controllers[controller] = true;
        emit ControllerAdded(controller);
    }

    // Revoke controller permission for an address.
    function removeController(address controller) external override onlyOwner {
        require(controller != address(0), "address can not be zero!");
        controllers[controller] = false;
        emit ControllerRemoved(controller);
    }

    // Set the resolver for the TLD this registrar manages.
    function setResolver(address resolver) external override onlyOwner {
        arbid.setResolver(baseNode, resolver);
    }

    // Returns the expiration timestamp of the specified id.
    function nameExpires(uint256 id) public view override returns (uint) {
        return expiries[id];
    }

    // Returns true iff the specified name is available for registration.
    function available(uint256 id) public view override returns (bool) {
        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,
        uint duration
    ) external override returns (uint) {
        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,
        uint duration
    ) external returns (uint) {
        return _register(id, owner, duration, false);
    }

    function _register(
        uint256 id,
        address owner,
        uint duration,
        bool updateRegistry
    ) internal live onlyController returns (uint) {
        require(available(id));
        require(block.timestamp + duration + GRACE_PERIOD > block.timestamp + GRACE_PERIOD); // Prevent future overflow

        expiries[id] = block.timestamp + duration;
        if (_exists(id)) {
            // Name was previously owned, and expired
            _burn(id);
        }
        _mint(owner, id);
        if (updateRegistry) {
            arbid.setSubnodeOwner(baseNode, bytes32(id), owner);
        }

        emit NameRegistered(id, owner, block.timestamp + duration);

        return block.timestamp + duration;
    }

    function renew(uint256 id, uint duration) external override live onlyController returns (uint) {
        require(expiries[id] + GRACE_PERIOD >= block.timestamp); // Name must be registered here or in grace period
        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 arbid, if you own it in the registrar.
     */
    function reclaim(uint256 id, address owner) external override live {
        require(_isApprovedOrOwner(msg.sender, id));
        arbid.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;
    }

    /**
     * PRIVILEGED MODULE FUNCTION. Sets a new baseURI for all token types.
     */
    function setURI(string memory newURI) external onlyOwner {
        baseUri = newURI;
    }

    function tokenURI(uint256 tokenId) public view override returns (string memory) {
        require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");

        string memory baseURI = baseUri;
        return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, Strings.toString(tokenId))) : "";
    }
}

File 4 of 50 : IARBRegistrarControllerV3.sol
//SPDX-License-Identifier: MIT
pragma solidity >=0.8.4;

import "../price-oracle/ISidPriceOracle.sol";
import {ReferralInfo} from "../struct/SidStruct.sol";

interface IARBRegistrarControllerV3 {
    function rentPrice(string memory, uint256)
        external
        view
        returns (ISidPriceOracle.Price memory);

    function available(string memory) external returns (bool);

    function rentPrice(string memory, uint256, address)
        external
        view
        returns (ISidPriceOracle.Price memory);

    function makeCommitment(
        string memory,
        address,
        bytes32
    ) external pure returns (bytes32);

    function commit(bytes32) external;

    function registerWithConfig(
        string calldata,
        address,
        uint256,
        bytes32,
        address,
        bool
    ) external payable;

    function registerWithConfigAndPoint(
        string calldata,
        address,
        uint256,
        bytes32,
        address,
        bool,
        ReferralInfo memory
    ) external payable;

    function renew(string calldata, uint256) external payable;

    function renewWithPoint(string calldata, uint256, bool)
        external
        payable;
}

File 5 of 50 : StringUtils.sol
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 (uint) {
        uint len;
        uint i = 0;
        uint 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;
    }
}

File 6 of 50 : SidStruct.sol
pragma solidity >=0.8.4;

struct ReferralInfo {
    address referrerAddress;
    bytes32 referrerNodehash;
    uint256 referralAmount;
    uint256 signedAt;
    bytes signature;
}

File 7 of 50 : ReferralHub.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.4;
import "./IReferralHub.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "../registry/ARBID.sol";
import "../resolvers/profiles/AddrResolver.sol";
import "../resolvers/profiles/NameResolver.sol";
import "../registry/IReverseRegistrar.sol";

contract ReferralHub is IReferralHub, Ownable, ReentrancyGuard {
    // ReferralHub controllers that can update referral count and related states.
    mapping(address => bool) public controllers;

    // Commission configuration
    struct Comission {
        // The number of minimum referrals that is required for the rate.
        uint256 minimumReferralCount;
        // Percentage of registration fee that will be deposited to referrer.
        uint256 referrer;
        // Percentage of registration fee that will be discounted to referee.
        uint256 referee;
    }
    //map comission chart to a level
    mapping(uint256 => Comission) public comissionCharts;
    // map from refferral domain name nodehash to the number of referrals.
    mapping(bytes32 => uint256) public referralCount;
    // map address to the amount of bonus.
    mapping(address => uint256) public referralBalance;
    // Map partner's domain's nodehash to customized commission rate.
    mapping(bytes32 => Comission) public partnerComissionCharts;

    bytes32 constant ADDR_REVERSE_NODE = 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;
    bytes32 constant lookup = 0x3031323334353637383961626364656600000000000000000000000000000000;

    ARBID immutable arbid;

    constructor(ARBID _arbid) {
        arbid = _arbid;
        comissionCharts[1] = Comission(0, 5, 0);
        comissionCharts[2] = Comission(30, 8, 0);
        comissionCharts[3] = Comission(100, 11, 0);
        comissionCharts[4] = Comission(600, 15, 0);
        comissionCharts[5] = Comission(100000000, 15, 0);
        comissionCharts[6] = Comission(100000000, 15, 0);
        comissionCharts[7] = Comission(100000000, 15, 0);
        comissionCharts[8] = Comission(100000000, 15, 0);
        comissionCharts[9] = Comission(100000000, 15, 0);
        comissionCharts[10] = Comission(100000000, 15, 0);
    }

    modifier onlyController() {
        require(controllers[msg.sender], "Not a authorized controller");
        _;
    }

    modifier validLevel(uint256 _level) {
        require(_level >= 1 && _level <= 10, "Invalid level");
        _;
    }

    function getNodehash(string calldata name, string calldata tld) public pure returns (bytes32) {
        bytes32 nameHash = keccak256(bytes(name));
        bytes32 tldHash = keccak256(abi.encodePacked(bytes32(0), keccak256(bytes(tld))));
        return keccak256(abi.encodePacked(tldHash, nameHash));
    }

    function getReverseNodehash(address addr) public pure 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 isReferralEligible(bytes32 nodeHash) external view override returns (bool, address) {
        address resolverAddress = arbid.resolver(nodeHash);
        if (resolverAddress == address(0)) {
            return (false, address(0));
        }
        AddrResolver resolver = AddrResolver(resolverAddress);
        address resolvedAddress = resolver.addr(nodeHash);
        bytes32 reverseNodeHash = getReverseNodehash(resolvedAddress);
        address reverseResolverAddress = arbid.resolver(reverseNodeHash);

        if (reverseResolverAddress == address(0)) {
            return (false, address(0));
        }

        return (true, resolvedAddress);
    }

    function isPartner(bytes32 nodeHash) public view returns (bool) {
        return partnerComissionCharts[nodeHash].referrer > 0 || partnerComissionCharts[nodeHash].referee > 0;
    }

    function getReferralCommisionFee(uint256 price, bytes32 nodeHash) public view returns (uint256, uint256) {
        uint256 referrerRate = 0;
        uint256 refereeRate = 0;
        uint256 level = 1;
        if (isPartner(nodeHash)) {
            referrerRate = partnerComissionCharts[nodeHash].referrer;
            refereeRate = partnerComissionCharts[nodeHash].referee;
        } else {
            (level, referrerRate, refereeRate) = _getComissionChart(referralCount[nodeHash]);
        }
        uint256 referrerFee = (price * referrerRate) / 100;
        uint256 refereeFee = (price * refereeRate) / 100;
        return (referrerFee, refereeFee);
    }

    function setPartnerComissionChart(
        string calldata name,
        string calldata tld,
        uint256 minimumReferralCount,
        uint256 referrerRate,
        uint256 refereeRate
    ) external onlyOwner {
        bytes32 nodeHash = getNodehash(name, tld);
        partnerComissionCharts[nodeHash] = Comission(minimumReferralCount, referrerRate, refereeRate);
    }

    function addNewReferralRecord(bytes32 referrerNodeHash) external override onlyController {
        referralCount[referrerNodeHash] += 1;
        emit NewReferralRecord(referrerNodeHash);
    }

    function _getReferralCount(bytes32 referrerNodeHash) internal view returns (uint256) {
        return referralCount[referrerNodeHash];
    }

    function _getComissionChart(uint256 referralAmount)
        internal
        view
        returns (
            uint256,
            uint256,
            uint256
        )
    {
        uint256 curLevel = 1;
        uint256 referrerRate;
        uint256 refereeRate;
        uint256 level;
        while (referralAmount >= comissionCharts[curLevel].minimumReferralCount && curLevel <= 10)  {
            referrerRate = comissionCharts[curLevel].referrer;
            refereeRate = comissionCharts[curLevel].referee;
            level = curLevel;
            curLevel += 1;
        }
        return (level, referrerRate, refereeRate);
    }

    function getReferralDetails(bytes32 referrerNodeHash)
        external
        view
        override
        returns (
            uint256,
            uint256,
            uint256,
            uint256
        )
    {
        uint256 referralNum = _getReferralCount(referrerNodeHash);
        (uint256 level, uint256 referrerRate, uint256 refereeRate) = _getComissionChart(referralNum);
        return (referralNum, level, referrerRate, refereeRate);
    }

    function setComissionChart(
        uint256 level,
        uint256 minimumAmount,
        uint256 referrerRate,
        uint256 refereeRate
    ) external onlyOwner validLevel(level) {
        comissionCharts[level] = Comission(minimumAmount, referrerRate, refereeRate);
    }

    function deposit(address _referrer) external payable onlyController{
        require(msg.value > 0, "Invalid amount");
        referralBalance[_referrer] += msg.value;
        emit depositRecord(_referrer, msg.value);
    }

    function withdraw() external nonReentrant{
        uint256 amount = referralBalance[msg.sender];
        require(amount > 0, "Insufficient balance");
        referralBalance[msg.sender] = 0;
        payable(msg.sender).transfer(amount);
        emit withdrawRecord(msg.sender, amount);
    }

    function addController(address controller) external override onlyOwner {
        controllers[controller] = true;
        emit ControllerAdded(controller);
    }

    function removeController(address controller) external override onlyOwner {
        controllers[controller] = false;
        emit ControllerRemoved(controller);
    }
}

File 8 of 50 : ReferralVerifier.sol
pragma solidity >=0.8.4;

import "./ReferralVerifier.sol";
import {EIP712} from "@openzeppelin/contracts/utils/cryptography/draft-EIP712.sol";
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {Pausable} from  "@openzeppelin/contracts/security/Pausable.sol";
import {ECDSA} from "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
import {ReferralHub} from "./ReferralHub.sol";



contract ReferralVerifier is EIP712, Ownable, Pausable {
    address public spaceid_signer;
    ReferralHub immutable referralHub;
    

    constructor(address _spaceid_signer, ReferralHub _referral_hub) EIP712("ReferralVerifier", "1.0.0") {
        spaceid_signer = _spaceid_signer;
        referralHub = _referral_hub;
    }

    function setSpaceIdSigner(address _spaceid_signer) external onlyOwner {
        spaceid_signer = _spaceid_signer;
    }

    function pause() external onlyOwner {
        _pause();
    }

    function unpause() external onlyOwner {
        _unpause();
    } 

    function _hash(address referrerAddress, bytes32 nodehash, uint256 referralCount, uint256 signedAt) public view returns (bytes32) {
        return _hashTypedDataV4(keccak256(abi.encode(
            keccak256("Referral(address referrerAddress,bytes32 nodehash,uint256 referralCount,uint256 signedAt)"),
            referrerAddress,
            nodehash,
            referralCount,
            signedAt
        )));
    }

    function verifyReferral(address referrerAddress, bytes32 nodehash, uint256 referralCount, uint256 signedAt, bytes calldata signature) external view whenNotPaused returns (bool) {
        return _verifySignature(_hash(referrerAddress, nodehash, referralCount, signedAt), signature) && block.timestamp < signedAt + 5 minutes;
    }

    function getReferralCommisionFee(uint256 price, uint256 referralCount) external view returns (uint256, uint256) {
        uint256 curLevel = 1;
        (uint256 minimumReferralCount, uint256 referrerRate, uint256 refereeRate) = referralHub.comissionCharts(curLevel);
        while (referralCount > minimumReferralCount && curLevel <= 10)  {
            (, referrerRate, refereeRate) = referralHub.comissionCharts(curLevel);
            (minimumReferralCount, , ) = referralHub.comissionCharts(++curLevel);

        }
        uint256 referrerFee = (price * referrerRate) / 100;
        uint256 refereeFee = (price * refereeRate) / 100;
        return (referrerFee, refereeFee);
    }

    function _verifySignature(bytes32 hash, bytes calldata signature) private view returns (bool) {
        return ECDSA.recover(hash, signature) == spaceid_signer;
    }

}

File 9 of 50 : SidGiftCardLedger.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.4;
import "./SidGiftCardRegistrar.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "./SidGiftCardVoucher.sol";

contract SidGiftCardLedger is Ownable {
    SidGiftCardRegistrar public registrar;
    SidGiftCardVoucher public voucher;
    mapping(address => uint256) public balances;
    mapping(address => bool) public controllers;

    event ControllerAdded(address indexed controller);
    event ControllerRemoved(address indexed controller);

    constructor(SidGiftCardRegistrar _registrar, SidGiftCardVoucher _voucher) {
        registrar = _registrar;
        voucher = _voucher;
    }

    modifier onlyController() {
        require(controllers[msg.sender], "Not a authorized controller");
        _;
    }

    function balanceOf(address account) public view returns (uint256) {
        return balances[account];
    }

    function redeem(uint256[] calldata ids, uint256[] calldata amounts) external {
        registrar.batchBurn(msg.sender, ids, amounts);
        uint256 totalValue = voucher.totalValue(ids, amounts);
        balances[msg.sender] += totalValue;
    }

    function deduct(address account, uint256 amount) public onlyController {
        uint256 fromBalance = balances[account];
        require(fromBalance >= amount, "Insufficient balance");
        balances[account] = fromBalance - amount;
    }

    function addController(address controller) external onlyOwner {
        require(controller != address(0), "address can not be zero!");
        controllers[controller] = true;
        emit ControllerAdded(controller);
    }

    function removeController(address controller) external onlyOwner {
        require(controller != address(0), "address can not be zero!");
        controllers[controller] = false;
        emit ControllerRemoved(controller);
    }
}

File 10 of 50 : Resolver.sol
//SPDX-License-Identifier: MIT
pragma solidity >=0.8.4;

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 "./ISupportsInterface.sol";

/**
 * A generic resolver interface which includes all the functions including the ones deprecated
 */
interface Resolver is
    ISupportsInterface,
    IABIResolver,
    IAddressResolver,
    IAddrResolver,
    IContentHashResolver,
    IDNSRecordResolver,
    IDNSZoneResolver,
    IInterfaceResolver,
    INameResolver,
    IPubkeyResolver,
    ITextResolver
{
    /* Deprecated events */
    event ContentChanged(bytes32 indexed node, bytes32 hash);

    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 setAddr(
        bytes32 node,
        uint256 coinType,
        address 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);

    /* 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;
}

File 11 of 50 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)

pragma solidity ^0.8.0;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        assembly {
            size := extcodesize(account)
        }
        return size > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        (bool success, ) = recipient.call{value: amount}("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain `call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCall(target, data, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        require(isContract(target), "Address: call to non-contract");

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        require(isContract(target), "Address: static call to non-contract");

        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionDelegateCall(target, data, "Address: low-level delegate call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(isContract(target), "Address: delegate call to non-contract");

        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

File 12 of 50 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
abstract contract ReentrancyGuard {
    // Booleans are more expensive than uint256 or any type that takes up a full
    // word because each write operation emits an extra SLOAD to first read the
    // slot's contents, replace the bits taken up by the boolean, and then write
    // back. This is the compiler's defense against contract upgrades and
    // pointer aliasing, and it cannot be disabled.

    // The values being non-zero value makes deployment a bit more expensive,
    // but in exchange the refund on every call to nonReentrant will be lower in
    // amount. Since refunds are capped to a percentage of the total
    // transaction's gas, it is best to keep them low in cases like this one, to
    // increase the likelihood of the full refund coming into effect.
    uint256 private constant _NOT_ENTERED = 1;
    uint256 private constant _ENTERED = 2;

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        // On the first call to nonReentrant, _notEntered will be true
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

        // Any calls to nonReentrant after this point will fail
        _status = _ENTERED;

        _;

        // By storing the original value once again, a refund is triggered (see
        // https://eips.ethereum.org/EIPS/eip-2200)
        _status = _NOT_ENTERED;
    }
}

File 13 of 50 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../utils/Context.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _transferOwnership(_msgSender());
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
        _;
    }

    /**
     * @dev 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.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

File 14 of 50 : IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[EIP].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165 {
    /**
     * @dev 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.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}

File 15 of 50 : ARBID.sol
pragma solidity >=0.8.4;

interface ARBID {
    // 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);
}

File 16 of 50 : IBaseRegistrar.sol
import "../registry/ARBID.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 iff 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 SID, if you own it in the registrar.
     */
    function reclaim(uint256 id, address owner) external;
}

File 17 of 50 : Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)

pragma solidity ^0.8.0;

/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        // Inspired by OraclizeAPI's implementation - MIT licence
        // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol

        if (value == 0) {
            return "0";
        }
        uint256 temp = value;
        uint256 digits;
        while (temp != 0) {
            digits++;
            temp /= 10;
        }
        bytes memory buffer = new bytes(digits);
        while (value != 0) {
            digits -= 1;
            buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
            value /= 10;
        }
        return string(buffer);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        if (value == 0) {
            return "0x00";
        }
        uint256 temp = value;
        uint256 length = 0;
        while (temp != 0) {
            length++;
            temp >>= 8;
        }
        return toHexString(value, length);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
     */
    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
        bytes memory buffer = new bytes(2 * length + 2);
        buffer[0] = "0";
        buffer[1] = "x";
        for (uint256 i = 2 * length + 1; i > 1; --i) {
            buffer[i] = _HEX_SYMBOLS[value & 0xf];
            value >>= 4;
        }
        require(value == 0, "Strings: hex length insufficient");
        return string(buffer);
    }
}

File 18 of 50 : ERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/ERC721.sol)

pragma solidity ^0.8.0;

import "./IERC721.sol";
import "./IERC721Receiver.sol";
import "./extensions/IERC721Metadata.sol";
import "../../utils/Address.sol";
import "../../utils/Context.sol";
import "../../utils/Strings.sol";
import "../../utils/introspection/ERC165.sol";

/**
 * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
 * the Metadata extension, but not including the Enumerable extension, which is available separately as
 * {ERC721Enumerable}.
 */
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
    using Address for address;
    using Strings for uint256;

    // Token name
    string private _name;

    // Token symbol
    string private _symbol;

    // Mapping from token ID to owner address
    mapping(uint256 => address) private _owners;

    // Mapping owner address to token count
    mapping(address => uint256) private _balances;

    // Mapping from token ID to approved address
    mapping(uint256 => address) private _tokenApprovals;

    // Mapping from owner to operator approvals
    mapping(address => mapping(address => bool)) private _operatorApprovals;

    /**
     * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
     */
    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
        return
            interfaceId == type(IERC721).interfaceId ||
            interfaceId == type(IERC721Metadata).interfaceId ||
            super.supportsInterface(interfaceId);
    }

    /**
     * @dev See {IERC721-balanceOf}.
     */
    function balanceOf(address owner) public view virtual override returns (uint256) {
        require(owner != address(0), "ERC721: balance query for the zero address");
        return _balances[owner];
    }

    /**
     * @dev See {IERC721-ownerOf}.
     */
    function ownerOf(uint256 tokenId) public view virtual override returns (address) {
        address owner = _owners[tokenId];
        require(owner != address(0), "ERC721: owner query for nonexistent token");
        return owner;
    }

    /**
     * @dev See {IERC721Metadata-name}.
     */
    function name() public view virtual override returns (string memory) {
        return _name;
    }

    /**
     * @dev See {IERC721Metadata-symbol}.
     */
    function symbol() public view virtual override returns (string memory) {
        return _symbol;
    }

    /**
     * @dev See {IERC721Metadata-tokenURI}.
     */
    function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
        require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");

        string memory baseURI = _baseURI();
        return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : "";
    }

    /**
     * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
     * token will be the concatenation of the `baseURI` and the `tokenId`. Empty
     * by default, can be overriden in child contracts.
     */
    function _baseURI() internal view virtual returns (string memory) {
        return "";
    }

    /**
     * @dev See {IERC721-approve}.
     */
    function approve(address to, uint256 tokenId) public virtual override {
        address owner = ERC721.ownerOf(tokenId);
        require(to != owner, "ERC721: approval to current owner");

        require(
            _msgSender() == owner || isApprovedForAll(owner, _msgSender()),
            "ERC721: approve caller is not owner nor approved for all"
        );

        _approve(to, tokenId);
    }

    /**
     * @dev See {IERC721-getApproved}.
     */
    function getApproved(uint256 tokenId) public view virtual override returns (address) {
        require(_exists(tokenId), "ERC721: approved query for nonexistent token");

        return _tokenApprovals[tokenId];
    }

    /**
     * @dev See {IERC721-setApprovalForAll}.
     */
    function setApprovalForAll(address operator, bool approved) public virtual override {
        _setApprovalForAll(_msgSender(), operator, approved);
    }

    /**
     * @dev See {IERC721-isApprovedForAll}.
     */
    function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
        return _operatorApprovals[owner][operator];
    }

    /**
     * @dev See {IERC721-transferFrom}.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public virtual override {
        //solhint-disable-next-line max-line-length
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");

        _transfer(from, to, tokenId);
    }

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public virtual override {
        safeTransferFrom(from, to, tokenId, "");
    }

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) public virtual override {
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
        _safeTransfer(from, to, tokenId, _data);
    }

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
     * are aware of the ERC721 protocol to prevent tokens from being forever locked.
     *
     * `_data` is additional data, it has no specified format and it is sent in call to `to`.
     *
     * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
     * implement alternative mechanisms to perform token transfer, such as signature-based.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeTransfer(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) internal virtual {
        _transfer(from, to, tokenId);
        require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
    }

    /**
     * @dev Returns whether `tokenId` exists.
     *
     * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
     *
     * Tokens start existing when they are minted (`_mint`),
     * and stop existing when they are burned (`_burn`).
     */
    function _exists(uint256 tokenId) internal view virtual returns (bool) {
        return _owners[tokenId] != address(0);
    }

    /**
     * @dev Returns whether `spender` is allowed to manage `tokenId`.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {
        require(_exists(tokenId), "ERC721: operator query for nonexistent token");
        address owner = ERC721.ownerOf(tokenId);
        return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender));
    }

    /**
     * @dev Safely mints `tokenId` and transfers it to `to`.
     *
     * Requirements:
     *
     * - `tokenId` must not exist.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeMint(address to, uint256 tokenId) internal virtual {
        _safeMint(to, tokenId, "");
    }

    /**
     * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is
     * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
     */
    function _safeMint(
        address to,
        uint256 tokenId,
        bytes memory _data
    ) internal virtual {
        _mint(to, tokenId);
        require(
            _checkOnERC721Received(address(0), to, tokenId, _data),
            "ERC721: transfer to non ERC721Receiver implementer"
        );
    }

    /**
     * @dev Mints `tokenId` and transfers it to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
     *
     * Requirements:
     *
     * - `tokenId` must not exist.
     * - `to` cannot be the zero address.
     *
     * Emits a {Transfer} event.
     */
    function _mint(address to, uint256 tokenId) internal virtual {
        require(to != address(0), "ERC721: mint to the zero address");
        require(!_exists(tokenId), "ERC721: token already minted");

        _beforeTokenTransfer(address(0), to, tokenId);

        _balances[to] += 1;
        _owners[tokenId] = to;

        emit Transfer(address(0), to, tokenId);
    }

    /**
     * @dev Destroys `tokenId`.
     * The approval is cleared when the token is burned.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     *
     * Emits a {Transfer} event.
     */
    function _burn(uint256 tokenId) internal virtual {
        address owner = ERC721.ownerOf(tokenId);

        _beforeTokenTransfer(owner, address(0), tokenId);

        // Clear approvals
        _approve(address(0), tokenId);

        _balances[owner] -= 1;
        delete _owners[tokenId];

        emit Transfer(owner, address(0), tokenId);
    }

    /**
     * @dev Transfers `tokenId` from `from` to `to`.
     *  As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     *
     * Emits a {Transfer} event.
     */
    function _transfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual {
        require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own");
        require(to != address(0), "ERC721: transfer to the zero address");

        _beforeTokenTransfer(from, to, tokenId);

        // Clear approvals from the previous owner
        _approve(address(0), tokenId);

        _balances[from] -= 1;
        _balances[to] += 1;
        _owners[tokenId] = to;

        emit Transfer(from, to, tokenId);
    }

    /**
     * @dev Approve `to` to operate on `tokenId`
     *
     * Emits a {Approval} event.
     */
    function _approve(address to, uint256 tokenId) internal virtual {
        _tokenApprovals[tokenId] = to;
        emit Approval(ERC721.ownerOf(tokenId), to, tokenId);
    }

    /**
     * @dev Approve `operator` to operate on all of `owner` tokens
     *
     * Emits a {ApprovalForAll} event.
     */
    function _setApprovalForAll(
        address owner,
        address operator,
        bool approved
    ) internal virtual {
        require(owner != operator, "ERC721: approve to caller");
        _operatorApprovals[owner][operator] = approved;
        emit ApprovalForAll(owner, operator, approved);
    }

    /**
     * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
     * The call is not executed if the target address is not a contract.
     *
     * @param from address representing the previous owner of the given token ID
     * @param to target address that will receive the tokens
     * @param tokenId uint256 ID of the token to be transferred
     * @param _data bytes optional data to send along with the call
     * @return bool whether the call correctly returned the expected magic value
     */
    function _checkOnERC721Received(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) private returns (bool) {
        if (to.isContract()) {
            try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {
                return retval == IERC721Receiver.onERC721Received.selector;
            } catch (bytes memory reason) {
                if (reason.length == 0) {
                    revert("ERC721: transfer to non ERC721Receiver implementer");
                } else {
                    assembly {
                        revert(add(32, reason), mload(reason))
                    }
                }
            }
        } else {
            return true;
        }
    }

    /**
     * @dev Hook that is called before any token transfer. This includes minting
     * and burning.
     *
     * Calling conditions:
     *
     * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be
     * transferred to `to`.
     * - When `from` is zero, `tokenId` will be minted for `to`.
     * - When `to` is zero, ``from``'s `tokenId` will be burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual {}
}

File 19 of 50 : IERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol)

pragma solidity ^0.8.0;

import "../../utils/introspection/IERC165.sol";

/**
 * @dev Required interface of an ERC721 compliant contract.
 */
interface IERC721 is IERC165 {
    /**
     * @dev Emitted when `tokenId` token is transferred from `from` to `to`.
     */
    event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
     */
    event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
     */
    event ApprovalForAll(address indexed owner, address indexed operator, bool approved);

    /**
     * @dev Returns the number of tokens in ``owner``'s account.
     */
    function balanceOf(address owner) external view returns (uint256 balance);

    /**
     * @dev Returns the owner of the `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function ownerOf(uint256 tokenId) external view returns (address owner);

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
     * are aware of the ERC721 protocol to prevent tokens from being forever locked.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

    /**
     * @dev Transfers `tokenId` token from `from` to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

    /**
     * @dev Gives permission to `to` to transfer `tokenId` token to another account.
     * The approval is cleared when the token is transferred.
     *
     * Only a single account can be approved at a time, so approving the zero address clears previous approvals.
     *
     * Requirements:
     *
     * - The caller must own the token or be an approved operator.
     * - `tokenId` must exist.
     *
     * Emits an {Approval} event.
     */
    function approve(address to, uint256 tokenId) external;

    /**
     * @dev Returns the account approved for `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function getApproved(uint256 tokenId) external view returns (address operator);

    /**
     * @dev Approve or remove `operator` as an operator for the caller.
     * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
     *
     * Requirements:
     *
     * - The `operator` cannot be the caller.
     *
     * Emits an {ApprovalForAll} event.
     */
    function setApprovalForAll(address operator, bool _approved) external;

    /**
     * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
     *
     * See {setApprovalForAll}
     */
    function isApprovedForAll(address owner, address operator) external view returns (bool);

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes calldata data
    ) external;
}

File 20 of 50 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
}

File 21 of 50 : IERC721Receiver.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol)

pragma solidity ^0.8.0;

/**
 * @title ERC721 token receiver interface
 * @dev Interface for any contract that wants to support safeTransfers
 * from ERC721 asset contracts.
 */
interface IERC721Receiver {
    /**
     * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
     * by `operator` from `from`, this function is called.
     *
     * It must return its Solidity selector to confirm the token transfer.
     * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
     *
     * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`.
     */
    function onERC721Received(
        address operator,
        address from,
        uint256 tokenId,
        bytes calldata data
    ) external returns (bytes4);
}

File 22 of 50 : ERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)

pragma solidity ^0.8.0;

import "./IERC165.sol";

/**
 * @dev Implementation of the {IERC165} interface.
 *
 * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
 * for the additional interface id that will be supported. For example:
 *
 * ```solidity
 * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
 *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
 * }
 * ```
 *
 * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
 */
abstract contract ERC165 is IERC165 {
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IERC165).interfaceId;
    }
}

File 23 of 50 : IERC721Metadata.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)

pragma solidity ^0.8.0;

import "../IERC721.sol";

/**
 * @title ERC-721 Non-Fungible Token Standard, optional metadata extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721Metadata is IERC721 {
    /**
     * @dev Returns the token collection name.
     */
    function name() external view returns (string memory);

    /**
     * @dev Returns the token collection symbol.
     */
    function symbol() external view returns (string memory);

    /**
     * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
     */
    function tokenURI(uint256 tokenId) external view returns (string memory);
}

File 24 of 50 : IReferralHub.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.4;

interface IReferralHub {
    event ControllerAdded(address indexed controller);
    event ControllerRemoved(address indexed controller);
    event NewReferralRecord(bytes32 indexed referralNodeHash);
    event depositRecord(address indexed addr, uint256 amount);
    event withdrawRecord(address indexed addr, uint256 amount);
    

    //Authorises a controller, who can issue a gift card.
    function addController(address controller) external;

    // Revoke controller permission for an address.
    function removeController(address controller) external;

    //check if a domain name is eligible for referral program
    function isReferralEligible(
        bytes32 nodeHash
    ) external view returns (bool, address);

    //add a referral count for a given referrer
    function addNewReferralRecord(bytes32 referrerNodeHash) external;

    //get a domain's referral count, referral comission and referee comission
    function getReferralDetails(bytes32 referrerNodeHash)
        external
        view
        returns (
            uint256,
            uint256,
            uint256,
            uint256
        );

    //set partner comission chart
    function setPartnerComissionChart(
        string calldata name,
        string calldata tld,
        uint256 minimumReferralCount,
        uint256 referrerComission,
        uint256 refereeComission
    ) external;

    function getReferralCommisionFee(uint256 price, bytes32 nodeHash) external view returns (uint256, uint256);

    function deposit(address _referrer) external payable;

    function withdraw() external;
}

File 25 of 50 : IReverseRegistrar.sol
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);
}

File 26 of 50 : NameResolver.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.4;

import "../ResolverBase.sol";
import "./INameResolver.sol";

abstract contract NameResolver is INameResolver, ResolverBase {
    mapping(bytes32=>string) 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) virtual external authorised(node) {
        names[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) virtual override external view returns (string memory) {
        return names[node];
    }

    function supportsInterface(bytes4 interfaceID) virtual override public pure returns(bool) {
        return interfaceID == type(INameResolver).interfaceId || super.supportsInterface(interfaceID);
    }
}

File 27 of 50 : AddrResolver.sol
// 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 constant private COIN_TYPE_ARB1 = 2147525809;
    uint256 constant private COIN_TYPE_ARB_NOVA = 2147525809;


    mapping(bytes32=>mapping(uint=>bytes)) _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) virtual external authorised(node) {
        setAddr(node, COIN_TYPE_ARB1, addressToBytes(a));
    }

    function setAddr(bytes32 node, uint coinType, address a) virtual external authorised(node) {
        setAddr(node, coinType, 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) virtual override public view returns (address payable) {
        bytes memory a = addr(node, COIN_TYPE_ARB1);
        if(a.length == 0) {
            return payable(0);
        }
        return bytesToAddress(a);
    }
    
    function setAddr(bytes32 node, uint coinType, bytes memory a) virtual public authorised(node) {
        emit AddressChanged(node, coinType, a);        
        _addresses[node][coinType] = a;
    }

    function addr(bytes32 node, uint coinType) virtual override public view returns(bytes memory) {
        return _addresses[node][coinType];
    }

    function supportsInterface(bytes4 interfaceID) virtual override public pure 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)))
        }
    }
}

File 28 of 50 : ResolverBase.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.4;

import "./SupportsInterface.sol";

abstract contract ResolverBase is SupportsInterface {
    function isAuthorised(bytes32 node) internal virtual view returns(bool);

    modifier authorised(bytes32 node) {
        require(isAuthorised(node));
        _;
    }
}

File 29 of 50 : INameResolver.sol
// 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);
}

File 30 of 50 : SupportsInterface.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

import "./ISupportsInterface.sol";

abstract contract SupportsInterface is ISupportsInterface {
    function supportsInterface(bytes4 interfaceID) virtual override public pure returns(bool) {
        return interfaceID == type(ISupportsInterface).interfaceId;
    }
}

File 31 of 50 : ISupportsInterface.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

interface ISupportsInterface {
    function supportsInterface(bytes4 interfaceID) external pure returns(bool);
}

File 32 of 50 : IAddressResolver.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.4;

/**
 * Interface for the new (multicoin) addr function.
 */
interface IAddressResolver {
    event AddressChanged(bytes32 indexed node, uint coinType, bytes newAddress);

    function addr(bytes32 node, uint coinType) external view returns(bytes memory);
}

File 33 of 50 : IAddrResolver.sol
// 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);
}

File 34 of 50 : Pausable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/Pausable.sol)

pragma solidity ^0.8.0;

import "../utils/Context.sol";

/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract Pausable is Context {
    /**
     * @dev Emitted when the pause is triggered by `account`.
     */
    event Paused(address account);

    /**
     * @dev Emitted when the pause is lifted by `account`.
     */
    event Unpaused(address account);

    bool private _paused;

    /**
     * @dev Initializes the contract in unpaused state.
     */
    constructor() {
        _paused = false;
    }

    /**
     * @dev Returns true if the contract is paused, and false otherwise.
     */
    function paused() public view virtual returns (bool) {
        return _paused;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is not paused.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    modifier whenNotPaused() {
        require(!paused(), "Pausable: paused");
        _;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is paused.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    modifier whenPaused() {
        require(paused(), "Pausable: not paused");
        _;
    }

    /**
     * @dev Triggers stopped state.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    function _pause() internal virtual whenNotPaused {
        _paused = true;
        emit Paused(_msgSender());
    }

    /**
     * @dev Returns to normal state.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    function _unpause() internal virtual whenPaused {
        _paused = false;
        emit Unpaused(_msgSender());
    }
}

File 35 of 50 : ECDSA.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/cryptography/ECDSA.sol)

pragma solidity ^0.8.0;

import "../Strings.sol";

/**
 * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
 *
 * These functions can be used to verify that a message was signed by the holder
 * of the private keys of a given address.
 */
library ECDSA {
    enum RecoverError {
        NoError,
        InvalidSignature,
        InvalidSignatureLength,
        InvalidSignatureS,
        InvalidSignatureV
    }

    function _throwError(RecoverError error) private pure {
        if (error == RecoverError.NoError) {
            return; // no error: do nothing
        } else if (error == RecoverError.InvalidSignature) {
            revert("ECDSA: invalid signature");
        } else if (error == RecoverError.InvalidSignatureLength) {
            revert("ECDSA: invalid signature length");
        } else if (error == RecoverError.InvalidSignatureS) {
            revert("ECDSA: invalid signature 's' value");
        } else if (error == RecoverError.InvalidSignatureV) {
            revert("ECDSA: invalid signature 'v' value");
        }
    }

    /**
     * @dev Returns the address that signed a hashed message (`hash`) with
     * `signature` or error string. This address can then be used for verification purposes.
     *
     * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
     * this function rejects them by requiring the `s` value to be in the lower
     * half order, and the `v` value to be either 27 or 28.
     *
     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
     * verification to be secure: it is possible to craft signatures that
     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
     * this is by receiving a hash of the original message (which may otherwise
     * be too long), and then calling {toEthSignedMessageHash} on it.
     *
     * Documentation for signature generation:
     * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]
     * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]
     *
     * _Available since v4.3._
     */
    function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {
        // Check the signature length
        // - case 65: r,s,v signature (standard)
        // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._
        if (signature.length == 65) {
            bytes32 r;
            bytes32 s;
            uint8 v;
            // ecrecover takes the signature parameters, and the only way to get them
            // currently is to use assembly.
            assembly {
                r := mload(add(signature, 0x20))
                s := mload(add(signature, 0x40))
                v := byte(0, mload(add(signature, 0x60)))
            }
            return tryRecover(hash, v, r, s);
        } else if (signature.length == 64) {
            bytes32 r;
            bytes32 vs;
            // ecrecover takes the signature parameters, and the only way to get them
            // currently is to use assembly.
            assembly {
                r := mload(add(signature, 0x20))
                vs := mload(add(signature, 0x40))
            }
            return tryRecover(hash, r, vs);
        } else {
            return (address(0), RecoverError.InvalidSignatureLength);
        }
    }

    /**
     * @dev Returns the address that signed a hashed message (`hash`) with
     * `signature`. This address can then be used for verification purposes.
     *
     * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
     * this function rejects them by requiring the `s` value to be in the lower
     * half order, and the `v` value to be either 27 or 28.
     *
     * IMPORTANT: `hash` _must_ be the result of a hash operation for the
     * verification to be secure: it is possible to craft signatures that
     * recover to arbitrary addresses for non-hashed data. A safe way to ensure
     * this is by receiving a hash of the original message (which may otherwise
     * be too long), and then calling {toEthSignedMessageHash} on it.
     */
    function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, signature);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.
     *
     * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]
     *
     * _Available since v4.3._
     */
    function tryRecover(
        bytes32 hash,
        bytes32 r,
        bytes32 vs
    ) internal pure returns (address, RecoverError) {
        bytes32 s;
        uint8 v;
        assembly {
            s := and(vs, 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff)
            v := add(shr(255, vs), 27)
        }
        return tryRecover(hash, v, r, s);
    }

    /**
     * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.
     *
     * _Available since v4.2._
     */
    function recover(
        bytes32 hash,
        bytes32 r,
        bytes32 vs
    ) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, r, vs);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Overload of {ECDSA-tryRecover} that receives the `v`,
     * `r` and `s` signature fields separately.
     *
     * _Available since v4.3._
     */
    function tryRecover(
        bytes32 hash,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal pure returns (address, RecoverError) {
        // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
        // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
        // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most
        // signatures from current libraries generate a unique signature with an s-value in the lower half order.
        //
        // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
        // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
        // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
        // these malleable signatures as well.
        if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
            return (address(0), RecoverError.InvalidSignatureS);
        }
        if (v != 27 && v != 28) {
            return (address(0), RecoverError.InvalidSignatureV);
        }

        // If the signature is valid (and not malleable), return the signer address
        address signer = ecrecover(hash, v, r, s);
        if (signer == address(0)) {
            return (address(0), RecoverError.InvalidSignature);
        }

        return (signer, RecoverError.NoError);
    }

    /**
     * @dev Overload of {ECDSA-recover} that receives the `v`,
     * `r` and `s` signature fields separately.
     */
    function recover(
        bytes32 hash,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal pure returns (address) {
        (address recovered, RecoverError error) = tryRecover(hash, v, r, s);
        _throwError(error);
        return recovered;
    }

    /**
     * @dev Returns an Ethereum Signed Message, created from a `hash`. This
     * produces hash corresponding to the one signed with the
     * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
     * JSON-RPC method as part of EIP-191.
     *
     * See {recover}.
     */
    function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {
        // 32 is the length in bytes of hash,
        // enforced by the type signature above
        return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash));
    }

    /**
     * @dev Returns an Ethereum Signed Message, created from `s`. This
     * produces hash corresponding to the one signed with the
     * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
     * JSON-RPC method as part of EIP-191.
     *
     * See {recover}.
     */
    function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {
        return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s));
    }

    /**
     * @dev Returns an Ethereum Signed Typed Data, created from a
     * `domainSeparator` and a `structHash`. This produces hash corresponding
     * to the one signed with the
     * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]
     * JSON-RPC method as part of EIP-712.
     *
     * See {recover}.
     */
    function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {
        return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
    }
}

File 36 of 50 : draft-EIP712.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/cryptography/draft-EIP712.sol)

pragma solidity ^0.8.0;

import "./ECDSA.sol";

/**
 * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.
 *
 * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,
 * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding
 * they need in their contracts using a combination of `abi.encode` and `keccak256`.
 *
 * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding
 * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA
 * ({_hashTypedDataV4}).
 *
 * The implementation of the domain separator was designed to be as efficient as possible while still properly updating
 * the chain id to protect against replay attacks on an eventual fork of the chain.
 *
 * NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method
 * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].
 *
 * _Available since v3.4._
 */
abstract contract EIP712 {
    /* solhint-disable var-name-mixedcase */
    // Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to
    // invalidate the cached domain separator if the chain id changes.
    bytes32 private immutable _CACHED_DOMAIN_SEPARATOR;
    uint256 private immutable _CACHED_CHAIN_ID;
    address private immutable _CACHED_THIS;

    bytes32 private immutable _HASHED_NAME;
    bytes32 private immutable _HASHED_VERSION;
    bytes32 private immutable _TYPE_HASH;

    /* solhint-enable var-name-mixedcase */

    /**
     * @dev Initializes the domain separator and parameter caches.
     *
     * The meaning of `name` and `version` is specified in
     * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:
     *
     * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.
     * - `version`: the current major version of the signing domain.
     *
     * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart
     * contract upgrade].
     */
    constructor(string memory name, string memory version) {
        bytes32 hashedName = keccak256(bytes(name));
        bytes32 hashedVersion = keccak256(bytes(version));
        bytes32 typeHash = keccak256(
            "EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"
        );
        _HASHED_NAME = hashedName;
        _HASHED_VERSION = hashedVersion;
        _CACHED_CHAIN_ID = block.chainid;
        _CACHED_DOMAIN_SEPARATOR = _buildDomainSeparator(typeHash, hashedName, hashedVersion);
        _CACHED_THIS = address(this);
        _TYPE_HASH = typeHash;
    }

    /**
     * @dev Returns the domain separator for the current chain.
     */
    function _domainSeparatorV4() internal view returns (bytes32) {
        if (address(this) == _CACHED_THIS && block.chainid == _CACHED_CHAIN_ID) {
            return _CACHED_DOMAIN_SEPARATOR;
        } else {
            return _buildDomainSeparator(_TYPE_HASH, _HASHED_NAME, _HASHED_VERSION);
        }
    }

    function _buildDomainSeparator(
        bytes32 typeHash,
        bytes32 nameHash,
        bytes32 versionHash
    ) private view returns (bytes32) {
        return keccak256(abi.encode(typeHash, nameHash, versionHash, block.chainid, address(this)));
    }

    /**
     * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this
     * function returns the hash of the fully encoded EIP712 message for this domain.
     *
     * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:
     *
     * ```solidity
     * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(
     *     keccak256("Mail(address to,string contents)"),
     *     mailTo,
     *     keccak256(bytes(mailContents))
     * )));
     * address signer = ECDSA.recover(digest, signature);
     * ```
     */
    function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {
        return ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash);
    }
}

File 37 of 50 : SidGiftCardRegistrar.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.4;
import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "./ISidGiftCardRegistrar.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/security/Pausable.sol";

contract SidGiftCardRegistrar is ERC1155, ISidGiftCardRegistrar, Ownable, Pausable {
    mapping(address => bool) public controllers;

    constructor() ERC1155("") {}

    modifier onlyController() {
        require(controllers[msg.sender], "Not a authorized controller");
        _;
    }

    function setURI(string calldata newURI) external onlyOwner {
        _setURI(newURI);
    }

    function uri(uint256 _id) public view virtual override(ERC1155) returns (string memory) {
        return string(abi.encodePacked(ERC1155.uri(_id), Strings.toString(_id)));
    }

    function name() public view virtual returns (string memory) {
        return "SPACE ID Gift Card";
    }

    function symbol() public view virtual returns (string memory) {
        return "SIDGC";
    }

    function register(
        address to,
        uint256 id,
        uint256 amount
    ) external onlyController whenNotPaused returns (uint256, uint256) {
        super._mint(to, id, amount, "");
        return (id, amount);
    }

    function batchRegister(
        address to,
        uint256[] calldata ids,
        uint256[] calldata amounts
    ) external onlyController whenNotPaused {
        require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");
        for (uint256 i = 0; i < ids.length; i++) {
            if (amounts[i] > 0) {
                super._mint(to, ids[i], amounts[i], "");
            }
        }
    }

    function batchBurn(
        address account,
        uint256[] calldata ids,
        uint256[] calldata amounts
    ) external onlyController whenNotPaused {
        require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");
        for (uint256 i = 0; i < ids.length; i++) {
            if (amounts[i] > 0) {
                super._burn(account, ids[i], amounts[i]);
            }
        }
    }

    function addController(address controller) external override onlyOwner {
        require(controller != address(0), "address can not be zero!");
        controllers[controller] = true;
        emit ControllerAdded(controller);
    }

    function removeController(address controller) external override onlyOwner {
        require(controller != address(0), "address can not be zero!");
        controllers[controller] = false;
        emit ControllerRemoved(controller);
    }

    function pause() external onlyOwner {
        _pause();
    }

    function unpause() external onlyOwner {
        _unpause();
    }

    function safeBatchTransferFrom(
        address from,
        address to,
        uint256[] calldata ids,
        uint256[] calldata amounts,
        bytes calldata data
    ) public virtual whenNotPaused override(ERC1155, IERC1155) {
        require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");
        for (uint256 i = 0; i < ids.length; i++) {
            if (amounts[i] > 0) {
                super.safeTransferFrom(from, to, ids[i], amounts[i], data);
            }
        }
    }
}

File 38 of 50 : SidGiftCardVoucher.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.4;
import "@openzeppelin/contracts/access/Ownable.sol";

contract SidGiftCardVoucher is Ownable {
    uint256 public constant THREE_DIGIT_VOUCHER = 0;
    uint256 public constant FOUR_DIGIT_VOUCHER = 1;
    uint256 public constant FIVE_DIGIT_VOUCHER = 2;

    uint256 public constant THREE_DIGIT_VOUCHER_VALUE = 500 * (10**18);
    uint256 public constant FOUR_DIGIT_VOUCHER_VALUE = 100 * (10**18);
    uint256 public constant FIVE_DIGIT_VOUCHER_VALUE = 5 * (10**18);

    mapping(uint256 => uint256) public voucherValues;

    constructor() {
        voucherValues[THREE_DIGIT_VOUCHER] = THREE_DIGIT_VOUCHER_VALUE;
        voucherValues[FOUR_DIGIT_VOUCHER] = FOUR_DIGIT_VOUCHER_VALUE;
        voucherValues[FIVE_DIGIT_VOUCHER] = FIVE_DIGIT_VOUCHER_VALUE;
    }

    function addCustomizedVoucher(uint256 tokenId, uint256 price) external onlyOwner {
        require(voucherValues[tokenId] == 0, "voucher already exsits");
        voucherValues[tokenId] = price;
    }
    
    function totalValue(uint256[] calldata ids, uint256[] calldata amounts) external view returns (uint256) {
        uint256 total = 0;
        for (uint256 i = 0; i < ids.length; i++) {
            total += voucherValues[ids[i]] * amounts[i];
        }
        return total;
    }

    function isValidVoucherIds(uint256[] calldata id) external view returns (bool) {
        for (uint256 i = 0; i < id.length; i++) {
            if (voucherValues[id[i]] == 0) {
                return false;
            }
        }
        return true;
    }
}

File 39 of 50 : ISidGiftCardRegistrar.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.4;
import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";

interface ISidGiftCardRegistrar is IERC1155 {
    event ControllerAdded(address indexed controller);
    event ControllerRemoved(address indexed controller);

    //Authorises a controller, who can issue a gift card.
    function addController(address controller) external;

    // Revoke controller permission for an address.
    function removeController(address controller) external;

    //Register new gift card voucher
    function register(
        address to,
        uint256 id,
        uint256 amount
    ) external returns (uint256, uint256);

    //batch register new gift card voucher
    function batchRegister(
        address to,
        uint256[] calldata ids,
        uint256[] calldata amounts
    ) external;
}

File 40 of 50 : ERC1155.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC1155/ERC1155.sol)

pragma solidity ^0.8.0;

import "./IERC1155.sol";
import "./IERC1155Receiver.sol";
import "./extensions/IERC1155MetadataURI.sol";
import "../../utils/Address.sol";
import "../../utils/Context.sol";
import "../../utils/introspection/ERC165.sol";

/**
 * @dev Implementation of the basic standard multi-token.
 * See https://eips.ethereum.org/EIPS/eip-1155
 * Originally based on code by Enjin: https://github.com/enjin/erc-1155
 *
 * _Available since v3.1._
 */
contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI {
    using Address for address;

    // Mapping from token ID to account balances
    mapping(uint256 => mapping(address => uint256)) private _balances;

    // Mapping from account to operator approvals
    mapping(address => mapping(address => bool)) private _operatorApprovals;

    // Used as the URI for all token types by relying on ID substitution, e.g. https://token-cdn-domain/{id}.json
    string private _uri;

    /**
     * @dev See {_setURI}.
     */
    constructor(string memory uri_) {
        _setURI(uri_);
    }

    /**
     * @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 {IERC1155MetadataURI-uri}.
     *
     * This implementation returns the same URI for *all* token types. It relies
     * on the token type ID substitution mechanism
     * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].
     *
     * Clients calling this function must replace the `\{id\}` substring with the
     * actual token type ID.
     */
    function uri(uint256) public view virtual override returns (string memory) {
        return _uri;
    }

    /**
     * @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");
        return _balances[id][account];
    }

    /**
     * @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 {
        _setApprovalForAll(_msgSender(), operator, approved);
    }

    /**
     * @dev See {IERC1155-isApprovedForAll}.
     */
    function isApprovedForAll(address account, address operator) public view virtual override returns (bool) {
        return _operatorApprovals[account][operator];
    }

    /**
     * @dev See {IERC1155-safeTransferFrom}.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 id,
        uint256 amount,
        bytes memory data
    ) public virtual override {
        require(
            from == _msgSender() || isApprovedForAll(from, _msgSender()),
            "ERC1155: caller is not owner nor approved"
        );
        _safeTransferFrom(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(
            from == _msgSender() || isApprovedForAll(from, _msgSender()),
            "ERC1155: transfer caller is not owner nor approved"
        );
        _safeBatchTransferFrom(from, to, ids, amounts, data);
    }

    /**
     * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - `from` must have a balance of tokens of type `id` of at least `amount`.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
     * acceptance magic value.
     */
    function _safeTransferFrom(
        address from,
        address to,
        uint256 id,
        uint256 amount,
        bytes memory data
    ) internal virtual {
        require(to != address(0), "ERC1155: transfer to the zero address");

        address operator = _msgSender();

        _beforeTokenTransfer(operator, from, to, _asSingletonArray(id), _asSingletonArray(amount), data);

        uint256 fromBalance = _balances[id][from];
        require(fromBalance >= amount, "ERC1155: insufficient balance for transfer");
        unchecked {
            _balances[id][from] = fromBalance - amount;
        }
        _balances[id][to] += amount;

        emit TransferSingle(operator, from, to, id, amount);

        _doSafeTransferAcceptanceCheck(operator, from, to, id, amount, data);
    }

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_safeTransferFrom}.
     *
     * Emits a {TransferBatch} event.
     *
     * Requirements:
     *
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
     * acceptance magic value.
     */
    function _safeBatchTransferFrom(
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) internal virtual {
        require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");
        require(to != address(0), "ERC1155: transfer to the zero address");

        address operator = _msgSender();

        _beforeTokenTransfer(operator, from, to, ids, amounts, data);

        for (uint256 i = 0; i < ids.length; ++i) {
            uint256 id = ids[i];
            uint256 amount = amounts[i];

            uint256 fromBalance = _balances[id][from];
            require(fromBalance >= amount, "ERC1155: insufficient balance for transfer");
            unchecked {
                _balances[id][from] = fromBalance - amount;
            }
            _balances[id][to] += amount;
        }

        emit TransferBatch(operator, from, to, ids, amounts);

        _doSafeBatchTransferAcceptanceCheck(operator, from, to, ids, amounts, data);
    }

    /**
     * @dev Sets a new URI for all token types, by relying on the token type ID
     * substitution mechanism
     * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].
     *
     * By this mechanism, any occurrence of the `\{id\}` substring in either the
     * URI or any of the amounts in the JSON file at said URI will be replaced by
     * clients with the token type ID.
     *
     * For example, the `https://token-cdn-domain/\{id\}.json` URI would be
     * interpreted by clients as
     * `https://token-cdn-domain/000000000000000000000000000000000000000000000000000000000004cce0.json`
     * for token type ID 0x4cce0.
     *
     * See {uri}.
     *
     * Because these URIs cannot be meaningfully represented by the {URI} event,
     * this function emits no events.
     */
    function _setURI(string memory newuri) internal virtual {
        _uri = newuri;
    }

    /**
     * @dev Creates `amount` tokens of token type `id`, and assigns them to `to`.
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
     * acceptance magic value.
     */
    function _mint(
        address to,
        uint256 id,
        uint256 amount,
        bytes memory data
    ) internal virtual {
        require(to != address(0), "ERC1155: mint to the zero address");

        address operator = _msgSender();

        _beforeTokenTransfer(operator, address(0), to, _asSingletonArray(id), _asSingletonArray(amount), data);

        _balances[id][to] += amount;
        emit TransferSingle(operator, address(0), to, id, amount);

        _doSafeTransferAcceptanceCheck(operator, address(0), to, id, amount, data);
    }

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_mint}.
     *
     * Requirements:
     *
     * - `ids` and `amounts` must have the same length.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
     * acceptance magic value.
     */
    function _mintBatch(
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) internal virtual {
        require(to != address(0), "ERC1155: mint to the zero address");
        require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");

        address operator = _msgSender();

        _beforeTokenTransfer(operator, address(0), to, ids, amounts, data);

        for (uint256 i = 0; i < ids.length; i++) {
            _balances[ids[i]][to] += amounts[i];
        }

        emit TransferBatch(operator, address(0), to, ids, amounts);

        _doSafeBatchTransferAcceptanceCheck(operator, address(0), to, ids, amounts, data);
    }

    /**
     * @dev Destroys `amount` tokens of token type `id` from `from`
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `from` must have at least `amount` tokens of token type `id`.
     */
    function _burn(
        address from,
        uint256 id,
        uint256 amount
    ) internal virtual {
        require(from != address(0), "ERC1155: burn from the zero address");

        address operator = _msgSender();

        _beforeTokenTransfer(operator, from, address(0), _asSingletonArray(id), _asSingletonArray(amount), "");

        uint256 fromBalance = _balances[id][from];
        require(fromBalance >= amount, "ERC1155: burn amount exceeds balance");
        unchecked {
            _balances[id][from] = fromBalance - amount;
        }

        emit TransferSingle(operator, from, address(0), id, amount);
    }

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_burn}.
     *
     * Requirements:
     *
     * - `ids` and `amounts` must have the same length.
     */
    function _burnBatch(
        address from,
        uint256[] memory ids,
        uint256[] memory amounts
    ) internal virtual {
        require(from != address(0), "ERC1155: burn from the zero address");
        require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");

        address operator = _msgSender();

        _beforeTokenTransfer(operator, from, address(0), ids, amounts, "");

        for (uint256 i = 0; i < ids.length; i++) {
            uint256 id = ids[i];
            uint256 amount = amounts[i];

            uint256 fromBalance = _balances[id][from];
            require(fromBalance >= amount, "ERC1155: burn amount exceeds balance");
            unchecked {
                _balances[id][from] = fromBalance - amount;
            }
        }

        emit TransferBatch(operator, from, address(0), ids, amounts);
    }

    /**
     * @dev Approve `operator` to operate on all of `owner` tokens
     *
     * Emits a {ApprovalForAll} event.
     */
    function _setApprovalForAll(
        address owner,
        address operator,
        bool approved
    ) internal virtual {
        require(owner != operator, "ERC1155: setting approval status for self");
        _operatorApprovals[owner][operator] = approved;
        emit ApprovalForAll(owner, operator, approved);
    }

    /**
     * @dev Hook that is called before any token transfer. This includes minting
     * and burning, as well as batched variants.
     *
     * The same hook is called on both single and batched variants. For single
     * transfers, the length of the `id` and `amount` arrays will be 1.
     *
     * Calling conditions (for each `id` and `amount` pair):
     *
     * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * of token type `id` will be  transferred to `to`.
     * - When `from` is zero, `amount` tokens of token type `id` will be minted
     * for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens of token type `id`
     * will be burned.
     * - `from` and `to` are never both zero.
     * - `ids` and `amounts` have the same, non-zero length.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(
        address operator,
        address from,
        address to,
        uint256[] memory ids,
        uint256[] memory amounts,
        bytes memory data
    ) internal virtual {}

    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.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.onERC1155BatchReceived.selector) {
                    revert("ERC1155: ERC1155Receiver rejected tokens");
                }
            } catch Error(string memory reason) {
                revert(reason);
            } catch {
                revert("ERC1155: transfer to non ERC1155Receiver implementer");
            }
        }
    }

    function _asSingletonArray(uint256 element) private pure returns (uint256[] memory) {
        uint256[] memory array = new uint256[](1);
        array[0] = element;

        return array;
    }
}

File 41 of 50 : IERC1155.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC1155/IERC1155.sol)

pragma solidity ^0.8.0;

import "../../utils/introspection/IERC165.sol";

/**
 * @dev Required interface of an ERC1155 compliant contract, as defined in the
 * https://eips.ethereum.org/EIPS/eip-1155[EIP].
 *
 * _Available since v3.1._
 */
interface IERC1155 is IERC165 {
    /**
     * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.
     */
    event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);

    /**
     * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all
     * transfers.
     */
    event TransferBatch(
        address indexed operator,
        address indexed from,
        address indexed to,
        uint256[] ids,
        uint256[] values
    );

    /**
     * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to
     * `approved`.
     */
    event ApprovalForAll(address indexed account, address indexed operator, bool approved);

    /**
     * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.
     *
     * If an {URI} event was emitted for `id`, the standard
     * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value
     * returned by {IERC1155MetadataURI-uri}.
     */
    event URI(string value, uint256 indexed id);

    /**
     * @dev Returns the amount of tokens of token type `id` owned by `account`.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function balanceOf(address account, uint256 id) external view returns (uint256);

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.
     *
     * Requirements:
     *
     * - `accounts` and `ids` must have the same length.
     */
    function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)
        external
        view
        returns (uint256[] memory);

    /**
     * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,
     *
     * Emits an {ApprovalForAll} event.
     *
     * Requirements:
     *
     * - `operator` cannot be the caller.
     */
    function setApprovalForAll(address operator, bool approved) external;

    /**
     * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.
     *
     * See {setApprovalForAll}.
     */
    function isApprovedForAll(address account, address operator) external view returns (bool);

    /**
     * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - If the caller is not `from`, it must be have been approved to spend ``from``'s tokens via {setApprovalForAll}.
     * - `from` must have a balance of tokens of type `id` of at least `amount`.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
     * acceptance magic value.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 id,
        uint256 amount,
        bytes calldata data
    ) external;

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.
     *
     * Emits a {TransferBatch} event.
     *
     * Requirements:
     *
     * - `ids` and `amounts` must have the same length.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
     * acceptance magic value.
     */
    function safeBatchTransferFrom(
        address from,
        address to,
        uint256[] calldata ids,
        uint256[] calldata amounts,
        bytes calldata data
    ) external;
}

File 42 of 50 : IERC1155Receiver.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC1155/IERC1155Receiver.sol)

pragma solidity ^0.8.0;

import "../../utils/introspection/IERC165.sol";

/**
 * @dev _Available since v3.1._
 */
interface IERC1155Receiver is IERC165 {
    /**
        @dev Handles the receipt of a single ERC1155 token type. This function is
        called at the end of a `safeTransferFrom` after the balance has been updated.
        To accept the transfer, this must return
        `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))`
        (i.e. 0xf23a6e61, or its own function selector).
        @param operator The address which initiated the transfer (i.e. msg.sender)
        @param from The address which previously owned the token
        @param id The ID of the token being transferred
        @param value The amount of tokens being transferred
        @param data Additional data with no specified format
        @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed
    */
    function onERC1155Received(
        address operator,
        address from,
        uint256 id,
        uint256 value,
        bytes calldata data
    ) external returns (bytes4);

    /**
        @dev Handles the receipt of a multiple ERC1155 token types. This function
        is called at the end of a `safeBatchTransferFrom` after the balances have
        been updated. To accept the transfer(s), this must return
        `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))`
        (i.e. 0xbc197c81, or its own function selector).
        @param operator The address which initiated the batch transfer (i.e. msg.sender)
        @param from The address which previously owned the token
        @param ids An array containing ids of each token being transferred (order and length must match values array)
        @param values An array containing amounts of each token being transferred (order and length must match ids array)
        @param data Additional data with no specified format
        @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed
    */
    function onERC1155BatchReceived(
        address operator,
        address from,
        uint256[] calldata ids,
        uint256[] calldata values,
        bytes calldata data
    ) external returns (bytes4);
}

File 43 of 50 : IERC1155MetadataURI.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol)

pragma solidity ^0.8.0;

import "../IERC1155.sol";

/**
 * @dev Interface of the optional ERC1155MetadataExtension interface, as defined
 * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP].
 *
 * _Available since v3.1._
 */
interface IERC1155MetadataURI is IERC1155 {
    /**
     * @dev Returns the URI for token type `id`.
     *
     * If the `\{id\}` substring is present in the URI, it must be replaced by
     * clients with the actual token type ID.
     */
    function uri(uint256 id) external view returns (string memory);
}

File 44 of 50 : IABIResolver.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.4;

import "./IABIResolver.sol";
import "../ResolverBase.sol";

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);
}

File 45 of 50 : IDNSRecordResolver.sol
// 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);
    // DNSZoneCleared is emitted whenever a given node's zone information is cleared.
    event DNSZoneCleared(bytes32 indexed node);

    /**
     * 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);
}

File 46 of 50 : IContentHashResolver.sol
// 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);
}

File 47 of 50 : IInterfaceResolver.sol
// 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);
}

File 48 of 50 : IDNSZoneResolver.sol
// 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);
}

File 49 of 50 : ITextResolver.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.4;

interface ITextResolver {
    event TextChanged(bytes32 indexed node, string indexed indexedKey, string key);

    /**
     * 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);
}

File 50 of 50 : IPubkeyResolver.sol
// 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);
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 10000
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "metadata": {
    "useLiteralContent": true
  },
  "libraries": {}
}

Contract ABI

[{"inputs":[{"internalType":"contract BaseRegistrarImplementation","name":"_base","type":"address"},{"internalType":"contract ISidPriceOracle","name":"_prices","type":"address"},{"internalType":"contract SidGiftCardLedger","name":"_giftCardLedger","type":"address"},{"internalType":"contract ReferralHub","name":"_referralHub","type":"address"},{"internalType":"contract ReferralVerifier","name":"_referralVerifier","type":"address"},{"internalType":"uint256","name":"_minCommitmentAge","type":"uint256"},{"internalType":"uint256","name":"_maxCommitmentAge","type":"uint256"}],"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":[{"internalType":"address","name":"owner","type":"address"}],"name":"InvalidOwner","type":"error"},{"inputs":[],"name":"MaxCommitmentAgeTooHigh","type":"error"},{"inputs":[],"name":"MaxCommitmentAgeTooLow","type":"error"},{"inputs":[{"internalType":"string","name":"name","type":"string"}],"name":"NameNotAvailable","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"},{"anonymous":false,"inputs":[],"name":"Referral","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":[],"name":"giftCardLedger","outputs":[{"internalType":"contract SidGiftCardLedger","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"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"}],"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":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"prices","outputs":[{"internalType":"contract ISidPriceOracle","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"referralHub","outputs":[{"internalType":"contract ReferralHub","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"referralVerifier","outputs":[{"internalType":"contract ReferralVerifier","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":"bool","name":"reverseRecord","type":"bool"}],"name":"registerWithConfig","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":"bool","name":"isUsePoints","type":"bool"},{"components":[{"internalType":"address","name":"referrerAddress","type":"address"},{"internalType":"bytes32","name":"referrerNodehash","type":"bytes32"},{"internalType":"uint256","name":"referralAmount","type":"uint256"},{"internalType":"uint256","name":"signedAt","type":"uint256"},{"internalType":"bytes","name":"signature","type":"bytes"}],"internalType":"struct ReferralInfo","name":"referralInfo","type":"tuple"}],"name":"registerWithConfigAndPoint","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":"bool","name":"isUsePoints","type":"bool"}],"name":"renewWithPoint","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"},{"internalType":"address","name":"registerAddress","type":"address"}],"name":"rentPrice","outputs":[{"components":[{"internalType":"uint256","name":"base","type":"uint256"},{"internalType":"uint256","name":"premium","type":"uint256"},{"internalType":"uint256","name":"usedPoint","type":"uint256"}],"internalType":"struct ISidPriceOracle.Price","name":"price","type":"tuple"}],"stateMutability":"view","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":"uint256","name":"usedPoint","type":"uint256"}],"internalType":"struct ISidPriceOracle.Price","name":"price","type":"tuple"}],"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"}]

6101606040523480156200001257600080fd5b506040516200330d3803806200330d833981016040819052620000359162000129565b6200004033620000c0565b6001805581811162000065576040516307cb550760e31b815260040160405180910390fd5b428111156200008757604051630b4319e560e21b815260040160405180910390fd5b6001600160a01b0396871660805294861660a0529285166101005260c09290925260e092909252908216610120521661014052620001bc565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b03811681146200012657600080fd5b50565b600080600080600080600060e0888a0312156200014557600080fd5b8751620001528162000110565b6020890151909750620001658162000110565b6040890151909650620001788162000110565b60608901519095506200018b8162000110565b60808901519094506200019e8162000110565b8093505060a0880151915060c0880151905092959891949750929550565b60805160a05160c05160e051610100516101205161014051613063620002aa6000396000818161024b015281816122cc01526125440152600081816102a4015281816123df01528181612485015281816125f801526126b70152600081816102ed0152818161071901526114ca01526000818161044601528181611d1f0152612197015260008181610394015261212001526000818161047a01528181610b910152610df901526000818161083301528181610bbd01528181610e25015281816113680152818161169f01528181611727015281816117e201528181611a860152611b3201526130636000f3fe6080604052600436106101805760003560e01c80638a95b09f116100d6578063ce1e09c01161007f578063f14fcbc811610059578063f14fcbc8146104af578063f2fde38b146104cf578063f49826be146104ef57600080fd5b8063ce1e09c014610434578063d3419bf314610468578063d37095601461049c57600080fd5b80639791c097116100b05780639791c097146103e1578063acf1a84114610401578063aeb8ce9b1461041457600080fd5b80638a95b09f1461036a5780638d839ffe146103825780638da5cb5b146103b657600080fd5b806359cf683c1161013857806381e991cc1161011257806381e991cc146102db578063839df9451461030f57806383e7f6ff1461034a57600080fd5b806359cf683c14610239578063656bb89614610292578063715018a6146102c657600080fd5b80633ccfd60b116101695780633ccfd60b146101cf57806344d31f06146101e4578063563749771461022657600080fd5b806301ffc9a71461018557806339b94c58146101ba575b600080fd5b34801561019157600080fd5b506101a56101a036600461272d565b61056a565b60405190151581526020015b60405180910390f35b6101cd6101c83660046127c6565b610603565b005b3480156101db57600080fd5b506101cd6109ac565b3480156101f057600080fd5b506102046101ff366004612953565b610b22565b60408051825181526020808401519082015291810151908201526060016101b1565b6101cd6102343660046129ae565b610c95565b34801561024557600080fd5b5061026d7f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016101b1565b34801561029e57600080fd5b5061026d7f000000000000000000000000000000000000000000000000000000000000000081565b3480156102d257600080fd5b506101cd610d17565b3480156102e757600080fd5b5061026d7f000000000000000000000000000000000000000000000000000000000000000081565b34801561031b57600080fd5b5061033c61032a366004612a3e565b60026020526000908152604090205481565b6040519081526020016101b1565b34801561035657600080fd5b50610204610365366004612a57565b610d8a565b34801561037657600080fd5b5061033c6301e1338081565b34801561038e57600080fd5b5061033c7f000000000000000000000000000000000000000000000000000000000000000081565b3480156103c257600080fd5b5060005473ffffffffffffffffffffffffffffffffffffffff1661026d565b3480156103ed57600080fd5b506101a56103fc366004612a9c565b610efa565b6101cd61040f366004612ad1565b6112b1565b34801561042057600080fd5b506101a561042f366004612a9c565b61131f565b34801561044057600080fd5b5061033c7f000000000000000000000000000000000000000000000000000000000000000081565b34801561047457600080fd5b5061026d7f000000000000000000000000000000000000000000000000000000000000000081565b6101cd6104aa366004612b1d565b6113ef565b3480156104bb57600080fd5b506101cd6104ca366004612a3e565b611d08565b3480156104db57600080fd5b506101cd6104ea366004612c4c565b611d91565b3480156104fb57600080fd5b5061033c61050a366004612c69565b8251602093840120604080518086019290925260609390931b7fffffffffffffffffffffffffffffffffffffffff000000000000000000000000168184015260548082019290925282518082039092018252607401909152805191012090565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f01ffc9a70000000000000000000000000000000000000000000000000000000014806105fd57507fffffffff0000000000000000000000000000000000000000000000000000000082167f7c54f21a00000000000000000000000000000000000000000000000000000000145b92915050565b6002600154141561065b5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064015b60405180910390fd5b60026001556040805160608101825260008082526020820181905291810191909152811561077a576106c685858080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250879250339150610b229050565b60408082015190517f47055321000000000000000000000000000000000000000000000000000000008152336004820152602481019190915290915073ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001690634705532190604401600060405180830381600087803b15801561075d57600080fd5b505af1158015610771573d6000803e3d6000fd5b505050506107be565b6107bb85858080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250879250610d8a915050565b90505b602081015181516000916107d191612cf2565b9050803410156107e057600080fd5b600086866040516107f2929190612d0a565b6040519081900381207fc475abff000000000000000000000000000000000000000000000000000000008252600482018190526024820187905291506000907f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff169063c475abff906044016020604051808303816000875af1158015610891573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108b59190612d1a565b905082341115610960576000336108cc8534612d33565b604051600081818185875af1925050503d8060008114610908576040519150601f19603f3d011682016040523d82523d6000602084013e61090d565b606091505b505090508061095e5760405162461bcd60e51b815260206004820152601460248201527f4661696c656420746f2073656e642045746865720000000000000000000000006044820152606401610652565b505b817f3da24c024582931cfaf8267d8ed24d13a82a8068d5bd337d30ec45cea4e506ae898986856040516109969493929190612d4a565b60405180910390a2505060018055505050505050565b60005473ffffffffffffffffffffffffffffffffffffffff163314610a135760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610652565b60026001541415610a665760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610652565b60026001556000805460405173ffffffffffffffffffffffffffffffffffffffff9091169047908381818185875af1925050503d8060008114610ac5576040519150601f19603f3d011682016040523d82523d6000602084013e610aca565b606091505b5050905080610b1b5760405162461bcd60e51b815260206004820152601460248201527f4661696c656420746f2073656e642045746865720000000000000000000000006044820152606401610652565b5060018055565b610b4660405180606001604052806000815260200160008152602001600081525090565b835160208501206040517fd6e4fa860000000000000000000000000000000000000000000000000000000081526004810182905273ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000081169163fb8bb3ab9188917f00000000000000000000000000000000000000000000000000000000000000009091169063d6e4fa8690602401602060405180830381865afa158015610c06573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c2a9190612d1a565b87876040518563ffffffff1660e01b8152600401610c4b9493929190612e13565b606060405180830381865afa158015610c68573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c8c9190612e58565b95945050505050565b610d0e87878080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201829052506040805160a081018252828152602080820184905281830184905260608201849052825190810190925291815260808201528a9350899250889150879087906113ef565b50505050505050565b60005473ffffffffffffffffffffffffffffffffffffffff163314610d7e5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610652565b610d886000611e8d565b565b610dae60405180606001604052806000815260200160008152602001600081525090565b825160208401206040517fd6e4fa860000000000000000000000000000000000000000000000000000000081526004810182905273ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000081169163bbf2feec9187917f00000000000000000000000000000000000000000000000000000000000000009091169063d6e4fa8690602401602060405180830381865afa158015610e6e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e929190612d1a565b866040518463ffffffff1660e01b8152600401610eb193929190612eb4565b606060405180830381865afa158015610ece573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ef29190612e58565b949350505050565b60006003610f0783611f02565b1015610f1557506000919050565b8160005b60028251610f279190612d33565b8110156112a757818181518110610f4057610f40612ed9565b6020910101517fff00000000000000000000000000000000000000000000000000000000000000167fe200000000000000000000000000000000000000000000000000000000000000148015610ff8575081610f9d826001612cf2565b81518110610fad57610fad612ed9565b6020910101517fff00000000000000000000000000000000000000000000000000000000000000167f8000000000000000000000000000000000000000000000000000000000000000145b156111515781611009826002612cf2565b8151811061101957611019612ed9565b6020910101517fff00000000000000000000000000000000000000000000000000000000000000167f8b0000000000000000000000000000000000000000000000000000000000000014806110d0575081611075826002612cf2565b8151811061108557611085612ed9565b6020910101517fff00000000000000000000000000000000000000000000000000000000000000167f8c00000000000000000000000000000000000000000000000000000000000000145b8061113d5750816110e2826002612cf2565b815181106110f2576110f2612ed9565b6020910101517fff00000000000000000000000000000000000000000000000000000000000000167f8d00000000000000000000000000000000000000000000000000000000000000145b1561114c575060009392505050565b611295565b81818151811061116357611163612ed9565b6020910101517fff00000000000000000000000000000000000000000000000000000000000000167fef00000000000000000000000000000000000000000000000000000000000000141561129557816111be826001612cf2565b815181106111ce576111ce612ed9565b6020910101517fff00000000000000000000000000000000000000000000000000000000000000167fbb0000000000000000000000000000000000000000000000000000000000000014801561128657508161122b826002612cf2565b8151811061123b5761123b612ed9565b6020910101517fff00000000000000000000000000000000000000000000000000000000000000167fbf00000000000000000000000000000000000000000000000000000000000000145b15611295575060009392505050565b8061129f81612f08565b915050610f19565b5060019392505050565b600260015414156113045760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610652565b60026001556113168383836000610603565b50506001805550565b8051602082012060009061133283610efa565b80156113e857506040517f96e494e8000000000000000000000000000000000000000000000000000000008152600481018290527f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16906396e494e890602401602060405180830381865afa1580156113c4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113e89190612f41565b9392505050565b600260015414156114425760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610652565b60026001556040805160608101825260008082526020820181905291810191909152821561152b57611475888789610b22565b60408082015190517f4705532100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8a8116600483015260248201929092529192507f00000000000000000000000000000000000000000000000000000000000000001690634705532190604401600060405180830381600087803b15801561150e57600080fd5b505af1158015611522573d6000803e3d6000fd5b50505050611538565b6115358887610d8a565b90505b602081015181516115499190612cf2565b341015611582576040517f1101129400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff87166115e7576040517fb20f76e300000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff88166004820152602401610652565b61165788876116528b8b8a8251602093840120604080518086019290925260609390931b7fffffffffffffffffffffffffffffffffffffffff000000000000000000000000168184015260548082019290925282518082039092018252607401909152805191012090565b612109565b875160208901206040517ffca247ac000000000000000000000000000000000000000000000000000000008152600481018290523060248201526044810188905281906000907f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff169063fca247ac906064016020604051808303816000875af11580156116fd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117219190612d1a565b905060007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663ddf7fcb06040518163ffffffff1660e01b8152600401602060405180830381865afa158015611790573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117b49190612d1a565b60408051602081019290925281018590526060016040516020818303038152906040528051906020012090507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff166375dc17646040518163ffffffff1660e01b8152600401602060405180830381865afa15801561184b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061186f9190612f5e565b6040517f1896f70a0000000000000000000000000000000000000000000000000000000081526004810183905273ffffffffffffffffffffffffffffffffffffffff8a811660248301529190911690631896f70a90604401600060405180830381600087803b1580156118e157600080fd5b505af11580156118f5573d6000803e3d6000fd5b5050505073ffffffffffffffffffffffffffffffffffffffff8b1615611a3a576040517f6acdccb900000000000000000000000000000000000000000000000000000000815260048101829052638000a4b1602482015273ffffffffffffffffffffffffffffffffffffffff8c81166044830152891690636acdccb990606401600060405180830381600087803b15801561198f57600080fd5b505af11580156119a3573d6000803e3d6000fd5b50506040517f6acdccb900000000000000000000000000000000000000000000000000000000815260048101849052638000a4ba602482015273ffffffffffffffffffffffffffffffffffffffff8e811660448301528b169250636acdccb99150606401600060405180830381600087803b158015611a2157600080fd5b505af1158015611a35573d6000803e3d6000fd5b505050505b6040517f28ed4f6c0000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff8c811660248301527f000000000000000000000000000000000000000000000000000000000000000016906328ed4f6c90604401600060405180830381600087803b158015611aca57600080fd5b505af1158015611ade573d6000803e3d6000fd5b50506040517f23b872dd00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff8e81166024830152604482018790527f00000000000000000000000000000000000000000000000000000000000000001692506323b872dd9150606401600060405180830381600087803b158015611b7857600080fd5b505af1158015611b8c573d6000803e3d6000fd5b505050508a73ffffffffffffffffffffffffffffffffffffffff168c805190602001207f69e37f151eb98a09618ddaa80c8cfaf1ce5996867c489f45b555b412271ebf278e8860000151896020015187604051611bec9493929190612f7b565b60405180910390a360208501518551600091611c0791612cf2565b875190915073ffffffffffffffffffffffffffffffffffffffff1615611c4c57611c4981886000015189602001518a604001518b606001518c6080015161228c565b90505b80341115611cf557600033611c618334612d33565b604051600081818185875af1925050503d8060008114611c9d576040519150601f19603f3d011682016040523d82523d6000602084013e611ca2565b606091505b5050905080611cf35760405162461bcd60e51b815260206004820152601460248201527f4661696c656420746f2073656e642045746865720000000000000000000000006044820152606401610652565b505b5050600180555050505050505050505050565b6000818152600260205260409020544290611d44907f000000000000000000000000000000000000000000000000000000000000000090612cf2565b10611d7e576040517f0a059d7100000000000000000000000000000000000000000000000000000000815260048101829052602401610652565b6000908152600260205260409020429055565b60005473ffffffffffffffffffffffffffffffffffffffff163314611df85760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610652565b73ffffffffffffffffffffffffffffffffffffffff8116611e815760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610652565b611e8a81611e8d565b50565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b8051600090819081905b80821015612100576000858381518110611f2857611f28612ed9565b01602001517fff000000000000000000000000000000000000000000000000000000000000001690507f8000000000000000000000000000000000000000000000000000000000000000811015611f8b57611f84600184612cf2565b92506120ed565b7fe0000000000000000000000000000000000000000000000000000000000000007fff0000000000000000000000000000000000000000000000000000000000000082161015611fe057611f84600284612cf2565b7ff0000000000000000000000000000000000000000000000000000000000000007fff000000000000000000000000000000000000000000000000000000000000008216101561203557611f84600384612cf2565b7ff8000000000000000000000000000000000000000000000000000000000000007fff000000000000000000000000000000000000000000000000000000000000008216101561208a57611f84600484612cf2565b7ffc000000000000000000000000000000000000000000000000000000000000007fff00000000000000000000000000000000000000000000000000000000000000821610156120df57611f84600584612cf2565b6120ea600684612cf2565b92505b50826120f881612f08565b935050611f0c565b50909392505050565b6000818152600260205260409020544290612145907f000000000000000000000000000000000000000000000000000000000000000090612cf2565b1115612180576040517f5320bcf900000000000000000000000000000000000000000000000000000000815260048101829052602401610652565b60008181526002602052604090205442906121bc907f000000000000000000000000000000000000000000000000000000000000000090612cf2565b116121f6576040517fcb7690d700000000000000000000000000000000000000000000000000000000815260048101829052602401610652565b6121ff8361131f565b61223757826040517f477707e80000000000000000000000000000000000000000000000000000000081526004016106529190612faa565b6000818152600260205260408120556301e13380821015612287576040517f9a71997b00000000000000000000000000000000000000000000000000000000815260048101839052602401610652565b505050565b6040517fbecd725c00000000000000000000000000000000000000000000000000000000815260009073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000169063becd725c906123099089908990899089908990600401612fbd565b602060405180830381865afa158015612326573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061234a9190612f41565b6123965760405162461bcd60e51b815260206004820152601a60248201527f496e76616c696420726566657272616c207369676e61747572650000000000006044820152606401610652565b6040517f0fededb200000000000000000000000000000000000000000000000000000000815260048101869052600090819073ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001690630fededb290602401602060405180830381865afa158015612426573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061244a9190612f41565b1561250e576040517fbe64b069000000000000000000000000000000000000000000000000000000008152600481018a9052602481018890527f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff169063be64b069906044016040805180830381865afa1580156124e0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125049190613009565b90925090506125c9565b6040517f0f95767e000000000000000000000000000000000000000000000000000000008152600481018a9052602481018790527f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1690630f95767e906044016040805180830381865afa15801561259f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125c39190613009565b90925090505b6040517f6cc6b278000000000000000000000000000000000000000000000000000000008152600481018890527f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1690636cc6b27890602401600060405180830381600087803b15801561265157600080fd5b505af1158015612665573d6000803e3d6000fd5b505050506000821115612716576040517ff340fa0100000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff89811660048301527f0000000000000000000000000000000000000000000000000000000000000000169063f340fa019084906024016000604051808303818588803b1580156126fc57600080fd5b505af1158015612710573d6000803e3d6000fd5b50505050505b612720818a612d33565b9998505050505050505050565b60006020828403121561273f57600080fd5b81357fffffffff00000000000000000000000000000000000000000000000000000000811681146113e857600080fd5b60008083601f84011261278157600080fd5b50813567ffffffffffffffff81111561279957600080fd5b6020830191508360208285010111156127b157600080fd5b9250929050565b8015158114611e8a57600080fd5b600080600080606085870312156127dc57600080fd5b843567ffffffffffffffff8111156127f357600080fd5b6127ff8782880161276f565b90955093505060208501359150604085013561281a816127b8565b939692955090935050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405160a0810167ffffffffffffffff8111828210171561287757612877612825565b60405290565b600067ffffffffffffffff8084111561289857612898612825565b604051601f85017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f011681019082821181831017156128de576128de612825565b816040528093508581528686860111156128f757600080fd5b858560208301376000602087830101525050509392505050565b600082601f83011261292257600080fd5b6113e88383356020850161287d565b73ffffffffffffffffffffffffffffffffffffffff81168114611e8a57600080fd5b60008060006060848603121561296857600080fd5b833567ffffffffffffffff81111561297f57600080fd5b61298b86828701612911565b9350506020840135915060408401356129a381612931565b809150509250925092565b600080600080600080600060c0888a0312156129c957600080fd5b873567ffffffffffffffff8111156129e057600080fd5b6129ec8a828b0161276f565b9098509650506020880135612a0081612931565b945060408801359350606088013592506080880135612a1e81612931565b915060a0880135612a2e816127b8565b8091505092959891949750929550565b600060208284031215612a5057600080fd5b5035919050565b60008060408385031215612a6a57600080fd5b823567ffffffffffffffff811115612a8157600080fd5b612a8d85828601612911565b95602094909401359450505050565b600060208284031215612aae57600080fd5b813567ffffffffffffffff811115612ac557600080fd5b610ef284828501612911565b600080600060408486031215612ae657600080fd5b833567ffffffffffffffff811115612afd57600080fd5b612b098682870161276f565b909790965060209590950135949350505050565b600080600080600080600060e0888a031215612b3857600080fd5b873567ffffffffffffffff80821115612b5057600080fd5b612b5c8b838c01612911565b985060208a01359150612b6e82612931565b9096506040890135955060608901359450608089013590612b8e82612931565b90935060a089013590612ba0826127b8565b90925060c08901359080821115612bb657600080fd5b9089019060a0828c031215612bca57600080fd5b612bd2612854565b8235612bdd81612931565b80825250602083013560208201526040830135604082015260608301356060820152608083013582811115612c1157600080fd5b8084019350508b601f840112612c2657600080fd5b612c358c84356020860161287d565b608082015280935050505092959891949750929550565b600060208284031215612c5e57600080fd5b81356113e881612931565b600080600060608486031215612c7e57600080fd5b833567ffffffffffffffff811115612c9557600080fd5b612ca186828701612911565b9350506020840135612cb281612931565b929592945050506040919091013590565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60008219821115612d0557612d05612cc3565b500190565b8183823760009101908152919050565b600060208284031215612d2c57600080fd5b5051919050565b600082821015612d4557612d45612cc3565b500390565b6060815283606082015283856080830137600060808583010152600060807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f870116830101905083602083015282604083015295945050505050565b6000815180845260005b81811015612dce57602081850181015186830182015201612db2565b81811115612de0576000602083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b608081526000612e266080830187612da8565b602083019590955250604081019290925273ffffffffffffffffffffffffffffffffffffffff16606090910152919050565b600060608284031215612e6a57600080fd5b6040516060810181811067ffffffffffffffff82111715612e8d57612e8d612825565b80604052508251815260208301516020820152604083015160408201528091505092915050565b606081526000612ec76060830186612da8565b60208301949094525060400152919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415612f3a57612f3a612cc3565b5060010190565b600060208284031215612f5357600080fd5b81516113e8816127b8565b600060208284031215612f7057600080fd5b81516113e881612931565b608081526000612f8e6080830187612da8565b6020830195909552506040810192909252606090910152919050565b6020815260006113e86020830184612da8565b73ffffffffffffffffffffffffffffffffffffffff8616815284602082015283604082015282606082015260a060808201526000612ffe60a0830184612da8565b979650505050505050565b6000806040838503121561301c57600080fd5b50508051602090910151909290915056fea26469706673582212203d86850c2b2e6431d2c74b17452522b0779bde980e5a9e40674fd5ac272d99ba64736f6c634300080c00330000000000000000000000005d482d501b369f5ba034dec5c5fb7a50d2d6ca2000000000000000000000000044b1daf988e0c5d1f9bdca0e1d1c89f462c9a5dc000000000000000000000000c9eb5e16c10ad9845f49f280d46aef58997548970000000000000000000000009fa006eed523407f55f1257a76aa9bdee994b116000000000000000000000000af3ad03f59d6917a29de833eff266e0b51d42cdb000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000093a80

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

0000000000000000000000005d482d501b369f5ba034dec5c5fb7a50d2d6ca2000000000000000000000000044b1daf988e0c5d1f9bdca0e1d1c89f462c9a5dc000000000000000000000000c9eb5e16c10ad9845f49f280d46aef58997548970000000000000000000000009fa006eed523407f55f1257a76aa9bdee994b116000000000000000000000000af3ad03f59d6917a29de833eff266e0b51d42cdb000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000093a80

-----Decoded View---------------
Arg [0] : _base (address): 0x5d482d501b369f5ba034dec5c5fb7a50d2d6ca20
Arg [1] : _prices (address): 0x44b1daf988e0c5d1f9bdca0e1d1c89f462c9a5dc
Arg [2] : _giftCardLedger (address): 0xc9eb5e16c10ad9845f49f280d46aef5899754897
Arg [3] : _referralHub (address): 0x9fa006eed523407f55f1257a76aa9bdee994b116
Arg [4] : _referralVerifier (address): 0xaf3ad03f59d6917a29de833eff266e0b51d42cdb
Arg [5] : _minCommitmentAge (uint256): 10
Arg [6] : _maxCommitmentAge (uint256): 604800

-----Encoded View---------------
7 Constructor Arguments found :
Arg [0] : 0000000000000000000000005d482d501b369f5ba034dec5c5fb7a50d2d6ca20
Arg [1] : 00000000000000000000000044b1daf988e0c5d1f9bdca0e1d1c89f462c9a5dc
Arg [2] : 000000000000000000000000c9eb5e16c10ad9845f49f280d46aef5899754897
Arg [3] : 0000000000000000000000009fa006eed523407f55f1257a76aa9bdee994b116
Arg [4] : 000000000000000000000000af3ad03f59d6917a29de833eff266e0b51d42cdb
Arg [5] : 000000000000000000000000000000000000000000000000000000000000000a
Arg [6] : 0000000000000000000000000000000000000000000000000000000000093a80


Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Block Uncle Number Difficulty Gas Used Reward
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.