ETH Price: $1,972.86 (+0.15%)
 

Overview

ETH Balance

8 ETH

Eth Value

$15,782.89 (@ $1,972.86/ETH)

Token Holdings

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Add To Collectio...235360062025-10-08 22:28:47136 days ago1759962527IN
0x8416c049...8077d5A94
0.005 ETH0.000036830.16269885
Retrieve Support...224307142025-05-07 8:50:11291 days ago1746607811IN
0x8416c049...8077d5A94
0 ETH0.000090420.86109738
Support Yield Po...220023892025-03-08 13:14:11350 days ago1741439651IN
0x8416c049...8077d5A94
1 ETH0.000340781.39924372
Retrieve Support...217473692025-01-31 22:03:35386 days ago1738361015IN
0x8416c049...8077d5A94
0 ETH0.000305733.47793853
Support Yield Po...214952682024-12-27 17:24:11421 days ago1735320251IN
0x8416c049...8077d5A94
2 ETH0.001855798.07034426
Support Yield Po...214102232024-12-15 20:12:35433 days ago1734293555IN
0x8416c049...8077d5A94
1 ETH0.0025799911.219681
Support Yield Po...212660362024-11-25 16:42:59453 days ago1732552979IN
0x8416c049...8077d5A94
1 ETH0.0053963423.46716873
Transfer Permiss...212586312024-11-24 15:54:35454 days ago1732463675IN
0x8416c049...8077d5A94
0 ETH0.000265619.17824149
Force Active Col...212562192024-11-24 7:49:23455 days ago1732434563IN
0x8416c049...8077d5A94
0 ETH0.031134359.94712735
Allow New Collec...212562192024-11-24 7:49:23455 days ago1732434563IN
0x8416c049...8077d5A94
0 ETH0.000533079.94712735
Force Active Col...212562192024-11-24 7:49:23455 days ago1732434563IN
0x8416c049...8077d5A94
0 ETH0.031134359.94712735
Allow New Collec...212562192024-11-24 7:49:23455 days ago1732434563IN
0x8416c049...8077d5A94
0 ETH0.000533079.94712735
Force Active Col...212562192024-11-24 7:49:23455 days ago1732434563IN
0x8416c049...8077d5A94
0 ETH0.031134359.94712735
Allow New Collec...212562192024-11-24 7:49:23455 days ago1732434563IN
0x8416c049...8077d5A94
0 ETH0.000533079.94712735
Force Active Col...212562192024-11-24 7:49:23455 days ago1732434563IN
0x8416c049...8077d5A94
0 ETH0.031134359.94712735
Allow New Collec...212562192024-11-24 7:49:23455 days ago1732434563IN
0x8416c049...8077d5A94
0 ETH0.000533079.94712735
Force Active Col...212562192024-11-24 7:49:23455 days ago1732434563IN
0x8416c049...8077d5A94
0 ETH0.031304459.94712735
Allow New Collec...212562192024-11-24 7:49:23455 days ago1732434563IN
0x8416c049...8077d5A94
0 ETH0.000532959.94712735
Set Ticker Logic212562192024-11-24 7:49:23455 days ago1732434563IN
0x8416c049...8077d5A94
0 ETH0.000501269.94712735
Set Ticker Logic212562192024-11-24 7:49:23455 days ago1732434563IN
0x8416c049...8077d5A94
0 ETH0.000501269.94712735
Set Ticker Logic212562192024-11-24 7:49:23455 days ago1732434563IN
0x8416c049...8077d5A94
0 ETH0.000501269.94712735
Set Ticker Logic212562192024-11-24 7:49:23455 days ago1732434563IN
0x8416c049...8077d5A94
0 ETH0.000501269.94712735
Set Ticker Logic212562192024-11-24 7:49:23455 days ago1732434563IN
0x8416c049...8077d5A94
0 ETH0.000501269.94712735
Set Ticker Logic212562192024-11-24 7:49:23455 days ago1732434563IN
0x8416c049...8077d5A94
0 ETH0.000501269.94712735
Set Ticker Logic212562192024-11-24 7:49:23455 days ago1732434563IN
0x8416c049...8077d5A94
0 ETH0.000501269.94712735
View all transactions

Latest 25 internal transactions (View All)

Advanced mode:
Parent Transaction Hash Method Block
From
To
Deposit235360062025-10-08 22:28:47136 days ago1759962527
0x8416c049...8077d5A94
0.005 ETH
Transfer231690882025-08-18 16:18:35187 days ago1755533915
0x8416c049...8077d5A94
0.06 ETH
Transfer*231690882025-08-18 16:18:35187 days ago1755533915
0x8416c049...8077d5A94
0.1 ETH
Transfer231690322025-08-18 16:07:23187 days ago1755533243
0x8416c049...8077d5A94
0.06 ETH
Transfer*231690322025-08-18 16:07:23187 days ago1755533243
0x8416c049...8077d5A94
0.1 ETH
Transfer231689792025-08-18 15:56:47187 days ago1755532607
0x8416c049...8077d5A94
0.06 ETH
Transfer*231689792025-08-18 15:56:47187 days ago1755532607
0x8416c049...8077d5A94
0.1 ETH
Transfer231084662025-08-10 5:07:11196 days ago1754802431
0x8416c049...8077d5A94
0.06 ETH
Transfer*231084662025-08-10 5:07:11196 days ago1754802431
0x8416c049...8077d5A94
0.1 ETH
Transfer230585422025-08-03 5:47:47203 days ago1754200067
0x8416c049...8077d5A94
0.06 ETH
Transfer*230585422025-08-03 5:47:47203 days ago1754200067
0x8416c049...8077d5A94
0.1 ETH
Transfer230224342025-07-29 4:33:47208 days ago1753763627
0x8416c049...8077d5A94
0.06 ETH
Transfer*230224342025-07-29 4:33:47208 days ago1753763627
0x8416c049...8077d5A94
0.1 ETH
Transfer230224302025-07-29 4:32:59208 days ago1753763579
0x8416c049...8077d5A94
0.06 ETH
Transfer*230224302025-07-29 4:32:59208 days ago1753763579
0x8416c049...8077d5A94
0.1 ETH
Transfer230185012025-07-28 15:20:59208 days ago1753716059
0x8416c049...8077d5A94
0.06 ETH
Transfer*230185012025-07-28 15:20:59208 days ago1753716059
0x8416c049...8077d5A94
0.1 ETH
Transfer230184262025-07-28 15:05:59208 days ago1753715159
0x8416c049...8077d5A94
0.06 ETH
Transfer*230184262025-07-28 15:05:59208 days ago1753715159
0x8416c049...8077d5A94
0.1 ETH
Transfer230179022025-07-28 13:20:47208 days ago1753708847
0x8416c049...8077d5A94
0.06 ETH
Transfer*230179022025-07-28 13:20:47208 days ago1753708847
0x8416c049...8077d5A94
0.1 ETH
Transfer230175602025-07-28 12:11:35208 days ago1753704695
0x8416c049...8077d5A94
0.06 ETH
Transfer*230175602025-07-28 12:11:35208 days ago1753704695
0x8416c049...8077d5A94
0.1 ETH
Transfer230117362025-07-27 16:40:23209 days ago1753634423
0x8416c049...8077d5A94
0.06 ETH
Transfer*230117362025-07-27 16:40:23209 days ago1753634423
0x8416c049...8077d5A94
0.1 ETH
View All Internal Transactions
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
ObeliskRegistry

Compiler Version
v0.8.25+commit.b61c2a91

Optimization Enabled:
Yes with 200 runs

Other Settings:
paris EvmVersion
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.25;

import { IObeliskRegistry } from "src/interfaces/IObeliskRegistry.sol";

import { Permission } from "atoumic/access/Permission.sol";
import { IDripVault } from "src/interfaces/IDripVault.sol";

import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import { IWrappedNFTFactory } from "src/interfaces/IWrappedNFTFactory.sol";
import { IWrappedNFTHero } from "src/interfaces/IWrappedNFTHero.sol";

import { HCT } from "src/services/HCT.sol";

import { Math } from "@openzeppelin/contracts/utils/math/Math.sol";
import { ReentrancyGuard } from "@openzeppelin/contracts/utils/ReentrancyGuard.sol";

import { WrappedNFTFactory } from "src/services/WrappedNFTFactory.sol";

/**
 * @title ObeliskRegistry
 * @notice It can creates / allow / modify Tickers, have supporting option to boost yield
 * for 30 days and handle
 * Collection access & unlocking.
 * @custom:export abi
 */
contract ObeliskRegistry is IObeliskRegistry, Permission, ReentrancyGuard {
  uint256 public constant MINIMUM_SENDING_ETH = 0.005 ether;
  uint256 public constant MINIMUM_ETH_SUPPORT_AMOUNT = 1e18;
  uint256 public constant MINIMUM_DAI_SUPPORT_AMOUNT = 1000e18;
  uint128 public constant REQUIRED_ETH_TO_ENABLE_COLLECTION = 100e18;
  uint32 public constant SUPPORT_LOCK_DURATION = 30 days;
  uint32 public constant COLLECTION_REWARD_PERCENT = 4000;
  uint32 public constant BPS = 10_000;
  bytes1 public constant TICKER_ROLE = 0x01;
  bytes1 public constant IPFS_ROLE = 0x02;
  bytes1 public constant DATA_ASSERTER_ROLE = 0x04;

  mapping(address => Collection) internal supportedCollections;
  mapping(address wrappedCollection => CollectionRewards) internal
    wrappedCollectionRewards;
  mapping(address wrappedNFT => bool isValid) public override isWrappedNFT;

  mapping(string ticker => address logic) private tickersLogic;
  mapping(address user => mapping(address collection => ContributionInfo)) internal
    userSupportedCollections;
  mapping(uint32 => Supporter) private supporters;

  address public immutable HCT_ADDRESS;
  address public immutable NFT_PASS;
  IERC20 public immutable DAI;
  IDripVault public immutable DRIP_VAULT_ETH;
  IDripVault public immutable DRIP_VAULT_DAI;
  IWrappedNFTFactory public immutable WRAPPED_NFT_FACTORY;

  address public treasury;
  address public megapoolFactory;
  uint32 public supportId;
  uint256 public maxRewardPerCollection;

  string public wrappedCollectionImageIPFS;
  mapping(uint256 => string) public collectionImageIPFS;

  constructor(
    address _owner,
    address _treasury,
    address _nftPass,
    address _dripVaultETH,
    address _dripVaultDAI,
    address _dai
  ) Permission(_owner) {
    maxRewardPerCollection = 250e18;

    treasury = _treasury;
    HCT_ADDRESS = address(new HCT(_owner, _treasury));
    DRIP_VAULT_ETH = IDripVault(_dripVaultETH);
    DRIP_VAULT_DAI = IDripVault(_dripVaultDAI);
    NFT_PASS = _nftPass;
    DAI = IERC20(_dai);
    WRAPPED_NFT_FACTORY =
      IWrappedNFTFactory(new WrappedNFTFactory(address(HCT_ADDRESS), _nftPass));

    wrappedCollectionImageIPFS = "ipfs://QmVLK98G9xCXKA3r1mAJ2ytJ7XVCfWBy4DfnHkXF2VWJ53";
  }

  /// @inheritdoc IObeliskRegistry
  function addToCollection(address _collection) external payable override nonReentrant {
    Collection storage collection = supportedCollections[_collection];
    uint256 sendingAmount = DRIP_VAULT_ETH.previewDeposit(msg.value);
    uint256 contributionBalance = collection.contributionBalance;
    uint256 surplus;

    if (sendingAmount < MINIMUM_SENDING_ETH) revert AmountTooLow();

    if (contributionBalance >= REQUIRED_ETH_TO_ENABLE_COLLECTION) {
      revert TooManyEth();
    }

    contributionBalance += sendingAmount;

    if (contributionBalance > REQUIRED_ETH_TO_ENABLE_COLLECTION) {
      surplus = contributionBalance - REQUIRED_ETH_TO_ENABLE_COLLECTION;
      sendingAmount -= surplus;
      contributionBalance -= surplus;
    }

    if (!collection.allowed) revert CollectionNotAllowed();

    sendingAmount = DRIP_VAULT_ETH.deposit{ value: sendingAmount }(0);
    userSupportedCollections[msg.sender][_collection].deposit += uint128(sendingAmount);

    //Ignore the potential fee from drip_vault.
    collection.contributionBalance = contributionBalance;

    emit CollectionContributed(_collection, msg.sender, sendingAmount);
    if (contributionBalance < REQUIRED_ETH_TO_ENABLE_COLLECTION) return;

    _createWrappedNFT(
      _collection,
      collection.totalSupply,
      collection.collectionStartedUnixTime,
      collection.premium
    );

    if (surplus != 0) {
      (bool success,) = msg.sender.call{ value: surplus }("");
      if (!success) revert TransferFailed();
    }
  }

  function forceActiveCollection(address _collection) external onlyPermissionAdmin {
    Collection storage collection = supportedCollections[_collection];
    if (!collection.allowed) revert CollectionNotAllowed();

    uint256 currentBalance = collection.contributionBalance;
    if (currentBalance >= REQUIRED_ETH_TO_ENABLE_COLLECTION) {
      revert TooManyEth();
    }

    uint256 missingEth = REQUIRED_ETH_TO_ENABLE_COLLECTION - currentBalance;

    collection.contributionBalance += missingEth;
    userSupportedCollections[treasury][_collection].deposit += uint128(missingEth);

    _createWrappedNFT(
      _collection,
      collection.totalSupply,
      collection.collectionStartedUnixTime,
      collection.premium
    );
  }

  function _createWrappedNFT(
    address _collection,
    uint256 _totalSupply,
    uint32 _unixTimeCreation,
    bool _premium
  ) internal returns (address addr_) {
    addr_ = WRAPPED_NFT_FACTORY.createWrappedNFT(
      _collection, address(this), _totalSupply, _unixTimeCreation, _premium
    );

    isWrappedNFT[addr_] = true;
    supportedCollections[_collection].wrappedVersion = addr_;

    emit WrappedNFTCreated(_collection, addr_);

    return addr_;
  }

  /// @inheritdoc IObeliskRegistry
  function removeFromCollection(address _collection, uint256 _amount)
    external
    override
    nonReentrant
  {
    Collection storage collection = supportedCollections[_collection];
    uint256 depositedAmount = userSupportedCollections[msg.sender][_collection].deposit;
    uint256 currentBalance = collection.contributionBalance;

    if (_amount > depositedAmount) {
      revert AmountExceedsDeposit();
    }
    if (_amount == 0) _amount = depositedAmount;

    if (currentBalance >= REQUIRED_ETH_TO_ENABLE_COLLECTION) {
      revert GoalReached();
    }

    collection.contributionBalance = currentBalance - _amount;
    depositedAmount -= _amount;

    if (depositedAmount != 0 && depositedAmount < MINIMUM_SENDING_ETH) {
      revert ContributionBalanceTooLow();
    }

    userSupportedCollections[msg.sender][_collection].deposit = uint128(depositedAmount);
    DRIP_VAULT_ETH.withdraw(msg.sender, _amount);

    emit CollectionContributionWithdrawn(_collection, msg.sender, _amount);
  }

  /// @inheritdoc IObeliskRegistry
  function supportYieldPool(uint256 _amount) external payable override {
    if (msg.value != 0 && _amount != 0) revert OnlyOneValue();

    address token = msg.value != 0 ? address(0) : address(DAI);
    uint256 sanitizedAmount = msg.value != 0 ? msg.value : _amount;
    uint256 minimumAmount =
      token == address(0) ? MINIMUM_ETH_SUPPORT_AMOUNT : MINIMUM_DAI_SUPPORT_AMOUNT;

    if (sanitizedAmount < minimumAmount) revert AmountTooLow();

    if (token == address(0)) {
      sanitizedAmount = DRIP_VAULT_ETH.deposit{ value: sanitizedAmount }(0);
    } else {
      DAI.transferFrom(msg.sender, address(DRIP_VAULT_DAI), sanitizedAmount);
      sanitizedAmount = DRIP_VAULT_DAI.deposit(sanitizedAmount);
    }

    supportId++;
    supporters[supportId] = Supporter({
      depositor: msg.sender,
      token: token,
      amount: uint128(sanitizedAmount),
      lockUntil: uint32(block.timestamp + SUPPORT_LOCK_DURATION),
      removed: false
    });

    emit Supported(supportId, msg.sender, sanitizedAmount);
  }

  /// @inheritdoc IObeliskRegistry
  function retrieveSupportToYieldPool(uint32 _id) external override nonReentrant {
    Supporter storage supporter = supporters[_id];
    uint256 returningAmount = supporter.amount;

    if (supporter.depositor != msg.sender) revert NotSupporterDepositor();
    if (supporter.lockUntil > block.timestamp) revert SupportNotFinished();
    if (supporter.removed) revert AlreadyRemoved();

    supporter.removed = true;

    if (supporter.token == address(0)) {
      DRIP_VAULT_ETH.withdraw(msg.sender, returningAmount);
    } else {
      DRIP_VAULT_DAI.withdraw(msg.sender, returningAmount);
    }

    emit SupportRetrieved(_id, msg.sender, returningAmount);
  }

  function onSlotBought() external payable {
    if (!isWrappedNFT[msg.sender]) revert NotWrappedNFT();
    if (msg.value == 0) return;

    uint256 collectionTotalReward = wrappedCollectionRewards[msg.sender].totalRewards;
    uint256 toCollection = Math.mulDiv(msg.value, COLLECTION_REWARD_PERCENT, BPS);

    if (collectionTotalReward + toCollection > maxRewardPerCollection) {
      toCollection = maxRewardPerCollection - collectionTotalReward;
    }
    uint256 toTreasury = msg.value - toCollection;

    wrappedCollectionRewards[msg.sender].totalRewards += uint128(toCollection);

    (bool success,) = treasury.call{ value: toTreasury }("");
    if (!success) revert TransferFailed();

    emit SlotBought(msg.sender, toCollection, toTreasury);
  }

  function claim(address _collection) external nonReentrant {
    Collection storage collection = supportedCollections[_collection];
    CollectionRewards storage collectionRewards =
      wrappedCollectionRewards[collection.wrappedVersion];
    ContributionInfo storage userContribution =
      userSupportedCollections[msg.sender][_collection];

    uint256 contributionBalance = collection.contributionBalance;

    if (contributionBalance != REQUIRED_ETH_TO_ENABLE_COLLECTION) revert NothingToClaim();

    uint256 totalUserReward = Math.mulDiv(
      userContribution.deposit, collectionRewards.totalRewards, contributionBalance
    );
    uint128 rewardsToClaim = uint128(totalUserReward - userContribution.claimed);

    if (rewardsToClaim == 0) revert NothingToClaim();

    collectionRewards.claimedRewards += rewardsToClaim;
    userContribution.claimed = uint128(totalUserReward);

    (bool success,) = msg.sender.call{ value: rewardsToClaim }("");
    if (!success) revert TransferFailed();

    emit Claimed(_collection, msg.sender, rewardsToClaim);
  }

  function allowNewCollection(
    address _collection,
    uint256 _totalSupply,
    uint32 _collectionStartedUnixTime,
    bool _premium
  ) external {
    bool isOwner = msg.sender == permissionAdmin();
    if (!isOwner && !hasPermission(msg.sender, DATA_ASSERTER_ROLE)) {
      revert NotAuthorized();
    }
    if (supportedCollections[_collection].allowed) revert CollectionAlreadyAllowed();

    supportedCollections[_collection] = Collection({
      wrappedVersion: address(0),
      totalSupply: _totalSupply,
      contributionBalance: 0,
      collectionStartedUnixTime: _collectionStartedUnixTime,
      allowed: true,
      premium: isOwner ? _premium : false
    });

    emit CollectionAllowed(
      _collection, _totalSupply, _collectionStartedUnixTime, _premium
    );
  }

  function toggleIsWrappedNFTFor(
    address _collection,
    address _wrappedVersion,
    bool _allowed
  ) external onlyPermissionAdmin {
    isWrappedNFT[_wrappedVersion] = _allowed;

    if (_allowed) {
      emit WrappedNFTEnabled(_collection, _wrappedVersion);
    } else {
      emit WrappedNFTDisabled(_collection, _wrappedVersion);
    }
  }

  function setTickerLogic(string memory _ticker, address _pool, bool _override) external {
    bool isOwner = msg.sender == permissionAdmin();
    _override = isOwner ? _override : false;

    if (!isOwner && !hasPermission(msg.sender, TICKER_ROLE)) revert NoAccess();
    if (!_override && tickersLogic[_ticker] != address(0)) revert TickerAlreadyExists();

    tickersLogic[_ticker] = _pool;
    emit TickerLogicSet(_ticker, _pool, _ticker);
  }

  function setTreasury(address _treasury) external onlyPermissionAdmin {
    if (_treasury == address(0)) revert ZeroAddress();
    treasury = _treasury;
    emit TreasurySet(_treasury);
  }

  function setMegapoolFactory(address _megapoolFactory) external onlyPermissionAdmin {
    _removePermission(_megapoolFactory, TICKER_ROLE);
    _addPermission(_megapoolFactory, TICKER_ROLE);

    megapoolFactory = _megapoolFactory;
    emit MegapoolFactorySet(_megapoolFactory);
  }

  function setMaxRewardPerCollection(uint256 _maxRewardPerCollection)
    external
    onlyPermissionAdmin
  {
    maxRewardPerCollection = _maxRewardPerCollection;
    emit MaxRewardPerCollectionSet(_maxRewardPerCollection);
  }

  /**
   * @notice Enable emergency withdraw for a wrapped collection
   * @param _wrappedCollection Wrapped collection address
   *
   * @dev This function enables emergency withdrawal for users to retrieve their NFTs
   * in case of external issues.
   *
   * Once activated, this action is irreversible, and the collection will be marked as
   * "offline".
   *
   * This will result in "Ghost weight" in the Tickers, negatively impacting the pool's
   * yield
   * and locking the rewards of these "Ghosts".
   *
   * In such a scenario, a migration is recommended. Although we use a trusted third
   * party,
   * the possibility of this happening is low but not impossible.
   */
  function enableEmergencyWithdrawForCollection(address _wrappedCollection)
    external
    onlyPermissionAdmin
  {
    IWrappedNFTHero(_wrappedCollection).enableEmergencyWithdraw();
  }

  function setWrappedCollectionImageIPFS(string memory _ipfsImage)
    external
    onlyPermissionAdmin
  {
    wrappedCollectionImageIPFS = _ipfsImage;
  }

  function setCollectionImageIPFS(uint256 _id, string memory _ipfsImage)
    external
    onlyPermission(IPFS_ROLE)
  {
    collectionImageIPFS[_id] = _ipfsImage;
    emit CollectionImageIPFSUpdated(_id, _ipfsImage);
  }

  /// @inheritdoc IObeliskRegistry
  function getTickerLogic(string memory _ticker) external view override returns (address) {
    return tickersLogic[_ticker];
  }

  /// @inheritdoc IObeliskRegistry
  function getSupporter(uint32 _id) external view override returns (Supporter memory) {
    return supporters[_id];
  }

  function getUserContribution(address _user, address _collection)
    external
    view
    returns (ContributionInfo memory)
  {
    return userSupportedCollections[_user][_collection];
  }

  function getCollectionRewards(address _collection)
    external
    view
    returns (CollectionRewards memory)
  {
    return wrappedCollectionRewards[supportedCollections[_collection].wrappedVersion];
  }

  function getCollection(address _collection)
    external
    view
    override
    returns (Collection memory)
  {
    return supportedCollections[_collection];
  }

  function getCollectionImageIPFS(uint256 _id)
    external
    view
    override
    returns (string memory ipfs_)
  {
    ipfs_ = collectionImageIPFS[_id];
    if (bytes(ipfs_).length != 0) return ipfs_;

    return wrappedCollectionImageIPFS;
  }

  receive() external payable { }
}

// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;

interface IObeliskRegistry {
  error TooManyEth();
  error GoalReached();
  error AmountExceedsDeposit();
  error TransferFailed();
  error FailedDeployment();
  error TickerAlreadyExists();
  error NotSupporterDepositor();
  error AlreadyRemoved();
  error SupportNotFinished();
  error NothingToClaim();
  error NotWrappedNFT();
  error CollectionNotAllowed();
  error NotAuthorized();
  error OnlyOneValue();
  error AmountTooLow();
  error ContributionBalanceTooLow();
  error ZeroAddress();
  error CollectionAlreadyAllowed();
  error NoAccess();

  event WrappedNFTCreated(address indexed collection, address indexed wrappedNFT);
  event WrappedNFTEnabled(address indexed collection, address indexed wrappedNFT);
  event WrappedNFTDisabled(address indexed collection, address indexed wrappedNFT);
  event MegapoolFactorySet(address indexed megapoolFactory);
  event TickerCreationAccessSet(address indexed to, bool status);
  event TickerLogicSet(string indexed ticker, address indexed pool, string readableName);
  event NewGenesisTickerCreated(string indexed ticker, address pool);
  event Supported(uint32 indexed supportId, address indexed supporter, uint256 amount);
  event SupportRetrieved(
    uint32 indexed supportId, address indexed supporter, uint256 amount
  );
  event CollectionContributed(
    address indexed collection, address indexed contributor, uint256 amount
  );
  event CollectionContributionWithdrawn(
    address indexed collection, address indexed contributor, uint256 amount
  );
  event Claimed(address indexed collection, address indexed contributor, uint256 amount);
  event SlotBought(address indexed wrappedNFT, uint256 toCollection, uint256 toTreasury);
  event CollectionAllowed(
    address indexed collection,
    uint256 totalSupply,
    uint32 collectionStartedUnixTime,
    bool premium
  );
  event TreasurySet(address indexed treasury);
  event MaxRewardPerCollectionSet(uint256 maxRewardPerCollection);
  event CollectionImageIPFSUpdated(uint256 indexed id, string ipfsImage);

  struct Collection {
    uint256 totalSupply;
    uint256 contributionBalance;
    address wrappedVersion;
    uint32 collectionStartedUnixTime;
    bool allowed;
    bool premium;
  }

  struct Supporter {
    address depositor;
    address token;
    uint128 amount;
    uint32 lockUntil;
    bool removed;
  }

  struct CollectionRewards {
    uint128 totalRewards;
    uint128 claimedRewards;
  }

  struct ContributionInfo {
    uint128 deposit;
    uint128 claimed;
  }

  function isWrappedNFT(address _collection) external view returns (bool);

  /**
   * @notice Contribute to collection
   * @param _collection NFT Collection address
   * @dev Warning: once the collection goal is reached, it cannot be removed
   */
  function addToCollection(address _collection) external payable;

  /**
   * @notice Remove from collection
   * @param _collection Collection address
   * @dev Warning: once the collection goal is reached, it cannot be removed
   */
  function removeFromCollection(address _collection, uint256 _amount) external;

  /**
   * @notice Support the yield pool
   * @param _amount The amount to support with
   * @dev The amount is locked for 30 days
   * @dev if msg.value is 0, the amount is expected to be sent in DAI
   */
  function supportYieldPool(uint256 _amount) external payable;

  /**
   * @notice Retrieve support to yield pool
   * @param _id Support ID
   */
  function retrieveSupportToYieldPool(uint32 _id) external;

  /**
   * @notice Set ticker logic
   * @param _ticker Ticker
   * @param _pool Pool address
   * @param _override Override existing ticker logic. Only owner can override.
   */
  function setTickerLogic(string memory _ticker, address _pool, bool _override) external;

  /**
   * @notice When a slot is bought from the wrapped NFT
   */
  function onSlotBought() external payable;

  /**
   * @notice Get ticker logic
   * @param _ticker Ticker
   */
  function getTickerLogic(string memory _ticker) external view returns (address);

  /**
   * @notice Get supporter
   * @param _id Support ID
   */
  function getSupporter(uint32 _id) external view returns (Supporter memory);

  /**
   * @notice Get user contribution
   * @param _user User address
   * @param _collection Collection address
   */
  function getUserContribution(address _user, address _collection)
    external
    view
    returns (ContributionInfo memory);

  /**
   * @notice Get collection rewards
   * @param _collection Collection address
   */
  function getCollectionRewards(address _collection)
    external
    view
    returns (CollectionRewards memory);

  /**
   * @notice Get collection
   * @param _collection Collection address
   */
  function getCollection(address _collection) external view returns (Collection memory);

  function getCollectionImageIPFS(uint256 _id) external view returns (string memory);
}

// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0 <0.9.0;

/**
 * @title Permission
 * @dev Binary Roles Recommended Slots
 * 0x01  |  0x10
 * 0x02  |  0x20
 * 0x04  |  0x40
 * 0x08  |  0x80
 *
 * Don't use other slots unless you are familiar with bitewise operations
 */
abstract contract Permission {
  error InvalidPermission(bytes1 permissionNeeded);
  error PermissionAdminCannotBeEmpty();

  event SetPermissionAdmin(address admin);
  event PermissionChanged(address indexed target, bytes1 permission);

  mapping(address => bytes1) internal permissions;
  address private admin;

  modifier onlyPermission(bytes1 access) {
    if (permissions[msg.sender] & access == 0) revert InvalidPermission(access);
    _;
  }

  modifier onlyPermissionAdmin() {
    if (msg.sender != admin) revert InvalidPermission(0x00);
    _;
  }

  constructor(address _permissionAdmin) {
    if (_permissionAdmin == address(0)) revert PermissionAdminCannotBeEmpty();

    admin = _permissionAdmin;
    emit SetPermissionAdmin(_permissionAdmin);
  }

  function renouncePermissionAdmin() external onlyPermissionAdmin {
    admin = address(0);
    emit SetPermissionAdmin(address(0));
  }

  function transferPermissionAdmin(address _newAdmin) external onlyPermissionAdmin {
    admin = _newAdmin;
    emit SetPermissionAdmin(_newAdmin);
  }

  function setPermission(address _address, bytes1 _permission)
    external
    onlyPermissionAdmin
  {
    _setPermission(_address, _permission);
  }

  function _setPermission(address _address, bytes1 _permission) internal virtual {
    permissions[_address] = _permission;
    emit PermissionChanged(_address, _permission);
  }

  function addPermission(address _address, bytes1 _permission)
    external
    onlyPermissionAdmin
  {
    _addPermission(_address, _permission);
  }

  function _addPermission(address _address, bytes1 _permission) internal virtual {
    permissions[_address] |= _permission;
    emit PermissionChanged(_address, permissions[_address]);
  }

  function removePermission(address _address, bytes1 _permission)
    external
    onlyPermissionAdmin
  {
    _removePermission(_address, _permission);
  }

  function _removePermission(address _address, bytes1 _permission) internal virtual {
    permissions[_address] &= ~_permission;
    emit PermissionChanged(_address, permissions[_address]);
  }

  function clearPermission(address _address) external onlyPermissionAdmin {
    _clearPermission(_address);
  }

  function _clearPermission(address _address) internal virtual {
    _setPermission(_address, 0x00);
  }

  function getPermission(address _address) external view returns (bytes1) {
    return permissions[_address];
  }

  function hasPermission(address _address, bytes1 accessLevel) public view returns (bool) {
    return permissions[_address] & accessLevel != 0;
  }

  function permissionAdmin() public view returns (address) {
    return admin;
  }
}

// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;

interface IDripVault {
  error FailedToSendETH();
  error InvalidAmount();
  error NotObeliskRegistry();
  error NativeNotAccepted();
  error ZeroAddress();

  event ObeliskRegistryUpdated(address indexed obeliskRegistry);
  event InterestRateReceiverUpdated(address indexed interestRateReceiver);

  /**
   * @notice Deposits ETH or a specified amount of ERC20 token into the vault.
   * @dev ERC20 has to be transferred before calling this function
   */
  function deposit(uint256 _amount) external payable returns (uint256 depositAmount_);

  /**
   * @notice Withdraws ETH or a specified amount of ERC20 token from the vault.
   * @param _to The address to withdraw the funds to.
   * @param _amount The amount of ETH or ERC20 token to withdraw. Use 0 for ETH.
   */
  function withdraw(address _to, uint256 _amount)
    external
    returns (uint256 withdrawAmount_);

  /**
   * @notice Claims any accrued interest in the vault.
   * @return The amount of interest claimed.
   */
  function claim() external returns (uint256);

  /**
   * @notice Gets the total deposit amount in the vault.
   * @return The total deposit amount.
   */
  function getTotalDeposit() external view returns (uint256);

  /**
   * @notice Gets the input token of the vault.
   * @return The input token address.
   */
  function getInputToken() external view returns (address);

  /**
   * @notice Gets the output token of the vault.
   * @return The output token address.
   */
  function getOutputToken() external view returns (address);

  /**
   * @notice Gets the preview deposit amount of the vault.
   * @return The preview deposit amount.
   */
  function previewDeposit(uint256 _amount) external view returns (uint256);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);

    /**
     * @dev Returns the value of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the value of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves a `value` amount of tokens from the caller's account to `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, uint256 value) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the
     * caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 value) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to` using the
     * allowance mechanism. `value` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address from, address to, uint256 value) external returns (bool);
}

File 6 of 32 : IWrappedNFTFactory.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.25;

interface IWrappedNFTFactory {
  error NotRegistry();

  event WrappedNFTCreated(
    uint256 indexed id, address indexed addr, address indexed collection
  );

  function createWrappedNFT(
    address _collection,
    address _obeliskRegistry,
    uint256 _totalSupply,
    uint32 _unixTimeCreation,
    bool _premium
  ) external returns (address addr_);
}

// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;

interface IWrappedNFTHero {
  error AlreadyMinted();
  error NotMinted();
  error NotNFTHolder();
  error NoFreeSlots();
  error FreeSlotAvailable();
  error CannotTransferUnwrapFirst();
  error SameMultiplier();
  error InvalidNameLength();
  error InvalidWalletReceiver();
  error EmergencyWithdrawDisabled();
  error EmergencyModeIsActive();
  error NotObeliskRegistry();
  error NotNFTPassHolder();

  event Wrapped(uint256 indexed tokenId);
  event Unwrapped(uint256 indexed tokenId);
  event SlotBought(address indexed user, uint256 indexed inputCollectionNFTId);
  event FreeSlotUsed(uint256 freeSlotLeft);
  event EmergencyWithdrawEnabled();
  event MultiplierUpdated(uint256 indexed tokenId, uint128 newMultiplier);

  struct NFTData {
    bool isMinted;
    bool hasBeenRenamed;
    bool wrappedOnce;
    uint128 assignedMultiplier;
  }

  /**
   * @notice Wraps an NFT from the input collection into a Wrapped NFT Hero.
   * @param _inputCollectionNFTId The ID of the NFT to wrap.
   */
  function wrap(uint256 _inputCollectionNFTId) external payable;

  /**
   * @notice Renames a Wrapped NFT Hero.
   * @param _tokenId The ID of the Wrapped NFT Hero to rename.
   * @param _newName The new name for the Wrapped NFT Hero.
   */
  function rename(uint256 _tokenId, string memory _newName) external;

  /**
   * @notice Unwraps a Wrapped NFT Hero back into the original NFT from the input
   * collection.
   * @param _tokenId The ID of the Wrapped NFT Hero to unwrap.
   */
  function unwrap(uint256 _tokenId) external;

  /**
   * @notice Updates the multiplier of a Wrapped NFT Hero.
   * @param _tokenId The ID of the Wrapped NFT Hero to update the multiplier.
   * @dev Since the multiplier increases over-time, the user needs to update the
   * multiplier on their side. Not ideal, but good enough for the time we have.
   */
  function updateMultiplier(uint256 _tokenId) external;

  /**
   * @notice Returns the multiplier of the Wrapped NFT Hero.
   */
  function getWrapperMultiplier() external view returns (uint128);

  /**
   * @notice Returns the data of a Wrapped NFT Hero.
   * @param _tokenId The ID of the Wrapped NFT Hero to get the data.
   */
  function getNFTData(uint256 _tokenId) external view returns (NFTData memory);

  /**
   * @notice Enables emergency withdraw for the Wrapped NFT Hero.
   */
  function enableEmergencyWithdraw() external;
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.25;

import { ERC20 } from "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import { IHCT } from "src/interfaces/IHCT.sol";
import { IObeliskRegistry } from "src/interfaces/IObeliskRegistry.sol";

import { Math } from "@openzeppelin/contracts/utils/math/Math.sol";
import { ShareableMath } from "src/lib/ShareableMath.sol";
import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";

/**
 * @title HCT
 * @author Heroglyph
 * @notice HCT is the token used to pay for name changes on Obelisk and to vote for
 * Megapools share.
 * @custom:export abi
 */
contract HCT is ERC20, IHCT, Ownable {
  uint128 public constant NAME_COST = 90e18;
  uint256 public constant PRE_MINT_AMOUNT = 250_000e18;

  IObeliskRegistry public immutable obeliskRegistry;
  mapping(address => UserInfo) internal usersInfo;

  uint256 public inflationRate;
  uint256 public baseRate;
  uint256 public inflationThreshold;

  uint256 internal totalMultiplier;
  uint256 internal totalRewards;
  uint256 public yieldPerTokenInRay;
  uint32 internal lastUnixTimeRewards;
  uint32 internal totalWrappedNFT;

  constructor(address _owner, address _treasury)
    ERC20("Heroglyph Name Change Token", "HCT")
    Ownable(_owner)
  {
    obeliskRegistry = IObeliskRegistry(msg.sender);
    baseRate = 1e18;
    inflationRate = 0.02 ether;

    inflationThreshold = 1_000_000e18;
    _mint(_treasury, PRE_MINT_AMOUNT);
  }

  modifier onlyHeroglyphWrappedNFT() {
    if (!obeliskRegistry.isWrappedNFT(msg.sender)) revert NotWrappedNFT();
    _;
  }

  function addPower(address _user, uint128 _addMultiplier, bool _newNFT)
    external
    override
    onlyHeroglyphWrappedNFT
  {
    UserInfo storage userInfo = usersInfo[_user];
    uint256 totalMultiplierCached = totalMultiplier;

    if (totalMultiplierCached == 0) {
      lastUnixTimeRewards = uint32(block.timestamp);
    }

    _claim(_user, userInfo, false);

    uint256 userMultiplier = userInfo.multiplier + _addMultiplier;
    userInfo.multiplier = userMultiplier;
    totalMultiplier = totalMultiplierCached + _addMultiplier;

    userInfo.userRates = ShareableMath.rmulup(userMultiplier, yieldPerTokenInRay);

    emit PowerAdded(msg.sender, _user, _addMultiplier);

    if (_newNFT) {
      uint32 totalWrappedNFTCached = totalWrappedNFT + 1;
      totalWrappedNFT = totalWrappedNFTCached;
      emit TotalNFTWrapped(totalWrappedNFTCached);
    }
  }

  function removePower(address _user, uint128 _removeMultiplier)
    external
    override
    onlyHeroglyphWrappedNFT
  {
    UserInfo storage userInfo = usersInfo[_user];
    _claim(_user, userInfo, false);

    uint256 userMultiplier = userInfo.multiplier - _removeMultiplier;

    userInfo.multiplier = userMultiplier;
    totalMultiplier -= _removeMultiplier;

    userInfo.userRates = ShareableMath.rmulup(userMultiplier, yieldPerTokenInRay);

    emit PowerRemoved(msg.sender, _user, _removeMultiplier);

    uint32 totalWrappedNFTCached = totalWrappedNFT - 1;
    totalWrappedNFT = totalWrappedNFTCached;
    emit TotalNFTWrapped(totalWrappedNFTCached);
  }

  function usesForRenaming(address _user) external override onlyHeroglyphWrappedNFT {
    _claim(_user, usersInfo[_user], true);
    _burn(_user, NAME_COST);

    emit BurnedForRenaming(msg.sender, _user, NAME_COST);
  }

  function burn(address _user, uint256 _amount) external {
    _spendAllowance(_user, msg.sender, _amount);
    _burn(_user, _amount);
  }

  function claim() external {
    uint128 amount_ = _claim(msg.sender, usersInfo[msg.sender], true);
    if (amount_ == 0) revert NothingToClaim();
  }

  function _claim(address _user, UserInfo storage _userInfo, bool _updateUserRate)
    internal
    returns (uint128 amount_)
  {
    uint256 nextTotalRewards = totalRewards;

    nextTotalRewards += _getSystemPendingRewards(uint32(block.timestamp));
    lastUnixTimeRewards = uint32(block.timestamp);

    uint256 yieldPerTokenInRayCached = yieldPerTokenInRay;
    uint256 totalMultiplierCached = totalMultiplier;

    if (totalMultiplierCached > 0) {
      yieldPerTokenInRayCached +=
        ShareableMath.rdiv(nextTotalRewards - totalRewards, totalMultiplierCached);
    }

    uint256 last = _userInfo.userRates;
    uint256 curr = ShareableMath.rmulup(_userInfo.multiplier, yieldPerTokenInRayCached);

    if (curr > last) {
      amount_ = uint128(curr - last);
      _mint(_user, amount_);
      nextTotalRewards -= amount_;

      emit Claimed(_user, amount_);
    }

    totalRewards = nextTotalRewards;
    yieldPerTokenInRay = yieldPerTokenInRayCached;

    if (_updateUserRate) {
      _userInfo.userRates =
        uint128(ShareableMath.rmulup(_userInfo.multiplier, yieldPerTokenInRayCached));
    }

    return amount_;
  }

  function setInflationRate(uint256 _inflationRate) external onlyOwner {
    inflationRate = _inflationRate;
    emit InflationRateSet(_inflationRate);
  }

  function setBaseRate(uint256 _baseRate) external onlyOwner {
    baseRate = _baseRate;
    emit BaseRateSet(_baseRate);
  }

  function setInflationThreshold(uint256 _inflationThreshold) external onlyOwner {
    inflationThreshold = _inflationThreshold;
    emit InflationThresholdSet(_inflationThreshold);
  }

  function balanceOf(address _user) public view override returns (uint256) {
    return super.balanceOf(_user);
  }

  function getUserPendingRewards(address _user) external view override returns (uint256) {
    return _getUserPendingRewards(_user);
  }

  function _getUserPendingRewards(address _user) internal view returns (uint256 amount_) {
    if (totalMultiplier == 0) return 0;

    UserInfo memory userInfo = usersInfo[_user];
    uint256 nextTotalRewards = totalRewards;

    nextTotalRewards += _getSystemPendingRewards(uint32(block.timestamp));

    uint256 yieldPerTokenInRayCached = yieldPerTokenInRay;
    uint256 totalMultiplierCached = totalMultiplier;

    yieldPerTokenInRayCached +=
      ShareableMath.rdiv(nextTotalRewards - totalRewards, totalMultiplierCached);

    uint256 last = userInfo.userRates;
    uint256 curr = ShareableMath.rmulup(userInfo.multiplier, yieldPerTokenInRayCached);

    if (curr > last) {
      amount_ = uint128(curr - last);
    }

    return amount_;
  }

  function getSystemPendingRewards() external view override returns (uint256) {
    return _getSystemPendingRewards(uint32(block.timestamp));
  }

  function getTotalRewardsGenerated() external view override returns (uint256) {
    return totalRewards + _getSystemPendingRewards(uint32(block.timestamp));
  }

  function _getSystemPendingRewards(uint32 _currentTime) internal view returns (uint256) {
    uint32 timePassed = _currentTime - lastUnixTimeRewards;
    if (timePassed == 0) return 0;

    bool isInflation = totalSupply() >= inflationThreshold;

    uint256 rateReward =
      (totalWrappedNFT * (isInflation ? inflationRate : baseRate)) / 1 days;

    return uint256(timePassed * rateReward);
  }

  function getUserInfo(address _user) external view override returns (UserInfo memory) {
    return usersInfo[_user];
  }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/Math.sol)

