Ape Curtis Testnet

Contract

0xE6Bd0e652B7cCD1C20bDADe33BcA455CCbbD2AaE
Transaction Hash
Method
Block
From
To
Distribute158685762025-02-14 11:04:205 days ago1739531060IN
0xE6Bd0e65...CCbbD2AaE
0.1 APE0.000002430.01
Cancel158676962025-02-14 10:15:185 days ago1739528118IN
0xE6Bd0e65...CCbbD2AaE
0 APE0.000000590.01
Claim158668112025-02-14 9:27:235 days ago1739525243IN
0xE6Bd0e65...CCbbD2AaE
0 APE0.000001220.01
Claim158527442025-02-13 21:40:515 days ago1739482851IN
0xE6Bd0e65...CCbbD2AaE
0 APE0.000003810.01
Claim158527082025-02-13 21:38:415 days ago1739482721IN
0xE6Bd0e65...CCbbD2AaE
0 APE0.000003530.01
Distribute158526702025-02-13 21:35:095 days ago1739482509IN
0xE6Bd0e65...CCbbD2AaE
0.1 APE0.00000220.01
Distribute158526532025-02-13 21:33:295 days ago1739482409IN
0xE6Bd0e65...CCbbD2AaE
0.1 APE0.000002380.01
Claim158525842025-02-13 21:29:095 days ago1739482149IN
0xE6Bd0e65...CCbbD2AaE
0 APE0.000003590.01
Distribute158525722025-02-13 21:28:045 days ago1739482084IN
0xE6Bd0e65...CCbbD2AaE
0.1 APE0.000002320.01
Distribute158525442025-02-13 21:26:265 days ago1739481986IN
0xE6Bd0e65...CCbbD2AaE
0.1 APE0.000002430.01
Claim158524702025-02-13 21:20:565 days ago1739481656IN
0xE6Bd0e65...CCbbD2AaE
0 APE0.00000310.01
Claim158524562025-02-13 21:20:425 days ago1739481642IN
0xE6Bd0e65...CCbbD2AaE
0 APE0.0000030.01
Distribute158524392025-02-13 21:19:085 days ago1739481548IN
0xE6Bd0e65...CCbbD2AaE
0.1 APE0.000002370.01
Claim158523612025-02-13 21:12:555 days ago1739481175IN
0xE6Bd0e65...CCbbD2AaE
0 APE0.000002730.01
Claim158003972025-02-13 10:13:386 days ago1739441618IN
0xE6Bd0e65...CCbbD2AaE
0 APE0.000001490.01
Claim157931152025-02-13 9:07:406 days ago1739437660IN
0xE6Bd0e65...CCbbD2AaE
0 APE0.000001760.01
Claim157929442025-02-13 9:06:206 days ago1739437580IN
0xE6Bd0e65...CCbbD2AaE
0 APE0.000001110.01
Distribute157925502025-02-13 9:02:476 days ago1739437367IN
0xE6Bd0e65...CCbbD2AaE
0.1 APE0.000002260.01
Distribute157106092025-02-12 11:06:407 days ago1739358400IN
0xE6Bd0e65...CCbbD2AaE
0.1 APE0.000002430.01
Add NFT Collecti...157103512025-02-12 11:04:427 days ago1739358282IN
0xE6Bd0e65...CCbbD2AaE
0 APE0.000001470.01
Claim157095962025-02-12 10:58:547 days ago1739357934IN
0xE6Bd0e65...CCbbD2AaE
0 APE0.000001350.01
Distribute157095402025-02-12 10:58:287 days ago1739357908IN
0xE6Bd0e65...CCbbD2AaE
0.1 APE0.000002410.01
Claim157077762025-02-12 10:45:317 days ago1739357131IN
0xE6Bd0e65...CCbbD2AaE
0 APE0.000001050.01
Claim157077622025-02-12 10:45:277 days ago1739357127IN
0xE6Bd0e65...CCbbD2AaE
0 APE0.000000410.01
Claim157077222025-02-12 10:45:057 days ago1739357105IN
0xE6Bd0e65...CCbbD2AaE
0 APE0.000001230.01
View all transactions

Latest 25 internal transactions (View All)

Parent Transaction Hash Block From To
158685762025-02-14 11:04:205 days ago1739531060
0xE6Bd0e65...CCbbD2AaE
0 APE
158685762025-02-14 11:04:205 days ago1739531060
0xE6Bd0e65...CCbbD2AaE
0.1 APE
158685762025-02-14 11:04:205 days ago1739531060
0xE6Bd0e65...CCbbD2AaE
0 APE
158676962025-02-14 10:15:185 days ago1739528118
0xE6Bd0e65...CCbbD2AaE
0 APE
158676962025-02-14 10:15:185 days ago1739528118
0xE6Bd0e65...CCbbD2AaE
0 APE
158668112025-02-14 9:27:235 days ago1739525243
0xE6Bd0e65...CCbbD2AaE
0 APE
158668112025-02-14 9:27:235 days ago1739525243
0xE6Bd0e65...CCbbD2AaE
0 APE
158668112025-02-14 9:27:235 days ago1739525243
0xE6Bd0e65...CCbbD2AaE
0 APE
158527442025-02-13 21:40:515 days ago1739482851
0xE6Bd0e65...CCbbD2AaE
0 APE
158527442025-02-13 21:40:515 days ago1739482851
0xE6Bd0e65...CCbbD2AaE
0 APE
158527442025-02-13 21:40:515 days ago1739482851
0xE6Bd0e65...CCbbD2AaE
0 APE
158527442025-02-13 21:40:515 days ago1739482851
0xE6Bd0e65...CCbbD2AaE
0 APE
158527442025-02-13 21:40:515 days ago1739482851
0xE6Bd0e65...CCbbD2AaE
0 APE
158527442025-02-13 21:40:515 days ago1739482851
0xE6Bd0e65...CCbbD2AaE
0 APE
158527442025-02-13 21:40:515 days ago1739482851
0xE6Bd0e65...CCbbD2AaE
0 APE
158527442025-02-13 21:40:515 days ago1739482851
0xE6Bd0e65...CCbbD2AaE
0 APE
158527442025-02-13 21:40:515 days ago1739482851
0xE6Bd0e65...CCbbD2AaE
0 APE
158527442025-02-13 21:40:515 days ago1739482851
0xE6Bd0e65...CCbbD2AaE
0 APE
158527442025-02-13 21:40:515 days ago1739482851
0xE6Bd0e65...CCbbD2AaE
0 APE
158527082025-02-13 21:38:415 days ago1739482721
0xE6Bd0e65...CCbbD2AaE
0 APE
158527082025-02-13 21:38:415 days ago1739482721
0xE6Bd0e65...CCbbD2AaE
0 APE
158527082025-02-13 21:38:415 days ago1739482721
0xE6Bd0e65...CCbbD2AaE
0 APE
158527082025-02-13 21:38:415 days ago1739482721
0xE6Bd0e65...CCbbD2AaE
0 APE
158527082025-02-13 21:38:415 days ago1739482721
0xE6Bd0e65...CCbbD2AaE
0 APE
158527082025-02-13 21:38:415 days ago1739482721
0xE6Bd0e65...CCbbD2AaE
0 APE
View All Internal Transactions

Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
NFTRewardsV2

Compiler Version
v0.8.23+commit.f704f362

Optimization Enabled:
Yes with 200 runs

Other Settings:
paris EvmVersion

Contract Source Code (Solidity Standard Json-Input format)

File 1 of 15 : NFTRewardsV2.sol
// SPDX-License-Identifier: MIT
pragma solidity =0.8.23;

import "../interfaces/degen/ITokenRegistry.sol";
import {AccessControl} from "@openzeppelin/contracts/access/AccessControl.sol";
import {Errors} from "../libraries/Errors.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {IERC721} from "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import {IFeeDistributor} from "../interfaces/fees/IFeeDistributor.sol";
import {ReentrancyGuard} from "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";


