ETH Price: $3,350.91 (-8.66%)

Contract

0x5F3eD79A3EF34e1c4d6D02b0A8C297D8d79115eb
 
Transaction Hash
Method
Block
From
To
Forward Funds209748052024-10-16 1:21:2365 days ago1729041683IN
0x5F3eD79A...8d79115eb
0 ETH0.0008852111.78134443
Forward Funds Et...209631822024-10-14 10:22:3566 days ago1728901355IN
0x5F3eD79A...8d79115eb
0 ETH0.0004639312.7502893
Forward Funds Et...209183182024-10-08 3:58:2373 days ago1728359903IN
0x5F3eD79A...8d79115eb
0 ETH0.000347139.54037679
Forward Funds Et...208044042024-09-22 6:44:2388 days ago1726987463IN
0x5F3eD79A...8d79115eb
0 ETH0.000314018.63013861
Forward Funds Et...207510132024-09-14 19:44:1196 days ago1726343051IN
0x5F3eD79A...8d79115eb
0 ETH0.000137733.78532031
Forward Funds Et...207481452024-09-14 10:06:5996 days ago1726308419IN
0x5F3eD79A...8d79115eb
0 ETH0.00005761.58307609
Forward Funds Et...206639762024-09-02 16:08:11108 days ago1725293291IN
0x5F3eD79A...8d79115eb
0 ETH0.0004520812.42471483
Forward Funds Et...206277542024-08-28 14:42:23113 days ago1724856143IN
0x5F3eD79A...8d79115eb
0 ETH0.000142143.90670964
Forward Funds Et...205780072024-08-21 15:51:35120 days ago1724255495IN
0x5F3eD79A...8d79115eb
0 ETH0.000196255.39382307
Buy Tokens Eth205636092024-08-19 15:36:11122 days ago1724081771IN
0x5F3eD79A...8d79115eb
0.2 ETH0.000456953.76393158
Buy Tokens Eth205190232024-08-13 10:11:47128 days ago1723543907IN
0x5F3eD79A...8d79115eb
0.07 ETH0.000194572.23122892
Buy Tokens Eth205181692024-08-13 7:19:35128 days ago1723533575IN
0x5F3eD79A...8d79115eb
0.1 ETH0.000177671.4635023
Forward Funds Et...205122462024-08-12 11:30:35129 days ago1723462235IN
0x5F3eD79A...8d79115eb
0 ETH0.000309568.50790974
Buy Tokens Eth204113162024-07-29 9:27:11143 days ago1722245231IN
0x5F3eD79A...8d79115eb
0.033 ETH0.000379043.12215109
Buy Tokens Eth204109172024-07-29 8:06:59143 days ago1722240419IN
0x5F3eD79A...8d79115eb
0.01738 ETH0.000333862.75
Buy Tokens Eth203915932024-07-26 15:23:11146 days ago1722007391IN
0x5F3eD79A...8d79115eb
0.02 ETH0.000746936.15250758
Forward Funds Et...203782612024-07-24 18:42:23148 days ago1721846543IN
0x5F3eD79A...8d79115eb
0 ETH0.000222956.12737732
Buy Tokens Eth203712422024-07-23 19:11:59149 days ago1721761919IN
0x5F3eD79A...8d79115eb
0.0175 ETH0.000481865.52571476
Buy Tokens Eth203170012024-07-16 5:32:35157 days ago1721107955IN
0x5F3eD79A...8d79115eb
0.025 ETH0.000384844.41315166
Buy Tokens Eth203169972024-07-16 5:31:47157 days ago1721107907IN
0x5F3eD79A...8d79115eb
0.02 ETH0.000361394.14422369
Buy Tokens Eth202880802024-07-12 4:36:11161 days ago1720758971IN
0x5F3eD79A...8d79115eb
0.09 ETH0.000239411.97207622
Buy Tokens Eth202825112024-07-11 9:57:11161 days ago1720691831IN
0x5F3eD79A...8d79115eb
0.05 ETH0.000774358.8798097
Buy Tokens Eth202823222024-07-11 9:19:23161 days ago1720689563IN
0x5F3eD79A...8d79115eb
0.035 ETH0.0014407816.52201136
Buy Tokens Eth202815142024-07-11 6:37:11161 days ago1720679831IN
0x5F3eD79A...8d79115eb
0.03 ETH0.000322112.65322133
Forward Funds Et...202759692024-07-10 12:02:11162 days ago1720612931IN
0x5F3eD79A...8d79115eb
0 ETH0.000210435.78334152
View all transactions

Latest 24 internal transactions

Advanced mode:
Parent Transaction Hash Block
From
To
209631822024-10-14 10:22:3566 days ago1728901355
0x5F3eD79A...8d79115eb
1.3 ETH
209183182024-10-08 3:58:2373 days ago1728359903
0x5F3eD79A...8d79115eb
1.1 ETH
208044042024-09-22 6:44:2388 days ago1726987463
0x5F3eD79A...8d79115eb
1.1 ETH
207510132024-09-14 19:44:1196 days ago1726343051
0x5F3eD79A...8d79115eb
1 ETH
207481452024-09-14 10:06:5996 days ago1726308419
0x5F3eD79A...8d79115eb
4.66 ETH
206639762024-09-02 16:08:11108 days ago1725293291
0x5F3eD79A...8d79115eb
3.1 ETH
206277542024-08-28 14:42:23113 days ago1724856143
0x5F3eD79A...8d79115eb
2 ETH
205780072024-08-21 15:51:35120 days ago1724255495
0x5F3eD79A...8d79115eb
4 ETH
205122462024-08-12 11:30:35129 days ago1723462235
0x5F3eD79A...8d79115eb
4.5 ETH
203782612024-07-24 18:42:23148 days ago1721846543
0x5F3eD79A...8d79115eb
1 ETH
202759692024-07-10 12:02:11162 days ago1720612931
0x5F3eD79A...8d79115eb
5 ETH
201905312024-06-28 13:37:47174 days ago1719581867
0x5F3eD79A...8d79115eb
1.35 ETH
201165802024-06-18 5:31:23185 days ago1718688683
0x5F3eD79A...8d79115eb
3 ETH
200673132024-06-11 8:11:59191 days ago1718093519
0x5F3eD79A...8d79115eb
4 ETH
200477412024-06-08 14:35:11194 days ago1717857311
0x5F3eD79A...8d79115eb
4 ETH
198690552024-05-14 15:13:47219 days ago1715699627
0x5F3eD79A...8d79115eb
6 ETH
198458572024-05-11 9:20:23222 days ago1715419223
0x5F3eD79A...8d79115eb
8 ETH
198171812024-05-07 9:05:47226 days ago1715072747
0x5F3eD79A...8d79115eb
10 ETH
197258802024-04-24 14:38:59239 days ago1713969539
0x5F3eD79A...8d79115eb
10 ETH
196461542024-04-13 10:48:23250 days ago1713005303
0x5F3eD79A...8d79115eb
13 ETH
196107792024-04-08 11:53:35255 days ago1712577215
0x5F3eD79A...8d79115eb
32 ETH
195906172024-04-05 16:06:11258 days ago1712333171
0x5F3eD79A...8d79115eb
25 ETH
195540442024-03-31 13:02:35263 days ago1711890155
0x5F3eD79A...8d79115eb
0.95123001 ETH
195402322024-03-29 14:24:23265 days ago1711722263
0x5F3eD79A...8d79115eb
2 ETH
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Presale

Compiler Version
v0.8.24+commit.e11b9ed9

Optimization Enabled:
Yes with 200 runs

Other Settings:
paris EvmVersion
File 1 of 11 : Presale.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

/// @author Presale Contract for NFTFN tokens not a general purpose contract
import { IERC20Metadata } from
  "../../lib/openzeppelin-contracts/contracts/interfaces/IERC20Metadata.sol";
import { SafeERC20 } from
  "../../lib/openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol";
import { Ownable } from "../../lib/openzeppelin-contracts/contracts/access/Ownable.sol";
import { PresaleData } from "./PresaleLib.sol";
import { AggregatorV3Interface } from "../Interfaces/AggregatorV3.sol";

