ETH Price: $3,254.73 (+0.02%)
Gas: 1 Gwei

Contract

0x57d8dc5eF3762395AB1E842473354CEc9Ab14f5B
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Approve202590442024-07-08 3:15:2319 days ago1720408523IN
0x57d8dc5e...c9Ab14f5B
0 ETH0.000069481.5011448
Transfer185810042023-11-16 0:55:59254 days ago1700096159IN
0x57d8dc5e...c9Ab14f5B
0 ETH0.0013442428.80495232
Transfer185809842023-11-16 0:51:59254 days ago1700095919IN
0x57d8dc5e...c9Ab14f5B
0 ETH0.0008091430.2292813
Exit Mine185753762023-11-15 6:01:35254 days ago1700028095IN
0x57d8dc5e...c9Ab14f5B
0 ETH0.0025174925.75524431
Exit Mine185753612023-11-15 5:58:35254 days ago1700027915IN
0x57d8dc5e...c9Ab14f5B
0 ETH0.0023538724.08130646
Exit Mine185744802023-11-15 3:01:11255 days ago1700017271IN
0x57d8dc5e...c9Ab14f5B
0 ETH0.1004530927.81563964
Exit Mine185682032023-11-14 5:58:47255 days ago1699941527IN
0x57d8dc5e...c9Ab14f5B
0 ETH0.0022568521.65613405
Approve184657402023-10-30 21:45:35270 days ago1698702335IN
0x57d8dc5e...c9Ab14f5B
0 ETH0.0011408224.67126915
Approve184567212023-10-29 15:25:47271 days ago1698593147IN
0x57d8dc5e...c9Ab14f5B
0 ETH0.0008298117.94544413
Approve184339762023-10-26 11:04:11274 days ago1698318251IN
0x57d8dc5e...c9Ab14f5B
0 ETH0.000510421
Approve184167422023-10-24 1:07:11277 days ago1698109631IN
0x57d8dc5e...c9Ab14f5B
0 ETH0.0014925732.23639475
Transfer184092972023-10-23 0:06:23278 days ago1698019583IN
0x57d8dc5e...c9Ab14f5B
0 ETH0.000334837.17499051
Transfer183999282023-10-21 16:39:11279 days ago1697906351IN
0x57d8dc5e...c9Ab14f5B
0 ETH0.0007070715.15149157
Approve183961762023-10-21 4:02:47280 days ago1697860967IN
0x57d8dc5e...c9Ab14f5B
0 ETH0.000292556.32192066
Approve183961582023-10-21 3:59:11280 days ago1697860751IN
0x57d8dc5e...c9Ab14f5B
0 ETH0.000295486.39343372
Transfer183657692023-10-16 21:57:23284 days ago1697493443IN
0x57d8dc5e...c9Ab14f5B
0 ETH0.0009326220
Miner Start183593152023-10-16 0:20:47285 days ago1697415647IN
0x57d8dc5e...c9Ab14f5B
0 ETH0.000258958.88743083
Transfer183492862023-10-14 14:42:59286 days ago1697294579IN
0x57d8dc5e...c9Ab14f5B
0 ETH0.000264155.66033889
Enter Mine183464922023-10-14 5:18:35286 days ago1697260715IN
0x57d8dc5e...c9Ab14f5B
0 ETH0.036156735.10347288
Continue Mining183421912023-10-13 14:53:23287 days ago1697208803IN
0x57d8dc5e...c9Ab14f5B
0 ETH0.000633048.278708
Continue Mining183421852023-10-13 14:52:11287 days ago1697208731IN
0x57d8dc5e...c9Ab14f5B
0 ETH0.000673698.81029612
Continue Mining183391042023-10-13 4:31:23288 days ago1697171483IN
0x57d8dc5e...c9Ab14f5B
0 ETH0.000473695.91141818
Approve182745422023-10-04 3:42:35297 days ago1696390955IN
0x57d8dc5e...c9Ab14f5B
0 ETH0.000137475.6560584
Continue Mining181245012023-09-13 2:46:35318 days ago1694573195IN
0x57d8dc5e...c9Ab14f5B
0 ETH0.000705128.81780596
Enter Mine181178552023-09-12 4:24:11319 days ago1694492651IN
0x57d8dc5e...c9Ab14f5B
0 ETH0.001446839.77595467
View all transactions

Latest 1 internal transaction

Advanced mode:
Parent Transaction Hash Block From To
171729722023-05-02 12:04:23451 days ago1683029063
0x57d8dc5e...c9Ab14f5B
 Contract Creation0 ETH
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Mida

Compiler Version
v0.8.19+commit.7dd6d404

Optimization Enabled:
Yes with 5000 runs

Other Settings:
default evmVersion
File 1 of 35 : Mida.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.18;

//  __  __ _____ _____
// |  \/  |_   _|  __ \   /\
// | \  / | | | | |  | | /  \
// | |\/| | | | | |  | |/ /\ \
// | |  | |_| |_| |__| / ____ \
// |_|  |_|_____|_____/_/    \_\
//
// Mida Token
// t.me/midatoken
// by: @korkey128k
//

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";

import "./Mida/Mineable.sol";

import "./MTM.sol";

contract Mida is ERC20, ReentrancyGuard, Mineable {

  // Mida Token Miner NFT
  MTM private immutable _mtm;
  address public mtm;

  address public constant BA_ADDRESS =
    address(0xd2dc058f4068ec0e42655F8a385Eb6333FB67ab6);

  uint128 internal constant RESOLUTION = 1e6;

  uint128 private constant TOTAL_SUPPLY =
    42_000_000_000_000 * RESOLUTION; // forty-two trillion

  uint128 private constant BA_ALLOCATION =
    TOTAL_SUPPLY / 2; // half of supply for liquidity

  uint128 private constant TOTAL_MINEABLE_SUPPLY =
    TOTAL_SUPPLY - BA_ALLOCATION; // twenty-one trillion

  uint128 private constant MSHARE_RATE =
    694_200; // 1 MShare == six hundred ninety four thousand, two hundred

  uint128 public pendingMidaMined;
  uint128 public totalMidaMined;

  event EnterMine(OwnerMiner ownerMiner);
  event RewardsClaim(address ownerAddress, uint rewardsAndPeriod);
  event MinerRetrieval(address ownerAddress, uint[] minerIds);

  error InvalidMTMOwner();
  error NotEnoughMSharesToMine();
  error ReloadPeriodNotStarted();
  error CannotEnterMineDuringMiningPeriod(uint timeToChangeStatus);
  error CannotEnterMineWithPendingRewards(uint rewards);
  error CannotRetreiveMtmsDuringMiningPeriod(uint timeToChangeStatus);
  error TotalSupplyHasBeenReached(uint maxSupply);
  error NoRewardsToClaim(address claimer);
  error NoMinersToRetrieve(address retriever);
  error OwnerIsMining(uint periodId);

  modifier notMining() {
    if(ownerMiner[_msgSender()].periodId == currentPeriod.periodId) {
      revert OwnerIsMining(currentPeriod.periodId);
    }

    _;
  }

  modifier minerStartable() {
    _;

    if(shouldStartMiner()) {
      minerStart();
    }
  }

  modifier minerEndable() {
    if(shouldEndMiner()) {
      minerEnd();
    }

    _;
  }

  modifier onlyReload() {
    if(currentPeriod.status != PeriodStatus.Reload) {
      revert CannotEnterMineDuringMiningPeriod(currentPeriod.timeToChangeStatus);
    }

    _;
  }

  modifier maxSupplyNotReached() {
    if(pendingMidaMined + totalSupply() == maxSupply()) {
      revert TotalSupplyHasBeenReached(maxSupply());
    }

    _;
  }

  constructor(uint64 _launchTime) ERC20("Mida", "MIDA") Mineable(_launchTime) {
    _mint(BA_ADDRESS, BA_ALLOCATION);

    mtm = address(new MTM());
    _mtm = MTM(mtm);
  }

  function maxSupply() public pure returns(uint128) {
    return TOTAL_SUPPLY;
  }

  function mineableSupply() public pure returns(uint128) {
    return TOTAL_MINEABLE_SUPPLY;
  }

  function mShareRate() public pure returns(uint128) {
    return MSHARE_RATE;
  }

  function decimals() public pure override returns(uint8) {
    return 6;
  }

  // @dev Public function for enterMine
  function enterMine(
    uint[] calldata mtmIds
  ) external
    nonReentrant
    maxSupplyNotReached
    notMining
    onlyReload
    minerStartable {
    _enterMine(mtmIds);
  }

  // @dev Public function to claim rewards && enterMine
  // Gas saving function to extract rewards and keep on mining
  function continueMining()
    external
    nonReentrant
    minerEndable
    maxSupplyNotReached
    notMining
    onlyReload
    minerStartable {
    _claimRewards();
    _reEnterMine();
  }

  // @dev Return all rewards and MTMs to miner & exit the mine
  function exitMine()
    external
    minerEndable
    notMining
    minerStartable {
    _claimRewards();
    _retreiveMtms();
  }

  // @dev Enter the 30 day mine
  // @param mtmIds array of MTM ids to enter the mine with
  function _enterMine(uint[] memory mtmIds) internal {
    OwnerMiner storage _ownerMiner = ownerMiner[_msgSender()];

    uint128 totalMPoints;

    for(uint i; i < mtmIds.length;) {
      uint mtmId = mtmIds[i];

      // If this mtm isn't owned by msgSender, revert out
      if(_mtm.ownerOf(mtmId) != _msgSender()) {
        revert InvalidMTMOwner();
      }

      (, uint128 mPoints, ) = _mtm.mtmStorage(mtmId);

      totalMPoints += uint128(mPoints);

      _mtm.enterMine(mtmId);

      _ownerMiner.mtmIds.push(mtmId);

      unchecked {
        i++;
      }
    }

    uint128 midaMining = _verifyRewards(totalMPoints * MSHARE_RATE);

    _ownerMiner.rewards += midaMining;
    _ownerMiner.periodId = currentPeriod.periodId;

    emit EnterMine(_ownerMiner);

  }

  // @dev It's assumed here that miners HAVE NOT been claimed.
  //      If they have, this fails with InvalidMTMOwner
  function _reEnterMine() internal {
    OwnerMiner storage _ownerMiner = ownerMiner[_msgSender()];

    uint[] memory mtmIds = _ownerMiner.mtmIds;

    uint128 totalMPoints;

    for(uint i; i < mtmIds.length;) {
      uint mtmId = mtmIds[i];

      // The inverse from _enterMine. Verify this mtm is burned using _mtm.burntOwners
      if(_mtm.burntOwners(mtmId) != _msgSender()) {
        revert InvalidMTMOwner();
      }

      (, uint128 mPoints, ) = _mtm.mtmStorage(mtmId);

      totalMPoints += uint128(mPoints);

      unchecked {
        i++;
      }
    }

    uint128 midaMining = _verifyRewards(totalMPoints * MSHARE_RATE);

    _ownerMiner.rewards += midaMining;
    _ownerMiner.periodId = currentPeriod.periodId;

    emit EnterMine(_ownerMiner);

    if(shouldStartMiner()) {
      minerStart();
    }
  }

  function _claimRewards() internal {
    OwnerMiner storage _ownerMiner = ownerMiner[_msgSender()];
    uint128 rewards = _ownerMiner.rewards;
    uint56 periodId = _ownerMiner.periodId;

    if(rewards == 0) {
      revert NoRewardsToClaim(_msgSender());
    }

    _ownerMiner.rewards = uint128(0);
    _ownerMiner.periodId = uint56(0);

    _mint(_msgSender(), rewards);
    pendingMidaMined -= rewards;

    emit RewardsClaim(_msgSender(), uint(rewards) | uint(periodId) << 128);
  }

  // @dev Claim MTMs
  // @notice Only MTMs that aren't mining are claimable
  function _retreiveMtms() internal {
    OwnerMiner storage _ownerMiner = ownerMiner[_msgSender()];

    uint[] memory miners = _ownerMiner.mtmIds;

    if(miners.length == 0) {
      revert NoMinersToRetrieve(_msgSender());
    }

    for(uint i; i < miners.length;) {

      _mtm.exitMine(miners[i]);

      unchecked {
        i++;
      }
    }

    delete _ownerMiner.mtmIds;

    emit MinerRetrieval(_msgSender(), miners);
  }

  //TODO maybe come back to this
  function _verifyRewards(uint128 midaMining) internal returns(uint128) {
    if(midaMining == 0) {
      revert NotEnoughMSharesToMine();
    }

    // Do these MIDA push us over totalSupply?
    uint128 supplyAfterMining = pendingMidaMined + midaMining;

    if(supplyAfterMining + totalSupply() > maxSupply()) {
      // Reduce this midaMining so we hit maxSupply()
      midaMining -= uint128(supplyAfterMining + totalSupply() - maxSupply());
    }

    totalMidaMined += midaMining;
    currentPeriod.totalMidaMined += midaMining;
    pendingMidaMined += midaMining;

    return midaMining;
  }

}

File 2 of 35 : MTM.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.18;

//  __  __ _______ __  __
// |  \/  |__   __|  \/  |
// | \  / |  | |  | \  / |
// | |\/| |  | |  | |\/| |
// | |  | |  | |  | |  | |
// |_|  |_|  |_|  |_|  |_|
//
// Mida Token Miner
// t.me/midatoken
// by: @korkey128k
//

import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Burnable.sol";

import "@openzeppelin/contracts/utils/Counters.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";

import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/utils/Base64.sol";

import "./MTM/inc/MTMLibrary.sol";
import "./MTM/MShareCalculable.sol";

interface MIDA {
  function totalMidaMined() external view returns (uint128);
  function mineableSupply() external view returns (uint);
}

// Split it up if can (split into more nfts for sending n stuff)

contract MTM is ERC721, ReentrancyGuard, MShareCalculable {
  using { MTMLibrary.decimals, MTMLibrary.isStable, MTMLibrary.name } for address;
  using Counters for Counters.Counter;

  Counters.Counter private _tokenIdCounter;

  address private immutable OWNER;
  MIDA private immutable _mida;

  address public constant BA_ADDRESS =
    address(0xd2dc058f4068ec0e42655F8a385Eb6333FB67ab6);

  struct _MTMVariables {
    address tokenAddress;
    uint96 requestedMPoints;
  }

  struct MTMVariables {
    uint128 tokenAmount;
    uint96 mPoints;
    address tokenAddress;
  }

  // Key: tokenId
  mapping(uint => MTMVariables) public mtmStorage;
  mapping(uint => address) public burntOwners;

  event MtmMint(uint mtmVariables, address tokenAddress, address minter, uint tokenId);

  error MTMMintIsOver();
  error InvalidTokenAddress(address tokenAddress);
  error NotOwner();

  modifier onlyOwner() {
    if (_msgSender() != OWNER) {
      revert NotOwner();
    }
    _;
  }

  constructor() ERC721("Mida Token Miner", "MTM") {
    OWNER = _msgSender();
    _mida = MIDA(OWNER);
  }

  function owner() external view returns (address) {
    return OWNER;
  }

  // @dev Get the current token amount for mSharesAmount
  // @return the total tokenAmount for this token & requestedMPoints
  function calcTokenAmt(address tokenAddress, uint requestedMPoints) public view returns(uint) {
    uint tokenDecimals = tokenAddress.decimals();
    uint oneHunderedWeiInToken = 100 * (10 ** tokenDecimals);

    uint mPointsPerOneHunderedTokens = calcMTMPoints(tokenAddress, oneHunderedWeiInToken);
    uint totalTokenAmount =
      ((requestedMPoints * oneHunderedWeiInToken) / (mPointsPerOneHunderedTokens));

    return totalTokenAmount;
  }

  // @dev Get the current M-Shares in USD (or converted from ETH) for this token & amount
  // @return the total M-Points for this token & amount
  function calcMTMPoints(address tokenAddress, uint tokenAmount) public view returns(uint) {
    if(!isTokenAvailableForMTM(tokenAddress)) {
      revert InvalidTokenAddress(tokenAddress);
    }

    uint amountUSD = _tokenToUSDPrice(tokenAddress, tokenAmount);
    uint mPoints = amountUSD / MPOINT_RATE_PER_USD;

    return mPoints;
  }

  // @dev Helper function to bulk mint MTMs
  function mint(
    _MTMVariables[] calldata _mtmVariables
  ) external payable nonReentrant {
    for(uint i; i < _mtmVariables.length;) {

      _mintSingle(_mtmVariables[i]);

      unchecked {
        i++;
      }
    }
  }

  // @dev Mint an MTM, sending the required tokens to the BA
  function _mintSingle(
    _MTMVariables calldata _mtmVariable
  ) private {
    // Check if mint is over
    if(_mtmMintIsOver()) {
      revert MTMMintIsOver();
    }

    uint tokenId = _tokenIdCounter.current();
    _tokenIdCounter.increment();

    uint128 tokenAmount =
      uint128(calcTokenAmt(_mtmVariable.tokenAddress, _mtmVariable.requestedMPoints));

    mtmStorage[tokenId] = MTMVariables({
      tokenAddress: address(_mtmVariable.tokenAddress),
      tokenAmount: tokenAmount,
      mPoints: _mtmVariable.requestedMPoints
    });

    // If this is ether (address(0) for our dapp), just transfer. No erc20 action
    if(_mtmVariable.tokenAddress == address(0)) {

      (bool sent, /* bytes memory data */) = payable(BA_ADDRESS).call{value: tokenAmount}("");
      require(sent, "Failed to send ether for MTM");

    } else {

      IERC20(_mtmVariable.tokenAddress).transferFrom(
        _msgSender(), BA_ADDRESS, tokenAmount
      );

    }

    _safeMint(_msgSender(), tokenId);

    emit MtmMint(
      uint(tokenAmount) | uint(_mtmVariable.requestedMPoints) << 128,
      _mtmVariable.tokenAddress,
      _msgSender(),
      tokenId
    );
  }

  // @dev Helper function to bulk BURN MTMs.
  function bulkBurn(uint[] calldata tokenIds) external {
    for(uint i; i < tokenIds.length;) {

      burn(tokenIds[i]);

      unchecked {
        i++;
      }
    }
  }

  // @notice BURN BABY BURN! 🔥
  function burn(uint tokenId) public {
    require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not token owner or approved");

    // This token is actually being deleted, remove the storage for gas savings
    delete mtmStorage[tokenId];

    _burn(tokenId);
  }

  // @dev Called by the Mida contract; Remove this MTM from supply
  // @notice fails silently
  function enterMine(uint tokenId) external onlyOwner {
    if(_exists(tokenId)) {
      burntOwners[tokenId] = ownerOf(tokenId);
      _burn(tokenId);
    }
  }

  // @dev Called by the Mida contract; Mint this MTM back to owner
  // @notice fails silently
  function exitMine(uint tokenId) external onlyOwner {
    if(!_exists(tokenId)) {
      _safeMint(burntOwners[tokenId], tokenId);
      delete burntOwners[tokenId];
    }
  }

  // @returns bool Has the mida total supply reached half yet?
  function _mtmMintIsOver() internal view returns(bool) {
    return _mida.totalMidaMined() > (_mida.mineableSupply() / 2);
  }

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

    MTMVariables storage _mtmStorage = mtmStorage[tokenId];

    string memory nftUri;

    if(_mtmStorage.mPoints >= (25_000 * MSHARE_RESOLUTION)) {
      nftUri = 'ipfs://bafybeidfnk5mcpksyxfs4mzawwbnesjwner7m3lzdahfubzwkf2dyw35uy';
    } else if(_mtmStorage.mPoints >= (5_000 * MSHARE_RESOLUTION)) {
      nftUri = 'ipfs://bafybeihpwkikpgi7cqctarsdjxt33x2qvnw6oo6yvdrewua4naczleeqma';
    } else {
      nftUri = 'ipfs://bafybeiegxov7grvrpzqvaxxky2jp5zhv5a7r6xw24c7xtcsy3ihvmix3ju';
    }

    uint tokenDecimals = _mtmStorage.tokenAddress.decimals();

    string memory tokenAmountForDisplay;
    string memory tokenAmountAsString = Strings.toString(_mtmStorage.tokenAmount);
    uint tokenAmountConverted =
      _mtmStorage.tokenAmount / (10 ** tokenDecimals);

    // Is the amount below 1 if converted?
    if(tokenAmountConverted == 0) {
      uint leftJust =
        tokenDecimals - bytes(tokenAmountAsString).length;

      bytes memory zeros = new bytes(leftJust);
      for (uint j = 0; j < leftJust; j++) {
        zeros[j] = '0';
      }

      tokenAmountForDisplay =
        string(abi.encodePacked('0.', zeros, tokenAmountAsString));
    } else {
      uint tokenAmountLength = bytes(tokenAmountAsString).length;
      uint convertedLength = bytes(Strings.toString(tokenAmountConverted)).length;

      tokenAmountForDisplay =
        string(abi.encodePacked(
          Strings.toString(tokenAmountConverted),
          '.',
          _substr(tokenAmountAsString, convertedLength, tokenAmountLength)
        ));
    }

    string memory mPointsForDisplay = Strings.toString(_mtmStorage.mPoints / MSHARE_RESOLUTION);

    string memory mPointsAttribute = string(abi.encodePacked(
      '{',
        '"key": "MPoints", ',
        '"trait_type": "MPoints", ',
        '"value": "', mPointsForDisplay, '"',
      '}, '
    ));

    string memory tokenUsedAttribute = string(abi.encodePacked(
      '{',
        '"key": "Token Used to Mint", ',
        '"trait_type": "Token Used to Mint", ',
        '"value": "', _mtmStorage.tokenAddress.name(), '"',
      '}, '
    ));

    string memory tokensSpentAttribute = string(abi.encodePacked(
      '{',
        '"key": "Tokens Spent", ',
        '"trait_type": "Tokens Spent", ',
        '"value": "', tokenAmountForDisplay, '"',
      '}'
    ));

    return string(abi.encodePacked('data:application/json;base64,', Base64.encode(abi.encodePacked(
      '{',
        '"name": "MTM | ', mPointsForDisplay, ' MPoints', '", ',
        '"external_url": "https://midatoken.app/mtm-mint", ',
        '"image": "', nftUri, '", ',
        '"attributes": [',
          mPointsAttribute, tokenUsedAttribute, tokensSpentAttribute,
        ']',
      '}'
    ))));
  }

  function _substr(string memory str, uint startIndex, uint endIndex) public pure returns (string memory ) {
    bytes memory strBytes = bytes(str);
    bytes memory result = new bytes(endIndex-startIndex);
    for(uint i = startIndex; i < endIndex; i++) {
        result[i-startIndex] = strBytes[i];
    }
    return string(result);
  }
}