contract NFTRewardsV2 is AccessControl, ReentrancyGuard {
  using SafeERC20 for IERC20;

  bytes32 public constant MANAGER_ROLE = keccak256("MANAGER_ROLE");

  enum ClaimPeriod {
    SevenDays,
    OneMonth,
    ThreeMonths
  }

  struct Claim {
    /// @dev reward token
    address token;
    /// @dev NFT address
    address nft;
    /// @dev reward amount
    uint256 amount;
  }

  struct Distribution {
    address token;
    address nft;
    uint256 reward;
    uint256 rewardPerNFT;
    uint256 claimed;
    uint64 endsAt;
  }

  struct NFTCollection {
    address nft;
    uint256 totalAmount;
    string name;
    string symbol;
    bool isActive;
  }

  uint64 private constant SEVEN_DAYS = 7 days;
  uint64 private constant ONE_MONTH = 30 days;
  uint64 private constant THREE_MONTH = 90 days;
  IFeeDistributor public immutable feeDistributor;
  ITokenRegistry[] public tokenRegistry;
  uint256 public fee;

  mapping(address => NFTCollection) public validNFTCollections;
  mapping(address => mapping(address => Distribution)) private _distributions;
  /// @dev Token => (NFT address => (TokenId => True/False has claimed))
  mapping(address => mapping(address => mapping(uint256 => bool))) public hasClaimed;


  error InvalidClaim();
  error NotFound();

  event FactoryAdded(address factory);
  event FactoryRemoved(address factory);
  event NFTCollectionUpdated(address nft, uint256 amount, bool status, string name, string symbol, string url);
  event FeeUpdated(uint256 fee);
  event Distributed(address indexed token, address nft, address account, uint256 reward, uint256 totalHolders, uint64 endsAt);
  event Cancelled(address indexed token, address nft, address account, uint256 unclaimed, uint256 claimed);
  event Claimed(address indexed account, address nft, Claim claim);
  event UnclaimedTokensReturned(address token, address nft, address to, uint256 amount);

  modifier onlyManager() {
    require(hasRole(MANAGER_ROLE, msg.sender) || hasRole(DEFAULT_ADMIN_ROLE, msg.sender), "Not a manager");
    _;
  }

  modifier onlyOwner() {
    require(hasRole(DEFAULT_ADMIN_ROLE, msg.sender), "Not an admin");
    _;
  }

  modifier claimCheck(address token, address nft) {
    Distribution memory distribution = _distributions[token][nft];
    if (distribution.endsAt == 0) revert Errors.Unavailable();
    if (distribution.endsAt < block.timestamp) revert Errors.PrematureExecution(distribution.endsAt);
    _;
    if (distribution.claimed > distribution.reward) revert InvalidClaim();
  }

  /**
     * @param _feeDistributor Fee distributor contract.
     */
  constructor(
    IFeeDistributor _feeDistributor
  ) {
    if (address(_feeDistributor) == address(0)) revert Errors.InvalidAddress();
    _grantRole(DEFAULT_ADMIN_ROLE, _msgSender());
    feeDistributor = _feeDistributor;
  }

  /**
  * @notice Get Creator by Token
  * @param _token Token address
  * @return address Creator address
  */
  function getCreatorByToken(address _token) public view returns (address) {
    for (uint256 i = 0; i < tokenRegistry.length; i++) {
      address _creator = tokenRegistry[i].creatorByToken(_token);
      if (_creator != address(0)) {
        return _creator;
      }
    }
    return address(0);
  }

  /**
   * @notice Set the token registry (only Owner)
     * @param tokenRegistry_ DegenFactory address
     */
  function setDegenFactory(ITokenRegistry tokenRegistry_) external onlyOwner {
    if (address(tokenRegistry_) == address(0)) revert Errors.InvalidAddress();
    //Check if the factory is already added
    for (uint256 i = 0; i < tokenRegistry.length; i++) {
      if (address(tokenRegistry[i]) == address(tokenRegistry_)) {
        return;
      }
    }
    tokenRegistry.push(tokenRegistry_);
    emit FactoryAdded(address(tokenRegistry_));
  }

  /**
    * @notice Remove a factory from the registry (only Owner)
    * @param factory Factory address
    */
  function removeFactory(ITokenRegistry factory) external onlyOwner {
    for (uint256 i = 0; i < tokenRegistry.length; i++) {
      if (tokenRegistry[i] == factory) {
        tokenRegistry[i] = tokenRegistry[tokenRegistry.length - 1];
        tokenRegistry.pop();
        emit FactoryRemoved(address(factory));
        return;
      }
    }
  }

  function addNFTCollection(address nft, uint256 totalAmount, string calldata name, string calldata symbol, string calldata url) external onlyManager {
    if(validNFTCollections[nft].nft != address(0)) revert Errors.InvalidAddress();
    validNFTCollections[nft] = NFTCollection(nft, totalAmount, name, symbol, true);
    emit NFTCollectionUpdated(nft, totalAmount, true, name, symbol, url);
  }

  function updateNFTCollection(address nft, uint256 totalAmount, bool status, string calldata name, string calldata symbol, string calldata url) external onlyManager {
    if(validNFTCollections[nft].nft == address(0)) revert Errors.InvalidAddress();
    validNFTCollections[nft] = NFTCollection(nft, totalAmount, name, symbol, status);
    emit NFTCollectionUpdated(nft, totalAmount, status, name, symbol, url);
  }

  /**
   * @notice Set fee (only Owner)
     * @param _fee Fee in APE
     */
  function setFee(uint256 _fee) external onlyOwner {
    fee = _fee;
    emit FeeUpdated(_fee);
  }

  /**
   * @notice Distribute tokens (created by the Ape Express factory) to a specific set of NFT holders (e.g. BAYC)
     */
  function distribute(address nft, address token, ClaimPeriod claimPeriod, uint256 rewards) external payable {
    if (msg.value != fee) revert Errors.InvalidPayment();
    NFTCollection memory nftCollection = validNFTCollections[nft];
    if (!nftCollection.isActive || nftCollection.totalAmount == 0) revert Errors.Unavailable();
    _validateCaller(token);
    /// @dev only allow a new distribution if previous one has been withdrawn
    if (_distributions[token][nft].endsAt != 0) revert Errors.Unavailable();
    uint64 endsAt = uint64(block.timestamp) + _getClaimPeriod(claimPeriod);
    uint256 rewardPerNFT = rewards / nftCollection.totalAmount;
    if (rewards == 0 || rewardPerNFT == 0) revert Errors.InvalidAmount();
    _distributions[token][nft] = Distribution(
      token,
      nft,
      rewards,
      rewardPerNFT,
      0,
      endsAt
    );
    feeDistributor.distribute{value: msg.value}();
    IERC20(token).safeTransferFrom(_msgSender(), address(this), rewards);
    emit Distributed(
      token,
      nft,
      _msgSender(),
      rewards,
      nftCollection.totalAmount,
      endsAt
    );
  }

  /**
   * @notice Claim token rewards
      * @param token Token to claim
      * @param nft NFT to claim
     */
  function claim(address token, address nft, uint256[] calldata ids) external nonReentrant {
    _claim(token, nft, ids);
  }

  /**
   * @notice Claim batch token rewards for multiple NFTs
      * @param token Token to claim
      * @param nft NFTs to claim
     */
  function claimBatch(address token, address[] calldata nft, uint256[][] calldata ids) external nonReentrant {
    for (uint256 i = 0; i < nft.length; i++) {
      _claim(token, nft[i], ids[i]);
    }
  }

  /**
   * @notice Cancel a distribution (after the end date has been reached or if all rewards have been claimed)
     * @param _token Token distributed
     * @param _nft NFT related to the distribution
     */
  function cancel(address _token, address _nft) external {
    _validateCaller(_token);
    Distribution memory distribution = _distributions[_token][_nft];
    if (distribution.endsAt == 0) revert Errors.Unavailable();
    if (block.timestamp <= distribution.endsAt && distribution.reward != distribution.claimed)
      revert Errors.PrematureExecution(distribution.endsAt);
    uint256 claimed = distribution.claimed;
    uint256 unclaimed = distribution.reward - claimed;
    delete _distributions[_token][_nft];
    if (unclaimed != 0) {
      IERC20(_token).safeTransfer(_msgSender(), unclaimed);
      emit UnclaimedTokensReturned(_token, _nft, _msgSender(), unclaimed);
    }
    emit Cancelled(_token, _nft, _msgSender(), unclaimed, claimed);
  }

  /**
   * @notice Get a distribution
     * @param _token Token
     * @param _nft NFT
     * @return distribution Distribution for _token to _nft holders
     */
  function getDistribution(
    address _token,
    address _nft
  ) external view returns (Distribution memory distribution) {
    if (_token == address(0) || _nft == address(0)) revert Errors.InvalidAddress();
    distribution = _distributions[_token][_nft];
    if (distribution.endsAt == 0) revert NotFound();
    return distribution;
  }

  function checkClaimable(address token, address nft, uint256[] calldata ids) external view returns (uint256) {
    uint notClaimed = 0;
    for (uint256 i = 0; i < ids.length; i++) {
      if (hasClaimed[token][nft][ids[i]]) {
        continue;
      }
      notClaimed++;
    }
    return notClaimed;
  }

  function _claim(address token, address nft, uint256[] calldata ids) private claimCheck(token, nft) {
    Claim memory _claimData = Claim(token, nft, ids.length);
    IERC721 _nftCollection = IERC721(nft);
    if (ids.length == 0) {
      return;
    }
    uint256 notClaimed = 0;
    for (uint256 i = 0; i < ids.length; i++) {
      if (hasClaimed[token][nft][ids[i]]) {
        continue;
      }
      address owner = _nftCollection.ownerOf(ids[i]);
      if (owner != _msgSender()) {
        continue;
      }
      hasClaimed[token][nft][ids[i]] = true;
      notClaimed++;
    }
    if (notClaimed == 0) {
      return;
    }
    uint256 rewardPerNFT = _distributions[_claimData.token][_claimData.nft].rewardPerNFT;
    uint256 rewardsPerUser = notClaimed * rewardPerNFT;
    _claimData.amount = rewardsPerUser;
    _distributions[_claimData.token][_claimData.nft].claimed += rewardsPerUser;
    IERC20(_claimData.token).safeTransfer(_msgSender(), rewardsPerUser);
    emit Claimed(_msgSender(), _claimData.nft, _claimData);
  }

  /// @param _token Token address
  function _validateCaller(address _token) private view {
    /// @dev checks if a token is from the DegenFactory, if it is then it should equal _msgSender(). msgSender should be a user, not a factory
    address _creator = getCreatorByToken(_token);
    if (_creator == _msgSender()) {
      return;
    }
    revert Errors.InvalidCaller();
  }

  /**
   * @param _claimPeriod Claim period.
     * @return uint64 Amount of time (in seconds) associated with _claimPeriod.
     */
  function _getClaimPeriod(ClaimPeriod _claimPeriod) private pure returns (uint64) {
    if (_claimPeriod == ClaimPeriod.SevenDays) {
      return SEVEN_DAYS;
    } else if (_claimPeriod == ClaimPeriod.OneMonth) {
      return ONE_MONTH;
    }
    // @dev 3 months
    return THREE_MONTH;
  }
}

File 2 of 15 : AccessControl.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol)

pragma solidity ^0.8.20;

import {IAccessControl} from "./IAccessControl.sol";
import {Context} from "../utils/Context.sol";
import {ERC165} from "../utils/introspection/ERC165.sol";

