ETH Price: $2,087.97 (-1.74%)

Contract

0xcafea970135C07B07a3eCA76C6c00AAC849767b3
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To

There are no matching entries

1 Internal Transaction found.

Latest 1 internal transaction

Advanced mode:
Parent Transaction Hash Method Block
From
To
0x60e06040175140052023-06-19 13:11:11998 days ago1687180271  Contract Creation0 ETH
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Validator Index Block Amount
View All Withdrawals

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

Contract Source Code Verified (Exact Match)

Contract Name:
StakingViewer

Compiler Version
v0.8.18+commit.87f61d96

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
// SPDX-License-Identifier: GPL-3.0-only

pragma solidity ^0.8.18;

import "../../abstract/Multicall.sol";
import "../../interfaces/ICover.sol";
import "../../interfaces/INXMMaster.sol";
import "../../interfaces/IStakingNFT.sol";
import "../../interfaces/IStakingPool.sol";
import "../../interfaces/IStakingProducts.sol";
import "../../interfaces/IStakingPoolFactory.sol";
import "../../libraries/StakingPoolLibrary.sol";
import "../../libraries/UncheckedMath.sol";

contract StakingViewer is Multicall {
  using UncheckedMath for uint;

  struct Pool {
    uint poolId;
    bool isPrivatePool;
    address manager;
    uint poolFee;
    uint maxPoolFee;
    uint activeStake;
    uint currentAPY;
  }

  struct StakingProduct {
    uint productId;
    uint lastEffectiveWeight;
    uint targetWeight;
    uint targetPrice;
    uint bumpedPrice;
    uint bumpedPriceUpdateTime;
  }

  struct Deposit {
    uint tokenId;
    uint trancheId;
    uint stake;
    uint stakeShares;
    uint reward;
  }

  struct Token {
    uint tokenId;
    uint poolId;
    uint activeStake;
    uint expiredStake;
    uint rewards;
    Deposit[] deposits;
  }

  struct TokenPoolMap {
    uint poolId;
    uint tokenId;
  }

  struct AggregatedTokens {
    uint totalActiveStake;
    uint totalExpiredStake;
    uint totalRewards;
  }

  struct AggregatedRewards {
    uint totalRewards;
    uint[] trancheIds;
  }

  INXMMaster public immutable master;
  IStakingNFT public immutable stakingNFT;
  IStakingPoolFactory public immutable stakingPoolFactory;

  uint public constant TRANCHE_DURATION = 91 days;
  uint public constant MAX_ACTIVE_TRANCHES = 8;
  uint public constant ONE_NXM = 1 ether;
  uint public constant TRANCHE_ID_AT_DEPLOY = 213; // first active tranche at deploy time
  uint public constant MAX_UINT = type(uint).max;

  constructor(
    INXMMaster _master,
    IStakingNFT _stakingNFT,
    IStakingPoolFactory _stakingPoolFactory
  ) {
    master = _master;
    stakingNFT = _stakingNFT;
    stakingPoolFactory = _stakingPoolFactory;
  }

  function cover() internal view returns (ICover) {
    return ICover(master.contractAddresses('CO'));
  }

  function stakingProducts() internal view returns (IStakingProducts) {
    return IStakingProducts(master.contractAddresses('SP'));
  }

  function stakingPool(uint poolId) public view returns (IStakingPool) {
    return IStakingPool(
      StakingPoolLibrary.getAddress(address(stakingPoolFactory), poolId)
    );
  }

  /* ========== STAKING POOL ========== */

  function getPool(uint poolId) public view returns (Pool memory pool) {

    IStakingPool _stakingPool = stakingPool(poolId);

    pool.poolId = poolId;
    pool.isPrivatePool = _stakingPool.isPrivatePool();
    pool.manager = _stakingPool.manager();
    pool.poolFee = _stakingPool.getPoolFee();
    pool.maxPoolFee = _stakingPool.getMaxPoolFee();
    pool.activeStake = _stakingPool.getActiveStake();
    pool.currentAPY =
      _stakingPool.getActiveStake() != 0
        ? 1 ether * _stakingPool.getRewardPerSecond() * 365 days / _stakingPool.getActiveStake()
        : 0;

    return pool;
  }

  function getPools(uint[] memory poolIds) public view returns (Pool[] memory pools) {

    uint poolsLength = poolIds.length;
    pools = new Pool[](poolsLength);

    for (uint i = 0; i < poolsLength; i++) {
      pools[i] = getPool(poolIds[i]);
    }

    return pools;
  }

  function getAllPools() public view returns (Pool[] memory pools) {

    uint poolCount = stakingPoolFactory.stakingPoolCount();
    pools = new Pool[](poolCount);

    for (uint i = 0; i < poolCount; i++) {
      pools[i] = getPool(i+1); // poolId starts from 1
    }

    return pools;
  }

  function getProductPools(uint productId) public view returns (Pool[] memory pools) {
    uint queueSize = 0;
    uint poolCount = stakingPoolFactory.stakingPoolCount();
    Pool[] memory stakedPoolsQueue = new Pool[](poolCount);

    for (uint i = 1; i <= poolCount; i++) {
      (
        uint lastEffectiveWeight,
        uint targetWeight,
        /* uint targetPrice */,
        /* uint bumpedPrice */,
        uint bumpedPriceUpdateTime
      ) = stakingProducts().getProduct(i, productId);

      if (targetWeight == 0 && lastEffectiveWeight == 0 && bumpedPriceUpdateTime == 0) {
        continue;
      }

      Pool memory pool = getPool(i);
      stakedPoolsQueue[queueSize] = pool;
      queueSize++;
    }
    pools = new Pool[](queueSize);

    for (uint i = 0; i < queueSize; i++) {
      pools[i] = stakedPoolsQueue[i];
    }

    return pools;
  }

  /* ========== PRODUCTS ========== */

  function getPoolProducts(uint poolId) public view returns (StakingProduct[] memory products) {

    uint stakedProductsCount = 0;
    uint coverProductCount = cover().productsCount();
    StakingProduct[] memory stakedProductsQueue = new StakingProduct[](coverProductCount);

    for (uint i = 0; i < coverProductCount; i++) {
      (
        uint lastEffectiveWeight,
        uint targetWeight,
        uint targetPrice,
        uint bumpedPrice,
        uint bumpedPriceUpdateTime
      ) = stakingProducts().getProduct(poolId, i);

      if (targetWeight == 0 && lastEffectiveWeight == 0 && bumpedPriceUpdateTime == 0) {
        continue;
      }

      StakingProduct memory product;
      product.productId = i;
      product.lastEffectiveWeight = lastEffectiveWeight;
      product.targetWeight = targetWeight;
      product.bumpedPrice = bumpedPrice;
      product.targetPrice = targetPrice;
      product.bumpedPriceUpdateTime = bumpedPriceUpdateTime;

      stakedProductsQueue[stakedProductsCount] = product;
      stakedProductsCount++;
    }

    products = new StakingProduct[](stakedProductsCount);

    for (uint i = 0; i < stakedProductsCount; i++) {
      products[i] = stakedProductsQueue[i];
    }

    return products;
  }

  /* ========== TOKENS AND DEPOSITS ========== */

  function getStakingPoolsOf(
    uint[] memory tokenIds
  ) public view returns (TokenPoolMap[] memory tokenPools) {

    tokenPools = new TokenPoolMap[](tokenIds.length);

    for (uint i = 0; i < tokenIds.length; i++) {
      uint tokenId = tokenIds[i];
      uint poolId = stakingNFT.stakingPoolOf(tokenId);
      tokenPools[i] = TokenPoolMap(poolId, tokenId);
    }

    return tokenPools;
  }

  function _getToken(uint poolId, uint tokenId) internal view returns (Token memory token) {

    IStakingPool _stakingPool = stakingPool(poolId);

    uint firstActiveTrancheId = block.timestamp / TRANCHE_DURATION;
    uint depositCount;

    Deposit[] memory depositsQueue;
    {
      uint maxTranches = firstActiveTrancheId - TRANCHE_ID_AT_DEPLOY + MAX_ACTIVE_TRANCHES;
      depositsQueue = new Deposit[](maxTranches);
    }

    // Active tranches

    for (uint i = 0; i < MAX_ACTIVE_TRANCHES; i++) {
      (
        uint lastAccNxmPerRewardShare,
        uint pendingRewards,
        uint stakeShares,
        uint rewardsShares
      ) = _stakingPool.getDeposit(tokenId, firstActiveTrancheId + i);

      if (rewardsShares == 0) {
        continue;
      }

      Deposit memory deposit;
      deposit.tokenId = tokenId;
      deposit.trancheId = firstActiveTrancheId + i;

      uint stake =
        _stakingPool.getActiveStake()
        * stakeShares
        / _stakingPool.getStakeSharesSupply();

      uint newRewardPerShare = _stakingPool.getAccNxmPerRewardsShare().uncheckedSub(lastAccNxmPerRewardShare);
      uint reward = pendingRewards + newRewardPerShare * rewardsShares / ONE_NXM;

      deposit.stake = stake;
      deposit.stakeShares = stakeShares;
      deposit.reward = reward;
      depositsQueue[depositCount++] = deposit;

      token.activeStake += stake;
      token.rewards += reward;
    }

    // Expired tranches

    for (uint i = TRANCHE_ID_AT_DEPLOY; i < firstActiveTrancheId; i++) {
      (
        uint lastAccNxmPerRewardShare,
        uint pendingRewards,
        uint stakeShares,
        uint rewardsShares
      ) = _stakingPool.getDeposit(tokenId, i);

      if (rewardsShares == 0) {
        continue;
      }

      (
        uint accNxmPerRewardShareAtExpiry,
        uint stakeAmountAtExpiry,
        uint stakeShareSupplyAtExpiry
      ) = _stakingPool.getExpiredTranche(i);

      // to avoid this the workaround is to call processExpirations as the first call in the
      // multicall batch. this will require the call to be explicitly be static in js:
      // viewer.callStatic.multicall(...)
      require(stakeShareSupplyAtExpiry != 0, "Tranche expired but expirations were not processed");

      Deposit memory deposit;
      deposit.stake = stakeAmountAtExpiry * stakeShares / stakeShareSupplyAtExpiry;
      deposit.stakeShares = stakeShares;

      uint newRewardPerShare = accNxmPerRewardShareAtExpiry.uncheckedSub(lastAccNxmPerRewardShare);
      deposit.reward = pendingRewards + newRewardPerShare * rewardsShares / ONE_NXM;

      deposit.tokenId = tokenId;
      deposit.trancheId = i;

      depositsQueue[depositCount] = deposit;
      depositCount++;

      token.expiredStake += deposit.stake;
      token.rewards += deposit.reward;
    }

    token.tokenId = tokenId;
    token.poolId = poolId;
    token.deposits = new Deposit[](depositCount);

    for (uint i = 0; i < depositCount; i++) {
      token.deposits[i] = depositsQueue[i];
    }

    return token;
  }

  function getToken(uint tokenId) public view returns (Token memory token) {
    uint poolId = stakingNFT.stakingPoolOf(tokenId);
    return _getToken(poolId, tokenId);
  }

  function getTokens(uint[] memory tokenIds) public view returns (Token[] memory tokens) {

    tokens = new Token[](tokenIds.length);

    for (uint i = 0; i < tokenIds.length; i++) {
      uint poolId = stakingNFT.stakingPoolOf(tokenIds[i]);
      tokens[i] = _getToken(poolId, tokenIds[i]);
    }

    return tokens;
  }

  function getAggregatedTokens(
    uint[] calldata tokenIds
  ) public view returns (AggregatedTokens memory aggregated) {

    for (uint i = 0; i < tokenIds.length; i++) {
      Token memory token = getToken(tokenIds[i]);
      aggregated.totalActiveStake += token.activeStake;
      aggregated.totalExpiredStake += token.expiredStake;
      aggregated.totalRewards += token.rewards;
    }

    return aggregated;
  }

  function getManagerRewards (uint[] memory poolIds) public view returns (Token[] memory tokens) {
    tokens = new Token[](poolIds.length);

    for (uint i = 0; i < poolIds.length; i++) {
      tokens[i] = _getToken(poolIds[i], 0);
    }
  }

  function processExpirations(uint[] memory poolIds) public {
    for (uint i = 0; i < poolIds.length; i++) {
      stakingPool(poolIds[i]).processExpirations(true);
    }
  }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.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: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

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

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

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

pragma solidity ^0.8.0;

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

File 4 of 13 : Multicall.sol
// SPDX-License-Identifier: GPL-3.0-only

pragma solidity ^0.8.18;

abstract contract Multicall {

  error RevertedWithoutReason(uint index);

  // WARNING: Do not set this function as payable
  function multicall(bytes[] calldata data) external returns (bytes[] memory results) {

    uint callCount = data.length;
    results = new bytes[](callCount);

    for (uint i = 0; i < callCount; i++) {
      (bool ok, bytes memory result) = address(this).delegatecall(data[i]);

      if (!ok) {

        uint length = result.length;

        // 0 length returned from empty revert() / require(false)
        if (length == 0) {
          revert RevertedWithoutReason(i);
        }

        assembly {
          revert(add(result, 0x20), length)
        }
      }

      results[i] = result;
    }
  }
}

// SPDX-License-Identifier: GPL-3.0-only

pragma solidity >=0.5.0;

import "./ICoverNFT.sol";
import "./IStakingNFT.sol";
import "./IStakingPool.sol";
import "./IStakingPoolFactory.sol";

/* ========== DATA STRUCTURES ========== */

enum ClaimMethod {
  IndividualClaims,
  YieldTokenIncidents
}

// Basically CoverStatus from QuotationData.sol but with the extra Migrated status to avoid
// polluting Cover.sol state layout with new status variables.
enum LegacyCoverStatus {
  Active,
  ClaimAccepted,
  ClaimDenied,
  CoverExpired,
  ClaimSubmitted,
  Requested,
  Migrated
}

/* io structs */

struct PoolAllocationRequest {
  uint40 poolId;
  bool skip;
  uint coverAmountInAsset;
}

struct RequestAllocationVariables {
  uint previousPoolAllocationsLength;
  uint previousPremiumInNXM;
  uint refund;
  uint coverAmountInNXM;
}

struct BuyCoverParams {
  uint coverId;
  address owner;
  uint24 productId;
  uint8 coverAsset;
  uint96 amount;
  uint32 period;
  uint maxPremiumInAsset;
  uint8 paymentAsset;
  uint16 commissionRatio;
  address commissionDestination;
  string ipfsData;
}

struct ProductParam {
  string productName;
  uint productId;
  string ipfsMetadata;
  Product product;
  uint[] allowedPools;
}

struct ProductTypeParam {
  string productTypeName;
  uint productTypeId;
  string ipfsMetadata;
  ProductType productType;
}

struct ProductInitializationParams {
  uint productId;
  uint8 weight;
  uint96 initialPrice;
  uint96 targetPrice;
}

/* storage structs */

struct PoolAllocation {
  uint40 poolId;
  uint96 coverAmountInNXM;
  uint96 premiumInNXM;
  uint24 allocationId;
}

struct CoverData {
  uint24 productId;
  uint8 coverAsset;
  uint96 amountPaidOut;
}

struct CoverSegment {
  uint96 amount;
  uint32 start;
  uint32 period; // seconds
  uint32 gracePeriod; // seconds
  uint24 globalRewardsRatio;
  uint24 globalCapacityRatio;
}

struct Product {
  uint16 productType;
  address yieldTokenAddress;
  // cover assets bitmap. each bit represents whether the asset with
  // the index of that bit is enabled as a cover asset for this product
  uint32 coverAssets;
  uint16 initialPriceRatio;
  uint16 capacityReductionRatio;
  bool isDeprecated;
  bool useFixedPrice;
}

struct ProductType {
  uint8 claimMethod;
  uint32 gracePeriod;
}

struct ActiveCover {
  // Global active cover amount per asset.
  uint192 totalActiveCoverInAsset;
  // The last time activeCoverExpirationBuckets was updated
  uint64 lastBucketUpdateId;
}

interface ICover {

  /* ========== VIEWS ========== */

  function coverData(uint coverId) external view returns (CoverData memory);

  function coverDataCount() external view returns (uint);

  function coverSegmentsCount(uint coverId) external view returns (uint);

  function coverSegments(uint coverId) external view returns (CoverSegment[] memory);

  function coverSegmentWithRemainingAmount(
    uint coverId,
    uint segmentId
  ) external view returns (CoverSegment memory);

  function products(uint id) external view returns (Product memory);

  function productTypes(uint id) external view returns (ProductType memory);

  function stakingPool(uint index) external view returns (IStakingPool);

  function productNames(uint productId) external view returns (string memory);

  function productsCount() external view returns (uint);

  function productTypesCount() external view returns (uint);

  function totalActiveCoverInAsset(uint coverAsset) external view returns (uint);

  function globalCapacityRatio() external view returns (uint);

  function globalRewardsRatio() external view returns (uint);

  function getPriceAndCapacityRatios(uint[] calldata productIds) external view returns (
    uint _globalCapacityRatio,
    uint _globalMinPriceRatio,
    uint[] memory _initialPriceRatios,
    uint[] memory _capacityReductionRatios
  );

  /* === MUTATIVE FUNCTIONS ==== */

  function addLegacyCover(
    uint productId,
    uint coverAsset,
    uint amount,
    uint start,
    uint period,
    address newOwner
  ) external returns (uint coverId);

  function buyCover(
    BuyCoverParams calldata params,
    PoolAllocationRequest[] calldata coverChunkRequests
  ) external payable returns (uint coverId);

  function setProductTypes(ProductTypeParam[] calldata productTypes) external;

  function setProducts(ProductParam[] calldata params) external;

  function burnStake(
    uint coverId,
    uint segmentId,
    uint amount
  ) external returns (address coverOwner);

  function coverNFT() external returns (ICoverNFT);

  function stakingNFT() external returns (IStakingNFT);

  function stakingPoolFactory() external returns (IStakingPoolFactory);

  function createStakingPool(
    bool isPrivatePool,
    uint initialPoolFee,
    uint maxPoolFee,
    ProductInitializationParams[] calldata productInitParams,
    string calldata ipfsDescriptionHash
  ) external returns (uint poolId, address stakingPoolAddress);

  function isPoolAllowed(uint productId, uint poolId) external returns (bool);
  function requirePoolIsAllowed(uint[] calldata productIds, uint poolId) external view;

  /* ========== EVENTS ========== */

  event ProductSet(uint id, string ipfsMetadata);
  event ProductTypeSet(uint id, string ipfsMetadata);
  event CoverEdited(uint indexed coverId, uint indexed productId, uint indexed segmentId, address buyer, string ipfsMetadata);

  // Auth
  error OnlyMemberRolesCanOperateTransfer();
  error OnlyOwnerOrApproved();

  // Cover details
  error CoverPeriodTooShort();
  error CoverPeriodTooLong();
  error CoverOutsideOfTheGracePeriod();
  error CoverAmountIsZero();

  // Products
  error ProductDoesntExist();
  error ProductTypeNotFound();
  error ProductDoesntExistOrIsDeprecated();
  error InvalidProductType();
  error UnexpectedProductId();
  error PoolNotAllowedForThisProduct(uint productId);

  // Cover and payment assets
  error CoverAssetNotSupported();
  error InvalidPaymentAsset();
  error UnexpectedCoverAsset();
  error UnsupportedCoverAssets();
  error UnexpectedEthSent();
  error EditNotSupported();

  // Price & Commission
  error PriceExceedsMaxPremiumInAsset();
  error TargetPriceBelowGlobalMinPriceRatio();
  error InitialPriceRatioBelowGlobalMinPriceRatio();
  error InitialPriceRatioAbove100Percent();
  error CommissionRateTooHigh();

  // ETH transfers
  error InsufficientEthSent();
  error SendingEthToPoolFailed();
  error SendingEthToCommissionDestinationFailed();
  error ReturningEthRemainderToSenderFailed();

  // Misc
  error AlreadyInitialized();
  error ExpiredCoversCannotBeEdited();
  error CoverNotYetExpired(uint coverId);
  error CoverAlreadyExpired(uint coverId);
  error InsufficientCoverAmountAllocated();
  error UnexpectedPoolId();
  error CapacityReductionRatioAbove100Percent();
}

// SPDX-License-Identifier: GPL-3.0-only

pragma solidity >=0.5.0;

import "@openzeppelin/contracts-v4/token/ERC721/IERC721.sol";

interface ICoverNFT is IERC721 {

  function isApprovedOrOwner(address spender, uint tokenId) external returns (bool);

  function mint(address to) external returns (uint tokenId);

  function changeOperator(address newOperator) external;

  function totalSupply() external view returns (uint);

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

  error NotOperator();
  error NotMinted();
  error WrongFrom();
  error InvalidRecipient();
  error InvalidNewOperatorAddress();
  error InvalidNewNFTDescriptorAddress();
  error NotAuthorized();
  error UnsafeRecipient();
  error AlreadyMinted();

}

// SPDX-License-Identifier: GPL-3.0-only

pragma solidity >=0.5.0;

interface INXMMaster {

  function tokenAddress() external view returns (address);

  function owner() external view returns (address);

  function emergencyAdmin() external view returns (address);

  function masterInitialized() external view returns (bool);

  function isInternal(address _add) external view returns (bool);

  function isPause() external view returns (bool check);

  function isMember(address _add) external view returns (bool);

  function checkIsAuthToGoverned(address _add) external view returns (bool);

  function getLatestAddress(bytes2 _contractName) external view returns (address payable contractAddress);

  function contractAddresses(bytes2 code) external view returns (address payable);

  function upgradeMultipleContracts(
    bytes2[] calldata _contractCodes,
    address payable[] calldata newAddresses
  ) external;

  function removeContracts(bytes2[] calldata contractCodesToRemove) external;

  function addNewInternalContracts(
    bytes2[] calldata _contractCodes,
    address payable[] calldata newAddresses,
    uint[] calldata _types
  ) external;

  function updateOwnerParameters(bytes8 code, address payable val) external;
}

// SPDX-License-Identifier: GPL-3.0-only

pragma solidity >=0.5.0;

import "@openzeppelin/contracts-v4/token/ERC721/IERC721.sol";

interface IStakingNFT is IERC721 {

  function isApprovedOrOwner(address spender, uint tokenId) external returns (bool);

  function mint(uint poolId, address to) external returns (uint tokenId);

  function changeOperator(address newOperator) external;

  function totalSupply() external returns (uint);

  function tokenInfo(uint tokenId) external view returns (uint poolId, address owner);

  function stakingPoolOf(uint tokenId) external view returns (uint poolId);

  function stakingPoolFactory() external view returns (address);

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

  error NotOperator();
  error NotMinted();
  error WrongFrom();
  error InvalidRecipient();
  error InvalidNewOperatorAddress();
  error InvalidNewNFTDescriptorAddress();
  error NotAuthorized();
  error UnsafeRecipient();
  error AlreadyMinted();
  error NotStakingPool();

}

// SPDX-License-Identifier: GPL-3.0-only

pragma solidity >=0.5.0;

/* structs for io */

struct AllocationRequest {
  uint productId;
  uint coverId;
  uint allocationId;
  uint period;
  uint gracePeriod;
  bool useFixedPrice;
  uint previousStart;
  uint previousExpiration;
  uint previousRewardsRatio;
  uint globalCapacityRatio;
  uint capacityReductionRatio;
  uint rewardRatio;
  uint globalMinPrice;
}

struct StakedProductParam {
  uint productId;
  bool recalculateEffectiveWeight;
  bool setTargetWeight;
  uint8 targetWeight;
  bool setTargetPrice;
  uint96 targetPrice;
}

  struct BurnStakeParams {
    uint allocationId;
    uint productId;
    uint start;
    uint period;
    uint deallocationAmount;
  }

interface IStakingPool {

  /* structs for storage */

  // stakers are grouped in tranches based on the timelock expiration
  // tranche index is calculated based on the expiration date
  // the initial proposal is to have 4 tranches per year (1 tranche per quarter)
  struct Tranche {
    uint128 stakeShares;
    uint128 rewardsShares;
  }

  struct ExpiredTranche {
    uint96 accNxmPerRewardShareAtExpiry;
    uint96 stakeAmountAtExpiry; // nxm total supply is 6.7e24 and uint96.max is 7.9e28
    uint128 stakeSharesSupplyAtExpiry;
  }

  struct Deposit {
    uint96 lastAccNxmPerRewardShare;
    uint96 pendingRewards;
    uint128 stakeShares;
    uint128 rewardsShares;
  }

  function initialize(
    bool isPrivatePool,
    uint initialPoolFee,
    uint maxPoolFee,
    uint _poolId,
    string memory ipfsDescriptionHash
  ) external;

  function processExpirations(bool updateUntilCurrentTimestamp) external;

  function requestAllocation(
    uint amount,
    uint previousPremium,
    AllocationRequest calldata request
  ) external returns (uint premium, uint allocationId);

  function burnStake(uint amount, BurnStakeParams calldata params) external;

  function depositTo(
    uint amount,
    uint trancheId,
    uint requestTokenId,
    address destination
  ) external returns (uint tokenId);

  function withdraw(
    uint tokenId,
    bool withdrawStake,
    bool withdrawRewards,
    uint[] memory trancheIds
  ) external returns (uint withdrawnStake, uint withdrawnRewards);

  function isPrivatePool() external view returns (bool);

  function isHalted() external view returns (bool);

  function manager() external view returns (address);

  function getPoolId() external view returns (uint);

  function getPoolFee() external view returns (uint);

  function getMaxPoolFee() external view returns (uint);

  function getActiveStake() external view returns (uint);

  function getStakeSharesSupply() external view returns (uint);

  function getRewardsSharesSupply() external view returns (uint);

  function getRewardPerSecond() external view returns (uint);

  function getAccNxmPerRewardsShare() external view returns (uint);

  function getLastAccNxmUpdate() external view returns (uint);

  function getFirstActiveTrancheId() external view returns (uint);

  function getFirstActiveBucketId() external view returns (uint);

  function getNextAllocationId() external view returns (uint);

  function getDeposit(uint tokenId, uint trancheId) external view returns (
    uint lastAccNxmPerRewardShare,
    uint pendingRewards,
    uint stakeShares,
    uint rewardsShares
  );

  function getTranche(uint trancheId) external view returns (
    uint stakeShares,
    uint rewardsShares
  );

  function getExpiredTranche(uint trancheId) external view returns (
    uint accNxmPerRewardShareAtExpiry,
    uint stakeAmountAtExpiry,
    uint stakeShareSupplyAtExpiry
  );

  function setPoolFee(uint newFee) external;

  function setPoolPrivacy(bool isPrivatePool) external;

  function getActiveAllocations(
    uint productId
  ) external view returns (uint[] memory trancheAllocations);

  function getTrancheCapacities(
    uint productId,
    uint firstTrancheId,
    uint trancheCount,
    uint capacityRatio,
    uint reductionRatio
  ) external view returns (uint[] memory trancheCapacities);

  /* ========== EVENTS ========== */

  event StakeDeposited(address indexed user, uint256 amount, uint256 trancheId, uint256 tokenId);

  event DepositExtended(address indexed user, uint256 tokenId, uint256 initialTrancheId, uint256 newTrancheId, uint256 topUpAmount);

  event PoolPrivacyChanged(address indexed manager, bool isPrivate);

  event PoolFeeChanged(address indexed manager, uint newFee);

  event PoolDescriptionSet(string ipfsDescriptionHash);

  event Withdraw(address indexed user, uint indexed tokenId, uint tranche, uint amountStakeWithdrawn, uint amountRewardsWithdrawn);

  event StakeBurned(uint amount);

  event Deallocated(uint productId);

  event BucketExpired(uint bucketId);

  event TrancheExpired(uint trancheId);

  // Auth
  error OnlyCoverContract();
  error OnlyManager();
  error PrivatePool();
  error SystemPaused();
  error PoolHalted();

  // Fees
  error PoolFeeExceedsMax();
  error MaxPoolFeeAbove100();

  // Voting
  error NxmIsLockedForGovernanceVote();
  error ManagerNxmIsLockedForGovernanceVote();

  // Deposit
  error InsufficientDepositAmount();
  error RewardRatioTooHigh();

  // Staking NFTs
  error InvalidTokenId();
  error NotTokenOwnerOrApproved();
  error InvalidStakingPoolForToken();

  // Tranche & capacity
  error NewTrancheEndsBeforeInitialTranche();
  error RequestedTrancheIsNotYetActive();
  error RequestedTrancheIsExpired();
  error InsufficientCapacity();

  // Allocation
  error AlreadyDeallocated(uint allocationId);
}

// SPDX-License-Identifier: GPL-3.0-only

pragma solidity >=0.5.0;

interface IStakingPoolFactory {

  function stakingPoolCount() external view returns (uint);

  function beacon() external view returns (address);

  function create(address beacon) external returns (uint poolId, address stakingPoolAddress);

  event StakingPoolCreated(uint indexed poolId, address indexed stakingPoolAddress);
}

// SPDX-License-Identifier: GPL-3.0-only

pragma solidity >=0.5.0;

import "./ICover.sol";
import "./IStakingPool.sol";

interface IStakingProducts {

  // TODO: resize values?
  struct Weights {
    uint32 totalEffectiveWeight;
    uint32 totalTargetWeight;
  }

  struct StakedProduct {
    uint16 lastEffectiveWeight;
    uint8 targetWeight;
    uint96 targetPrice;
    uint96 bumpedPrice;
    uint32 bumpedPriceUpdateTime;
  }

  /* ============= PRODUCT FUNCTIONS ============= */

  function setProducts(uint poolId, StakedProductParam[] memory params) external;

  function setInitialProducts(uint poolId, ProductInitializationParams[] memory params) external;

  function getProductTargetWeight(uint poolId, uint productId) external view returns (uint);

  function getTotalTargetWeight(uint poolId) external view returns (uint);

  function getTotalEffectiveWeight(uint poolId) external view returns (uint);

  function getProduct(uint poolId, uint productId) external view returns (
    uint lastEffectiveWeight,
    uint targetWeight,
    uint targetPrice,
    uint bumpedPrice,
    uint bumpedPriceUpdateTime
  );

  /* ============= PRICING FUNCTIONS ============= */

  function getPremium(
    uint poolId,
    uint productId,
    uint period,
    uint coverAmount,
    uint initialCapacityUsed,
    uint totalCapacity,
    uint globalMinPrice,
    bool useFixedPrice,
    uint nxmPerAllocationUnit,
    uint allocationUnitsPerNxm
  ) external returns (uint premium);

  function calculateFixedPricePremium(
    uint coverAmount,
    uint period,
    uint fixedPrice,
    uint nxmPerAllocationUnit,
    uint targetPriceDenominator
  ) external pure returns (uint);


  function calculatePremium(
    StakedProduct memory product,
    uint period,
    uint coverAmount,
    uint initialCapacityUsed,
    uint totalCapacity,
    uint targetPrice,
    uint currentBlockTimestamp,
    uint nxmPerAllocationUnit,
    uint allocationUnitsPerNxm,
    uint targetPriceDenominator
  ) external pure returns (uint premium, StakedProduct memory);

  function calculatePremiumPerYear(
    uint basePrice,
    uint coverAmount,
    uint initialCapacityUsed,
    uint totalCapacity,
    uint nxmPerAllocationUnit,
    uint allocationUnitsPerNxm,
    uint targetPriceDenominator
  ) external pure returns (uint);

  // Calculates the premium for a given cover amount starting with the surge point
  function calculateSurgePremium(
    uint amountOnSurge,
    uint totalCapacity,
    uint allocationUnitsPerNxm
  ) external pure returns (uint);

  /* ============= EVENTS ============= */

  event ProductUpdated(uint productId, uint8 targetWeight, uint96 targetPrice);

  /* ============= ERRORS ============= */

  // Auth
  error OnlyStakingPool();
  error OnlyCoverContract();
  error OnlyManager();

  // Products & weights
  error MustSetPriceForNewProducts();
  error MustSetWeightForNewProducts();
  error TargetPriceTooHigh();
  error TargetPriceBelowMin();
  error TargetWeightTooHigh();
  error MustRecalculateEffectiveWeight();
  error TotalTargetWeightExceeded();
  error TotalEffectiveWeightExceeded();

}

// SPDX-License-Identifier: GPL-3.0-only

pragma solidity ^0.8.18;

/**
 * @dev Simple library to derive the staking pool address from the pool id without external calls
 */
library StakingPoolLibrary {

  function getAddress(address factory, uint poolId) internal pure returns (address) {

    bytes32 hash = keccak256(
      abi.encodePacked(
        hex'ff',
        factory,
        poolId, // salt
        // init code hash of the MinimalBeaconProxy
        // updated using patch-staking-pool-library.js script
        hex'1eb804b66941a2e8465fa0951be9c8b855b7794ee05b0789ab22a02ee1298ebe' // init code hash
      )
    );

    // cast last 20 bytes of hash to address
    return address(uint160(uint(hash)));
  }

}

// SPDX-License-Identifier: GPL-3.0-only

pragma solidity ^0.8.18;

/**
 * @dev Simple library that defines basic math functions that allow overflow
 */
library UncheckedMath {

  function uncheckedAdd(uint a, uint b) internal pure returns (uint) {
    unchecked { return a + b; }
  }

  function uncheckedSub(uint a, uint b) internal pure returns (uint) {
    unchecked { return a - b; }
  }

  function uncheckedMul(uint a, uint b) internal pure returns (uint) {
    unchecked { return a * b; }
  }

  function uncheckedDiv(uint a, uint b) internal pure returns (uint) {
    unchecked { return a / b; }
  }

}

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

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"contract INXMMaster","name":"_master","type":"address"},{"internalType":"contract IStakingNFT","name":"_stakingNFT","type":"address"},{"internalType":"contract IStakingPoolFactory","name":"_stakingPoolFactory","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"RevertedWithoutReason","type":"error"},{"inputs":[],"name":"MAX_ACTIVE_TRANCHES","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_UINT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ONE_NXM","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TRANCHE_DURATION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TRANCHE_ID_AT_DEPLOY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"getAggregatedTokens","outputs":[{"components":[{"internalType":"uint256","name":"totalActiveStake","type":"uint256"},{"internalType":"uint256","name":"totalExpiredStake","type":"uint256"},{"internalType":"uint256","name":"totalRewards","type":"uint256"}],"internalType":"struct StakingViewer.AggregatedTokens","name":"aggregated","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getAllPools","outputs":[{"components":[{"internalType":"uint256","name":"poolId","type":"uint256"},{"internalType":"bool","name":"isPrivatePool","type":"bool"},{"internalType":"address","name":"manager","type":"address"},{"internalType":"uint256","name":"poolFee","type":"uint256"},{"internalType":"uint256","name":"maxPoolFee","type":"uint256"},{"internalType":"uint256","name":"activeStake","type":"uint256"},{"internalType":"uint256","name":"currentAPY","type":"uint256"}],"internalType":"struct StakingViewer.Pool[]","name":"pools","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"poolIds","type":"uint256[]"}],"name":"getManagerRewards","outputs":[{"components":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"poolId","type":"uint256"},{"internalType":"uint256","name":"activeStake","type":"uint256"},{"internalType":"uint256","name":"expiredStake","type":"uint256"},{"internalType":"uint256","name":"rewards","type":"uint256"},{"components":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"trancheId","type":"uint256"},{"internalType":"uint256","name":"stake","type":"uint256"},{"internalType":"uint256","name":"stakeShares","type":"uint256"},{"internalType":"uint256","name":"reward","type":"uint256"}],"internalType":"struct StakingViewer.Deposit[]","name":"deposits","type":"tuple[]"}],"internalType":"struct StakingViewer.Token[]","name":"tokens","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"poolId","type":"uint256"}],"name":"getPool","outputs":[{"components":[{"internalType":"uint256","name":"poolId","type":"uint256"},{"internalType":"bool","name":"isPrivatePool","type":"bool"},{"internalType":"address","name":"manager","type":"address"},{"internalType":"uint256","name":"poolFee","type":"uint256"},{"internalType":"uint256","name":"maxPoolFee","type":"uint256"},{"internalType":"uint256","name":"activeStake","type":"uint256"},{"internalType":"uint256","name":"currentAPY","type":"uint256"}],"internalType":"struct StakingViewer.Pool","name":"pool","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"poolId","type":"uint256"}],"name":"getPoolProducts","outputs":[{"components":[{"internalType":"uint256","name":"productId","type":"uint256"},{"internalType":"uint256","name":"lastEffectiveWeight","type":"uint256"},{"internalType":"uint256","name":"targetWeight","type":"uint256"},{"internalType":"uint256","name":"targetPrice","type":"uint256"},{"internalType":"uint256","name":"bumpedPrice","type":"uint256"},{"internalType":"uint256","name":"bumpedPriceUpdateTime","type":"uint256"}],"internalType":"struct StakingViewer.StakingProduct[]","name":"products","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"poolIds","type":"uint256[]"}],"name":"getPools","outputs":[{"components":[{"internalType":"uint256","name":"poolId","type":"uint256"},{"internalType":"bool","name":"isPrivatePool","type":"bool"},{"internalType":"address","name":"manager","type":"address"},{"internalType":"uint256","name":"poolFee","type":"uint256"},{"internalType":"uint256","name":"maxPoolFee","type":"uint256"},{"internalType":"uint256","name":"activeStake","type":"uint256"},{"internalType":"uint256","name":"currentAPY","type":"uint256"}],"internalType":"struct StakingViewer.Pool[]","name":"pools","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"productId","type":"uint256"}],"name":"getProductPools","outputs":[{"components":[{"internalType":"uint256","name":"poolId","type":"uint256"},{"internalType":"bool","name":"isPrivatePool","type":"bool"},{"internalType":"address","name":"manager","type":"address"},{"internalType":"uint256","name":"poolFee","type":"uint256"},{"internalType":"uint256","name":"maxPoolFee","type":"uint256"},{"internalType":"uint256","name":"activeStake","type":"uint256"},{"internalType":"uint256","name":"currentAPY","type":"uint256"}],"internalType":"struct StakingViewer.Pool[]","name":"pools","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"getStakingPoolsOf","outputs":[{"components":[{"internalType":"uint256","name":"poolId","type":"uint256"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"internalType":"struct StakingViewer.TokenPoolMap[]","name":"tokenPools","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getToken","outputs":[{"components":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"poolId","type":"uint256"},{"internalType":"uint256","name":"activeStake","type":"uint256"},{"internalType":"uint256","name":"expiredStake","type":"uint256"},{"internalType":"uint256","name":"rewards","type":"uint256"},{"components":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"trancheId","type":"uint256"},{"internalType":"uint256","name":"stake","type":"uint256"},{"internalType":"uint256","name":"stakeShares","type":"uint256"},{"internalType":"uint256","name":"reward","type":"uint256"}],"internalType":"struct StakingViewer.Deposit[]","name":"deposits","type":"tuple[]"}],"internalType":"struct StakingViewer.Token","name":"token","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"getTokens","outputs":[{"components":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"poolId","type":"uint256"},{"internalType":"uint256","name":"activeStake","type":"uint256"},{"internalType":"uint256","name":"expiredStake","type":"uint256"},{"internalType":"uint256","name":"rewards","type":"uint256"},{"components":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"trancheId","type":"uint256"},{"internalType":"uint256","name":"stake","type":"uint256"},{"internalType":"uint256","name":"stakeShares","type":"uint256"},{"internalType":"uint256","name":"reward","type":"uint256"}],"internalType":"struct StakingViewer.Deposit[]","name":"deposits","type":"tuple[]"}],"internalType":"struct StakingViewer.Token[]","name":"tokens","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"master","outputs":[{"internalType":"contract INXMMaster","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes[]","name":"data","type":"bytes[]"}],"name":"multicall","outputs":[{"internalType":"bytes[]","name":"results","type":"bytes[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"poolIds","type":"uint256[]"}],"name":"processExpirations","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"stakingNFT","outputs":[{"internalType":"contract IStakingNFT","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"poolId","type":"uint256"}],"name":"stakingPool","outputs":[{"internalType":"contract IStakingPool","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"stakingPoolFactory","outputs":[{"internalType":"contract IStakingPoolFactory","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

60e06040523480156200001157600080fd5b506040516200260e3803806200260e83398101604081905262000034916200006b565b6001600160a01b0392831660805290821660a0521660c052620000bf565b6001600160a01b03811681146200006857600080fd5b50565b6000806000606084860312156200008157600080fd5b83516200008e8162000052565b6020850151909350620000a18162000052565b6040850151909250620000b48162000052565b809150509250925092565b60805160a05160c0516124e762000127600039600081816102a501528181610383015281816109e4015261115b01526000818161018901528181610b9001528181610dda01526112a001526000818161035a015281816115e70152611d0401526124e76000f3fe608060405234801561001057600080fd5b50600436106101365760003560e01c80639e53456d116100b8578063d88ff1f41161007c578063d88ff1f4146102fc578063e2338b5514610304578063e4b50cb81461030c578063e4e0ba001461032c578063e5b5019a1461034c578063ee97f7f31461035557600080fd5b80639e53456d1461024b5780639f3040ec1461026b578063a1b8adcb146102a0578063ac9650d8146102c7578063cbee29d6146102e757600080fd5b80632952dde8116100ff5780632952dde8146101ee57806332ba0a1e1461020157806347d30ab61461022157806363e251ca1461022957806365c00a571461023c57600080fd5b8062f41b271461013b578063068bcd8d146101645780630ce71e321461018457806313d135ed146101c357806321b0b0cb146101db575b600080fd5b61014e610149366004611e1e565b61037c565b60405161015b9190611e83565b60405180910390f35b610177610172366004611e1e565b610614565b60405161015b9190611ed1565b6101ab7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200161015b565b6101cd6277f88081565b60405190815260200161015b565b6101ab6101e9366004611e1e565b6109cc565b61014e6101fc366004611ef5565b610a6c565b61021461020f366004611ef5565b610b29565b60405161015b9190612056565b6101cd600881565b610214610237366004611ef5565b610c92565b6101cd670de0b6b3a764000081565b61025e610259366004611ef5565b610d49565b60405161015b91906120b8565b61027e610279366004612152565b610eb0565b604080518251815260208084015190820152918101519082015260600161015b565b6101ab7f000000000000000000000000000000000000000000000000000000000000000081565b6102da6102d5366004612152565b610f6a565b60405161015b9190612193565b6102fa6102f5366004611ef5565b6110b4565b005b61014e611155565b6101cd60d581565b61031f61031a366004611e1e565b61127f565b60405161015b9190612225565b61033f61033a366004611e1e565b611326565b60405161015b9190612238565b6101cd60001981565b6101ab7f000000000000000000000000000000000000000000000000000000000000000081565b60606000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316632dd96be96040518163ffffffff1660e01b8152600401602060405180830381865afa1580156103df573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061040391906122a3565b90506000816001600160401b0381111561041f5761041f611edf565b60405190808252806020026020018201604052801561045857816020015b610445611d3b565b81526020019060019003908161043d5790505b50905060015b8281116105615760008060006104726115ca565b6040516324f346ab60e01b815260048101869052602481018b90526001600160a01b0391909116906324f346ab9060440160a060405180830381865afa1580156104c0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104e491906122bc565b94505050925092508160001480156104fa575082155b8015610504575080155b156105115750505061054f565b600061051c85610614565b905080868981518110610531576105316122fc565b6020026020010181905250878061054790612328565b985050505050505b8061055981612328565b91505061045e565b50826001600160401b0381111561057a5761057a611edf565b6040519080825280602002602001820160405280156105b357816020015b6105a0611d3b565b8152602001906001900390816105985790505b50935060005b8381101561060b578181815181106105d3576105d36122fc565b60200260200101518582815181106105ed576105ed6122fc565b6020026020010181905250808061060390612328565b9150506105b9565b50505050919050565b61061c611d3b565b6000610627836109cc565b905082826000018181525050806001600160a01b031663f3d1a10f6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610671573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106959190612341565b15156020808401919091526040805163481c6a7560e01b815290516001600160a01b0384169263481c6a7592600480820193918290030181865afa1580156106e1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610705919061237b565b82604001906001600160a01b031690816001600160a01b031681525050806001600160a01b0316636741fad26040518163ffffffff1660e01b8152600401602060405180830381865afa158015610760573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061078491906122a3565b826060018181525050806001600160a01b0316635d70877c6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156107cb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107ef91906122a3565b826080018181525050806001600160a01b03166317387b586040518163ffffffff1660e01b8152600401602060405180830381865afa158015610836573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061085a91906122a3565b8260a0018181525050806001600160a01b03166317387b586040518163ffffffff1660e01b8152600401602060405180830381865afa1580156108a1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108c591906122a3565b6000036108d35760006109c1565b806001600160a01b03166317387b586040518163ffffffff1660e01b8152600401602060405180830381865afa158015610911573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061093591906122a3565b816001600160a01b031663da5b4ee76040518163ffffffff1660e01b8152600401602060405180830381865afa158015610973573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061099791906122a3565b6109a990670de0b6b3a7640000612398565b6109b7906301e13380612398565b6109c191906123af565b60c083015250919050565b604080516001600160f81b03196020808301919091527f000000000000000000000000000000000000000000000000000000000000000060601b6bffffffffffffffffffffffff19166021830152603582018490527f1eb804b66941a2e8465fa0951be9c8b855b7794ee05b0789ab22a02ee1298ebe60558084019190915283518084039091018152607590920190925280519101206000905b92915050565b8051606090806001600160401b03811115610a8957610a89611edf565b604051908082528060200260200182016040528015610ac257816020015b610aaf611d3b565b815260200190600190039081610aa75790505b50915060005b81811015610b2257610af2848281518110610ae557610ae56122fc565b6020026020010151610614565b838281518110610b0457610b046122fc565b60200260200101819052508080610b1a90612328565b915050610ac8565b5050919050565b606081516001600160401b03811115610b4457610b44611edf565b604051908082528060200260200182016040528015610b7d57816020015b610b6a611d83565b815260200190600190039081610b625790505b50905060005b8251811015610c8c5760007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663cf11548b858481518110610bcf57610bcf6122fc565b60200260200101516040518263ffffffff1660e01b8152600401610bf591815260200190565b602060405180830381865afa158015610c12573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c3691906122a3565b9050610c5b81858481518110610c4e57610c4e6122fc565b6020026020010151611660565b838381518110610c6d57610c6d6122fc565b6020026020010181905250508080610c8490612328565b915050610b83565b50919050565b606081516001600160401b03811115610cad57610cad611edf565b604051908082528060200260200182016040528015610ce657816020015b610cd3611d83565b815260200190600190039081610ccb5790505b50905060005b8251811015610c8c57610d19838281518110610d0a57610d0a6122fc565b60200260200101516000611660565b828281518110610d2b57610d2b6122fc565b60200260200101819052508080610d4190612328565b915050610cec565b606081516001600160401b03811115610d6457610d64611edf565b604051908082528060200260200182016040528015610da957816020015b6040805180820190915260008082526020820152815260200190600190039081610d825790505b50905060005b8251811015610c8c576000838281518110610dcc57610dcc6122fc565b6020026020010151905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663cf11548b836040518263ffffffff1660e01b8152600401610e2691815260200190565b602060405180830381865afa158015610e43573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e6791906122a3565b9050604051806040016040528082815260200183815250848481518110610e9057610e906122fc565b602002602001018190525050508080610ea890612328565b915050610daf565b610ed460405180606001604052806000815260200160008152602001600081525090565b60005b82811015610f63576000610f02858584818110610ef657610ef66122fc565b9050602002013561127f565b9050806040015183600001818151610f1a91906123d1565b9052506060810151602084018051610f339083906123d1565b9052506080810151604084018051610f4c9083906123d1565b905250819050610f5b81612328565b915050610ed7565b5092915050565b606081806001600160401b03811115610f8557610f85611edf565b604051908082528060200260200182016040528015610fb857816020015b6060815260200190600190039081610fa35790505b50915060005b818110156110ac5760008030878785818110610fdc57610fdc6122fc565b9050602002810190610fee91906123e4565b604051610ffc92919061242a565b600060405180830381855af49150503d8060008114611037576040519150601f19603f3d011682016040523d82523d6000602084013e61103c565b606091505b50915091508161107957805160008190036110725760405163f1a8c42d60e01b8152600481018590526024015b60405180910390fd5b8060208301fd5b8085848151811061108c5761108c6122fc565b6020026020010181905250505080806110a490612328565b915050610fbe565b505092915050565b60005b8151811015611151576110e28282815181106110d5576110d56122fc565b60200260200101516109cc565b6040516337552a6360e21b8152600160048201526001600160a01b03919091169063dd54a98c90602401600060405180830381600087803b15801561112657600080fd5b505af115801561113a573d6000803e3d6000fd5b50505050808061114990612328565b9150506110b7565b5050565b606060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316632dd96be96040518163ffffffff1660e01b8152600401602060405180830381865afa1580156111b7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111db91906122a3565b9050806001600160401b038111156111f5576111f5611edf565b60405190808252806020026020018201604052801561122e57816020015b61121b611d3b565b8152602001906001900390816112135790505b50915060005b8181101561127a5761124a6101728260016123d1565b83828151811061125c5761125c6122fc565b6020026020010181905250808061127290612328565b915050611234565b505090565b611287611d83565b60405163cf11548b60e01b8152600481018390526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063cf11548b90602401602060405180830381865afa1580156112ef573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061131391906122a3565b905061131f8184611660565b9392505050565b6060600080611333611ce7565b6001600160a01b031663e0df7bb66040518163ffffffff1660e01b8152600401602060405180830381865afa158015611370573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061139491906122a3565b90506000816001600160401b038111156113b0576113b0611edf565b6040519080825280602002602001820160405280156113e957816020015b6113d6611db9565b8152602001906001900390816113ce5790505b50905060005b828110156115205760008060008060006114076115ca565b6040516324f346ab60e01b8152600481018d9052602481018890526001600160a01b0391909116906324f346ab9060440160a060405180830381865afa158015611455573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061147991906122bc565b94509450945094509450836000148015611491575084155b801561149b575080155b156114aa57505050505061150e565b6114b2611db9565b8681526020810186905260408101859052608081018390526060810184905260a081018290528751819089908c9081106114ee576114ee6122fc565b6020026020010181905250898061150490612328565b9a50505050505050505b8061151881612328565b9150506113ef565b50826001600160401b0381111561153957611539611edf565b60405190808252806020026020018201604052801561157257816020015b61155f611db9565b8152602001906001900390816115575790505b50935060005b8381101561060b57818181518110611592576115926122fc565b60200260200101518582815181106115ac576115ac6122fc565b602002602001018190525080806115c290612328565b915050611578565b60405163c64c2c3560e01b815261053560f41b60048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063c64c2c35906024015b602060405180830381865afa158015611637573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061165b919061237b565b905090565b611668611d83565b6000611673846109cc565b905060006116846277f880426123af565b90506000606081600861169860d58661243a565b6116a291906123d1565b9050806001600160401b038111156116bc576116bc611edf565b6040519080825280602002602001820160405280156116f557816020015b6116e2611def565b8152602001906001900390816116da5790505b5091505060005b60088110156119bb5760008080806001600160a01b038916634e4a7fa38c611724888c6123d1565b6040516001600160e01b031960e085901b16815260048101929092526024820152604401608060405180830381865afa158015611765573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611789919061244d565b9350935093509350806000036117a257505050506119a9565b6117aa611def565b8b81526117b7868a6123d1565b81602001818152505060008a6001600160a01b03166357a607e56040518163ffffffff1660e01b8152600401602060405180830381865afa158015611800573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061182491906122a3565b848c6001600160a01b03166317387b586040518163ffffffff1660e01b8152600401602060405180830381865afa158015611863573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061188791906122a3565b6118919190612398565b61189b91906123af565b90506000611909878d6001600160a01b0316632393b1ca6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156118e1573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061190591906122a3565b0390565b90506000670de0b6b3a76400006119208684612398565b61192a91906123af565b61193490886123d1565b6040850184905260608501879052608085018190529050838a8c61195781612328565b9d5081518110611969576119696122fc565b6020026020010181905250828e60400181815161198691906123d1565b90525060808e01805182919061199d9083906123d1565b90525050505050505050505b806119b381612328565b9150506116fc565b5060d55b83811015611c2157604051634e4a7fa360e01b815260048101889052602481018290526000908190819081906001600160a01b038a1690634e4a7fa390604401608060405180830381865afa158015611a1c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a40919061244d565b935093509350935080600003611a595750505050611c0f565b60008060008b6001600160a01b0316631ad90766896040518263ffffffff1660e01b8152600401611a8c91815260200190565b606060405180830381865afa158015611aa9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611acd9190612483565b92509250925080600003611b3e5760405162461bcd60e51b815260206004820152603260248201527f5472616e6368652065787069726564206275742065787069726174696f6e73206044820152711dd95c99481b9bdd081c1c9bd8d95cdcd95960721b6064820152608401611069565b611b46611def565b81611b518785612398565b611b5b91906123af565b604082015260608101869052878403670de0b6b3a7640000611b7d8783612398565b611b8791906123af565b611b9190896123d1565b60808301528f8252602082018a90528a5182908c908e908110611bb657611bb66122fc565b60200260200101819052508b80611bcc90612328565b9c505081604001518f606001818151611be591906123d1565b9150818152505081608001518f608001818151611c0291906123d1565b9052505050505050505050505b80611c1981612328565b9150506119bf565b5085855260208501879052816001600160401b03811115611c4457611c44611edf565b604051908082528060200260200182016040528015611c7d57816020015b611c6a611def565b815260200190600190039081611c625790505b5060a086015260005b82811015611cdc57818181518110611ca057611ca06122fc565b60200260200101518660a001518281518110611cbe57611cbe6122fc565b60200260200101819052508080611cd490612328565b915050611c86565b505050505092915050565b60405163c64c2c3560e01b815261434f60f01b60048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063c64c2c359060240161161a565b6040518060e001604052806000815260200160001515815260200160006001600160a01b03168152602001600081526020016000815260200160008152602001600081525090565b6040518060c001604052806000815260200160008152602001600081526020016000815260200160008152602001606081525090565b6040518060c001604052806000815260200160008152602001600081526020016000815260200160008152602001600081525090565b6040518060a0016040528060008152602001600081526020016000815260200160008152602001600081525090565b600060208284031215611e3057600080fd5b5035919050565b805182526020808201511515908301526040808201516001600160a01b031690830152606080820151908301526080808201519083015260a0808201519083015260c090810151910152565b6020808252825182820181905260009190848201906040850190845b81811015611ec557611eb2838551611e37565b9284019260e09290920191600101611e9f565b50909695505050505050565b60e08101610a668284611e37565b634e487b7160e01b600052604160045260246000fd5b60006020808385031215611f0857600080fd5b82356001600160401b0380821115611f1f57600080fd5b818501915085601f830112611f3357600080fd5b813581811115611f4557611f45611edf565b8060051b604051601f19603f83011681018181108582111715611f6a57611f6a611edf565b604052918252848201925083810185019188831115611f8857600080fd5b938501935b82851015611fa657843584529385019392850192611f8d565b98975050505050505050565b600060c08301825184526020808401518186015260408085015181870152606080860151818801526080808701518189015260a08088015160c0828b015286815180895260e08c0191508783019850600092505b808310156120475788518051835288810151898401528781015188840152868101518784015285015185830152978701976001929092019190830190612006565b509a9950505050505050505050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b828110156120ab57603f19888603018452612099858351611fb2565b9450928501929085019060010161207d565b5092979650505050505050565b602080825282518282018190526000919060409081850190868401855b828110156120fa578151805185528601518685015292840192908501906001016120d5565b5091979650505050505050565b60008083601f84011261211957600080fd5b5081356001600160401b0381111561213057600080fd5b6020830191508360208260051b850101111561214b57600080fd5b9250929050565b6000806020838503121561216557600080fd5b82356001600160401b0381111561217b57600080fd5b61218785828601612107565b90969095509350505050565b6000602080830181845280855180835260408601915060408160051b87010192508387016000805b8381101561221757888603603f1901855282518051808852835b818110156121f0578281018a01518982018b015289016121d5565b508781018901849052601f01601f19169096018701955093860193918601916001016121bb565b509398975050505050505050565b60208152600061131f6020830184611fb2565b602080825282518282018190526000919060409081850190868401855b828110156120fa5781518051855286810151878601528581015186860152606080820151908601526080808201519086015260a0908101519085015260c09093019290850190600101612255565b6000602082840312156122b557600080fd5b5051919050565b600080600080600060a086880312156122d457600080fd5b5050835160208501516040860151606087015160809097015192989197509594509092509050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60006001820161233a5761233a612312565b5060010190565b60006020828403121561235357600080fd5b8151801515811461131f57600080fd5b6001600160a01b038116811461237857600080fd5b50565b60006020828403121561238d57600080fd5b815161131f81612363565b8082028115828204841417610a6657610a66612312565b6000826123cc57634e487b7160e01b600052601260045260246000fd5b500490565b80820180821115610a6657610a66612312565b6000808335601e198436030181126123fb57600080fd5b8301803591506001600160401b0382111561241557600080fd5b60200191503681900382131561214b57600080fd5b8183823760009101908152919050565b81810381811115610a6657610a66612312565b6000806000806080858703121561246357600080fd5b505082516020840151604085015160609095015191969095509092509050565b60008060006060848603121561249857600080fd5b835192506020840151915060408401519050925092509256fea2646970667358221220185df5abbfb4b3c6de5ce4ff45e5baa37568e1aeb73d1b3a09c66d16974f46f264736f6c6343000812003300000000000000000000000001bfd82675dbcc7762c84019ca518e701c0cd07e000000000000000000000000cafea508a477d94c502c253a58239fb8f948e97f000000000000000000000000cafeafb97bf8831d95c0fc659b8eb3946b101cb3

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106101365760003560e01c80639e53456d116100b8578063d88ff1f41161007c578063d88ff1f4146102fc578063e2338b5514610304578063e4b50cb81461030c578063e4e0ba001461032c578063e5b5019a1461034c578063ee97f7f31461035557600080fd5b80639e53456d1461024b5780639f3040ec1461026b578063a1b8adcb146102a0578063ac9650d8146102c7578063cbee29d6146102e757600080fd5b80632952dde8116100ff5780632952dde8146101ee57806332ba0a1e1461020157806347d30ab61461022157806363e251ca1461022957806365c00a571461023c57600080fd5b8062f41b271461013b578063068bcd8d146101645780630ce71e321461018457806313d135ed146101c357806321b0b0cb146101db575b600080fd5b61014e610149366004611e1e565b61037c565b60405161015b9190611e83565b60405180910390f35b610177610172366004611e1e565b610614565b60405161015b9190611ed1565b6101ab7f000000000000000000000000cafea508a477d94c502c253a58239fb8f948e97f81565b6040516001600160a01b03909116815260200161015b565b6101cd6277f88081565b60405190815260200161015b565b6101ab6101e9366004611e1e565b6109cc565b61014e6101fc366004611ef5565b610a6c565b61021461020f366004611ef5565b610b29565b60405161015b9190612056565b6101cd600881565b610214610237366004611ef5565b610c92565b6101cd670de0b6b3a764000081565b61025e610259366004611ef5565b610d49565b60405161015b91906120b8565b61027e610279366004612152565b610eb0565b604080518251815260208084015190820152918101519082015260600161015b565b6101ab7f000000000000000000000000cafeafb97bf8831d95c0fc659b8eb3946b101cb381565b6102da6102d5366004612152565b610f6a565b60405161015b9190612193565b6102fa6102f5366004611ef5565b6110b4565b005b61014e611155565b6101cd60d581565b61031f61031a366004611e1e565b61127f565b60405161015b9190612225565b61033f61033a366004611e1e565b611326565b60405161015b9190612238565b6101cd60001981565b6101ab7f00000000000000000000000001bfd82675dbcc7762c84019ca518e701c0cd07e81565b60606000807f000000000000000000000000cafeafb97bf8831d95c0fc659b8eb3946b101cb36001600160a01b0316632dd96be96040518163ffffffff1660e01b8152600401602060405180830381865afa1580156103df573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061040391906122a3565b90506000816001600160401b0381111561041f5761041f611edf565b60405190808252806020026020018201604052801561045857816020015b610445611d3b565b81526020019060019003908161043d5790505b50905060015b8281116105615760008060006104726115ca565b6040516324f346ab60e01b815260048101869052602481018b90526001600160a01b0391909116906324f346ab9060440160a060405180830381865afa1580156104c0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104e491906122bc565b94505050925092508160001480156104fa575082155b8015610504575080155b156105115750505061054f565b600061051c85610614565b905080868981518110610531576105316122fc565b6020026020010181905250878061054790612328565b985050505050505b8061055981612328565b91505061045e565b50826001600160401b0381111561057a5761057a611edf565b6040519080825280602002602001820160405280156105b357816020015b6105a0611d3b565b8152602001906001900390816105985790505b50935060005b8381101561060b578181815181106105d3576105d36122fc565b60200260200101518582815181106105ed576105ed6122fc565b6020026020010181905250808061060390612328565b9150506105b9565b50505050919050565b61061c611d3b565b6000610627836109cc565b905082826000018181525050806001600160a01b031663f3d1a10f6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610671573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106959190612341565b15156020808401919091526040805163481c6a7560e01b815290516001600160a01b0384169263481c6a7592600480820193918290030181865afa1580156106e1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610705919061237b565b82604001906001600160a01b031690816001600160a01b031681525050806001600160a01b0316636741fad26040518163ffffffff1660e01b8152600401602060405180830381865afa158015610760573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061078491906122a3565b826060018181525050806001600160a01b0316635d70877c6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156107cb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107ef91906122a3565b826080018181525050806001600160a01b03166317387b586040518163ffffffff1660e01b8152600401602060405180830381865afa158015610836573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061085a91906122a3565b8260a0018181525050806001600160a01b03166317387b586040518163ffffffff1660e01b8152600401602060405180830381865afa1580156108a1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108c591906122a3565b6000036108d35760006109c1565b806001600160a01b03166317387b586040518163ffffffff1660e01b8152600401602060405180830381865afa158015610911573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061093591906122a3565b816001600160a01b031663da5b4ee76040518163ffffffff1660e01b8152600401602060405180830381865afa158015610973573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061099791906122a3565b6109a990670de0b6b3a7640000612398565b6109b7906301e13380612398565b6109c191906123af565b60c083015250919050565b604080516001600160f81b03196020808301919091527f000000000000000000000000cafeafb97bf8831d95c0fc659b8eb3946b101cb360601b6bffffffffffffffffffffffff19166021830152603582018490527f1eb804b66941a2e8465fa0951be9c8b855b7794ee05b0789ab22a02ee1298ebe60558084019190915283518084039091018152607590920190925280519101206000905b92915050565b8051606090806001600160401b03811115610a8957610a89611edf565b604051908082528060200260200182016040528015610ac257816020015b610aaf611d3b565b815260200190600190039081610aa75790505b50915060005b81811015610b2257610af2848281518110610ae557610ae56122fc565b6020026020010151610614565b838281518110610b0457610b046122fc565b60200260200101819052508080610b1a90612328565b915050610ac8565b5050919050565b606081516001600160401b03811115610b4457610b44611edf565b604051908082528060200260200182016040528015610b7d57816020015b610b6a611d83565b815260200190600190039081610b625790505b50905060005b8251811015610c8c5760007f000000000000000000000000cafea508a477d94c502c253a58239fb8f948e97f6001600160a01b031663cf11548b858481518110610bcf57610bcf6122fc565b60200260200101516040518263ffffffff1660e01b8152600401610bf591815260200190565b602060405180830381865afa158015610c12573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c3691906122a3565b9050610c5b81858481518110610c4e57610c4e6122fc565b6020026020010151611660565b838381518110610c6d57610c6d6122fc565b6020026020010181905250508080610c8490612328565b915050610b83565b50919050565b606081516001600160401b03811115610cad57610cad611edf565b604051908082528060200260200182016040528015610ce657816020015b610cd3611d83565b815260200190600190039081610ccb5790505b50905060005b8251811015610c8c57610d19838281518110610d0a57610d0a6122fc565b60200260200101516000611660565b828281518110610d2b57610d2b6122fc565b60200260200101819052508080610d4190612328565b915050610cec565b606081516001600160401b03811115610d6457610d64611edf565b604051908082528060200260200182016040528015610da957816020015b6040805180820190915260008082526020820152815260200190600190039081610d825790505b50905060005b8251811015610c8c576000838281518110610dcc57610dcc6122fc565b6020026020010151905060007f000000000000000000000000cafea508a477d94c502c253a58239fb8f948e97f6001600160a01b031663cf11548b836040518263ffffffff1660e01b8152600401610e2691815260200190565b602060405180830381865afa158015610e43573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e6791906122a3565b9050604051806040016040528082815260200183815250848481518110610e9057610e906122fc565b602002602001018190525050508080610ea890612328565b915050610daf565b610ed460405180606001604052806000815260200160008152602001600081525090565b60005b82811015610f63576000610f02858584818110610ef657610ef66122fc565b9050602002013561127f565b9050806040015183600001818151610f1a91906123d1565b9052506060810151602084018051610f339083906123d1565b9052506080810151604084018051610f4c9083906123d1565b905250819050610f5b81612328565b915050610ed7565b5092915050565b606081806001600160401b03811115610f8557610f85611edf565b604051908082528060200260200182016040528015610fb857816020015b6060815260200190600190039081610fa35790505b50915060005b818110156110ac5760008030878785818110610fdc57610fdc6122fc565b9050602002810190610fee91906123e4565b604051610ffc92919061242a565b600060405180830381855af49150503d8060008114611037576040519150601f19603f3d011682016040523d82523d6000602084013e61103c565b606091505b50915091508161107957805160008190036110725760405163f1a8c42d60e01b8152600481018590526024015b60405180910390fd5b8060208301fd5b8085848151811061108c5761108c6122fc565b6020026020010181905250505080806110a490612328565b915050610fbe565b505092915050565b60005b8151811015611151576110e28282815181106110d5576110d56122fc565b60200260200101516109cc565b6040516337552a6360e21b8152600160048201526001600160a01b03919091169063dd54a98c90602401600060405180830381600087803b15801561112657600080fd5b505af115801561113a573d6000803e3d6000fd5b50505050808061114990612328565b9150506110b7565b5050565b606060007f000000000000000000000000cafeafb97bf8831d95c0fc659b8eb3946b101cb36001600160a01b0316632dd96be96040518163ffffffff1660e01b8152600401602060405180830381865afa1580156111b7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111db91906122a3565b9050806001600160401b038111156111f5576111f5611edf565b60405190808252806020026020018201604052801561122e57816020015b61121b611d3b565b8152602001906001900390816112135790505b50915060005b8181101561127a5761124a6101728260016123d1565b83828151811061125c5761125c6122fc565b6020026020010181905250808061127290612328565b915050611234565b505090565b611287611d83565b60405163cf11548b60e01b8152600481018390526000907f000000000000000000000000cafea508a477d94c502c253a58239fb8f948e97f6001600160a01b03169063cf11548b90602401602060405180830381865afa1580156112ef573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061131391906122a3565b905061131f8184611660565b9392505050565b6060600080611333611ce7565b6001600160a01b031663e0df7bb66040518163ffffffff1660e01b8152600401602060405180830381865afa158015611370573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061139491906122a3565b90506000816001600160401b038111156113b0576113b0611edf565b6040519080825280602002602001820160405280156113e957816020015b6113d6611db9565b8152602001906001900390816113ce5790505b50905060005b828110156115205760008060008060006114076115ca565b6040516324f346ab60e01b8152600481018d9052602481018890526001600160a01b0391909116906324f346ab9060440160a060405180830381865afa158015611455573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061147991906122bc565b94509450945094509450836000148015611491575084155b801561149b575080155b156114aa57505050505061150e565b6114b2611db9565b8681526020810186905260408101859052608081018390526060810184905260a081018290528751819089908c9081106114ee576114ee6122fc565b6020026020010181905250898061150490612328565b9a50505050505050505b8061151881612328565b9150506113ef565b50826001600160401b0381111561153957611539611edf565b60405190808252806020026020018201604052801561157257816020015b61155f611db9565b8152602001906001900390816115575790505b50935060005b8381101561060b57818181518110611592576115926122fc565b60200260200101518582815181106115ac576115ac6122fc565b602002602001018190525080806115c290612328565b915050611578565b60405163c64c2c3560e01b815261053560f41b60048201526000907f00000000000000000000000001bfd82675dbcc7762c84019ca518e701c0cd07e6001600160a01b03169063c64c2c35906024015b602060405180830381865afa158015611637573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061165b919061237b565b905090565b611668611d83565b6000611673846109cc565b905060006116846277f880426123af565b90506000606081600861169860d58661243a565b6116a291906123d1565b9050806001600160401b038111156116bc576116bc611edf565b6040519080825280602002602001820160405280156116f557816020015b6116e2611def565b8152602001906001900390816116da5790505b5091505060005b60088110156119bb5760008080806001600160a01b038916634e4a7fa38c611724888c6123d1565b6040516001600160e01b031960e085901b16815260048101929092526024820152604401608060405180830381865afa158015611765573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611789919061244d565b9350935093509350806000036117a257505050506119a9565b6117aa611def565b8b81526117b7868a6123d1565b81602001818152505060008a6001600160a01b03166357a607e56040518163ffffffff1660e01b8152600401602060405180830381865afa158015611800573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061182491906122a3565b848c6001600160a01b03166317387b586040518163ffffffff1660e01b8152600401602060405180830381865afa158015611863573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061188791906122a3565b6118919190612398565b61189b91906123af565b90506000611909878d6001600160a01b0316632393b1ca6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156118e1573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061190591906122a3565b0390565b90506000670de0b6b3a76400006119208684612398565b61192a91906123af565b61193490886123d1565b6040850184905260608501879052608085018190529050838a8c61195781612328565b9d5081518110611969576119696122fc565b6020026020010181905250828e60400181815161198691906123d1565b90525060808e01805182919061199d9083906123d1565b90525050505050505050505b806119b381612328565b9150506116fc565b5060d55b83811015611c2157604051634e4a7fa360e01b815260048101889052602481018290526000908190819081906001600160a01b038a1690634e4a7fa390604401608060405180830381865afa158015611a1c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a40919061244d565b935093509350935080600003611a595750505050611c0f565b60008060008b6001600160a01b0316631ad90766896040518263ffffffff1660e01b8152600401611a8c91815260200190565b606060405180830381865afa158015611aa9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611acd9190612483565b92509250925080600003611b3e5760405162461bcd60e51b815260206004820152603260248201527f5472616e6368652065787069726564206275742065787069726174696f6e73206044820152711dd95c99481b9bdd081c1c9bd8d95cdcd95960721b6064820152608401611069565b611b46611def565b81611b518785612398565b611b5b91906123af565b604082015260608101869052878403670de0b6b3a7640000611b7d8783612398565b611b8791906123af565b611b9190896123d1565b60808301528f8252602082018a90528a5182908c908e908110611bb657611bb66122fc565b60200260200101819052508b80611bcc90612328565b9c505081604001518f606001818151611be591906123d1565b9150818152505081608001518f608001818151611c0291906123d1565b9052505050505050505050505b80611c1981612328565b9150506119bf565b5085855260208501879052816001600160401b03811115611c4457611c44611edf565b604051908082528060200260200182016040528015611c7d57816020015b611c6a611def565b815260200190600190039081611c625790505b5060a086015260005b82811015611cdc57818181518110611ca057611ca06122fc565b60200260200101518660a001518281518110611cbe57611cbe6122fc565b60200260200101819052508080611cd490612328565b915050611c86565b505050505092915050565b60405163c64c2c3560e01b815261434f60f01b60048201526000907f00000000000000000000000001bfd82675dbcc7762c84019ca518e701c0cd07e6001600160a01b03169063c64c2c359060240161161a565b6040518060e001604052806000815260200160001515815260200160006001600160a01b03168152602001600081526020016000815260200160008152602001600081525090565b6040518060c001604052806000815260200160008152602001600081526020016000815260200160008152602001606081525090565b6040518060c001604052806000815260200160008152602001600081526020016000815260200160008152602001600081525090565b6040518060a0016040528060008152602001600081526020016000815260200160008152602001600081525090565b600060208284031215611e3057600080fd5b5035919050565b805182526020808201511515908301526040808201516001600160a01b031690830152606080820151908301526080808201519083015260a0808201519083015260c090810151910152565b6020808252825182820181905260009190848201906040850190845b81811015611ec557611eb2838551611e37565b9284019260e09290920191600101611e9f565b50909695505050505050565b60e08101610a668284611e37565b634e487b7160e01b600052604160045260246000fd5b60006020808385031215611f0857600080fd5b82356001600160401b0380821115611f1f57600080fd5b818501915085601f830112611f3357600080fd5b813581811115611f4557611f45611edf565b8060051b604051601f19603f83011681018181108582111715611f6a57611f6a611edf565b604052918252848201925083810185019188831115611f8857600080fd5b938501935b82851015611fa657843584529385019392850192611f8d565b98975050505050505050565b600060c08301825184526020808401518186015260408085015181870152606080860151818801526080808701518189015260a08088015160c0828b015286815180895260e08c0191508783019850600092505b808310156120475788518051835288810151898401528781015188840152868101518784015285015185830152978701976001929092019190830190612006565b509a9950505050505050505050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b828110156120ab57603f19888603018452612099858351611fb2565b9450928501929085019060010161207d565b5092979650505050505050565b602080825282518282018190526000919060409081850190868401855b828110156120fa578151805185528601518685015292840192908501906001016120d5565b5091979650505050505050565b60008083601f84011261211957600080fd5b5081356001600160401b0381111561213057600080fd5b6020830191508360208260051b850101111561214b57600080fd5b9250929050565b6000806020838503121561216557600080fd5b82356001600160401b0381111561217b57600080fd5b61218785828601612107565b90969095509350505050565b6000602080830181845280855180835260408601915060408160051b87010192508387016000805b8381101561221757888603603f1901855282518051808852835b818110156121f0578281018a01518982018b015289016121d5565b508781018901849052601f01601f19169096018701955093860193918601916001016121bb565b509398975050505050505050565b60208152600061131f6020830184611fb2565b602080825282518282018190526000919060409081850190868401855b828110156120fa5781518051855286810151878601528581015186860152606080820151908601526080808201519086015260a0908101519085015260c09093019290850190600101612255565b6000602082840312156122b557600080fd5b5051919050565b600080600080600060a086880312156122d457600080fd5b5050835160208501516040860151606087015160809097015192989197509594509092509050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60006001820161233a5761233a612312565b5060010190565b60006020828403121561235357600080fd5b8151801515811461131f57600080fd5b6001600160a01b038116811461237857600080fd5b50565b60006020828403121561238d57600080fd5b815161131f81612363565b8082028115828204841417610a6657610a66612312565b6000826123cc57634e487b7160e01b600052601260045260246000fd5b500490565b80820180821115610a6657610a66612312565b6000808335601e198436030181126123fb57600080fd5b8301803591506001600160401b0382111561241557600080fd5b60200191503681900382131561214b57600080fd5b8183823760009101908152919050565b81810381811115610a6657610a66612312565b6000806000806080858703121561246357600080fd5b505082516020840151604085015160609095015191969095509092509050565b60008060006060848603121561249857600080fd5b835192506020840151915060408401519050925092509256fea2646970667358221220185df5abbfb4b3c6de5ce4ff45e5baa37568e1aeb73d1b3a09c66d16974f46f264736f6c63430008120033

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

00000000000000000000000001bfd82675dbcc7762c84019ca518e701c0cd07e000000000000000000000000cafea508a477d94c502c253a58239fb8f948e97f000000000000000000000000cafeafb97bf8831d95c0fc659b8eb3946b101cb3

-----Decoded View---------------
Arg [0] : _master (address): 0x01BFd82675DBCc7762C84019cA518e701C0cD07e
Arg [1] : _stakingNFT (address): 0xcafea508a477D94c502c253A58239fb8F948e97f
Arg [2] : _stakingPoolFactory (address): 0xcafeafb97BF8831D95C0FC659b8eB3946B101CB3

-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 00000000000000000000000001bfd82675dbcc7762c84019ca518e701c0cd07e
Arg [1] : 000000000000000000000000cafea508a477d94c502c253a58239fb8f948e97f
Arg [2] : 000000000000000000000000cafeafb97bf8831d95c0fc659b8eb3946b101cb3


Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ 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.