File 3 of 35 : Mineable.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.18;

import "@openzeppelin/contracts/security/ReentrancyGuard.sol";

abstract contract Mineable is ReentrancyGuard {
  uint64 public constant INIT_RELOAD_PERIOD = 5 days;
  uint64 public constant MINING_DURATION = 30 days;
  uint64 public constant RELOAD_PERIOD = 2 days;

  mapping(address => OwnerMiner) public ownerMiner;

  Period public currentPeriod;

  enum PeriodStatus { Reload, Mining }

  struct Period {
    uint128 totalMidaMined;
    uint64 timeToChangeStatus;
    uint56 periodId;
    PeriodStatus status;
  }

  struct OwnerMiner {
    uint128 rewards;
    uint56 periodId;
    uint[] mtmIds;
  }

  event PeriodChange(uint64 timeToChange, uint56 periodId, uint8 status);

  error NoMinersMining();
  error NotTimeToStartMinerYet(uint64 timeToChange, uint blockTimestamp);
  error NotTimeToEndMinerYet(uint64 timeToChange, uint blockTimestamp);
  error MinerAlreadyStarted();
  error MinerIsNotRunning();

  constructor(uint64 _launchTime) {
    currentPeriod = Period({
      timeToChangeStatus: _launchTime + INIT_RELOAD_PERIOD,
      totalMidaMined: uint128(0),
      status: PeriodStatus.Reload,
      periodId: uint56(1)
    });
  }

  // @dev The public function to start the miner.
  // @notice Generally, this will be called by the miners exiting/entering
  // If we must though, we can run it manually
  function minerStart() public {
    _verifyMinerStart();

    _minerStart();
  }

  // @dev The public function to end the miner.
  // @notice Generally, this will be called by the miners exiting/entering
  // If we must though, we can run it manually
  function minerEnd() public {
    _verifyMinerEnd();

    _minerEnd();
  }

  function _minerStart() private {
    currentPeriod.status = PeriodStatus.Mining;

    currentPeriod.timeToChangeStatus += MINING_DURATION;

    emit PeriodChange(
      currentPeriod.timeToChangeStatus,
      currentPeriod.periodId,
      uint8(currentPeriod.status)
    );
  }

  function _minerEnd() private {
    currentPeriod.totalMidaMined = uint128(0);
    currentPeriod.status = PeriodStatus.Reload;

    currentPeriod.timeToChangeStatus += RELOAD_PERIOD;
    currentPeriod.periodId += 1;

    emit PeriodChange(
      currentPeriod.timeToChangeStatus,
      currentPeriod.periodId,
      uint8(currentPeriod.status)
    );
  }

  function _verifyMinerStart() private view {
    // Are we currently mining? If so, that's a no fo sho tho
    if(currentPeriod.status == PeriodStatus.Mining) {
      revert MinerAlreadyStarted();
    }

    // Is it time?
    if(!_timeToChangeStatus()) {
      revert NotTimeToStartMinerYet(currentPeriod.timeToChangeStatus, block.timestamp);
    }

    // Do we actually have miners mining?
    if(currentPeriod.totalMidaMined == 0) {
      revert NoMinersMining();
    }
  }

  function _verifyMinerEnd() private view {
    // Are we currently NOT mining? If so, no go fo sho tho
    if(currentPeriod.status == PeriodStatus.Reload) {
      revert MinerIsNotRunning();
    }

    // Is it time?
    if(!_timeToChangeStatus()) {
      revert NotTimeToEndMinerYet(currentPeriod.timeToChangeStatus, block.timestamp);
    }
  }

  function shouldStartMiner() public view returns(bool) {
    return _timeToChangeStatus() && currentPeriod.status == PeriodStatus.Reload &&
           currentPeriod.totalMidaMined > 0;
  }

  function shouldEndMiner() public view returns(bool) {
    return _timeToChangeStatus() && currentPeriod.status == PeriodStatus.Mining;
  }

  function _timeToChangeStatus() public view returns(bool) {
    return currentPeriod.timeToChangeStatus <= block.timestamp;
  }

}

File 4 of 35 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;

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

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

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        _nonReentrantBefore();
        _;
        _nonReentrantAfter();
    }

    function _nonReentrantBefore() private {
        // On the first call to nonReentrant, _status will be _NOT_ENTERED
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

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

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

File 5 of 35 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @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 amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

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

    /**
     * @dev Moves `amount` 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 amount) 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 `amount` 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 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `from` to `to` using the
     * allowance mechanism. `amount` 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 amount
    ) external returns (bool);
}

File 6 of 35 : ERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/ERC20.sol)

pragma solidity ^0.8.0;

import "./IERC20.sol";
import "./extensions/IERC20Metadata.sol";
import "../../utils/Context.sol";

/**
 * @dev Implementation of the {IERC20} interface.
 *
 * This implementation is agnostic to the way tokens are created. This means
 * that a supply mechanism has to be added in a derived contract using {_mint}.
 * For a generic mechanism see {ERC20PresetMinterPauser}.
 *
 * TIP: For a detailed writeup see our guide
 * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How
 * to implement supply mechanisms].
 *
 * We have followed general OpenZeppelin Contracts guidelines: functions revert
 * instead returning `false` on failure. This behavior is nonetheless
 * conventional and does not conflict with the expectations of ERC20
 * applications.
 *
 * Additionally, an {Approval} event is emitted on calls to {transferFrom}.
 * This allows applications to reconstruct the allowance for all accounts just
 * by listening to said events. Other implementations of the EIP may not emit
 * these events, as it isn't required by the specification.
 *
 * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
 * functions have been added to mitigate the well-known issues around setting
 * allowances. See {IERC20-approve}.
 */
contract ERC20 is Context, IERC20, IERC20Metadata {
    mapping(address => uint256) private _balances;

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

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

    /**
     * @dev Sets the values for {name} and {symbol}.
     *
     * The default value of {decimals} is 18. To select a different value for
     * {decimals} you should overload it.
     *
     * All two of these values are immutable: they can only be set once during
     * construction.
     */
    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

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

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

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

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

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

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

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

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

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

    /**
     * @dev Atomically increases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     */
    function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
        address owner = _msgSender();
        _approve(owner, spender, allowance(owner, spender) + addedValue);
        return true;
    }

    /**
     * @dev Atomically decreases the allowance granted to `spender` by the caller.
     *
     * This is an alternative to {approve} that can be used as a mitigation for
     * problems described in {IERC20-approve}.
     *
     * Emits an {Approval} event indicating the updated allowance.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `spender` must have allowance for the caller of at least
     * `subtractedValue`.
     */
    function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
        address owner = _msgSender();
        uint256 currentAllowance = allowance(owner, spender);
        require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
        unchecked {
            _approve(owner, spender, currentAllowance - subtractedValue);
        }

        return true;
    }

    /**
     * @dev Moves `amount` of tokens from `from` to `to`.
     *
     * This internal function is equivalent to {transfer}, and can be used to
     * e.g. implement automatic token fees, slashing mechanisms, etc.
     *
     * Emits a {Transfer} event.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `from` must have a balance of at least `amount`.
     */
    function _transfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual {
        require(from != address(0), "ERC20: transfer from the zero address");
        require(to != address(0), "ERC20: transfer to the zero address");

        _beforeTokenTransfer(from, to, amount);

        uint256 fromBalance = _balances[from];
        require(fromBalance >= amount, "ERC20: transfer amount exceeds balance");
        unchecked {
            _balances[from] = fromBalance - amount;
            // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by
            // decrementing then incrementing.
            _balances[to] += amount;
        }

        emit Transfer(from, to, amount);

        _afterTokenTransfer(from, to, amount);
    }

    /** @dev Creates `amount` tokens and assigns them to `account`, increasing
     * the total supply.
     *
     * Emits a {Transfer} event with `from` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function _mint(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: mint to the zero address");

        _beforeTokenTransfer(address(0), account, amount);

        _totalSupply += amount;
        unchecked {
            // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.
            _balances[account] += amount;
        }
        emit Transfer(address(0), account, amount);

        _afterTokenTransfer(address(0), account, amount);
    }

    /**
     * @dev Destroys `amount` tokens from `account`, reducing the
     * total supply.
     *
     * Emits a {Transfer} event with `to` set to the zero address.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     * - `account` must have at least `amount` tokens.
     */
    function _burn(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: burn from the zero address");

        _beforeTokenTransfer(account, address(0), amount);

        uint256 accountBalance = _balances[account];
        require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
        unchecked {
            _balances[account] = accountBalance - amount;
            // Overflow not possible: amount <= accountBalance <= totalSupply.
            _totalSupply -= amount;
        }

        emit Transfer(account, address(0), amount);

        _afterTokenTransfer(account, address(0), amount);
    }

    /**
     * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
     *
     * This internal function is equivalent to `approve`, and can be used to
     * e.g. set automatic allowances for certain subsystems, etc.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `owner` cannot be the zero address.
     * - `spender` cannot be the zero address.
     */
    function _approve(
        address owner,
        address spender,
        uint256 amount
    ) internal virtual {
        require(owner != address(0), "ERC20: approve from the zero address");
        require(spender != address(0), "ERC20: approve to the zero address");

        _allowances[owner][spender] = amount;
        emit Approval(owner, spender, amount);
    }

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

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

    /**
     * @dev Hook that is called after any transfer of tokens. This includes
     * minting and burning.
     *
     * Calling conditions:
     *
     * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
     * has been transferred to `to`.
     * - when `from` is zero, `amount` tokens have been minted for `to`.
     * - when `to` is zero, `amount` of ``from``'s tokens have been burned.
     * - `from` and `to` are never both zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _afterTokenTransfer(
        address from,
        address to,
        uint256 amount
    ) internal virtual {}
}

File 7 of 35 : MShareCalculable.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.18;

import "@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol";

import "./inc/MTMLibrary.sol";
import "./inc/UniswapV3.sol";
import "./inc/UniswapV2.sol";

abstract contract MShareCalculable is UniswapV3, UniswapV2 {
  using { MTMLibrary.isStable, MTMLibrary.isEther, MTMLibrary.decimals } for address;
  mapping(address => MTMLibrary.Pool) public availableTokens;

  uint public constant MSHARE_DECIMALS = 6;
  uint internal immutable MSHARE_RESOLUTION;
  uint public immutable MPOINT_RATE;
  uint public immutable MPOINT_RATE_PER_USD;

  error TokenIsNotAvailableForMTM(address token);

  constructor() {

    MSHARE_RESOLUTION = 10 ** MSHARE_DECIMALS;

    // MPOINT_RATE == $1
    MPOINT_RATE = 1 * MSHARE_RESOLUTION;

    MPOINT_RATE_PER_USD = MSHARE_RESOLUTION / MPOINT_RATE;

    // Setup the token lookup map;
    // Loop through all pools, set their corresponding tokens to the pools for lookup
    uint poolsLength = MTMLibrary.availablePools().length;
    for(uint i; i < poolsLength;) {
      MTMLibrary.Pool memory pool = MTMLibrary.availablePools()[i];

      address token = _getTokenAddressFromPair(pool);

      availableTokens[token] = pool;

      unchecked {
        i++;
      }
    }
  }

  // @dev Determine if token is available for minting M-Shares
  function isTokenAvailableForMTM(address token) public view returns(bool) {
    if(token == address(0)) {
      return true;
    }

    return
      availableTokens[token].poolAddress != address(0) ||
      token.isStable() ||
      token.isEther();
  }

  // @dev return the token price within their respective pool
  // @returns token price
  function _tokenToUSDPrice(address token, uint amount) internal view returns(uint) {
    uint usdPrice;

    // If token is a stable coin, it's price is always 1 (at least for MTMs)
    if(token.isStable()) {

      usdPrice = (amount * MSHARE_RESOLUTION) / (10 ** token.decimals());

    } else if(token.isEther()) {

      usdPrice = (etherV3Price() * amount) / 1e18;

    } else {

      MTMLibrary.Pool storage pool = availableTokens[token];

      usdPrice = _getUSDPrice(pool, amount) / (10 ** token.decimals());

    }

    return usdPrice;
  }

  function _getTokenAddressFromPair(MTMLibrary.Pool memory pool) private view returns(address) {
    if(pool.isV2) {
      return getV2TokenAddressFromPair(pool.poolAddress);
    } else {
      return getV3TokenAddressFromPair(pool.poolAddress);
    }
  }

  function _getUSDPrice(MTMLibrary.Pool memory pool, uint amount) private view returns(uint) {
    if(pool.isV2) {
      return getV2TokenPrice(pool.poolAddress, amount);
    } else {
      return getV3TokenPrice(pool.poolAddress, amount);
    }
  }
}

File 8 of 35 : MTMLibrary.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.18;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";

library MTMLibrary {

  // @dev Pool details are stored in memory for cheaper lookup
  struct Pool{
    address poolAddress;
    bool isV2;
  }

  // Stable Coins
  address internal constant USDT_ADDRESS = address(0xdAC17F958D2ee523a2206206994597C13D831ec7);
  address internal constant USDC_ADDRESS = address(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);
  address internal constant LUSD_ADDRESS = address(0x5f98805A4E8be255a32880FDeC7F6728C6568bA0);
  address internal constant GUSD_ADDRESS = address(0x056Fd409E1d7A124BD7017459dFEa2F387b6d5Cd);
  address internal constant FRAX_ADDRESS = address(0x853d955aCEf822Db058eb8505911ED77F175b99e);
  address internal constant USDP_ADDRESS = address(0x1456688345527bE1f37E9e627DA0837D6f08C925);
  address internal constant MIM_ADDRESS = address(0x99D8a9C45b2ecA8864373A26D1459e3Dff1e17F3);
  address internal constant DAI_ADDRESS = address(0x6B175474E89094C44Da98b954EedeAC495271d0F);
  address internal constant USDD_ADDRESS = address(0x0C10bF8FcB7Bf5412187A595ab97a3609160b5c6);
  address internal constant FEI_ADDRESS = address(0x956F47F50A910163D8BF957Cf5846D573E7f87CA);

  // WETH
  address internal constant WETH_ADDRESS = address(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);
  address internal constant WETH_USDC_POOL = address(0x88e6A0c2dDD26FEEb64F039a2c41296FcB3f5640);
  address internal constant WETH_USDT_POOL = address(0x0d4a11d5EEaaC28EC3F61d100daF4d40471f1852);

  uint8 internal constant TWAP_INTERVAL = 15;

  // @dev An array of all available pools for MTM minting
  function availablePools() internal pure returns(Pool[17] memory) {
    return [
      Pool(0xCBCdF9626bC03E24f779434178A73a0B4bad62eD, false), // WBTC
      Pool(0x3328CA5b535D537F88715b305375C591cF52d541, false), // PLSD
      Pool(0x25c0eDc51909fc20429c6EcE9B8F4FBB5af13878, false), // ASIC
      Pool(0xA5eF2a6BbE8852BD6fd2EF6AB9bB45081a6F531C, false), // PLSB
      Pool(0x2F62f2B4c5fcd7570a709DeC05D68EA19c82A9ec, false), // SHIB
      Pool(0x69D91B94f0AaF8e8A2586909fA77A5c2c89818d5, false), // HEX
      Pool(0xE859041c9C6D70177f83DE991B9d757E13CEA26E, false), // HDRN
      Pool(0x3aAf77ba7Da262e34dFfb9B10fC6777BfDA79Ab7, false), // ICSA
      Pool(0x2a9d2ba41aba912316D16742f259412B681898Db, false), // XEN
      Pool(0x30aA16699d08A6af61b7D1860845C4855b86713e, false), // DXN
      Pool(0x2CA1D6950182D28434f89A719ED9E915b8c417B5, false), // DBI
      Pool(0xA43fe16908251ee70EF74718545e4FE6C5cCEc9f, true), // PEPE
      Pool(0x0F23d49bC92Ec52FF591D091b3e16c937034496E, true), // WOJAK
      Pool(0x5281E311734869C64ca60eF047fd87759397EFe6, true), // CULT
      Pool(0xA5e9C917b4B821e4E0A5bbeFce078Ab6540d6B5E, true), // STARL
      Pool(0x2dB388d12c56fA6Bd81b101Aa6Ec8542e315eC5C, true), // CHAD
      Pool(0x6591c4BcD6D7A1eb4E537DA8B78676C1576Ba244, true) // BOND
    ];
  }

  function name(address token) internal view returns(string memory) {
    if(token == address(0)) {
      return 'Ethereum';
    } else {
      return ERC20(token).name();
    }
  }

  function decimals(address token) internal view returns(uint) {
    if(token == address(0)) {
      return 18;
    } else {
      return ERC20(token).decimals();
    }
  }

  function isStable(address token) internal pure returns(bool) {
    return
      token == USDT_ADDRESS ||
      token == USDC_ADDRESS ||
      token == LUSD_ADDRESS ||
      token == GUSD_ADDRESS ||
      token == FRAX_ADDRESS ||
      token == USDP_ADDRESS ||
      token == MIM_ADDRESS  ||
      token == DAI_ADDRESS  ||
      token == USDD_ADDRESS ||
      token == FEI_ADDRESS;
  }

  function isEther(address token) internal pure returns(bool) {
    return token == WETH_ADDRESS || token == address(0);
  }

}

File 9 of 35 : Base64.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (utils/Base64.sol)

pragma solidity ^0.8.0;

/**
 * @dev Provides a set of functions to operate with Base64 strings.
 *
 * _Available since v4.5._
 */
library Base64 {
    /**
     * @dev Base64 Encoding/Decoding Table
     */
    string internal constant _TABLE = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";

    /**
     * @dev Converts a `bytes` to its Bytes64 `string` representation.
     */
    function encode(bytes memory data) internal pure returns (string memory) {
        /**
         * Inspired by Brecht Devos (Brechtpd) implementation - MIT licence
         * https://github.com/Brechtpd/base64/blob/e78d9fd951e7b0977ddca77d92dc85183770daf4/base64.sol
         */
        if (data.length == 0) return "";

        // Loads the table into memory
        string memory table = _TABLE;

        // Encoding takes 3 bytes chunks of binary data from `bytes` data parameter
        // and split into 4 numbers of 6 bits.
        // The final Base64 length should be `bytes` data length multiplied by 4/3 rounded up
        // - `data.length + 2`  -> Round up
        // - `/ 3`              -> Number of 3-bytes chunks
        // - `4 *`              -> 4 characters for each chunk
        string memory result = new string(4 * ((data.length + 2) / 3));

        /// @solidity memory-safe-assembly
        assembly {
            // Prepare the lookup table (skip the first "length" byte)
            let tablePtr := add(table, 1)

            // Prepare result pointer, jump over length
            let resultPtr := add(result, 32)

            // Run over the input, 3 bytes at a time
            for {
                let dataPtr := data
                let endPtr := add(data, mload(data))
            } lt(dataPtr, endPtr) {

            } {
                // Advance 3 bytes
                dataPtr := add(dataPtr, 3)
                let input := mload(dataPtr)

                // To write each character, shift the 3 bytes (18 bits) chunk
                // 4 times in blocks of 6 bits for each character (18, 12, 6, 0)
                // and apply logical AND with 0x3F which is the number of
                // the previous character in the ASCII table prior to the Base64 Table
                // The result is then added to the table to get the character to write,
                // and finally write it in the result pointer but with a left shift
                // of 256 (1 byte) - 8 (1 ASCII char) = 248 bits

                mstore8(resultPtr, mload(add(tablePtr, and(shr(18, input), 0x3F))))
                resultPtr := add(resultPtr, 1) // Advance

                mstore8(resultPtr, mload(add(tablePtr, and(shr(12, input), 0x3F))))
                resultPtr := add(resultPtr, 1) // Advance

                mstore8(resultPtr, mload(add(tablePtr, and(shr(6, input), 0x3F))))
                resultPtr := add(resultPtr, 1) // Advance

                mstore8(resultPtr, mload(add(tablePtr, and(input, 0x3F))))
                resultPtr := add(resultPtr, 1) // Advance
            }

            // When data `bytes` is not exactly 3 bytes long
            // it is padded with `=` characters at the end
            switch mod(mload(data), 3)
            case 1 {
                mstore8(sub(resultPtr, 1), 0x3d)
                mstore8(sub(resultPtr, 2), 0x3d)
            }
            case 2 {
                mstore8(sub(resultPtr, 1), 0x3d)
            }
        }

        return result;
    }
}

File 10 of 35 : Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)

pragma solidity ^0.8.0;

import "./math/Math.sol";

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

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

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

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

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

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

pragma solidity ^0.8.0;

/**
 * @title Counters
 * @author Matt Condon (@shrugs)
 * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number
 * of elements in a mapping, issuing ERC721 ids, or counting request ids.
 *
 * Include with `using Counters for Counters.Counter;`
 */