/**
 * @dev Contract module that allows children to implement role-based access
 * control mechanisms. This is a lightweight version that doesn't allow enumerating role
 * members except through off-chain means by accessing the contract event logs. Some
 * applications may benefit from on-chain enumerability, for those cases see
 * {AccessControlEnumerable}.
 *
 * Roles are referred to by their `bytes32` identifier. These should be exposed
 * in the external API and be unique. The best way to achieve this is by
 * using `public constant` hash digests:
 *
 * ```solidity
 * bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
 * ```
 *
 * Roles can be used to represent a set of permissions. To restrict access to a
 * function call, use {hasRole}:
 *
 * ```solidity
 * function foo() public {
 *     require(hasRole(MY_ROLE, msg.sender));
 *     ...
 * }
 * ```
 *
 * Roles can be granted and revoked dynamically via the {grantRole} and
 * {revokeRole} functions. Each role has an associated admin role, and only
 * accounts that have a role's admin role can call {grantRole} and {revokeRole}.
 *
 * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
 * that only accounts with this role will be able to grant or revoke other
 * roles. More complex role relationships can be created by using
 * {_setRoleAdmin}.
 *
 * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
 * grant and revoke this role. Extra precautions should be taken to secure
 * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}
 * to enforce additional security measures for this role.
 */
abstract contract AccessControl is Context, IAccessControl, ERC165 {
    struct RoleData {
        mapping(address account => bool) hasRole;
        bytes32 adminRole;
    }

    mapping(bytes32 role => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

    /**
     * @dev Modifier that checks that an account has a specific role. Reverts
     * with an {AccessControlUnauthorizedAccount} error including the required role.
     */
    modifier onlyRole(bytes32 role) {
        _checkRole(role);
        _;
    }

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

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) public view virtual returns (bool) {
        return _roles[role].hasRole[account];
    }

    /**
     * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()`
     * is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier.
     */
    function _checkRole(bytes32 role) internal view virtual {
        _checkRole(role, _msgSender());
    }

    /**
     * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account`
     * is missing `role`.
     */
    function _checkRole(bytes32 role, address account) internal view virtual {
        if (!hasRole(role, account)) {
            revert AccessControlUnauthorizedAccount(account, role);
        }
    }

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) public view virtual returns (bytes32) {
        return _roles[role].adminRole;
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     *
     * May emit a {RoleGranted} event.
     */
    function grantRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {
        _grantRole(role, account);
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     *
     * May emit a {RoleRevoked} event.
     */
    function revokeRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {
        _revokeRole(role, account);
    }

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been revoked `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `callerConfirmation`.
     *
     * May emit a {RoleRevoked} event.
     */
    function renounceRole(bytes32 role, address callerConfirmation) public virtual {
        if (callerConfirmation != _msgSender()) {
            revert AccessControlBadConfirmation();
        }

        _revokeRole(role, callerConfirmation);
    }

    /**
     * @dev Sets `adminRole` as ``role``'s admin role.
     *
     * Emits a {RoleAdminChanged} event.
     */
    function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
        bytes32 previousAdminRole = getRoleAdmin(role);
        _roles[role].adminRole = adminRole;
        emit RoleAdminChanged(role, previousAdminRole, adminRole);
    }

    /**
     * @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted.
     *
     * Internal function without access restriction.
     *
     * May emit a {RoleGranted} event.
     */
    function _grantRole(bytes32 role, address account) internal virtual returns (bool) {
        if (!hasRole(role, account)) {
            _roles[role].hasRole[account] = true;
            emit RoleGranted(role, account, _msgSender());
            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Attempts to revoke `role` to `account` and returns a boolean indicating if `role` was revoked.
     *
     * Internal function without access restriction.
     *
     * May emit a {RoleRevoked} event.
     */
    function _revokeRole(bytes32 role, address account) internal virtual returns (bool) {
        if (hasRole(role, account)) {
            _roles[role].hasRole[account] = false;
            emit RoleRevoked(role, account, _msgSender());
            return true;
        } else {
            return false;
        }
    }
}

File 3 of 15 : IAccessControl.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/IAccessControl.sol)

pragma solidity ^0.8.20;

/**
 * @dev External interface of AccessControl declared to support ERC165 detection.
 */
interface IAccessControl {
    /**
     * @dev The `account` is missing a role.
     */
    error AccessControlUnauthorizedAccount(address account, bytes32 neededRole);

    /**
     * @dev The caller of a function is not the expected one.
     *
     * NOTE: Don't confuse with {AccessControlUnauthorizedAccount}.
     */
    error AccessControlBadConfirmation();

    /**
     * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
     *
     * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
     * {RoleAdminChanged} not being emitted signaling this.
     */
    event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);

    /**
     * @dev Emitted when `account` is granted `role`.
     *
     * `sender` is the account that originated the contract call, an admin role
     * bearer except when using {AccessControl-_setupRole}.
     */
    event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Emitted when `account` is revoked `role`.
     *
     * `sender` is the account that originated the contract call:
     *   - if using `revokeRole`, it is the admin role bearer
     *   - if using `renounceRole`, it is the role bearer (i.e. `account`)
     */
    event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) external view returns (bool);

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {AccessControl-_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) external view returns (bytes32);

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function grantRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function revokeRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been granted `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `callerConfirmation`.
     */
    function renounceRole(bytes32 role, address callerConfirmation) external;
}

File 4 of 15 : IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 *
 * ==== Security Considerations
 *
 * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature
 * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be
 * considered as an intention to spend the allowance in any specific way. The second is that because permits have
 * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should
 * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be
 * generally recommended is:
 *
 * ```solidity
 * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {
 *     try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}
 *     doThing(..., value);
 * }
 *
 * function doThing(..., uint256 value) public {
 *     token.safeTransferFrom(msg.sender, address(this), value);
 *     ...
 * }
 * ```
 *
 * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of
 * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also
 * {SafeERC20-safeTransferFrom}).
 *
 * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so
 * contracts should have entry points that don't rely on permit.
 */
interface IERC20Permit {
    /**
     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
     * given ``owner``'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     *
     * CAUTION: See Security Considerations above.
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    /**
     * @dev Returns the current nonce for `owner`. This value must be
     * included whenever a signature is generated for {permit}.
     *
     * Every successful call to {permit} increases ``owner``'s nonce by one. This
     * prevents a signature from being used multiple times.
     */
    function nonces(address owner) external view returns (uint256);

    /**
     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view returns (bytes32);
}

File 5 of 15 : IERC20.sol
// 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 15 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.20;

import {IERC20} from "../IERC20.sol";
import {IERC20Permit} from "../extensions/IERC20Permit.sol";
import {Address} from "../../../utils/Address.sol";

/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    using Address for address;

    /**
     * @dev An operation with an ERC20 token failed.
     */
    error SafeERC20FailedOperation(address token);

    /**
     * @dev Indicates a failed `decreaseAllowance` request.
     */
    error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);

    /**
     * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeTransfer(IERC20 token, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));
    }

    /**
     * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
     * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
     */
    function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));
    }

    /**
     * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 oldAllowance = token.allowance(address(this), spender);
        forceApprove(token, spender, oldAllowance + value);
    }

    /**
     * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no
     * value, non-reverting calls are assumed to be successful.
     */
    function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {
        unchecked {
            uint256 currentAllowance = token.allowance(address(this), spender);
            if (currentAllowance < requestedDecrease) {
                revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);
            }
            forceApprove(token, spender, currentAllowance - requestedDecrease);
        }
    }

    /**
     * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
     * to be set to zero before setting it to a non-zero value, such as USDT.
     */
    function forceApprove(IERC20 token, address spender, uint256 value) internal {
        bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));

        if (!_callOptionalReturnBool(token, approvalCall)) {
            _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));
            _callOptionalReturn(token, approvalCall);
        }
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

        bytes memory returndata = address(token).functionCall(data);
        if (returndata.length != 0 && !abi.decode(returndata, (bool))) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     *
     * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
     */
    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false
        // and not revert is the subcall reverts.

        (bool success, bytes memory returndata) = address(token).call(data);
        return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && address(token).code.length > 0;
    }
}

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

File 8 of 15 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)

pragma solidity ^0.8.20;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev The ETH balance of the account is not enough to perform the operation.
     */
    error AddressInsufficientBalance(address account);

    /**
     * @dev There's no code at `target` (it is not a contract).
     */
    error AddressEmptyCode(address target);

    /**
     * @dev A call to an address target failed. The target may have reverted.
     */
    error FailedInnerCall();

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

        (bool success, ) = recipient.call{value: amount}("");
        if (!success) {
            revert FailedInnerCall();
        }
    }

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

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
        if (address(this).balance < value) {
            revert AddressInsufficientBalance(address(this));
        }
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target
     * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an
     * unsuccessful call.
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata
    ) internal view returns (bytes memory) {
        if (!success) {
            _revert(returndata);
        } else {
            // only check if target is a contract if the call was successful and the return data is empty
            // otherwise we already know that it was a contract
            if (returndata.length == 0 && target.code.length == 0) {
                revert AddressEmptyCode(target);
            }
            return returndata;
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the
     * revert reason or with a default {FailedInnerCall} error.
     */
    function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {
        if (!success) {
            _revert(returndata);
        } else {
            return returndata;
        }
    }

    /**
     * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.
     */
    function _revert(bytes memory returndata) private pure {
        // Look for revert reason and bubble it up if present
        if (returndata.length > 0) {
            // The easiest way to bubble the revert reason is using memory via assembly
            /// @solidity memory-safe-assembly
            assembly {
                let returndata_size := mload(returndata)
                revert(add(32, returndata), returndata_size)
            }
        } else {
            revert FailedInnerCall();
        }
    }
}

File 9 of 15 : Context.sol
// 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;
    }
}

File 10 of 15 : ERC165.sol
// 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;
    }
}

File 11 of 15 : IERC165.sol
// 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);
}

File 12 of 15 : ReentrancyGuard.sol
// 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;
    }
}