pragma solidity ^0.8.20;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    /**
     * @dev Muldiv operation overflow.
     */
    error MathOverflowedMulDiv();

    enum Rounding {
        Floor, // Toward negative infinity
        Ceil, // Toward positive infinity
        Trunc, // Toward zero
        Expand // Away from zero
    }

    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            uint256 c = a + b;
            if (c < a) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, with an overflow flag.
     */
    function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b > a) return (false, 0);
            return (true, a - b);
        }
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.
     */
    function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
            // benefit is lost if 'b' is also tested.
            // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
            if (a == 0) return (true, 0);
            uint256 c = a * b;
            if (c / a != b) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the division of two unsigned integers, with a division by zero flag.
     */
    function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a / b);
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
     */
    function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a % b);
        }
    }

    /**
     * @dev Returns the largest of two numbers.
     */
    function max(uint256 a, uint256 b) internal pure returns (uint256) {
        return a > b ? a : b;
    }

    /**
     * @dev Returns the smallest of two numbers.
     */
    function min(uint256 a, uint256 b) internal pure returns (uint256) {
        return a < b ? a : b;
    }

    /**
     * @dev Returns the average of two numbers. The result is rounded towards
     * zero.
     */
    function average(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b) / 2 can overflow.
        return (a & b) + (a ^ b) / 2;
    }

    /**
     * @dev Returns the ceiling of the division of two numbers.
     *
     * This differs from standard division with `/` in that it rounds towards infinity instead
     * of rounding towards zero.
     */
    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
        if (b == 0) {
            // Guarantee the same behavior as in a regular Solidity division.
            return a / b;
        }

        // (a + b - 1) / b can overflow on addition, so we distribute.
        return a == 0 ? 0 : (a - 1) / b + 1;
    }

    /**
     * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or
     * denominator == 0.
     * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) with further edits by
     * Uniswap Labs also under MIT license.
     */
    function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {
        unchecked {
            // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
            // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
            // variables such that product = prod1 * 2^256 + prod0.
            uint256 prod0 = x * y; // Least significant 256 bits of the product
            uint256 prod1; // Most significant 256 bits of the product
            assembly {
                let mm := mulmod(x, y, not(0))
                prod1 := sub(sub(mm, prod0), lt(mm, prod0))
            }

            // Handle non-overflow cases, 256 by 256 division.
            if (prod1 == 0) {
                // Solidity will revert if denominator == 0, unlike the div opcode on its own.
                // The surrounding unchecked block does not change this fact.
                // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
                return prod0 / denominator;
            }

            // Make sure the result is less than 2^256. Also prevents denominator == 0.
            if (denominator <= prod1) {
                revert MathOverflowedMulDiv();
            }

            ///////////////////////////////////////////////
            // 512 by 256 division.
            ///////////////////////////////////////////////

            // Make division exact by subtracting the remainder from [prod1 prod0].
            uint256 remainder;
            assembly {
                // Compute remainder using mulmod.
                remainder := mulmod(x, y, denominator)

                // Subtract 256 bit number from 512 bit number.
                prod1 := sub(prod1, gt(remainder, prod0))
                prod0 := sub(prod0, remainder)
            }

            // Factor powers of two out of denominator and compute largest power of two divisor of denominator.
            // Always >= 1. See https://cs.stackexchange.com/q/138556/92363.

            uint256 twos = denominator & (0 - denominator);
            assembly {
                // Divide denominator by twos.
                denominator := div(denominator, twos)

                // Divide [prod1 prod0] by twos.
                prod0 := div(prod0, twos)

                // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
                twos := add(div(sub(0, twos), twos), 1)
            }

            // Shift in bits from prod1 into prod0.
            prod0 |= prod1 * twos;

            // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
            // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
            // four bits. That is, denominator * inv = 1 mod 2^4.
            uint256 inverse = (3 * denominator) ^ 2;

            // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also
            // works in modular arithmetic, doubling the correct bits in each step.
            inverse *= 2 - denominator * inverse; // inverse mod 2^8
            inverse *= 2 - denominator * inverse; // inverse mod 2^16
            inverse *= 2 - denominator * inverse; // inverse mod 2^32
            inverse *= 2 - denominator * inverse; // inverse mod 2^64
            inverse *= 2 - denominator * inverse; // inverse mod 2^128
            inverse *= 2 - denominator * inverse; // inverse mod 2^256

            // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
            // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
            // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
            // is no longer required.
            result = prod0 * inverse;
            return result;
        }
    }

    /**
     * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
     */
    function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {
        uint256 result = mulDiv(x, y, denominator);
        if (unsignedRoundsUp(rounding) && mulmod(x, y, denominator) > 0) {
            result += 1;
        }
        return result;
    }

    /**
     * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded
     * towards zero.
     *
     * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
     */
    function sqrt(uint256 a) internal pure returns (uint256) {
        if (a == 0) {
            return 0;
        }

        // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
        //
        // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
        // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
        //
        // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
        // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
        // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
        //
        // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
        uint256 result = 1 << (log2(a) >> 1);

        // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
        // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
        // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
        // into the expected uint128 result.
        unchecked {
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            return min(result, a / result);
        }
    }

    /**
     * @notice Calculates sqrt(a), following the selected rounding direction.
     */
    function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = sqrt(a);
            return result + (unsignedRoundsUp(rounding) && result * result < a ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 2 of a positive value rounded towards zero.
     * Returns 0 if given 0.
     */
    function log2(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 128;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 64;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 32;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 16;
            }
            if (value >> 8 > 0) {
                value >>= 8;
                result += 8;
            }
            if (value >> 4 > 0) {
                value >>= 4;
                result += 4;
            }
            if (value >> 2 > 0) {
                value >>= 2;
                result += 2;
            }
            if (value >> 1 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 2, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log2(value);
            return result + (unsignedRoundsUp(rounding) && 1 << result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 10 of a positive value rounded towards zero.
     * Returns 0 if given 0.
     */
    function log10(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >= 10 ** 64) {
                value /= 10 ** 64;
                result += 64;
            }
            if (value >= 10 ** 32) {
                value /= 10 ** 32;
                result += 32;
            }
            if (value >= 10 ** 16) {
                value /= 10 ** 16;
                result += 16;
            }
            if (value >= 10 ** 8) {
                value /= 10 ** 8;
                result += 8;
            }
            if (value >= 10 ** 4) {
                value /= 10 ** 4;
                result += 4;
            }
            if (value >= 10 ** 2) {
                value /= 10 ** 2;
                result += 2;
            }
            if (value >= 10 ** 1) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log10(value);
            return result + (unsignedRoundsUp(rounding) && 10 ** result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 256 of a positive value rounded towards zero.
     * Returns 0 if given 0.
     *
     * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
     */
    function log256(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 16;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 8;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 4;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 2;
            }
            if (value >> 8 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 256, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log256(value);
            return result + (unsignedRoundsUp(rounding) && 1 << (result << 3) < value ? 1 : 0);
        }
    }

    /**
     * @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers.
     */
    function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) {
        return uint8(rounding) % 2 == 1;
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/ReentrancyGuard.sol)

pragma solidity ^0.8.20;

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

    /**
     * @dev Unauthorized reentrant call.
     */
    error ReentrancyGuardReentrantCall();

    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() {
        _nonReentrantBefore();
        _;
        _nonReentrantAfter();
    }

    function _nonReentrantBefore() private {
        // On the first call to nonReentrant, _status will be NOT_ENTERED
        if (_status == ENTERED) {
            revert ReentrancyGuardReentrantCall();
        }

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

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

    /**
     * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
     * `nonReentrant` function in the call stack.
     */
    function _reentrancyGuardEntered() internal view returns (bool) {
        return _status == ENTERED;
    }
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.25;

import { WrappedNFTHero } from "src/services/nft/WrappedNFTHero.sol";
import { IWrappedNFTFactory } from "src/interfaces/IWrappedNFTFactory.sol";

contract WrappedNFTFactory is IWrappedNFTFactory {
  address public immutable HCT_ADDRESS;
  address public immutable NFT_PASS;
  address public immutable REGISTRY;

  mapping(address => bool) public generators;

  uint256 public lastId;

  constructor(address _hctAddress, address _nftPass) {
    REGISTRY = msg.sender;
    HCT_ADDRESS = _hctAddress;
    NFT_PASS = _nftPass;
  }

  function createWrappedNFT(
    address _collection,
    address _obeliskRegistry,
    uint256 _totalSupply,
    uint32 _unixTimeCreation,
    bool _premium
  ) external override returns (address addr_) {
    if (msg.sender != REGISTRY) revert NotRegistry();

    uint256 id = ++lastId;

    addr_ = address(
      new WrappedNFTHero(
        HCT_ADDRESS,
        NFT_PASS,
        _collection,
        _obeliskRegistry,
        _totalSupply,
        _unixTimeCreation,
        _premium,
        id
      )
    );

    emit WrappedNFTCreated(id, addr_, _collection);

    return addr_;
  }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/ERC20.sol)

pragma solidity ^0.8.20;

import {IERC20} from "./IERC20.sol";
import {IERC20Metadata} from "./extensions/IERC20Metadata.sol";
import {Context} from "../../utils/Context.sol";
import {IERC20Errors} from "../../interfaces/draft-IERC6093.sol";

/**
 * @dev Implementation of the {IERC20} interface.
 *
 * This implementation is agnostic to the way tokens are created. This means
 * that a supply mechanism has to be added in a derived contract using {_mint}.
 *
 * TIP: For a detailed writeup see our guide
 * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How
 * to implement supply mechanisms].
 *
 * The default value of {decimals} is 18. To change this, you should override
 * this function so it returns a different value.
 *
 * We have followed general OpenZeppelin Contracts guidelines: functions revert
 * instead returning `false` on failure. This behavior is nonetheless
 * conventional and does not conflict with the expectations of ERC20
 * applications.
 *
 * Additionally, an {Approval} event is emitted on calls to {transferFrom}.
 * This allows applications to reconstruct the allowance for all accounts just
 * by listening to said events. Other implementations of the EIP may not emit
 * these events, as it isn't required by the specification.
 */
abstract contract ERC20 is Context, IERC20, IERC20Metadata, IERC20Errors {
    mapping(address account => uint256) private _balances;

    mapping(address account => mapping(address spender => uint256)) private _allowances;

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

    /**
     * @dev Sets the values for {name} and {symbol}.
     *
     * All two of these values are immutable: they can only be set once during
     * construction.
     */
    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

    /**
     * @dev Returns the name of the token.
     */
    function name() public view virtual returns (string memory) {
        return _name;
    }

    /**
     * @dev Returns the symbol of the token, usually a shorter version of the
     * name.
     */
    function symbol() public view virtual returns (string memory) {
        return _symbol;
    }

    /**
     * @dev Returns the number of decimals used to get its user representation.
     * For example, if `decimals` equals `2`, a balance of `505` tokens should
     * be displayed to a user as `5.05` (`505 / 10 ** 2`).
     *
     * Tokens usually opt for a value of 18, imitating the relationship between
     * Ether and Wei. This is the default value returned by this function, unless
     * it's overridden.
     *
     * NOTE: This information is only used for _display_ purposes: it in
     * no way affects any of the arithmetic of the contract, including
     * {IERC20-balanceOf} and {IERC20-transfer}.
     */
    function decimals() public view virtual returns (uint8) {
        return 18;
    }

    /**
     * @dev See {IERC20-totalSupply}.
     */
    function totalSupply() public view virtual returns (uint256) {
        return _totalSupply;
    }

    /**
     * @dev See {IERC20-balanceOf}.
     */
    function balanceOf(address account) public view virtual returns (uint256) {
        return _balances[account];
    }

    /**
     * @dev See {IERC20-transfer}.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - the caller must have a balance of at least `value`.
     */
    function transfer(address to, uint256 value) public virtual returns (bool) {
        address owner = _msgSender();
        _transfer(owner, to, value);
        return true;
    }

    /**
     * @dev See {IERC20-allowance}.
     */
    function allowance(address owner, address spender) public view virtual returns (uint256) {
        return _allowances[owner][spender];
    }

    /**
     * @dev See {IERC20-approve}.
     *
     * NOTE: If `value` is the maximum `uint256`, the allowance is not updated on
     * `transferFrom`. This is semantically equivalent to an infinite approval.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function approve(address spender, uint256 value) public virtual returns (bool) {
        address owner = _msgSender();
        _approve(owner, spender, value);
        return true;
    }

    /**
     * @dev See {IERC20-transferFrom}.
     *
     * Emits an {Approval} event indicating the updated allowance. This is not
     * required by the EIP. See the note at the beginning of {ERC20}.
     *
     * NOTE: Does not update the allowance if the current allowance
     * is the maximum `uint256`.
     *
     * Requirements:
     *
     * - `from` and `to` cannot be the zero address.
     * - `from` must have a balance of at least `value`.
     * - the caller must have allowance for ``from``'s tokens of at least
     * `value`.
     */
    function transferFrom(address from, address to, uint256 value) public virtual returns (bool) {
        address spender = _msgSender();
        _spendAllowance(from, spender, value);
        _transfer(from, to, value);
        return true;
    }

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to`.
     *
     * This internal function is equivalent to {transfer}, and can be used to
     * e.g. implement automatic token fees, slashing mechanisms, etc.
     *
     * Emits a {Transfer} event.
     *
     * NOTE: This function is not virtual, {_update} should be overridden instead.
     */
    function _transfer(address from, address to, uint256 value) internal {
        if (from == address(0)) {
            revert ERC20InvalidSender(address(0));
        }
        if (to == address(0)) {
            revert ERC20InvalidReceiver(address(0));
        }
        _update(from, to, value);
    }

    /**
     * @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints (or burns) if `from`
     * (or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding
     * this function.
     *
     * Emits a {Transfer} event.
     */
    function _update(address from, address to, uint256 value) internal virtual {
        if (from == address(0)) {
            // Overflow check required: The rest of the code assumes that totalSupply never overflows
            _totalSupply += value;
        } else {
            uint256 fromBalance = _balances[from];
            if (fromBalance < value) {
                revert ERC20InsufficientBalance(from, fromBalance, value);
            }
            unchecked {
                // Overflow not possible: value <= fromBalance <= totalSupply.
                _balances[from] = fromBalance - value;
            }
        }

        if (to == address(0)) {
            unchecked {
                // Overflow not possible: value <= totalSupply or value <= fromBalance <= totalSupply.
                _totalSupply -= value;
            }
        } else {
            unchecked {
                // Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256.
                _balances[to] += value;
            }
        }

        emit Transfer(from, to, value);
    }

    /**
     * @dev Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0).
     * Relies on the `_update` mechanism
     *
     * Emits a {Transfer} event with `from` set to the zero address.
     *
     * NOTE: This function is not virtual, {_update} should be overridden instead.
     */
    function _mint(address account, uint256 value) internal {
        if (account == address(0)) {
            revert ERC20InvalidReceiver(address(0));
        }
        _update(address(0), account, value);
    }

    /**
     * @dev Destroys a `value` amount of tokens from `account`, lowering the total supply.
     * Relies on the `_update` mechanism.
     *
     * Emits a {Transfer} event with `to` set to the zero address.
     *
     * NOTE: This function is not virtual, {_update} should be overridden instead
     */
    function _burn(address account, uint256 value) internal {
        if (account == address(0)) {
            revert ERC20InvalidSender(address(0));
        }
        _update(account, address(0), value);
    }

    /**
     * @dev Sets `value` as the allowance of `spender` over the `owner` s tokens.
     *
     * This internal function is equivalent to `approve`, and can be used to
     * e.g. set automatic allowances for certain subsystems, etc.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `owner` cannot be the zero address.
     * - `spender` cannot be the zero address.
     *
     * Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument.
     */
    function _approve(address owner, address spender, uint256 value) internal {
        _approve(owner, spender, value, true);
    }

    /**
     * @dev Variant of {_approve} with an optional flag to enable or disable the {Approval} event.
     *
     * By default (when calling {_approve}) the flag is set to true. On the other hand, approval changes made by
     * `_spendAllowance` during the `transferFrom` operation set the flag to false. This saves gas by not emitting any
     * `Approval` event during `transferFrom` operations.
     *
     * Anyone who wishes to continue emitting `Approval` events on the`transferFrom` operation can force the flag to
     * true using the following override:
     * ```
     * function _approve(address owner, address spender, uint256 value, bool) internal virtual override {
     *     super._approve(owner, spender, value, true);
     * }
     * ```
     *
     * Requirements are the same as {_approve}.
     */
    function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual {
        if (owner == address(0)) {
            revert ERC20InvalidApprover(address(0));
        }
        if (spender == address(0)) {
            revert ERC20InvalidSpender(address(0));
        }
        _allowances[owner][spender] = value;
        if (emitEvent) {
            emit Approval(owner, spender, value);
        }
    }

    /**
     * @dev Updates `owner` s allowance for `spender` based on spent `value`.
     *
     * Does not update the allowance value in case of infinite allowance.
     * Revert if not enough allowance is available.
     *
     * Does not emit an {Approval} event.
     */
    function _spendAllowance(address owner, address spender, uint256 value) internal virtual {
        uint256 currentAllowance = allowance(owner, spender);
        if (currentAllowance != type(uint256).max) {
            if (currentAllowance < value) {
                revert ERC20InsufficientAllowance(spender, currentAllowance, value);
            }
            unchecked {
                _approve(owner, spender, currentAllowance - value, false);
            }
        }
    }
}

// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;

interface IHCT {
  error NotWrappedNFT();
  error NothingToClaim();

  event TotalNFTWrapped(uint256 totalWrappedNFT);
  event PowerAdded(address indexed wrappedNFT, address indexed user, uint128 multiplier);
  event PowerRemoved(
    address indexed wrappedNFT, address indexed user, uint128 multiplier
  );
  event Transferred(
    address indexed wrappedNFT,
    address indexed from,
    address indexed to,
    uint128 multiplier
  );
  event Claimed(address indexed user, uint256 amount);
  event BurnedForRenaming(
    address indexed wrappedNFT, address indexed user, uint256 amount
  );
  event InflationRateSet(uint256 inflationRate);
  event BaseRateSet(uint256 baseRate);
  event InflationThresholdSet(uint256 inflationThreshold);

  struct UserInfo {
    uint256 multiplier;
    uint256 userRates;
  }

  function addPower(address _user, uint128 _addMultiplier, bool _newNFT) external;
  function removePower(address _user, uint128 _removeMultiplier) external;
  function burn(address _user, uint256 _amount) external;
  function usesForRenaming(address _user) external;
  function getUserPendingRewards(address _user) external view returns (uint256);
  function getSystemPendingRewards() external view returns (uint256);
  function getTotalRewardsGenerated() external view returns (uint256);
  function getUserInfo(address _user) external view returns (UserInfo memory);
}

// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;

library ShareableMath {
  uint256 constant RAY = 10 ** 27;

  /// @notice Calculates floor(a×b÷denominator) with full precision. Throws if result
  /// overflows a uint256 or
  /// denominator == 0
  /// @param a The multiplicand
  /// @param b The multiplier
  /// @param denominator The divisor
  /// @return result The 256-bit result
  /// @dev Credit to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv
  function mulDiv(uint256 a, uint256 b, uint256 denominator)
    internal
    pure
    returns (uint256 result)
  {
    unchecked {
      // 512-bit multiply [prod1 prod0] = a * b
      // Compute the product mod 2**256 and mod 2**256 - 1
      // then use the Chinese Remainder Theorem to reconstruct
      // the 512 bit result. The result is stored in two 256
      // variables such that product = prod1 * 2**256 + prod0
      uint256 prod0; // Least significant 256 bits of the product
      uint256 prod1; // Most significant 256 bits of the product
      assembly {
        let mm := mulmod(a, b, not(0))
        prod0 := mul(a, b)
        prod1 := sub(sub(mm, prod0), lt(mm, prod0))
      }

      // Handle non-overflow cases, 256 by 256 division
      if (prod1 == 0) {
        require(denominator > 0);
        assembly {
          result := div(prod0, denominator)
        }
        return result;
      }

      // Make sure the result is less than 2**256.
      // Also prevents denominator == 0
      require(denominator > prod1);

      ///////////////////////////////////////////////
      // 512 by 256 division.
      ///////////////////////////////////////////////

      // Make division exact by subtracting the remainder from [prod1 prod0]
      // Compute remainder using mulmod
      uint256 remainder;
      assembly {
        remainder := mulmod(a, b, denominator)
      }
      // Subtract 256 bit number from 512 bit number
      assembly {
        prod1 := sub(prod1, gt(remainder, prod0))
        prod0 := sub(prod0, remainder)
      }

      // Factor powers of two out of denominator
      // Compute largest power of two divisor of denominator.
      // Always >= 1.
      uint256 twos = (type(uint256).max - denominator + 1) & denominator;
      // Divide denominator by power of two
      assembly {
        denominator := div(denominator, twos)
      }

      // Divide [prod1 prod0] by the factors of two
      assembly {
        prod0 := div(prod0, twos)
      }
      // Shift in bits from prod1 into prod0. For this we need
      // to flip `twos` such that it is 2**256 / twos.
      // If twos is zero, then it becomes one
      assembly {
        twos := add(div(sub(0, twos), twos), 1)
      }
      prod0 |= prod1 * twos;

      // Invert denominator mod 2**256
      // Now that denominator is an odd number, it has an inverse
      // modulo 2**256 such that denominator * inv = 1 mod 2**256.
      // Compute the inverse by starting with a seed that is correct
      // correct for four bits. That is, denominator * inv = 1 mod 2**4
      uint256 inv = (3 * denominator) ^ 2;
      // Now use Newton-Raphson iteration to improve the precision.
      // Thanks to Hensel's lifting lemma, this also works in modular
      // arithmetic, doubling the correct bits in each step.
      inv *= 2 - denominator * inv; // inverse mod 2**8
      inv *= 2 - denominator * inv; // inverse mod 2**16
      inv *= 2 - denominator * inv; // inverse mod 2**32
      inv *= 2 - denominator * inv; // inverse mod 2**64
      inv *= 2 - denominator * inv; // inverse mod 2**128
      inv *= 2 - denominator * inv; // inverse mod 2**256

      // Because the division is now exact we can divide by multiplying
      // with the modular inverse of denominator. This will give us the
      // correct result modulo 2**256. Since the precoditions guarantee
      // that the outcome is less than 2**256, this is the final result.
      // We don't need to compute the high bits of the result and prod1
      // is no longer required.
      result = prod0 * inv;
      return result;
    }
  }

  function divup(uint256 x, uint256 y) internal pure returns (uint256 z) {
    z = (x + (y - 1)) / y;
  }

  function rmul(uint256 x, uint256 y) internal pure returns (uint256 z) {
    z = (x * y) / RAY;
  }

  function rmulup(uint256 x, uint256 y) internal pure returns (uint256 z) {
    z = divup((x * y), RAY);
  }

  function rdiv(uint256 x, uint256 y) internal pure returns (uint256 z) {
    z = mulDiv(x, RAY, y);
  }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)

pragma solidity ^0.8.20;

import {Context} from "../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.
 *
 * The initial owner is set to the address provided by the deployer. 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;

    /**
     * @dev The caller account is not authorized to perform an operation.
     */
    error OwnableUnauthorizedAccount(address account);

    /**
     * @dev The owner is not a valid owner account. (eg. `address(0)`)
     */
    error OwnableInvalidOwner(address owner);

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

    /**
     * @dev Initializes the contract setting the address provided by the deployer as the initial owner.
     */
    constructor(address initialOwner) {
        if (initialOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(initialOwner);
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

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

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        if (owner() != _msgSender()) {
            revert OwnableUnauthorizedAccount(_msgSender());
        }
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby disabling any functionality that is only available to the owner.
     */
    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 {
        if (newOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _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);
    }
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.25;

import { IWrappedNFTHero } from "src/interfaces/IWrappedNFTHero.sol";
import { ObeliskNFT } from "./ObeliskNFT.sol";
import { IHCT } from "src/interfaces/IHCT.sol";
import { IObeliskRegistry } from "src/interfaces/IObeliskRegistry.sol";
import { ERC721 } from "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import { IERC721Receiver } from "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import { Math } from "@openzeppelin/contracts/utils/math/Math.sol";
import { strings } from "src/lib/strings.sol";
import { IERC721 } from "@openzeppelin/contracts/token/ERC721/IERC721.sol";

/**
 * @title WrappedNFTHero
 * @notice It allows users to wrap their NFT to get a WrappedNFTHero NFT.
 * @custom:export abi
 * @dev The NFT ID of this contract is reflecting the NFT ID from the input collection.
 */
contract WrappedNFTHero is IWrappedNFTHero, ERC721, IERC721Receiver, ObeliskNFT {
  using strings for string;
  using strings for strings.slice;

  uint256 private constant MAX_BPS = 10_000;
  uint256 private constant SECONDS_PER_YEAR = 31_557_600;

  uint256 public constant SLOT_PRICE = 0.1e18;
  uint256 public constant FREE_SLOT_BPS = 2500; // 25 %

  uint256 public constant RATE_PER_YEAR = 0.43e18;
  uint256 public constant MAX_RATE = 3e18;

  IHCT public immutable HCT;
  ERC721 public immutable INPUT_COLLECTION;

  uint32 public immutable COLLECTION_STARTED_UNIX_TIME;
  bool public immutable FREE_SLOT_FOR_ODD;
  bool public immutable PREMIUM;
  bool public emergencyWithdrawEnabled;

  uint256 public freeSlots;

  mapping(uint256 => NFTData) internal nftData;

  uint256 public immutable ID;

  constructor(
    address _HCT,
    address _nftPass,
    address _inputCollection,
    address _obeliskRegistry,
    uint256 _currentSupply,
    uint32 _collectionStartedUnixTime,
    bool _premium,
    uint256 _id
  ) ERC721("WrappedNFTHero", "WNH") ObeliskNFT(_obeliskRegistry, _nftPass) {
    HCT = IHCT(_HCT);
    INPUT_COLLECTION = ERC721(_inputCollection);

    freeSlots = _currentSupply * FREE_SLOT_BPS / MAX_BPS;
    FREE_SLOT_FOR_ODD = uint256(keccak256(abi.encode(_inputCollection))) % 2 == 1;
    COLLECTION_STARTED_UNIX_TIME = _collectionStartedUnixTime;
    PREMIUM = _premium;
    ID = _id;
  }

  /// @inheritdoc IWrappedNFTHero
  function wrap(uint256 _inputCollectionNFTId) external payable override {
    if (emergencyWithdrawEnabled) revert EmergencyModeIsActive();
    if (IERC721(address(NFT_PASS)).balanceOf(msg.sender) == 0) revert NotNFTPassHolder();

    bool isIdOdd = _inputCollectionNFTId % 2 == 1;
    bool canHaveFreeSlot = freeSlots != 0 && FREE_SLOT_FOR_ODD == isIdOdd;

    NFTData storage nftdata = nftData[_inputCollectionNFTId];
    bool didWrapBefore = nftdata.wrappedOnce;

    if (nftdata.isMinted) revert AlreadyMinted();

    if ((canHaveFreeSlot || didWrapBefore) && msg.value != 0) revert FreeSlotAvailable();
    if ((!canHaveFreeSlot && !didWrapBefore) && msg.value != SLOT_PRICE) {
      revert NoFreeSlots();
    }

    nftdata.isMinted = true;
    INPUT_COLLECTION.transferFrom(msg.sender, address(this), _inputCollectionNFTId);

    _safeMint(msg.sender, _inputCollectionNFTId);
    emit Wrapped(_inputCollectionNFTId);

    if (didWrapBefore) return;
    nftdata.wrappedOnce = true;

    if (!canHaveFreeSlot) {
      obeliskRegistry.onSlotBought{ value: msg.value }();
      emit SlotBought(msg.sender, _inputCollectionNFTId);
    } else {
      freeSlots--;
      emit FreeSlotUsed(freeSlots);
    }
  }

  /// @inheritdoc IWrappedNFTHero
  function rename(uint256 _tokenId, string memory _newName) external override {
    uint256 nameBytesLength = bytes(_newName).length;
    if (nameBytesLength == 0 || nameBytesLength > MAX_NAME_BYTES_LENGTH) {
      revert InvalidNameLength();
    }

    _renameRequirements(_tokenId);
    _updateMultiplier(_tokenId);

    bytes32 identity;
    address receiver;

    if (bytes(names[_tokenId]).length != 0) {
      (identity, receiver) = _getIdentityInformation(_tokenId);
      _removeOldTickers(identity, receiver, _tokenId, false);
    }

    (identity, receiver) = _updateIdentity(_tokenId, _newName);
    _addNewTickers(identity, receiver, _tokenId, _newName);

    emit NameUpdated(_tokenId, _newName);
    names[_tokenId] = _newName;
  }

  function _renameRequirements(uint256 _tokenId) internal {
    NFTData storage nftdata = nftData[_tokenId];

    if (!nftdata.isMinted) revert NotMinted();
    if (_ownerOf(_tokenId) != msg.sender) revert NotNFTHolder();

    if (PREMIUM && !nftdata.hasBeenRenamed) {
      nftdata.hasBeenRenamed = true;
      return;
    }

    HCT.usesForRenaming(msg.sender);
  }

  function _updateIdentity(uint256 _tokenId, string memory _name)
    internal
    virtual
    returns (bytes32 _identity, address receiver_)
  {
    strings.slice memory nameSlice = _name.toSlice();
    strings.slice memory needle = TICKER_START_IDENTITY.toSlice();
    string memory substring =
      nameSlice.find(needle).beyond(needle).split(string(" ").toSlice()).toString();

    receiver_ = NFT_PASS.getMetadata(0, substring).walletReceiver;

    if (receiver_ == address(0)) revert InvalidWalletReceiver();

    nftPassAttached[_tokenId] = substring;

    return (keccak256(abi.encode(substring)), receiver_);
  }

  /// @inheritdoc IWrappedNFTHero
  function unwrap(uint256 _tokenId) external override {
    NFTData storage nftdata = nftData[_tokenId];

    if (!nftdata.isMinted) revert NotMinted();
    if (_ownerOf(_tokenId) != msg.sender) revert NotNFTHolder();

    if (!emergencyWithdrawEnabled) {
      (bytes32 identity, address receiver) = _getIdentityInformation(_tokenId);
      _removeOldTickers(identity, receiver, _tokenId, false);
    }

    _burn(_tokenId);
    delete names[_tokenId];
    delete nftPassAttached[_tokenId];

    nftdata.assignedMultiplier = 0;
    nftdata.isMinted = false;

    INPUT_COLLECTION.safeTransferFrom(address(this), msg.sender, _tokenId);

    emit Unwrapped(_tokenId);
  }

  function _claimRequirements(uint256 _tokenId) internal view override returns (bool) {
    if (_ownerOf(_tokenId) != msg.sender) revert NotNFTHolder();
    return true;
  }

  function _update(address to, uint256 tokenId, address auth)
    internal
    override
    returns (address)
  {
    NFTData storage nftdata = nftData[tokenId];

    address from = _ownerOf(tokenId);
    uint128 multiplier = nftdata.assignedMultiplier;

    if (to == address(0)) {
      HCT.removePower(from, multiplier);
      multiplier = 0;
    } else if (from == address(0)) {
      multiplier = getWrapperMultiplier();
      HCT.addPower(to, multiplier, true);
    } else {
      revert CannotTransferUnwrapFirst();
    }

    nftdata.assignedMultiplier = multiplier;
    emit MultiplierUpdated(tokenId, multiplier);

    return super._update(to, tokenId, auth);
  }

  function _getIdentityInformation(uint256 _tokenId)
    internal
    view
    override
    returns (bytes32, address)
  {
    string memory nftPass = nftPassAttached[_tokenId];

    return
      (keccak256(abi.encode(nftPass)), NFT_PASS.getMetadata(0, nftPass).walletReceiver);
  }

  /// @inheritdoc IWrappedNFTHero
  function updateMultiplier(uint256 _tokenId) external override {
    if (!_updateMultiplier(_tokenId)) revert SameMultiplier();
  }

  function _updateMultiplier(uint256 _tokenId) internal returns (bool) {
    NFTData storage nftdata = nftData[_tokenId];
    if (_ownerOf(_tokenId) != msg.sender) revert NotNFTHolder();

    uint128 newMultiplier = getWrapperMultiplier();
    uint128 multiplier = nftdata.assignedMultiplier;

    if (newMultiplier == multiplier) return false;

    HCT.addPower(msg.sender, newMultiplier - multiplier, false);
    nftData[_tokenId].assignedMultiplier = newMultiplier;
    emit MultiplierUpdated(_tokenId, newMultiplier);

    return true;
  }

  /// @inheritdoc IWrappedNFTHero
  function enableEmergencyWithdraw() external override {
    if (msg.sender != address(obeliskRegistry)) revert NotObeliskRegistry();
    emergencyWithdrawEnabled = true;

    emit EmergencyWithdrawEnabled();
  }

  /// @inheritdoc IWrappedNFTHero
  function getWrapperMultiplier() public view override returns (uint128) {
    if (PREMIUM) return uint128(MAX_RATE);

    uint256 currentYear =
      (block.timestamp - COLLECTION_STARTED_UNIX_TIME) / SECONDS_PER_YEAR;
    return uint128(Math.min(currentYear * RATE_PER_YEAR, MAX_RATE));
  }

  /// @inheritdoc IWrappedNFTHero
  function getNFTData(uint256 _tokenId) external view override returns (NFTData memory) {
    return nftData[_tokenId];
  }

  function onERC721Received(address, address, uint256, bytes calldata)
    external
    pure
    override
    returns (bytes4)
  {
    return this.onERC721Received.selector;
  }

  function tokenURI(uint256 tokenId) public view override returns (string memory) {
    _requireOwned(tokenId);

    string memory name = names[tokenId];

    if (bytes(name).length == 0) name = "Unnamed";

    string memory data = string(
      abi.encodePacked(
        '{"name":"',
        name,
        '","description":"Wrapped Version of an external collection","image":"',
        IObeliskRegistry(obeliskRegistry).getCollectionImageIPFS(ID),
        '"}'
      )
    );

    return string(abi.encodePacked("data:application/json;utf8,", data));
  }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Metadata.sol)

pragma solidity ^0.8.20;

import {IERC20} from "../IERC20.sol";

/**
 * @dev Interface for the optional metadata functions from the ERC20 standard.
 */
interface IERC20Metadata is IERC20 {
    /**
     * @dev Returns the name of the token.
     */
    function name() external view returns (string memory);

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

    /**
     * @dev Returns the decimals places of the token.
     */
    function decimals() external view returns (uint8);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)

pragma solidity ^0.8.20;

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

    function _contextSuffixLength() internal view virtual returns (uint256) {
        return 0;
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC6093.sol)
pragma solidity ^0.8.20;

/**
 * @dev Standard ERC20 Errors
 * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC20 tokens.
 */
interface IERC20Errors {
    /**
     * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     * @param balance Current balance for the interacting account.
     * @param needed Minimum amount required to perform a transfer.
     */
    error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed);

    /**
     * @dev Indicates a failure with the token `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     */
    error ERC20InvalidSender(address sender);

    /**
     * @dev Indicates a failure with the token `receiver`. Used in transfers.
     * @param receiver Address to which tokens are being transferred.
     */
    error ERC20InvalidReceiver(address receiver);

    /**
     * @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers.
     * @param spender Address that may be allowed to operate on tokens without being their owner.
     * @param allowance Amount of tokens a `spender` is allowed to operate with.
     * @param needed Minimum amount required to perform a transfer.
     */
    error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed);

    /**
     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
     * @param approver Address initiating an approval operation.
     */
    error ERC20InvalidApprover(address approver);

    /**
     * @dev Indicates a failure with the `spender` to be approved. Used in approvals.
     * @param spender Address that may be allowed to operate on tokens without being their owner.
     */
    error ERC20InvalidSpender(address spender);
}

/**
 * @dev Standard ERC721 Errors
 * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC721 tokens.
 */
interface IERC721Errors {
    /**
     * @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in EIP-20.
     * Used in balance queries.
     * @param owner Address of the current owner of a token.
     */
    error ERC721InvalidOwner(address owner);

    /**
     * @dev Indicates a `tokenId` whose `owner` is the zero address.
     * @param tokenId Identifier number of a token.
     */
    error ERC721NonexistentToken(uint256 tokenId);

    /**
     * @dev Indicates an error related to the ownership over a particular token. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     * @param tokenId Identifier number of a token.
     * @param owner Address of the current owner of a token.
     */
    error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner);

    /**
     * @dev Indicates a failure with the token `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     */
    error ERC721InvalidSender(address sender);

    /**
     * @dev Indicates a failure with the token `receiver`. Used in transfers.
     * @param receiver Address to which tokens are being transferred.
     */
    error ERC721InvalidReceiver(address receiver);

    /**
     * @dev Indicates a failure with the `operator`’s approval. Used in transfers.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     * @param tokenId Identifier number of a token.
     */
    error ERC721InsufficientApproval(address operator, uint256 tokenId);

    /**
     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
     * @param approver Address initiating an approval operation.
     */
    error ERC721InvalidApprover(address approver);

    /**
     * @dev Indicates a failure with the `operator` to be approved. Used in approvals.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     */
    error ERC721InvalidOperator(address operator);
}

/**
 * @dev Standard ERC1155 Errors
 * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC1155 tokens.
 */
interface IERC1155Errors {
    /**
     * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     * @param balance Current balance for the interacting account.
     * @param needed Minimum amount required to perform a transfer.
     * @param tokenId Identifier number of a token.
     */
    error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId);

    /**
     * @dev Indicates a failure with the token `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     */
    error ERC1155InvalidSender(address sender);

    /**
     * @dev Indicates a failure with the token `receiver`. Used in transfers.
     * @param receiver Address to which tokens are being transferred.
     */
    error ERC1155InvalidReceiver(address receiver);

    /**
     * @dev Indicates a failure with the `operator`’s approval. Used in transfers.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     * @param owner Address of the current owner of a token.
     */
    error ERC1155MissingApprovalForAll(address operator, address owner);

    /**
     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
     * @param approver Address initiating an approval operation.
     */
    error ERC1155InvalidApprover(address approver);

    /**
     * @dev Indicates a failure with the `operator` to be approved. Used in approvals.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     */
    error ERC1155InvalidOperator(address operator);

    /**
     * @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation.
     * Used in batch transfers.
     * @param idsLength Length of the array of token identifiers
     * @param valuesLength Length of the array of token amounts
     */
    error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.25;

import { IObeliskNFT } from "src/interfaces/IObeliskNFT.sol";
import { ILiteTicker } from "src/interfaces/ILiteTicker.sol";
import { IObeliskRegistry } from "src/interfaces/IObeliskRegistry.sol";
import { INFTPass } from "src/interfaces/INFTPass.sol";

import { strings } from "src/lib/strings.sol";
import { ReentrancyGuard } from "@openzeppelin/contracts/utils/ReentrancyGuard.sol";

/**
 * @title ObeliskNFT
 * @notice Base contract for Obelisk NFTs. It contains the staking logic via name.
 */
abstract contract ObeliskNFT is IObeliskNFT, ReentrancyGuard {
  using strings for string;
  using strings for strings.slice;

  string public constant TICKER_START_INDICE = "#";
  string public constant TICKER_SPLIT_STRING = ",";
  string public constant TICKER_START_IDENTITY = "@";
  uint32 public constant MAX_NAME_BYTES_LENGTH = 29;
  IObeliskRegistry public immutable obeliskRegistry;
  INFTPass public immutable NFT_PASS;

  mapping(uint256 => string) public nftPassAttached;
  mapping(uint256 => address[]) internal linkedTickers;
  mapping(uint256 => string) public names;

  constructor(address _obeliskRegistry, address _nftPass) {
    obeliskRegistry = IObeliskRegistry(_obeliskRegistry);
    NFT_PASS = INFTPass(_nftPass);
  }

  function _removeOldTickers(
    bytes32 _identity,
    address _receiver,
    uint256 _tokenId,
    bool _ignoreRewards
  ) internal nonReentrant {
    address[] memory activePools = linkedTickers[_tokenId];
    delete linkedTickers[_tokenId];

    address currentPool;

    for (uint256 i = 0; i < activePools.length; ++i) {
      currentPool = activePools[i];

      ILiteTicker(currentPool).virtualWithdraw(
        _identity, _tokenId, _receiver, _ignoreRewards
      );

      emit TickerDeactivated(_tokenId, currentPool);
    }
  }

  function _addNewTickers(
    bytes32 _identity,
    address _receiver,
    uint256 _tokenId,
    string memory _name
  ) internal virtual nonReentrant {
    strings.slice memory nameSlice = _name.toSlice();
    strings.slice memory needle = TICKER_START_INDICE.toSlice();
    strings.slice memory substring =
      nameSlice.find(needle).beyond(needle).split(string(" ").toSlice());
    strings.slice memory delim = TICKER_SPLIT_STRING.toSlice();

    address[] memory poolTargets = new address[](substring.count(delim) + 1);

    address poolTarget;
    string memory tickerName;
    for (uint256 i = 0; i < poolTargets.length; ++i) {
      tickerName = substring.split(delim).toString();
      if (bytes(tickerName).length == 0) continue;

      poolTarget = obeliskRegistry.getTickerLogic(tickerName);
      if (poolTarget == address(0)) continue;

      poolTargets[i] = poolTarget;

      ILiteTicker(poolTarget).virtualDeposit(_identity, _tokenId, _receiver);
      emit TickerActivated(_tokenId, poolTarget);
    }

    linkedTickers[_tokenId] = poolTargets;
  }

  /// @inheritdoc IObeliskNFT
  function claim(uint256 _tokenId) external nonReentrant {
    address[] memory activePools = linkedTickers[_tokenId];
    assert(_claimRequirements(_tokenId));

    (bytes32 identity, address identityReceiver) = _getIdentityInformation(_tokenId);

    for (uint256 i = 0; i < activePools.length; i++) {
      ILiteTicker(activePools[i]).claim(identity, _tokenId, identityReceiver, false);
      emit TickerClaimed(_tokenId, activePools[i]);
    }
  }

  function _claimRequirements(uint256 _tokenId) internal view virtual returns (bool);

  function getIdentityInformation(uint256 _tokenId)
    external
    view
    override
    returns (bytes32 identityInTicker_, address rewardReceiver_)
  {
    return _getIdentityInformation(_tokenId);
  }

  function _getIdentityInformation(uint256 _tokenId)
    internal
    view
    virtual
    returns (bytes32, address);

  function getLinkedTickers(uint256 _tokenId) external view returns (address[] memory) {
    return linkedTickers[_tokenId];
  }

  function getPendingRewards(uint256 _tokenId)
    external
    view
    returns (uint256[] memory pendingRewards_, address[] memory pendingRewardsTokens_)
  {
    address[] memory activePools = linkedTickers[_tokenId];
    (bytes32 identity,) = _getIdentityInformation(_tokenId);

    pendingRewards_ = new uint256[](activePools.length);
    pendingRewardsTokens_ = new address[](activePools.length);

    uint256 pendingRewards;
    address pendingRewardsToken;

    for (uint256 i = 0; i < activePools.length; ++i) {
      (pendingRewards, pendingRewardsToken) =
        ILiteTicker(activePools[i]).getClaimableRewards(identity, 0);

      pendingRewards_[i] = pendingRewards;
      pendingRewardsTokens_[i] = pendingRewardsToken;
    }

    return (pendingRewards_, pendingRewardsTokens_);
  }
}

File 21 of 32 : ERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/ERC721.sol)

pragma solidity ^0.8.20;

import {IERC721} from "./IERC721.sol";
import {IERC721Receiver} from "./IERC721Receiver.sol";
import {IERC721Metadata} from "./extensions/IERC721Metadata.sol";
import {Context} from "../../utils/Context.sol";
import {Strings} from "../../utils/Strings.sol";
import {IERC165, ERC165} from "../../utils/introspection/ERC165.sol";
import {IERC721Errors} from "../../interfaces/draft-IERC6093.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}.
 */