library Counters {
    struct Counter {
        // This variable should never be directly accessed by users of the library: interactions must be restricted to
        // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add
        // this feature: see https://github.com/ethereum/solidity/issues/4637
        uint256 _value; // default: 0
    }

    function current(Counter storage counter) internal view returns (uint256) {
        return counter._value;
    }

    function increment(Counter storage counter) internal {
        unchecked {
            counter._value += 1;
        }
    }

    function decrement(Counter storage counter) internal {
        uint256 value = counter._value;
        require(value > 0, "Counter: decrement overflow");
        unchecked {
            counter._value = value - 1;
        }
    }

    function reset(Counter storage counter) internal {
        counter._value = 0;
    }
}

File 12 of 35 : ERC721Burnable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/extensions/ERC721Burnable.sol)

pragma solidity ^0.8.0;

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

/**
 * @title ERC721 Burnable Token
 * @dev ERC721 Token that can be burned (destroyed).
 */
abstract contract ERC721Burnable is Context, ERC721 {
    /**
     * @dev Burns `tokenId`. See {ERC721-_burn}.
     *
     * Requirements:
     *
     * - The caller must own `tokenId` or be an approved operator.
     */
    function burn(uint256 tokenId) public virtual {
        //solhint-disable-next-line max-line-length
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not token owner or approved");
        _burn(tokenId);
    }
}

File 13 of 35 : ERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.2) (token/ERC721/ERC721.sol)

pragma solidity ^0.8.0;

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

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

    // Token name
    string private _name;

    // Token symbol
    string private _symbol;

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

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

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

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

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

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

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

    /**
     * @dev See {IERC721-ownerOf}.
     */
    function ownerOf(uint256 tokenId) public view virtual override returns (address) {
        address owner = _ownerOf(tokenId);
        require(owner != address(0), "ERC721: invalid token ID");
        return owner;
    }

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

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

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

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

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

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

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

        _approve(to, tokenId);
    }

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

        return _tokenApprovals[tokenId];
    }

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

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

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

        _transfer(from, to, tokenId);
    }

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

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

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

    /**
     * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist
     */
    function _ownerOf(uint256 tokenId) internal view virtual returns (address) {
        return _owners[tokenId];
    }

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

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

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

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

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

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

        // Check that tokenId was not minted by `_beforeTokenTransfer` hook
        require(!_exists(tokenId), "ERC721: token already minted");

        unchecked {
            // Will not overflow unless all 2**256 token ids are minted to the same owner.
            // Given that tokens are minted one by one, it is impossible in practice that
            // this ever happens. Might change if we allow batch minting.
            // The ERC fails to describe this case.
            _balances[to] += 1;
        }

        _owners[tokenId] = to;

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

        _afterTokenTransfer(address(0), to, tokenId, 1);
    }

    /**
     * @dev Destroys `tokenId`.
     * The approval is cleared when the token is burned.
     * This is an internal function that does not check if the sender is authorized to operate on the token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     *
     * Emits a {Transfer} event.
     */
    function _burn(uint256 tokenId) internal virtual {
        address owner = ERC721.ownerOf(tokenId);

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

        // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook
        owner = ERC721.ownerOf(tokenId);

        // Clear approvals
        delete _tokenApprovals[tokenId];

        unchecked {
            // Cannot overflow, as that would require more tokens to be burned/transferred
            // out than the owner initially received through minting and transferring in.
            _balances[owner] -= 1;
        }
        delete _owners[tokenId];

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

        _afterTokenTransfer(owner, address(0), tokenId, 1);
    }

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

        _beforeTokenTransfer(from, to, tokenId, 1);

        // Check that tokenId was not transferred by `_beforeTokenTransfer` hook
        require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner");

        // Clear approvals from the previous owner
        delete _tokenApprovals[tokenId];

        unchecked {
            // `_balances[from]` cannot overflow for the same reason as described in `_burn`:
            // `from`'s balance is the number of token held, which is at least one before the current
            // transfer.
            // `_balances[to]` could overflow in the conditions described in `_mint`. That would require
            // all 2**256 token ids to be minted, which in practice is impossible.
            _balances[from] -= 1;
            _balances[to] += 1;
        }
        _owners[tokenId] = to;

        emit Transfer(from, to, tokenId);

        _afterTokenTransfer(from, to, tokenId, 1);
    }

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

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

    /**
     * @dev Reverts if the `tokenId` has not been minted yet.
     */
    function _requireMinted(uint256 tokenId) internal view virtual {
        require(_exists(tokenId), "ERC721: invalid token ID");
    }

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

    /**
     * @dev Hook that is called before any token transfer. This includes minting and burning. If {ERC721Consecutive} is
     * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.
     *
     * Calling conditions:
     *
     * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.
     * - When `from` is zero, the tokens will be minted for `to`.
     * - When `to` is zero, ``from``'s tokens will be burned.
     * - `from` and `to` are never both zero.
     * - `batchSize` is non-zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 firstTokenId,
        uint256 batchSize
    ) internal virtual {}

    /**
     * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is
     * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.
     *
     * Calling conditions:
     *
     * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.
     * - When `from` is zero, the tokens were minted for `to`.
     * - When `to` is zero, ``from``'s tokens were burned.
     * - `from` and `to` are never both zero.
     * - `batchSize` is non-zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _afterTokenTransfer(
        address from,
        address to,
        uint256 firstTokenId,
        uint256 batchSize
    ) internal virtual {}

    /**
     * @dev Unsafe write access to the balances, used by extensions that "mint" tokens using an {ownerOf} override.
     *
     * WARNING: Anyone calling this MUST ensure that the balances remain consistent with the ownership. The invariant
     * being that for any address `a` the value returned by `balanceOf(a)` must be equal to the number of tokens such
     * that `ownerOf(tokenId)` is `a`.
     */
    // solhint-disable-next-line func-name-mixedcase
    function __unsafe_increaseBalance(address account, uint256 amount) internal {
        _balances[account] += amount;
    }
}

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

pragma solidity ^0.8.0;

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

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

File 15 of 35 : IERC20Metadata.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";

/**
 * @dev Interface for the optional metadata functions from the ERC20 standard.
 *
 * _Available since v4.1._
 */
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 16 of 35 : UniswapV2.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.18;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import '@uniswap/v2-core/contracts/interfaces/IUniswapV2Pair.sol';
import "./MTMLibrary.sol";

abstract contract UniswapV2 {
  using { MTMLibrary.isEther, MTMLibrary.isStable, MTMLibrary.decimals } for address;

  function getV2TokenPrice(
    address pairAddress, uint amount
  ) public view returns(uint) {

    IUniswapV2Pair pool = IUniswapV2Pair(pairAddress);
    (uint reserves0, uint reserves1,) = pool.getReserves();

    address token; address stableOrWeth;
    uint tokenPrice;

    if(pool.token1().isEther() || pool.token1().isStable()) {

      token = pool.token0();
      stableOrWeth = pool.token1();

      tokenPrice = (reserves1 * amount) / reserves0;

    } else if(pool.token0().isEther() || pool.token0().isStable()) {

      token = pool.token1();
      stableOrWeth = pool.token0();

      tokenPrice = (reserves0 * amount) / reserves1;

    } else {
      revert("Invalid Pair");
    }

    if(stableOrWeth.isEther()) {

      // Fix the resulting number from multiplication
      uint finalDecimals;
      if(token.decimals() != 18) {
        finalDecimals = 18 - token.decimals();
      }

      tokenPrice = (ethV2Price() * tokenPrice) / (10 ** finalDecimals);

    } else {

      tokenPrice = tokenPrice * (10 ** token.decimals());

    }

    return tokenPrice;

  }

  function ethV2Price() internal view returns(uint) {
    IUniswapV2Pair pool = IUniswapV2Pair(MTMLibrary.WETH_USDT_POOL);
    (uint reserves0, uint reserves1,) = pool.getReserves();
    return (reserves1 * 1e18) / reserves0; // 1e12 is eth decimals - usdt decimals
  }

  function getV2TokenAddressFromPair(address pairAddress) internal view returns(address) {
    IUniswapV2Pair pool = IUniswapV2Pair(pairAddress);

    if(pool.token1().isEther() || pool.token1().isStable()) {
      return pool.token0();
    } else {
      return pool.token1();
    }
  }

}

File 17 of 35 : UniswapV3.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.18;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol";
import "@uniswap/v3-core/contracts/libraries/FixedPoint96.sol";
import "./FullMath.sol";
import "./TickMath.sol";
import "./MTMLibrary.sol";

abstract contract UniswapV3 {
  using { MTMLibrary.isEther, MTMLibrary.isStable, MTMLibrary.decimals } for address;

  uint private constant Q96 = 2**96;

  function getV3TokenPrice(
    address pairAddress, uint amount
  ) internal view returns(uint) {

    IUniswapV3Pool pool = IUniswapV3Pool(pairAddress);
    uint poolPriceX96 = getPriceX96FromSqrtPriceX96(getSqrtTwapX96(pairAddress));

    address token; address stableOrWeth;
    uint tokenPrice;

    if(pool.token1().isEther() || pool.token1().isStable()) {

      token = pool.token0();
      stableOrWeth = pool.token1();

      tokenPrice = ((amount * poolPriceX96) / Q96);

    } else if(pool.token0().isEther() || pool.token0().isStable()) {

      token = pool.token1();
      stableOrWeth = pool.token0();

      tokenPrice = ((amount * Q96) / poolPriceX96);

    } else {
      revert("Invalid Pair");
    }

    // If this is a eth pool, get the price of eth && multiply it by this price
    if(stableOrWeth.isEther()) {

      // Fix the resulting number from multiplication
      uint finalDecimals;
      if(token.decimals() != 18) {
        finalDecimals = 18 - token.decimals();
      }

      tokenPrice = (etherV3Price() * tokenPrice) / (10 ** finalDecimals);

    } else {

      tokenPrice = tokenPrice * (10 ** token.decimals());

    }

    return tokenPrice;
  }

  function etherV3Price() internal view returns(uint) {
    uint ethPriceX96 = getPriceX96FromSqrtPriceX96(getSqrtTwapX96(MTMLibrary.WETH_USDC_POOL));
    return ( ( 1e18 * (2**96) ) / ethPriceX96 );
  }

  function getV3TokenAddressFromPair(address pairAddress) internal view returns(address) {
    IUniswapV3Pool pool = IUniswapV3Pool(pairAddress);

    if(pool.token1().isEther() || pool.token1().isStable()) {
      return pool.token0();
    } else {
      return pool.token1();
    }
  }

  /// @dev Fetches time weighted price square root (scaled 2 ** 96) from a uniswap v3 pool.
  /// @param uniswapV3Pool Address of the uniswap v3 pool.
  /// @return sqrtPriceX96 Time weighted square root token price (scaled 2 ** 96).
  function getSqrtTwapX96(address uniswapV3Pool) internal view returns (uint160 sqrtPriceX96) {
    uint32[] memory secondsAgos = new uint32[](2);
    secondsAgos[0] = MTMLibrary.TWAP_INTERVAL;
    secondsAgos[1] = 0;

    (int56[] memory tickCumulatives, ) = IUniswapV3Pool(uniswapV3Pool).observe(secondsAgos);

    sqrtPriceX96 = TickMath.getSqrtRatioAtTick(
      int24((tickCumulatives[1] - tickCumulatives[0]) / int8(MTMLibrary.TWAP_INTERVAL))
    );

    return sqrtPriceX96;
  }

  /// @dev Converts a uniswap v3 square root price into a token price (scaled 2 ** 96).
  /// @param sqrtPriceX96 Square root uniswap pool price (scaled 2 ** 96).
  /// @return priceX96 Token price (scaled 2 ** 96).
  function getPriceX96FromSqrtPriceX96(uint160 sqrtPriceX96) internal pure returns (uint256 priceX96) {
      return FullMath.mulDiv(sqrtPriceX96, sqrtPriceX96, FixedPoint96.Q96);
  }

}

File 18 of 35 : IUniswapV3Pool.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

import './pool/IUniswapV3PoolImmutables.sol';
import './pool/IUniswapV3PoolState.sol';
import './pool/IUniswapV3PoolDerivedState.sol';
import './pool/IUniswapV3PoolActions.sol';
import './pool/IUniswapV3PoolOwnerActions.sol';
import './pool/IUniswapV3PoolEvents.sol';

/// @title The interface for a Uniswap V3 Pool
/// @notice A Uniswap pool facilitates swapping and automated market making between any two assets that strictly conform
/// to the ERC20 specification
/// @dev The pool interface is broken up into many smaller pieces
interface IUniswapV3Pool is
    IUniswapV3PoolImmutables,
    IUniswapV3PoolState,
    IUniswapV3PoolDerivedState,
    IUniswapV3PoolActions,
    IUniswapV3PoolOwnerActions,
    IUniswapV3PoolEvents
{

}

File 19 of 35 : Math.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)

pragma solidity ^0.8.0;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    enum Rounding {
        Down, // Toward negative infinity
        Up, // Toward infinity
        Zero // Toward zero
    }

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

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

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

    /**
     * @dev Returns the ceiling of the division of two numbers.
     *
     * This differs from standard division with `/` in that it rounds up instead
     * of rounding down.
     */
    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b - 1) / b can overflow on addition, so we distribute.
        return a == 0 ? 0 : (a - 1) / b + 1;
    }

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

            // Handle non-overflow cases, 256 by 256 division.
            if (prod1 == 0) {
                return prod0 / denominator;
            }

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

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

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

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

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

            // Does not overflow because the denominator cannot be zero at this stage in the function.
            uint256 twos = denominator & (~denominator + 1);
            assembly {
                // Divide denominator by twos.
                denominator := div(denominator, twos)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

import "./IERC165.sol";

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

File 21 of 35 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 0;
    }

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

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

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

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

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

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

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

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

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

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

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
     * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
     *
     * _Available since v4.8._
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        if (success) {
            if (returndata.length == 0) {
                // only check isContract if the call was successful and the return data is empty
                // otherwise we already know that it was a contract
                require(isContract(target), "Address: call to non-contract");
            }
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason or using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    function _revert(bytes memory returndata, string memory errorMessage) 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(errorMessage);
        }
    }
}

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

pragma solidity ^0.8.0;

import "../IERC721.sol";

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

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

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

File 23 of 35 : IERC721Receiver.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)

pragma solidity ^0.8.0;

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