File 13 of 15 : ITokenRegistry.sol
// SPDX-License-Identifier: Unlicense
pragma solidity =0.8.23;

/// @title IDegenFactory: Bare minimum interface for the Degen Factory contract.
interface ITokenRegistry {
    /**
     * @notice Get the creator of a token.
     * @param _token Token address.
     * @return address Creator address.
     */
    function creatorByToken(address _token) external view returns (address);
}

File 14 of 15 : IFeeDistributor.sol
// SPDX-License-Identifier: Unlicense
pragma solidity =0.8.23;

/// @title IFeeDistributor: Bare minimum interface for FeeDistributor contract.
interface IFeeDistributor {
    function distribute() external payable;
}

File 15 of 15 : Errors.sol
// SPDX-License-Identifier: Unlicense
pragma solidity =0.8.23;

/// @notice A library that houses common errors.
library Errors {
    error InvalidAddress();
    error InvalidAddressAtIndex(uint256 index);
    error InvalidAmount();
    error InvalidAmountAtIndex(uint256 index);
    error InvalidCaller();
    error InvalidToken(address token);
    error InvalidListLength(uint256 provided, uint256 limit);
    error InvalidPayment();
    error InvalidLimits();
    error InsufficientAllowance();
    error InsufficientBalance();
    error UnsupportedFeature();
    error NotInitialized();
    error AlreadyInitialized();
    error NothingToWithdraw();
    error PrematureExecution(uint256 requiredTimestamp);
    error Unavailable();
}

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

Contract ABI

[{"inputs":[{"internalType":"contract IFeeDistributor","name":"_feeDistributor","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AccessControlBadConfirmation","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bytes32","name":"neededRole","type":"bytes32"}],"name":"AccessControlUnauthorizedAccount","type":"error"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"AddressInsufficientBalance","type":"error"},{"inputs":[],"name":"FailedInnerCall","type":"error"},{"inputs":[],"name":"InvalidAddress","type":"error"},{"inputs":[],"name":"InvalidAmount","type":"error"},{"inputs":[],"name":"InvalidCaller","type":"error"},{"inputs":[],"name":"InvalidClaim","type":"error"},{"inputs":[],"name":"InvalidPayment","type":"error"},{"inputs":[],"name":"NotFound","type":"error"},{"inputs":[{"internalType":"uint256","name":"requiredTimestamp","type":"uint256"}],"name":"PrematureExecution","type":"error"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"inputs":[],"name":"Unavailable","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"address","name":"nft","type":"address"},{"indexed":false,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"unclaimed","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"claimed","type":"uint256"}],"name":"Cancelled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"address","name":"nft","type":"address"},{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"nft","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"indexed":false,"internalType":"struct NFTRewardsV2.Claim","name":"claim","type":"tuple"}],"name":"Claimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"address","name":"nft","type":"address"},{"indexed":false,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"reward","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalHolders","type":"uint256"},{"indexed":false,"internalType":"uint64","name":"endsAt","type":"uint64"}],"name":"Distributed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"factory","type":"address"}],"name":"FactoryAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"factory","type":"address"}],"name":"FactoryRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"fee","type":"uint256"}],"name":"FeeUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"nft","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"bool","name":"status","type":"bool"},{"indexed":false,"internalType":"string","name":"name","type":"string"},{"indexed":false,"internalType":"string","name":"symbol","type":"string"},{"indexed":false,"internalType":"string","name":"url","type":"string"}],"name":"NFTCollectionUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"address","name":"nft","type":"address"},{"indexed":false,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"UnclaimedTokensReturned","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MANAGER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"nft","type":"address"},{"internalType":"uint256","name":"totalAmount","type":"uint256"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"},{"internalType":"string","name":"url","type":"string"}],"name":"addNFTCollection","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"address","name":"_nft","type":"address"}],"name":"cancel","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"nft","type":"address"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"}],"name":"checkClaimable","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"nft","type":"address"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"}],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address[]","name":"nft","type":"address[]"},{"internalType":"uint256[][]","name":"ids","type":"uint256[][]"}],"name":"claimBatch","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"nft","type":"address"},{"internalType":"address","name":"token","type":"address"},{"internalType":"enum NFTRewardsV2.ClaimPeriod","name":"claimPeriod","type":"uint8"},{"internalType":"uint256","name":"rewards","type":"uint256"}],"name":"distribute","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"fee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feeDistributor","outputs":[{"internalType":"contract IFeeDistributor","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"getCreatorByToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"address","name":"_nft","type":"address"}],"name":"getDistribution","outputs":[{"components":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"nft","type":"address"},{"internalType":"uint256","name":"reward","type":"uint256"},{"internalType":"uint256","name":"rewardPerNFT","type":"uint256"},{"internalType":"uint256","name":"claimed","type":"uint256"},{"internalType":"uint64","name":"endsAt","type":"uint64"}],"internalType":"struct NFTRewardsV2.Distribution","name":"distribution","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"hasClaimed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract ITokenRegistry","name":"factory","type":"address"}],"name":"removeFactory","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"callerConfirmation","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract ITokenRegistry","name":"tokenRegistry_","type":"address"}],"name":"setDegenFactory","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_fee","type":"uint256"}],"name":"setFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"tokenRegistry","outputs":[{"internalType":"contract ITokenRegistry","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"nft","type":"address"},{"internalType":"uint256","name":"totalAmount","type":"uint256"},{"internalType":"bool","name":"status","type":"bool"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"},{"internalType":"string","name":"url","type":"string"}],"name":"updateNFTCollection","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"validNFTCollections","outputs":[{"internalType":"address","name":"nft","type":"address"},{"internalType":"uint256","name":"totalAmount","type":"uint256"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"},{"internalType":"bool","name":"isActive","type":"bool"}],"stateMutability":"view","type":"function"}]