abstract contract ERC721 is Context, ERC165, IERC721, IERC721Metadata, IERC721Errors {
    using Strings for uint256;

    // Token name
    string private _name;

    // Token symbol
    string private _symbol;

    mapping(uint256 tokenId => address) private _owners;

    mapping(address owner => uint256) private _balances;

    mapping(uint256 tokenId => address) private _tokenApprovals;

    mapping(address owner => mapping(address operator => 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 returns (uint256) {
        if (owner == address(0)) {
            revert ERC721InvalidOwner(address(0));
        }
        return _balances[owner];
    }

    /**
     * @dev See {IERC721-ownerOf}.
     */
    function ownerOf(uint256 tokenId) public view virtual returns (address) {
        return _requireOwned(tokenId);
    }

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

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

    /**
     * @dev See {IERC721Metadata-tokenURI}.
     */
    function tokenURI(uint256 tokenId) public view virtual returns (string memory) {
        _requireOwned(tokenId);

        string memory baseURI = _baseURI();
        return bytes(baseURI).length > 0 ? string.concat(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 overridden in child contracts.
     */
    function _baseURI() internal view virtual returns (string memory) {
        return "";
    }

    /**
     * @dev See {IERC721-approve}.
     */
    function approve(address to, uint256 tokenId) public virtual {
        _approve(to, tokenId, _msgSender());
    }

    /**
     * @dev See {IERC721-getApproved}.
     */
    function getApproved(uint256 tokenId) public view virtual returns (address) {
        _requireOwned(tokenId);

        return _getApproved(tokenId);
    }

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

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

    /**
     * @dev See {IERC721-transferFrom}.
     */
    function transferFrom(address from, address to, uint256 tokenId) public virtual {
        if (to == address(0)) {
            revert ERC721InvalidReceiver(address(0));
        }
        // Setting an "auth" arguments enables the `_isAuthorized` check which verifies that the token exists
        // (from != 0). Therefore, it is not needed to verify that the return value is not 0 here.
        address previousOwner = _update(to, tokenId, _msgSender());
        if (previousOwner != from) {
            revert ERC721IncorrectOwner(from, tokenId, previousOwner);
        }
    }

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

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public virtual {
        transferFrom(from, to, tokenId);
        _checkOnERC721Received(from, to, tokenId, data);
    }

    /**
     * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist
     *
     * IMPORTANT: Any overrides to this function that add ownership of tokens not tracked by the
     * core ERC721 logic MUST be matched with the use of {_increaseBalance} to keep balances
     * consistent with ownership. The invariant to preserve is that for any address `a` the value returned by
     * `balanceOf(a)` must be equal to the number of tokens such that `_ownerOf(tokenId)` is `a`.
     */
    function _ownerOf(uint256 tokenId) internal view virtual returns (address) {
        return _owners[tokenId];
    }

    /**
     * @dev Returns the approved address for `tokenId`. Returns 0 if `tokenId` is not minted.
     */
    function _getApproved(uint256 tokenId) internal view virtual returns (address) {
        return _tokenApprovals[tokenId];
    }

    /**
     * @dev Returns whether `spender` is allowed to manage `owner`'s tokens, or `tokenId` in
     * particular (ignoring whether it is owned by `owner`).
     *
     * WARNING: This function assumes that `owner` is the actual owner of `tokenId` and does not verify this
     * assumption.
     */
    function _isAuthorized(address owner, address spender, uint256 tokenId) internal view virtual returns (bool) {
        return
            spender != address(0) &&
            (owner == spender || isApprovedForAll(owner, spender) || _getApproved(tokenId) == spender);
    }

    /**
     * @dev Checks if `spender` can operate on `tokenId`, assuming the provided `owner` is the actual owner.
     * Reverts if `spender` does not have approval from the provided `owner` for the given token or for all its assets
     * the `spender` for the specific `tokenId`.
     *
     * WARNING: This function assumes that `owner` is the actual owner of `tokenId` and does not verify this
     * assumption.
     */
    function _checkAuthorized(address owner, address spender, uint256 tokenId) internal view virtual {
        if (!_isAuthorized(owner, spender, tokenId)) {
            if (owner == address(0)) {
                revert ERC721NonexistentToken(tokenId);
            } else {
                revert ERC721InsufficientApproval(spender, tokenId);
            }
        }
    }

    /**
     * @dev Unsafe write access to the balances, used by extensions that "mint" tokens using an {ownerOf} override.
     *
     * NOTE: the value is limited to type(uint128).max. This protect against _balance overflow. It is unrealistic that
     * a uint256 would ever overflow from increments when these increments are bounded to uint128 values.
     *
     * WARNING: Increasing an account's balance using this function tends to be paired with an override of the
     * {_ownerOf} function to resolve the ownership of the corresponding tokens so that balances and ownership
     * remain consistent with one another.
     */
    function _increaseBalance(address account, uint128 value) internal virtual {
        unchecked {
            _balances[account] += value;
        }
    }

    /**
     * @dev Transfers `tokenId` from its current owner to `to`, or alternatively mints (or burns) if the current owner
     * (or `to`) is the zero address. Returns the owner of the `tokenId` before the update.
     *
     * The `auth` argument is optional. If the value passed is non 0, then this function will check that
     * `auth` is either the owner of the token, or approved to operate on the token (by the owner).
     *
     * Emits a {Transfer} event.
     *
     * NOTE: If overriding this function in a way that tracks balances, see also {_increaseBalance}.
     */
    function _update(address to, uint256 tokenId, address auth) internal virtual returns (address) {
        address from = _ownerOf(tokenId);

        // Perform (optional) operator check
        if (auth != address(0)) {
            _checkAuthorized(from, auth, tokenId);
        }

        // Execute the update
        if (from != address(0)) {
            // Clear approval. No need to re-authorize or emit the Approval event
            _approve(address(0), tokenId, address(0), false);

            unchecked {
                _balances[from] -= 1;
            }
        }

        if (to != address(0)) {
            unchecked {
                _balances[to] += 1;
            }
        }

        _owners[tokenId] = to;

        emit Transfer(from, to, tokenId);

        return from;
    }

    /**
     * @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 {
        if (to == address(0)) {
            revert ERC721InvalidReceiver(address(0));
        }
        address previousOwner = _update(to, tokenId, address(0));
        if (previousOwner != address(0)) {
            revert ERC721InvalidSender(address(0));
        }
    }

    /**
     * @dev Mints `tokenId`, transfers it to `to` and checks for `to` acceptance.
     *
     * 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 {
        _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);
        _checkOnERC721Received(address(0), to, tokenId, data);
    }

    /**
     * @dev Destroys `tokenId`.
     * The approval is cleared when the token is burned.
     * This is an internal function that does not check if the sender is authorized to operate on the token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     *
     * Emits a {Transfer} event.
     */
    function _burn(uint256 tokenId) internal {
        address previousOwner = _update(address(0), tokenId, address(0));
        if (previousOwner == address(0)) {
            revert ERC721NonexistentToken(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 {
        if (to == address(0)) {
            revert ERC721InvalidReceiver(address(0));
        }
        address previousOwner = _update(to, tokenId, address(0));
        if (previousOwner == address(0)) {
            revert ERC721NonexistentToken(tokenId);
        } else if (previousOwner != from) {
            revert ERC721IncorrectOwner(from, tokenId, previousOwner);
        }
    }

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking that contract recipients
     * are aware of the ERC721 standard 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 like {safeTransferFrom} in the sense that it invokes
     * {IERC721Receiver-onERC721Received} on the receiver, and can be used to e.g.
     * implement alternative mechanisms to perform token transfer, such as signature-based.
     *
     * Requirements:
     *
     * - `tokenId` token must exist and be owned by `from`.
     * - `to` cannot be the zero address.
     * - `from` cannot be the zero address.
     * - 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) internal {
        _safeTransfer(from, to, tokenId, "");
    }

    /**
     * @dev Same as {xref-ERC721-_safeTransfer-address-address-uint256-}[`_safeTransfer`], with an additional `data` parameter which is
     * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
     */
    function _safeTransfer(address from, address to, uint256 tokenId, bytes memory data) internal virtual {
        _transfer(from, to, tokenId);
        _checkOnERC721Received(from, to, tokenId, data);
    }

    /**
     * @dev Approve `to` to operate on `tokenId`
     *
     * The `auth` argument is optional. If the value passed is non 0, then this function will check that `auth` is
     * either the owner of the token, or approved to operate on all tokens held by this owner.
     *
     * Emits an {Approval} event.
     *
     * Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument.
     */
    function _approve(address to, uint256 tokenId, address auth) internal {
        _approve(to, tokenId, auth, true);
    }

    /**
     * @dev Variant of `_approve` with an optional flag to enable or disable the {Approval} event. The event is not
     * emitted in the context of transfers.
     */
    function _approve(address to, uint256 tokenId, address auth, bool emitEvent) internal virtual {
        // Avoid reading the owner unless necessary
        if (emitEvent || auth != address(0)) {
            address owner = _requireOwned(tokenId);

            // We do not use _isAuthorized because single-token approvals should not be able to call approve
            if (auth != address(0) && owner != auth && !isApprovedForAll(owner, auth)) {
                revert ERC721InvalidApprover(auth);
            }

            if (emitEvent) {
                emit Approval(owner, to, tokenId);
            }
        }

        _tokenApprovals[tokenId] = to;
    }

    /**
     * @dev Approve `operator` to operate on all of `owner` tokens
     *
     * Requirements:
     * - operator can't be the address zero.
     *
     * Emits an {ApprovalForAll} event.
     */
    function _setApprovalForAll(address owner, address operator, bool approved) internal virtual {
        if (operator == address(0)) {
            revert ERC721InvalidOperator(operator);
        }
        _operatorApprovals[owner][operator] = approved;
        emit ApprovalForAll(owner, operator, approved);
    }

    /**
     * @dev Reverts if the `tokenId` doesn't have a current owner (it hasn't been minted, or it has been burned).
     * Returns the owner.
     *
     * Overrides to ownership logic should be done to {_ownerOf}.
     */
    function _requireOwned(uint256 tokenId) internal view returns (address) {
        address owner = _ownerOf(tokenId);
        if (owner == address(0)) {
            revert ERC721NonexistentToken(tokenId);
        }
        return owner;
    }

    /**
     * @dev Private function to invoke {IERC721Receiver-onERC721Received} on a target address. This will revert if the
     * recipient doesn't accept the token transfer. 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
     */
    function _checkOnERC721Received(address from, address to, uint256 tokenId, bytes memory data) private {
        if (to.code.length > 0) {
            try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {
                if (retval != IERC721Receiver.onERC721Received.selector) {
                    revert ERC721InvalidReceiver(to);
                }
            } catch (bytes memory reason) {
                if (reason.length == 0) {
                    revert ERC721InvalidReceiver(to);
                } else {
                    /// @solidity memory-safe-assembly
                    assembly {
                        revert(add(32, reason), mload(reason))
                    }
                }
            }
        }
    }
}

File 22 of 32 : IERC721Receiver.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/IERC721Receiver.sol)

pragma solidity ^0.8.20;

/**
 * @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 `IERC721Receiver.onERC721Received.selector`.
     */
    function onERC721Received(
        address operator,
        address from,
        uint256 tokenId,
        bytes calldata data
    ) external returns (bytes4);
}

/*
 * @title String & slice utility library for Solidity contracts.
 * @author Nick Johnson <arachnid@notdot.net>
 *
 * @dev Functionality in this library is largely implemented using an
 *      abstraction called a 'slice'. A slice represents a part of a string -
 *      anything from the entire string to a single character, or even no
 *      characters at all (a 0-length slice). Since a slice only has to specify
 *      an offset and a length, copying and manipulating slices is a lot less
 *      expensive than copying and manipulating the strings they reference.
 *
 *      To further reduce gas costs, most functions on slice that need to return
 *      a slice modify the original one instead of allocating a new one; for
 *      instance, `s.split(".")` will return the text up to the first '.',
 *      modifying s to only contain the remainder of the string after the '.'.
 *      In situations where you do not want to modify the original slice, you
 *      can make a copy first with `.copy()`, for example:
 *      `s.copy().split(".")`. Try and avoid using this idiom in loops; since
 *      Solidity has no memory management, it will result in allocating many
 *      short-lived slices that are later discarded.
 *
 *      Functions that return two slices come in two versions: a non-allocating
 *      version that takes the second slice as an argument, modifying it in
 *      place, and an allocating version that allocates and returns the second
 *      slice; see `nextRune` for example.
 *
 *      Functions that have to copy string data will return strings rather than
 *      slices; these can be cast back to slices for further processing if
 *      required.
 *
 *      For convenience, some functions are provided with non-modifying
 *      variants that create a new slice and return both; for instance,
 *      `s.splitNew('.')` leaves s unmodified, and returns two values
 *      corresponding to the left and right parts of the string.
 */

pragma solidity ^0.8.0;

library strings {
  struct slice {
    uint256 _len;
    uint256 _ptr;
  }

  function memcpy(uint256 dest, uint256 src, uint256 _len) private pure {
    // Copy word-length chunks while possible
    for (; _len >= 32; _len -= 32) {
      assembly {
        mstore(dest, mload(src))
      }
      dest += 32;
      src += 32;
    }

    // Copy remaining bytes
    uint256 mask = type(uint256).max;
    if (_len > 0) {
      mask = 256 ** (32 - _len) - 1;
    }
    assembly {
      let srcpart := and(mload(src), not(mask))
      let destpart := and(mload(dest), mask)
      mstore(dest, or(destpart, srcpart))
    }
  }

  /*
     * @dev Returns a slice containing the entire string.
     * @param self The string to make a slice from.
     * @return A newly allocated slice containing the entire string.
     */
  function toSlice(string memory self) internal pure returns (slice memory) {
    uint256 ptr;
    assembly {
      ptr := add(self, 0x20)
    }
    return slice(bytes(self).length, ptr);
  }

  /*
     * @dev Returns the length of a null-terminated bytes32 string.
     * @param self The value to find the length of.
     * @return The length of the string, from 0 to 32.
     */
  function len(bytes32 self) internal pure returns (uint256) {
    uint256 ret;
    if (self == 0) {
      return 0;
    }
    if (uint256(self) & type(uint128).max == 0) {
      ret += 16;
      self = bytes32(uint256(self) / 0x100000000000000000000000000000000);
    }
    if (uint256(self) & type(uint64).max == 0) {
      ret += 8;
      self = bytes32(uint256(self) / 0x10000000000000000);
    }
    if (uint256(self) & type(uint32).max == 0) {
      ret += 4;
      self = bytes32(uint256(self) / 0x100000000);
    }
    if (uint256(self) & type(uint16).max == 0) {
      ret += 2;
      self = bytes32(uint256(self) / 0x10000);
    }
    if (uint256(self) & type(uint8).max == 0) {
      ret += 1;
    }
    return 32 - ret;
  }

  /*
     * @dev Returns a slice containing the entire bytes32, interpreted as a
     *      null-terminated utf-8 string.
     * @param self The bytes32 value to convert to a slice.
     * @return A new slice containing the value of the input argument up to the
     *         first null.
     */
  function toSliceB32(bytes32 self) internal pure returns (slice memory ret) {
    // Allocate space for `self` in memory, copy it there, and point ret at it
    assembly {
      let ptr := mload(0x40)
      mstore(0x40, add(ptr, 0x20))
      mstore(ptr, self)
      mstore(add(ret, 0x20), ptr)
    }
    ret._len = len(self);
  }

  /*
     * @dev Returns a new slice containing the same data as the current slice.
     * @param self The slice to copy.
     * @return A new slice containing the same data as `self`.
     */
  function copy(slice memory self) internal pure returns (slice memory) {
    return slice(self._len, self._ptr);
  }

  /*
     * @dev Copies a slice to a new string.
     * @param self The slice to copy.
     * @return A newly allocated string containing the slice's text.
     */
  function toString(slice memory self) internal pure returns (string memory) {
    string memory ret = new string(self._len);
    uint256 retptr;
    assembly {
      retptr := add(ret, 32)
    }

    memcpy(retptr, self._ptr, self._len);
    return ret;
  }

  /*
     * @dev Returns the length in runes of the slice. Note that this operation
     *      takes time proportional to the length of the slice; avoid using it
     *      in loops, and call `slice.empty()` if you only need to know whether
     *      the slice is empty or not.
     * @param self The slice to operate on.
     * @return The length of the slice in runes.
     */
  function len(slice memory self) internal pure returns (uint256 l) {
    // Starting at ptr-31 means the LSB will be the byte we care about
    uint256 ptr = self._ptr - 31;
    uint256 end = ptr + self._len;
    for (l = 0; ptr < end; l++) {
      uint8 b;
      assembly {
        b := and(mload(ptr), 0xFF)
      }
      if (b < 0x80) {
        ptr += 1;
      } else if (b < 0xE0) {
        ptr += 2;
      } else if (b < 0xF0) {
        ptr += 3;
      } else if (b < 0xF8) {
        ptr += 4;
      } else if (b < 0xFC) {
        ptr += 5;
      } else {
        ptr += 6;
      }
    }
  }

  /*
     * @dev Returns true if the slice is empty (has a length of 0).
     * @param self The slice to operate on.
     * @return True if the slice is empty, False otherwise.
     */
  function empty(slice memory self) internal pure returns (bool) {
    return self._len == 0;
  }

  /*
     * @dev Returns a positive number if `other` comes lexicographically after
     *      `self`, a negative number if it comes before, or zero if the
     *      contents of the two slices are equal. Comparison is done per-rune,
     *      on unicode codepoints.
     * @param self The first slice to compare.
     * @param other The second slice to compare.
     * @return The result of the comparison.
     */
  function compare(slice memory self, slice memory other) internal pure returns (int256) {
    uint256 shortest = self._len;
    if (other._len < self._len) {
      shortest = other._len;
    }

    uint256 selfptr = self._ptr;
    uint256 otherptr = other._ptr;
    for (uint256 idx = 0; idx < shortest; idx += 32) {
      uint256 a;
      uint256 b;
      assembly {
        a := mload(selfptr)
        b := mload(otherptr)
      }
      if (a != b) {
        // Mask out irrelevant bytes and check again
        uint256 mask = type(uint256).max; // 0xffff...
        if (shortest < 32) {
          mask = ~(2 ** (8 * (32 - shortest + idx)) - 1);
        }
        unchecked {
          uint256 diff = (a & mask) - (b & mask);
          if (diff != 0) {
            return int256(diff);
          }
        }
      }
      selfptr += 32;
      otherptr += 32;
    }
    return int256(self._len) - int256(other._len);
  }

  /*
     * @dev Returns true if the two slices contain the same text.
     * @param self The first slice to compare.
     * @param self The second slice to compare.
     * @return True if the slices are equal, false otherwise.
     */
  function equals(slice memory self, slice memory other) internal pure returns (bool) {
    return compare(self, other) == 0;
  }

  /*
     * @dev Extracts the first rune in the slice into `rune`, advancing the
     *      slice to point to the next rune and returning `self`.
     * @param self The slice to operate on.
     * @param rune The slice that will contain the first rune.
     * @return `rune`.
     */
  function nextRune(slice memory self, slice memory rune)
    internal
    pure
    returns (slice memory)
  {
    rune._ptr = self._ptr;

    if (self._len == 0) {
      rune._len = 0;
      return rune;
    }

    uint256 l;
    uint256 b;
    // Load the first byte of the rune into the LSBs of b
    assembly {
      b := and(mload(sub(mload(add(self, 32)), 31)), 0xFF)
    }
    if (b < 0x80) {
      l = 1;
    } else if (b < 0xE0) {
      l = 2;
    } else if (b < 0xF0) {
      l = 3;
    } else {
      l = 4;
    }

    // Check for truncated codepoints
    if (l > self._len) {
      rune._len = self._len;
      self._ptr += self._len;
      self._len = 0;
      return rune;
    }

    self._ptr += l;
    self._len -= l;
    rune._len = l;
    return rune;
  }

  /*
     * @dev Returns the first rune in the slice, advancing the slice to point
     *      to the next rune.
     * @param self The slice to operate on.
     * @return A slice containing only the first rune from `self`.
     */
  function nextRune(slice memory self) internal pure returns (slice memory ret) {
    nextRune(self, ret);
  }

  /*
     * @dev Returns the number of the first codepoint in the slice.
     * @param self The slice to operate on.
     * @return The number of the first codepoint in the slice.
     */
  function ord(slice memory self) internal pure returns (uint256 ret) {
    if (self._len == 0) {
      return 0;
    }

    uint256 word;
    uint256 length;
    uint256 divisor = 2 ** 248;

    // Load the rune into the MSBs of b
    assembly {
      word := mload(mload(add(self, 32)))
    }
    uint256 b = word / divisor;
    if (b < 0x80) {
      ret = b;
      length = 1;
    } else if (b < 0xE0) {
      ret = b & 0x1F;
      length = 2;
    } else if (b < 0xF0) {
      ret = b & 0x0F;
      length = 3;
    } else {
      ret = b & 0x07;
      length = 4;
    }

    // Check for truncated codepoints
    if (length > self._len) {
      return 0;
    }

    for (uint256 i = 1; i < length; i++) {
      divisor = divisor / 256;
      b = (word / divisor) & 0xFF;
      if (b & 0xC0 != 0x80) {
        // Invalid UTF-8 sequence
        return 0;
      }
      ret = (ret * 64) | (b & 0x3F);
    }

    return ret;
  }

  /*
     * @dev Returns the keccak-256 hash of the slice.
     * @param self The slice to hash.
     * @return The hash of the slice.
     */
  function keccak(slice memory self) internal pure returns (bytes32 ret) {
    assembly {
      ret := keccak256(mload(add(self, 32)), mload(self))
    }
  }

  /*
     * @dev Returns true if `self` starts with `needle`.
     * @param self The slice to operate on.
     * @param needle The slice to search for.
     * @return True if the slice starts with the provided text, false otherwise.
     */
  function startsWith(slice memory self, slice memory needle)
    internal
    pure
    returns (bool)
  {
    if (self._len < needle._len) {
      return false;
    }

    if (self._ptr == needle._ptr) {
      return true;
    }

    bool equal;
    assembly {
      let length := mload(needle)
      let selfptr := mload(add(self, 0x20))
      let needleptr := mload(add(needle, 0x20))
      equal := eq(keccak256(selfptr, length), keccak256(needleptr, length))
    }
    return equal;
  }

  /*
     * @dev If `self` starts with `needle`, `needle` is removed from the
     *      beginning of `self`. Otherwise, `self` is unmodified.
     * @param self The slice to operate on.
     * @param needle The slice to search for.
     * @return `self`
     */
  function beyond(slice memory self, slice memory needle)
    internal
    pure
    returns (slice memory)
  {
    if (self._len < needle._len) {
      return self;
    }

    bool equal = true;
    if (self._ptr != needle._ptr) {
      assembly {
        let length := mload(needle)
        let selfptr := mload(add(self, 0x20))
        let needleptr := mload(add(needle, 0x20))
        equal := eq(keccak256(selfptr, length), keccak256(needleptr, length))
      }
    }

    if (equal) {
      self._len -= needle._len;
      self._ptr += needle._len;
    }

    return self;
  }

  /*
     * @dev Returns true if the slice ends with `needle`.
     * @param self The slice to operate on.
     * @param needle The slice to search for.
     * @return True if the slice starts with the provided text, false otherwise.
     */
  function endsWith(slice memory self, slice memory needle) internal pure returns (bool) {
    if (self._len < needle._len) {
      return false;
    }

    uint256 selfptr = self._ptr + self._len - needle._len;

    if (selfptr == needle._ptr) {
      return true;
    }

    bool equal;
    assembly {
      let length := mload(needle)
      let needleptr := mload(add(needle, 0x20))
      equal := eq(keccak256(selfptr, length), keccak256(needleptr, length))
    }

    return equal;
  }

  /*
     * @dev If `self` ends with `needle`, `needle` is removed from the
     *      end of `self`. Otherwise, `self` is unmodified.
     * @param self The slice to operate on.
     * @param needle The slice to search for.
     * @return `self`
     */
  function until(slice memory self, slice memory needle)
    internal
    pure
    returns (slice memory)
  {
    if (self._len < needle._len) {
      return self;
    }

    uint256 selfptr = self._ptr + self._len - needle._len;
    bool equal = true;
    if (selfptr != needle._ptr) {
      assembly {
        let length := mload(needle)
        let needleptr := mload(add(needle, 0x20))
        equal := eq(keccak256(selfptr, length), keccak256(needleptr, length))
      }
    }

    if (equal) {
      self._len -= needle._len;
    }

    return self;
  }

  // Returns the memory address of the first byte of the first occurrence of
  // `needle` in `self`, or the first byte after `self` if not found.
  function findPtr(uint256 selflen, uint256 selfptr, uint256 needlelen, uint256 needleptr)
    private
    pure
    returns (uint256)
  {
    uint256 ptr = selfptr;
    uint256 idx;

    if (needlelen <= selflen) {
      if (needlelen <= 32) {
        bytes32 mask;
        if (needlelen > 0) {
          mask = bytes32(~(2 ** (8 * (32 - needlelen)) - 1));
        }

        bytes32 needledata;
        assembly {
          needledata := and(mload(needleptr), mask)
        }

        uint256 end = selfptr + selflen - needlelen;
        bytes32 ptrdata;
        assembly {
          ptrdata := and(mload(ptr), mask)
        }

        while (ptrdata != needledata) {
          if (ptr >= end) {
            return selfptr + selflen;
          }
          ptr++;
          assembly {
            ptrdata := and(mload(ptr), mask)
          }
        }
        return ptr;
      } else {
        // For long needles, use hashing
        bytes32 hash;
        assembly {
          hash := keccak256(needleptr, needlelen)
        }

        for (idx = 0; idx <= selflen - needlelen; idx++) {
          bytes32 testHash;
          assembly {
            testHash := keccak256(ptr, needlelen)
          }
          if (hash == testHash) {
            return ptr;
          }
          ptr += 1;
        }
      }
    }
    return selfptr + selflen;
  }

  // Returns the memory address of the first byte after the last occurrence of
  // `needle` in `self`, or the address of `self` if not found.
  function rfindPtr(
    uint256 selflen,
    uint256 selfptr,
    uint256 needlelen,
    uint256 needleptr
  ) private pure returns (uint256) {
    uint256 ptr;

    if (needlelen <= selflen) {
      if (needlelen <= 32) {
        bytes32 mask;
        if (needlelen > 0) {
          mask = bytes32(~(2 ** (8 * (32 - needlelen)) - 1));
        }

        bytes32 needledata;
        assembly {
          needledata := and(mload(needleptr), mask)
        }

        ptr = selfptr + selflen - needlelen;
        bytes32 ptrdata;
        assembly {
          ptrdata := and(mload(ptr), mask)
        }

        while (ptrdata != needledata) {
          if (ptr <= selfptr) {
            return selfptr;
          }
          ptr--;
          assembly {
            ptrdata := and(mload(ptr), mask)
          }
        }
        return ptr + needlelen;
      } else {
        // For long needles, use hashing
        bytes32 hash;
        assembly {
          hash := keccak256(needleptr, needlelen)
        }
        ptr = selfptr + (selflen - needlelen);
        while (ptr >= selfptr) {
          bytes32 testHash;
          assembly {
            testHash := keccak256(ptr, needlelen)
          }
          if (hash == testHash) {
            return ptr + needlelen;
          }
          ptr -= 1;
        }
      }
    }
    return selfptr;
  }

  /*
     * @dev Modifies `self` to contain everything from the first occurrence of
     *      `needle` to the end of the slice. `self` is set to the empty slice
     *      if `needle` is not found.
     * @param self The slice to search and modify.
     * @param needle The text to search for.
     * @return `self`.
     */
  function find(slice memory self, slice memory needle)
    internal
    pure
    returns (slice memory)
  {
    uint256 ptr = findPtr(self._len, self._ptr, needle._len, needle._ptr);
    self._len -= ptr - self._ptr;
    self._ptr = ptr;
    return self;
  }

  /*
     * @dev Modifies `self` to contain the part of the string from the start of
     *      `self` to the end of the first occurrence of `needle`. If `needle`
     *      is not found, `self` is set to the empty slice.
     * @param self The slice to search and modify.
     * @param needle The text to search for.
     * @return `self`.
     */
  function rfind(slice memory self, slice memory needle)
    internal
    pure
    returns (slice memory)
  {
    uint256 ptr = rfindPtr(self._len, self._ptr, needle._len, needle._ptr);
    self._len = ptr - self._ptr;
    return self;
  }

  /*
     * @dev Splits the slice, setting `self` to everything after the first
     *      occurrence of `needle`, and `token` to everything before it. If
     *      `needle` does not occur in `self`, `self` is set to the empty slice,
     *      and `token` is set to the entirety of `self`.
     * @param self The slice to split.
     * @param needle The text to search for in `self`.
     * @param token An output parameter to which the first token is written.
     * @return `token`.
     */
  function split(slice memory self, slice memory needle, slice memory token)
    internal
    pure
    returns (slice memory)
  {
    uint256 ptr = findPtr(self._len, self._ptr, needle._len, needle._ptr);
    token._ptr = self._ptr;
    token._len = ptr - self._ptr;
    if (ptr == self._ptr + self._len) {
      // Not found
      self._len = 0;
    } else {
      self._len -= token._len + needle._len;
      self._ptr = ptr + needle._len;
    }
    return token;
  }

  /*
     * @dev Splits the slice, setting `self` to everything after the first
     *      occurrence of `needle`, and returning everything before it. If
     *      `needle` does not occur in `self`, `self` is set to the empty slice,
     *      and the entirety of `self` is returned.
     * @param self The slice to split.
     * @param needle The text to search for in `self`.
     * @return The part of `self` up to the first occurrence of `delim`.
     */
  function split(slice memory self, slice memory needle)
    internal
    pure
    returns (slice memory token)
  {
    split(self, needle, token);
  }

  /*
     * @dev Splits the slice, setting `self` to everything before the last
     *      occurrence of `needle`, and `token` to everything after it. If
     *      `needle` does not occur in `self`, `self` is set to the empty slice,
     *      and `token` is set to the entirety of `self`.
     * @param self The slice to split.
     * @param needle The text to search for in `self`.
     * @param token An output parameter to which the first token is written.
     * @return `token`.
     */
  function rsplit(slice memory self, slice memory needle, slice memory token)
    internal
    pure
    returns (slice memory)
  {
    uint256 ptr = rfindPtr(self._len, self._ptr, needle._len, needle._ptr);
    token._ptr = ptr;
    token._len = self._len - (ptr - self._ptr);
    if (ptr == self._ptr) {
      // Not found
      self._len = 0;
    } else {
      self._len -= token._len + needle._len;
    }
    return token;
  }

  /*
     * @dev Splits the slice, setting `self` to everything before the last
     *      occurrence of `needle`, and returning everything after it. If
     *      `needle` does not occur in `self`, `self` is set to the empty slice,
     *      and the entirety of `self` is returned.
     * @param self The slice to split.
     * @param needle The text to search for in `self`.
     * @return The part of `self` after the last occurrence of `delim`.
     */
  function rsplit(slice memory self, slice memory needle)
    internal
    pure
    returns (slice memory token)
  {
    rsplit(self, needle, token);
  }

  /*
     * @dev Counts the number of nonoverlapping occurrences of `needle` in `self`.
     * @param self The slice to search.
     * @param needle The text to search for in `self`.
     * @return The number of occurrences of `needle` found in `self`.
     */
  function count(slice memory self, slice memory needle)
    internal
    pure
    returns (uint256 cnt)
  {
    uint256 ptr = findPtr(self._len, self._ptr, needle._len, needle._ptr) + needle._len;
    while (ptr <= self._ptr + self._len) {
      cnt++;
      ptr = findPtr(self._len - (ptr - self._ptr), ptr, needle._len, needle._ptr)
        + needle._len;
    }
  }

  /*
     * @dev Returns True if `self` contains `needle`.
     * @param self The slice to search.
     * @param needle The text to search for in `self`.
     * @return True if `needle` is found in `self`, false otherwise.
     */
  function contains(slice memory self, slice memory needle) internal pure returns (bool) {
    return rfindPtr(self._len, self._ptr, needle._len, needle._ptr) != self._ptr;
  }

  /*
     * @dev Returns a newly allocated string containing the concatenation of
     *      `self` and `other`.
     * @param self The first slice to concatenate.
     * @param other The second slice to concatenate.
     * @return The concatenation of the two strings.
     */
  function concat(slice memory self, slice memory other)
    internal
    pure
    returns (string memory)
  {
    string memory ret = new string(self._len + other._len);
    uint256 retptr;
    assembly {
      retptr := add(ret, 32)
    }
    memcpy(retptr, self._ptr, self._len);
    memcpy(retptr + self._len, other._ptr, other._len);
    return ret;
  }

  /*
     * @dev Joins an array of slices, using `self` as a delimiter, returning a
     *      newly allocated string.
     * @param self The delimiter to use.
     * @param parts A list of slices to join.
     * @return A newly allocated string containing all the slices in `parts`,
     *         joined with `self`.
     */
  function join(slice memory self, slice[] memory parts)
    internal
    pure
    returns (string memory)
  {
    if (parts.length == 0) {
      return "";
    }

    uint256 length = self._len * (parts.length - 1);
    for (uint256 i = 0; i < parts.length; i++) {
      length += parts[i]._len;
    }

    string memory ret = new string(length);
    uint256 retptr;
    assembly {
      retptr := add(ret, 32)
    }

    for (uint256 i = 0; i < parts.length; i++) {
      memcpy(retptr, parts[i]._ptr, parts[i]._len);
      retptr += parts[i]._len;
      if (i < parts.length - 1) {
        memcpy(retptr, self._ptr, self._len);
        retptr += self._len;
      }
    }

    return ret;
  }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/IERC721.sol)

pragma solidity ^0.8.20;

import {IERC165} from "../../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`.
     *
     * 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;

    /**
     * @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 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: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721
     * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must
     * understand this adds an external call which potentially creates a reentrancy vulnerability.
     *
     * 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 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 address zero.
     *
     * Emits an {ApprovalForAll} event.
     */
    function setApprovalForAll(address operator, bool approved) external;

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

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

// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;

interface IObeliskNFT {
  event TickerDeactivated(uint256 indexed tokenId, address indexed stakedPool);
  event TickerActivated(uint256 indexed tokenId, address indexed stakedPool);
  event TickerClaimed(uint256 indexed tokenId, address indexed stakedPool);
  event NameUpdated(uint256 indexed tokenId, string name);

  /**
   * @notice Claims the rewards for a given token ID.
   * @param _tokenId The ID of the token to claim rewards for.
   */
  function claim(uint256 _tokenId) external;

  /**
   * @notice Returns the identity information for a given token ID.
   * @param _tokenId The ID of the token to get identity information for.
   * @return identityInTicker_ The identity id in the ticker pools.
   * @return rewardReceiver_ The address that will receive the rewards.
   */
  function getIdentityInformation(uint256 _tokenId)
    external
    view
    returns (bytes32 identityInTicker_, address rewardReceiver_);
}

// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;

interface ILiteTicker {
  error NotWrappedNFT();
  error NotDeposited();
  error AlreadyDeposited();

  event Deposited(address indexed wrappedNFT, uint256 indexed nftId);
  event Withdrawn(address indexed wrappedNFT, uint256 indexed nftId);

  /**
   * @dev Virtual deposit and withdraw functions for the wrapped NFTs.
   * @param _tokenId The ID of the NFT to deposit or withdraw.
   */
  function virtualDeposit(bytes32 _identity, uint256 _tokenId, address _receiver)
    external;

  /**
   * @dev Virtual withdraw function for the wrapped NFTs.
   * @param _tokenId The ID of the NFT to withdraw.
   * @param _ignoreRewards Whether to ignore the rewards and withdraw the NFT.
   * @dev The `_ignoreRewards` parameter is primarily used for Hashmasks. When
   * transferring or renaming their NFTs, any
   * claims made will result in the rewards being canceled and returned to the pool. This
   * mechanism is in place to
   * prevent exploitative farming.
   */
  function virtualWithdraw(
    bytes32 _identity,
    uint256 _tokenId,
    address _receiver,
    bool _ignoreRewards
  ) external;

  /**
   * @dev Claim function for the wrapped NFTs.
   * @param _tokenId The ID of the NFT to claim.
   */
  function claim(
    bytes32 _identity,
    uint256 _tokenId,
    address _receiver,
    bool _ignoreRewards
  ) external;

  /**
   * @dev Get the claimable rewards for a given identity.
   * @param _identity The identity of the NFT.
   * @param _extraRewards The extra rewards to add to the total for simulation purposes.
   * @return rewards_ The amount of rewards.
   * @return rewardsToken_ The address of the rewards token.
   */
  function getClaimableRewards(bytes32 _identity, uint256 _extraRewards)
    external
    view
    returns (uint256 rewards_, address rewardsToken_);
}

// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;

interface INFTPass {
  error NoNeedToPay();
  error InvalidBPS();
  error MsgValueTooLow();
  error AlreadyClaimed();
  error InvalidProof();
  error NameTooLong();
  error ClaimingEnded();

  event NFTPassCreated(
    uint256 indexed nftId, string indexed name, address indexed receiver, uint256 cost
  );
  event NFTPassUpdated(
    uint256 indexed nftId, string indexed name, address indexed receiver
  );
  event MaxIdentityPerDayAtInitialPriceUpdated(uint32 newMaxIdentityPerDayAtInitialPrice);
  event PriceIncreaseThresholdUpdated(uint32 newPriceIncreaseThreshold);
  event PriceDecayBPSUpdated(uint32 newPriceDecayBPS);

  struct Metadata {
    string name;
    address walletReceiver;
    uint8 imageIndex;
  }

  /**
   * @param _name The name of the NFT Pass
   * @param _receiverWallet The wallet address that will receive the NFT Pass
   * @param merkleProof The Merkle proof for the NFT Pass
   */
  function claimPass(
    string calldata _name,
    address _receiverWallet,
    bytes32[] calldata merkleProof
  ) external;

  /**
   * @param _name The name of the NFT Pass
   * @param _receiverWallet The wallet address that will receive the NFT Pass
   */
  function create(string calldata _name, address _receiverWallet) external payable;

  /**
   * @param _nftId The ID of the NFT Pass
   * @param _name The name of the NFT Pass
   * @param _receiver The wallet address that will receive the NFT Pass
   * @dev It's nftId or Name, if nftId is 0, it will use the name to find the nftId
   */
  function updateReceiverAddress(uint256 _nftId, string calldata _name, address _receiver)
    external;

  /**
   * @return The cost of the NFT Pass
   */
  function getCost() external view returns (uint256);

  /**
   * @param _nftId The ID of the NFT Pass
   * @param _name The name of the NFT Pass
   */
  function getMetadata(uint256 _nftId, string calldata _name)
    external
    view
    returns (Metadata memory);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/extensions/IERC721Metadata.sol)

pragma solidity ^0.8.20;

import {IERC721} from "../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);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Strings.sol)

pragma solidity ^0.8.20;

import {Math} from "./math/Math.sol";
import {SignedMath} from "./math/SignedMath.sol";

/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant HEX_DIGITS = "0123456789abcdef";
    uint8 private constant ADDRESS_LENGTH = 20;

    /**
     * @dev The `value` string doesn't fit in the specified `length`.
     */
    error StringsInsufficientHexLength(uint256 value, uint256 length);

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        unchecked {
            uint256 length = Math.log10(value) + 1;
            string memory buffer = new string(length);
            uint256 ptr;
            /// @solidity memory-safe-assembly
            assembly {
                ptr := add(buffer, add(32, length))
            }
            while (true) {
                ptr--;
                /// @solidity memory-safe-assembly
                assembly {
                    mstore8(ptr, byte(mod(value, 10), HEX_DIGITS))
                }
                value /= 10;
                if (value == 0) break;
            }
            return buffer;
        }
    }

    /**
     * @dev Converts a `int256` to its ASCII `string` decimal representation.
     */
    function toStringSigned(int256 value) internal pure returns (string memory) {
        return string.concat(value < 0 ? "-" : "", toString(SignedMath.abs(value)));
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        unchecked {
            return toHexString(value, Math.log256(value) + 1);
        }
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
     */
    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
        uint256 localValue = value;
        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_DIGITS[localValue & 0xf];
            localValue >>= 4;
        }
        if (localValue != 0) {
            revert StringsInsufficientHexLength(value, length);
        }
        return string(buffer);
    }

    /**
     * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal
     * representation.
     */
    function toHexString(address addr) internal pure returns (string memory) {
        return toHexString(uint256(uint160(addr)), ADDRESS_LENGTH);
    }

    /**
     * @dev Returns true if the two strings are equal.
     */
    function equal(string memory a, string memory b) internal pure returns (bool) {
        return bytes(a).length == bytes(b).length && keccak256(bytes(a)) == keccak256(bytes(b));
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)

pragma solidity ^0.8.20;

import {IERC165} from "./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);
 * }
 * ```
 */
abstract contract ERC165 is IERC165 {
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {
        return interfaceId == type(IERC165).interfaceId;
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)

pragma solidity ^0.8.20;

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/SignedMath.sol)

pragma solidity ^0.8.20;

/**
 * @dev Standard signed math utilities missing in the Solidity language.
 */
library SignedMath {
    /**
     * @dev Returns the largest of two signed numbers.
     */
    function max(int256 a, int256 b) internal pure returns (int256) {
        return a > b ? a : b;
    }

    /**
     * @dev Returns the smallest of two signed numbers.
     */
    function min(int256 a, int256 b) internal pure returns (int256) {
        return a < b ? a : b;
    }

    /**
     * @dev Returns the average of two signed numbers without overflow.
     * The result is rounded towards zero.
     */
    function average(int256 a, int256 b) internal pure returns (int256) {
        // Formula from the book "Hacker's Delight"
        int256 x = (a & b) + ((a ^ b) >> 1);
        return x + (int256(uint256(x) >> 255) & (a ^ b));
    }

    /**
     * @dev Returns the absolute unsigned value of a signed value.
     */
    function abs(int256 n) internal pure returns (uint256) {
        unchecked {
            // must be unchecked in order to support `n = type(int256).min`
            return uint256(n >= 0 ? n : -n);
        }
    }
}

Settings
{
  "remappings": [
    "hero-tokens/test/=test/",
    "ds-test/=node_modules/@layerzerolabs/toolbox-foundry/lib/ds-test/",
    "forge-std/=node_modules/@layerzerolabs/toolbox-foundry/lib/forge-std/src/",
    "@layerzerolabs/=node_modules/@layerzerolabs/",
    "@openzeppelin/=node_modules/@openzeppelin/",
    "heroglyph-library/=node_modules/@layerzerolabs/toolbox-foundry/lib/heroglyph-library/src/",
    "@axelar-network/=node_modules/@axelar-network/",
    "@chainlink/=node_modules/@chainlink/",
    "@eth-optimism/=node_modules/@eth-optimism/",
    "hardhat-deploy/=node_modules/hardhat-deploy/",
    "hardhat/=node_modules/hardhat/",
    "solidity-bytes-utils/=node_modules/solidity-bytes-utils/",
    "@prb-math/=node_modules/@layerzerolabs/toolbox-foundry/lib/prb-math/",
    "@prb/math/=node_modules/@layerzerolabs/toolbox-foundry/lib/prb-math/",
    "@sablier/v2-core/=node_modules/@sablier/v2-core/",
    "@uniswap/v3-periphery/=node_modules/@layerzerolabs/toolbox-foundry/lib/v3-periphery/",
    "@uniswap/v3-core/=node_modules/@layerzerolabs/toolbox-foundry/lib/v3-core/",
    "atoumic/=node_modules/@layerzerolabs/toolbox-foundry/lib/atoumic/src/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "metadata": {
    "useLiteralContent": false,
    "bytecodeHash": "ipfs",
    "appendCBOR": true
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "paris",
  "viaIR": true,
  "libraries": {}
}

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"address","name":"_treasury","type":"address"},{"internalType":"address","name":"_nftPass","type":"address"},{"internalType":"address","name":"_dripVaultETH","type":"address"},{"internalType":"address","name":"_dripVaultDAI","type":"address"},{"internalType":"address","name":"_dai","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AlreadyRemoved","type":"error"},{"inputs":[],"name":"AmountExceedsDeposit","type":"error"},{"inputs":[],"name":"AmountTooLow","type":"error"},{"inputs":[],"name":"CollectionAlreadyAllowed","type":"error"},{"inputs":[],"name":"CollectionNotAllowed","type":"error"},{"inputs":[],"name":"ContributionBalanceTooLow","type":"error"},{"inputs":[],"name":"FailedDeployment","type":"error"},{"inputs":[],"name":"GoalReached","type":"error"},{"inputs":[{"internalType":"bytes1","name":"permissionNeeded","type":"bytes1"}],"name":"InvalidPermission","type":"error"},{"inputs":[],"name":"MathOverflowedMulDiv","type":"error"},{"inputs":[],"name":"NoAccess","type":"error"},{"inputs":[],"name":"NotAuthorized","type":"error"},{"inputs":[],"name":"NotSupporterDepositor","type":"error"},{"inputs":[],"name":"NotWrappedNFT","type":"error"},{"inputs":[],"name":"NothingToClaim","type":"error"},{"inputs":[],"name":"OnlyOneValue","type":"error"},{"inputs":[],"name":"PermissionAdminCannotBeEmpty","type":"error"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"inputs":[],"name":"SupportNotFinished","type":"error"},{"inputs":[],"name":"TickerAlreadyExists","type":"error"},{"inputs":[],"name":"TooManyEth","type":"error"},{"inputs":[],"name":"TransferFailed","type":"error"},{"inputs":[],"name":"ZeroAddress","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"collection","type":"address"},{"indexed":true,"internalType":"address","name":"contributor","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Claimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"collection","type":"address"},{"indexed":false,"internalType":"uint256","name":"totalSupply","type":"uint256"},{"indexed":false,"internalType":"uint32","name":"collectionStartedUnixTime","type":"uint32"},{"indexed":false,"internalType":"bool","name":"premium","type":"bool"}],"name":"CollectionAllowed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"collection","type":"address"},{"indexed":true,"internalType":"address","name":"contributor","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"CollectionContributed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"collection","type":"address"},{"indexed":true,"internalType":"address","name":"contributor","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"CollectionContributionWithdrawn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"string","name":"ipfsImage","type":"string"}],"name":"CollectionImageIPFSUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"maxRewardPerCollection","type":"uint256"}],"name":"MaxRewardPerCollectionSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"megapoolFactory","type":"address"}],"name":"MegapoolFactorySet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"string","name":"ticker","type":"string"},{"indexed":false,"internalType":"address","name":"pool","type":"address"}],"name":"NewGenesisTickerCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"target","type":"address"},{"indexed":false,"internalType":"bytes1","name":"permission","type":"bytes1"}],"name":"PermissionChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"admin","type":"address"}],"name":"SetPermissionAdmin","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"wrappedNFT","type":"address"},{"indexed":false,"internalType":"uint256","name":"toCollection","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"toTreasury","type":"uint256"}],"name":"SlotBought","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint32","name":"supportId","type":"uint32"},{"indexed":true,"internalType":"address","name":"supporter","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"SupportRetrieved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint32","name":"supportId","type":"uint32"},{"indexed":true,"internalType":"address","name":"supporter","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Supported","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"bool","name":"status","type":"bool"}],"name":"TickerCreationAccessSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"string","name":"ticker","type":"string"},{"indexed":true,"internalType":"address","name":"pool","type":"address"},{"indexed":false,"internalType":"string","name":"readableName","type":"string"}],"name":"TickerLogicSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"treasury","type":"address"}],"name":"TreasurySet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"collection","type":"address"},{"indexed":true,"internalType":"address","name":"wrappedNFT","type":"address"}],"name":"WrappedNFTCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"collection","type":"address"},{"indexed":true,"internalType":"address","name":"wrappedNFT","type":"address"}],"name":"WrappedNFTDisabled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"collection","type":"address"},{"indexed":true,"internalType":"address","name":"wrappedNFT","type":"address"}],"name":"WrappedNFTEnabled","type":"event"},{"inputs":[],"name":"BPS","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"COLLECTION_REWARD_PERCENT","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DAI","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DATA_ASSERTER_ROLE","outputs":[{"internalType":"bytes1","name":"","type":"bytes1"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DRIP_VAULT_DAI","outputs":[{"internalType":"contract IDripVault","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DRIP_VAULT_ETH","outputs":[{"internalType":"contract IDripVault","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"HCT_ADDRESS","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"IPFS_ROLE","outputs":[{"internalType":"bytes1","name":"","type":"bytes1"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MINIMUM_DAI_SUPPORT_AMOUNT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MINIMUM_ETH_SUPPORT_AMOUNT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MINIMUM_SENDING_ETH","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"NFT_PASS","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"REQUIRED_ETH_TO_ENABLE_COLLECTION","outputs":[{"internalType":"uint128","name":"","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SUPPORT_LOCK_DURATION","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TICKER_ROLE","outputs":[{"internalType":"bytes1","name":"","type":"bytes1"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WRAPPED_NFT_FACTORY","outputs":[{"internalType":"contract IWrappedNFTFactory","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"},{"internalType":"bytes1","name":"_permission","type":"bytes1"}],"name":"addPermission","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_collection","type":"address"}],"name":"addToCollection","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_collection","type":"address"},{"internalType":"uint256","name":"_totalSupply","type":"uint256"},{"internalType":"uint32","name":"_collectionStartedUnixTime","type":"uint32"},{"internalType":"bool","name":"_premium","type":"bool"}],"name":"allowNewCollection","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_collection","type":"address"}],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"clearPermission","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"collectionImageIPFS","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_wrappedCollection","type":"address"}],"name":"enableEmergencyWithdrawForCollection","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_collection","type":"address"}],"name":"forceActiveCollection","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_collection","type":"address"}],"name":"getCollection","outputs":[{"components":[{"internalType":"uint256","name":"totalSupply","type":"uint256"},{"internalType":"uint256","name":"contributionBalance","type":"uint256"},{"internalType":"address","name":"wrappedVersion","type":"address"},{"internalType":"uint32","name":"collectionStartedUnixTime","type":"uint32"},{"internalType":"bool","name":"allowed","type":"bool"},{"internalType":"bool","name":"premium","type":"bool"}],"internalType":"struct IObeliskRegistry.Collection","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_id","type":"uint256"}],"name":"getCollectionImageIPFS","outputs":[{"internalType":"string","name":"ipfs_","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_collection","type":"address"}],"name":"getCollectionRewards","outputs":[{"components":[{"internalType":"uint128","name":"totalRewards","type":"uint128"},{"internalType":"uint128","name":"claimedRewards","type":"uint128"}],"internalType":"struct IObeliskRegistry.CollectionRewards","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"getPermission","outputs":[{"internalType":"bytes1","name":"","type":"bytes1"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"_id","type":"uint32"}],"name":"getSupporter","outputs":[{"components":[{"internalType":"address","name":"depositor","type":"address"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint128","name":"amount","type":"uint128"},{"internalType":"uint32","name":"lockUntil","type":"uint32"},{"internalType":"bool","name":"removed","type":"bool"}],"internalType":"struct IObeliskRegistry.Supporter","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"_ticker","type":"string"}],"name":"getTickerLogic","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"},{"internalType":"address","name":"_collection","type":"address"}],"name":"getUserContribution","outputs":[{"components":[{"internalType":"uint128","name":"deposit","type":"uint128"},{"internalType":"uint128","name":"claimed","type":"uint128"}],"internalType":"struct IObeliskRegistry.ContributionInfo","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"},{"internalType":"bytes1","name":"accessLevel","type":"bytes1"}],"name":"hasPermission","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"wrappedNFT","type":"address"}],"name":"isWrappedNFT","outputs":[{"internalType":"bool","name":"isValid","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxRewardPerCollection","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"megapoolFactory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"onSlotBought","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"permissionAdmin","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_collection","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"removeFromCollection","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"},{"internalType":"bytes1","name":"_permission","type":"bytes1"}],"name":"removePermission","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renouncePermissionAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"_id","type":"uint32"}],"name":"retrieveSupportToYieldPool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_id","type":"uint256"},{"internalType":"string","name":"_ipfsImage","type":"string"}],"name":"setCollectionImageIPFS","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_maxRewardPerCollection","type":"uint256"}],"name":"setMaxRewardPerCollection","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_megapoolFactory","type":"address"}],"name":"setMegapoolFactory","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"},{"internalType":"bytes1","name":"_permission","type":"bytes1"}],"name":"setPermission","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_ticker","type":"string"},{"internalType":"address","name":"_pool","type":"address"},{"internalType":"bool","name":"_override","type":"bool"}],"name":"setTickerLogic","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_treasury","type":"address"}],"name":"setTreasury","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_ipfsImage","type":"string"}],"name":"setWrappedCollectionImageIPFS","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"supportId","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"supportYieldPool","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_collection","type":"address"},{"internalType":"address","name":"_wrappedVersion","type":"address"},{"internalType":"bool","name":"_allowed","type":"bool"}],"name":"toggleIsWrappedNFTFor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newAdmin","type":"address"}],"name":"transferPermissionAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"treasury","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"wrappedCollectionImageIPFS","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]

6101403461037b576001600160401b03601f618fe038819003918201601f19168401919083831185841017610354578160c0928692604095865283398101031261037b5761004c83610380565b61005860208501610380565b610063838601610380565b9361007060608701610380565b9461008960a061008260808a01610380565b9801610380565b6001600160a01b039685881695909190861561036a57600180546001600160a01b031990811689178255895198895290977fb0c836c55880dc7bb0a7e759fa9c03569b415b1ce49230848ab2c421b66d922890602090a187600255680d8d726b7177a80000600b55898716906009541617600955875195611d219081880192888410888511176103545788936101389361301f86396001600160a01b0391821681529116602082015260400190565b0360009586f0801561034a5790888080931693846080521660e052816101009a168a528360a0521660c0528551926142a08085019185831090831117610336579184939161019f93614d4086396001600160a01b0391821681529116602082015260400190565b039082f093841561032a5761012094168452600c548281811c91168015610320575b602082101461030c57601f81116102a7575b509060207f585643665742793444666e486b58463256574a3533000000000000000000000092606b600c55600c8152207f697066733a2f2f516d564c4b393847397843584b413372316d414a3279744a37815501555190612c8a9283610395843960805183611315015260a05183610dda015260c05183818161061301528181610b810152610c83015260e051838181610975015281816117ee01528181611a610152818161202501526125c301525182818161067a01528181610b3a01526118b30152518181816107060152612b610152f35b600c8252601f0160051c7fdf6966c971051c3d54ec59162606531493a51404a002842f56009d7e5cf4a8c7017fdf6966c971051c3d54ec59162606531493a51404a002842f56009d7e5cf4a8c95b81811061030257506101d3565b82815583016102f5565b634e487b7160e01b82526022600452602482fd5b90607f16906101c1565b508251903d90823e3d90fd5b634e487b7160e01b86526041600452602486fd5b87513d87823e3d90fd5b634e487b7160e01b600052604160045260246000fd5b875163def5ec4f60e01b8152600490fd5b600080fd5b51906001600160a01b038216820361037b5756fe60406080815260048036101561001f575b5050361561001d57600080fd5b005b600091823560e01c8062550aea1461205457806305d7f13714612010578063063ae59414611fee578063073aa84b14611f145780630eb70ef214611ef75780631376c89114611d6b5780631a80d0d714611d045780631e83409a14611b9357806320a8a3da14611b74578063249d39e914611b5757806324d4a72614611b3357806326fb04c414611962578063288b44581461172b5780633377e8f8146116bc5780633b6299ed1461167b5780633db803ad146114c35780633f607cbf146114a557806345247c2e146114675780634e17811d146113f857806354aaa1f4146113cb5780635aa035ef146113ad57806361d027b314611384578063640e69e21461136357806365850ee4146113445780637511aaca1461130057806379a08571146111215780637b7000e8146110c55780637c84de6014610ff757806383c1cd8a14610fb757806384e0192a14610f8f57806386304ba914610f26578063869ecc1e14610e0957806388124bd914610dc55780638eb828de14610d4f57806398b4c7a514610cca57806399f0805f146108f9578063a7bed11c146108da578063a909f654146108b6578063af2f3b17146107e5578063b9a08b3914610735578063bcc293c0146106f1578063bff33127146106c8578063c167bc65146106a9578063ce8abd2114610665578063d7297c4d14610642578063e0bab4c4146105fe578063e40de8871461051a578063e4a02012146104a2578063e57475a914610469578063e8758cdf146103e7578063eea7f57b146103ba578063f0f4426014610323578063f4f7516c146103095763ffa0613b1461027d5750610010565b34610305576020366003190112610305576102966122c6565b600154926001600160a01b03919082851633036102ee5750166001600160a01b0319929092168217600155519081527fb0c836c55880dc7bb0a7e759fa9c03569b415b1ce49230848ab2c421b66d922890602090a180f35b8351633119d86d60e11b8152908101869052602490fd5b8280fd5b83806003193601126103205761031d6128c7565b80f35b80fd5b5090346103055760203660031901126103055761033e6122c6565b6001546001600160a01b039190821633036103a35716918215610396575050600980546001600160a01b031916821790557f3c864541ef71378c6229510ed90f376565ee42d9c5e0904a984a9e863e6db44f8280a280f35b5163d92e233d60e01b8152fd5b8351633119d86d60e11b8152808401869052602490fd5b8382346103e357816003193601126103e357600a5490516001600160a01b039091168152602090f35b5080fd5b5082346103205781600319360112610320576104016122c6565b8261040a6122b0565b9260006020835161041a8161220a565b828152015260018060a01b0380931681526007602052209116600052602052610445816000206128a2565b61046782518092602090816001600160801b0391828151168552015116910152565bf35b509034610305576020366003190112610305578161049e9361049392358152600d60205220612435565b9051918291826124fb565b0390f35b509034610305578260031936011261030557600154906001600160a01b038216330361050357506001600160a01b031916600155518181527fb0c836c55880dc7bb0a7e759fa9c03569b415b1ce49230848ab2c421b66d922890602090a180f35b8251633119d86d60e11b8152908101849052602490fd5b8382346103e35760203660031901126103e357908160c09261053a6122c6565b928060a08351610549816121bc565b8281528260208201528285820152826060820152826080820152015260018060a01b03809416815260036020522091815190610584826121bc565b83549384835260026001820154916020850192835201549380840192808616845263ffffffff936060860193858860a01c16855260ff60a06080890198828b8e1c1615158a52019860c81c1615158852835198895251602089015251169086015251166060840152511515608083015251151560a0820152f35b8382346103e357816003193601126103e357517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b8382346103e357816003193601126103e35760209051670de0b6b3a76400008152f35b8382346103e357816003193601126103e357517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b8382346103e357816003193601126103e35751600160f91b8152602090f35b8382346103e357816003193601126103e35760015490516001600160a01b039091168152602090f35b8382346103e357816003193601126103e357517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b508290346103e35760203660031901126103e3576107516122c6565b6001549093906001600160a01b0390811633036107cf57839416803b156107ca57839082845180968193633630153360e01b83525af180156107c057610795578380f35b67ffffffffffffffff83116107ad5750528180808380f35b634e487b7160e01b845260419052602483fd5b82513d86823e3d90fd5b505050fd5b50826024925191633119d86d60e11b8352820152fd5b8382346103e35760203660031901126103e35760a091816108046122eb565b918060808351610813816121ee565b8281528260208201528285820152826060820152015263ffffffff8093168152600860205220908251610845816121ee565b600180861b0393848454169485835260028160018701541695602085019687520154946001600160801b039183850191838816835260ff60806060880197898b831c16895201988b1c1615158852845198895251166020880152511690850152511660608301525115156080820152f35b8382346103e357816003193601126103e35760209051683635c9adc5dea000008152f35b8382346103e357816003193601126103e357602090600b549051908152f35b50829060209081600319360112610305573415159184358380610cc1575b610cb1578315610c815784935b15610c7c5750345b6001600160a01b03938416908082158015610c6d57670de0b6b3a76400005b8310610c5d5784919015610b35576024925085519283809263b6b55f2560e01b82528a8c830152897f0000000000000000000000000000000000000000000000000000000000000000165af1908115610b2b578691610afa575b50935b600a549163ffffffff92838160a01c16848114610ae757600163ffffffff60a01b910160a01b169063ffffffff60a01b1916179081600a556001600160801b039062278d00420193844211610ad4579160028a8a9593857fe5d5503587d41cd579af1b22e69329e0ec9b9f9eb74f212973b61be636560b2a9a9998968c805194610a31866121ee565b3386528c8601948552878287019b168b528b606087019a168a528b6080870199828b5260a01c16815260088d5220935116906bffffffffffffffffffffffff60a01b918285541617845560018401925116908254161790550193511683549263ffffffff60801b905160801b169160ff60a01b9051151560a01b16926affffffffffffffffffffff60a81b161717179055600a5460a01c1692519384523393a380f35b634e487b7160e01b8a5260118b5260248afd5b634e487b7160e01b895260118a52602489fd5b90508281813d8311610b24575b610b118183612226565b81010312610b205751876109a5565b8580fd5b503d610b07565b84513d88823e3d90fd5b5050847f0000000000000000000000000000000000000000000000000000000000000000169084516323b872dd60e01b8152338982015282602482015281604482015284816064818b8b7f0000000000000000000000000000000000000000000000000000000000000000165af18015610c5357918893918693610c11575b506024908751948593849263b6b55f2560e01b84528d8401525af1908115610b2b578691610be4575b50936109a8565b90508281813d8311610c0a575b610bfb8183612226565b81010312610b20575187610bdd565b503d610bf1565b9193509181813d8111610c4c575b610c298183612226565b81010312610c48575180151503610c4457869184918a610bb4565b8680fd5b8780fd5b503d610c1f565b86513d8a823e3d90fd5b8551631fbaba3560e01b81528990fd5b683635c9adc5dea0000061094b565b61092c565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031693610924565b8251631f60009960e21b81528690fd5b50801515610917565b50903461030557610cda366122fe565b60015490926001600160a01b03929183163303610d38575091602091600080516020612c35833981519152931693848652858352808620918254908160f81b1760f81c9060ff191617809255519060ff60f81b9060f81b168152a280f35b8451633119d86d60e11b8152908101869052602490fd5b50903461030557602036600319011261030557610d6a6122c6565b6001546001600160a01b03929083163303610dae5750600080516020612c3583398151915291602091169283855284825280852060ff19815416905551848152a280f35b8351633119d86d60e11b8152908101859052602490fd5b8382346103e357816003193601126103e357517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b508290346103e35760203660031901126103e357610e256122c6565b6001546001600160a01b039081163303610f0f5780821690818552600360205283852091600283019460ff865460c01c1615610f0057600184019182549268056bc75e2d631000009384811015610ef057808503948511610ad457610eec999a5084610e9091612595565b90556001600160801b03936009541689526007602052818920908952602052872091610ec2818454931682841661254a565b16906001600160801b0319161790555491549163ffffffff60ff8460c81c169360a01c1691612b15565b5080f35b8351634f10cd9f60e01b81528b90fd5b516341fbc5a760e01b81528790fd5b8251633119d86d60e11b8152808601859052602490fd5b5082346103205760203660031901126103205782359067ffffffffffffffff82116103205750602092610f5b91369101612264565b82610f6e835192838151938492016124d8565b6006908201908152819003830190205490516001600160a01b039091168152f35b8382346103e357816003193601126103e35760209063ffffffff600a5460a01c169051908152f35b8382346103e35760203660031901126103e35760209181906001600160a01b03610fdf6122c6565b168152808452205460f81b90519060ff60f81b168152f35b509034610305576060366003190112610305576110126122c6565b61101a6122b0565b6110226122dc565b6001546001600160a01b039491929190851633036110ae57508316938486526005602052852060ff1981541660ff8315151617905560001461108657167f0211f82302458486d009f57b4f60864d0228b04ee0ab528a5e3f99ac46d4e7a08380a380f35b167fada537e83313f87700605d76e8a40b047c14e51541d0e00ae35889c6582d9b6e8380a380f35b8551633119d86d60e11b8152908101879052602490fd5b509190346103e35760203660031901126103e3576104459183916110e76122c6565b82602085516110f58161220a565b82815201526001600160a01b0390811683526003602090815284842060020154909116835252206128a2565b50903461030557816003193601126103055780359167ffffffffffffffff91602435838111610b20576111579036908301612264565b923386526020868152600160f91b808589205460f81b16156112ea5750858752600d81528387209285519283116112d757506111938354612335565b601f8111611294575b5080601f831160011461120a575091816111f994927f337a70f4f5a37276b1f9543833290cb7a869eb2eb8216d62fb7e868f4d6f51b5969489916111ff575b508160011b916000199060031b1c19161790555b51918291826124fb565b0390a280f35b9050840151386111db565b90601f1983168489528289209289905b82821061127c575050927f337a70f4f5a37276b1f9543833290cb7a869eb2eb8216d62fb7e868f4d6f51b5969492600192826111f9989610611263575b5050811b0190556111ef565b86015160001960f88460031b161c191690553880611257565b80600185968294968c0151815501950193019061121a565b838852818820601f840160051c8101918385106112cd575b601f0160051c01905b8181106112c2575061119c565b8881556001016112b5565b90915081906112ac565b634e487b7160e01b885260419052602487fd5b83602491865191633119d86d60e11b8352820152fd5b8382346103e357816003193601126103e357517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b8382346103e357816003193601126103e35751600160fa1b8152602090f35b508234610320576020366003190112610320575061049361049e923561287b565b8382346103e357816003193601126103e35760095490516001600160a01b039091168152602090f35b8382346103e357816003193601126103e35761049e9061049361236f565b836020366003190112610320576113f06113e36122c6565b6113eb6129dd565b6125a2565b600160025580f35b503461030557602036600319011261030557600154823592906001600160a01b031633036114525750816020917fa574c90ca73b4ac7ea6db89c2ce80bd8ed1e76936a4ffab90d8f0ebde0614cae93600b5551908152a180f35b836024925191633119d86d60e11b8352820152fd5b8382346103e35760203660031901126103e35760209160ff9082906001600160a01b036114926122c6565b1681526005855220541690519015158152f35b8382346103e357816003193601126103e3576020905162278d008152f35b509034610305576020806003193601126116775767ffffffffffffffff918035838111610b20576114f79036908301612264565b9060019460018060a01b0386541633036116615750815193841161164e5750611521600c54612335565b601f81116115e8575b50602091601f84116001146115675750928293918392869461155c575b50501b916000199060031b1c191617600c5580f35b015192503880611547565b919083601f198116600c88527fdf6966c971051c3d54ec59162606531493a51404a002842f56009d7e5cf4a8c79488905b888383106115ce57505050106115b5575b505050811b01600c5580f35b015160001960f88460031b161c191690553880806115a9565b858701518855909601959485019487935090810190611598565b600c86527fdf6966c971051c3d54ec59162606531493a51404a002842f56009d7e5cf4a8c7601f850160051c81019160208610611644575b601f0160051c019085905b82811061163957505061152a565b87815501859061162b565b9091508190611620565b634e487b7160e01b865260419052602485fd5b51633119d86d60e11b8152908101869052602490fd5b8380fd5b8382346103e35760209161168e366122fe565b6001600160a01b0390911682528184529082902054915160f89290921b166001600160f81b03191615158152f35b509034610305576116cc366122fe565b60015490926001600160a01b03929183163303610d38575091602091600080516020612c3583398151915293169384865285835280862091825490198160f81b1660f81c9060ff191617809255519060ff60f81b9060f81b168152a280f35b5090346103055760209182600319360112611677576117486122eb565b926117516129dd565b63ffffffff9384168086526008825282862060028101805482546001600160801b038216989497946001600160a01b0394939291851633036119525742908260801c16116119425760ff8160a01c166119325760ff60a01b1916600160a01b1790556001015483918791811661188657855163f3fef3a360e01b8152339481019485526020850192909252909283919082908a90829060400103927f0000000000000000000000000000000000000000000000000000000000000000165af1801561187c5761184e575b507f13ba83ca6ba0ea0638c6e19929c2a3b603f471fcb7eec655c70bde60802fe3f2915b519384523393a3600160025580f35b8190813d8311611875575b6118638183612226565b81010312611871573861181b565b8480fd5b503d611859565b83513d88823e3d90fd5b855163f3fef3a360e01b8152339481019485526020850192909252909283919082908a90829060400103927f0000000000000000000000000000000000000000000000000000000000000000165af1801561187c57611908575b507f13ba83ca6ba0ea0638c6e19929c2a3b603f471fcb7eec655c70bde60802fe3f29161183f565b8190813d831161192b575b61191d8183612226565b8101031261187157386118e0565b503d611913565b86516355adf54760e11b81528590fd5b865163f94a6d1160e01b81528590fd5b8751630aadc8f760e21b81528690fd5b50903461030557816003193601126103055761197c6122c6565b916024356119886129dd565b809360018060a01b03809116938487526020926003845284882033895260078552858920878a5285526001600160801b0391600183888c205416920190815490838111611b235715611b1a575b68056bc75e2d63100000811015611b0a579189916119f6836119fd95612527565b9055612527565b9081151580611afa575b611aea5733808a5260078652868a20888b528652868a2080546001600160801b03191693909216929092179055845163f3fef3a360e01b8152918201908152602081018790529091839183919082908a90829060400103927f0000000000000000000000000000000000000000000000000000000000000000165af1801561187c57611ac0575b507f1db45d68a79b3f7656091f2656143b8bff824bd68b0f77eec0ed41747854cdfb91519384523393a3600160025580f35b8190813d8311611ae3575b611ad58183612226565b810103126118715738611a8e565b503d611acb565b85516395ba79fd60e01b81528390fd5b506611c37937e080008210611a07565b875163f30bb8af60e01b81528590fd5b985081986119d5565b88516317a1ae2760e31b81528690fd5b8382346103e357816003193601126103e3576020905168056bc75e2d631000008152f35b8382346103e357816003193601126103e357602090516127108152f35b8382346103e357816003193601126103e35751600160f81b8152602090f35b5090346103055760208060031936011261167757611baf6122c6565b92611bb86129dd565b60018060a01b0380941692838652600383528186209460028601541686528083528186209433875260078452828720858852845260018388209101549568056bc75e2d631000008703611cf45781546001600160801b039182611c2f611c2583549b838d16848716612a7b565b9360801c84612527565b16988915611ce457611c8d94939291611c4e8b611c6e9360801c61254a565b81546001600160801b031660809190911b6001600160801b031916179055565b82546001600160801b0316911660801b6001600160801b031916179055565b8580808088335af1611c9d612565565b5015611cd65750907ff7a40077ff7a04c7e61f6f26fb13774259ddf1b6bce9ecf26a8276cdd399268391519384523393a3600160025580f35b90516312171d8360e31b8152fd5b86516312d37ee560e31b81528690fd5b83516312d37ee560e31b81528390fd5b50903461030557611d14366122fe565b60015490926001600160a01b03929183163303610d385750168084526020848152838520805460ff191660f885901c17905592516001600160f81b0319909216825291600080516020612c3583398151915291a280f35b503461030557608036600319011261030557611d856122c6565b6024359160443563ffffffff8116809103610b20576064359283151593848103610c485760018060a01b03918260015416331490811580611edb575b611ecb57831697888a52600360205260ff6002878c20015460c01c16611ebd5750918860609694927f246f8be29250021ed7b87f7b1e9def90abf9aa1b2dee2a369f865cd5722d16f7989694600014611eb6575b89855193611e22856121bc565b8885526002602086019585875288810196868852898d8301978a895260808401966001885260a0850198151589528152600360205220915182555160018201550194511684549363ffffffff60a01b905160a01b169160ff60c01b9051151560c01b169260ff60c81b9051151560c81b169365ffffffffffff60d01b1617171717905581519384526020840152820152a280f35b5080611e15565b855163f5e2e91f60e01b8152fd5b855163ea8e4eb560e01b81528990fd5b50338a5260208a9052858a205460f81b600160fa1b1615611dc1565b8382346103e357816003193601126103e35760209051610fa08152f35b50903461030557602036600319011261030557611f2f6122c6565b6001546001600160a01b03929083163303610dae57506020929183911692839283865285825280862080549160ff19928360fe821691161780925585815160ff60f81b809460f81b168152600080516020612c35833981519152968791a2858852878452808820805493841660f894851b600160f81b17851c17908190559051921b168152a2600a80546001600160a01b031916821790557f11399aa18969a5223209b5c2a40d43272dba187f6272b7f3b08937fdd3da6dfc8280a280f35b8382346103e357816003193601126103e357602090516611c37937e080008152f35b8382346103e357816003193601126103e357517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b503461030557606036600319011261030557813567ffffffffffffffff8111611677576120849036908401612264565b61208c6122b0565b926120956122dc565b6001546001600160a01b03929190831633149081156121b457905b1580612198575b612189571580612160575b61215257507faaf39b41c37aa03e0720b1664b6e9d5b5bf03b7a3087faf098c6efe3626bd3379161213c61214c92855190835191602081818701946121088183886124d8565b81016006815203019020971696876bffffffffffffffffffffffff60a01b82541617905585518092819285519283916124d8565b81010390209351918291826124fb565b0390a380f35b8351635dc1236b60e11b8152fd5b5081845160208186516121768183858b016124d8565b81016006815203019020541615156120c2565b50835163160d3af160e11b8152fd5b5033875260208790528487205460f81b600160f81b16156120b7565b5086906120b0565b60c0810190811067ffffffffffffffff8211176121d857604052565b634e487b7160e01b600052604160045260246000fd5b60a0810190811067ffffffffffffffff8211176121d857604052565b6040810190811067ffffffffffffffff8211176121d857604052565b90601f8019910116810190811067ffffffffffffffff8211176121d857604052565b67ffffffffffffffff81116121d857601f01601f191660200190565b81601f820112156122ab5780359061227b82612248565b926122896040519485612226565b828452602083830101116122ab57816000926020809301838601378301015290565b600080fd5b602435906001600160a01b03821682036122ab57565b600435906001600160a01b03821682036122ab57565b6044359081151582036122ab57565b6004359063ffffffff821682036122ab57565b60409060031901126122ab576004356001600160a01b03811681036122ab57906024356001600160f81b0319811681036122ab5790565b90600182811c92168015612365575b602083101461234f57565b634e487b7160e01b600052602260045260246000fd5b91607f1691612344565b60405190600082600c549161238383612335565b8083529260209060019081811690811561241157506001146123b0575b50506123ae92500383612226565b565b915092600c6000527fdf6966c971051c3d54ec59162606531493a51404a002842f56009d7e5cf4a8c7936000925b8284106123f957506123ae94505050810160200138806123a0565b855488850183015294850194879450928101926123de565b915050602092506123ae94915060ff191682840152151560051b82010138806123a0565b9060405191826000825461244881612335565b908184526020946001916001811690816000146124b65750600114612477575b5050506123ae92500383612226565b600090815285812095935091905b81831061249e5750506123ae9350820101388080612468565b85548884018501529485019487945091830191612485565b925050506123ae94925060ff191682840152151560051b820101388080612468565b60005b8381106124eb5750506000910152565b81810151838201526020016124db565b6040916020825261251b81518092816020860152602086860191016124d8565b601f01601f1916010190565b9190820391821161253457565b634e487b7160e01b600052601160045260246000fd5b9190916001600160801b038080941691160191821161253457565b3d15612590573d9061257682612248565b916125846040519384612226565b82523d6000602084013e565b606090565b9190820180921161253457565b60018060a01b039081811660009080825260209360038552604093848420917f0000000000000000000000000000000000000000000000000000000000000000169085519663ef8b30f760e01b885260049734898201528181602481875afa908115612871578791612844575b508093600186019687549389986611c37937e0800085106128345768056bc75e2d631000009586811015612824578561264791612595565b948686116127dc575b50600289019760ff895460c01c16156127cc578c5163b6b55f2560e01b8152808f018d9052948391869160249183915af19384156127c2578c949392918c87928196612762575b507f68d983f34506233768c7739bcc474d4566f676f25fbf983559f16d8fd7d220b19495966001600160801b039133815260078652818120888252865220908154906126e7818a1682841661254a565b16906001600160801b031916179055558b519384523393a31061275957612723925491549163ffffffff60ff8460c81c169360a01c1691612b15565b5080612730575b50505050565b81808092335af161273f612565565b501561274c57808061272a565b516312171d8360e31b8152fd5b50505050505050565b93955050929450508281813d83116127bb575b61277f8183612226565b810103126127b75791847f68d983f34506233768c7739bcc474d4566f676f25fbf983559f16d8fd7d220b1928c8e9695519594612697565b8a80fd5b503d612775565b8c513d8d823e3d90fd5b8c516341fbc5a760e01b81528e90fd5b995093965068056bc75e2d630fffff19870187811161281157806128048161280a939c612527565b98612527565b9338612650565b634e487b7160e01b8b5260118d5260248bfd5b8c51634f10cd9f60e01b81528e90fd5b8b51631fbaba3560e01b81528d90fd5b90508181813d831161286a575b61285b8183612226565b81010312610c4457513861260f565b503d612851565b88513d89823e3d90fd5b600052600d6020526128906040600020612435565b805161289f575061289f61236f565b90565b906040516128af8161220a565b91546001600160801b038116835260801c6020830152565b60003381526005602052604060ff8183205416156129cd5734156129c95733825260046020526001600160801b0380828420541692612905346129fe565b936129108582612595565b600b548091116129b6575b50506129278434612527565b9133825260046020528382209081549061294581881682841661254a565b16906001600160801b0319161790558080808460018060a01b03600954165af161296d612565565b50156129a557907f17ad8e3ecc7b4fac225cfa9c1be3f36f595e0e354868e4a985b9ea10594a381e91815193845260208401523392a2565b81516312171d8360e31b8152600490fd5b6129c1929550612527565b92388061291b565b5050565b516381d5b5ad60e01b8152600490fd5b60028054146129ec5760028055565b604051633ee5aeb560e01b8152600490fd5b610fa08181029060001981840990828083109203918083039214612a70576127109082821115612a5e577fbc01a36e2eb1c432ca57a786c226809d495182a9930be0ded288ce703afb7e91940990828211900360fc1b910360041c170290565b60405163227bc15360e01b8152600490fd5b505061271091500490565b90918282029160001984820993838086109503948086039514612af15784831115612a5e5782910981600003821680920460028082600302188083028203028083028203028083028203028083028203028083028203028092029003029360018380600003040190848311900302920304170290565b505080925015612aff570490565b634e487b7160e01b600052601260045260246000fd5b9263ffffffff60018060a01b039384604051966359a2567f60e01b88521693846004880152306024880152604487015216606485015215156084840152602091600090838560a48185857f0000000000000000000000000000000000000000000000000000000000000000165af1948515612c29578295612bf0575b508416808252600584526040808320805460ff19166001179055838352600390945292812060020180546001600160a01b031916841790557f272e091e149483ff0ce831f3b0e712c169f39c3202d6aad9b32138626a83b16c9080a390565b9094508381813d8311612c22575b612c088183612226565b810103126103e3575184811681036103e357936003612b91565b503d612bfe565b6040513d84823e3d90fdfe875cc7db9aab147d67906d9905e17f3ace84574847d15e4262794dfddb0daaa4a26469706673582212204020202d479dea2ee15d53b9d5f236b17737a320fe5bf5a3353ae8de5fe0de3564736f6c6343000819003360a03461045c57611d21906001600160401b0390601f601f193885900382810182168401908582118583101761036a578085916040988994855283398101031261045c5761004c83610480565b9061005a6020809501610480565b94610063610461565b93601b85527f4865726f676c797068204e616d65204368616e676520546f6b656e000000000086860152610095610461565b94600391828752621210d560ea1b88880152815184811161036a5783546001938482811c92168015610452575b8b83101461043c5781848493116103eb575b508a9084831160011461038b57600092610380575b505060001982861b1c191690831b1783555b865193841161036a5760049687548381811c91168015610360575b8a82101461034b57828111610305575b50889185116001146102a15784955090849291600095610296575b50501b92600019911b1c19161782555b6001600160a01b0390811693841561027f57600580546001600160a01b0319811687179091558651959083167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a333608052670de0b6b3a764000060085566470de4df82000060075569d3c21bcecceda10000006009551692831561026b57506002546934f086f3b33b6840000091828201809211610256575060025560008381528083528481208054830190558451918252917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a35161188c908161049582396080518181816104aa0152818161065201528181610b1f0152610ef90152f35b601190634e487b7160e01b6000525260246000fd5b600060249263ec442f0560e01b8352820152fd5b8551631e4fbdf760e01b8152600081850152602490fd5b015193503880610141565b9291948416928760005284896000209460005b8b898383106102ee57505050106102d4575b50505050811b018255610151565b01519060f884600019921b161c19169055388080806102c6565b8686015189559097019694850194889350016102b4565b88600052896000208380880160051c8201928c8910610342575b0160051c019084905b828110610336575050610126565b60008155018490610328565b9250819261031f565b602289634e487b7160e01b6000525260246000fd5b90607f1690610116565b634e487b7160e01b600052604160045260246000fd5b0151905038806100e9565b908886941691876000528c600020928d6000905b8282106103d457505084116103bc575b505050811b0183556100fb565b015160001983881b60f8161c191690553880806103af565b83850151865589979095019493840193018e61039f565b909150856000528a6000208480850160051c8201928d8610610433575b918791869594930160051c01915b8281106104245750506100d4565b60008155859450879101610416565b92508192610408565b634e487b7160e01b600052602260045260246000fd5b91607f16916100c2565b600080fd5b60408051919082016001600160401b0381118382101761036a57604052565b51906001600160a01b038216820361045c5756fe6080604081815260048036101561001557600080fd5b600092833560e01c90816306fdde03146111f857508063095ea7b31461114f5780631093e42d14610ea357806318160ddd14610e845780631d08837b14610e375780631f68f20a14610e1857806323b872dd14610ddb578063247e927c14610db75780632cf09f4814610d98578063313ce56714610d7c57806331f9e35b14610d5d5780634b1946fb14610ae05780634bf7392814610ac15780634e71d92d1461099c5780636386c1c71461093257806370a08231146108fb578063715018a61461089b5780638048257e146106085780638da5cb5b146105df57806395d89b41146104d95780639915e23d146104955780639dc29fac146103c8578063a76d21f5146103a3578063a9059cbb14610372578063b1551b9514610325578063bddc1e68146102d8578063cf7c11fa146102b2578063d37e7ea91461027b578063dd62ed3e14610232578063e3ebaf3a1461020a5763f2fde38b1461017857600080fd5b3461020657602036600319011261020657610191611333565b9061019a61145b565b6001600160a01b039182169283156101f0575050600554826bffffffffffffffffffffffff60a01b821617600555167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08380a380f35b51631e4fbdf760e01b8152908101849052602490fd5b8280fd5b50503461022e578160031936011261022e57602090516804e1003b28d92800008152f35b5080fd5b50503461022e578060031936011261022e5780602092610250611333565b61025861134e565b6001600160a01b0391821683526001865283832091168252845220549051908152f35b50503461022e578160031936011261022e576020906102ab600b546102a563ffffffff4216611626565b906113e6565b9051908152f35b50503461022e57602036600319011261022e576020906102ab6102d3611333565b61168a565b5034610206576020366003190112610206577f0936f5112aeee6bc6ad2ce7f0578fa50cb693eafda653e233a0926934b69e4aa91602091359061031961145b565b8160095551908152a180f35b5034610206576020366003190112610206577f378b0c2c80acbe949b082a06236dc1ec5c13420ff596e05f26fed66a10abe8f391602091359061036661145b565b8160075551908152a180f35b50503461022e578060031936011261022e5760209061039c610392611333565b602435903361155a565b5160018152f35b50503461022e578160031936011261022e57602090516934f086f3b33b684000008152f35b5082903461022e578260031936011261022e576103e3611333565b90602435906103f3823385611487565b6001600160a01b03831692831561047e5783855284602052858520549183831061044a575050818495600080516020611837833981519152936020938688528785520381872055816002540360025551908152a380f35b865163391434e360e21b81526001600160a01b03909216908201908152602081018390526040810184905281906060010390fd5b8551634b637e8f60e11b8152808301869052602490fd5b50503461022e578160031936011261022e57517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b5091903461022e578160031936011261022e5780519180938054916001908360011c92600185169485156105d5575b60209586861081146105c25785895290811561059e5750600114610546575b6105428787610538828c03836113ac565b51918291826112ea565b0390f35b81529295507f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b5b82841061058b57505050826105429461053892820101943880610527565b805486850188015292860192810161056d565b60ff19168887015250505050151560051b8301019250610538826105423880610527565b634e487b7160e01b845260228352602484fd5b93607f1693610508565b50503461022e578160031936011261022e5760055490516001600160a01b039091168152602090f35b5091903461022e578060031936011261022e57610623611333565b9061062c611364565b81516322923e1760e11b8152338682015260209391906001600160a01b039085816024817f000000000000000000000000000000000000000000000000000000000000000086165afa908115610891578791610864575b5015610854578216908186526006855283862092600b5490819463ffffffff956106b3874216946102a586611626565b9363ffffffff19600d541617600d55600c5490600a549081610836575b505060018201938454936106e5838554611429565b8581116107c9575b505061072b9350600b55600c556107106001600160801b03825495168095611409565b80915561071f84600a54611409565b600a55600c5490611429565b905583519081527fdb3412ec21299c6ecf8cb2292210711e8aab1f68a1faedb79a5d30835e504180853392a3600d5480841c82166000190192908284116107b65767ffffffff00000000191683851b67ffffffff000000001617600d5551911681529192507f2270d74c0cb12442133f6b412088e04a2eb03dc7b4dcb1f033acc4c298b2bc0291a180f35b634e487b7160e01b865260118752602486fd5b6001600160801b03919394956107de91611409565b1691871561081f576000805160206118178339815191528b61081185809561080c61072b9a99988e97611728565b611409565b938c51908152a238806106ed565b895163ec442f0560e01b8152808e018d9052602490fd5b61084d92916108486102a59288611409565b611784565b38806106d0565b83516381d5b5ad60e01b81528790fd5b6108849150863d881161088a575b61087c81836113ac565b8101906113ce565b38610683565b503d610872565b85513d89823e3d90fd5b83346108f857806003193601126108f8576108b461145b565b600580546001600160a01b0319811690915581906001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b80fd5b50503461022e57602036600319011261022e5760209181906001600160a01b03610923611333565b16815280845220549051908152f35b50503461022e57602036600319011261022e57809161094f611333565b816020845161095d8161137a565b82815201526001600160a01b03168152600660205220815161097e8161137a565b60206001835493848452015491019081528251918252516020820152f35b509034610206578260031936011261020657338352600660205280832083600b5480926109d363ffffffff4216926102a584611626565b9163ffffffff19600d541617600d55600c5493600a549081610aa6575b505060018101918254610a04868454611429565b818111610a43575b5050600b5583600c55610a296001600160801b0394859254611429565b1690551615610a36578280f35b516312d37ee560e31b8152fd5b6001600160801b0392955090610a5891611409565b16923315610a8f5783610a6f9161080c8233611728565b855184815260008051602061181783398151915260203392a23880610a0c565b855163ec442f0560e01b8152808801899052602490fd5b610ab99295916108486102a59286611409565b9238806109f0565b50503461022e578160031936011261022e57602090600c549051908152f35b503461020657602080600319360112610d5957610afb611333565b83516322923e1760e11b815233848201529093906001600160a01b039083816024817f000000000000000000000000000000000000000000000000000000000000000086165afa908115610d4f578791610d32575b5015610d225784169384865260068352818620600b549081610b7c63ffffffff4216916102a583611626565b9063ffffffff19600d541617600d55600c5492600a549081610d07575b505060018201938454610bad858554611429565b818111610c95575b50505091610bd3916001600160801b0393600b5581600c5554611429565b1690558315610c7f57838552848252808520546804e1003b28d928000093848210610c5e5750907f39fcc5c1db7456a4ba4e2e861932bcf7ffa1a38971c9058b896b3c6224892cf992916804e1003b28d927ffff1980918789528885520182882055600254016002558585600080516020611837833981519152848451888152a3519283523392a380f35b846064928785519363391434e360e21b855284015260248301526044820152fd5b51634b637e8f60e11b8152808301859052602490fd5b6001600160801b0391610caa91949394611409565b16918915610cf057918960008051602061181783398151915289610ce084610bd3989661080c826001600160801b039c9a611728565b938a51908152a291938193610bb5565b865163ec442f0560e01b8152808a018c9052602490fd5b8294916108486102a592610d1a95611409565b913880610b99565b81516381d5b5ad60e01b81528490fd5b610d499150843d861161088a5761087c81836113ac565b38610b50565b83513d89823e3d90fd5b8380fd5b50503461022e578160031936011261022e576020906007549051908152f35b50503461022e578160031936011261022e576020905160128152f35b50503461022e578160031936011261022e576020906009549051908152f35b50503461022e578160031936011261022e576020906102ab63ffffffff4216611626565b50503461022e57606036600319011261022e5760209061039c610dfc611333565b610e0461134e565b60443591610e13833383611487565b61155a565b50503461022e578160031936011261022e576020906008549051908152f35b5034610206576020366003190112610206577fc98034147b45762a645f5d7c4755be34747c222204b5f4c4a80442613041d4df916020913590610e7861145b565b8160085551908152a180f35b50503461022e578160031936011261022e576020906002549051908152f35b5091903461022e57606036600319011261022e57610ebf611333565b90610ec8611364565b604435801515810361114b5782516322923e1760e11b81523387820152602094906001600160a01b039086816024817f000000000000000000000000000000000000000000000000000000000000000086165afa908115611141578891611124575b50156111145781169081875260068652848720600a5494851595866110fa575b600b5496878263ffffffff99610f668b4216936102a585611626565b9263ffffffff19600d541617600d55600c5493156110df575b505060018501958654610f93848854611429565b818111611067575b50505092610fc895949261071f92610fd095600b55600c556001600160801b0384549216968780936113e6565b8094556113e6565b905584519081527f857c3ac0a5d19f9e64e59112fb2af6180c943817ce013789de0aff577e5e28f5863392a3611004578380f35b600d549160018284861c1601928284116107b65767ffffffff00000000191683851b67ffffffff000000001617600d5551911681529192507f2270d74c0cb12442133f6b412088e04a2eb03dc7b4dcb1f033acc4c298b2bc0291a1803880808380f35b6001600160801b039161107c91949394611409565b169188156110c957928b896000805160206118178339815191528f866110b481610fc89e9d9b9861080c610fd09e9b61071f9d611728565b9451908152a292958295979850819450610f9b565b60248f8f8e519163ec442f0560e01b8352820152fd5b8293916108486102a5926110f295611409565b908238610f7f565b63ffffffff421663ffffffff19600d541617600d55610f4a565b84516381d5b5ad60e01b81528890fd5b61113b9150873d891161088a5761087c81836113ac565b38610f2a565b86513d8a823e3d90fd5b8480fd5b5034610206578160031936011261020657611168611333565b6024359033156111e1576001600160a01b03169182156111ca57508083602095338152600187528181208582528752205582519081527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925843392a35160018152f35b8351634a1406b160e11b8152908101859052602490fd5b835163e602df0560e01b8152808401869052602490fd5b9291905034610d595783600319360112610d5957600354600181811c91869082811680156112e0575b60209586861082146112cd57508488529081156112ab5750600114611252575b6105428686610538828b03836113ac565b929550600383527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b5b828410611298575050508261054294610538928201019438611241565b805486850188015292860192810161127b565b60ff191687860152505050151560051b83010192506105388261054238611241565b634e487b7160e01b845260229052602483fd5b93607f1693611221565b6020808252825181830181905290939260005b82811061131f57505060409293506000838284010152601f8019910116010190565b8181018601518482016040015285016112fd565b600435906001600160a01b038216820361134957565b600080fd5b602435906001600160a01b038216820361134957565b602435906001600160801b038216820361134957565b6040810190811067ffffffffffffffff82111761139657604052565b634e487b7160e01b600052604160045260246000fd5b90601f8019910116810190811067ffffffffffffffff82111761139657604052565b90816020910312611349575180151581036113495790565b919082018092116113f357565b634e487b7160e01b600052601160045260246000fd5b919082039182116113f357565b818102929181159184041417156113f357565b9061143391611416565b6b033b2e3c9fd0803ce7ffffff81018091116113f3576b033b2e3c9fd0803ce8000000900490565b6005546001600160a01b0316330361146f57565b60405163118cdaa760e01b8152336004820152602490fd5b9160018060a01b0380931691600093838552600160205260409384862091831691828752602052848620549260001984036114c6575b50505050505050565b84841061152a575080156115125781156114fa578552600160205283852090855260205203912055388080808080806114bd565b8451634a1406b160e11b815260048101879052602490fd5b845163e602df0560e01b815260048101879052602490fd5b8551637dc7a0d960e11b81526001600160a01b039190911660048201526024810184905260448101859052606490fd5b916001600160a01b0380841692831561160d57169283156115f457600090838252816020526040822054908382106115c257509160408282600080516020611837833981519152958760209652828652038282205586815220818154019055604051908152a3565b60405163391434e360e21b81526001600160a01b03919091166004820152602481019190915260448101839052606490fd5b60405163ec442f0560e01b815260006004820152602490fd5b604051634b637e8f60e11b815260006004820152602490fd5b600d5463ffffffff91828083169116038281116113f35782169081156116825761166f620151809161167694600254600954111560001461167957600754915b60201c16611416565b0490611416565b90565b60085491611666565b505050600090565b600a5460009181156116825760018060a01b031660005260066020526117046040600020916116fb6001604051946116c18661137a565b80548652015491602085019283526102a5600b54916108486116f16116eb63ffffffff4216611626565b856113e6565b93600c5494611409565b90519251611429565b81811161171057505090565b6001600160801b0392509061172491611409565b1690565b6000805160206118378339815191526020600092611748856002546113e6565b6002556001600160a01b0316938415841461176f5780600254036002555b604051908152a3565b84845283825260408420818154019055611766565b906b033b2e3c9fd0803ce80000009060001982840992828102928380861095039480860395146118085784831115611349578291098160018119011680920460028082600302188083028203028083028203028083028203028083028203028083028203028092029003029360018380600003040190848311900302920304170290565b50508092501561134957049056fed8138f8a3f377c5259ca548e70e4c2de94f129f5a11036a15b69513cba2b426addf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa26469706673582212200e75c4f3d69f1aba0ed59341d4a60b2ed502644e5df29bf0fbec9cf98f23038664736f6c6343000819003360e03461009b57601f6142a038819003918201601f19168301916001600160401b038311848410176100a057808492604094855283398101031261009b57610052602061004b836100b6565b92016100b6565b903360c05260805260a0526040516141d590816100cb82396080518181816101180152610205015260a05181818160d5015261022a015260c05181818161019b01526103180152f35b600080fd5b634e487b7160e01b600052604160045260246000fd5b51906001600160a01b038216820361009b5756fe60806040818152600436101561001457600080fd5b600091823560e01c90816306433b1b146103045750806359a2567f146101475780637511aaca1461010457806388124bd9146100c157806390ad4ad8146100855763c1292cc31461006457600080fd5b346100815781600319360112610081576020906001549051908152f35b5080fd5b50346100815760203660031901126100815760209160ff9082906001600160a01b036100af610347565b16815280855220541690519015158152f35b5034610081578160031936011261008157517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b5034610081578160031936011261008157517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b5090346103015760a036600319011261030157610162610347565b6024356001600160a01b0381811692918390036102fd5760643563ffffffff81168091036102f957608435928315158094036102f557827f00000000000000000000000000000000000000000000000000000000000000001633036102e45760015460001981146102d0576001019384600155875192613e3d928385019385851067ffffffffffffffff8611176102bc57918686949261010096946103638739817f0000000000000000000000000000000000000000000000000000000000000000168552817f00000000000000000000000000000000000000000000000000000000000000001660208601521698898c8501526060840152604435608084015260a083015260c08201528560e082015203019085f080156102b25791602095917fe853869564626062cfe119946f544b92169e54208ea8346d551e6cdab808449d949316938492519580a48152f35b85513d86823e3d90fd5b634e487b7160e01b8a52604160045260248afd5b634e487b7160e01b87526011600452602487fd5b8651633217675b60e21b8152600490fd5b8580fd5b8480fd5b8380fd5b80fd5b8390346100815781600319360112610081577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b600435906001600160a01b038216820361035d57565b600080fdfe6101803461050557601f613e3d38819003918201601f19168301916001600160401b038311848410176104075780849260409485528339610100938491810103126105055761004d81610525565b9061005a60208201610525565b92610066818301610525565b61007260608401610525565b9460808401519160a08501519663ffffffff881688036105055760c08601519586151587036105055760e001519685516100ab8161050a565b600e81526d577261707065644e46544865726f60901b60208201528651906100d28261050a565b60038252620ae9c960eb1b60208301528051906001600160401b0382116104075760005490600182811c921680156104fb575b60208310146103e75781601f84931161049e575b50602090601f83116001146104285760009261041d575b50508160011b916000199060031b1c1916176000555b8051906001600160401b0382116104075760015490600182811c921680156103fd575b60208310146103e75781601f849311610389575b50602090601f83116001146103155760009261030a575b50508160011b916000199060031b1c1916176001555b60016006556001600160a01b0391821660805292811660a05291821660c0521660e0819052906109c480820291801590830490911417156102f457600191612710839204600b55835160208101918252602081526102078161050a565b519020161493610120948552855261014091825261016092835251926138c3948561053a863960805185818161085f0152818161103b0152818161145d0152818161210e0152612a1f015260a051858181610f1c01528181611fc3015281816124b40152612935015260c05185818161134d01528181611a47015281816125a0015281816126af01528181612ed80152613016015260e0518581816104d5015281816116de015261205c0152518481816108040152611de7015251838181611143015261226301525182818161183201528181611dbd015261257201525181818161125001526114280152f35b634e487b7160e01b600052601160045260246000fd5b015190503880610194565b60016000908152600080516020613e1d8339815191529350601f198516905b8181106103715750908460019594939210610358575b505050811b016001556101aa565b015160001960f88460031b161c1916905538808061034a565b92936020600181928786015181550195019301610334565b6001600052909150600080516020613e1d833981519152601f840160051c810191602085106103dd575b90601f859493920160051c01905b8181106103ce575061017d565b600081558493506001016103c1565b90915081906103b3565b634e487b7160e01b600052602260045260246000fd5b91607f1691610169565b634e487b7160e01b600052604160045260246000fd5b015190503880610130565b60008080529350600080516020613dfd83398151915291905b601f1984168510610483576001945083601f1981161061046a575b505050811b01600055610146565b015160001960f88460031b161c1916905538808061045c565b81810151835560209485019460019093019290910190610441565b60008052909150600080516020613dfd833981519152601f840160051c810191602085106104f1575b90601f859493920160051c01905b8181106104e25750610119565b600081558493506001016104d5565b90915081906104c7565b91607f1691610105565b600080fd5b604081019081106001600160401b0382111761040757604052565b51906001600160a01b03821682036105055756fe6080604052600436101561001257600080fd5b60003560e01c806301ffc9a7146102e757806306fdde03146102e257806307eefa09146102dd578063081812fc146102d8578063095ea7b3146102d35780630ad4c4f4146102ce578063150b7a02146102c957806321ac8eb4146102c457806323b872dd146102bf5780632da2d6e1146102ba57806330866abe146102b557806336301533146102b0578063379607f5146102ab5780633ec2d836146102a657806342842e0e146102a15780634622ab031461029c5780635747e69f146102975780635cec72a4146102925780635f7c95311461028d5780635ffe6146146102885780636352211e1461028357806370a082311461027e57806370ec6e1b1461027957806388124bd914610274578063947d56101461026f57806395d89b411461026a5780639915e23d14610265578063a22cb46514610260578063a50053901461025b578063b153673014610256578063b3cea21714610251578063b449810f1461024c578063b88d4fde14610247578063b90aac9c14610242578063bb5f943f1461023d578063c15319bf14610238578063c24dbebd14610233578063c87b56dd1461022e578063d2d4d77d14610229578063de0e9a3e14610224578063e985e9c51461021f578063ea3696ca1461021a578063ea598cb014610215578063f3239a18146102105763f9f87c181461020b57600080fd5b6118da565b61186e565b611857565b61181a565b6117b2565b6115f7565b6115db565b6113d8565b6113b5565b611399565b611337565b61131b565b611291565b611273565b611238565b6111b6565b61112b565b61106a565b611025565b610f7e565b610f4b565b610f06565b610eda565b610e7d565b610e4d565b610e18565b610dec565b610dc9565b610da6565b610d66565b610c54565b610b38565b6108d3565b61084b565b610828565b6107e7565b6107d0565b610787565b61071a565b610656565b610553565b610504565b6104bf565b6103d8565b610303565b6001600160e01b03198116036102fe57565b600080fd5b346102fe5760203660031901126102fe576020600435610322816102ec565b63ffffffff60e01b166380ac58cd60e01b8114908115610360575b811561034f575b506040519015158152f35b6301ffc9a760e01b14905038610344565b635b5e139f60e01b8114915061033d565b60009103126102fe57565b60005b83811061038f5750506000910152565b818101518382015260200161037f565b906020916103b88151809281855285808601910161037c565b601f01601f1916010190565b9060206103d592818152019061039f565b90565b346102fe576000806003193601126104bc5760405190808054906103fb82610c87565b8085529160209160019182811690811561048f5750600114610438575b6104348661042881880382610ac5565b604051918291826103c4565b0390f35b80809550527f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e5635b83851061047c575050505081016020016104288261043438610418565b805486860184015293820193810161045f565b90508695506104349693506020925061042894915060ff191682840152151560051b820101929338610418565b80fd5b346102fe5760003660031901126102fe576040517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b346102fe5760203660031901126102fe576004356105218161233e565b506000526004602052602060018060a01b0360406000205416604051908152f35b6001600160a01b038116036102fe57565b346102fe5760403660031901126102fe5760043561057081610542565b6024359061057d8261233e565b33151580610643575b80610615575b6105fd576105fb926105dc9181906001600160a01b0385811691167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925600080a46000526004602052604060002090565b80546001600160a01b0319166001600160a01b03909216919091179055565b005b60405163a9fbf51f60e01b8152336004820152602490fd5b506001600160a01b038116600090815260056020908152604080832033845290915290205460ff161561058c565b506001600160a01b038116331415610586565b346102fe5760203660031901126102fe576104346040806060815161067a81610a41565b6000918183809352826020820152828582015201526004358152600c60205220906001600160801b038151926106af84610a41565b5460ff81161515845260ff8160081c161515602085015260ff8160101c1615158385015260181c166060830152519182918291909160606001600160801b03816080840195805115158552602081015115156020860152604081015115156040860152015116910152565b346102fe5760803660031901126102fe57610736600435610542565b610741602435610542565b6064356001600160401b038082116102fe57366023830112156102fe5781600401359081116102fe57369101602401116102fe57604051630a85bd0160e11b8152602090f35b346102fe5760003660031901126102fe5760206040516109c48152f35b60609060031901126102fe576004356107bc81610542565b906024356107c981610542565b9060443590565b346102fe576105fb6107e1366107a4565b916119f6565b346102fe5760003660031901126102fe57602060405163ffffffff7f0000000000000000000000000000000000000000000000000000000000000000168152f35b346102fe5760003660031901126102fe5760206040516705f7aab8c56b00008152f35b346102fe576000806003193601126104bc577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031633036108c157600160ff19600a541617600a557f251f6d17a349e94e170ba983a0d79962271c3be5fe0c255d050ddc40f35aa8758180a180f35b6040516356620d4b60e11b8152600490fd5b346102fe5760203660031901126102fe5760048035906108f1612379565b61090d610908836000526008602052604060002090565b611b76565b9161091f61091a8261239c565b611bd0565b6109288161244c565b939060005b8251811015610a21576109626109566109566109498487611bed565b516001600160a01b031690565b6001600160a01b031690565b90813b156102fe5760408051632f79b7e960e11b8152808801858152602081018890526001600160a01b038a16928101929092526000606083018190529093909184919082908490829060800103925af1918215610a1c57600192610a03575b50818060a01b036109d66109498387611bed565b16857fb4ce698fd4c4f80fa2d06d863ce77e9c0fdf8e24c64ecfbb8c852ed20000430b600080a30161092d565b80610a10610a1692610a61565b80610371565b386109c2565b611c17565b6105fb6001600655565b634e487b7160e01b600052604160045260246000fd5b608081019081106001600160401b03821117610a5c57604052565b610a2b565b6001600160401b038111610a5c57604052565b606081019081106001600160401b03821117610a5c57604052565b604081019081106001600160401b03821117610a5c57604052565b602081019081106001600160401b03821117610a5c57604052565b90601f801991011681019081106001600160401b03821117610a5c57604052565b6001600160401b038111610a5c57601f01601f191660200190565b929192610b0d82610ae6565b91610b1b6040519384610ac5565b8294818452818301116102fe578281602093846000960137010152565b346102fe5760403660031901126102fe576004356024356001600160401b0381116102fe57366023820112156102fe57610b7c903690602481600401359101610b01565b80518015908115610c49575b50610c3757610c1a82610b9d6105fb94612526565b610ba68161263b565b50806000526009602052610bbd6040600020611c23565b610c1f575b610bd78382610bd182826128bf565b906129c9565b807f70a8f52a5cc7cf2d25e71645299888cb2ed1590225e7fca72f35ac61cf61d32460405180610c0787826103c4565b0390a26000526009602052604060002090565b611c89565b610c3281610c2c8161244c565b90612779565b610bc2565b604051631ae3550b60e01b8152600490fd5b601d91501138610b88565b346102fe576105fb610c65366107a4565b9060405192610c7384610aaa565b60008452610c828383836119f6565b612dfe565b90600182811c92168015610cb7575b6020831014610ca157565b634e487b7160e01b600052602260045260246000fd5b91607f1691610c96565b90604051918260008254610cd481610c87565b90818452602094600191600181169081600014610d445750600114610d05575b505050610d0392500383610ac5565b565b600090815285812095935091905b818310610d2c575050610d039350820101388080610cf4565b85548884018501529485019487945091830191610d13565b92505050610d0394925060ff191682840152151560051b820101388080610cf4565b346102fe5760203660031901126102fe576004356000526009602052610434610d926040600020610cc1565b60405191829160208352602083019061039f565b346102fe5760003660031901126102fe57602060ff600a54166040519015158152f35b346102fe5760003660031901126102fe57602060405167016345785d8a00008152f35b346102fe5760203660031901126102fe576004356000526007602052610434610d926040600020610cc1565b346102fe5760203660031901126102fe57610e3460043561263b565b15610e3b57005b604051633536de7360e21b8152600490fd5b346102fe5760203660031901126102fe576020610e6b60043561233e565b6040516001600160a01b039091168152f35b346102fe5760203660031901126102fe57600435610e9a81610542565b6001600160a01b03168015610ec15760005260036020526020604060002054604051908152f35b6040516322718ad960e21b815260006004820152602490fd5b346102fe5760003660031901126102fe576020610ef5611dbb565b6001600160801b0360405191168152f35b346102fe5760003660031901126102fe576040517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b346102fe5760203660031901126102fe576040610f6960043561244c565b82519182526001600160a01b03166020820152f35b346102fe576000806003193601126104bc5760405190806001805490610fa382610c87565b808652926020926001811690811561048f5750600114610fcd576104348661042881880382610ac5565b9350600184527fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf65b838510611012575050505081016020016104288261043438610418565b8054868601840152938201938101610ff5565b346102fe5760003660031901126102fe576040517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b346102fe5760403660031901126102fe5760043561108781610542565b602435801515908181036102fe576001600160a01b03831692831561111257906110d36110e49233600052600560205260406000209060018060a01b0316600052602052604060002090565b9060ff801983541691151516179055565b6040519081527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3160203392a3005b604051630b61174360e31b815260048101859052602490fd5b346102fe5760003660031901126102fe5760206040517f000000000000000000000000000000000000000000000000000000000000000015158152f35b90815180825260208080930193019160005b828110611188575050505090565b83516001600160a01b03168552938101939281019260010161117a565b9060206103d5928181520190611168565b346102fe576020806003193601126102fe5760043560005260086020526040600020906040519081602084549182815201936000526020600020916000905b828210611218576104348561120c81890382610ac5565b604051918291826111a5565b83546001600160a01b0316865294850194600193840193909101906111f5565b346102fe5760003660031901126102fe5760206040517f00000000000000000000000000000000000000000000000000000000000000008152f35b346102fe5760003660031901126102fe576020600b54604051908152f35b346102fe5760803660031901126102fe576004356112ae81610542565b602435906112bb82610542565b604435606435926001600160401b0384116102fe57366023850112156102fe576112f26105fb943690602481600401359101610b01565b92610c828383836119f6565b6040519061130b82610a8f565b60018252602360f81b6020830152565b346102fe5760003660031901126102fe57610434610d926112fe565b346102fe5760003660031901126102fe576040517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b6040519061138982610a8f565b60018252600b60fa1b6020830152565b346102fe5760003660031901126102fe57610434610d9261137c565b346102fe5760003660031901126102fe5760206040516729a2241af62c00008152f35b346102fe5760203660031901126102fe5761141161140c6004356113fb8161233e565b506000526009602052604060002090565b610cc1565b8051156115b0575b60405163320734f160e11b81527f00000000000000000000000000000000000000000000000000000000000000006004820152906000826024816001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000165afa8015610a1c576114cd6115819261153861152a610428946104349760009161158d575b50604051683d913730b6b2911d1160b91b60208201529485946114c791906029870183565b90611eec565b7f222c226465736372697074696f6e223a22577261707065642056657273696f6e81527f206f6620616e2065787465726e616c20636f6c6c656374696f6e222c22696d6160208201526433b2911d1160d91b604082015260450190565b61227d60f01b815260020190565b039061154c601f1992838101835282610ac5565b6040517f646174613a6170706c69636174696f6e2f6a736f6e3b757466382c00000000006020820152938491603b83016114c7565b03908101835282610ac5565b6115aa91503d806000833e6115a28183610ac5565b810190611ec7565b386114a2565b506115b9611e62565b611419565b604051906115cb82610a8f565b60018252600160fe1b6020830152565b346102fe5760003660031901126102fe57610434610d926115be565b346102fe5760203660031901126102fe5760043561161f81600052600c602052604060002090565b61163161162d825460ff1690565b1590565b6117a05761165961164c836000526002602052604060002090565b546001600160a01b031690565b6001600160a01b039190339083160361178e576116dc9061167f61162d600a5460ff1690565b61177c575b61168d84612e95565b6116a96116a4856000526009602052604060002090565b611f03565b6116c06116a4856000526007602052604060002090565b805472ffffffffffffffffffffffffffffffff0000ff19169055565b7f00000000000000000000000000000000000000000000000000000000000000001690813b156102fe57604051632142170760e11b81523060048201523360248201526044810182905260009283908290606490829084905af18015610a1c57611769575b507fbeaa92c6354c6dcf375d2c514352b2c11bc865784722e5dd9b267e606eb5fc5f8280a280f35b80610a1061177692610a61565b38611741565b61178984610c2c8161244c565b611684565b604051633617438360e11b8152600490fd5b604051634d5e5fb360e01b8152600490fd5b346102fe5760403660031901126102fe57602060ff61180e6004356117d681610542565b602435906117e382610542565b60018060a01b03166000526005845260406000209060018060a01b0316600052602052604060002090565b54166040519015158152f35b346102fe5760003660031901126102fe5760206040517f000000000000000000000000000000000000000000000000000000000000000015158152f35b60203660031901126102fe576105fb600435611f8e565b346102fe5760003660031901126102fe576020604051601d8152f35b9092916040820191604081528451809352606081019260208096019060005b8181106118c6575050506103d59394506020818403910152611168565b8251865294870194918701916001016118a9565b346102fe5760203660031901126102fe576004803561190f611909610908836000526008602052604060002090565b9161244c565b5061191a82516122f0565b61192483516122f0565b9360005b84518110156119e7576119446109566109566109498489611bed565b60408051633506307760e21b81528481018781526000602082015291939290918491839182908190850103915afa8015610a1c576001936119af9260009182936119b5575b50506119958488611bed565b526119a0838a611bed565b6001600160a01b039091169052565b01611928565b6119d8935080919250903d106119e0575b6119d08183610ac5565b810190612322565b903880611989565b503d6119c6565b6040518061043488868361188a565b91906001600160a01b039081811615611b5d57611a1d83600052600c602052604060002090565b9082611a3661164c866000526002602052604060002090565b16611b4b57611a43611dbb565b90837f000000000000000000000000000000000000000000000000000000000000000016803b156102fe57604051631093e42d60e01b81526001600160a01b03831660048201526001600160801b038416602482015260016044820152906000908290606490829084905af18015610a1c57611af984611adf611b049689988b9660008051602061386e83398151915296611b38575b50611f4c565b6040516001600160801b0390911681529081906020820190565b0390a28433916132d1565b9316921690828203611b1557505050565b60649350604051926364283d7b60e01b8452600484015260248301526044820152fd5b80610a10611b4592610a61565b38611ad9565b604051631a05867560e21b8152600490fd5b604051633250574960e11b815260006004820152602490fd5b90604051918281549182825260209260208301916000526020600020936000905b828210611bad57505050610d0392500383610ac5565b85546001600160a01b031684526001958601958895509381019390910190611b97565b15611bd757565b634e487b7160e01b600052600160045260246000fd5b8051821015611c015760209160051b010190565b634e487b7160e01b600052603260045260246000fd5b6040513d6000823e3d90fd5b6103d59054610c87565b818110611c38575050565b60008155600101611c2d565b9190601f8111611c5357505050565b610d03926000526020600020906020601f840160051c83019310611c7f575b601f0160051c0190611c2d565b9091508190611c72565b91909182516001600160401b038111610a5c57611cb081611caa8454610c87565b84611c44565b602080601f8311600114611cf357508190611ce4939495600092611ce8575b50508160011b916000199060031b1c19161790565b9055565b015190503880611ccf565b90601f19831695611d0985600052602060002090565b926000905b888210611d4657505083600195969710611d2d575b505050811b019055565b015160001960f88460031b161c19169055388080611d23565b80600185968294968601518155019501930190611d0e565b634e487b7160e01b600052601160045260246000fd5b600019810191908211611d8357565b611d5e565b6020039060208211611d8357565b91908203918211611d8357565b600381901b91906001600160fd1b03811603611d8357565b7f0000000000000000000000000000000000000000000000000000000000000000611e565763ffffffff7f0000000000000000000000000000000000000000000000000000000000000000164203428111611d83576301e187e090046705f7aab8c56b000090818102918183041490151715611d83576001600160801b03906729a2241af62c000080821015611e5057501690565b90501690565b6729a2241af62c000090565b60405190611e6f82610a8f565b6007825266155b9b985b595960ca1b6020830152565b81601f820112156102fe578051611e9b81610ae6565b92611ea96040519485610ac5565b818452602082840101116102fe576103d5916020808501910161037c565b906020828203126102fe5781516001600160401b0381116102fe576103d59201611e85565b90611eff6020928281519485920161037c565b0190565b611f0d8154610c87565b9081611f17575050565b81601f60009311600114611f29575055565b908083918252611f48601f60208420940160051c840160018501611c2d565b5555565b906301000000600160981b0382549160181b16906301000000600160981b031916179055565b908160209103126102fe575190565b8015611d83576000190190565b600a5460ff166122c757604080516370a0823160e01b81523360048083019190915291906001600160a01b03906020816024817f000000000000000000000000000000000000000000000000000000000000000086165afa908115610a1c57600091612298575b501561228a57600b5415158061225a575b61201a85600052600c602052604060002090565b805460ff808260101c16911661224a5782159283612243575b8061223a575b61222a578280612222575b80612210575b61220057815460ff19166001178255837f000000000000000000000000000000000000000000000000000000000000000016803b156102fe5785516323b872dd60e01b815233818901908152306020820152604081018a9052909160009183919082908490829060600103925af18015610a1c576121ed575b506120ce8733612fb3565b867f5b8cd8f3a67af1dee11ad4321a05f79a76cc7ea517810fc56d6d96c1e60d3686600080a26121e557805462ff000019166201000017905515612192577f000000000000000000000000000000000000000000000000000000000000000016803b156102fe576000915192838092633d3dd45b60e21b825234905af18015610a1c5761217f575b50337f38e5238102ce2a59567903a1637a95729503851bddda3a844436f29c80ee6e52600080a3565b80610a1061218c92610a61565b38612156565b507fa0af932cc5cbdd6147bf8bdcaea54634cf27abe631044f1f4f9f2daddaf3567792506121e091506121ce6121c9600b54611f81565b600b55565b600b5490519081529081906020820190565b0390a1565b505050505050565b80610a106121fa92610a61565b386120c3565b8451635d197e5160e01b81528690fd5b5067016345785d8a000034141561204a565b508015612044565b84516378fc2c5160e01b81528690fd5b50341515612039565b5080612033565b8451631bbdf5c560e31b81528690fd5b506001808516147f0000000000000000000000000000000000000000000000000000000000000000151514612006565b5051635c95168760e11b8152fd5b6122ba915060203d6020116122c0575b6122b28183610ac5565b810190611f72565b38611ff5565b503d6122a8565b60405163c3603d0960e01b8152600490fd5b6001600160401b038111610a5c5760051b60200190565b906122fa826122d9565b6123076040519182610ac5565b8281528092612318601f19916122d9565b0190602036910137565b91908260409103126102fe57602082519201516103d581610542565b6000818152600260205260409020546001600160a01b0316908115612361575090565b60249060405190637e27328960e01b82526004820152fd5b60026006541461238a576002600655565b604051633ee5aeb560e01b8152600490fd5b6000908152600260205260409020546001600160a01b0316330361178e57600190565b906020828203126102fe5781516001600160401b03928382116102fe57016060818303126102fe57604051926123f484610a74565b81519081116102fe5760409261240b918301611e85565b8352602081015161241b81610542565b6020840152015160ff811681036102fe57604082015290565b9060406103d59260008152816020820152019061039f565b60005260076020526124616040600020610cc1565b906124b0600060405160208101906020825261249281612484604082018961039f565b03601f198101835282610ac5565b51902093604051809381926365a3ccf960e11b835260048301612434565b03817f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03165afa908115610a1c576103d591602091600091612503575b5001516001600160a01b031690565b61252091503d806000833e6125188183610ac5565b8101906123bf565b386124f4565b61253a81600052600c602052604060002090565b80549160ff8316156117a05761164c61255d916000526002602052604060002090565b6001600160a01b039290339084160361178e577f00000000000000000000000000000000000000000000000000000000000000009081612613575b5061260357507f000000000000000000000000000000000000000000000000000000000000000016803b156102fe57604051634b1946fb60e01b8152336004820152906000908290602490829084905af18015610a1c576125f65750565b80610a10610d0392610a61565b805461ff00191661010017905550565b60ff915060081c161538612598565b6001600160801b039182169082160391908211611d8357565b61264f81600052600c602052604060002090565b61266661164c836000526002602052604060002090565b6001600160a01b039190339083160361178e57612695612684611dbb565b915460181c6001600160801b031690565b916001600160801b0380841690831614612770576126d6907f0000000000000000000000000000000000000000000000000000000000000000169282612622565b91803b156102fe57604051631093e42d60e01b81523360048201526001600160801b03939093166024840152600060448401819052908390606490829084905af1908115610a1c5760008051602061386e833981519152926127559261275d575b50611adf8161275086600052600c602052604060002090565b611f4c565b0390a2600190565b80610a1061276a92610a61565b38612737565b50505050600090565b909291612784612379565b61279b610908826000526008602052604060002090565b6127b76127b2836000526008602052604060002090565b61287e565b60005b815181101561286e576001600160a01b036127d86109498385611bed565b1690813b156102fe5760405163bcfb29af60e01b815260048101869052602481018590526001600160a01b03881660448201526000606482018190529092908360848183855af1928315610a1c5760019361285b575b50847f1e7dc9151e44edb4fc142dbf645faec2bf01b5de5e0ac6cd20e90ef5d0422871600080a3016127ba565b80610a1061286892610a61565b3861282e565b505050509050610d036001600655565b8054600082558061288d575050565b610d0391600052602060002090810190611c2d565b604051906128af82610a8f565b60018252600160fd1b6020830152565b91906129036128f26128d361290893613487565b6128ed6128e66128e16115be565b613487565b80926134ad565b6134ee565b6128fd6128e16128a2565b90613565565b6135ee565b6040516365a3ccf960e11b81526001600160a01b039390600081806129308660048301612434565b0381887f0000000000000000000000000000000000000000000000000000000000000000165afa908115610a1c5761297b91602091600091612503575001516001600160a01b031690565b938416156129b75781610c1a61299b926000526007602052604060002090565b6040516129b0816124846020820194856103c4565b5190209190565b604051631d538a9160e01b8152600490fd5b9193926128f26129de6129ec926128e1612379565b6128ed6128e66128e16112fe565b906129f86128e161137c565b92612a13612a0e612a0986866136b2565b612bb8565b6122f0565b936001600160a01b03937f00000000000000000000000000000000000000000000000000000000000000008516919060005b8751811015612b8a57612a5b6129038484613565565b90815115612b81576040918251906386304ba960e01b8252602091828180612a876004958683016103c4565b03818b5afa928315610a1c57600093612b52575b5050898216918b8315612b4557906119a085612ab693611bed565b813b156102fe57925163067a619d60e51b8152928301878152602081018d90526001600160a01b038916604082015260009084908190606001038183855af1928315610a1c57600193612b32575b508b7fc0011caead85c5a7acde281295df035f6bfe8aa69af2b3d723cf601f99cfa797600080a35b01612a45565b80610a10612b3f92610a61565b38612b04565b5050505060019150612b2c565b612b72929350803d10612b7a575b612b6a8183610ac5565b810190612bd3565b903880612a9b565b503d612b60565b60019150612b2c565b50505050505050612ba9612bae92936000526008602052604060002090565b612be8565b610d036001600655565b9060018201809211611d8357565b91908201809211611d8357565b908160209103126102fe57516103d581610542565b8151916001600160401b038311610a5c57680100000000000000008311610a5c578154838355808410612c52575b5060208091019160005260206000209060005b848110612c37575050505050565b83516001600160a01b03168382015592810192600101612c29565b612c6a90836000528460206000209182019101611c2d565b38612c16565b908160209103126102fe57516103d5816102ec565b6103d5939260809260018060a01b03168252600060208301526040820152816060820152019061039f565b6001600160a01b0391821681529116602082015260408101919091526080606082018190526103d59291019061039f565b3d15612d0c573d90612cf282610ae6565b91612d006040519384610ac5565b82523d6000602084013e565b606090565b91823b612d1d57505050565b6020612d409160405180938192630a85bd0160e11b968784523360048501612c85565b038160006001600160a01b0388165af160009181612dcd575b50612d985782612d67612ce1565b8051919082612d9157604051633250574960e11b81526001600160a01b0383166004820152602490fd5b9050602001fd5b6001600160e01b03191603612daa5750565b604051633250574960e11b81526001600160a01b03919091166004820152602490fd5b612df091925060203d602011612df7575b612de88183610ac5565b810190612c70565b9038612d59565b503d612dde565b91929092833b612e0f575b50505050565b612e34916020916040519384928392630a85bd0160e11b978885523360048601612cb0565b038160006001600160a01b0388165af160009181612e74575b50612e5b5782612d67612ce1565b6001600160e01b03191603612daa575038808080612e09565b612e8e91925060203d602011612df757612de88183610ac5565b9038612e4d565b612ea981600052600c602052604060002090565b60008281526002602052604090206001600160a01b03919082905416906001600160801b03815460181c1691837f00000000000000000000000000000000000000000000000000000000000000001692833b156102fe5760405163402412bf60e11b81526001600160a01b039290921660048301526001600160801b03166024820152916000908390604490829084905af1918215610a1c57612f6892612fa0575b50805472ffffffffffffffffffffffffffffffff00000019169055565b8160008051602061386e83398151915260405180612f8b81906000602083019252565b0390a2612f9782613147565b16156123615750565b80610a10612fad92610a61565b38612f4b565b919091604092835191612fc583610aaa565b60008084526001600160a01b038281161561310b57612fee84600052600c602052604060002090565b8161300661164c876000526002602052604060002090565b166130fa57613013611dbb565b827f00000000000000000000000000000000000000000000000000000000000000001691823b156130f6578951631093e42d60e01b81526001600160a01b03871660048201526001600160801b0383166024820152600160448201529285908490606490829084905af1918215610a1c576130a8816130c1938a9660008051602061386e83398151915296611b385750611f4c565b8a516001600160801b0390911681529081906020820190565b0390a26130ce84846131f9565b166130df5750610d03939450612d11565b6024908651906339e3563760e11b82526004820152fd5b8480fd5b8751631a05867560e21b8152600490fd5b8651633250574960e11b815260048101839052602490fd5b613137906000526004602052604060002090565b80546001600160a01b0319169055565b6000818152600260205260409020546001600160a01b031690816131b2575b61317a816000526002602052604060002090565b80546001600160a01b03191690556000827fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8280a490565b6131c6816000526004602052604060002090565b80546001600160a01b03191690556001600160a01b03821660009081526003602052604090208054600019019055613166565b6000828152600260205260409020546001600160a01b0390811692919061323d908461328a575b82169182613266575b6105dc846000526002602052604060002090565b827fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef600080a490565b6001600160a01b038116600090815260036020526040902060018154019055613229565b61329e846000526004602052604060002090565b80546001600160a01b03191690556001600160a01b03851660009081526003602052604090208054600019019055613220565b6000828152600260205260408120546001600160a01b03908116948592919081811680151590816133a0575b505050906133497fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9284613372575b8516948561334e575b6105dc876000526002602052604060002090565b80a490565b6001600160a01b038116600090815260036020526040902060018154019055613335565b61337b87613123565b6001600160a01b0385166000908152600360205260409020805460001901905561332c565b9080929394955091613409575b50156133be579081808794936132fd565b8490866133de57604051637e27328960e01b815260048101839052602490fd5b60405163177e802f60e01b81526001600160a01b039190911660048201526024810191909152604490fd5b8781149150811561343b575b8115613423575b50386133ad565b9050858452600460205282604085205416143861341c565b9050868452600560205260ff61346683604087209060018060a01b0316600052602052604060002090565b541690613415565b6040519061347b82610a8f565b60006020838281520152565b61348f61346e565b506020815191604051926134a284610a8f565b835201602082015290565b906134b661346e565b506134d0825160208401928351602082519201519261374c565b9080518203828111611d83578351908103908111611d835783525290565b906134f761346e565b5081519080519182811061355f576001926020850193845182602086015180830361354f575b50505061352c575b5050505090565b8103908111611d8357835251908051918201809211611d83575238808080613525565b819293502091201438828161351d565b50505090565b919061356f61346e565b9261357861346e565b508051916135946020830193845183519060208501519261374c565b908351602087015283518203828111611d83578652835183518101809111611d835782036135c55750506000915052565b85519281518401809411611d83576135e16135ea948251611d96565b90525190612bc6565b9052565b8051906136136135fd83610ae6565b9261360b6040519485610ac5565b808452610ae6565b601f19919060208481019184013683378083015192519291935b8184101561367657506000199280613650575b5050518251821691191617905290565b908092935003908111611d835761366961366e9161385e565b611d74565b903880613640565b92919384518152818101809111611d835793818101809111611d835791838101908111611d83579261362d565b6000198114611d835760010190565b91600083519360208101916136d28351968651602088019889519261374c565b85518101809111611d8357905b835183518101809111611d83578211613734576136fb906136a3565b9082519084518103818111611d83578203918211611d835761372e91613726918851908a519261374c565b865190612bc6565b906136df565b95505050509050565b60ff8111611d83576001901b90565b9192819383811115613765575b50506103d59250612bc6565b909291906020811161380757600093816137dd575b518416939291906137949061378f8484612bc6565b611d96565b84848751165b036137a757505050505090565b9091929394818110156137ce576137bd906136a3565b94848651169080959493929161379a565b50509091506103d59250612bc6565b93506137946137fe6136696137f96137f485611d88565b611da3565b61373d565b1994905061377a565b8091959320916000945b61381b8383611d96565b861161384c5782812084146138425761383661383c91612bb8565b956136a3565b94613811565b9450505050915090565b5092949150506103d592503880613759565b601f8111611d83576101000a9056fe154c1641fa45e45c3964d7c08068cde47e8e5eec0330ba974330b7f98a95592ea2646970667358221220f541242f70c7c31def3d60a444890edc0afe987a0a08d125b6701ea407b412cd64736f6c63430008190033290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e563b10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf6a2646970667358221220385a79878199108fdf0e925b9bc677d98916317483479d1b38ac9cdb5157efe464736f6c63430008190033000000000000000000000000c90b92d70af24ef1369389f1a1e3887305cd89c9000000000000000000000000888d768764a2e304215247f0ba3457ccb0f0ab4f000000000000000000000000c88d37b7ae9b6d781678cf12155a69d6d4eb82f2000000000000000000000000cb6dfd06973bf66c8bd2779538e5c8311b8070b800000000000000000000000090a8e18c1b382fc59009c24081ac58e28b86311b0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f

Deployed Bytecode

0x60406080815260048036101561001f575b5050361561001d57600080fd5b005b600091823560e01c8062550aea1461205457806305d7f13714612010578063063ae59414611fee578063073aa84b14611f145780630eb70ef214611ef75780631376c89114611d6b5780631a80d0d714611d045780631e83409a14611b9357806320a8a3da14611b74578063249d39e914611b5757806324d4a72614611b3357806326fb04c414611962578063288b44581461172b5780633377e8f8146116bc5780633b6299ed1461167b5780633db803ad146114c35780633f607cbf146114a557806345247c2e146114675780634e17811d146113f857806354aaa1f4146113cb5780635aa035ef146113ad57806361d027b314611384578063640e69e21461136357806365850ee4146113445780637511aaca1461130057806379a08571146111215780637b7000e8146110c55780637c84de6014610ff757806383c1cd8a14610fb757806384e0192a14610f8f57806386304ba914610f26578063869ecc1e14610e0957806388124bd914610dc55780638eb828de14610d4f57806398b4c7a514610cca57806399f0805f146108f9578063a7bed11c146108da578063a909f654146108b6578063af2f3b17146107e5578063b9a08b3914610735578063bcc293c0146106f1578063bff33127146106c8578063c167bc65146106a9578063ce8abd2114610665578063d7297c4d14610642578063e0bab4c4146105fe578063e40de8871461051a578063e4a02012146104a2578063e57475a914610469578063e8758cdf146103e7578063eea7f57b146103ba578063f0f4426014610323578063f4f7516c146103095763ffa0613b1461027d5750610010565b34610305576020366003190112610305576102966122c6565b600154926001600160a01b03919082851633036102ee5750166001600160a01b0319929092168217600155519081527fb0c836c55880dc7bb0a7e759fa9c03569b415b1ce49230848ab2c421b66d922890602090a180f35b8351633119d86d60e11b8152908101869052602490fd5b8280fd5b83806003193601126103205761031d6128c7565b80f35b80fd5b5090346103055760203660031901126103055761033e6122c6565b6001546001600160a01b039190821633036103a35716918215610396575050600980546001600160a01b031916821790557f3c864541ef71378c6229510ed90f376565ee42d9c5e0904a984a9e863e6db44f8280a280f35b5163d92e233d60e01b8152fd5b8351633119d86d60e11b8152808401869052602490fd5b8382346103e357816003193601126103e357600a5490516001600160a01b039091168152602090f35b5080fd5b5082346103205781600319360112610320576104016122c6565b8261040a6122b0565b9260006020835161041a8161220a565b828152015260018060a01b0380931681526007602052209116600052602052610445816000206128a2565b61046782518092602090816001600160801b0391828151168552015116910152565bf35b509034610305576020366003190112610305578161049e9361049392358152600d60205220612435565b9051918291826124fb565b0390f35b509034610305578260031936011261030557600154906001600160a01b038216330361050357506001600160a01b031916600155518181527fb0c836c55880dc7bb0a7e759fa9c03569b415b1ce49230848ab2c421b66d922890602090a180f35b8251633119d86d60e11b8152908101849052602490fd5b8382346103e35760203660031901126103e357908160c09261053a6122c6565b928060a08351610549816121bc565b8281528260208201528285820152826060820152826080820152015260018060a01b03809416815260036020522091815190610584826121bc565b83549384835260026001820154916020850192835201549380840192808616845263ffffffff936060860193858860a01c16855260ff60a06080890198828b8e1c1615158a52019860c81c1615158852835198895251602089015251169086015251166060840152511515608083015251151560a0820152f35b8382346103e357816003193601126103e357517f0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f6001600160a01b03168152602090f35b8382346103e357816003193601126103e35760209051670de0b6b3a76400008152f35b8382346103e357816003193601126103e357517f00000000000000000000000090a8e18c1b382fc59009c24081ac58e28b86311b6001600160a01b03168152602090f35b8382346103e357816003193601126103e35751600160f91b8152602090f35b8382346103e357816003193601126103e35760015490516001600160a01b039091168152602090f35b8382346103e357816003193601126103e357517f000000000000000000000000cb1d4a0bbb09a6b9b8c9eb171a195d24dcce93cd6001600160a01b03168152602090f35b508290346103e35760203660031901126103e3576107516122c6565b6001549093906001600160a01b0390811633036107cf57839416803b156107ca57839082845180968193633630153360e01b83525af180156107c057610795578380f35b67ffffffffffffffff83116107ad5750528180808380f35b634e487b7160e01b845260419052602483fd5b82513d86823e3d90fd5b505050fd5b50826024925191633119d86d60e11b8352820152fd5b8382346103e35760203660031901126103e35760a091816108046122eb565b918060808351610813816121ee565b8281528260208201528285820152826060820152015263ffffffff8093168152600860205220908251610845816121ee565b600180861b0393848454169485835260028160018701541695602085019687520154946001600160801b039183850191838816835260ff60806060880197898b831c16895201988b1c1615158852845198895251166020880152511690850152511660608301525115156080820152f35b8382346103e357816003193601126103e35760209051683635c9adc5dea000008152f35b8382346103e357816003193601126103e357602090600b549051908152f35b50829060209081600319360112610305573415159184358380610cc1575b610cb1578315610c815784935b15610c7c5750345b6001600160a01b03938416908082158015610c6d57670de0b6b3a76400005b8310610c5d5784919015610b35576024925085519283809263b6b55f2560e01b82528a8c830152897f000000000000000000000000cb6dfd06973bf66c8bd2779538e5c8311b8070b8165af1908115610b2b578691610afa575b50935b600a549163ffffffff92838160a01c16848114610ae757600163ffffffff60a01b910160a01b169063ffffffff60a01b1916179081600a556001600160801b039062278d00420193844211610ad4579160028a8a9593857fe5d5503587d41cd579af1b22e69329e0ec9b9f9eb74f212973b61be636560b2a9a9998968c805194610a31866121ee565b3386528c8601948552878287019b168b528b606087019a168a528b6080870199828b5260a01c16815260088d5220935116906bffffffffffffffffffffffff60a01b918285541617845560018401925116908254161790550193511683549263ffffffff60801b905160801b169160ff60a01b9051151560a01b16926affffffffffffffffffffff60a81b161717179055600a5460a01c1692519384523393a380f35b634e487b7160e01b8a5260118b5260248afd5b634e487b7160e01b895260118a52602489fd5b90508281813d8311610b24575b610b118183612226565b81010312610b205751876109a5565b8580fd5b503d610b07565b84513d88823e3d90fd5b5050847f00000000000000000000000090a8e18c1b382fc59009c24081ac58e28b86311b169084516323b872dd60e01b8152338982015282602482015281604482015284816064818b8b7f0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f165af18015610c5357918893918693610c11575b506024908751948593849263b6b55f2560e01b84528d8401525af1908115610b2b578691610be4575b50936109a8565b90508281813d8311610c0a575b610bfb8183612226565b81010312610b20575187610bdd565b503d610bf1565b9193509181813d8111610c4c575b610c298183612226565b81010312610c48575180151503610c4457869184918a610bb4565b8680fd5b8780fd5b503d610c1f565b86513d8a823e3d90fd5b8551631fbaba3560e01b81528990fd5b683635c9adc5dea0000061094b565b61092c565b7f0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f6001600160a01b031693610924565b8251631f60009960e21b81528690fd5b50801515610917565b50903461030557610cda366122fe565b60015490926001600160a01b03929183163303610d38575091602091600080516020612c35833981519152931693848652858352808620918254908160f81b1760f81c9060ff191617809255519060ff60f81b9060f81b168152a280f35b8451633119d86d60e11b8152908101869052602490fd5b50903461030557602036600319011261030557610d6a6122c6565b6001546001600160a01b03929083163303610dae5750600080516020612c3583398151915291602091169283855284825280852060ff19815416905551848152a280f35b8351633119d86d60e11b8152908101859052602490fd5b8382346103e357816003193601126103e357517f000000000000000000000000c88d37b7ae9b6d781678cf12155a69d6d4eb82f26001600160a01b03168152602090f35b508290346103e35760203660031901126103e357610e256122c6565b6001546001600160a01b039081163303610f0f5780821690818552600360205283852091600283019460ff865460c01c1615610f0057600184019182549268056bc75e2d631000009384811015610ef057808503948511610ad457610eec999a5084610e9091612595565b90556001600160801b03936009541689526007602052818920908952602052872091610ec2818454931682841661254a565b16906001600160801b0319161790555491549163ffffffff60ff8460c81c169360a01c1691612b15565b5080f35b8351634f10cd9f60e01b81528b90fd5b516341fbc5a760e01b81528790fd5b8251633119d86d60e11b8152808601859052602490fd5b5082346103205760203660031901126103205782359067ffffffffffffffff82116103205750602092610f5b91369101612264565b82610f6e835192838151938492016124d8565b6006908201908152819003830190205490516001600160a01b039091168152f35b8382346103e357816003193601126103e35760209063ffffffff600a5460a01c169051908152f35b8382346103e35760203660031901126103e35760209181906001600160a01b03610fdf6122c6565b168152808452205460f81b90519060ff60f81b168152f35b509034610305576060366003190112610305576110126122c6565b61101a6122b0565b6110226122dc565b6001546001600160a01b039491929190851633036110ae57508316938486526005602052852060ff1981541660ff8315151617905560001461108657167f0211f82302458486d009f57b4f60864d0228b04ee0ab528a5e3f99ac46d4e7a08380a380f35b167fada537e83313f87700605d76e8a40b047c14e51541d0e00ae35889c6582d9b6e8380a380f35b8551633119d86d60e11b8152908101879052602490fd5b509190346103e35760203660031901126103e3576104459183916110e76122c6565b82602085516110f58161220a565b82815201526001600160a01b0390811683526003602090815284842060020154909116835252206128a2565b50903461030557816003193601126103055780359167ffffffffffffffff91602435838111610b20576111579036908301612264565b923386526020868152600160f91b808589205460f81b16156112ea5750858752600d81528387209285519283116112d757506111938354612335565b601f8111611294575b5080601f831160011461120a575091816111f994927f337a70f4f5a37276b1f9543833290cb7a869eb2eb8216d62fb7e868f4d6f51b5969489916111ff575b508160011b916000199060031b1c19161790555b51918291826124fb565b0390a280f35b9050840151386111db565b90601f1983168489528289209289905b82821061127c575050927f337a70f4f5a37276b1f9543833290cb7a869eb2eb8216d62fb7e868f4d6f51b5969492600192826111f9989610611263575b5050811b0190556111ef565b86015160001960f88460031b161c191690553880611257565b80600185968294968c0151815501950193019061121a565b838852818820601f840160051c8101918385106112cd575b601f0160051c01905b8181106112c2575061119c565b8881556001016112b5565b90915081906112ac565b634e487b7160e01b885260419052602487fd5b83602491865191633119d86d60e11b8352820152fd5b8382346103e357816003193601126103e357517f000000000000000000000000c597a71a49c49b4a0554b3110bab25a51c76847b6001600160a01b03168152602090f35b8382346103e357816003193601126103e35751600160fa1b8152602090f35b508234610320576020366003190112610320575061049361049e923561287b565b8382346103e357816003193601126103e35760095490516001600160a01b039091168152602090f35b8382346103e357816003193601126103e35761049e9061049361236f565b836020366003190112610320576113f06113e36122c6565b6113eb6129dd565b6125a2565b600160025580f35b503461030557602036600319011261030557600154823592906001600160a01b031633036114525750816020917fa574c90ca73b4ac7ea6db89c2ce80bd8ed1e76936a4ffab90d8f0ebde0614cae93600b5551908152a180f35b836024925191633119d86d60e11b8352820152fd5b8382346103e35760203660031901126103e35760209160ff9082906001600160a01b036114926122c6565b1681526005855220541690519015158152f35b8382346103e357816003193601126103e3576020905162278d008152f35b509034610305576020806003193601126116775767ffffffffffffffff918035838111610b20576114f79036908301612264565b9060019460018060a01b0386541633036116615750815193841161164e5750611521600c54612335565b601f81116115e8575b50602091601f84116001146115675750928293918392869461155c575b50501b916000199060031b1c191617600c5580f35b015192503880611547565b919083601f198116600c88527fdf6966c971051c3d54ec59162606531493a51404a002842f56009d7e5cf4a8c79488905b888383106115ce57505050106115b5575b505050811b01600c5580f35b015160001960f88460031b161c191690553880806115a9565b858701518855909601959485019487935090810190611598565b600c86527fdf6966c971051c3d54ec59162606531493a51404a002842f56009d7e5cf4a8c7601f850160051c81019160208610611644575b601f0160051c019085905b82811061163957505061152a565b87815501859061162b565b9091508190611620565b634e487b7160e01b865260419052602485fd5b51633119d86d60e11b8152908101869052602490fd5b8380fd5b8382346103e35760209161168e366122fe565b6001600160a01b0390911682528184529082902054915160f89290921b166001600160f81b03191615158152f35b509034610305576116cc366122fe565b60015490926001600160a01b03929183163303610d38575091602091600080516020612c3583398151915293169384865285835280862091825490198160f81b1660f81c9060ff191617809255519060ff60f81b9060f81b168152a280f35b5090346103055760209182600319360112611677576117486122eb565b926117516129dd565b63ffffffff9384168086526008825282862060028101805482546001600160801b038216989497946001600160a01b0394939291851633036119525742908260801c16116119425760ff8160a01c166119325760ff60a01b1916600160a01b1790556001015483918791811661188657855163f3fef3a360e01b8152339481019485526020850192909252909283919082908a90829060400103927f000000000000000000000000cb6dfd06973bf66c8bd2779538e5c8311b8070b8165af1801561187c5761184e575b507f13ba83ca6ba0ea0638c6e19929c2a3b603f471fcb7eec655c70bde60802fe3f2915b519384523393a3600160025580f35b8190813d8311611875575b6118638183612226565b81010312611871573861181b565b8480fd5b503d611859565b83513d88823e3d90fd5b855163f3fef3a360e01b8152339481019485526020850192909252909283919082908a90829060400103927f00000000000000000000000090a8e18c1b382fc59009c24081ac58e28b86311b165af1801561187c57611908575b507f13ba83ca6ba0ea0638c6e19929c2a3b603f471fcb7eec655c70bde60802fe3f29161183f565b8190813d831161192b575b61191d8183612226565b8101031261187157386118e0565b503d611913565b86516355adf54760e11b81528590fd5b865163f94a6d1160e01b81528590fd5b8751630aadc8f760e21b81528690fd5b50903461030557816003193601126103055761197c6122c6565b916024356119886129dd565b809360018060a01b03809116938487526020926003845284882033895260078552858920878a5285526001600160801b0391600183888c205416920190815490838111611b235715611b1a575b68056bc75e2d63100000811015611b0a579189916119f6836119fd95612527565b9055612527565b9081151580611afa575b611aea5733808a5260078652868a20888b528652868a2080546001600160801b03191693909216929092179055845163f3fef3a360e01b8152918201908152602081018790529091839183919082908a90829060400103927f000000000000000000000000cb6dfd06973bf66c8bd2779538e5c8311b8070b8165af1801561187c57611ac0575b507f1db45d68a79b3f7656091f2656143b8bff824bd68b0f77eec0ed41747854cdfb91519384523393a3600160025580f35b8190813d8311611ae3575b611ad58183612226565b810103126118715738611a8e565b503d611acb565b85516395ba79fd60e01b81528390fd5b506611c37937e080008210611a07565b875163f30bb8af60e01b81528590fd5b985081986119d5565b88516317a1ae2760e31b81528690fd5b8382346103e357816003193601126103e3576020905168056bc75e2d631000008152f35b8382346103e357816003193601126103e357602090516127108152f35b8382346103e357816003193601126103e35751600160f81b8152602090f35b5090346103055760208060031936011261167757611baf6122c6565b92611bb86129dd565b60018060a01b0380941692838652600383528186209460028601541686528083528186209433875260078452828720858852845260018388209101549568056bc75e2d631000008703611cf45781546001600160801b039182611c2f611c2583549b838d16848716612a7b565b9360801c84612527565b16988915611ce457611c8d94939291611c4e8b611c6e9360801c61254a565b81546001600160801b031660809190911b6001600160801b031916179055565b82546001600160801b0316911660801b6001600160801b031916179055565b8580808088335af1611c9d612565565b5015611cd65750907ff7a40077ff7a04c7e61f6f26fb13774259ddf1b6bce9ecf26a8276cdd399268391519384523393a3600160025580f35b90516312171d8360e31b8152fd5b86516312d37ee560e31b81528690fd5b83516312d37ee560e31b81528390fd5b50903461030557611d14366122fe565b60015490926001600160a01b03929183163303610d385750168084526020848152838520805460ff191660f885901c17905592516001600160f81b0319909216825291600080516020612c3583398151915291a280f35b503461030557608036600319011261030557611d856122c6565b6024359160443563ffffffff8116809103610b20576064359283151593848103610c485760018060a01b03918260015416331490811580611edb575b611ecb57831697888a52600360205260ff6002878c20015460c01c16611ebd5750918860609694927f246f8be29250021ed7b87f7b1e9def90abf9aa1b2dee2a369f865cd5722d16f7989694600014611eb6575b89855193611e22856121bc565b8885526002602086019585875288810196868852898d8301978a895260808401966001885260a0850198151589528152600360205220915182555160018201550194511684549363ffffffff60a01b905160a01b169160ff60c01b9051151560c01b169260ff60c81b9051151560c81b169365ffffffffffff60d01b1617171717905581519384526020840152820152a280f35b5080611e15565b855163f5e2e91f60e01b8152fd5b855163ea8e4eb560e01b81528990fd5b50338a5260208a9052858a205460f81b600160fa1b1615611dc1565b8382346103e357816003193601126103e35760209051610fa08152f35b50903461030557602036600319011261030557611f2f6122c6565b6001546001600160a01b03929083163303610dae57506020929183911692839283865285825280862080549160ff19928360fe821691161780925585815160ff60f81b809460f81b168152600080516020612c35833981519152968791a2858852878452808820805493841660f894851b600160f81b17851c17908190559051921b168152a2600a80546001600160a01b031916821790557f11399aa18969a5223209b5c2a40d43272dba187f6272b7f3b08937fdd3da6dfc8280a280f35b8382346103e357816003193601126103e357602090516611c37937e080008152f35b8382346103e357816003193601126103e357517f000000000000000000000000cb6dfd06973bf66c8bd2779538e5c8311b8070b86001600160a01b03168152602090f35b503461030557606036600319011261030557813567ffffffffffffffff8111611677576120849036908401612264565b61208c6122b0565b926120956122dc565b6001546001600160a01b03929190831633149081156121b457905b1580612198575b612189571580612160575b61215257507faaf39b41c37aa03e0720b1664b6e9d5b5bf03b7a3087faf098c6efe3626bd3379161213c61214c92855190835191602081818701946121088183886124d8565b81016006815203019020971696876bffffffffffffffffffffffff60a01b82541617905585518092819285519283916124d8565b81010390209351918291826124fb565b0390a380f35b8351635dc1236b60e11b8152fd5b5081845160208186516121768183858b016124d8565b81016006815203019020541615156120c2565b50835163160d3af160e11b8152fd5b5033875260208790528487205460f81b600160f81b16156120b7565b5086906120b0565b60c0810190811067ffffffffffffffff8211176121d857604052565b634e487b7160e01b600052604160045260246000fd5b60a0810190811067ffffffffffffffff8211176121d857604052565b6040810190811067ffffffffffffffff8211176121d857604052565b90601f8019910116810190811067ffffffffffffffff8211176121d857604052565b67ffffffffffffffff81116121d857601f01601f191660200190565b81601f820112156122ab5780359061227b82612248565b926122896040519485612226565b828452602083830101116122ab57816000926020809301838601378301015290565b600080fd5b602435906001600160a01b03821682036122ab57565b600435906001600160a01b03821682036122ab57565b6044359081151582036122ab57565b6004359063ffffffff821682036122ab57565b60409060031901126122ab576004356001600160a01b03811681036122ab57906024356001600160f81b0319811681036122ab5790565b90600182811c92168015612365575b602083101461234f57565b634e487b7160e01b600052602260045260246000fd5b91607f1691612344565b60405190600082600c549161238383612335565b8083529260209060019081811690811561241157506001146123b0575b50506123ae92500383612226565b565b915092600c6000527fdf6966c971051c3d54ec59162606531493a51404a002842f56009d7e5cf4a8c7936000925b8284106123f957506123ae94505050810160200138806123a0565b855488850183015294850194879450928101926123de565b915050602092506123ae94915060ff191682840152151560051b82010138806123a0565b9060405191826000825461244881612335565b908184526020946001916001811690816000146124b65750600114612477575b5050506123ae92500383612226565b600090815285812095935091905b81831061249e5750506123ae9350820101388080612468565b85548884018501529485019487945091830191612485565b925050506123ae94925060ff191682840152151560051b820101388080612468565b60005b8381106124eb5750506000910152565b81810151838201526020016124db565b6040916020825261251b81518092816020860152602086860191016124d8565b601f01601f1916010190565b9190820391821161253457565b634e487b7160e01b600052601160045260246000fd5b9190916001600160801b038080941691160191821161253457565b3d15612590573d9061257682612248565b916125846040519384612226565b82523d6000602084013e565b606090565b9190820180921161253457565b60018060a01b039081811660009080825260209360038552604093848420917f000000000000000000000000cb6dfd06973bf66c8bd2779538e5c8311b8070b8169085519663ef8b30f760e01b885260049734898201528181602481875afa908115612871578791612844575b508093600186019687549389986611c37937e0800085106128345768056bc75e2d631000009586811015612824578561264791612595565b948686116127dc575b50600289019760ff895460c01c16156127cc578c5163b6b55f2560e01b8152808f018d9052948391869160249183915af19384156127c2578c949392918c87928196612762575b507f68d983f34506233768c7739bcc474d4566f676f25fbf983559f16d8fd7d220b19495966001600160801b039133815260078652818120888252865220908154906126e7818a1682841661254a565b16906001600160801b031916179055558b519384523393a31061275957612723925491549163ffffffff60ff8460c81c169360a01c1691612b15565b5080612730575b50505050565b81808092335af161273f612565565b501561274c57808061272a565b516312171d8360e31b8152fd5b50505050505050565b93955050929450508281813d83116127bb575b61277f8183612226565b810103126127b75791847f68d983f34506233768c7739bcc474d4566f676f25fbf983559f16d8fd7d220b1928c8e9695519594612697565b8a80fd5b503d612775565b8c513d8d823e3d90fd5b8c516341fbc5a760e01b81528e90fd5b995093965068056bc75e2d630fffff19870187811161281157806128048161280a939c612527565b98612527565b9338612650565b634e487b7160e01b8b5260118d5260248bfd5b8c51634f10cd9f60e01b81528e90fd5b8b51631fbaba3560e01b81528d90fd5b90508181813d831161286a575b61285b8183612226565b81010312610c4457513861260f565b503d612851565b88513d89823e3d90fd5b600052600d6020526128906040600020612435565b805161289f575061289f61236f565b90565b906040516128af8161220a565b91546001600160801b038116835260801c6020830152565b60003381526005602052604060ff8183205416156129cd5734156129c95733825260046020526001600160801b0380828420541692612905346129fe565b936129108582612595565b600b548091116129b6575b50506129278434612527565b9133825260046020528382209081549061294581881682841661254a565b16906001600160801b0319161790558080808460018060a01b03600954165af161296d612565565b50156129a557907f17ad8e3ecc7b4fac225cfa9c1be3f36f595e0e354868e4a985b9ea10594a381e91815193845260208401523392a2565b81516312171d8360e31b8152600490fd5b6129c1929550612527565b92388061291b565b5050565b516381d5b5ad60e01b8152600490fd5b60028054146129ec5760028055565b604051633ee5aeb560e01b8152600490fd5b610fa08181029060001981840990828083109203918083039214612a70576127109082821115612a5e577fbc01a36e2eb1c432ca57a786c226809d495182a9930be0ded288ce703afb7e91940990828211900360fc1b910360041c170290565b60405163227bc15360e01b8152600490fd5b505061271091500490565b90918282029160001984820993838086109503948086039514612af15784831115612a5e5782910981600003821680920460028082600302188083028203028083028203028083028203028083028203028083028203028092029003029360018380600003040190848311900302920304170290565b505080925015612aff570490565b634e487b7160e01b600052601260045260246000fd5b9263ffffffff60018060a01b039384604051966359a2567f60e01b88521693846004880152306024880152604487015216606485015215156084840152602091600090838560a48185857f000000000000000000000000cb1d4a0bbb09a6b9b8c9eb171a195d24dcce93cd165af1948515612c29578295612bf0575b508416808252600584526040808320805460ff19166001179055838352600390945292812060020180546001600160a01b031916841790557f272e091e149483ff0ce831f3b0e712c169f39c3202d6aad9b32138626a83b16c9080a390565b9094508381813d8311612c22575b612c088183612226565b810103126103e3575184811681036103e357936003612b91565b503d612bfe565b6040513d84823e3d90fdfe875cc7db9aab147d67906d9905e17f3ace84574847d15e4262794dfddb0daaa4a26469706673582212204020202d479dea2ee15d53b9d5f236b17737a320fe5bf5a3353ae8de5fe0de3564736f6c63430008190033

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

000000000000000000000000c90b92d70af24ef1369389f1a1e3887305cd89c9000000000000000000000000888d768764a2e304215247f0ba3457ccb0f0ab4f000000000000000000000000c88d37b7ae9b6d781678cf12155a69d6d4eb82f2000000000000000000000000cb6dfd06973bf66c8bd2779538e5c8311b8070b800000000000000000000000090a8e18c1b382fc59009c24081ac58e28b86311b0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f

-----Decoded View---------------
Arg [0] : _owner (address): 0xc90B92d70AF24eF1369389f1A1E3887305cD89c9
Arg [1] : _treasury (address): 0x888D768764A2E304215247F0bA3457cCb0f0ab4f
Arg [2] : _nftPass (address): 0xC88d37B7ae9b6d781678Cf12155A69d6d4Eb82F2
Arg [3] : _dripVaultETH (address): 0xCb6DFd06973bF66C8bD2779538e5C8311B8070B8
Arg [4] : _dripVaultDAI (address): 0x90A8E18c1B382Fc59009c24081Ac58E28b86311b
Arg [5] : _dai (address): 0x6B175474E89094C44Da98b954EedeAC495271d0F

-----Encoded View---------------
6 Constructor Arguments found :
Arg [0] : 000000000000000000000000c90b92d70af24ef1369389f1a1e3887305cd89c9
Arg [1] : 000000000000000000000000888d768764a2e304215247f0ba3457ccb0f0ab4f
Arg [2] : 000000000000000000000000c88d37b7ae9b6d781678cf12155a69d6d4eb82f2
Arg [3] : 000000000000000000000000cb6dfd06973bf66c8bd2779538e5c8311b8070b8
Arg [4] : 00000000000000000000000090a8e18c1b382fc59009c24081ac58e28b86311b
Arg [5] : 0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f


Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export  ]
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.