File 24 of 35 : IERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/IERC721.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

    /**
     * @dev Transfers `tokenId` token from `from` to `to`.
     *
     * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721
     * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must
     * understand this adds an external call which potentially creates a reentrancy vulnerability.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

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

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

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

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

File 25 of 35 : TickMath.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity ^0.8.0;

/// @title Math library for computing sqrt prices from ticks and vice versa
/// @notice Computes sqrt price for ticks of size 1.0001, i.e. sqrt(1.0001^tick) as fixed point Q64.96 numbers. Supports
/// prices between 2**-128 and 2**128
library TickMath {
  error T();
  error R();

  /// @dev The minimum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**-128
  int24 internal constant MIN_TICK = -887272;
  /// @dev The maximum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**128
  int24 internal constant MAX_TICK = -MIN_TICK;

  /// @dev The minimum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MIN_TICK)
  uint160 internal constant MIN_SQRT_RATIO = 4295128739;
  /// @dev The maximum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MAX_TICK)
  uint160 internal constant MAX_SQRT_RATIO = 1461446703485210103287273052203988822378723970342;

  /// @notice Calculates sqrt(1.0001^tick) * 2^96
  /// @dev Throws if |tick| > max tick
  /// @param tick The input tick for the above formula
  /// @return sqrtPriceX96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0)
  /// at the given tick
  function getSqrtRatioAtTick(int24 tick) internal pure returns (uint160 sqrtPriceX96) {
    unchecked {
      uint256 absTick = tick < 0 ? uint256(-int256(tick)) : uint256(int256(tick));
      if (absTick > uint256(int256(MAX_TICK))) revert T();

      uint256 ratio = absTick & 0x1 != 0
        ? 0xfffcb933bd6fad37aa2d162d1a594001
        : 0x100000000000000000000000000000000;
      if (absTick & 0x2 != 0) ratio = (ratio * 0xfff97272373d413259a46990580e213a) >> 128;
      if (absTick & 0x4 != 0) ratio = (ratio * 0xfff2e50f5f656932ef12357cf3c7fdcc) >> 128;
      if (absTick & 0x8 != 0) ratio = (ratio * 0xffe5caca7e10e4e61c3624eaa0941cd0) >> 128;
      if (absTick & 0x10 != 0) ratio = (ratio * 0xffcb9843d60f6159c9db58835c926644) >> 128;
      if (absTick & 0x20 != 0) ratio = (ratio * 0xff973b41fa98c081472e6896dfb254c0) >> 128;
      if (absTick & 0x40 != 0) ratio = (ratio * 0xff2ea16466c96a3843ec78b326b52861) >> 128;
      if (absTick & 0x80 != 0) ratio = (ratio * 0xfe5dee046a99a2a811c461f1969c3053) >> 128;
      if (absTick & 0x100 != 0) ratio = (ratio * 0xfcbe86c7900a88aedcffc83b479aa3a4) >> 128;
      if (absTick & 0x200 != 0) ratio = (ratio * 0xf987a7253ac413176f2b074cf7815e54) >> 128;
      if (absTick & 0x400 != 0) ratio = (ratio * 0xf3392b0822b70005940c7a398e4b70f3) >> 128;
      if (absTick & 0x800 != 0) ratio = (ratio * 0xe7159475a2c29b7443b29c7fa6e889d9) >> 128;
      if (absTick & 0x1000 != 0) ratio = (ratio * 0xd097f3bdfd2022b8845ad8f792aa5825) >> 128;
      if (absTick & 0x2000 != 0) ratio = (ratio * 0xa9f746462d870fdf8a65dc1f90e061e5) >> 128;
      if (absTick & 0x4000 != 0) ratio = (ratio * 0x70d869a156d2a1b890bb3df62baf32f7) >> 128;
      if (absTick & 0x8000 != 0) ratio = (ratio * 0x31be135f97d08fd981231505542fcfa6) >> 128;
      if (absTick & 0x10000 != 0) ratio = (ratio * 0x9aa508b5b7a84e1c677de54f3e99bc9) >> 128;
      if (absTick & 0x20000 != 0) ratio = (ratio * 0x5d6af8dedb81196699c329225ee604) >> 128;
      if (absTick & 0x40000 != 0) ratio = (ratio * 0x2216e584f5fa1ea926041bedfe98) >> 128;
      if (absTick & 0x80000 != 0) ratio = (ratio * 0x48a170391f7dc42444e8fa2) >> 128;

      if (tick > 0) ratio = type(uint256).max / ratio;

      // this divides by 1<<32 rounding up to go from a Q128.128 to a Q128.96.
      // we then downcast because we know the result always fits within 160 bits due to our tick input constraint
      // we round up in the division so getTickAtSqrtRatio of the output price is always consistent
      sqrtPriceX96 = uint160((ratio >> 32) + (ratio % (1 << 32) == 0 ? 0 : 1));
    }
  }

  /// @notice Calculates the greatest tick value such that getRatioAtTick(tick) <= ratio
  /// @dev Throws in case sqrtPriceX96 < MIN_SQRT_RATIO, as MIN_SQRT_RATIO is the lowest value getRatioAtTick may
  /// ever return.
  /// @param sqrtPriceX96 The sqrt ratio for which to compute the tick as a Q64.96
  /// @return tick The greatest tick for which the ratio is less than or equal to the input ratio
  function getTickAtSqrtRatio(uint160 sqrtPriceX96) internal pure returns (int24 tick) {
    unchecked {
      // second inequality must be < because the price can never reach the price at the max tick
      if (!(sqrtPriceX96 >= MIN_SQRT_RATIO && sqrtPriceX96 < MAX_SQRT_RATIO)) revert R();
      uint256 ratio = uint256(sqrtPriceX96) << 32;

      uint256 r = ratio;
      uint256 msb = 0;

      assembly {
        let f := shl(7, gt(r, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF))
        msb := or(msb, f)
        r := shr(f, r)
      }
      assembly {
        let f := shl(6, gt(r, 0xFFFFFFFFFFFFFFFF))
        msb := or(msb, f)
        r := shr(f, r)
      }
      assembly {
        let f := shl(5, gt(r, 0xFFFFFFFF))
        msb := or(msb, f)
        r := shr(f, r)
      }
      assembly {
        let f := shl(4, gt(r, 0xFFFF))
        msb := or(msb, f)
        r := shr(f, r)
      }
      assembly {
        let f := shl(3, gt(r, 0xFF))
        msb := or(msb, f)
        r := shr(f, r)
      }
      assembly {
        let f := shl(2, gt(r, 0xF))
        msb := or(msb, f)
        r := shr(f, r)
      }
      assembly {
        let f := shl(1, gt(r, 0x3))
        msb := or(msb, f)
        r := shr(f, r)
      }
      assembly {
        let f := gt(r, 0x1)
        msb := or(msb, f)
      }

      if (msb >= 128) r = ratio >> (msb - 127);
      else r = ratio << (127 - msb);

      int256 log_2 = (int256(msb) - 128) << 64;

      assembly {
        r := shr(127, mul(r, r))
        let f := shr(128, r)
        log_2 := or(log_2, shl(63, f))
        r := shr(f, r)
      }
      assembly {
        r := shr(127, mul(r, r))
        let f := shr(128, r)
        log_2 := or(log_2, shl(62, f))
        r := shr(f, r)
      }
      assembly {
        r := shr(127, mul(r, r))
        let f := shr(128, r)
        log_2 := or(log_2, shl(61, f))
        r := shr(f, r)
      }
      assembly {
        r := shr(127, mul(r, r))
        let f := shr(128, r)
        log_2 := or(log_2, shl(60, f))
        r := shr(f, r)
      }
      assembly {
        r := shr(127, mul(r, r))
        let f := shr(128, r)
        log_2 := or(log_2, shl(59, f))
        r := shr(f, r)
      }
      assembly {
        r := shr(127, mul(r, r))
        let f := shr(128, r)
        log_2 := or(log_2, shl(58, f))
        r := shr(f, r)
      }
      assembly {
        r := shr(127, mul(r, r))
        let f := shr(128, r)
        log_2 := or(log_2, shl(57, f))
        r := shr(f, r)
      }
      assembly {
        r := shr(127, mul(r, r))
        let f := shr(128, r)
        log_2 := or(log_2, shl(56, f))
        r := shr(f, r)
      }
      assembly {
        r := shr(127, mul(r, r))
        let f := shr(128, r)
        log_2 := or(log_2, shl(55, f))
        r := shr(f, r)
      }
      assembly {
        r := shr(127, mul(r, r))
        let f := shr(128, r)
        log_2 := or(log_2, shl(54, f))
        r := shr(f, r)
      }
      assembly {
        r := shr(127, mul(r, r))
        let f := shr(128, r)
        log_2 := or(log_2, shl(53, f))
        r := shr(f, r)
      }
      assembly {
        r := shr(127, mul(r, r))
        let f := shr(128, r)
        log_2 := or(log_2, shl(52, f))
        r := shr(f, r)
      }
      assembly {
        r := shr(127, mul(r, r))
        let f := shr(128, r)
        log_2 := or(log_2, shl(51, f))
        r := shr(f, r)
      }
      assembly {
        r := shr(127, mul(r, r))
        let f := shr(128, r)
        log_2 := or(log_2, shl(50, f))
      }

      int256 log_sqrt10001 = log_2 * 255738958999603826347141; // 128.128 number

      int24 tickLow = int24((log_sqrt10001 - 3402992956809132418596140100660247210) >> 128);
      int24 tickHi = int24((log_sqrt10001 + 291339464771989622907027621153398088495) >> 128);

      tick = tickLow == tickHi ? tickLow : getSqrtRatioAtTick(tickHi) <= sqrtPriceX96 ? tickHi : tickLow;
    }
  }
}

File 26 of 35 : FullMath.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

/// @title Contains 512-bit math functions
/// @notice Facilitates multiplication and division that can have overflow of an intermediate value without any loss of precision
/// @dev Handles "phantom overflow" i.e., allows multiplication and division where an intermediate value overflows 256 bits
library FullMath {
  /// @notice Calculates floor(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
  /// @param a The multiplicand
  /// @param b The multiplier
  /// @param denominator The divisor
  /// @return result The 256-bit result
  /// @dev Credit to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv
  function mulDiv(
    uint256 a,
    uint256 b,
    uint256 denominator
  ) internal pure returns (uint256 result) {
    unchecked {
      // 512-bit multiply [prod1 prod0] = a * b
      // Compute the product mod 2**256 and mod 2**256 - 1
      // then use the Chinese Remainder Theorem to reconstruct
      // the 512 bit result. The result is stored in two 256
      // variables such that product = prod1 * 2**256 + prod0
      uint256 prod0; // Least significant 256 bits of the product
      uint256 prod1; // Most significant 256 bits of the product
      assembly {
        let mm := mulmod(a, b, not(0))
        prod0 := mul(a, b)
        prod1 := sub(sub(mm, prod0), lt(mm, prod0))
      }

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

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

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

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

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

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

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

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

  /// @notice Calculates ceil(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
  /// @param a The multiplicand
  /// @param b The multiplier
  /// @param denominator The divisor
  /// @return result The 256-bit result
  function mulDivRoundingUp(
    uint256 a,
    uint256 b,
    uint256 denominator
  ) internal pure returns (uint256 result) {
    unchecked {
      result = mulDiv(a, b, denominator);
      if (mulmod(a, b, denominator) > 0) {
        require(result < type(uint256).max);
        result++;
      }
    }
  }
}

File 27 of 35 : FixedPoint96.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.4.0;

/// @title FixedPoint96
/// @notice A library for handling binary fixed point numbers, see https://en.wikipedia.org/wiki/Q_(number_format)
/// @dev Used in SqrtPriceMath.sol
library FixedPoint96 {
    uint8 internal constant RESOLUTION = 96;
    uint256 internal constant Q96 = 0x1000000000000000000000000;
}

File 28 of 35 : IUniswapV2Pair.sol
pragma solidity >=0.5.0;

interface IUniswapV2Pair {
    event Approval(address indexed owner, address indexed spender, uint value);
    event Transfer(address indexed from, address indexed to, uint value);

    function name() external pure returns (string memory);
    function symbol() external pure returns (string memory);
    function decimals() external pure returns (uint8);
    function totalSupply() external view returns (uint);
    function balanceOf(address owner) external view returns (uint);
    function allowance(address owner, address spender) external view returns (uint);

    function approve(address spender, uint value) external returns (bool);
    function transfer(address to, uint value) external returns (bool);
    function transferFrom(address from, address to, uint value) external returns (bool);

    function DOMAIN_SEPARATOR() external view returns (bytes32);
    function PERMIT_TYPEHASH() external pure returns (bytes32);
    function nonces(address owner) external view returns (uint);

    function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;

    event Mint(address indexed sender, uint amount0, uint amount1);
    event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
    event Swap(
        address indexed sender,
        uint amount0In,
        uint amount1In,
        uint amount0Out,
        uint amount1Out,
        address indexed to
    );
    event Sync(uint112 reserve0, uint112 reserve1);

    function MINIMUM_LIQUIDITY() external pure returns (uint);
    function factory() external view returns (address);
    function token0() external view returns (address);
    function token1() external view returns (address);
    function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
    function price0CumulativeLast() external view returns (uint);
    function price1CumulativeLast() external view returns (uint);
    function kLast() external view returns (uint);

    function mint(address to) external returns (uint liquidity);
    function burn(address to) external returns (uint amount0, uint amount1);
    function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;
    function skim(address to) external;
    function sync() external;

    function initialize(address, address) external;
}

File 29 of 35 : IUniswapV3PoolEvents.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title Events emitted by a pool
/// @notice Contains all events emitted by the pool
interface IUniswapV3PoolEvents {
    /// @notice Emitted exactly once by a pool when #initialize is first called on the pool
    /// @dev Mint/Burn/Swap cannot be emitted by the pool before Initialize
    /// @param sqrtPriceX96 The initial sqrt price of the pool, as a Q64.96
    /// @param tick The initial tick of the pool, i.e. log base 1.0001 of the starting price of the pool
    event Initialize(uint160 sqrtPriceX96, int24 tick);

    /// @notice Emitted when liquidity is minted for a given position
    /// @param sender The address that minted the liquidity
    /// @param owner The owner of the position and recipient of any minted liquidity
    /// @param tickLower The lower tick of the position
    /// @param tickUpper The upper tick of the position
    /// @param amount The amount of liquidity minted to the position range
    /// @param amount0 How much token0 was required for the minted liquidity
    /// @param amount1 How much token1 was required for the minted liquidity
    event Mint(
        address sender,
        address indexed owner,
        int24 indexed tickLower,
        int24 indexed tickUpper,
        uint128 amount,
        uint256 amount0,
        uint256 amount1
    );

    /// @notice Emitted when fees are collected by the owner of a position
    /// @dev Collect events may be emitted with zero amount0 and amount1 when the caller chooses not to collect fees
    /// @param owner The owner of the position for which fees are collected
    /// @param tickLower The lower tick of the position
    /// @param tickUpper The upper tick of the position
    /// @param amount0 The amount of token0 fees collected
    /// @param amount1 The amount of token1 fees collected
    event Collect(
        address indexed owner,
        address recipient,
        int24 indexed tickLower,
        int24 indexed tickUpper,
        uint128 amount0,
        uint128 amount1
    );

    /// @notice Emitted when a position's liquidity is removed
    /// @dev Does not withdraw any fees earned by the liquidity position, which must be withdrawn via #collect
    /// @param owner The owner of the position for which liquidity is removed
    /// @param tickLower The lower tick of the position
    /// @param tickUpper The upper tick of the position
    /// @param amount The amount of liquidity to remove
    /// @param amount0 The amount of token0 withdrawn
    /// @param amount1 The amount of token1 withdrawn
    event Burn(
        address indexed owner,
        int24 indexed tickLower,
        int24 indexed tickUpper,
        uint128 amount,
        uint256 amount0,
        uint256 amount1
    );

    /// @notice Emitted by the pool for any swaps between token0 and token1
    /// @param sender The address that initiated the swap call, and that received the callback
    /// @param recipient The address that received the output of the swap
    /// @param amount0 The delta of the token0 balance of the pool
    /// @param amount1 The delta of the token1 balance of the pool
    /// @param sqrtPriceX96 The sqrt(price) of the pool after the swap, as a Q64.96
    /// @param liquidity The liquidity of the pool after the swap
    /// @param tick The log base 1.0001 of price of the pool after the swap
    event Swap(
        address indexed sender,
        address indexed recipient,
        int256 amount0,
        int256 amount1,
        uint160 sqrtPriceX96,
        uint128 liquidity,
        int24 tick
    );

    /// @notice Emitted by the pool for any flashes of token0/token1
    /// @param sender The address that initiated the swap call, and that received the callback
    /// @param recipient The address that received the tokens from flash
    /// @param amount0 The amount of token0 that was flashed
    /// @param amount1 The amount of token1 that was flashed
    /// @param paid0 The amount of token0 paid for the flash, which can exceed the amount0 plus the fee
    /// @param paid1 The amount of token1 paid for the flash, which can exceed the amount1 plus the fee
    event Flash(
        address indexed sender,
        address indexed recipient,
        uint256 amount0,
        uint256 amount1,
        uint256 paid0,
        uint256 paid1
    );

    /// @notice Emitted by the pool for increases to the number of observations that can be stored
    /// @dev observationCardinalityNext is not the observation cardinality until an observation is written at the index
    /// just before a mint/swap/burn.
    /// @param observationCardinalityNextOld The previous value of the next observation cardinality
    /// @param observationCardinalityNextNew The updated value of the next observation cardinality
    event IncreaseObservationCardinalityNext(
        uint16 observationCardinalityNextOld,
        uint16 observationCardinalityNextNew
    );

    /// @notice Emitted when the protocol fee is changed by the pool
    /// @param feeProtocol0Old The previous value of the token0 protocol fee
    /// @param feeProtocol1Old The previous value of the token1 protocol fee
    /// @param feeProtocol0New The updated value of the token0 protocol fee
    /// @param feeProtocol1New The updated value of the token1 protocol fee
    event SetFeeProtocol(uint8 feeProtocol0Old, uint8 feeProtocol1Old, uint8 feeProtocol0New, uint8 feeProtocol1New);

    /// @notice Emitted when the collected protocol fees are withdrawn by the factory owner
    /// @param sender The address that collects the protocol fees
    /// @param recipient The address that receives the collected protocol fees
    /// @param amount0 The amount of token0 protocol fees that is withdrawn
    /// @param amount0 The amount of token1 protocol fees that is withdrawn
    event CollectProtocol(address indexed sender, address indexed recipient, uint128 amount0, uint128 amount1);
}

File 30 of 35 : IUniswapV3PoolOwnerActions.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title Permissioned pool actions
/// @notice Contains pool methods that may only be called by the factory owner
interface IUniswapV3PoolOwnerActions {
    /// @notice Set the denominator of the protocol's % share of the fees
    /// @param feeProtocol0 new protocol fee for token0 of the pool
    /// @param feeProtocol1 new protocol fee for token1 of the pool
    function setFeeProtocol(uint8 feeProtocol0, uint8 feeProtocol1) external;

    /// @notice Collect the protocol fee accrued to the pool
    /// @param recipient The address to which collected protocol fees should be sent
    /// @param amount0Requested The maximum amount of token0 to send, can be 0 to collect fees in only token1
    /// @param amount1Requested The maximum amount of token1 to send, can be 0 to collect fees in only token0
    /// @return amount0 The protocol fee collected in token0
    /// @return amount1 The protocol fee collected in token1
    function collectProtocol(
        address recipient,
        uint128 amount0Requested,
        uint128 amount1Requested
    ) external returns (uint128 amount0, uint128 amount1);
}

File 31 of 35 : IUniswapV3PoolActions.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title Permissionless pool actions
/// @notice Contains pool methods that can be called by anyone
interface IUniswapV3PoolActions {
    /// @notice Sets the initial price for the pool
    /// @dev Price is represented as a sqrt(amountToken1/amountToken0) Q64.96 value
    /// @param sqrtPriceX96 the initial sqrt price of the pool as a Q64.96
    function initialize(uint160 sqrtPriceX96) external;

    /// @notice Adds liquidity for the given recipient/tickLower/tickUpper position
    /// @dev The caller of this method receives a callback in the form of IUniswapV3MintCallback#uniswapV3MintCallback
    /// in which they must pay any token0 or token1 owed for the liquidity. The amount of token0/token1 due depends
    /// on tickLower, tickUpper, the amount of liquidity, and the current price.
    /// @param recipient The address for which the liquidity will be created
    /// @param tickLower The lower tick of the position in which to add liquidity
    /// @param tickUpper The upper tick of the position in which to add liquidity
    /// @param amount The amount of liquidity to mint
    /// @param data Any data that should be passed through to the callback
    /// @return amount0 The amount of token0 that was paid to mint the given amount of liquidity. Matches the value in the callback
    /// @return amount1 The amount of token1 that was paid to mint the given amount of liquidity. Matches the value in the callback
    function mint(
        address recipient,
        int24 tickLower,
        int24 tickUpper,
        uint128 amount,
        bytes calldata data
    ) external returns (uint256 amount0, uint256 amount1);

    /// @notice Collects tokens owed to a position
    /// @dev Does not recompute fees earned, which must be done either via mint or burn of any amount of liquidity.
    /// Collect must be called by the position owner. To withdraw only token0 or only token1, amount0Requested or
    /// amount1Requested may be set to zero. To withdraw all tokens owed, caller may pass any value greater than the
    /// actual tokens owed, e.g. type(uint128).max. Tokens owed may be from accumulated swap fees or burned liquidity.
    /// @param recipient The address which should receive the fees collected
    /// @param tickLower The lower tick of the position for which to collect fees
    /// @param tickUpper The upper tick of the position for which to collect fees
    /// @param amount0Requested How much token0 should be withdrawn from the fees owed
    /// @param amount1Requested How much token1 should be withdrawn from the fees owed
    /// @return amount0 The amount of fees collected in token0
    /// @return amount1 The amount of fees collected in token1
    function collect(
        address recipient,
        int24 tickLower,
        int24 tickUpper,
        uint128 amount0Requested,
        uint128 amount1Requested
    ) external returns (uint128 amount0, uint128 amount1);

    /// @notice Burn liquidity from the sender and account tokens owed for the liquidity to the position
    /// @dev Can be used to trigger a recalculation of fees owed to a position by calling with an amount of 0
    /// @dev Fees must be collected separately via a call to #collect
    /// @param tickLower The lower tick of the position for which to burn liquidity
    /// @param tickUpper The upper tick of the position for which to burn liquidity
    /// @param amount How much liquidity to burn
    /// @return amount0 The amount of token0 sent to the recipient
    /// @return amount1 The amount of token1 sent to the recipient
    function burn(
        int24 tickLower,
        int24 tickUpper,
        uint128 amount
    ) external returns (uint256 amount0, uint256 amount1);

    /// @notice Swap token0 for token1, or token1 for token0
    /// @dev The caller of this method receives a callback in the form of IUniswapV3SwapCallback#uniswapV3SwapCallback
    /// @param recipient The address to receive the output of the swap
    /// @param zeroForOne The direction of the swap, true for token0 to token1, false for token1 to token0
    /// @param amountSpecified The amount of the swap, which implicitly configures the swap as exact input (positive), or exact output (negative)
    /// @param sqrtPriceLimitX96 The Q64.96 sqrt price limit. If zero for one, the price cannot be less than this
    /// value after the swap. If one for zero, the price cannot be greater than this value after the swap
    /// @param data Any data to be passed through to the callback
    /// @return amount0 The delta of the balance of token0 of the pool, exact when negative, minimum when positive
    /// @return amount1 The delta of the balance of token1 of the pool, exact when negative, minimum when positive
    function swap(
        address recipient,
        bool zeroForOne,
        int256 amountSpecified,
        uint160 sqrtPriceLimitX96,
        bytes calldata data
    ) external returns (int256 amount0, int256 amount1);

    /// @notice Receive token0 and/or token1 and pay it back, plus a fee, in the callback
    /// @dev The caller of this method receives a callback in the form of IUniswapV3FlashCallback#uniswapV3FlashCallback
    /// @dev Can be used to donate underlying tokens pro-rata to currently in-range liquidity providers by calling
    /// with 0 amount{0,1} and sending the donation amount(s) from the callback
    /// @param recipient The address which will receive the token0 and token1 amounts
    /// @param amount0 The amount of token0 to send
    /// @param amount1 The amount of token1 to send
    /// @param data Any data to be passed through to the callback
    function flash(
        address recipient,
        uint256 amount0,
        uint256 amount1,
        bytes calldata data
    ) external;

    /// @notice Increase the maximum number of price and liquidity observations that this pool will store
    /// @dev This method is no-op if the pool already has an observationCardinalityNext greater than or equal to
    /// the input observationCardinalityNext.
    /// @param observationCardinalityNext The desired minimum number of observations for the pool to store
    function increaseObservationCardinalityNext(uint16 observationCardinalityNext) external;
}

File 32 of 35 : IUniswapV3PoolDerivedState.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title Pool state that is not stored
/// @notice Contains view functions to provide information about the pool that is computed rather than stored on the
/// blockchain. The functions here may have variable gas costs.
interface IUniswapV3PoolDerivedState {
    /// @notice Returns the cumulative tick and liquidity as of each timestamp `secondsAgo` from the current block timestamp
    /// @dev To get a time weighted average tick or liquidity-in-range, you must call this with two values, one representing
    /// the beginning of the period and another for the end of the period. E.g., to get the last hour time-weighted average tick,
    /// you must call it with secondsAgos = [3600, 0].
    /// @dev The time weighted average tick represents the geometric time weighted average price of the pool, in
    /// log base sqrt(1.0001) of token1 / token0. The TickMath library can be used to go from a tick value to a ratio.
    /// @param secondsAgos From how long ago each cumulative tick and liquidity value should be returned
    /// @return tickCumulatives Cumulative tick values as of each `secondsAgos` from the current block timestamp
    /// @return secondsPerLiquidityCumulativeX128s Cumulative seconds per liquidity-in-range value as of each `secondsAgos` from the current block
    /// timestamp
    function observe(uint32[] calldata secondsAgos)
        external
        view
        returns (int56[] memory tickCumulatives, uint160[] memory secondsPerLiquidityCumulativeX128s);

    /// @notice Returns a snapshot of the tick cumulative, seconds per liquidity and seconds inside a tick range
    /// @dev Snapshots must only be compared to other snapshots, taken over a period for which a position existed.
    /// I.e., snapshots cannot be compared if a position is not held for the entire period between when the first
    /// snapshot is taken and the second snapshot is taken.
    /// @param tickLower The lower tick of the range
    /// @param tickUpper The upper tick of the range
    /// @return tickCumulativeInside The snapshot of the tick accumulator for the range
    /// @return secondsPerLiquidityInsideX128 The snapshot of seconds per liquidity for the range
    /// @return secondsInside The snapshot of seconds per liquidity for the range
    function snapshotCumulativesInside(int24 tickLower, int24 tickUpper)
        external
        view
        returns (
            int56 tickCumulativeInside,
            uint160 secondsPerLiquidityInsideX128,
            uint32 secondsInside
        );
}

File 33 of 35 : IUniswapV3PoolState.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title Pool state that can change
/// @notice These methods compose the pool's state, and can change with any frequency including multiple times
/// per transaction
interface IUniswapV3PoolState {
    /// @notice The 0th storage slot in the pool stores many values, and is exposed as a single method to save gas
    /// when accessed externally.
    /// @return sqrtPriceX96 The current price of the pool as a sqrt(token1/token0) Q64.96 value
    /// tick The current tick of the pool, i.e. according to the last tick transition that was run.
    /// This value may not always be equal to SqrtTickMath.getTickAtSqrtRatio(sqrtPriceX96) if the price is on a tick
    /// boundary.
    /// observationIndex The index of the last oracle observation that was written,
    /// observationCardinality The current maximum number of observations stored in the pool,
    /// observationCardinalityNext The next maximum number of observations, to be updated when the observation.
    /// feeProtocol The protocol fee for both tokens of the pool.
    /// Encoded as two 4 bit values, where the protocol fee of token1 is shifted 4 bits and the protocol fee of token0
    /// is the lower 4 bits. Used as the denominator of a fraction of the swap fee, e.g. 4 means 1/4th of the swap fee.
    /// unlocked Whether the pool is currently locked to reentrancy
    function slot0()
        external
        view
        returns (
            uint160 sqrtPriceX96,
            int24 tick,
            uint16 observationIndex,
            uint16 observationCardinality,
            uint16 observationCardinalityNext,
            uint8 feeProtocol,
            bool unlocked
        );

    /// @notice The fee growth as a Q128.128 fees of token0 collected per unit of liquidity for the entire life of the pool
    /// @dev This value can overflow the uint256
    function feeGrowthGlobal0X128() external view returns (uint256);

    /// @notice The fee growth as a Q128.128 fees of token1 collected per unit of liquidity for the entire life of the pool
    /// @dev This value can overflow the uint256
    function feeGrowthGlobal1X128() external view returns (uint256);

    /// @notice The amounts of token0 and token1 that are owed to the protocol
    /// @dev Protocol fees will never exceed uint128 max in either token
    function protocolFees() external view returns (uint128 token0, uint128 token1);

    /// @notice The currently in range liquidity available to the pool
    /// @dev This value has no relationship to the total liquidity across all ticks
    function liquidity() external view returns (uint128);

    /// @notice Look up information about a specific tick in the pool
    /// @param tick The tick to look up
    /// @return liquidityGross the total amount of position liquidity that uses the pool either as tick lower or
    /// tick upper,
    /// liquidityNet how much liquidity changes when the pool price crosses the tick,
    /// feeGrowthOutside0X128 the fee growth on the other side of the tick from the current tick in token0,
    /// feeGrowthOutside1X128 the fee growth on the other side of the tick from the current tick in token1,
    /// tickCumulativeOutside the cumulative tick value on the other side of the tick from the current tick
    /// secondsPerLiquidityOutsideX128 the seconds spent per liquidity on the other side of the tick from the current tick,
    /// secondsOutside the seconds spent on the other side of the tick from the current tick,
    /// initialized Set to true if the tick is initialized, i.e. liquidityGross is greater than 0, otherwise equal to false.
    /// Outside values can only be used if the tick is initialized, i.e. if liquidityGross is greater than 0.
    /// In addition, these values are only relative and must be used only in comparison to previous snapshots for
    /// a specific position.
    function ticks(int24 tick)
        external
        view
        returns (
            uint128 liquidityGross,
            int128 liquidityNet,
            uint256 feeGrowthOutside0X128,
            uint256 feeGrowthOutside1X128,
            int56 tickCumulativeOutside,
            uint160 secondsPerLiquidityOutsideX128,
            uint32 secondsOutside,
            bool initialized
        );

    /// @notice Returns 256 packed tick initialized boolean values. See TickBitmap for more information
    function tickBitmap(int16 wordPosition) external view returns (uint256);

    /// @notice Returns the information about a position by the position's key
    /// @param key The position's key is a hash of a preimage composed by the owner, tickLower and tickUpper
    /// @return _liquidity The amount of liquidity in the position,
    /// Returns feeGrowthInside0LastX128 fee growth of token0 inside the tick range as of the last mint/burn/poke,
    /// Returns feeGrowthInside1LastX128 fee growth of token1 inside the tick range as of the last mint/burn/poke,
    /// Returns tokensOwed0 the computed amount of token0 owed to the position as of the last mint/burn/poke,
    /// Returns tokensOwed1 the computed amount of token1 owed to the position as of the last mint/burn/poke
    function positions(bytes32 key)
        external
        view
        returns (
            uint128 _liquidity,
            uint256 feeGrowthInside0LastX128,
            uint256 feeGrowthInside1LastX128,
            uint128 tokensOwed0,
            uint128 tokensOwed1
        );

    /// @notice Returns data about a specific observation index
    /// @param index The element of the observations array to fetch
    /// @dev You most likely want to use #observe() instead of this method to get an observation as of some amount of time
    /// ago, rather than at a specific index in the array.
    /// @return blockTimestamp The timestamp of the observation,
    /// Returns tickCumulative the tick multiplied by seconds elapsed for the life of the pool as of the observation timestamp,
    /// Returns secondsPerLiquidityCumulativeX128 the seconds per in range liquidity for the life of the pool as of the observation timestamp,
    /// Returns initialized whether the observation has been initialized and the values are safe to use
    function observations(uint256 index)
        external
        view
        returns (
            uint32 blockTimestamp,
            int56 tickCumulative,
            uint160 secondsPerLiquidityCumulativeX128,
            bool initialized
        );
}

File 34 of 35 : IUniswapV3PoolImmutables.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title Pool state that never changes
/// @notice These parameters are fixed for a pool forever, i.e., the methods will always return the same values
interface IUniswapV3PoolImmutables {
    /// @notice The contract that deployed the pool, which must adhere to the IUniswapV3Factory interface
    /// @return The contract address
    function factory() external view returns (address);

    /// @notice The first of the two tokens of the pool, sorted by address
    /// @return The token contract address
    function token0() external view returns (address);

    /// @notice The second of the two tokens of the pool, sorted by address
    /// @return The token contract address
    function token1() external view returns (address);

    /// @notice The pool's fee in hundredths of a bip, i.e. 1e-6
    /// @return The fee
    function fee() external view returns (uint24);

    /// @notice The pool tick spacing
    /// @dev Ticks can only be used at multiples of this value, minimum of 1 and always positive
    /// e.g.: a tickSpacing of 3 means ticks can be initialized every 3rd tick, i.e., ..., -6, -3, 0, 3, 6, ...
    /// This value is an int24 to avoid casting even though it is always positive.
    /// @return The tick spacing
    function tickSpacing() external view returns (int24);

    /// @notice The maximum amount of position liquidity that can use any tick in the range
    /// @dev This parameter is enforced per tick to prevent liquidity from overflowing a uint128 at any point, and
    /// also prevents out-of-range liquidity from being used to prevent adding in-range liquidity to a pool
    /// @return The max amount of liquidity per tick
    function maxLiquidityPerTick() external view returns (uint128);
}

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

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[EIP].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165 {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"uint64","name":"_launchTime","type":"uint64"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"uint256","name":"timeToChangeStatus","type":"uint256"}],"name":"CannotEnterMineDuringMiningPeriod","type":"error"},{"inputs":[{"internalType":"uint256","name":"rewards","type":"uint256"}],"name":"CannotEnterMineWithPendingRewards","type":"error"},{"inputs":[{"internalType":"uint256","name":"timeToChangeStatus","type":"uint256"}],"name":"CannotRetreiveMtmsDuringMiningPeriod","type":"error"},{"inputs":[],"name":"InvalidMTMOwner","type":"error"},{"inputs":[],"name":"MinerAlreadyStarted","type":"error"},{"inputs":[],"name":"MinerIsNotRunning","type":"error"},{"inputs":[],"name":"NoMinersMining","type":"error"},{"inputs":[{"internalType":"address","name":"retriever","type":"address"}],"name":"NoMinersToRetrieve","type":"error"},{"inputs":[{"internalType":"address","name":"claimer","type":"address"}],"name":"NoRewardsToClaim","type":"error"},{"inputs":[],"name":"NotEnoughMSharesToMine","type":"error"},{"inputs":[{"internalType":"uint64","name":"timeToChange","type":"uint64"},{"internalType":"uint256","name":"blockTimestamp","type":"uint256"}],"name":"NotTimeToEndMinerYet","type":"error"},{"inputs":[{"internalType":"uint64","name":"timeToChange","type":"uint64"},{"internalType":"uint256","name":"blockTimestamp","type":"uint256"}],"name":"NotTimeToStartMinerYet","type":"error"},{"inputs":[{"internalType":"uint256","name":"periodId","type":"uint256"}],"name":"OwnerIsMining","type":"error"},{"inputs":[],"name":"ReloadPeriodNotStarted","type":"error"},{"inputs":[{"internalType":"uint256","name":"maxSupply","type":"uint256"}],"name":"TotalSupplyHasBeenReached","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"components":[{"internalType":"uint128","name":"rewards","type":"uint128"},{"internalType":"uint56","name":"periodId","type":"uint56"},{"internalType":"uint256[]","name":"mtmIds","type":"uint256[]"}],"indexed":false,"internalType":"struct Mineable.OwnerMiner","name":"ownerMiner","type":"tuple"}],"name":"EnterMine","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"ownerAddress","type":"address"},{"indexed":false,"internalType":"uint256[]","name":"minerIds","type":"uint256[]"}],"name":"MinerRetrieval","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint64","name":"timeToChange","type":"uint64"},{"indexed":false,"internalType":"uint56","name":"periodId","type":"uint56"},{"indexed":false,"internalType":"uint8","name":"status","type":"uint8"}],"name":"PeriodChange","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"ownerAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"rewardsAndPeriod","type":"uint256"}],"name":"RewardsClaim","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"BA_ADDRESS","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"INIT_RELOAD_PERIOD","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MINING_DURATION","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"RELOAD_PERIOD","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_timeToChangeStatus","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"continueMining","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"currentPeriod","outputs":[{"internalType":"uint128","name":"totalMidaMined","type":"uint128"},{"internalType":"uint64","name":"timeToChangeStatus","type":"uint64"},{"internalType":"uint56","name":"periodId","type":"uint56"},{"internalType":"enum Mineable.PeriodStatus","name":"status","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"mtmIds","type":"uint256[]"}],"name":"enterMine","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"exitMine","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"mShareRate","outputs":[{"internalType":"uint128","name":"","type":"uint128"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"maxSupply","outputs":[{"internalType":"uint128","name":"","type":"uint128"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"mineableSupply","outputs":[{"internalType":"uint128","name":"","type":"uint128"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"minerEnd","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"minerStart","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"mtm","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"ownerMiner","outputs":[{"internalType":"uint128","name":"rewards","type":"uint128"},{"internalType":"uint56","name":"periodId","type":"uint56"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingMidaMined","outputs":[{"internalType":"uint128","name":"","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"shouldEndMiner","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"shouldStartMiner","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalMidaMined","outputs":[{"internalType":"uint128","name":"","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"}]

60a06040523480156200001157600080fd5b506040516200855f3803806200855f8339810160408190526200003491620002f2565b80604051806040016040528060048152602001634d69646160e01b815250604051806040016040528060048152602001634d49444160e01b8152508160039081620000809190620003c8565b5060046200008f8282620003c8565b505060016005555060408051608081019091526000815260208101620000b96206978084620004aa565b6001600160401b0316815260016020820152604001600090528051600780546020840151604085015166ffffffffffffff16600160c01b0266ffffffffffffff60c01b196001600160401b03909216600160801b026001600160c01b03199093166001600160801b039095169490941791909117908116831782556060840151919283916001600160f81b039091166001600160c01b0390911617600160f81b8360018111156200016e576200016e620004d4565b021790555090505050620001c473d2dc058f4068ec0e42655f8a385eb6333fb67ab66002620f4240652632e314a000620001a99190620004ea565b620001b5919062000518565b6001600160801b031662000219565b604051620001d290620002e4565b604051809103906000f080158015620001ef573d6000803e3d6000fd5b50600880546001600160a01b0319166001600160a01b039290921691821790556080525062000569565b6001600160a01b038216620002745760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015260640160405180910390fd5b80600260008282546200028891906200054d565b90915550506001600160a01b038216600081815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b505050565b6159898062002bd683390190565b6000602082840312156200030557600080fd5b81516001600160401b03811681146200031d57600080fd5b9392505050565b634e487b7160e01b600052604160045260246000fd5b600181811c908216806200034f57607f821691505b6020821081036200037057634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115620002df57600081815260208120601f850160051c810160208610156200039f5750805b601f850160051c820191505b81811015620003c057828155600101620003ab565b505050505050565b81516001600160401b03811115620003e457620003e462000324565b620003fc81620003f584546200033a565b8462000376565b602080601f8311600181146200043457600084156200041b5750858301515b600019600386901b1c1916600185901b178555620003c0565b600085815260208120601f198616915b82811015620004655788860151825594840194600190910190840162000444565b5085821015620004845787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b634e487b7160e01b600052601160045260246000fd5b6001600160401b03818116838216019080821115620004cd57620004cd62000494565b5092915050565b634e487b7160e01b600052602160045260246000fd5b6001600160801b0381811683821602808216919082811462000510576200051062000494565b505092915050565b60006001600160801b03838116806200054157634e487b7160e01b600052601260045260246000fd5b92169190910492915050565b8082018082111562000563576200056362000494565b92915050565b60805161262e620005a860003960008181610cae01528181610d8b01528181610e4d015281816117db015281816118b80152611cbe015261262e6000f3fe608060405234801561001057600080fd5b50600436106101e55760003560e01c80633a213b661161010f578063a457c2d7116100a2578063d5abeb0111610071578063d5abeb01146104a2578063d6fb1678146104aa578063db6ca515146104b2578063dd62ed3e146104ba57600080fd5b8063a457c2d71461046a578063a9059cbb1461047d578063b8f4421f14610490578063bfd95b181461049857600080fd5b80637714bda0116100de5780637714bda01461043f57806381f51dcb1461044757806395d89b411461045a578063972488de1461046257600080fd5b80633a213b66146103e75780634d1f7740146103f15780635b8ed2e61461040e57806370a082311461041657600080fd5b806318160ddd11610187578063313ce56711610156578063313ce56714610399578063321f8aa2146103a857806332590c5c146103b157806339509351146103d457600080fd5b806318160ddd1461032e578063205b34fc1461034057806323b872dd146103735780632cf6551a1461038657600080fd5b8063095ea7b3116101c3578063095ea7b31461026f5780630ffd626e14610292578063108aae5b1461029a5780631609506e146102cc57600080fd5b806306040618146101ea57806306fdde03146102455780630849438f1461025a575b600080fd5b60075461022c906001600160801b03811690600160801b810467ffffffffffffffff1690600160c01b810466ffffffffffffff1690600160f81b900460ff1684565b60405161023c9493929190612091565b60405180910390f35b61024d6104f3565b60405161023c9190612106565b61026d610268366004612172565b610585565b005b61028261027d3660046121fc565b610754565b604051901515815260200161023c565b61026d61076e565b6009546102b490600160801b90046001600160801b031681565b6040516001600160801b03909116815260200161023c565b6103076102da366004612228565b6006602052600090815260409020546001600160801b03811690600160801b900466ffffffffffffff1682565b604080516001600160801b03909316835266ffffffffffffff90911660208301520161023c565b6002545b60405190815260200161023c565b61035b73d2dc058f4068ec0e42655f8a385eb6333fb67ab681565b6040516001600160a01b03909116815260200161023c565b61028261038136600461224c565b610780565b6009546102b4906001600160801b031681565b6040516006815260200161023c565b620a97b86102b4565b6103bb62278d0081565b60405167ffffffffffffffff909116815260200161023c565b6102826103e23660046121fc565b6107a4565b6103bb6202a30081565b60075442600160801b90910467ffffffffffffffff161115610282565b6102826107e3565b610332610424366004612228565b6001600160a01b031660009081526020819052604090205490565b61026d610842565b60085461035b906001600160a01b031681565b61024d6109b3565b6102826109c2565b6102826104783660046121fc565b610a0a565b61028261048b3660046121fc565b610ab4565b61026d610ac2565b6103bb6206978081565b6102b4610ad2565b6102b4610ae7565b61026d610b25565b6103326104c836600461228d565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b606060038054610502906122c6565b80601f016020809104026020016040519081016040528092919081815260200182805461052e906122c6565b801561057b5780601f106105505761010080835404028352916020019161057b565b820191906000526020600020905b81548152906001019060200180831161055e57829003601f168201915b5050505050905090565b61058d610bda565b610595610ad2565b6001600160801b03166105a760025490565b6009546105bd91906001600160801b0316612348565b0361060d576105ca610ad2565b6040517f342db5f60000000000000000000000000000000000000000000000000000000081526001600160801b0390911660048201526024015b60405180910390fd5b60075433600090815260066020526040902054600160c01b90910466ffffffffffffff908116600160801b9092041603610688576007546040517f31775d51000000000000000000000000000000000000000000000000000000008152600160c01b90910466ffffffffffffff166004820152602401610604565b6000600754600160f81b900460ff1660018111156106a8576106a8612062565b146106f5576007546040517f46a20837000000000000000000000000000000000000000000000000000000008152600160801b90910467ffffffffffffffff166004820152602401610604565b610731828280806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250610c3392505050565b6107396107e3565b1561074657610746610ac2565b6107506001600555565b5050565b600033610762818585610fae565b60019150505b92915050565b610776611106565b61077e6111c7565b565b60003361078e858285611314565b6107998585856113c4565b506001949350505050565b3360008181526001602090815260408083206001600160a01b038716845290915281205490919061076290829086906107de908790612348565b610fae565b60075460009042600160801b90910467ffffffffffffffff161115801561082757506000600754600160f81b900460ff16600181111561082557610825612062565b145b801561083d57506007546001600160801b031615155b905090565b61084a610bda565b6108526109c2565b1561085f5761085f61076e565b610867610ad2565b6001600160801b031661087960025490565b60095461088f91906001600160801b0316612348565b0361089c576105ca610ad2565b60075433600090815260066020526040902054600160c01b90910466ffffffffffffff908116600160801b9092041603610917576007546040517f31775d51000000000000000000000000000000000000000000000000000000008152600160c01b90910466ffffffffffffff166004820152602401610604565b6000600754600160f81b900460ff16600181111561093757610937612062565b14610984576007546040517f46a20837000000000000000000000000000000000000000000000000000000008152600160801b90910467ffffffffffffffff166004820152602401610604565b61098c6115b1565b61099461170b565b61099c6107e3565b156109a9576109a9610ac2565b61077e6001600555565b606060048054610502906122c6565b60075460009042600160801b90910467ffffffffffffffff161115801561083d57506001600754600160f81b900460ff166001811115610a0457610a04612062565b14905090565b3360008181526001602090815260408083206001600160a01b038716845290915281205490919083811015610aa75760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f0000000000000000000000000000000000000000000000000000006064820152608401610604565b6107998286868403610fae565b6000336107628185856113c4565b610aca611a39565b61077e611b3f565b600061083d620f4240652632e314a00061235b565b60006002610afe620f4240652632e314a00061235b565b610b089190612386565b610b1b620f4240652632e314a00061235b565b61083d91906123d3565b610b2d6109c2565b15610b3a57610b3a61076e565b60075433600090815260066020526040902054600160c01b90910466ffffffffffffff908116600160801b9092041603610bb5576007546040517f31775d51000000000000000000000000000000000000000000000000000000008152600160c01b90910466ffffffffffffff166004820152602401610604565b610bbd6115b1565b610bc5611c10565b610bcd6107e3565b1561077e5761077e610ac2565b600260055403610c2c5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610604565b6002600555565b33600090815260066020526040812090805b8351811015610ed3576000848281518110610c6257610c626123fa565b60200260200101519050610c733390565b6040517f6352211e000000000000000000000000000000000000000000000000000000008152600481018390526001600160a01b03918216917f00000000000000000000000000000000000000000000000000000000000000001690636352211e90602401602060405180830381865afa158015610cf5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d199190612429565b6001600160a01b031614610d59576040517f87ff008900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517fbcc25791000000000000000000000000000000000000000000000000000000008152600481018290526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063bcc2579190602401606060405180830381865afa158015610dda573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dfe9190612446565b506bffffffffffffffffffffffff169150610e1b905081856124b0565b6040517f5a04216e000000000000000000000000000000000000000000000000000000008152600481018490529094507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690635a04216e90602401600060405180830381600087803b158015610e9957600080fd5b505af1158015610ead573d6000803e3d6000fd5b505050600180870180548083018255600091825260209091200193909355505001610c45565b506000610eeb610ee6620a97b88461235b565b611dad565b835490915081908490600090610f0b9084906001600160801b03166124b0565b82546101009290920a6001600160801b038181021990931691909216919091021790555060075483547fffffffffffffffffff00000000000000ffffffffffffffffffffffffffffffff16600160c01b90910466ffffffffffffff16600160801b021783556040517fca22edca75caca8fc8520b141f5a2b1fa7bc914e5c46e421ef1d872596fe516e90610fa09085906124d0565b60405180910390a150505050565b6001600160a01b0383166110295760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152608401610604565b6001600160a01b0382166110a55760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f73730000000000000000000000000000000000000000000000000000000000006064820152608401610604565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6000600754600160f81b900460ff16600181111561112657611126612062565b0361115d576040517fb240622500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60075442600160801b90910467ffffffffffffffff16111561077e576007546040517f7aee4b4e000000000000000000000000000000000000000000000000000000008152600160801b90910467ffffffffffffffff166004820152426024820152604401610604565b600780547effffffffffffffffffffffffffffff00000000000000000000000000000000168082556202a3009190601090611214908490600160801b900467ffffffffffffffff1661254d565b92506101000a81548167ffffffffffffffff021916908367ffffffffffffffff1602179055506001600760000160188282829054906101000a900466ffffffffffffff16611262919061256e565b82546101009290920a66ffffffffffffff8181021990931691831602179091556007547f80bcdd1c59d3ace14f9b09f0139000e27892da31911a0c83175ab112890441639250600160801b810467ffffffffffffffff1691600160c01b82041690600160f81b900460ff1660018111156112de576112de612062565b6040805167ffffffffffffffff909416845266ffffffffffffff909216602084015260ff169082015260600160405180910390a1565b6001600160a01b038381166000908152600160209081526040808320938616835292905220547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146113be57818110156113b15760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610604565b6113be8484848403610fae565b50505050565b6001600160a01b0383166114405760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f64726573730000000000000000000000000000000000000000000000000000006064820152608401610604565b6001600160a01b0382166114bc5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f65737300000000000000000000000000000000000000000000000000000000006064820152608401610604565b6001600160a01b0383166000908152602081905260409020548181101561154b5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e636500000000000000000000000000000000000000000000000000006064820152608401610604565b6001600160a01b03848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a36113be565b336000908152600660205260408120805490916001600160801b03821691600160801b900466ffffffffffffff169082900361161b576040517f6e377652000000000000000000000000000000000000000000000000000000008152336004820152602401610604565b82547fffffffffffffffffff000000000000000000000000000000000000000000000016835561165433836001600160801b0316611f69565b600980548391906000906116729084906001600160801b03166123d3565b92506101000a8154816001600160801b0302191690836001600160801b031602179055507ff0193af62631cc04f42841d590c093e885b44520cbb14dc573193023f80cb2846116be3390565b604080516001600160a01b0390921682526001600160801b03851676ffffffffffffff00000000000000000000000000000000608086901b161760208301520160405180910390a1505050565b33600090815260066020908152604080832060018101805483518186028101860190945280845291949390919083018282801561176757602002820191906000526020600020905b815481526020019060010190808311611753575b505050505090506000805b825181101561195457600083828151811061178f5761178f6123fa565b602002602001015190506117a03390565b6040517fa9aa231f000000000000000000000000000000000000000000000000000000008152600481018390526001600160a01b03918216917f0000000000000000000000000000000000000000000000000000000000000000169063a9aa231f90602401602060405180830381865afa158015611822573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118469190612429565b6001600160a01b031614611886576040517f87ff008900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517fbcc25791000000000000000000000000000000000000000000000000000000008152600481018290526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063bcc2579190602401606060405180830381865afa158015611907573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061192b9190612446565b506bffffffffffffffffffffffff169150611948905081856124b0565b93505050600101611772565b506000611967610ee6620a97b88461235b565b8454909150819085906000906119879084906001600160801b03166124b0565b82546101009290920a6001600160801b038181021990931691909216919091021790555060075484547fffffffffffffffffff00000000000000ffffffffffffffffffffffffffffffff16600160c01b90910466ffffffffffffff16600160801b021784556040517fca22edca75caca8fc8520b141f5a2b1fa7bc914e5c46e421ef1d872596fe516e90611a1c9086906124d0565b60405180910390a1611a2c6107e3565b156113be576113be610ac2565b6001600754600160f81b900460ff166001811115611a5957611a59612062565b03611a90576040517f04bf600600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60075442600160801b90910467ffffffffffffffff161115611afa576007546040517ff9526e32000000000000000000000000000000000000000000000000000000008152600160801b90910467ffffffffffffffff166004820152426024820152604401610604565b6007546001600160801b031660000361077e576040517fa23ce9d300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600780547effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff16600160f81b1780825562278d009190601090611b92908490600160801b900467ffffffffffffffff1661254d565b82546101009290920a67ffffffffffffffff8181021990931691831602179091556007547f80bcdd1c59d3ace14f9b09f0139000e27892da31911a0c83175ab112890441639250600160801b810490911690600160c01b810466ffffffffffffff1690600160f81b900460ff1660018111156112de576112de612062565b336000908152600660209081526040808320600181018054835181860281018601909452808452919493909190830182828015611c6c57602002820191906000526020600020905b815481526020019060010190808311611c58575b505050505090508051600003611cb0576040517f7cf77aaa000000000000000000000000000000000000000000000000000000008152336004820152602401610604565b60005b8151811015611d61577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316630adc10af838381518110611cfd57611cfd6123fa565b60200260200101516040518263ffffffff1660e01b8152600401611d2391815260200190565b600060405180830381600087803b158015611d3d57600080fd5b505af1158015611d51573d6000803e3d6000fd5b505060019092019150611cb39050565b50611d70600183016000612028565b7fb17dbdd0d485b2e72d19052ba4bec3bb3c7d573101e1cd07e66bbb875ffcb9d43382604051611da192919061258e565b60405180910390a15050565b6000816001600160801b0316600003611df2576040517f030858b900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600954600090611e0c9084906001600160801b03166124b0565b9050611e16610ad2565b6001600160801b0316611e2860025490565b611e3b906001600160801b038416612348565b1115611e8557611e49610ad2565b6001600160801b0316611e5b60025490565b611e6e906001600160801b038416612348565b611e7891906125e5565b611e8290846123d3565b92505b82600960108282829054906101000a90046001600160801b0316611ea991906124b0565b92506101000a8154816001600160801b0302191690836001600160801b0316021790555082600760000160008282829054906101000a90046001600160801b0316611ef491906124b0565b92506101000a8154816001600160801b0302191690836001600160801b0316021790555082600960008282829054906101000a90046001600160801b0316611f3c91906124b0565b92506101000a8154816001600160801b0302191690836001600160801b0316021790555082915050919050565b6001600160a01b038216611fbf5760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610604565b8060026000828254611fd19190612348565b90915550506001600160a01b038216600081815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b50805460008255906000526020600020908101906120469190612049565b50565b5b8082111561205e576000815560010161204a565b5090565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b6001600160801b038516815267ffffffffffffffff8416602082015266ffffffffffffff8316604082015260808101600283106120f7577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b82606083015295945050505050565b600060208083528351808285015260005b8181101561213357858101830151858201604001528201612117565b5060006040828601015260407fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8301168501019250505092915050565b6000806020838503121561218557600080fd5b823567ffffffffffffffff8082111561219d57600080fd5b818501915085601f8301126121b157600080fd5b8135818111156121c057600080fd5b8660208260051b85010111156121d557600080fd5b60209290920196919550909350505050565b6001600160a01b038116811461204657600080fd5b6000806040838503121561220f57600080fd5b823561221a816121e7565b946020939093013593505050565b60006020828403121561223a57600080fd5b8135612245816121e7565b9392505050565b60008060006060848603121561226157600080fd5b833561226c816121e7565b9250602084013561227c816121e7565b929592945050506040919091013590565b600080604083850312156122a057600080fd5b82356122ab816121e7565b915060208301356122bb816121e7565b809150509250929050565b600181811c908216806122da57607f821691505b602082108103612313577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b8082018082111561076857610768612319565b6001600160801b0381811683821602808216919082811461237e5761237e612319565b505092915050565b60006001600160801b03808416806123c7577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b92169190910492915050565b6001600160801b038281168282160390808211156123f3576123f3612319565b5092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60006020828403121561243b57600080fd5b8151612245816121e7565b60008060006060848603121561245b57600080fd5b83516001600160801b038116811461247257600080fd5b60208501519093506bffffffffffffffffffffffff8116811461249457600080fd5b60408501519092506124a5816121e7565b809150509250925092565b6001600160801b038181168382160190808211156123f3576123f3612319565b600060208083526080830184546001600160801b0381168386015266ffffffffffffff8160801c16604086015250600180860160608087015282815480855260a08801915082600052856000209450600092505b808310156125415784548252938301939183019190850190612524565b50979650505050505050565b67ffffffffffffffff8181168382160190808211156123f3576123f3612319565b66ffffffffffffff8181168382160190808211156123f3576123f3612319565b6000604082016001600160a01b03851683526020604081850152818551808452606086019150828701935060005b818110156125d8578451835293830193918301916001016125bc565b5090979650505050505050565b818103818111156107685761076861231956fea2646970667358221220f8dab023ca454694da326cadcda641d7ba6219a24bb0a904fa538c3a5eb2351264736f6c634300081300336101206040523480156200001257600080fd5b506040518060400160405280601081526020016f26b4b230902a37b5b2b71026b4b732b960811b815250604051806040016040528060038152602001624d544d60e81b8152508160009081620000699190620008d3565b506001620000788282620008d3565b5050600160069081556200008f9150600a62000ab2565b6080819052620000a190600162000ac0565b60a0819052608051620000b5919062000ada565b60c0526000620000c46200016d565b506011905060005b818110156200015b576000620000e16200016d565b8260118110620000f557620000f562000afd565b602002015190506000620001098262000457565b6001600160a01b0390811660009081526007602090815260409091208451815492909501511515600160a01b026001600160a81b031990921694909216939093179290921790915550600101620000cc565b50503360e08190526101005262000b3e565b62000177620007f9565b50604080516102608101825273cbcdf9626bc03e24f779434178a73a0b4bad62ed61022082019081526000610240830181905290825282518084018452733328ca5b535d537f88715b305375c591cf52d5418152602081810183905280840191909152835180850185527325c0edc51909fc20429c6ece9b8f4fbb5af138788152808201839052838501528351808501855273a5ef2a6bbe8852bd6fd2ef6ab9bb45081a6f531c8152808201839052606084015283518085018552732f62f2b4c5fcd7570a709dec05d68ea19c82a9ec81528082018390526080840152835180850185527369d91b94f0aaf8e8a2586909fa77a5c2c89818d5815280820183905260a08401528351808501855273e859041c9c6d70177f83de991b9d757e13cea26e815280820183905260c084015283518085018552733aaf77ba7da262e34dffb9b10fc6777bfda79ab7815280820183905260e084015283518085018552732a9d2ba41aba912316d16742f259412b681898db8152808201839052610100840152835180850185527330aa16699d08a6af61b7d1860845c4855b86713e815280820183905261012084015283518085018552732ca1d6950182d28434f89a719ed9e915b8c417b58152808201929092526101408301919091528251808401845273a43fe16908251ee70ef74718545e4fe6c5ccec9f8152600181830181905261016084019190915283518085018552730f23d49bc92ec52ff591d091b3e16c937034496e815280830182905261018084015283518085018552735281e311734869c64ca60ef047fd87759397efe681528083018290526101a08401528351808501855273a5e9c917b4b821e4e0a5bbefce078ab6540d6b5e81528083018290526101c084015283518085018552732db388d12c56fa6bd81b101aa6ec8542e315ec5c81528083018290526101e08401528351808501909452736591c4bcd6d7a1eb4e537da8b78676c1576ba24484529083015261020081019190915290565b60008160200151156200047757815162000471906200047f565b92915050565b815162000471905b600080829050620004fd816001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa158015620004c8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620004ee919062000b13565b6001600160a01b031662000633565b806200057c57506200057c816001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000547573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200056d919062000b13565b6001600160a01b03166200066a565b15620005ee57806001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa158015620005c1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620005e7919062000b13565b9392505050565b806001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa158015620005c1573d6000803e3d6000fd5b50919050565b60006001600160a01b03821673c02aaa39b223fe8d0a0e5c4f27ead9083c756cc21480620004715750506001600160a01b03161590565b60006001600160a01b03821673dac17f958d2ee523a2206206994597c13d831ec71480620006b457506001600160a01b03821673a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48145b80620006dc57506001600160a01b038216735f98805a4e8be255a32880fdec7f6728c6568ba0145b806200070457506001600160a01b03821673056fd409e1d7a124bd7017459dfea2f387b6d5cd145b806200072c57506001600160a01b03821673853d955acef822db058eb8505911ed77f175b99e145b806200075457506001600160a01b038216731456688345527be1f37e9e627da0837d6f08c925145b806200077c57506001600160a01b0382167399d8a9c45b2eca8864373a26d1459e3dff1e17f3145b80620007a457506001600160a01b038216736b175474e89094c44da98b954eedeac495271d0f145b80620007cc57506001600160a01b038216730c10bf8fcb7bf5412187a595ab97a3609160b5c6145b806200047157506001600160a01b03821673956f47f50a910163d8bf957cf5846d573e7f87ca1492915050565b6040518061022001604052806011905b6040805180820190915260008082526020820152815260200190600190039081620008095790505090565b634e487b7160e01b600052604160045260246000fd5b600181811c908216806200085f57607f821691505b6020821081036200062d57634e487b7160e01b600052602260045260246000fd5b601f821115620008ce57600081815260208120601f850160051c81016020861015620008a95750805b601f850160051c820191505b81811015620008ca57828155600101620008b5565b5050505b505050565b81516001600160401b03811115620008ef57620008ef62000834565b62000907816200090084546200084a565b8462000880565b602080601f8311600181146200093f5760008415620009265750858301515b600019600386901b1c1916600185901b178555620008ca565b600085815260208120601f198616915b8281101562000970578886015182559484019460019091019084016200094f565b50858210156200098f5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b634e487b7160e01b600052601160045260246000fd5b600181815b80851115620009f6578160001904821115620009da57620009da6200099f565b80851615620009e857918102915b93841c9390800290620009ba565b509250929050565b60008262000a0f5750600162000471565b8162000a1e5750600062000471565b816001811462000a37576002811462000a425762000a62565b600191505062000471565b60ff84111562000a565762000a566200099f565b50506001821b62000471565b5060208310610133831016604e8410600b841016171562000a87575081810a62000471565b62000a938383620009b5565b806000190482111562000aaa5762000aaa6200099f565b029392505050565b6000620005e78383620009fe565b80820281158282048414176200047157620004716200099f565b60008262000af857634e487b7160e01b600052601260045260246000fd5b500490565b634e487b7160e01b600052603260045260246000fd5b60006020828403121562000b2657600080fd5b81516001600160a01b0381168114620005e757600080fd5b60805160a05160c05160e05161010051614dd562000bb460003960008181612ced0152612d7901526000818161046f01528181610a1c0152610e9f0152600081816102240152610e24015260006106ba01526000818161170e01528181611783015281816119e2015261215d0152614dd56000f3fe6080604052600436106101d85760003560e01c80635a04216e11610102578063a22cb46511610095578063bcc2579111610064578063bcc25791146105f0578063c7a100d0146106a8578063c87b56dd146106dc578063e985e9c5146106fc57600080fd5b8063a22cb4651461055a578063a9aa231f1461057a578063b560867e146105b0578063b88d4fde146105d057600080fd5b80638e54402f116100d15780638e54402f1461049357806394cb0947146104b357806395d89b41146105255780639e124d691461053a57600080fd5b80635a04216e146104005780636352211e1461042057806370a08231146104405780638da5cb5b1461046057600080fd5b806323b872dd1161017a57806342966c681161014957806342966c68146103985780634ab52bd6146103b857806357e8f717146103d857806357ff5d80146103ed57600080fd5b806323b872dd146103185780633a0a850d146103385780633a3378301461035857806342842e0e1461037857600080fd5b8063081812fc116101b6578063081812fc14610276578063095ea7b3146102ae5780630adc10af146102d0578063205b34fc146102f057600080fd5b806301ffc9a7146101dd578063027ac57b1461021257806306fdde0314610254575b600080fd5b3480156101e957600080fd5b506101fd6101f8366004613b8b565b610745565b60405190151581526020015b60405180910390f35b34801561021e57600080fd5b506102467f000000000000000000000000000000000000000000000000000000000000000081565b604051908152602001610209565b34801561026057600080fd5b5061026961082a565b6040516102099190613bf8565b34801561028257600080fd5b50610296610291366004613c0b565b6108bc565b6040516001600160a01b039091168152602001610209565b3480156102ba57600080fd5b506102ce6102c9366004613c39565b6108e3565b005b3480156102dc57600080fd5b506102ce6102eb366004613c0b565b610a19565b3480156102fc57600080fd5b5061029673d2dc058f4068ec0e42655f8a385eb6333fb67ab681565b34801561032457600080fd5b506102ce610333366004613c65565b610ae6565b34801561034457600080fd5b506101fd610353366004613ca6565b610b6e565b34801561036457600080fd5b50610269610373366004613d89565b610bd3565b34801561038457600080fd5b506102ce610393366004613c65565b610cd2565b3480156103a457600080fd5b506102ce6103b3366004613c0b565b610ced565b3480156103c457600080fd5b506102466103d3366004613c39565b610dc3565b3480156103e457600080fd5b50610246600681565b6102ce6103fb366004613deb565b610e52565b34801561040c57600080fd5b506102ce61041b366004613c0b565b610e9c565b34801561042c57600080fd5b5061029661043b366004613c0b565b610f66565b34801561044c57600080fd5b5061024661045b366004613ca6565b610fcb565b34801561046c57600080fd5b507f0000000000000000000000000000000000000000000000000000000000000000610296565b34801561049f57600080fd5b506102466104ae366004613c39565b611065565b3480156104bf57600080fd5b506105066104ce366004613ca6565b6007602052600090815260409020546001600160a01b0381169074010000000000000000000000000000000000000000900460ff1682565b604080516001600160a01b039093168352901515602083015201610209565b34801561053157600080fd5b5061026961152f565b34801561054657600080fd5b506102ce610555366004613e60565b61153e565b34801561056657600080fd5b506102ce610575366004613ed1565b611572565b34801561058657600080fd5b50610296610595366004613c0b565b600a602052600090815260409020546001600160a01b031681565b3480156105bc57600080fd5b506102466105cb366004613c39565b61157d565b3480156105dc57600080fd5b506102ce6105eb366004613f0a565b6115de565b3480156105fc57600080fd5b5061066461060b366004613c0b565b600960205260009081526040902080546001909101546fffffffffffffffffffffffffffffffff82169170010000000000000000000000000000000090046bffffffffffffffffffffffff16906001600160a01b031683565b604080516fffffffffffffffffffffffffffffffff90941684526bffffffffffffffffffffffff90921660208401526001600160a01b031690820152606001610209565b3480156106b457600080fd5b506102467f000000000000000000000000000000000000000000000000000000000000000081565b3480156106e857600080fd5b506102696106f7366004613c0b565b61166c565b34801561070857600080fd5b506101fd610717366004613f8a565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f80ac58cd0000000000000000000000000000000000000000000000000000000014806107d857507fffffffff0000000000000000000000000000000000000000000000000000000082167f5b5e139f00000000000000000000000000000000000000000000000000000000145b8061082457507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b60606000805461083990613fb8565b80601f016020809104026020016040519081016040528092919081815260200182805461086590613fb8565b80156108b25780601f10610887576101008083540402835291602001916108b2565b820191906000526020600020905b81548152906001019060200180831161089557829003601f168201915b5050505050905090565b60006108c782611b15565b506000908152600460205260409020546001600160a01b031690565b60006108ee82610f66565b9050806001600160a01b0316836001600160a01b03160361097c5760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e6560448201527f720000000000000000000000000000000000000000000000000000000000000060648201526084015b60405180910390fd5b336001600160a01b038216148061099857506109988133610717565b610a0a5760405162461bcd60e51b815260206004820152603d60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c0000006064820152608401610973565b610a148383611b79565b505050565b337f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031614610a7b576040517f30cd747100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000818152600260205260409020546001600160a01b0316610ae3576000818152600a6020526040902054610ab9906001600160a01b031682611bf4565b6000818152600a60205260409020805473ffffffffffffffffffffffffffffffffffffffff191690555b50565b610af1335b82611c0e565b610b635760405162461bcd60e51b815260206004820152602d60248201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560448201527f72206f7220617070726f766564000000000000000000000000000000000000006064820152608401610973565b610a14838383611c8d565b60006001600160a01b038216610b8657506001919050565b6001600160a01b0382811660009081526007602052604090205416151580610bbb5750610bbb826001600160a01b0316611ec3565b806108245750610824826001600160a01b0316612049565b6060836000610be2858561403a565b67ffffffffffffffff811115610bfa57610bfa613cc3565b6040519080825280601f01601f191660200182016040528015610c24576020820181803683370190505b509050845b84811015610cc657828181518110610c4357610c4361404d565b01602001517fff000000000000000000000000000000000000000000000000000000000000001682610c75888461403a565b81518110610c8557610c8561404d565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535080610cbe8161407c565b915050610c29565b509150505b9392505050565b610a14838383604051806020016040528060008152506115de565b610cf633610aeb565b610d685760405162461bcd60e51b815260206004820152602d60248201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560448201527f72206f7220617070726f766564000000000000000000000000000000000000006064820152608401610973565b600081815260096020526040902080547fffffffff00000000000000000000000000000000000000000000000000000000168155600101805473ffffffffffffffffffffffffffffffffffffffff19169055610ae38161207f565b6000610dce83610b6e565b610e0f576040517f733068030000000000000000000000000000000000000000000000000000000081526001600160a01b0384166004820152602401610973565b6000610e1b8484612121565b90506000610e497f0000000000000000000000000000000000000000000000000000000000000000836140c5565b95945050505050565b610e5a612241565b60005b81811015610e8d57610e85838383818110610e7a57610e7a61404d565b90506040020161229a565b600101610e5d565b50610e986001600655565b5050565b337f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031614610efe576040517f30cd747100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000818152600260205260409020546001600160a01b031615610ae357610f2481610f66565b6000828152600a60205260409020805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055610ae38161207f565b6000818152600260205260408120546001600160a01b0316806108245760405162461bcd60e51b815260206004820152601860248201527f4552433732313a20696e76616c696420746f6b656e20494400000000000000006044820152606401610973565b60006001600160a01b0382166110495760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f74206120766160448201527f6c6964206f776e657200000000000000000000000000000000000000000000006064820152608401610973565b506001600160a01b031660009081526003602052604090205490565b600080839050600080826001600160a01b0316630902f1ac6040518163ffffffff1660e01b8152600401606060405180830381865afa1580156110ac573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110d091906140f7565b506dffffffffffffffffffffffffffff1691506dffffffffffffffffffffffffffff169150600080600061116d866001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa15801561113b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061115f9190614147565b6001600160a01b0316612049565b806111e657506111e6866001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa1580156111b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111d89190614147565b6001600160a01b0316611ec3565b156112cf57856001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa158015611229573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061124d9190614147565b9250856001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa15801561128d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112b19190614147565b9150846112be8986614164565b6112c891906140c5565b9050611477565b611310866001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa15801561113b573d6000803e3d6000fd5b806113575750611357866001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa1580156111b4573d6000803e3d6000fd5b1561142f57856001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa15801561139a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113be9190614147565b9250856001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa1580156113fe573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114229190614147565b9150836112be8987614164565b60405162461bcd60e51b815260206004820152600c60248201527f496e76616c6964205061697200000000000000000000000000000000000000006044820152606401610973565b611489826001600160a01b0316612049565b156114f95760006114a2846001600160a01b031661268a565b6012146114c9576114bb846001600160a01b031661268a565b6114c690601261403a565b90505b6114d481600a61425f565b826114dd612712565b6114e79190614164565b6114f191906140c5565b915050611523565b61150b836001600160a01b031661268a565b61151690600a61425f565b6115209082614164565b90505b98975050505050505050565b60606001805461083990613fb8565b60005b81811015610a145761156a83838381811061155e5761155e61404d565b90506020020135610ced565b600101611541565b610e983383836127ce565b600080611592846001600160a01b031661268a565b905060006115a182600a61425f565b6115ac906064614164565b905060006115ba8683610dc3565b90506000816115c98488614164565b6115d391906140c5565b979650505050505050565b6115e83383611c0e565b61165a5760405162461bcd60e51b815260206004820152602d60248201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560448201527f72206f7220617070726f766564000000000000000000000000000000000000006064820152608401610973565b611666848484846128ba565b50505050565b6000818152600260205260409020546060906001600160a01b03166116f95760405162461bcd60e51b815260206004820152602f60248201527f4552433732314d657461646174613a2055524920717565727920666f72206e6f60448201527f6e6578697374656e7420746f6b656e00000000000000000000000000000000006064820152608401610973565b600082815260096020526040902060606117357f00000000000000000000000000000000000000000000000000000000000000006161a8614164565b825470010000000000000000000000000000000090046bffffffffffffffffffffffff161061177e57604051806080016040528060428152602001614d1e60429139905061180f565b6117aa7f0000000000000000000000000000000000000000000000000000000000000000611388614164565b825470010000000000000000000000000000000090046bffffffffffffffffffffffff16106117f357604051806080016040528060428152602001614c9a60429139905061180f565b604051806080016040528060428152602001614cdc6042913990505b6001820154600090611829906001600160a01b031661268a565b835490915060609060009061184f906fffffffffffffffffffffffffffffffff16612943565b9050600061185e84600a61425f565b865461187c91906fffffffffffffffffffffffffffffffff166140c5565b90508060000361198a576000825185611895919061403a565b905060008167ffffffffffffffff8111156118b2576118b2613cc3565b6040519080825280601f01601f1916602001820160405280156118dc576020820181803683370190505b50905060005b8281101561195e577f300000000000000000000000000000000000000000000000000000000000000082828151811061191d5761191d61404d565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350806119568161407c565b9150506118e2565b508084604051602001611972929190614287565b604051602081830303815290604052945050506119d3565b8151600061199783612943565b5190506119a383612943565b6119ae858385610bd3565b6040516020016119bf9291906142e2565b604051602081830303815290604052945050505b8554600090611a2e90611a29907f00000000000000000000000000000000000000000000000000000000000000009070010000000000000000000000000000000090046bffffffffffffffffffffffff166140c5565b612943565b9050600081604051602001611a43919061433a565b60408051601f198184030181529190526001890154909150600090611a70906001600160a01b03166129e3565b604051602001611a80919061443e565b6040516020818303038152906040529050600086604051602001611aa49190614568565b6040516020818303038152906040529050611ae5848a858585604051602001611ad195949392919061466c565b604051602081830303815290604052612a92565b604051602001611af5919061487d565b6040516020818303038152906040529a5050505050505050505050919050565b6000818152600260205260409020546001600160a01b0316610ae35760405162461bcd60e51b815260206004820152601860248201527f4552433732313a20696e76616c696420746f6b656e20494400000000000000006044820152606401610973565b6000818152600460205260409020805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0384169081179091558190611bbb82610f66565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b610e98828260405180602001604052806000815250612be5565b600080611c1a83610f66565b9050806001600160a01b0316846001600160a01b03161480611c6157506001600160a01b0380821660009081526005602090815260408083209388168352929052205460ff165b80611c855750836001600160a01b0316611c7a846108bc565b6001600160a01b0316145b949350505050565b826001600160a01b0316611ca082610f66565b6001600160a01b031614611d1c5760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201527f6f776e65720000000000000000000000000000000000000000000000000000006064820152608401610973565b6001600160a01b038216611d975760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152608401610973565b826001600160a01b0316611daa82610f66565b6001600160a01b031614611e265760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201527f6f776e65720000000000000000000000000000000000000000000000000000006064820152608401610973565b6000818152600460209081526040808320805473ffffffffffffffffffffffffffffffffffffffff199081169091556001600160a01b0387811680865260038552838620805460001901905590871680865283862080546001019055868652600290945282852080549092168417909155905184937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b60006001600160a01b03821673dac17f958d2ee523a2206206994597c13d831ec71480611f0c57506001600160a01b03821673a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48145b80611f3357506001600160a01b038216735f98805a4e8be255a32880fdec7f6728c6568ba0145b80611f5a57506001600160a01b03821673056fd409e1d7a124bd7017459dfea2f387b6d5cd145b80611f8157506001600160a01b03821673853d955acef822db058eb8505911ed77f175b99e145b80611fa857506001600160a01b038216731456688345527be1f37e9e627da0837d6f08c925145b80611fcf57506001600160a01b0382167399d8a9c45b2eca8864373a26d1459e3dff1e17f3145b80611ff657506001600160a01b038216736b175474e89094c44da98b954eedeac495271d0f145b8061201d57506001600160a01b038216730c10bf8fcb7bf5412187a595ab97a3609160b5c6145b8061082457506001600160a01b03821673956f47f50a910163d8bf957cf5846d573e7f87ca1492915050565b60006001600160a01b03821673c02aaa39b223fe8d0a0e5c4f27ead9083c756cc214806108245750506001600160a01b03161590565b600061208a82610f66565b905061209582610f66565b6000838152600460209081526040808320805473ffffffffffffffffffffffffffffffffffffffff199081169091556001600160a01b0385168085526003845282852080546000190190558785526002909352818420805490911690555192935084927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b600080612136846001600160a01b0316611ec3565b156121935761214d846001600160a01b031661268a565b61215890600a61425f565b6121827f000000000000000000000000000000000000000000000000000000000000000085614164565b61218c91906140c5565b9050610ccb565b6121a5846001600160a01b0316612049565b156121c657670de0b6b3a7640000836121bc612c6e565b6121829190614164565b6001600160a01b0384166000818152600760205260409020906121e89061268a565b6121f390600a61425f565b6040805180820190915282546001600160a01b038116825274010000000000000000000000000000000000000000900460ff16151560208201526122379086612cbc565b610e4991906140c5565b6002600654036122935760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610973565b6002600655565b6122a2612ce7565b156122d9576040517f99a8ee2b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006122e460085490565b90506122f4600880546001019055565b60006123296123066020850185613ca6565b61231660408601602087016148c2565b6bffffffffffffffffffffffff1661157d565b90506040518060600160405280826fffffffffffffffffffffffffffffffff16815260200184602001602081019061236191906148c2565b6bffffffffffffffffffffffff16815260209081019061238390860186613ca6565b6001600160a01b03908116909152600084815260096020908152604080832085518154878501516bffffffffffffffffffffffff16700100000000000000000000000000000000027fffffffff000000000000000000000000000000000000000000000000000000009091166fffffffffffffffffffffffffffffffff90921691909117178155940151600190940180549490931673ffffffffffffffffffffffffffffffffffffffff19909416939093179091559061244590850185613ca6565b6001600160a01b0316036125175760405160009073d2dc058f4068ec0e42655f8a385eb6333fb67ab6906fffffffffffffffffffffffffffffffff8416908381818185875af1925050503d80600081146124bb576040519150601f19603f3d011682016040523d82523d6000602084013e6124c0565b606091505b50509050806125115760405162461bcd60e51b815260206004820152601c60248201527f4661696c656420746f2073656e6420657468657220666f72204d544d000000006044820152606401610973565b506125e9565b6125246020840184613ca6565b6001600160a01b03166323b872dd336040517fffffffff0000000000000000000000000000000000000000000000000000000060e084901b1681526001600160a01b03909116600482015273d2dc058f4068ec0e42655f8a385eb6333fb67ab660248201526fffffffffffffffffffffffffffffffff841660448201526064016020604051808303816000875af11580156125c3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125e791906148f0565b505b6125f33383611bf4565b7f549cadaf82e309b1f182a0a544a4157b2b59c1cddd9f0e10d3316957f1950898608061262660408601602087016148c2565b6bffffffffffffffffffffffff16901b6fffffffffffffffffffffffffffffffff8316176126576020860186613ca6565b604080519283526001600160a01b03919091166020830152338282015260608201859052519081900360800190a1505050565b60006001600160a01b0382166126a257506012919050565b816001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa1580156126e0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612704919061490d565b60ff1692915050565b919050565b600080730d4a11d5eeaac28ec3f61d100daf4d40471f18529050600080826001600160a01b0316630902f1ac6040518163ffffffff1660e01b8152600401606060405180830381865afa15801561276d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061279191906140f7565b506dffffffffffffffffffffffffffff9182169350169050816127bc82670de0b6b3a7640000614164565b6127c691906140c5565b935050505090565b816001600160a01b0316836001600160a01b03160361282f5760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610973565b6001600160a01b0383811660008181526005602090815260408083209487168084529482529182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b6128c5848484611c8d565b6128d184848484612e11565b6116665760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e74657200000000000000000000000000006064820152608401610973565b6060600061295083612fb2565b600101905060008167ffffffffffffffff81111561297057612970613cc3565b6040519080825280601f01601f19166020018201604052801561299a576020820181803683370190505b5090508181016020015b600019017f3031323334353637383961626364656600000000000000000000000000000000600a86061a8153600a85049450846129a457509392505050565b60606001600160a01b038216612a2c57505060408051808201909152600881527f457468657265756d000000000000000000000000000000000000000000000000602082015290565b816001600160a01b03166306fdde036040518163ffffffff1660e01b8152600401600060405180830381865afa158015612a6a573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526108249190810190614930565b60608151600003612ab157505060408051602081019091526000815290565b6000604051806060016040528060408152602001614d606040913990506000600384516002612ae0919061499e565b612aea91906140c5565b612af5906004614164565b67ffffffffffffffff811115612b0d57612b0d613cc3565b6040519080825280601f01601f191660200182016040528015612b37576020820181803683370190505b509050600182016020820185865187015b80821015612ba3576003820191508151603f8160121c168501518453600184019350603f81600c1c168501518453600184019350603f8160061c168501518453600184019350603f8116850151845350600183019250612b48565b5050600386510660018114612bbf5760028114612bd257612bda565b603d6001830353603d6002830353612bda565b603d60018303535b509195945050505050565b612bef8383613094565b612bfc6000848484612e11565b610a145760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e74657200000000000000000000000000006064820152608401610973565b600080612c96612c917388e6a0c2ddd26feeb64f039a2c41296fcb3f564061322c565b613394565b9050612cb681730de0b6b3a76400000000000000000000000000006140c5565b91505090565b6000826020015115612cdb578251612cd49083611065565b9050610824565b8251612cd490836133b7565b600060027f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663d6fb16786040518163ffffffff1660e01b8152600401602060405180830381865afa158015612d49573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d6d91906149b1565b612d7791906140c5565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663108aae5b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612dd5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612df991906149ca565b6fffffffffffffffffffffffffffffffff1611905090565b60006001600160a01b0384163b15612fa7576040517f150b7a020000000000000000000000000000000000000000000000000000000081526001600160a01b0385169063150b7a0290612e6e9033908990889088906004016149fc565b6020604051808303816000875af1925050508015612ea9575060408051601f3d908101601f19168201909252612ea691810190614a38565b60015b612f5c573d808015612ed7576040519150601f19603f3d011682016040523d82523d6000602084013e612edc565b606091505b508051600003612f545760405162461bcd60e51b815260206004820152603260248201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560448201527f63656976657220696d706c656d656e74657200000000000000000000000000006064820152608401610973565b805181602001fd5b7fffffffff00000000000000000000000000000000000000000000000000000000167f150b7a0200000000000000000000000000000000000000000000000000000000149050611c85565b506001949350505050565b6000807a184f03e93ff9f4daa797ed6e38ed64bf6a1f0100000000000000008310612ffb577a184f03e93ff9f4daa797ed6e38ed64bf6a1f010000000000000000830492506040015b6d04ee2d6d415b85acef81000000008310613027576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc10000831061304557662386f26fc10000830492506010015b6305f5e100831061305d576305f5e100830492506008015b612710831061307157612710830492506004015b60648310613083576064830492506002015b600a83106108245760010192915050565b6001600160a01b0382166130ea5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610973565b6000818152600260205260409020546001600160a01b03161561314f5760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610973565b6000818152600260205260409020546001600160a01b0316156131b45760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610973565b6001600160a01b0382166000818152600360209081526040808320805460010190558483526002909152808220805473ffffffffffffffffffffffffffffffffffffffff19168417905551839291907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b60408051600280825260608201835260009283929190602083019080368337019050509050600f60ff16816000815181106132695761326961404d565b602002602001019063ffffffff16908163ffffffff16815250506000816001815181106132985761329861404d565b63ffffffff909216602092830291909101909101526040517f883bdbfd0000000000000000000000000000000000000000000000000000000081526000906001600160a01b0385169063883bdbfd906132f5908590600401614a55565b600060405180830381865afa158015613312573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261333a9190810190614b32565b509050611c85600f60000b826000815181106133585761335861404d565b6020026020010151836001815181106133735761337361404d565b60200260200101516133859190614bfe565b61338f9190614c43565b613762565b60006108246001600160a01b038316806c01000000000000000000000000613aab565b600082816133c7612c918361322c565b9050600080600061340f856001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa15801561113b573d6000803e3d6000fd5b806134565750613456856001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa1580156111b4573d6000803e3d6000fd5b1561354c57846001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa158015613499573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906134bd9190614147565b9250846001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa1580156134fd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906135219190614147565b91506c0100000000000000000000000061353b8589614164565b61354591906140c5565b90506136b9565b61358d856001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa15801561113b573d6000803e3d6000fd5b806135d457506135d4856001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa1580156111b4573d6000803e3d6000fd5b1561142f57846001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa158015613617573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061363b9190614147565b9250846001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa15801561367b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061369f9190614147565b91508361353b6c0100000000000000000000000089614164565b6136cb826001600160a01b0316612049565b1561373b5760006136e4846001600160a01b031661268a565b60121461370b576136fd846001600160a01b031661268a565b61370890601261403a565b90505b61371681600a61425f565b8261371f612c6e565b6137299190614164565b61373391906140c5565b9150506115d3565b61374d836001600160a01b031661268a565b61375890600a61425f565b6115239082614164565b60008060008360020b12613779578260020b613781565b8260020b6000035b9050620d89e88111156137c0576040517f2bc80f3a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000816001166000036137e4577001000000000000000000000000000000006137f6565b6ffffcb933bd6fad37aa2d162d1a5940015b70ffffffffffffffffffffffffffffffffff169050600282161561382a576ffff97272373d413259a46990580e213a0260801c5b6004821615613849576ffff2e50f5f656932ef12357cf3c7fdcc0260801c5b6008821615613868576fffe5caca7e10e4e61c3624eaa0941cd00260801c5b6010821615613887576fffcb9843d60f6159c9db58835c9266440260801c5b60208216156138a6576fff973b41fa98c081472e6896dfb254c00260801c5b60408216156138c5576fff2ea16466c96a3843ec78b326b528610260801c5b60808216156138e4576ffe5dee046a99a2a811c461f1969c30530260801c5b610100821615613904576ffcbe86c7900a88aedcffc83b479aa3a40260801c5b610200821615613924576ff987a7253ac413176f2b074cf7815e540260801c5b610400821615613944576ff3392b0822b70005940c7a398e4b70f30260801c5b610800821615613964576fe7159475a2c29b7443b29c7fa6e889d90260801c5b611000821615613984576fd097f3bdfd2022b8845ad8f792aa58250260801c5b6120008216156139a4576fa9f746462d870fdf8a65dc1f90e061e50260801c5b6140008216156139c4576f70d869a156d2a1b890bb3df62baf32f70260801c5b6180008216156139e4576f31be135f97d08fd981231505542fcfa60260801c5b62010000821615613a05576f09aa508b5b7a84e1c677de54f3e99bc90260801c5b62020000821615613a25576e5d6af8dedb81196699c329225ee6040260801c5b62040000821615613a44576d2216e584f5fa1ea926041bedfe980260801c5b62080000821615613a61576b048a170391f7dc42444e8fa20260801c5b60008460020b1315613a82578060001981613a7e57613a7e614096565b0490505b640100000000810615613a96576001613a99565b60005b60ff16602082901c0192505050919050565b6000808060001985870985870292508281108382030391505080600003613ae45760008411613ad957600080fd5b508290049050610ccb565b808411613af057600080fd5b6000848688096000868103871696879004966002600389028118808a02820302808a02820302808a02820302808a02820302808a02820302808a02909103029181900381900460010186841190950394909402919094039290920491909117919091029150509392505050565b7fffffffff0000000000000000000000000000000000000000000000000000000081168114610ae357600080fd5b600060208284031215613b9d57600080fd5b8135610ccb81613b5d565b60005b83811015613bc3578181015183820152602001613bab565b50506000910152565b60008151808452613be4816020860160208601613ba8565b601f01601f19169290920160200192915050565b602081526000610ccb6020830184613bcc565b600060208284031215613c1d57600080fd5b5035919050565b6001600160a01b0381168114610ae357600080fd5b60008060408385031215613c4c57600080fd5b8235613c5781613c24565b946020939093013593505050565b600080600060608486031215613c7a57600080fd5b8335613c8581613c24565b92506020840135613c9581613c24565b929592945050506040919091013590565b600060208284031215613cb857600080fd5b8135610ccb81613c24565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715613d1b57613d1b613cc3565b604052919050565b600067ffffffffffffffff821115613d3d57613d3d613cc3565b50601f01601f191660200190565b6000613d5e613d5984613d23565b613cf2565b9050828152838383011115613d7257600080fd5b828260208301376000602084830101529392505050565b600080600060608486031215613d9e57600080fd5b833567ffffffffffffffff811115613db557600080fd5b8401601f81018613613dc657600080fd5b613dd586823560208401613d4b565b9660208601359650604090950135949350505050565b60008060208385031215613dfe57600080fd5b823567ffffffffffffffff80821115613e1657600080fd5b818501915085601f830112613e2a57600080fd5b813581811115613e3957600080fd5b8660208260061b8501011115613e4e57600080fd5b60209290920196919550909350505050565b60008060208385031215613e7357600080fd5b823567ffffffffffffffff80821115613e8b57600080fd5b818501915085601f830112613e9f57600080fd5b813581811115613eae57600080fd5b8660208260051b8501011115613e4e57600080fd5b8015158114610ae357600080fd5b60008060408385031215613ee457600080fd5b8235613eef81613c24565b91506020830135613eff81613ec3565b809150509250929050565b60008060008060808587031215613f2057600080fd5b8435613f2b81613c24565b93506020850135613f3b81613c24565b925060408501359150606085013567ffffffffffffffff811115613f5e57600080fd5b8501601f81018713613f6f57600080fd5b613f7e87823560208401613d4b565b91505092959194509250565b60008060408385031215613f9d57600080fd5b8235613fa881613c24565b91506020830135613eff81613c24565b600181811c90821680613fcc57607f821691505b602082108103614005577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b818103818111156108245761082461400b565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6000600019820361408f5761408f61400b565b5060010190565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000826140d4576140d4614096565b500490565b80516dffffffffffffffffffffffffffff8116811461270d57600080fd5b60008060006060848603121561410c57600080fd5b614115846140d9565b9250614123602085016140d9565b9150604084015163ffffffff8116811461413c57600080fd5b809150509250925092565b60006020828403121561415957600080fd5b8151610ccb81613c24565b80820281158282048414176108245761082461400b565b600181815b808511156141b657816000190482111561419c5761419c61400b565b808516156141a957918102915b93841c9390800290614180565b509250929050565b6000826141cd57506001610824565b816141da57506000610824565b81600181146141f057600281146141fa57614216565b6001915050610824565b60ff84111561420b5761420b61400b565b50506001821b610824565b5060208310610133831016604e8410600b8410161715614239575081810a610824565b614243838361417b565b80600019048211156142575761425761400b565b029392505050565b6000610ccb83836141be565b6000815161427d818560208601613ba8565b9290920192915050565b7f302e0000000000000000000000000000000000000000000000000000000000008152600083516142bf816002850160208801613ba8565b8351908301906142d6816002840160208801613ba8565b01600201949350505050565b600083516142f4818460208801613ba8565b7f2e00000000000000000000000000000000000000000000000000000000000000908301908152835161432e816001840160208801613ba8565b01600101949350505050565b7f7b0000000000000000000000000000000000000000000000000000000000000081527f226b6579223a20224d506f696e7473222c20000000000000000000000000000060018201527f2274726169745f74797065223a20224d506f696e7473222c200000000000000060138201527f2276616c7565223a202200000000000000000000000000000000000000000000602c820152600082516143e4816036850160208701613ba8565b7f220000000000000000000000000000000000000000000000000000000000000060369390910192830152507f7d2c2000000000000000000000000000000000000000000000000000000000006037820152603a01919050565b7f7b0000000000000000000000000000000000000000000000000000000000000081527f226b6579223a2022546f6b656e205573656420746f204d696e74222c2000000060018201527f2274726169745f74797065223a2022546f6b656e205573656420746f204d696e601e8201527f74222c2000000000000000000000000000000000000000000000000000000000603e8201527f2276616c7565223a20220000000000000000000000000000000000000000000060428201526000825161450e81604c850160208701613ba8565b7f2200000000000000000000000000000000000000000000000000000000000000604c9390910192830152507f7d2c200000000000000000000000000000000000000000000000000000000000604d820152605001919050565b7f7b0000000000000000000000000000000000000000000000000000000000000081527f226b6579223a2022546f6b656e73205370656e74222c2000000000000000000060018201527f2274726169745f74797065223a2022546f6b656e73205370656e74222c20000060188201527f2276616c7565223a202200000000000000000000000000000000000000000000603682015260008251614612816040850160208701613ba8565b7f220000000000000000000000000000000000000000000000000000000000000060409390910192830152507f7d000000000000000000000000000000000000000000000000000000000000006041820152604201919050565b7f7b0000000000000000000000000000000000000000000000000000000000000081527f226e616d65223a20224d544d207c2000000000000000000000000000000000006001820152600086516146ca816010850160208b01613ba8565b7f204d506f696e74730000000000000000000000000000000000000000000000006010918401918201527f222c20000000000000000000000000000000000000000000000000000000000060188201527f2265787465726e616c5f75726c223a202268747470733a2f2f6d696461746f6b601b8201527f656e2e6170702f6d746d2d6d696e74222c200000000000000000000000000000603b8201527f22696d616765223a202200000000000000000000000000000000000000000000604d820152865161479f816057840160208b01613ba8565b61487061484761481e61481861481261480c6147e36057888a01017f222c200000000000000000000000000000000000000000000000000000000000815260030190565b7f2261747472696275746573223a205b00000000000000000000000000000000008152600f0190565b8c61426b565b8a61426b565b8861426b565b7f5d00000000000000000000000000000000000000000000000000000000000000815260010190565b7f7d00000000000000000000000000000000000000000000000000000000000000815260010190565b9998505050505050505050565b7f646174613a6170706c69636174696f6e2f6a736f6e3b6261736536342c0000008152600082516148b581601d850160208701613ba8565b91909101601d0192915050565b6000602082840312156148d457600080fd5b81356bffffffffffffffffffffffff81168114610ccb57600080fd5b60006020828403121561490257600080fd5b8151610ccb81613ec3565b60006020828403121561491f57600080fd5b815160ff81168114610ccb57600080fd5b60006020828403121561494257600080fd5b815167ffffffffffffffff81111561495957600080fd5b8201601f8101841361496a57600080fd5b8051614978613d5982613d23565b81815285602083850101111561498d57600080fd5b610e49826020830160208601613ba8565b808201808211156108245761082461400b565b6000602082840312156149c357600080fd5b5051919050565b6000602082840312156149dc57600080fd5b81516fffffffffffffffffffffffffffffffff81168114610ccb57600080fd5b60006001600160a01b03808716835280861660208401525083604083015260806060830152614a2e6080830184613bcc565b9695505050505050565b600060208284031215614a4a57600080fd5b8151610ccb81613b5d565b6020808252825182820181905260009190848201906040850190845b81811015614a9357835163ffffffff1683529284019291840191600101614a71565b50909695505050505050565b600067ffffffffffffffff821115614ab957614ab9613cc3565b5060051b60200190565b600082601f830112614ad457600080fd5b81516020614ae4613d5983614a9f565b82815260059290921b84018101918181019086841115614b0357600080fd5b8286015b84811015614b27578051614b1a81613c24565b8352918301918301614b07565b509695505050505050565b60008060408385031215614b4557600080fd5b825167ffffffffffffffff80821115614b5d57600080fd5b818501915085601f830112614b7157600080fd5b81516020614b81613d5983614a9f565b82815260059290921b84018101918181019089841115614ba057600080fd5b948201945b83861015614bce5785518060060b8114614bbf5760008081fd5b82529482019490820190614ba5565b91880151919650909350505080821115614be757600080fd5b50614bf485828601614ac3565b9150509250929050565b600682810b9082900b037fffffffffffffffffffffffffffffffffffffffffffffffffff800000000000008112667fffffffffffff821317156108245761082461400b565b60008160060b8360060b80614c5a57614c5a614096565b60001981147fffffffffffffffffffffffffffffffffffffffffffffffffff8000000000000083141615614c9057614c9061400b565b9005939250505056fe697066733a2f2f626166796265696870776b696b7067693763716374617273646a78743333783271766e77366f6f367976647265777561346e61637a6c6565716d61697066733a2f2f626166796265696567786f763767727672707a71766178786b79326a70357a687635613772367877323463377874637379336968766d6978336a75697066733a2f2f6261667962656964666e6b356d63706b7379786673346d7a617777626e65736a776e6572376d336c7a6461686675627a776b6632647977333575794142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2fa264697066735822122066bbc1e3b6cdc359d4fceccefec7530530a860f70e595319d893cfc518fdcff864736f6c63430008130033000000000000000000000000000000000000000000000000000000006451a400

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106101e55760003560e01c80633a213b661161010f578063a457c2d7116100a2578063d5abeb0111610071578063d5abeb01146104a2578063d6fb1678146104aa578063db6ca515146104b2578063dd62ed3e146104ba57600080fd5b8063a457c2d71461046a578063a9059cbb1461047d578063b8f4421f14610490578063bfd95b181461049857600080fd5b80637714bda0116100de5780637714bda01461043f57806381f51dcb1461044757806395d89b411461045a578063972488de1461046257600080fd5b80633a213b66146103e75780634d1f7740146103f15780635b8ed2e61461040e57806370a082311461041657600080fd5b806318160ddd11610187578063313ce56711610156578063313ce56714610399578063321f8aa2146103a857806332590c5c146103b157806339509351146103d457600080fd5b806318160ddd1461032e578063205b34fc1461034057806323b872dd146103735780632cf6551a1461038657600080fd5b8063095ea7b3116101c3578063095ea7b31461026f5780630ffd626e14610292578063108aae5b1461029a5780631609506e146102cc57600080fd5b806306040618146101ea57806306fdde03146102455780630849438f1461025a575b600080fd5b60075461022c906001600160801b03811690600160801b810467ffffffffffffffff1690600160c01b810466ffffffffffffff1690600160f81b900460ff1684565b60405161023c9493929190612091565b60405180910390f35b61024d6104f3565b60405161023c9190612106565b61026d610268366004612172565b610585565b005b61028261027d3660046121fc565b610754565b604051901515815260200161023c565b61026d61076e565b6009546102b490600160801b90046001600160801b031681565b6040516001600160801b03909116815260200161023c565b6103076102da366004612228565b6006602052600090815260409020546001600160801b03811690600160801b900466ffffffffffffff1682565b604080516001600160801b03909316835266ffffffffffffff90911660208301520161023c565b6002545b60405190815260200161023c565b61035b73d2dc058f4068ec0e42655f8a385eb6333fb67ab681565b6040516001600160a01b03909116815260200161023c565b61028261038136600461224c565b610780565b6009546102b4906001600160801b031681565b6040516006815260200161023c565b620a97b86102b4565b6103bb62278d0081565b60405167ffffffffffffffff909116815260200161023c565b6102826103e23660046121fc565b6107a4565b6103bb6202a30081565b60075442600160801b90910467ffffffffffffffff161115610282565b6102826107e3565b610332610424366004612228565b6001600160a01b031660009081526020819052604090205490565b61026d610842565b60085461035b906001600160a01b031681565b61024d6109b3565b6102826109c2565b6102826104783660046121fc565b610a0a565b61028261048b3660046121fc565b610ab4565b61026d610ac2565b6103bb6206978081565b6102b4610ad2565b6102b4610ae7565b61026d610b25565b6103326104c836600461228d565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b606060038054610502906122c6565b80601f016020809104026020016040519081016040528092919081815260200182805461052e906122c6565b801561057b5780601f106105505761010080835404028352916020019161057b565b820191906000526020600020905b81548152906001019060200180831161055e57829003601f168201915b5050505050905090565b61058d610bda565b610595610ad2565b6001600160801b03166105a760025490565b6009546105bd91906001600160801b0316612348565b0361060d576105ca610ad2565b6040517f342db5f60000000000000000000000000000000000000000000000000000000081526001600160801b0390911660048201526024015b60405180910390fd5b60075433600090815260066020526040902054600160c01b90910466ffffffffffffff908116600160801b9092041603610688576007546040517f31775d51000000000000000000000000000000000000000000000000000000008152600160c01b90910466ffffffffffffff166004820152602401610604565b6000600754600160f81b900460ff1660018111156106a8576106a8612062565b146106f5576007546040517f46a20837000000000000000000000000000000000000000000000000000000008152600160801b90910467ffffffffffffffff166004820152602401610604565b610731828280806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250610c3392505050565b6107396107e3565b1561074657610746610ac2565b6107506001600555565b5050565b600033610762818585610fae565b60019150505b92915050565b610776611106565b61077e6111c7565b565b60003361078e858285611314565b6107998585856113c4565b506001949350505050565b3360008181526001602090815260408083206001600160a01b038716845290915281205490919061076290829086906107de908790612348565b610fae565b60075460009042600160801b90910467ffffffffffffffff161115801561082757506000600754600160f81b900460ff16600181111561082557610825612062565b145b801561083d57506007546001600160801b031615155b905090565b61084a610bda565b6108526109c2565b1561085f5761085f61076e565b610867610ad2565b6001600160801b031661087960025490565b60095461088f91906001600160801b0316612348565b0361089c576105ca610ad2565b60075433600090815260066020526040902054600160c01b90910466ffffffffffffff908116600160801b9092041603610917576007546040517f31775d51000000000000000000000000000000000000000000000000000000008152600160c01b90910466ffffffffffffff166004820152602401610604565b6000600754600160f81b900460ff16600181111561093757610937612062565b14610984576007546040517f46a20837000000000000000000000000000000000000000000000000000000008152600160801b90910467ffffffffffffffff166004820152602401610604565b61098c6115b1565b61099461170b565b61099c6107e3565b156109a9576109a9610ac2565b61077e6001600555565b606060048054610502906122c6565b60075460009042600160801b90910467ffffffffffffffff161115801561083d57506001600754600160f81b900460ff166001811115610a0457610a04612062565b14905090565b3360008181526001602090815260408083206001600160a01b038716845290915281205490919083811015610aa75760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f0000000000000000000000000000000000000000000000000000006064820152608401610604565b6107998286868403610fae565b6000336107628185856113c4565b610aca611a39565b61077e611b3f565b600061083d620f4240652632e314a00061235b565b60006002610afe620f4240652632e314a00061235b565b610b089190612386565b610b1b620f4240652632e314a00061235b565b61083d91906123d3565b610b2d6109c2565b15610b3a57610b3a61076e565b60075433600090815260066020526040902054600160c01b90910466ffffffffffffff908116600160801b9092041603610bb5576007546040517f31775d51000000000000000000000000000000000000000000000000000000008152600160c01b90910466ffffffffffffff166004820152602401610604565b610bbd6115b1565b610bc5611c10565b610bcd6107e3565b1561077e5761077e610ac2565b600260055403610c2c5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610604565b6002600555565b33600090815260066020526040812090805b8351811015610ed3576000848281518110610c6257610c626123fa565b60200260200101519050610c733390565b6040517f6352211e000000000000000000000000000000000000000000000000000000008152600481018390526001600160a01b03918216917f000000000000000000000000f9ea27d6248d2c0b0b064c19e7b532bbb9fec50a1690636352211e90602401602060405180830381865afa158015610cf5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d199190612429565b6001600160a01b031614610d59576040517f87ff008900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517fbcc25791000000000000000000000000000000000000000000000000000000008152600481018290526000907f000000000000000000000000f9ea27d6248d2c0b0b064c19e7b532bbb9fec50a6001600160a01b03169063bcc2579190602401606060405180830381865afa158015610dda573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dfe9190612446565b506bffffffffffffffffffffffff169150610e1b905081856124b0565b6040517f5a04216e000000000000000000000000000000000000000000000000000000008152600481018490529094507f000000000000000000000000f9ea27d6248d2c0b0b064c19e7b532bbb9fec50a6001600160a01b031690635a04216e90602401600060405180830381600087803b158015610e9957600080fd5b505af1158015610ead573d6000803e3d6000fd5b505050600180870180548083018255600091825260209091200193909355505001610c45565b506000610eeb610ee6620a97b88461235b565b611dad565b835490915081908490600090610f0b9084906001600160801b03166124b0565b82546101009290920a6001600160801b038181021990931691909216919091021790555060075483547fffffffffffffffffff00000000000000ffffffffffffffffffffffffffffffff16600160c01b90910466ffffffffffffff16600160801b021783556040517fca22edca75caca8fc8520b141f5a2b1fa7bc914e5c46e421ef1d872596fe516e90610fa09085906124d0565b60405180910390a150505050565b6001600160a01b0383166110295760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f72657373000000000000000000000000000000000000000000000000000000006064820152608401610604565b6001600160a01b0382166110a55760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f73730000000000000000000000000000000000000000000000000000000000006064820152608401610604565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6000600754600160f81b900460ff16600181111561112657611126612062565b0361115d576040517fb240622500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60075442600160801b90910467ffffffffffffffff16111561077e576007546040517f7aee4b4e000000000000000000000000000000000000000000000000000000008152600160801b90910467ffffffffffffffff166004820152426024820152604401610604565b600780547effffffffffffffffffffffffffffff00000000000000000000000000000000168082556202a3009190601090611214908490600160801b900467ffffffffffffffff1661254d565b92506101000a81548167ffffffffffffffff021916908367ffffffffffffffff1602179055506001600760000160188282829054906101000a900466ffffffffffffff16611262919061256e565b82546101009290920a66ffffffffffffff8181021990931691831602179091556007547f80bcdd1c59d3ace14f9b09f0139000e27892da31911a0c83175ab112890441639250600160801b810467ffffffffffffffff1691600160c01b82041690600160f81b900460ff1660018111156112de576112de612062565b6040805167ffffffffffffffff909416845266ffffffffffffff909216602084015260ff169082015260600160405180910390a1565b6001600160a01b038381166000908152600160209081526040808320938616835292905220547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146113be57818110156113b15760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610604565b6113be8484848403610fae565b50505050565b6001600160a01b0383166114405760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f64726573730000000000000000000000000000000000000000000000000000006064820152608401610604565b6001600160a01b0382166114bc5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f65737300000000000000000000000000000000000000000000000000000000006064820152608401610604565b6001600160a01b0383166000908152602081905260409020548181101561154b5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e636500000000000000000000000000000000000000000000000000006064820152608401610604565b6001600160a01b03848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a36113be565b336000908152600660205260408120805490916001600160801b03821691600160801b900466ffffffffffffff169082900361161b576040517f6e377652000000000000000000000000000000000000000000000000000000008152336004820152602401610604565b82547fffffffffffffffffff000000000000000000000000000000000000000000000016835561165433836001600160801b0316611f69565b600980548391906000906116729084906001600160801b03166123d3565b92506101000a8154816001600160801b0302191690836001600160801b031602179055507ff0193af62631cc04f42841d590c093e885b44520cbb14dc573193023f80cb2846116be3390565b604080516001600160a01b0390921682526001600160801b03851676ffffffffffffff00000000000000000000000000000000608086901b161760208301520160405180910390a1505050565b33600090815260066020908152604080832060018101805483518186028101860190945280845291949390919083018282801561176757602002820191906000526020600020905b815481526020019060010190808311611753575b505050505090506000805b825181101561195457600083828151811061178f5761178f6123fa565b602002602001015190506117a03390565b6040517fa9aa231f000000000000000000000000000000000000000000000000000000008152600481018390526001600160a01b03918216917f000000000000000000000000f9ea27d6248d2c0b0b064c19e7b532bbb9fec50a169063a9aa231f90602401602060405180830381865afa158015611822573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118469190612429565b6001600160a01b031614611886576040517f87ff008900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517fbcc25791000000000000000000000000000000000000000000000000000000008152600481018290526000907f000000000000000000000000f9ea27d6248d2c0b0b064c19e7b532bbb9fec50a6001600160a01b03169063bcc2579190602401606060405180830381865afa158015611907573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061192b9190612446565b506bffffffffffffffffffffffff169150611948905081856124b0565b93505050600101611772565b506000611967610ee6620a97b88461235b565b8454909150819085906000906119879084906001600160801b03166124b0565b82546101009290920a6001600160801b038181021990931691909216919091021790555060075484547fffffffffffffffffff00000000000000ffffffffffffffffffffffffffffffff16600160c01b90910466ffffffffffffff16600160801b021784556040517fca22edca75caca8fc8520b141f5a2b1fa7bc914e5c46e421ef1d872596fe516e90611a1c9086906124d0565b60405180910390a1611a2c6107e3565b156113be576113be610ac2565b6001600754600160f81b900460ff166001811115611a5957611a59612062565b03611a90576040517f04bf600600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60075442600160801b90910467ffffffffffffffff161115611afa576007546040517ff9526e32000000000000000000000000000000000000000000000000000000008152600160801b90910467ffffffffffffffff166004820152426024820152604401610604565b6007546001600160801b031660000361077e576040517fa23ce9d300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600780547effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff16600160f81b1780825562278d009190601090611b92908490600160801b900467ffffffffffffffff1661254d565b82546101009290920a67ffffffffffffffff8181021990931691831602179091556007547f80bcdd1c59d3ace14f9b09f0139000e27892da31911a0c83175ab112890441639250600160801b810490911690600160c01b810466ffffffffffffff1690600160f81b900460ff1660018111156112de576112de612062565b336000908152600660209081526040808320600181018054835181860281018601909452808452919493909190830182828015611c6c57602002820191906000526020600020905b815481526020019060010190808311611c58575b505050505090508051600003611cb0576040517f7cf77aaa000000000000000000000000000000000000000000000000000000008152336004820152602401610604565b60005b8151811015611d61577f000000000000000000000000f9ea27d6248d2c0b0b064c19e7b532bbb9fec50a6001600160a01b0316630adc10af838381518110611cfd57611cfd6123fa565b60200260200101516040518263ffffffff1660e01b8152600401611d2391815260200190565b600060405180830381600087803b158015611d3d57600080fd5b505af1158015611d51573d6000803e3d6000fd5b505060019092019150611cb39050565b50611d70600183016000612028565b7fb17dbdd0d485b2e72d19052ba4bec3bb3c7d573101e1cd07e66bbb875ffcb9d43382604051611da192919061258e565b60405180910390a15050565b6000816001600160801b0316600003611df2576040517f030858b900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600954600090611e0c9084906001600160801b03166124b0565b9050611e16610ad2565b6001600160801b0316611e2860025490565b611e3b906001600160801b038416612348565b1115611e8557611e49610ad2565b6001600160801b0316611e5b60025490565b611e6e906001600160801b038416612348565b611e7891906125e5565b611e8290846123d3565b92505b82600960108282829054906101000a90046001600160801b0316611ea991906124b0565b92506101000a8154816001600160801b0302191690836001600160801b0316021790555082600760000160008282829054906101000a90046001600160801b0316611ef491906124b0565b92506101000a8154816001600160801b0302191690836001600160801b0316021790555082600960008282829054906101000a90046001600160801b0316611f3c91906124b0565b92506101000a8154816001600160801b0302191690836001600160801b0316021790555082915050919050565b6001600160a01b038216611fbf5760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610604565b8060026000828254611fd19190612348565b90915550506001600160a01b038216600081815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b50805460008255906000526020600020908101906120469190612049565b50565b5b8082111561205e576000815560010161204a565b5090565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b6001600160801b038516815267ffffffffffffffff8416602082015266ffffffffffffff8316604082015260808101600283106120f7577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b82606083015295945050505050565b600060208083528351808285015260005b8181101561213357858101830151858201604001528201612117565b5060006040828601015260407fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8301168501019250505092915050565b6000806020838503121561218557600080fd5b823567ffffffffffffffff8082111561219d57600080fd5b818501915085601f8301126121b157600080fd5b8135818111156121c057600080fd5b8660208260051b85010111156121d557600080fd5b60209290920196919550909350505050565b6001600160a01b038116811461204657600080fd5b6000806040838503121561220f57600080fd5b823561221a816121e7565b946020939093013593505050565b60006020828403121561223a57600080fd5b8135612245816121e7565b9392505050565b60008060006060848603121561226157600080fd5b833561226c816121e7565b9250602084013561227c816121e7565b929592945050506040919091013590565b600080604083850312156122a057600080fd5b82356122ab816121e7565b915060208301356122bb816121e7565b809150509250929050565b600181811c908216806122da57607f821691505b602082108103612313577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b8082018082111561076857610768612319565b6001600160801b0381811683821602808216919082811461237e5761237e612319565b505092915050565b60006001600160801b03808416806123c7577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b92169190910492915050565b6001600160801b038281168282160390808211156123f3576123f3612319565b5092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60006020828403121561243b57600080fd5b8151612245816121e7565b60008060006060848603121561245b57600080fd5b83516001600160801b038116811461247257600080fd5b60208501519093506bffffffffffffffffffffffff8116811461249457600080fd5b60408501519092506124a5816121e7565b809150509250925092565b6001600160801b038181168382160190808211156123f3576123f3612319565b600060208083526080830184546001600160801b0381168386015266ffffffffffffff8160801c16604086015250600180860160608087015282815480855260a08801915082600052856000209450600092505b808310156125415784548252938301939183019190850190612524565b50979650505050505050565b67ffffffffffffffff8181168382160190808211156123f3576123f3612319565b66ffffffffffffff8181168382160190808211156123f3576123f3612319565b6000604082016001600160a01b03851683526020604081850152818551808452606086019150828701935060005b818110156125d8578451835293830193918301916001016125bc565b5090979650505050505050565b818103818111156107685761076861231956fea2646970667358221220f8dab023ca454694da326cadcda641d7ba6219a24bb0a904fa538c3a5eb2351264736f6c63430008130033

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

000000000000000000000000000000000000000000000000000000006451a400

-----Decoded View---------------
Arg [0] : _launchTime (uint64): 1683072000

-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 000000000000000000000000000000000000000000000000000000006451a400


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.