60a06040523480156200001157600080fd5b5060405162002ab538038062002ab583398101604081905262000034916200012f565b600180556001600160a01b038116620000605760405163e6c4247b60e01b815260040160405180910390fd5b6200006d60003362000080565b506001600160a01b031660805262000161565b6000828152602081815260408083206001600160a01b038516845290915281205460ff1662000125576000838152602081815260408083206001600160a01b03861684529091529020805460ff19166001179055620000dc3390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a450600162000129565b5060005b92915050565b6000602082840312156200014257600080fd5b81516001600160a01b03811681146200015a57600080fd5b9392505050565b60805161293162000184600039600081816101f3015261172b01526129316000f3fe6080604052600436106101665760003560e01c8063527bd72b116100d1578063a217fddf1161008a578063c93ab01b11610064578063c93ab01b146104f1578063d547741f14610504578063ddca3f4314610524578063ec87621c1461053a57600080fd5b8063a217fddf1461049c578063a5dba71d146104b1578063a9197fd5146104d157600080fd5b8063527bd72b1461036d578063539c47d41461039e57806369fe0e2d1461041c578063813799fc1461043c578063824c1db51461045c57806391d148541461047c57600080fd5b80632dbf52b0116101235780632dbf52b0146102ad5780632f2ff15d146102cd57806336568abe146102ed5780633af1f8af1461030d5780634ab4da9b1461032d5780634b37c73f1461034d57600080fd5b806301ffc9a71461016b57806309a54f6e146101a05780630d43e8ad146101e1578063143045301461022d5780632354383a1461024f578063248a9ca31461027d575b600080fd5b34801561017757600080fd5b5061018b610186366004612049565b61056e565b60405190151581526020015b60405180910390f35b3480156101ac57600080fd5b5061018b6101bb366004612088565b600660209081526000938452604080852082529284528284209052825290205460ff1681565b3480156101ed57600080fd5b506102157f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610197565b34801561023957600080fd5b5061024d6102483660046120c9565b6105a5565b005b34801561025b57600080fd5b5061026f61026a366004612131565b6106d3565b604051908152602001610197565b34801561028957600080fd5b5061026f610298366004612195565b60009081526020819052604090206001015490565b3480156102b957600080fd5b5061024d6102c83660046121ef565b61075b565b3480156102d957600080fd5b5061024d6102e83660046122a4565b610973565b3480156102f957600080fd5b5061024d6103083660046122a4565b61099e565b34801561031957600080fd5b5061024d6103283660046122d4565b6109d6565b34801561033957600080fd5b5061024d610348366004612131565b610a56565b34801561035957600080fd5b5061024d6103683660046120c9565b610a73565b34801561037957600080fd5b5061038d6103883660046120c9565b610bda565b6040516101979594939291906123a6565b3480156103aa57600080fd5b506103be6103b93660046123f4565b610d26565b604051610197919081516001600160a01b0390811682526020808401519091169082015260408083015190820152606080830151908201526080808301519082015260a0918201516001600160401b03169181019190915260c00190565b34801561042857600080fd5b5061024d610437366004612195565b610e25565b34801561044857600080fd5b5061024d610457366004612430565b610e81565b34801561046857600080fd5b5061024d6104773660046123f4565b611098565b34801561048857600080fd5b5061018b6104973660046122a4565b6112ce565b3480156104a857600080fd5b5061026f600081565b3480156104bd57600080fd5b506102156104cc3660046120c9565b6112f7565b3480156104dd57600080fd5b506102156104ec366004612195565b6113bb565b61024d6104ff3660046124fa565b6113e5565b34801561051057600080fd5b5061024d61051f3660046122a4565b61181d565b34801561053057600080fd5b5061026f60035481565b34801561054657600080fd5b5061026f7f241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b0881565b60006001600160e01b03198216637965db0b60e01b148061059f57506301ffc9a760e01b6001600160e01b03198316145b92915050565b6105b06000336112ce565b6105d55760405162461bcd60e51b81526004016105cc9061254f565b60405180910390fd5b6001600160a01b0381166105fc5760405163e6c4247b60e01b815260040160405180910390fd5b60005b60025481101561064c57816001600160a01b03166002828154811061062657610626612575565b6000918252602090912001546001600160a01b031603610644575050565b6001016105ff565b50600280546001810182556000919091527f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace0180546001600160a01b0319166001600160a01b0383169081179091556040519081527f6fdc0147105e43e21da80a75b42d0fd464060d5e1a34b0cefbf0b4ccfc2e36a1906020015b60405180910390a15b50565b600080805b83811015610751576001600160a01b038088166000908152600660209081526040808320938a1683529290529081209086868481811061071a5761071a612575565b602090810292909201358352508101919091526040016000205460ff166107495781610745816125a1565b9250505b6001016106d8565b5095945050505050565b6107857f241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b08336112ce565b8061079657506107966000336112ce565b6107d25760405162461bcd60e51b815260206004820152600d60248201526c2737ba10309036b0b730b3b2b960991b60448201526064016105cc565b6001600160a01b03888116600090815260046020526040902054161561080b5760405163e6c4247b60e01b815260040160405180910390fd5b6040518060a00160405280896001600160a01b0316815260200188815260200187878080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250505090825250604080516020601f88018190048102820181019092528681529181019190879087908190840183828082843760009201829052509385525050600160209384018190526001600160a01b038d8116845260048552604093849020865181546001600160a01b031916921691909117815593850151908401555082015160028201906108ef908261265a565b5060608201516003820190610904908261265a565b50608091909101516004909101805460ff19169115159190911790556040517f43c958f3c19cc42eb622ea37165ee870dbdae3190e89f86bc8fe8594f210fd0590610961908a908a906001908b908b908b908b908b908b90612742565b60405180910390a15050505050505050565b60008281526020819052604090206001015461098e81611842565b610998838361184c565b50505050565b6001600160a01b03811633146109c75760405163334bd91960e11b815260040160405180910390fd5b6109d182826118de565b505050565b6109de611949565b60005b83811015610a4557610a3d868686848181106109ff576109ff612575565b9050602002016020810190610a1491906120c9565b858585818110610a2657610a26612575565b9050602002810190610a3891906127aa565b611973565b6001016109e1565b50610a4f60018055565b5050505050565b610a5e611949565b610a6a84848484611973565b61099860018055565b610a7e6000336112ce565b610a9a5760405162461bcd60e51b81526004016105cc9061254f565b60005b600254811015610bd657816001600160a01b031660028281548110610ac457610ac4612575565b6000918252602090912001546001600160a01b031603610bce5760028054610aee906001906127f3565b81548110610afe57610afe612575565b600091825260209091200154600280546001600160a01b039092169183908110610b2a57610b2a612575565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055506002805480610b6957610b69612806565b6000828152602090819020600019908301810180546001600160a01b03191690559091019091556040516001600160a01b03841681527fafa2737b2090fa39c66b7348625f0c03726240f724defbc6216d679506f94441910160405180910390a15050565b600101610a9d565b5050565b6004602052600090815260409020805460018201546002830180546001600160a01b03909316939192610c0c906125d0565b80601f0160208091040260200160405190810160405280929190818152602001828054610c38906125d0565b8015610c855780601f10610c5a57610100808354040283529160200191610c85565b820191906000526020600020905b815481529060010190602001808311610c6857829003601f168201915b505050505090806003018054610c9a906125d0565b80601f0160208091040260200160405190810160405280929190818152602001828054610cc6906125d0565b8015610d135780601f10610ce857610100808354040283529160200191610d13565b820191906000526020600020905b815481529060010190602001808311610cf657829003601f168201915b5050506004909301549192505060ff1685565b6040805160c081018252600080825260208201819052918101829052606081018290526080810182905260a08101919091526001600160a01b0383161580610d7557506001600160a01b038216155b15610d935760405163e6c4247b60e01b815260040160405180910390fd5b506001600160a01b03808316600090815260056020818152604080842086861685528252808420815160c081018352815487168152600182015490961692860192909252600282015490850152600381015460608501526004810154608085015201546001600160401b031660a08301819052900361059f5760405163c5723b5160e01b815260040160405180910390fd5b610e306000336112ce565b610e4c5760405162461bcd60e51b81526004016105cc9061254f565b60038190556040518181527f8c4d35e54a3f2ef1134138fd8ea3daee6a3c89e10d2665996babdf70261e2c76906020016106c7565b610eab7f241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b08336112ce565b80610ebc5750610ebc6000336112ce565b610ef85760405162461bcd60e51b815260206004820152600d60248201526c2737ba10309036b0b730b3b2b960991b60448201526064016105cc565b6001600160a01b0389811660009081526004602052604090205416610f305760405163e6c4247b60e01b815260040160405180910390fd5b6040518060a001604052808a6001600160a01b0316815260200189815260200187878080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250505090825250604080516020601f88018190048102820181019092528681529181019190879087908190840183828082843760009201829052509385525050508915156020928301526001600160a01b038c8116825260048352604091829020845181546001600160a01b03191692169190911781559183015160018301558201516002820190611014908261265a565b5060608201516003820190611029908261265a565b50608091909101516004909101805460ff19169115159190911790556040517f43c958f3c19cc42eb622ea37165ee870dbdae3190e89f86bc8fe8594f210fd0590611085908b908b908b908b908b908b908b908b908b90612742565b60405180910390a1505050505050505050565b6110a182611d53565b6001600160a01b03808316600090815260056020818152604080842086861685528252808420815160c081018352815487168152600182015490961692860192909252600282015490850152600381015460608501526004810154608085015201546001600160401b031660a0830181905290036111325760405163a3b8915f60e01b815260040160405180910390fd5b8060a001516001600160401b0316421115801561115757508060800151816040015114155b156111865760a08101516040516326bcd7f760e21b81526001600160401b0390911660048201526024016105cc565b6080810151604082015160009061119e9083906127f3565b6001600160a01b038087166000908152600560208181526040808420948a16845293905291812080546001600160a01b0319908116825560018201805490911690556002810182905560038101829055600481019190915501805467ffffffffffffffff1916905590508015611273576112226001600160a01b0386163383611d8d565b604080516001600160a01b0380881682528616602082015233818301526060810183905290517f3a5d0f78e77874f5bf020b03f273e0bdd62cb64ea8fb9061a05c93ae9a893c069181900360800190a15b604080516001600160a01b038681168252336020830152818301849052606082018590529151918716917feb583ac46325753a689b323b3d538fced236bf66c7acc0870861b1cc75e315519181900360800190a25050505050565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b6000805b6002548110156113b25760006002828154811061131a5761131a612575565b60009182526020909120015460405163025bfb4360e01b81526001600160a01b0386811660048301529091169063025bfb4390602401602060405180830381865afa15801561136d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611391919061281c565b90506001600160a01b038116156113a9579392505050565b506001016112fb565b50600092915050565b600281815481106113cb57600080fd5b6000918252602090912001546001600160a01b0316905081565b60035434146114075760405163078d696560e31b815260040160405180910390fd5b6001600160a01b038085166000908152600460209081526040808320815160a0810183528154909516855260018101549285019290925260028201805493949391840191611454906125d0565b80601f0160208091040260200160405190810160405280929190818152602001828054611480906125d0565b80156114cd5780601f106114a2576101008083540402835291602001916114cd565b820191906000526020600020905b8154815290600101906020018083116114b057829003601f168201915b505050505081526020016003820180546114e6906125d0565b80601f0160208091040260200160405190810160405280929190818152602001828054611512906125d0565b801561155f5780601f106115345761010080835404028352916020019161155f565b820191906000526020600020905b81548152906001019060200180831161154257829003601f168201915b50505091835250506004919091015460ff1615156020909101526080810151909150158061158f57506020810151155b156115ad5760405163a3b8915f60e01b815260040160405180910390fd5b6115b684611d53565b6001600160a01b038085166000908152600560208181526040808420948a16845293905291902001546001600160401b0316156116065760405163a3b8915f60e01b815260040160405180910390fd5b600061161184611dec565b61161b9042612839565b9050600082602001518461162f9190612860565b905083158061163c575080155b1561165a5760405163162908e360e11b815260040160405180910390fd5b6040805160c0810182526001600160a01b038089168083528a821660208085018281528587018b8152606087018981526000608089018181526001600160401b03808e1660a08c0190815298835260058088528c8420988452979096528a822099518a54908a166001600160a01b0319918216178b55945160018b018054918b16919096161790945591516002890155516003880155905160048088019190915593519590920180549590911667ffffffffffffffff1990951694909417909355835163e4fc6b6d60e01b815293517f00000000000000000000000000000000000000000000000000000000000000009092169363e4fc6b6d93349382840193919290919082900301818588803b15801561177457600080fd5b505af1158015611788573d6000803e3d6000fd5b50505050506117a96117973390565b6001600160a01b038816903087611e3d565b602083810151604080516001600160a01b038b81168252339482019490945280820188905260608101929092526001600160401b038516608083015251918816917f5cbe59f41b4965145e64b14b08a8ab8de0b1e865947ad2039a94724a6aa8ab959181900360a00190a250505050505050565b60008281526020819052604090206001015461183881611842565b61099883836118de565b6106d08133611e76565b600061185883836112ce565b6118d6576000838152602081815260408083206001600160a01b03861684529091529020805460ff1916600117905561188e3390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a450600161059f565b50600061059f565b60006118ea83836112ce565b156118d6576000838152602081815260408083206001600160a01b0386168085529252808320805460ff1916905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a450600161059f565b60026001540361196c57604051633ee5aeb560e01b815260040160405180910390fd5b6002600155565b6001600160a01b03808516600090815260056020818152604080842085891685528252808420815160c081018352815487168152600182015490961692860192909252600282015490850152600381015460608501526004810154608085015201546001600160401b031660a083018190528692869290919003611a0a5760405163a3b8915f60e01b815260040160405180910390fd5b428160a001516001600160401b03161015611a495760a08101516040516326bcd7f760e21b81526001600160401b0390911660048201526024016105cc565b604080516060810182526001600160a01b03808a16825288166020820152908101859052866000869003611a7e575050611d21565b6000805b87811015611c06576001600160a01b03808c166000908152600660209081526040808320938e168352929052908120908a8a84818110611ac457611ac4612575565b602090810292909201358352508101919091526040016000205460ff16611bfe576000836001600160a01b0316636352211e8b8b85818110611b0857611b08612575565b905060200201356040518263ffffffff1660e01b8152600401611b2d91815260200190565b602060405180830381865afa158015611b4a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b6e919061281c565b90506001600160a01b0381163314611b865750611bfe565b6001600160a01b03808d166000908152600660209081526040808320938f1683529290529081206001918c8c86818110611bc257611bc2612575565b90506020020135815260200190815260200160002060006101000a81548160ff0219169083151502179055508280611bf9906125a1565b935050505b600101611a82565b5080600003611c1757505050611d21565b82516001600160a01b0390811660009081526005602090815260408083208288015190941683529290529081206003015490611c538284612882565b604080870182905286516001600160a01b03908116600090815260056020908152838220818b015190931682529190915290812060040180549293508392909190611c9f908490612899565b90915550508451611cba906001600160a01b03163383611d8d565b60208581018051604080516001600160a01b0392831681528951831694810194909452915116828201528087015160608301525133917fb67a84e7ccc8a4b4c75c56e2d0e301a5bc57444f0572f094e317c5399256e7a7919081900360800190a250505050505b806040015181608001511115611d4a57604051633b4f091f60e21b815260040160405180910390fd5b50505050505050565b6000611d5e826112f7565b9050336001600160a01b03821603611d74575050565b6040516348f5c3ed60e01b815260040160405180910390fd5b6040516001600160a01b038381166024830152604482018390526109d191859182169063a9059cbb906064015b604051602081830303815290604052915060e01b6020820180516001600160e01b038381831617835250505050611eaf565b600080826002811115611e0157611e016128ac565b03611e10575062093a80919050565b6001826002811115611e2457611e246128ac565b03611e33575062278d00919050565b506276a700919050565b6040516001600160a01b0384811660248301528381166044830152606482018390526109989186918216906323b872dd90608401611dba565b611e8082826112ce565b610bd65760405163e2517d3f60e01b81526001600160a01b0382166004820152602481018390526044016105cc565b6000611ec46001600160a01b03841683611f12565b90508051600014158015611ee9575080806020019051810190611ee791906128c2565b155b156109d157604051635274afe760e01b81526001600160a01b03841660048201526024016105cc565b6060611f2083836000611f27565b9392505050565b606081471015611f4c5760405163cd78605960e01b81523060048201526024016105cc565b600080856001600160a01b03168486604051611f6891906128df565b60006040518083038185875af1925050503d8060008114611fa5576040519150601f19603f3d011682016040523d82523d6000602084013e611faa565b606091505b5091509150611fba868383611fc4565b9695505050505050565b606082611fd957611fd482612020565b611f20565b8151158015611ff057506001600160a01b0384163b155b1561201957604051639996b31560e01b81526001600160a01b03851660048201526024016105cc565b5080611f20565b8051156120305780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b60006020828403121561205b57600080fd5b81356001600160e01b031981168114611f2057600080fd5b6001600160a01b03811681146106d057600080fd5b60008060006060848603121561209d57600080fd5b83356120a881612073565b925060208401356120b881612073565b929592945050506040919091013590565b6000602082840312156120db57600080fd5b8135611f2081612073565b60008083601f8401126120f857600080fd5b5081356001600160401b0381111561210f57600080fd5b6020830191508360208260051b850101111561212a57600080fd5b9250929050565b6000806000806060858703121561214757600080fd5b843561215281612073565b9350602085013561216281612073565b925060408501356001600160401b0381111561217d57600080fd5b612189878288016120e6565b95989497509550505050565b6000602082840312156121a757600080fd5b5035919050565b60008083601f8401126121c057600080fd5b5081356001600160401b038111156121d757600080fd5b60208301915083602082850101111561212a57600080fd5b60008060008060008060008060a0898b03121561220b57600080fd5b883561221681612073565b97506020890135965060408901356001600160401b038082111561223957600080fd5b6122458c838d016121ae565b909850965060608b013591508082111561225e57600080fd5b61226a8c838d016121ae565b909650945060808b013591508082111561228357600080fd5b506122908b828c016121ae565b999c989b5096995094979396929594505050565b600080604083850312156122b757600080fd5b8235915060208301356122c981612073565b809150509250929050565b6000806000806000606086880312156122ec57600080fd5b85356122f781612073565b945060208601356001600160401b038082111561231357600080fd5b61231f89838a016120e6565b9096509450604088013591508082111561233857600080fd5b50612345888289016120e6565b969995985093965092949392505050565b60005b83811015612371578181015183820152602001612359565b50506000910152565b60008151808452612392816020860160208601612356565b601f01601f19169290920160200192915050565b60018060a01b038616815284602082015260a0604082015260006123cd60a083018661237a565b82810360608401526123df818661237a565b91505082151560808301529695505050505050565b6000806040838503121561240757600080fd5b823561241281612073565b915060208301356122c981612073565b80151581146106d057600080fd5b600080600080600080600080600060c08a8c03121561244e57600080fd5b893561245981612073565b985060208a0135975060408a013561247081612422565b965060608a01356001600160401b038082111561248c57600080fd5b6124988d838e016121ae565b909850965060808c01359150808211156124b157600080fd5b6124bd8d838e016121ae565b909650945060a08c01359150808211156124d657600080fd5b506124e38c828d016121ae565b915080935050809150509295985092959850929598565b6000806000806080858703121561251057600080fd5b843561251b81612073565b9350602085013561252b81612073565b925060408501356003811061253f57600080fd5b9396929550929360600135925050565b6020808252600c908201526b2737ba1030b71030b236b4b760a11b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600182016125b3576125b361258b565b5060010190565b634e487b7160e01b600052604160045260246000fd5b600181811c908216806125e457607f821691505b60208210810361260457634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156109d1576000816000526020600020601f850160051c810160208610156126335750805b601f850160051c820191505b818110156126525782815560010161263f565b505050505050565b81516001600160401b03811115612673576126736125ba565b6126878161268184546125d0565b8461260a565b602080601f8311600181146126bc57600084156126a45750858301515b600019600386901b1c1916600185901b178555612652565b600085815260208120601f198616915b828110156126eb578886015182559484019460019091019084016126cc565b50858210156127095787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b60018060a01b038a168152886020820152871515604082015260c06060820152600061277260c08301888a612719565b8281036080840152612785818789612719565b905082810360a084015261279a818587612719565b9c9b505050505050505050505050565b6000808335601e198436030181126127c157600080fd5b8301803591506001600160401b038211156127db57600080fd5b6020019150600581901b360382131561212a57600080fd5b8181038181111561059f5761059f61258b565b634e487b7160e01b600052603160045260246000fd5b60006020828403121561282e57600080fd5b8151611f2081612073565b6001600160401b038181168382160190808211156128595761285961258b565b5092915050565b60008261287d57634e487b7160e01b600052601260045260246000fd5b500490565b808202811582820484141761059f5761059f61258b565b8082018082111561059f5761059f61258b565b634e487b7160e01b600052602160045260246000fd5b6000602082840312156128d457600080fd5b8151611f2081612422565b600082516128f1818460208701612356565b919091019291505056fea2646970667358221220e7a561217216b8e4ad21ac7f8d4c9d158cba111afc0c75ef879f5fde7999cdd264736f6c634300081700330000000000000000000000000935ce5bd9e1da2305e32800ec550fa9355b9ac0