/// @notice Simple Presale Contract Implementation
/// @author NFTFN (https://github.com/BLIV-CLUB/NFTFN-token/blob/feat/incorporate_changes/src/Presale/Presale.sol)
/// @dev Note:
/// Presale Invariants:
///  - Stages have fixed token allocation and USD Rates
///  - Refund Begins if a stage stagnates for 30 days
///  - Token Vesting is for 270 days with 10% unlock on the day the presale is concluded.
contract Presale is PresaleData, Ownable {
  using SafeERC20 for IERC20Metadata;

  //////////////////// ERRORS ///////////////////////////

  /// 0x399a417a
  error PresaleAlreadyActivated();

  error InvalidBalance();

  error PresaleNotActive();

  error InvalidParams();

  error MaxDepositLimitReached();

  error PresaleStillActive();

  error InsufficientTokenBalance();

  error NoTokenToClaim();

  error InvalidAccess();

  error SoftLimitHit();

  error RefundNotActive();

  error PresaleSoftLimitNotReached();

  error PresaleTimeLimitNotReached();

  error InvalidToken();

  error PresaleStageNotActive();

  error PresaleStageStillActive();

  error LowLevelCallFailed();

  error InvalidPriceFeedValue();
  ////////////////// PUBLIC VARIABLES //////////////////

  /// Treasury wallet where funds will be transferred
  address payable public treasuryWallet;

  /// NFTFN token address
  IERC20Metadata public nftfnToken;

  /// Aggregator V3 Interface
  AggregatorV3Interface public ethDataFeed;

  /// Current Stage of the presale
  uint256 public currentStage = 1;

  /// The timestamp since which vesting is calcualted and started
  uint256 public vestingStartTimestamp;

  /// The total sum of usd raised in USD
  uint256 public totalUsdRaised = 0;

  /// Flag indicating whether the sale has finished or not
  bool public presaleEnded = false;

  /// The total vesting period
  uint256 public constant vestingTimePeriod = 270 days; // 9 Months Vesting Period

  /// the total tokens allocated for the presale
  uint256 public totalTokensAllocated;

  /// $1M USDT
  uint256 public immutable maxDepositLimit = 1_000_000 * usdtMultiplier;

  /// Per Transaction Limits for USDT
  uint256 public immutable minTransactionLimit = 50 * usdtMultiplier;
  /// $50 USDT

  /// The soft limit in usd on the presale
  uint256 public immutable usdSoftLimit = 1_000_000 * usdtMultiplier;
  /// $ 2M Soft Limit

  uint256 public constant stalePriceDelay = 60 * 60; // 3600 seconds 

  /// A mapping for user and their deposit data
  mapping(address => UserData) public userDeposits;

  /// Presale Params Data
  mapping(uint256 => PresaleParams) public presaleParamsData;

  /// Accepted Tokens
  mapping(address => bool) public acceptedTokens;

  /// @notice Constructor to init the contract.
  /// @param _treasuryWallet the wallet where all funds are routed to
  /// @param _nftfnToken NFTFN token address
  /// @param usdRates USD Rate for the Presale 1 stage
  /// @param tokenAllocation 1st Stage Token Allocation
  /// @param ethPriceFeed  ETH Price Feed Address
  /// @param tokens List of USD Pegged tokens that can be used to buy in tokens
  constructor(
    address payable _treasuryWallet,
    address _nftfnToken,
    uint256 usdRates,
    uint256 tokenAllocation,
    address ethPriceFeed,
    address[] memory tokens
  ) Ownable(msg.sender) {
    treasuryWallet = _treasuryWallet;
    nftfnToken = IERC20Metadata(_nftfnToken);
    ethDataFeed = AggregatorV3Interface(ethPriceFeed);
    presaleParamsData[currentStage] = PresaleParams({
      startTime: uint256(0),
      endTime: uint256(0),
      usdRaised: uint256(0),
      tokensAllocated: tokenAllocation,
      tokensBought: uint256(0),
      usdRate: usdRates,
      isActive: false
    });
    totalTokensAllocated += tokenAllocation;
    uint256 i = 0;
    for (i; i < tokens.length; ++i) {
      acceptedTokens[tokens[i]] = true;
    }
  }

  /// @notice Function to initiate Presale can only be called once only for the first stage
  function initPresale() public onlyOwner {
    if (presaleParamsData[currentStage].isActive) {
      revert PresaleAlreadyActivated();
    }

    if (nftfnToken.balanceOf(address(this)) != totalTokensAllocated) {
      revert InsufficientTokenBalance();
    }

    presaleParamsData[currentStage].startTime = block.timestamp;
    presaleParamsData[currentStage].isActive = true;

    emit PresaleActivated(block.timestamp, currentStage);
  }

  /// @notice Function to Add Params for the Next Token Sale Stage
  /// @param tokenAllocation The amount of tokens to be sold in the next stage
  /// @param usdRate The usd rate for the tokens being sold in the next stage
  function initNextPresaleStage(uint256 tokenAllocation, uint256 usdRate) public onlyOwner {
    if (presaleEnded) revert PresaleNotActive();

    if (tokenAllocation == uint256(0) || usdRate == uint256(0)) {
      revert InvalidParams();
    }

    if (presaleParamsData[currentStage].isActive) {
      revert PresaleStageStillActive();
    }

    totalTokensAllocated += tokenAllocation;

    if ((nftfnToken.balanceOf(address(this)) < totalTokensAllocated)) {
      revert InvalidBalance();
    }

    ++currentStage;
    presaleParamsData[currentStage] = PresaleParams({
      startTime: block.timestamp,
      endTime: uint256(0),
      usdRaised: uint256(0),
      tokensAllocated: tokenAllocation,
      tokensBought: uint256(0),
      usdRate: usdRate,
      isActive: true
    });

    emit PresaleStageActivated(currentStage, tokenAllocation, usdRate, block.timestamp);
  }

  /// @notice Function to Buy tokens using Eth
  /// Use msg.value and a chainlink
  function buyTokensEth() public payable returns (uint256) {
    if (presaleEnded) revert PresaleNotActive();

    uint256 ethUsdRate = getLatestPrice();
    /// 18 decimals * 18 decimals * 6 decimals / 36 decimals
    uint256 usdAmount = (msg.value * ethUsdRate) / 10 ** 30;

    if (usdAmount < minTransactionLimit || usdAmount > maxDepositLimit) {
      revert InvalidBalance();
    }

    PresaleParams memory currentSaleParams = presaleParamsData[currentStage];

    if (!currentSaleParams.isActive) revert PresaleStageNotActive();

    UserData storage userData = userDeposits[msg.sender];

    uint256 tokensBought = calculateTokensAllocated(usdAmount);

    if (currentSaleParams.tokensBought + tokensBought > currentSaleParams.tokensAllocated) {
      currentSaleParams.isActive = false;
      currentSaleParams.endTime = block.timestamp;
      uint256 usdAmountUsed = 0;
      unchecked {
        tokensBought = currentSaleParams.tokensAllocated - currentSaleParams.tokensBought;

        usdAmountUsed = (currentSaleParams.usdRate * tokensBought) / 1 ether;

        totalUsdRaised += usdAmountUsed;
        currentSaleParams.tokensBought += tokensBought;
        currentSaleParams.usdRaised += usdAmountUsed;
        /// Add Tokens Bought to the users data structure
        userData.usdInvested += usdAmountUsed;
        userData.tokensAllocated += tokensBought;
      }

      if (userData.usdInvested > maxDepositLimit) {
        revert MaxDepositLimitReached();
      }

      presaleParamsData[currentStage] = currentSaleParams;

      (bool isSuccess,) =
        payable(msg.sender).call{ value: ((usdAmount - usdAmountUsed) * 10 ** 30) / ethUsdRate }("");

      if (!isSuccess) revert LowLevelCallFailed();

      emit TokensBought(msg.sender, usdAmountUsed, currentStage, tokensBought);

      emit PresaleStageFinished(currentStage, block.timestamp);
      return tokensBought;
    }
    userData.usdInvested += usdAmount;
    if (userData.usdInvested > maxDepositLimit) {
      revert MaxDepositLimitReached();
    }

    totalUsdRaised += usdAmount;
    currentSaleParams.tokensBought += tokensBought;
    currentSaleParams.usdRaised += usdAmount;
    userData.tokensAllocated += tokensBought;

    presaleParamsData[currentStage] = currentSaleParams;

    emit TokensBought(msg.sender, usdAmount, currentStage, tokensBought);

    return tokensBought;
  }

  /// @notice Function to buy tokens using USDT
  /// @param usdtAmount The Amount of usdtTokens used to buy tokens
  /// @param token The token to use while buying
  /// @return The amount of tokens bought/allocated
  function buyTokens(uint256 usdtAmount, address token) external returns (uint256) {
    if (presaleEnded) revert PresaleNotActive();

    if (usdtAmount < minTransactionLimit || usdtAmount > maxDepositLimit) {
      revert InvalidBalance();
    }

    if (!acceptedTokens[token]) revert InvalidToken();

    PresaleParams memory currentSaleParams = presaleParamsData[currentStage];

    if (!currentSaleParams.isActive) revert PresaleStageNotActive();

    UserData storage userData = userDeposits[msg.sender];

    uint256 tokensBought = calculateTokensAllocated(usdtAmount);

    /// Calculate total tokens to be allocated and currently Allocated tokens + tokens < totalTokens in this level
    /// Sale is exhausted buy the remaining ones at current price and shift to new sale
    if (currentSaleParams.tokensBought + tokensBought >= currentSaleParams.tokensAllocated) {
      currentSaleParams.isActive = false;
      currentSaleParams.endTime = block.timestamp;

      unchecked {
        tokensBought = currentSaleParams.tokensAllocated - currentSaleParams.tokensBought;

        usdtAmount = (currentSaleParams.usdRate * tokensBought) / 1 ether;

        totalUsdRaised += usdtAmount;
        currentSaleParams.tokensBought += tokensBought;
        currentSaleParams.usdRaised += usdtAmount;
        /// Add Tokens Bought to the users data structure
        userData.usdInvested += usdtAmount;
        userData.tokensAllocated += tokensBought;
      }

      if (userData.usdInvested > maxDepositLimit) {
        revert MaxDepositLimitReached();
      }
      presaleParamsData[currentStage] = currentSaleParams;

      IERC20Metadata(token).safeTransferFrom(msg.sender, address(this), usdtAmount);

      emit TokensBought(msg.sender, usdtAmount, currentStage, tokensBought);

      emit PresaleStageFinished(currentStage, block.timestamp);
      return tokensBought;
    }

    userData.usdInvested += usdtAmount;
    if (userData.usdInvested > maxDepositLimit) {
      revert MaxDepositLimitReached();
    }

    totalUsdRaised += usdtAmount;
    currentSaleParams.tokensBought += tokensBought;
    currentSaleParams.usdRaised += usdtAmount;
    userData.tokensAllocated += tokensBought;

    presaleParamsData[currentStage] = currentSaleParams;

    IERC20Metadata(token).safeTransferFrom(msg.sender, address(this), usdtAmount);

    emit TokensBought(msg.sender, usdtAmount, currentStage, tokensBought);

    return tokensBought;
  }

  /// @notice Manual function to call and end the Presale starting the vesting period
  function endPreSale() public onlyOwner {
    if (!presaleParamsData[currentStage].isActive) {
      revert PresaleNotActive();
    }

    presaleEnded = true;

    vestingStartTimestamp = block.timestamp;
    emit PresaleFinishied(block.timestamp);
  }

  //// @notice Claim Tokens according to the vesting timeperiod
  //// @param user The user to claim the tokens for
  function claimTokens(address user) public {
    if (user != msg.sender) revert InvalidAccess();

    if (totalUsdRaised < usdSoftLimit) revert PresaleSoftLimitNotReached();

    uint256 tokens = getClaimableTokens(user);

    if (tokens == 0) revert NoTokenToClaim();

    userDeposits[user].tokensClaimed += tokens;

    nftfnToken.safeTransfer(user, tokens);

    emit TokensClaimed(user, tokens, block.timestamp);
  }

  /// @notice Get Claimiable Tokens After presale has ended
  /// @param user The user to get the claimable tokens for
  /// @return tokens The amount of tokens that can be claimed
  function getClaimableTokens(address user) public view returns (uint256 tokens) {
    if (!presaleEnded || vestingStartTimestamp == uint256(0)) return 0;

    UserData memory userData = userDeposits[user];

    /// Formulae 10% at TGE then linear unlock over 270 days
    uint256 timeSinceUnlock = block.timestamp - vestingStartTimestamp;

    tokens = ((userData.tokensAllocated - (userData.tokensAllocated / 10)) * timeSinceUnlock)
      / vestingTimePeriod;

    tokens += userData.tokensAllocated / 10;
    tokens -= userData.tokensClaimed;
    return tokens;
  }

  /// @notice function to RefundTokens Allocation is case a soft limit is failed to be touched
  /// @param user The user who is trying to claim his refund
  /// @param token The token in which to refund the user
  function refundTokenAllocation(address user, address token) public {
    /// Check user Refunding Token 
    if (user != msg.sender) revert InvalidAccess();

    /// Check that Soft Limit has not been reached
    if (totalUsdRaised >= usdSoftLimit) revert SoftLimitHit();

    /// Revert If Token is Invalid
    if (!acceptedTokens[token]) revert InvalidToken();


    /// Revert if the stage has not been active for 30 days or the stage has no start time i.e. it was never started
    if (
      presaleParamsData[currentStage].startTime == 0
        || presaleParamsData[currentStage].startTime + (30 * 86400) > block.timestamp
    ) revert RefundNotActive();

    UserData storage userData = userDeposits[user];

    

    uint256 usdInvested = userData.usdInvested;

    /// Check that the user has an allocation that he is asking a refund for
    if (usdInvested == uint256(0)) revert InvalidBalance();

    /// If the amount need to refund is greated than the amount currently held in the stage

    /// Remove his invested and tokens allocated
    totalUsdRaised -= usdInvested;
    presaleParamsData[currentStage].usdRaised -= usdInvested;
    presaleParamsData[currentStage].tokensAllocated += userData.tokensAllocated;
    userData.tokensAllocated = 0;
    userData.usdInvested = 0;

    IERC20Metadata(token).safeTransfer(user, usdInvested);

    emit RefundClaimed(user, block.timestamp);
  }

  /// @notice Function to cash out tokesn to team wallet
  /// @param token The token to be forwarded
  /// @param value The amount of tokens to be forwarded
  function forwardFunds(address token, uint256 value) public onlyOwner {
    if(token == address(nftfnToken)) revert InvalidToken();
    IERC20Metadata(token).safeTransfer(treasuryWallet, value);
    emit FundsTransferred(token, value);
  }

  /// @notice Function to transfer ETH out of the contract
  /// @param amount of ETH to be transferred
  function forwardFundsEth(uint256 amount) public onlyOwner {
    if (address(this).balance < amount) revert InvalidBalance();
    (bool isSuccess,) = treasuryWallet.call{ value: amount }("");
    if (!isSuccess) revert LowLevelCallFailed();

    emit FundsTransferredEth(amount);
  }

  /// @notice Function to refund unallocated NFTFN tokens in case the sale does not hit required
  /// bounds
  /// @param tokens The amount of tokens to be refunded
  function getUnallocatedTokens(uint256 tokens) public onlyOwner {
    if (!presaleEnded) revert PresaleStillActive();

    nftfnToken.safeTransfer(treasuryWallet, tokens);
  }

  /// @notice view function to get presale params for a specific stage
  /// @param stage The stage for which the params are needed
  /// @return PresaleParams Structure with all the data required
  function getPresaleParamsData(uint256 stage) public view returns (PresaleParams memory) {
    return presaleParamsData[stage];
  }

  /// @notice View Functio to get current sale Params data
  /// @return PresaleParams for the current ongoing stage of the sale
  function getCurrentPresaleParamsData() public view returns (PresaleParams memory) {
    return presaleParamsData[currentStage];
  }

  /// @notice view function to calculate token allocation at current stage investing in eth
  /// @param ethAmount of ETH deposited
  function calculateTokenAllocationEth(uint256 ethAmount) public view returns (uint256) {
    uint256 usdAmount = (ethAmount * getLatestPrice()) / 10 ** 30;
    return calculateTokensAllocated(usdAmount);
  }

  /// @notice view function to calculate token allocation at current stage after investing a particular amount of usd
  /// @param usdAmount Amount of usd being deposited
  /// @return Amount of nftfn tokens that will be allocated
  /// @dev Does not take into account whether the number of tokens to be allocated are available in the given stage or not
  function calculateTokensAllocated(uint256 usdAmount) public view returns (uint256) {
    uint256 usdRate = presaleParamsData[currentStage].usdRate;
    unchecked {
      return (usdAmount / usdRate) * 1 ether;
    }
  }

  /// @notice Helper function to calculate Tokens allocation at different stages
  /// @param usdAmount Amount of usd being Deposited (in 10 ** 6 multiples)
  /// @param stage The stage to calculate the values on
  /// @return Amount of nftfn tokens that will be allocated on that stage
  function calculateTokensAllocated(uint256 usdAmount, uint256 stage) public view returns (uint256) {
    uint256 usdRate = presaleParamsData[stage].usdRate;
    if (usdRate == 0) return 0;
    unchecked {
      return (usdAmount / usdRate) * 1 ether;
    }
  }

  /// @notice Chainlink Helper function to get latest price for ETH/USD Pair
  /// @return ETH/USD price in 10 ** 18 decimals.
  function getLatestPrice() public view returns (uint256) {
    /// This gives answer in 8 decimals
    ( uint80 roundId, int256 answer,,uint256 updatedAt,uint80 answeredInRound) = ethDataFeed.latestRoundData();
    if (answer < 0) revert InvalidPriceFeedValue();
    if( answeredInRound > roundId) revert InvalidPriceFeedValue();
    if(block.timestamp > updatedAt + stalePriceDelay) revert InvalidPriceFeedValue();
    return uint256(answer * (10 ** 10)); // Conversion to 18 decimals
  }
}