Deployed Bytecode

0x6080604052600436106101665760003560e01c8063527bd72b116100d1578063a217fddf1161008a578063c93ab01b11610064578063c93ab01b146104f1578063d547741f14610504578063ddca3f4314610524578063ec87621c1461053a57600080fd5b8063a217fddf1461049c578063a5dba71d146104b1578063a9197fd5146104d157600080fd5b8063527bd72b1461036d578063539c47d41461039e57806369fe0e2d1461041c578063813799fc1461043c578063824c1db51461045c57806391d148541461047c57600080fd5b80632dbf52b0116101235780632dbf52b0146102ad5780632f2ff15d146102cd57806336568abe146102ed5780633af1f8af1461030d5780634ab4da9b1461032d5780634b37c73f1461034d57600080fd5b806301ffc9a71461016b57806309a54f6e146101a05780630d43e8ad146101e1578063143045301461022d5780632354383a1461024f578063248a9ca31461027d575b600080fd5b34801561017757600080fd5b5061018b610186366004612049565b61056e565b60405190151581526020015b60405180910390f35b3480156101ac57600080fd5b5061018b6101bb366004612088565b600660209081526000938452604080852082529284528284209052825290205460ff1681565b3480156101ed57600080fd5b506102157f0000000000000000000000000935ce5bd9e1da2305e32800ec550fa9355b9ac081565b6040516001600160a01b039091168152602001610197565b34801561023957600080fd5b5061024d6102483660046120c9565b6105a5565b005b34801561025b57600080fd5b5061026f61026a366004612131565b6106d3565b604051908152602001610197565b34801561028957600080fd5b5061026f610298366004612195565b60009081526020819052604090206001015490565b3480156102b957600080fd5b5061024d6102c83660046121ef565b61075b565b3480156102d957600080fd5b5061024d6102e83660046122a4565b610973565b3480156102f957600080fd5b5061024d6103083660046122a4565b61099e565b34801561031957600080fd5b5061024d6103283660046122d4565b6109d6565b34801561033957600080fd5b5061024d610348366004612131565b610a56565b34801561035957600080fd5b5061024d6103683660046120c9565b610a73565b34801561037957600080fd5b5061038d6103883660046120c9565b610bda565b6040516101979594939291906123a6565b3480156103aa57600080fd5b506103be6103b93660046123f4565b610d26565b604051610197919081516001600160a01b0390811682526020808401519091169082015260408083015190820152606080830151908201526080808301519082015260a0918201516001600160401b03169181019190915260c00190565b34801561042857600080fd5b5061024d610437366004612195565b610e25565b34801561044857600080fd5b5061024d610457366004612430565b610e81565b34801561046857600080fd5b5061024d6104773660046123f4565b611098565b34801561048857600080fd5b5061018b6104973660046122a4565b6112ce565b3480156104a857600080fd5b5061026f600081565b3480156104bd57600080fd5b506102156104cc3660046120c9565b6112f7565b3480156104dd57600080fd5b506102156104ec366004612195565b6113bb565b61024d6104ff3660046124fa565b6113e5565b34801561051057600080fd5b5061024d61051f3660046122a4565b61181d565b34801561053057600080fd5b5061026f60035481565b34801561054657600080fd5b5061026f7f241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b0881565b60006001600160e01b03198216637965db0b60e01b148061059f57506301ffc9a760e01b6001600160e01b03198316145b92915050565b6105b06000336112ce565b6105d55760405162461bcd60e51b81526004016105cc9061254f565b60405180910390fd5b6001600160a01b0381166105fc5760405163e6c4247b60e01b815260040160405180910390fd5b60005b60025481101561064c57816001600160a01b03166002828154811061062657610626612575565b6000918252602090912001546001600160a01b031603610644575050565b6001016105ff565b50600280546001810182556000919091527f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace0180546001600160a01b0319166001600160a01b0383169081179091556040519081527f6fdc0147105e43e21da80a75b42d0fd464060d5e1a34b0cefbf0b4ccfc2e36a1906020015b60405180910390a15b50565b600080805b83811015610751576001600160a01b038088166000908152600660209081526040808320938a1683529290529081209086868481811061071a5761071a612575565b602090810292909201358352508101919091526040016000205460ff166107495781610745816125a1565b9250505b6001016106d8565b5095945050505050565b6107857f241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b08336112ce565b8061079657506107966000336112ce565b6107d25760405162461bcd60e51b815260206004820152600d60248201526c2737ba10309036b0b730b3b2b960991b60448201526064016105cc565b6001600160a01b03888116600090815260046020526040902054161561080b5760405163e6c4247b60e01b815260040160405180910390fd5b6040518060a00160405280896001600160a01b0316815260200188815260200187878080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250505090825250604080516020601f88018190048102820181019092528681529181019190879087908190840183828082843760009201829052509385525050600160209384018190526001600160a01b038d8116845260048552604093849020865181546001600160a01b031916921691909117815593850151908401555082015160028201906108ef908261265a565b5060608201516003820190610904908261265a565b50608091909101516004909101805460ff19169115159190911790556040517f43c958f3c19cc42eb622ea37165ee870dbdae3190e89f86bc8fe8594f210fd0590610961908a908a906001908b908b908b908b908b908b90612742565b60405180910390a15050505050505050565b60008281526020819052604090206001015461098e81611842565b610998838361184c565b50505050565b6001600160a01b03811633146109c75760405163334bd91960e11b815260040160405180910390fd5b6109d182826118de565b505050565b6109de611949565b60005b83811015610a4557610a3d868686848181106109ff576109ff612575565b9050602002016020810190610a1491906120c9565b858585818110610a2657610a26612575565b9050602002810190610a3891906127aa565b611973565b6001016109e1565b50610a4f60018055565b5050505050565b610a5e611949565b610a6a84848484611973565b61099860018055565b610a7e6000336112ce565b610a9a5760405162461bcd60e51b81526004016105cc9061254f565b60005b600254811015610bd657816001600160a01b031660028281548110610ac457610ac4612575565b6000918252602090912001546001600160a01b031603610bce5760028054610aee906001906127f3565b81548110610afe57610afe612575565b600091825260209091200154600280546001600160a01b039092169183908110610b2a57610b2a612575565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055506002805480610b6957610b69612806565b6000828152602090819020600019908301810180546001600160a01b03191690559091019091556040516001600160a01b03841681527fafa2737b2090fa39c66b7348625f0c03726240f724defbc6216d679506f94441910160405180910390a15050565b600101610a9d565b5050565b6004602052600090815260409020805460018201546002830180546001600160a01b03909316939192610c0c906125d0565b80601f0160208091040260200160405190810160405280929190818152602001828054610c38906125d0565b8015610c855780601f10610c5a57610100808354040283529160200191610c85565b820191906000526020600020905b815481529060010190602001808311610c6857829003601f168201915b505050505090806003018054610c9a906125d0565b80601f0160208091040260200160405190810160405280929190818152602001828054610cc6906125d0565b8015610d135780601f10610ce857610100808354040283529160200191610d13565b820191906000526020600020905b815481529060010190602001808311610cf657829003601f168201915b5050506004909301549192505060ff1685565b6040805160c081018252600080825260208201819052918101829052606081018290526080810182905260a08101919091526001600160a01b0383161580610d7557506001600160a01b038216155b15610d935760405163e6c4247b60e01b815260040160405180910390fd5b506001600160a01b03808316600090815260056020818152604080842086861685528252808420815160c081018352815487168152600182015490961692860192909252600282015490850152600381015460608501526004810154608085015201546001600160401b031660a08301819052900361059f5760405163c5723b5160e01b815260040160405180910390fd5b610e306000336112ce565b610e4c5760405162461bcd60e51b81526004016105cc9061254f565b60038190556040518181527f8c4d35e54a3f2ef1134138fd8ea3daee6a3c89e10d2665996babdf70261e2c76906020016106c7565b610eab7f241ecf16d79d0f8dbfb92cbc07fe17840425976cf0667f022fe9877caa831b08336112ce565b80610ebc5750610ebc6000336112ce565b610ef85760405162461bcd60e51b815260206004820152600d60248201526c2737ba10309036b0b730b3b2b960991b60448201526064016105cc565b6001600160a01b0389811660009081526004602052604090205416610f305760405163e6c4247b60e01b815260040160405180910390fd5b6040518060a001604052808a6001600160a01b0316815260200189815260200187878080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250505090825250604080516020601f88018190048102820181019092528681529181019190879087908190840183828082843760009201829052509385525050508915156020928301526001600160a01b038c8116825260048352604091829020845181546001600160a01b03191692169190911781559183015160018301558201516002820190611014908261265a565b5060608201516003820190611029908261265a565b50608091909101516004909101805460ff19169115159190911790556040517f43c958f3c19cc42eb622ea37165ee870dbdae3190e89f86bc8fe8594f210fd0590611085908b908b908b908b908b908b908b908b908b90612742565b60405180910390a1505050505050505050565b6110a182611d53565b6001600160a01b03808316600090815260056020818152604080842086861685528252808420815160c081018352815487168152600182015490961692860192909252600282015490850152600381015460608501526004810154608085015201546001600160401b031660a0830181905290036111325760405163a3b8915f60e01b815260040160405180910390fd5b8060a001516001600160401b0316421115801561115757508060800151816040015114155b156111865760a08101516040516326bcd7f760e21b81526001600160401b0390911660048201526024016105cc565b6080810151604082015160009061119e9083906127f3565b6001600160a01b038087166000908152600560208181526040808420948a16845293905291812080546001600160a01b0319908116825560018201805490911690556002810182905560038101829055600481019190915501805467ffffffffffffffff1916905590508015611273576112226001600160a01b0386163383611d8d565b604080516001600160a01b0380881682528616602082015233818301526060810183905290517f3a5d0f78e77874f5bf020b03f273e0bdd62cb64ea8fb9061a05c93ae9a893c069181900360800190a15b604080516001600160a01b038681168252336020830152818301849052606082018590529151918716917feb583ac46325753a689b323b3d538fced236bf66c7acc0870861b1cc75e315519181900360800190a25050505050565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b6000805b6002548110156113b25760006002828154811061131a5761131a612575565b60009182526020909120015460405163025bfb4360e01b81526001600160a01b0386811660048301529091169063025bfb4390602401602060405180830381865afa15801561136d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611391919061281c565b90506001600160a01b038116156113a9579392505050565b506001016112fb565b50600092915050565b600281815481106113cb57600080fd5b6000918252602090912001546001600160a01b0316905081565b60035434146114075760405163078d696560e31b815260040160405180910390fd5b6001600160a01b038085166000908152600460209081526040808320815160a0810183528154909516855260018101549285019290925260028201805493949391840191611454906125d0565b80601f0160208091040260200160405190810160405280929190818152602001828054611480906125d0565b80156114cd5780601f106114a2576101008083540402835291602001916114cd565b820191906000526020600020905b8154815290600101906020018083116114b057829003601f168201915b505050505081526020016003820180546114e6906125d0565b80601f0160208091040260200160405190810160405280929190818152602001828054611512906125d0565b801561155f5780601f106115345761010080835404028352916020019161155f565b820191906000526020600020905b81548152906001019060200180831161154257829003601f168201915b50505091835250506004919091015460ff1615156020909101526080810151909150158061158f57506020810151155b156115ad5760405163a3b8915f60e01b815260040160405180910390fd5b6115b684611d53565b6001600160a01b038085166000908152600560208181526040808420948a16845293905291902001546001600160401b0316156116065760405163a3b8915f60e01b815260040160405180910390fd5b600061161184611dec565b61161b9042612839565b9050600082602001518461162f9190612860565b905083158061163c575080155b1561165a5760405163162908e360e11b815260040160405180910390fd5b6040805160c0810182526001600160a01b038089168083528a821660208085018281528587018b8152606087018981526000608089018181526001600160401b03808e1660a08c0190815298835260058088528c8420988452979096528a822099518a54908a166001600160a01b0319918216178b55945160018b018054918b16919096161790945591516002890155516003880155905160048088019190915593519590920180549590911667ffffffffffffffff1990951694909417909355835163e4fc6b6d60e01b815293517f0000000000000000000000000935ce5bd9e1da2305e32800ec550fa9355b9ac09092169363e4fc6b6d93349382840193919290919082900301818588803b15801561177457600080fd5b505af1158015611788573d6000803e3d6000fd5b50505050506117a96117973390565b6001600160a01b038816903087611e3d565b602083810151604080516001600160a01b038b81168252339482019490945280820188905260608101929092526001600160401b038516608083015251918816917f5cbe59f41b4965145e64b14b08a8ab8de0b1e865947ad2039a94724a6aa8ab959181900360a00190a250505050505050565b60008281526020819052604090206001015461183881611842565b61099883836118de565b6106d08133611e76565b600061185883836112ce565b6118d6576000838152602081815260408083206001600160a01b03861684529091529020805460ff1916600117905561188e3390565b6001600160a01b0316826001600160a01b0316847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a450600161059f565b50600061059f565b60006118ea83836112ce565b156118d6576000838152602081815260408083206001600160a01b0386168085529252808320805460ff1916905551339286917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a450600161059f565b60026001540361196c57604051633ee5aeb560e01b815260040160405180910390fd5b6002600155565b6001600160a01b03808516600090815260056020818152604080842085891685528252808420815160c081018352815487168152600182015490961692860192909252600282015490850152600381015460608501526004810154608085015201546001600160401b031660a083018190528692869290919003611a0a5760405163a3b8915f60e01b815260040160405180910390fd5b428160a001516001600160401b03161015611a495760a08101516040516326bcd7f760e21b81526001600160401b0390911660048201526024016105cc565b604080516060810182526001600160a01b03808a16825288166020820152908101859052866000869003611a7e575050611d21565b6000805b87811015611c06576001600160a01b03808c166000908152600660209081526040808320938e168352929052908120908a8a84818110611ac457611ac4612575565b602090810292909201358352508101919091526040016000205460ff16611bfe576000836001600160a01b0316636352211e8b8b85818110611b0857611b08612575565b905060200201356040518263ffffffff1660e01b8152600401611b2d91815260200190565b602060405180830381865afa158015611b4a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b6e919061281c565b90506001600160a01b0381163314611b865750611bfe565b6001600160a01b03808d166000908152600660209081526040808320938f1683529290529081206001918c8c86818110611bc257611bc2612575565b90506020020135815260200190815260200160002060006101000a81548160ff0219169083151502179055508280611bf9906125a1565b935050505b600101611a82565b5080600003611c1757505050611d21565b82516001600160a01b0390811660009081526005602090815260408083208288015190941683529290529081206003015490611c538284612882565b604080870182905286516001600160a01b03908116600090815260056020908152838220818b015190931682529190915290812060040180549293508392909190611c9f908490612899565b90915550508451611cba906001600160a01b03163383611d8d565b60208581018051604080516001600160a01b0392831681528951831694810194909452915116828201528087015160608301525133917fb67a84e7ccc8a4b4c75c56e2d0e301a5bc57444f0572f094e317c5399256e7a7919081900360800190a250505050505b806040015181608001511115611d4a57604051633b4f091f60e21b815260040160405180910390fd5b50505050505050565b6000611d5e826112f7565b9050336001600160a01b03821603611d74575050565b6040516348f5c3ed60e01b815260040160405180910390fd5b6040516001600160a01b038381166024830152604482018390526109d191859182169063a9059cbb906064015b604051602081830303815290604052915060e01b6020820180516001600160e01b038381831617835250505050611eaf565b600080826002811115611e0157611e016128ac565b03611e10575062093a80919050565b6001826002811115611e2457611e246128ac565b03611e33575062278d00919050565b506276a700919050565b6040516001600160a01b0384811660248301528381166044830152606482018390526109989186918216906323b872dd90608401611dba565b611e8082826112ce565b610bd65760405163e2517d3f60e01b81526001600160a01b0382166004820152602481018390526044016105cc565b6000611ec46001600160a01b03841683611f12565b90508051600014158015611ee9575080806020019051810190611ee791906128c2565b155b156109d157604051635274afe760e01b81526001600160a01b03841660048201526024016105cc565b6060611f2083836000611f27565b9392505050565b606081471015611f4c5760405163cd78605960e01b81523060048201526024016105cc565b600080856001600160a01b03168486604051611f6891906128df565b60006040518083038185875af1925050503d8060008114611fa5576040519150601f19603f3d011682016040523d82523d6000602084013e611faa565b606091505b5091509150611fba868383611fc4565b9695505050505050565b606082611fd957611fd482612020565b611f20565b8151158015611ff057506001600160a01b0384163b155b1561201957604051639996b31560e01b81526001600160a01b03851660048201526024016105cc565b5080611f20565b8051156120305780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b60006020828403121561205b57600080fd5b81356001600160e01b031981168114611f2057600080fd5b6001600160a01b03811681146106d057600080fd5b60008060006060848603121561209d57600080fd5b83356120a881612073565b925060208401356120b881612073565b929592945050506040919091013590565b6000602082840312156120db57600080fd5b8135611f2081612073565b60008083601f8401126120f857600080fd5b5081356001600160401b0381111561210f57600080fd5b6020830191508360208260051b850101111561212a57600080fd5b9250929050565b6000806000806060858703121561214757600080fd5b843561215281612073565b9350602085013561216281612073565b925060408501356001600160401b0381111561217d57600080fd5b612189878288016120e6565b95989497509550505050565b6000602082840312156121a757600080fd5b5035919050565b60008083601f8401126121c057600080fd5b5081356001600160401b038111156121d757600080fd5b60208301915083602082850101111561212a57600080fd5b60008060008060008060008060a0898b03121561220b57600080fd5b883561221681612073565b97506020890135965060408901356001600160401b038082111561223957600080fd5b6122458c838d016121ae565b909850965060608b013591508082111561225e57600080fd5b61226a8c838d016121ae565b909650945060808b013591508082111561228357600080fd5b506122908b828c016121ae565b999c989b5096995094979396929594505050565b600080604083850312156122b757600080fd5b8235915060208301356122c981612073565b809150509250929050565b6000806000806000606086880312156122ec57600080fd5b85356122f781612073565b945060208601356001600160401b038082111561231357600080fd5b61231f89838a016120e6565b9096509450604088013591508082111561233857600080fd5b50612345888289016120e6565b969995985093965092949392505050565b60005b83811015612371578181015183820152602001612359565b50506000910152565b60008151808452612392816020860160208601612356565b601f01601f19169290920160200192915050565b60018060a01b038616815284602082015260a0604082015260006123cd60a083018661237a565b82810360608401526123df818661237a565b91505082151560808301529695505050505050565b6000806040838503121561240757600080fd5b823561241281612073565b915060208301356122c981612073565b80151581146106d057600080fd5b600080600080600080600080600060c08a8c03121561244e57600080fd5b893561245981612073565b985060208a0135975060408a013561247081612422565b965060608a01356001600160401b038082111561248c57600080fd5b6124988d838e016121ae565b909850965060808c01359150808211156124b157600080fd5b6124bd8d838e016121ae565b909650945060a08c01359150808211156124d657600080fd5b506124e38c828d016121ae565b915080935050809150509295985092959850929598565b6000806000806080858703121561251057600080fd5b843561251b81612073565b9350602085013561252b81612073565b925060408501356003811061253f57600080fd5b9396929550929360600135925050565b6020808252600c908201526b2737ba1030b71030b236b4b760a11b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600182016125b3576125b361258b565b5060010190565b634e487b7160e01b600052604160045260246000fd5b600181811c908216806125e457607f821691505b60208210810361260457634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156109d1576000816000526020600020601f850160051c810160208610156126335750805b601f850160051c820191505b818110156126525782815560010161263f565b505050505050565b81516001600160401b03811115612673576126736125ba565b6126878161268184546125d0565b8461260a565b602080601f8311600181146126bc57600084156126a45750858301515b600019600386901b1c1916600185901b178555612652565b600085815260208120601f198616915b828110156126eb578886015182559484019460019091019084016126cc565b50858210156127095787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b60018060a01b038a168152886020820152871515604082015260c06060820152600061277260c08301888a612719565b8281036080840152612785818789612719565b905082810360a084015261279a818587612719565b9c9b505050505050505050505050565b6000808335601e198436030181126127c157600080fd5b8301803591506001600160401b038211156127db57600080fd5b6020019150600581901b360382131561212a57600080fd5b8181038181111561059f5761059f61258b565b634e487b7160e01b600052603160045260246000fd5b60006020828403121561282e57600080fd5b8151611f2081612073565b6001600160401b038181168382160190808211156128595761285961258b565b5092915050565b60008261287d57634e487b7160e01b600052601260045260246000fd5b500490565b808202811582820484141761059f5761059f61258b565b8082018082111561059f5761059f61258b565b634e487b7160e01b600052602160045260246000fd5b6000602082840312156128d457600080fd5b8151611f2081612422565b600082516128f1818460208701612356565b919091019291505056fea2646970667358221220e7a561217216b8e4ad21ac7f8d4c9d158cba111afc0c75ef879f5fde7999cdd264736f6c63430008170033

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

0000000000000000000000000935ce5bd9e1da2305e32800ec550fa9355b9ac0

-----Decoded View---------------
Arg [0] : _feeDistributor (address): 0x0935Ce5bD9E1dA2305E32800Ec550fA9355b9AC0

-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 0000000000000000000000000935ce5bd9e1da2305e32800ec550fa9355b9ac0


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
[ 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.