File 2 of 11 : IERC20Metadata.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC20Metadata.sol)

pragma solidity ^0.8.20;

import {IERC20Metadata} from "../token/ERC20/extensions/IERC20Metadata.sol";

File 3 of 11 : 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 4 of 11 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)

pragma solidity ^0.8.20;

import {Context} from "../utils/Context.sol";

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

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

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

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

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

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

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

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

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby disabling any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        if (newOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(newOwner);
    }

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

File 5 of 11 : PresaleLib.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

abstract contract PresaleData {
  struct PresaleParams {
    uint256 startTime; // Presale Start Time
    uint256 endTime; // Presale End Time
    /// Total Tokens Allocated for Presale
    uint256 tokensAllocated;
    /// Total Usd Raised
    uint256 usdRaised;
    /// Total Tokens Sold in Presale
    uint256 tokensBought;
    /// Usd rate for the Presale the rate should be in USDT decimals on ETH
    uint256 usdRate;
    bool isActive;
  }
  /// Is Presale active

  struct UserData {
    uint256 usdInvested;
    /// Usd Invested by user
    uint256 tokensAllocated;
    /// Total tokens allocated to user
    uint256 tokensClaimed;
  }
  /// Total tokens Claimed by the user

  //// USDT DECIMALS ON ETHEREUM
  /// USING ADDRESS 0xdAC17F958D2ee523a2206206994597C13D831ec7
  uint256 usdtMultiplier = 10 ** 6;

  ////////////////////// EVENTS ///////////////////////////

  /// @notice Funds Transferred Event
  /// @param token the Token being transferred
  /// @param value the Amount of token being transferred
  event FundsTransferred(address token, uint256 value);

  /// @notice Eth Transferred Event
  /// @param value The Amount of Eth transferred
  event FundsTransferredEth(uint256 value);

  /// @notice Tokens Bought event
  /// @param user User Buying the tokens
  /// @param usdValue Amount of Usd Used
  /// @param stage Current Stage
  /// @param tokens Amount of tokens allocated
  event TokensBought(address user, uint256 usdValue, uint256 stage, uint256 tokens);

  /// @notice Tokens Refunded Event
  /// @param user User Buying tokens
  /// @param value Amount of tokens bought
  event TokensRefunded(address user, uint256 value);

  /// @notice Presale Activated Event
  /// @param timestamp Timestamp on which Presale was activated
  /// @param stage The stage which has been activated
  event PresaleActivated(uint256 timestamp, uint256 stage);

  /// @notice Presale Finished Event
  /// @param timestamp the timestamp at which the presale was ended
  event PresaleFinishied(uint256 timestamp);

  /// @notice Tokens Claimed Event
  //// @param user The user which is claiming the token
  //// @param amount The amount of tokens being claimed
  //// @param timestamp The timestamp on which the claim was made
  event TokensClaimed(address user, uint256 amount, uint256 timestamp);

  /// @notice Refund Claimed Event
  /// @param user The user claiming the refund
  /// @param timestamp The timestamp at which the refund was claimed
  event RefundClaimed(address user, uint256 timestamp);

  /// @notice Presale Stage Finished Event
  /// @param stage The stage which was finished
  /// @param timestamp The timestamp on which the stage was finished
  event PresaleStageFinished(uint256 stage, uint256 timestamp);

  /// @notice New Presale Stage Activated
  /// @param stage The stage which has been started
  /// @param tokenAllocation Number of tokens allocated in the new stage
  /// @param usdRate Usd Rate for the current stage of tokens
  /// @param timestamp Timestamp for the activation
  event PresaleStageActivated(
    uint256 stage, uint256 tokenAllocation, uint256 usdRate, uint256 timestamp
  );
}

File 6 of 11 : AggregatorV3.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface AggregatorV3Interface {
  function decimals() external view returns (uint8);

  function description() external view returns (string memory);

  function version() external view returns (uint256);

  function getRoundData(uint80 _roundId)
    external
    view
    returns (
      uint80 roundId,
      int256 answer,
      uint256 startedAt,
      uint256 updatedAt,
      uint80 answeredInRound
    );

  function latestRoundData()
    external
    view
    returns (
      uint80 roundId,
      int256 answer,
      uint256 startedAt,
      uint256 updatedAt,
      uint80 answeredInRound
    );
}

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

pragma solidity ^0.8.20;

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

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

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

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

File 8 of 11 : 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 9 of 11 : 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 10 of 11 : 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 11 of 11 : 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;
    }
}

Settings
{
  "remappings": [
    "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
    "ds-test/=lib/forge-std/lib/ds-test/src/",
    "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
    "forge-std/=lib/forge-std/src/",
    "openzeppelin-contracts/=lib/openzeppelin-contracts/contracts/",
    "solady/=lib/solady/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "metadata": {
    "useLiteralContent": false,
    "bytecodeHash": "ipfs",
    "appendCBOR": true
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "paris",
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address payable","name":"_treasuryWallet","type":"address"},{"internalType":"address","name":"_nftfnToken","type":"address"},{"internalType":"uint256","name":"usdRates","type":"uint256"},{"internalType":"uint256","name":"tokenAllocation","type":"uint256"},{"internalType":"address","name":"ethPriceFeed","type":"address"},{"internalType":"address[]","name":"tokens","type":"address[]"}],"stateMutability":"nonpayable","type":"constructor"},{"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":"InsufficientTokenBalance","type":"error"},{"inputs":[],"name":"InvalidAccess","type":"error"},{"inputs":[],"name":"InvalidBalance","type":"error"},{"inputs":[],"name":"InvalidParams","type":"error"},{"inputs":[],"name":"InvalidPriceFeedValue","type":"error"},{"inputs":[],"name":"InvalidToken","type":"error"},{"inputs":[],"name":"LowLevelCallFailed","type":"error"},{"inputs":[],"name":"MaxDepositLimitReached","type":"error"},{"inputs":[],"name":"NoTokenToClaim","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[],"name":"PresaleAlreadyActivated","type":"error"},{"inputs":[],"name":"PresaleNotActive","type":"error"},{"inputs":[],"name":"PresaleSoftLimitNotReached","type":"error"},{"inputs":[],"name":"PresaleStageNotActive","type":"error"},{"inputs":[],"name":"PresaleStageStillActive","type":"error"},{"inputs":[],"name":"PresaleStillActive","type":"error"},{"inputs":[],"name":"PresaleTimeLimitNotReached","type":"error"},{"inputs":[],"name":"RefundNotActive","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"inputs":[],"name":"SoftLimitHit","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"FundsTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"FundsTransferredEth","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"stage","type":"uint256"}],"name":"PresaleActivated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"PresaleFinishied","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"stage","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"tokenAllocation","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"usdRate","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"PresaleStageActivated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"stage","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"PresaleStageFinished","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"RefundClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"usdValue","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"stage","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"tokens","type":"uint256"}],"name":"TokensBought","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"TokensClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"TokensRefunded","type":"event"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"acceptedTokens","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"usdtAmount","type":"uint256"},{"internalType":"address","name":"token","type":"address"}],"name":"buyTokens","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"buyTokensEth","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"ethAmount","type":"uint256"}],"name":"calculateTokenAllocationEth","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"usdAmount","type":"uint256"}],"name":"calculateTokensAllocated","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"usdAmount","type":"uint256"},{"internalType":"uint256","name":"stage","type":"uint256"}],"name":"calculateTokensAllocated","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"claimTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"currentStage","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"endPreSale","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"ethDataFeed","outputs":[{"internalType":"contract AggregatorV3Interface","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"forwardFunds","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"forwardFundsEth","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"getClaimableTokens","outputs":[{"internalType":"uint256","name":"tokens","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCurrentPresaleParamsData","outputs":[{"components":[{"internalType":"uint256","name":"startTime","type":"uint256"},{"internalType":"uint256","name":"endTime","type":"uint256"},{"internalType":"uint256","name":"tokensAllocated","type":"uint256"},{"internalType":"uint256","name":"usdRaised","type":"uint256"},{"internalType":"uint256","name":"tokensBought","type":"uint256"},{"internalType":"uint256","name":"usdRate","type":"uint256"},{"internalType":"bool","name":"isActive","type":"bool"}],"internalType":"struct PresaleData.PresaleParams","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getLatestPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"stage","type":"uint256"}],"name":"getPresaleParamsData","outputs":[{"components":[{"internalType":"uint256","name":"startTime","type":"uint256"},{"internalType":"uint256","name":"endTime","type":"uint256"},{"internalType":"uint256","name":"tokensAllocated","type":"uint256"},{"internalType":"uint256","name":"usdRaised","type":"uint256"},{"internalType":"uint256","name":"tokensBought","type":"uint256"},{"internalType":"uint256","name":"usdRate","type":"uint256"},{"internalType":"bool","name":"isActive","type":"bool"}],"internalType":"struct PresaleData.PresaleParams","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokens","type":"uint256"}],"name":"getUnallocatedTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenAllocation","type":"uint256"},{"internalType":"uint256","name":"usdRate","type":"uint256"}],"name":"initNextPresaleStage","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"initPresale","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"maxDepositLimit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minTransactionLimit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nftfnToken","outputs":[{"internalType":"contract IERC20Metadata","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"presaleEnded","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"presaleParamsData","outputs":[{"internalType":"uint256","name":"startTime","type":"uint256"},{"internalType":"uint256","name":"endTime","type":"uint256"},{"internalType":"uint256","name":"tokensAllocated","type":"uint256"},{"internalType":"uint256","name":"usdRaised","type":"uint256"},{"internalType":"uint256","name":"tokensBought","type":"uint256"},{"internalType":"uint256","name":"usdRate","type":"uint256"},{"internalType":"bool","name":"isActive","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"address","name":"token","type":"address"}],"name":"refundTokenAllocation","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"stalePriceDelay","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalTokensAllocated","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalUsdRaised","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"treasuryWallet","outputs":[{"internalType":"address payable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"usdSoftLimit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"userDeposits","outputs":[{"internalType":"uint256","name":"usdInvested","type":"uint256"},{"internalType":"uint256","name":"tokensAllocated","type":"uint256"},{"internalType":"uint256","name":"tokensClaimed","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"vestingStartTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"vestingTimePeriod","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]

60e0604052620f4240600081815560016005556007556008805460ff191690556200002b908062000275565b6080526000546200003e90603262000275565b60a0526000546200005390620f424062000275565b60c0523480156200006357600080fd5b5060405162002839380380620028398339810160408190526200008691620002d6565b3380620000ad57604051631e4fbdf760e01b81526000600482015260240160405180910390fd5b620000b8816200020d565b50600280546001600160a01b03199081166001600160a01b03898116919091178355600380548316898316178155600480549093169186169190911782556040805160e081018252600080825260208083018281528385018b8152606085018481526080860185815260a087018f815260c08801878152600580548952600b909752988720975188559351600188015591519986019990995597519584019590955595519482019490945591519382019390935591516006909201805460ff1916921515929092179091556009805485929062000197908490620003ff565b90915550600090505b815181101562000200576001600c6000848481518110620001c557620001c562000415565b6020908102919091018101516001600160a01b03168252810191909152604001600020805460ff1916911515919091179055600101620001a0565b505050505050506200042b565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b634e487b7160e01b600052601160045260246000fd5b80820281158282048414176200028f576200028f6200025f565b92915050565b6001600160a01b0381168114620002ab57600080fd5b50565b8051620002bb8162000295565b919050565b634e487b7160e01b600052604160045260246000fd5b60008060008060008060c08789031215620002f057600080fd5b8651620002fd8162000295565b80965050602080880151620003128162000295565b8096505060408801519450606088015193506080880151620003348162000295565b60a08901519093506001600160401b03808211156200035257600080fd5b818a0191508a601f8301126200036757600080fd5b8151818111156200037c576200037c620002c0565b8060051b604051601f19603f83011681018181108582111715620003a457620003a4620002c0565b60405291825284820192508381018501918d831115620003c357600080fd5b938501935b82851015620003ec57620003dc85620002ae565b84529385019392850192620003c8565b8096505050505050509295509295509295565b808201808211156200028f576200028f6200025f565b634e487b7160e01b600052603260045260246000fd5b60805160a05160c051612398620004a1600039600081816106a701528181610c350152611a760152600081816102e80152818161102601526115f70152600081816105e70152818161104f015281816111a90152818161136c01528181611620015281816117b301526118fa01526123986000f3fe60806040526004361061020f5760003560e01c806392878bd011610118578063d6ddd21b116100a0578063eb2031221161006f578063eb20312214610703578063eb74d21d14610718578063ee889ed014610738578063f207b19e1461074d578063f2fde38b1461076d57600080fd5b8063d6ddd21b1461067f578063ded716af14610695578063df8de3e7146106c9578063e580b2b0146106e957600080fd5b8063b63c44e7116100e7578063b63c44e7146105d5578063c07f773a14610609578063c49027d51461061f578063c625e9b11461063f578063ca024aa51461065f57600080fd5b806392878bd01461056d578063a3c270691461058d578063a52bfba914610595578063aed9053b146105b557600080fd5b80635bf5d54c1161019b57806382dc4a051161016a57806382dc4a05146104c257806385ee676614610502578063886ce38b1461051a5780638da5cb5b1461053a5780638e15f4731461055857600080fd5b80635bf5d54c146103e55780635eb7aabf146103fb5780636d79ba3a1461048d578063715018a6146104ad57600080fd5b8063453ffd31116101e2578063453ffd31146102d65780634626402b1461030a5780635647a6461461034257806359839424146103585780635be6cacb1461037857600080fd5b80630ba36dcd146102145780631b831ead146102705780632cea94421461029e578063422fdf02146102b4575b600080fd5b34801561022057600080fd5b5061025061022f36600461209e565b600a6020526000908152604090208054600182015460029092015490919083565b604080519384526020840192909252908201526060015b60405180910390f35b34801561027c57600080fd5b5061029061028b36600461209e565b61078d565b604051908152602001610267565b3480156102aa57600080fd5b5061029060075481565b3480156102c057600080fd5b506102d46102cf3660046120b9565b61086d565b005b3480156102e257600080fd5b506102907f000000000000000000000000000000000000000000000000000000000000000081565b34801561031657600080fd5b5060025461032a906001600160a01b031681565b6040516001600160a01b039091168152602001610267565b34801561034e57600080fd5b50610290610e1081565b34801561036457600080fd5b506102d46103733660046120d2565b610942565b34801561038457600080fd5b5061038d610b4b565b6040516102679190600060e082019050825182526020830151602083015260408301516040830152606083015160608301526080830151608083015260a083015160a083015260c0830151151560c083015292915050565b3480156103f157600080fd5b5061029060055481565b34801561040757600080fd5b506104566104163660046120b9565b600b602052600090815260409020805460018201546002830154600384015460048501546005860154600690960154949593949293919290919060ff1687565b604080519788526020880196909652948601939093526060850191909152608084015260a0830152151560c082015260e001610267565b34801561049957600080fd5b5060045461032a906001600160a01b031681565b3480156104b957600080fd5b506102d4610bf6565b3480156104ce57600080fd5b506104f26104dd36600461209e565b600c6020526000908152604090205460ff1681565b6040519015158152602001610267565b34801561050e57600080fd5b50610290630163f50081565b34801561052657600080fd5b506102d46105353660046120f4565b610c0a565b34801561054657600080fd5b506001546001600160a01b031661032a565b34801561056457600080fd5b50610290610e14565b34801561057957600080fd5b506102d4610588366004612127565b610f3b565b610290610fcb565b3480156105a157600080fd5b5061038d6105b03660046120b9565b6114a1565b3480156105c157600080fd5b506102d46105d03660046120b9565b61154b565b3480156105e157600080fd5b506102907f000000000000000000000000000000000000000000000000000000000000000081565b34801561061557600080fd5b5061029060095481565b34801561062b57600080fd5b5061029061063a3660046120b9565b611596565b34801561064b57600080fd5b5061029061065a366004612151565b6115ce565b34801561066b57600080fd5b5060035461032a906001600160a01b031681565b34801561068b57600080fd5b5061029060065481565b3480156106a157600080fd5b506102907f000000000000000000000000000000000000000000000000000000000000000081565b3480156106d557600080fd5b506102d46106e436600461209e565b611a4b565b3480156106f557600080fd5b506008546104f29060ff1681565b34801561070f57600080fd5b506102d4611b75565b34801561072457600080fd5b506102906107333660046120b9565b611caf565b34801561074457600080fd5b506102d4611cee565b34801561075957600080fd5b506102906107683660046120d2565b611d70565b34801561077957600080fd5b506102d461078836600461209e565b611db6565b60085460009060ff1615806107a25750600654155b156107af57506000919050565b6001600160a01b0382166000908152600a6020908152604080832081516060810183528154815260018201549381019390935260020154908201526006549091906107fa904261218a565b9050630163f50081600a846020015161081391906121b3565b8460200151610822919061218a565b61082c91906121d5565b61083691906121b3565b9250600a826020015161084991906121b3565b61085390846121ec565b9250816040015183610865919061218a565b949350505050565b610875611df6565b804710156108965760405163c52e3eff60e01b815260040160405180910390fd5b6002546040516000916001600160a01b03169083908381818185875af1925050503d80600081146108e3576040519150601f19603f3d011682016040523d82523d6000602084013e6108e8565b606091505b505090508061090a576040516349e7d1f760e11b815260040160405180910390fd5b6040518281527fdbb9aafb8a81f300a9bd8de82d212f728c70a559d9f97a731ac5fa7a4eac8d57906020015b60405180910390a15050565b61094a611df6565b60085460ff161561096e57604051633844da5760e21b815260040160405180910390fd5b811580610979575080155b1561099757604051635435b28960e11b815260040160405180910390fd5b6005546000908152600b602052604090206006015460ff16156109cd576040516337a8964960e21b815260040160405180910390fd5b81600960008282546109df91906121ec565b90915550506009546003546040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa158015610a2f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a5391906121ff565b1015610a725760405163c52e3eff60e01b815260040160405180910390fd5b600560008154610a8190612218565b909155506040805160e08101825242808252600060208084018281528486018881526060808701858152608080890187815260a08a018c8152600160c08c01818152600580548c52600b8b529a8e90209c518d559751908c0155945160028b0155915160038a01559051600489015591518786015591516006909601805460ff191696151596909617909555915485519081529081018790529384018590528301527fca86df7652ce63c8499edbbe37ef4d7b5a36adf2aec7a6f232519630e084ee9c9101610936565b610b8d6040518060e001604052806000815260200160008152602001600081526020016000815260200160008152602001600081526020016000151581525090565b50600580546000908152600b6020908152604091829020825160e0810184528154815260018201549281019290925260028101549282019290925260038201546060820152600482015460808201529181015460a08301526006015460ff16151560c082015290565b610bfe611df6565b610c086000611e23565b565b6001600160a01b0382163314610c3357604051633006171960e21b815260040160405180910390fd5b7f000000000000000000000000000000000000000000000000000000000000000060075410610c7557604051639b6495af60e01b815260040160405180910390fd5b6001600160a01b0381166000908152600c602052604090205460ff16610cae5760405163c1ab6dc160e01b815260040160405180910390fd5b6005546000908152600b60205260409020541580610cea57506005546000908152600b60205260409020544290610ce89062278d006121ec565b115b15610d0857604051633c8440db60e21b815260040160405180910390fd5b6001600160a01b0382166000908152600a60205260409020805480610d405760405163c52e3eff60e01b815260040160405180910390fd5b8060076000828254610d52919061218a565b90915550506005546000908152600b602052604081206003018054839290610d7b90849061218a565b909155505060018201546005546000908152600b602052604081206002018054909190610da99084906121ec565b90915550506000600183018190558255610dcd6001600160a01b0384168583611e75565b604080516001600160a01b03861681524260208201527f358fe4192934d3bf28ae181feda1f4bd08ca67f5e2fad55582cce5eb67304ae9910160405180910390a150505050565b6000806000806000600460009054906101000a90046001600160a01b03166001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a060405180830381865afa158015610e6f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e93919061224b565b9450945050935093506000831215610ebe5760405163cb03080b60e01b815260040160405180910390fd5b8369ffffffffffffffffffff168169ffffffffffffffffffff161115610ef75760405163cb03080b60e01b815260040160405180910390fd5b610f03610e10836121ec565b421115610f235760405163cb03080b60e01b815260040160405180910390fd5b610f32836402540be40061229b565b94505050505090565b610f43611df6565b6003546001600160a01b0390811690831603610f725760405163c1ab6dc160e01b815260040160405180910390fd5b600254610f8c906001600160a01b03848116911683611e75565b604080516001600160a01b0384168152602081018390527f8c9a4f13b67cb64d7c6aa1ae0c9bf07694af521a28b93e7060020810ab4bc59f9101610936565b60085460009060ff1615610ff257604051633844da5760e21b815260040160405180910390fd5b6000610ffc610e14565b905060006c0c9f2c9cd04674edea4000000061101883346121d5565b61102291906121b3565b90507f000000000000000000000000000000000000000000000000000000000000000081108061107157507f000000000000000000000000000000000000000000000000000000000000000081115b1561108f5760405163c52e3eff60e01b815260040160405180910390fd5b600580546000908152600b6020908152604091829020825160e0810184528154815260018201549281019290925260028101549282019290925260038201546060820152600482015460808201529181015460a08301526006015460ff16151560c082018190526111125760405162631aa160e91b815260040160405180910390fd5b336000908152600a602052604081209061112b84611596565b9050826040015181846080015161114291906121ec565b111561134f5750600060c0830152426020830152608082018051604084015160a085015160078054670de0b6b3a7640000938590039283029390930492830190559182019092526060840180518301905282548201808455600184018054830190559091907f000000000000000000000000000000000000000000000000000000000000000010156111e757604051634b59155b60e11b815260040160405180910390fd5b600580546000908152600b60209081526040808320885181559188015160018301558701516002820155606087015160038201556080870151600482015560a08701519281019290925560c08601516006909201805460ff1916921515929092179091553387611257848961218a565b61126e906c0c9f2c9cd04674edea400000006121d5565b61127891906121b3565b604051600081818185875af1925050503d80600081146112b4576040519150601f19603f3d011682016040523d82523d6000602084013e6112b9565b606091505b50509050806112db576040516349e7d1f760e11b815260040160405180910390fd5b60008051602061234383398151915233836005548660405161130094939291906122cb565b60405180910390a1600554604080519182524260208301527f5fd10f55317279067840c290f477e517a8c8710cafd2fd5a09d34d4cba6ab826910160405180910390a150909695505050505050565b8382600001600082825461136391906121ec565b909155505081547f000000000000000000000000000000000000000000000000000000000000000010156113aa57604051634b59155b60e11b815260040160405180910390fd5b83600760008282546113bc91906121ec565b9250508190555080836080018181516113d591906121ec565b9052506060830180518591906113ec9083906121ec565b9052506001820180548291906000906114069084906121ec565b9091555050600580546000908152600b602090815260409182902086518155908601516001820155858201516002820155606086015160038201556080860151600482015560a08601518184015560c08601516006909101805460ff19169115159190911790559054905160008051602061234383398151915291611490913391889186906122cb565b60405180910390a195945050505050565b6114e36040518060e001604052806000815260200160008152602001600081526020016000815260200160008152602001600081526020016000151581525090565b506000908152600b6020908152604091829020825160e081018452815481526001820154928101929092526002810154928201929092526003820154606082015260048201546080820152600582015460a082015260069091015460ff16151560c082015290565b611553611df6565b60085460ff16611576576040516365603eed60e11b815260040160405180910390fd5b600254600354611593916001600160a01b03918216911683611e75565b50565b600580546000908152600b60205260408120909101548083816115bb576115bb61219d565b04670de0b6b3a764000002915050919050565b60085460009060ff16156115f557604051633844da5760e21b815260040160405180910390fd5b7f000000000000000000000000000000000000000000000000000000000000000083108061164257507f000000000000000000000000000000000000000000000000000000000000000083115b156116605760405163c52e3eff60e01b815260040160405180910390fd5b6001600160a01b0382166000908152600c602052604090205460ff166116995760405163c1ab6dc160e01b815260040160405180910390fd5b600580546000908152600b6020908152604091829020825160e0810184528154815260018201549281019290925260028101549282019290925260038201546060820152600482015460808201529181015460a08301526006015460ff16151560c0820181905261171c5760405162631aa160e91b815260040160405180910390fd5b336000908152600a602052604081209061173586611596565b9050826040015181846080015161174c91906121ec565b106118dd5750600060c0830152426020830152608082018051604084015160a085015160078054670de0b6b3a764000093859003928302939093049283019055918201909252606084018051830190528254820180845560018401805483019055919650907f000000000000000000000000000000000000000000000000000000000000000010156117f157604051634b59155b60e11b815260040160405180910390fd5b600580546000908152600b602090815260409182902086518155908601516001820155908501516002820155606085015160038201556080850151600482015560a08501519181019190915560c08401516006909101805460ff191691151591909117905561186b6001600160a01b038616333089611ed9565b60008051602061234383398151915233876005548460405161189094939291906122cb565b60405180910390a1600554604080519182524260208301527f5fd10f55317279067840c290f477e517a8c8710cafd2fd5a09d34d4cba6ab826910160405180910390a19250611a45915050565b858260000160008282546118f191906121ec565b909155505081547f0000000000000000000000000000000000000000000000000000000000000000101561193857604051634b59155b60e11b815260040160405180910390fd5b856007600082825461194a91906121ec565b92505081905550808360800181815161196391906121ec565b90525060608301805187919061197a9083906121ec565b9052506001820180548291906000906119949084906121ec565b9091555050600580546000908152600b602090815260409182902086518155908601516001820155908501516002820155606085015160038201556080850151600482015560a08501519181019190915560c08401516006909101805460ff1916911515919091179055611a136001600160a01b038616333089611ed9565b600080516020612343833981519152338760055484604051611a3894939291906122cb565b60405180910390a1925050505b92915050565b6001600160a01b0381163314611a7457604051633006171960e21b815260040160405180910390fd5b7f00000000000000000000000000000000000000000000000000000000000000006007541015611ab7576040516323edc94960e11b815260040160405180910390fd5b6000611ac28261078d565b905080600003611ae557604051637bba838960e01b815260040160405180910390fd5b6001600160a01b0382166000908152600a602052604081206002018054839290611b109084906121ec565b9091555050600354611b2c906001600160a01b03168383611e75565b604080516001600160a01b03841681526020810183905242918101919091527f9923b4306c6c030f2bdfbf156517d5983b87e15b96176da122cd4f2effa4ba7b90606001610936565b611b7d611df6565b6005546000908152600b602052604090206006015460ff1615611bb357604051638b67379f60e01b815260040160405180910390fd5b6009546003546040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa158015611bfe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c2291906121ff565b14611c4057604051637222ae5760e11b815260040160405180910390fd5b600580546000908152600b602052604080822042908190558354835291819020600601805460ff19166001179055915491517f10121979be41abd0ebf98da496ce14bf416a9069c2c2c6cebac3a14fd6b5123e92611ca5928252602082015260400190565b60405180910390a1565b6000806c0c9f2c9cd04674edea40000000611cc8610e14565b611cd290856121d5565b611cdc91906121b3565b9050611ce781611596565b9392505050565b611cf6611df6565b6005546000908152600b602052604090206006015460ff16611d2b57604051633844da5760e21b815260040160405180910390fd5b6008805460ff191660011790554260068190556040517f124d23a4c3d54589dd0d43a0e0d6c2e851c3666d89dd9fda45c4d6924d21c63e91611ca59190815260200190565b6000818152600b6020526040812060050154808203611d93576000915050611a45565b808481611da257611da261219d565b04670de0b6b3a76400000291505092915050565b611dbe611df6565b6001600160a01b038116611ded57604051631e4fbdf760e01b8152600060048201526024015b60405180910390fd5b61159381611e23565b6001546001600160a01b03163314610c085760405163118cdaa760e01b8152336004820152602401611de4565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6040516001600160a01b03838116602483015260448201839052611ed491859182169063a9059cbb906064015b604051602081830303815290604052915060e01b6020820180516001600160e01b038381831617835250505050611f18565b505050565b6040516001600160a01b038481166024830152838116604483015260648201839052611f129186918216906323b872dd90608401611ea2565b50505050565b6000611f2d6001600160a01b03841683611f7b565b90508051600014158015611f52575080806020019051810190611f5091906122f1565b155b15611ed457604051635274afe760e01b81526001600160a01b0384166004820152602401611de4565b6060611ce78383600084600080856001600160a01b03168486604051611fa19190612313565b60006040518083038185875af1925050503d8060008114611fde576040519150601f19603f3d011682016040523d82523d6000602084013e611fe3565b606091505b5091509150611ff3868383611ffd565b9695505050505050565b6060826120125761200d82612059565b611ce7565b815115801561202957506001600160a01b0384163b155b1561205257604051639996b31560e01b81526001600160a01b0385166004820152602401611de4565b5080611ce7565b8051156120695780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b80356001600160a01b038116811461209957600080fd5b919050565b6000602082840312156120b057600080fd5b611ce782612082565b6000602082840312156120cb57600080fd5b5035919050565b600080604083850312156120e557600080fd5b50508035926020909101359150565b6000806040838503121561210757600080fd5b61211083612082565b915061211e60208401612082565b90509250929050565b6000806040838503121561213a57600080fd5b61214383612082565b946020939093013593505050565b6000806040838503121561216457600080fd5b8235915061211e60208401612082565b634e487b7160e01b600052601160045260246000fd5b81810381811115611a4557611a45612174565b634e487b7160e01b600052601260045260246000fd5b6000826121d057634e487b7160e01b600052601260045260246000fd5b500490565b8082028115828204841417611a4557611a45612174565b80820180821115611a4557611a45612174565b60006020828403121561221157600080fd5b5051919050565b60006001820161222a5761222a612174565b5060010190565b805169ffffffffffffffffffff8116811461209957600080fd5b600080600080600060a0868803121561226357600080fd5b61226c86612231565b945060208601519350604086015192506060860151915061228f60808701612231565b90509295509295909350565b80820260008212600160ff1b841416156122b7576122b7612174565b8181058314821517611a4557611a45612174565b6001600160a01b0394909416845260208401929092526040830152606082015260800190565b60006020828403121561230357600080fd5b81518015158114611ce757600080fd5b6000825160005b81811015612334576020818601810151858301520161231a565b50600092019182525091905056fe22f6af6e13430e3e7b6418d01e6a48c1fbce5e8cb1698901fc95134b4b1c58ada264697066735822122088545ac4ef7bab821a38a1ee75608971f48ef0342b74543871f83c28855dfb2664736f6c634300081800330000000000000000000000000feea8f4779767623f3c01c8eb796d1f8af1967b0000000000000000000000009a64977ebf739dff35ed4281a4b5e833bfdb131400000000000000000000000000000000000000000000000000000000000061a8000000000000000000000000000000000000000000084595161401484a0000000000000000000000000000005f4ec3df9cbd43714fe2740f5e3616155c5b841900000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000002000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec7000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48

Deployed Bytecode

0x60806040526004361061020f5760003560e01c806392878bd011610118578063d6ddd21b116100a0578063eb2031221161006f578063eb20312214610703578063eb74d21d14610718578063ee889ed014610738578063f207b19e1461074d578063f2fde38b1461076d57600080fd5b8063d6ddd21b1461067f578063ded716af14610695578063df8de3e7146106c9578063e580b2b0146106e957600080fd5b8063b63c44e7116100e7578063b63c44e7146105d5578063c07f773a14610609578063c49027d51461061f578063c625e9b11461063f578063ca024aa51461065f57600080fd5b806392878bd01461056d578063a3c270691461058d578063a52bfba914610595578063aed9053b146105b557600080fd5b80635bf5d54c1161019b57806382dc4a051161016a57806382dc4a05146104c257806385ee676614610502578063886ce38b1461051a5780638da5cb5b1461053a5780638e15f4731461055857600080fd5b80635bf5d54c146103e55780635eb7aabf146103fb5780636d79ba3a1461048d578063715018a6146104ad57600080fd5b8063453ffd31116101e2578063453ffd31146102d65780634626402b1461030a5780635647a6461461034257806359839424146103585780635be6cacb1461037857600080fd5b80630ba36dcd146102145780631b831ead146102705780632cea94421461029e578063422fdf02146102b4575b600080fd5b34801561022057600080fd5b5061025061022f36600461209e565b600a6020526000908152604090208054600182015460029092015490919083565b604080519384526020840192909252908201526060015b60405180910390f35b34801561027c57600080fd5b5061029061028b36600461209e565b61078d565b604051908152602001610267565b3480156102aa57600080fd5b5061029060075481565b3480156102c057600080fd5b506102d46102cf3660046120b9565b61086d565b005b3480156102e257600080fd5b506102907f0000000000000000000000000000000000000000000000000000000002faf08081565b34801561031657600080fd5b5060025461032a906001600160a01b031681565b6040516001600160a01b039091168152602001610267565b34801561034e57600080fd5b50610290610e1081565b34801561036457600080fd5b506102d46103733660046120d2565b610942565b34801561038457600080fd5b5061038d610b4b565b6040516102679190600060e082019050825182526020830151602083015260408301516040830152606083015160608301526080830151608083015260a083015160a083015260c0830151151560c083015292915050565b3480156103f157600080fd5b5061029060055481565b34801561040757600080fd5b506104566104163660046120b9565b600b602052600090815260409020805460018201546002830154600384015460048501546005860154600690960154949593949293919290919060ff1687565b604080519788526020880196909652948601939093526060850191909152608084015260a0830152151560c082015260e001610267565b34801561049957600080fd5b5060045461032a906001600160a01b031681565b3480156104b957600080fd5b506102d4610bf6565b3480156104ce57600080fd5b506104f26104dd36600461209e565b600c6020526000908152604090205460ff1681565b6040519015158152602001610267565b34801561050e57600080fd5b50610290630163f50081565b34801561052657600080fd5b506102d46105353660046120f4565b610c0a565b34801561054657600080fd5b506001546001600160a01b031661032a565b34801561056457600080fd5b50610290610e14565b34801561057957600080fd5b506102d4610588366004612127565b610f3b565b610290610fcb565b3480156105a157600080fd5b5061038d6105b03660046120b9565b6114a1565b3480156105c157600080fd5b506102d46105d03660046120b9565b61154b565b3480156105e157600080fd5b506102907f000000000000000000000000000000000000000000000000000000e8d4a5100081565b34801561061557600080fd5b5061029060095481565b34801561062b57600080fd5b5061029061063a3660046120b9565b611596565b34801561064b57600080fd5b5061029061065a366004612151565b6115ce565b34801561066b57600080fd5b5060035461032a906001600160a01b031681565b34801561068b57600080fd5b5061029060065481565b3480156106a157600080fd5b506102907f000000000000000000000000000000000000000000000000000000e8d4a5100081565b3480156106d557600080fd5b506102d46106e436600461209e565b611a4b565b3480156106f557600080fd5b506008546104f29060ff1681565b34801561070f57600080fd5b506102d4611b75565b34801561072457600080fd5b506102906107333660046120b9565b611caf565b34801561074457600080fd5b506102d4611cee565b34801561075957600080fd5b506102906107683660046120d2565b611d70565b34801561077957600080fd5b506102d461078836600461209e565b611db6565b60085460009060ff1615806107a25750600654155b156107af57506000919050565b6001600160a01b0382166000908152600a6020908152604080832081516060810183528154815260018201549381019390935260020154908201526006549091906107fa904261218a565b9050630163f50081600a846020015161081391906121b3565b8460200151610822919061218a565b61082c91906121d5565b61083691906121b3565b9250600a826020015161084991906121b3565b61085390846121ec565b9250816040015183610865919061218a565b949350505050565b610875611df6565b804710156108965760405163c52e3eff60e01b815260040160405180910390fd5b6002546040516000916001600160a01b03169083908381818185875af1925050503d80600081146108e3576040519150601f19603f3d011682016040523d82523d6000602084013e6108e8565b606091505b505090508061090a576040516349e7d1f760e11b815260040160405180910390fd5b6040518281527fdbb9aafb8a81f300a9bd8de82d212f728c70a559d9f97a731ac5fa7a4eac8d57906020015b60405180910390a15050565b61094a611df6565b60085460ff161561096e57604051633844da5760e21b815260040160405180910390fd5b811580610979575080155b1561099757604051635435b28960e11b815260040160405180910390fd5b6005546000908152600b602052604090206006015460ff16156109cd576040516337a8964960e21b815260040160405180910390fd5b81600960008282546109df91906121ec565b90915550506009546003546040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa158015610a2f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a5391906121ff565b1015610a725760405163c52e3eff60e01b815260040160405180910390fd5b600560008154610a8190612218565b909155506040805160e08101825242808252600060208084018281528486018881526060808701858152608080890187815260a08a018c8152600160c08c01818152600580548c52600b8b529a8e90209c518d559751908c0155945160028b0155915160038a01559051600489015591518786015591516006909601805460ff191696151596909617909555915485519081529081018790529384018590528301527fca86df7652ce63c8499edbbe37ef4d7b5a36adf2aec7a6f232519630e084ee9c9101610936565b610b8d6040518060e001604052806000815260200160008152602001600081526020016000815260200160008152602001600081526020016000151581525090565b50600580546000908152600b6020908152604091829020825160e0810184528154815260018201549281019290925260028101549282019290925260038201546060820152600482015460808201529181015460a08301526006015460ff16151560c082015290565b610bfe611df6565b610c086000611e23565b565b6001600160a01b0382163314610c3357604051633006171960e21b815260040160405180910390fd5b7f000000000000000000000000000000000000000000000000000000e8d4a5100060075410610c7557604051639b6495af60e01b815260040160405180910390fd5b6001600160a01b0381166000908152600c602052604090205460ff16610cae5760405163c1ab6dc160e01b815260040160405180910390fd5b6005546000908152600b60205260409020541580610cea57506005546000908152600b60205260409020544290610ce89062278d006121ec565b115b15610d0857604051633c8440db60e21b815260040160405180910390fd5b6001600160a01b0382166000908152600a60205260409020805480610d405760405163c52e3eff60e01b815260040160405180910390fd5b8060076000828254610d52919061218a565b90915550506005546000908152600b602052604081206003018054839290610d7b90849061218a565b909155505060018201546005546000908152600b602052604081206002018054909190610da99084906121ec565b90915550506000600183018190558255610dcd6001600160a01b0384168583611e75565b604080516001600160a01b03861681524260208201527f358fe4192934d3bf28ae181feda1f4bd08ca67f5e2fad55582cce5eb67304ae9910160405180910390a150505050565b6000806000806000600460009054906101000a90046001600160a01b03166001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a060405180830381865afa158015610e6f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e93919061224b565b9450945050935093506000831215610ebe5760405163cb03080b60e01b815260040160405180910390fd5b8369ffffffffffffffffffff168169ffffffffffffffffffff161115610ef75760405163cb03080b60e01b815260040160405180910390fd5b610f03610e10836121ec565b421115610f235760405163cb03080b60e01b815260040160405180910390fd5b610f32836402540be40061229b565b94505050505090565b610f43611df6565b6003546001600160a01b0390811690831603610f725760405163c1ab6dc160e01b815260040160405180910390fd5b600254610f8c906001600160a01b03848116911683611e75565b604080516001600160a01b0384168152602081018390527f8c9a4f13b67cb64d7c6aa1ae0c9bf07694af521a28b93e7060020810ab4bc59f9101610936565b60085460009060ff1615610ff257604051633844da5760e21b815260040160405180910390fd5b6000610ffc610e14565b905060006c0c9f2c9cd04674edea4000000061101883346121d5565b61102291906121b3565b90507f0000000000000000000000000000000000000000000000000000000002faf08081108061107157507f000000000000000000000000000000000000000000000000000000e8d4a5100081115b1561108f5760405163c52e3eff60e01b815260040160405180910390fd5b600580546000908152600b6020908152604091829020825160e0810184528154815260018201549281019290925260028101549282019290925260038201546060820152600482015460808201529181015460a08301526006015460ff16151560c082018190526111125760405162631aa160e91b815260040160405180910390fd5b336000908152600a602052604081209061112b84611596565b9050826040015181846080015161114291906121ec565b111561134f5750600060c0830152426020830152608082018051604084015160a085015160078054670de0b6b3a7640000938590039283029390930492830190559182019092526060840180518301905282548201808455600184018054830190559091907f000000000000000000000000000000000000000000000000000000e8d4a5100010156111e757604051634b59155b60e11b815260040160405180910390fd5b600580546000908152600b60209081526040808320885181559188015160018301558701516002820155606087015160038201556080870151600482015560a08701519281019290925560c08601516006909201805460ff1916921515929092179091553387611257848961218a565b61126e906c0c9f2c9cd04674edea400000006121d5565b61127891906121b3565b604051600081818185875af1925050503d80600081146112b4576040519150601f19603f3d011682016040523d82523d6000602084013e6112b9565b606091505b50509050806112db576040516349e7d1f760e11b815260040160405180910390fd5b60008051602061234383398151915233836005548660405161130094939291906122cb565b60405180910390a1600554604080519182524260208301527f5fd10f55317279067840c290f477e517a8c8710cafd2fd5a09d34d4cba6ab826910160405180910390a150909695505050505050565b8382600001600082825461136391906121ec565b909155505081547f000000000000000000000000000000000000000000000000000000e8d4a5100010156113aa57604051634b59155b60e11b815260040160405180910390fd5b83600760008282546113bc91906121ec565b9250508190555080836080018181516113d591906121ec565b9052506060830180518591906113ec9083906121ec565b9052506001820180548291906000906114069084906121ec565b9091555050600580546000908152600b602090815260409182902086518155908601516001820155858201516002820155606086015160038201556080860151600482015560a08601518184015560c08601516006909101805460ff19169115159190911790559054905160008051602061234383398151915291611490913391889186906122cb565b60405180910390a195945050505050565b6114e36040518060e001604052806000815260200160008152602001600081526020016000815260200160008152602001600081526020016000151581525090565b506000908152600b6020908152604091829020825160e081018452815481526001820154928101929092526002810154928201929092526003820154606082015260048201546080820152600582015460a082015260069091015460ff16151560c082015290565b611553611df6565b60085460ff16611576576040516365603eed60e11b815260040160405180910390fd5b600254600354611593916001600160a01b03918216911683611e75565b50565b600580546000908152600b60205260408120909101548083816115bb576115bb61219d565b04670de0b6b3a764000002915050919050565b60085460009060ff16156115f557604051633844da5760e21b815260040160405180910390fd5b7f0000000000000000000000000000000000000000000000000000000002faf08083108061164257507f000000000000000000000000000000000000000000000000000000e8d4a5100083115b156116605760405163c52e3eff60e01b815260040160405180910390fd5b6001600160a01b0382166000908152600c602052604090205460ff166116995760405163c1ab6dc160e01b815260040160405180910390fd5b600580546000908152600b6020908152604091829020825160e0810184528154815260018201549281019290925260028101549282019290925260038201546060820152600482015460808201529181015460a08301526006015460ff16151560c0820181905261171c5760405162631aa160e91b815260040160405180910390fd5b336000908152600a602052604081209061173586611596565b9050826040015181846080015161174c91906121ec565b106118dd5750600060c0830152426020830152608082018051604084015160a085015160078054670de0b6b3a764000093859003928302939093049283019055918201909252606084018051830190528254820180845560018401805483019055919650907f000000000000000000000000000000000000000000000000000000e8d4a5100010156117f157604051634b59155b60e11b815260040160405180910390fd5b600580546000908152600b602090815260409182902086518155908601516001820155908501516002820155606085015160038201556080850151600482015560a08501519181019190915560c08401516006909101805460ff191691151591909117905561186b6001600160a01b038616333089611ed9565b60008051602061234383398151915233876005548460405161189094939291906122cb565b60405180910390a1600554604080519182524260208301527f5fd10f55317279067840c290f477e517a8c8710cafd2fd5a09d34d4cba6ab826910160405180910390a19250611a45915050565b858260000160008282546118f191906121ec565b909155505081547f000000000000000000000000000000000000000000000000000000e8d4a51000101561193857604051634b59155b60e11b815260040160405180910390fd5b856007600082825461194a91906121ec565b92505081905550808360800181815161196391906121ec565b90525060608301805187919061197a9083906121ec565b9052506001820180548291906000906119949084906121ec565b9091555050600580546000908152600b602090815260409182902086518155908601516001820155908501516002820155606085015160038201556080850151600482015560a08501519181019190915560c08401516006909101805460ff1916911515919091179055611a136001600160a01b038616333089611ed9565b600080516020612343833981519152338760055484604051611a3894939291906122cb565b60405180910390a1925050505b92915050565b6001600160a01b0381163314611a7457604051633006171960e21b815260040160405180910390fd5b7f000000000000000000000000000000000000000000000000000000e8d4a510006007541015611ab7576040516323edc94960e11b815260040160405180910390fd5b6000611ac28261078d565b905080600003611ae557604051637bba838960e01b815260040160405180910390fd5b6001600160a01b0382166000908152600a602052604081206002018054839290611b109084906121ec565b9091555050600354611b2c906001600160a01b03168383611e75565b604080516001600160a01b03841681526020810183905242918101919091527f9923b4306c6c030f2bdfbf156517d5983b87e15b96176da122cd4f2effa4ba7b90606001610936565b611b7d611df6565b6005546000908152600b602052604090206006015460ff1615611bb357604051638b67379f60e01b815260040160405180910390fd5b6009546003546040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa158015611bfe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c2291906121ff565b14611c4057604051637222ae5760e11b815260040160405180910390fd5b600580546000908152600b602052604080822042908190558354835291819020600601805460ff19166001179055915491517f10121979be41abd0ebf98da496ce14bf416a9069c2c2c6cebac3a14fd6b5123e92611ca5928252602082015260400190565b60405180910390a1565b6000806c0c9f2c9cd04674edea40000000611cc8610e14565b611cd290856121d5565b611cdc91906121b3565b9050611ce781611596565b9392505050565b611cf6611df6565b6005546000908152600b602052604090206006015460ff16611d2b57604051633844da5760e21b815260040160405180910390fd5b6008805460ff191660011790554260068190556040517f124d23a4c3d54589dd0d43a0e0d6c2e851c3666d89dd9fda45c4d6924d21c63e91611ca59190815260200190565b6000818152600b6020526040812060050154808203611d93576000915050611a45565b808481611da257611da261219d565b04670de0b6b3a76400000291505092915050565b611dbe611df6565b6001600160a01b038116611ded57604051631e4fbdf760e01b8152600060048201526024015b60405180910390fd5b61159381611e23565b6001546001600160a01b03163314610c085760405163118cdaa760e01b8152336004820152602401611de4565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6040516001600160a01b03838116602483015260448201839052611ed491859182169063a9059cbb906064015b604051602081830303815290604052915060e01b6020820180516001600160e01b038381831617835250505050611f18565b505050565b6040516001600160a01b038481166024830152838116604483015260648201839052611f129186918216906323b872dd90608401611ea2565b50505050565b6000611f2d6001600160a01b03841683611f7b565b90508051600014158015611f52575080806020019051810190611f5091906122f1565b155b15611ed457604051635274afe760e01b81526001600160a01b0384166004820152602401611de4565b6060611ce78383600084600080856001600160a01b03168486604051611fa19190612313565b60006040518083038185875af1925050503d8060008114611fde576040519150601f19603f3d011682016040523d82523d6000602084013e611fe3565b606091505b5091509150611ff3868383611ffd565b9695505050505050565b6060826120125761200d82612059565b611ce7565b815115801561202957506001600160a01b0384163b155b1561205257604051639996b31560e01b81526001600160a01b0385166004820152602401611de4565b5080611ce7565b8051156120695780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b80356001600160a01b038116811461209957600080fd5b919050565b6000602082840312156120b057600080fd5b611ce782612082565b6000602082840312156120cb57600080fd5b5035919050565b600080604083850312156120e557600080fd5b50508035926020909101359150565b6000806040838503121561210757600080fd5b61211083612082565b915061211e60208401612082565b90509250929050565b6000806040838503121561213a57600080fd5b61214383612082565b946020939093013593505050565b6000806040838503121561216457600080fd5b8235915061211e60208401612082565b634e487b7160e01b600052601160045260246000fd5b81810381811115611a4557611a45612174565b634e487b7160e01b600052601260045260246000fd5b6000826121d057634e487b7160e01b600052601260045260246000fd5b500490565b8082028115828204841417611a4557611a45612174565b80820180821115611a4557611a45612174565b60006020828403121561221157600080fd5b5051919050565b60006001820161222a5761222a612174565b5060010190565b805169ffffffffffffffffffff8116811461209957600080fd5b600080600080600060a0868803121561226357600080fd5b61226c86612231565b945060208601519350604086015192506060860151915061228f60808701612231565b90509295509295909350565b80820260008212600160ff1b841416156122b7576122b7612174565b8181058314821517611a4557611a45612174565b6001600160a01b0394909416845260208401929092526040830152606082015260800190565b60006020828403121561230357600080fd5b81518015158114611ce757600080fd5b6000825160005b81811015612334576020818601810151858301520161231a565b50600092019182525091905056fe22f6af6e13430e3e7b6418d01e6a48c1fbce5e8cb1698901fc95134b4b1c58ada264697066735822122088545ac4ef7bab821a38a1ee75608971f48ef0342b74543871f83c28855dfb2664736f6c63430008180033

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

0000000000000000000000000feea8f4779767623f3c01c8eb796d1f8af1967b0000000000000000000000009a64977ebf739dff35ed4281a4b5e833bfdb131400000000000000000000000000000000000000000000000000000000000061a8000000000000000000000000000000000000000000084595161401484a0000000000000000000000000000005f4ec3df9cbd43714fe2740f5e3616155c5b841900000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000002000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec7000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48

-----Decoded View---------------
Arg [0] : _treasuryWallet (address): 0x0FEEa8f4779767623f3C01c8eb796d1F8af1967b
Arg [1] : _nftfnToken (address): 0x9a64977eBF739DFf35eD4281a4b5E833BFdB1314
Arg [2] : usdRates (uint256): 25000
Arg [3] : tokenAllocation (uint256): 10000000000000000000000000
Arg [4] : ethPriceFeed (address): 0x5f4eC3Df9cbd43714FE2740f5E3616155c5b8419
Arg [5] : tokens (address[]): 0xdAC17F958D2ee523a2206206994597C13D831ec7,0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48

-----Encoded View---------------
9 Constructor Arguments found :
Arg [0] : 0000000000000000000000000feea8f4779767623f3c01c8eb796d1f8af1967b
Arg [1] : 0000000000000000000000009a64977ebf739dff35ed4281a4b5e833bfdb1314
Arg [2] : 00000000000000000000000000000000000000000000000000000000000061a8
Arg [3] : 000000000000000000000000000000000000000000084595161401484a000000
Arg [4] : 0000000000000000000000005f4ec3df9cbd43714fe2740f5e3616155c5b8419
Arg [5] : 00000000000000000000000000000000000000000000000000000000000000c0
Arg [6] : 0000000000000000000000000000000000000000000000000000000000000002
Arg [7] : 000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec7
Arg [8] : 000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48


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
Loading...
Loading
[ Download: CSV Export  ]
[ Download: CSV Export  ]

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