POL Price: $0.714673 (-0.27%)
 

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Set Owner Profit...442663172023-06-24 2:06:38530 days ago1687572398IN
0x0605a34D...766375587
0 POL0.00916021166
Unlock442663002023-06-24 2:06:02530 days ago1687572362IN
0x0605a34D...766375587
0 POL0.00420495170
Lock438987302023-06-14 10:13:22540 days ago1686737602IN
0x0605a34D...766375587
0 POL0.01017188218
Unlock433070342023-05-29 23:52:44555 days ago1685404364IN
0x0605a34D...766375587
0 POL0.00432862175
Set Play Once Pr...411426842023-04-04 18:18:17610 days ago1680632297IN
0x0605a34D...766375587
0 POL0.00327228110
Set Owner Profit...411426612023-04-04 18:17:29610 days ago1680632249IN
0x0605a34D...766375587
0 POL0.00590447107
Lock411426582023-04-04 18:17:23610 days ago1680632243IN
0x0605a34D...766375587
0 POL0.0051326110
Unlock374791322022-12-30 23:28:26705 days ago1672442906IN
0x0605a34D...766375587
0 POL0.0011872848
Set Play Once Pr...370739352022-12-20 22:39:55715 days ago1671575995IN
0x0605a34D...766375587
0 POL0.0019038764
Lock370738782022-12-20 22:37:57715 days ago1671575877IN
0x0605a34D...766375587
0 POL0.00133850
Lock370738392022-12-20 22:36:35715 days ago1671575795IN
0x0605a34D...766375587
0 POL0.0026129656
Unlock348746872022-10-27 19:24:05769 days ago1666898645IN
0x0605a34D...766375587
0 POL0.00267138108
Set Owner Profit...348738832022-10-27 18:56:28769 days ago1666896988IN
0x0605a34D...766375587
0 POL0.00562856102
Set Owner Profit...347705792022-10-25 5:49:45772 days ago1666676985IN
0x0605a34D...766375587
0 POL0.0044978674
Lock347705542022-10-25 5:48:51772 days ago1666676931IN
0x0605a34D...766375587
0 POL0.0039194484
Unlock347666292022-10-25 3:31:17772 days ago1666668677IN
0x0605a34D...766375587
0 POL0.00311661126
Set Owner Profit...329971072022-09-12 4:06:54815 days ago1662955614IN
0x0605a34D...766375587
0 POL0.0028148951
Set Play Once Pr...318716472022-08-14 6:58:02844 days ago1660460282IN
0x0605a34D...766375587
0 POL0.0019212641
Set Title318716412022-08-14 6:57:50844 days ago1660460270IN
0x0605a34D...766375587
0 POL0.001060834
Set Description318716382022-08-14 6:57:44844 days ago1660460264IN
0x0605a34D...766375587
0 POL0.0110276234
Set Owner Profit...318716292022-08-14 6:57:26844 days ago1660460246IN
0x0605a34D...766375587
0 POL0.0072893934

Latest 1 internal transaction

Parent Transaction Hash Block From To
318710902022-08-14 6:36:44844 days ago1660459004  Contract Creation0 POL
Loading...
Loading

Similar Match Source Code
This contract matches the deployed Bytecode of the Source Code for Contract 0xbBaE991b...89611FC05
The constructor portion of the code might be different and could alter the actual behaviour of the contract

Contract Name:
Gachapon

Compiler Version
v0.8.6+commit.11564f7e

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 21 : Gachapon.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.6;

import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@chainlink/contracts/src/v0.8/VRFConsumerBase.sol";
import "./PrizePoolManager.sol";
import "./StateManager.sol";
import "../interfaces/IGachapon.sol";
import "../interfaces/ITreasuryManager.sol";
import "../interfaces/IOracleManager.sol";
import "../interfaces/IGachaponFactory.sol";

/// @author KirienzoEth for DokiDoki
contract Gachapon is PrizePoolManager, StateManager, IGachapon, VRFConsumerBase {
  uint256 constant private MAX_UINT = 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff;

  /// @dev Get the round from its oracle request ID
  mapping(bytes32 => IGachapon.Round) private _rounds;
  /// @dev The currency used by the oracle
  address private immutable _oracleCurrency;
  /// @dev The address containing the tokens to pay for an oracle call
  address private _oracleTokenPool;
  /// @notice The currency used by the machine
  address public immutable override currency;

  constructor(string memory _gachaponTitle, address _currency, address _deployer) 
  StateManager(_deployer) 
  VRFConsumerBase(IOracleManager(_deployer).oracleVRFCoordinator(), IOracleManager(_deployer).oracleToken()) 
  {
    title = _gachaponTitle;
    currency = _currency;
    _oracleCurrency = IOracleManager(_deployer).oracleToken();
    _oracleTokenPool = IGachaponFactory(msg.sender).oracleTokenPool();
  }

  /// @inheritdoc IGachapon
  function play(uint8 _times) external override {
    require(!isLocked && !isLockedForever, "You can't play with a locked gachapon");
    require(_times > 0 && _times <= 10, "You can only play between 1 and 10 times");
    require(_times <= getRemaningPrizesAmount(), "Not enough NFTs left to play");

    _transferTokens(playOncePrice * _times);
    _startRound(msg.sender, _times);
  }

  /// @dev Start a new round
  /// @param _player The address that will receive the prizes
  /// @param _times The number of prizes the round should contain
  function _startRound(address _player, uint8 _times) private {
    uint256 _oracleFee = IOracleManager(deployer).oracleFee();
    // Check if the gachapon has enough allowance for an oracle call
    require(LINK.allowance(_oracleTokenPool, address(this)) >= _oracleFee, "Allowance from oracle token pool depleted");
    require(LINK.balanceOf(_oracleTokenPool) >= _oracleFee, "Not enough tokens to pay the oracle");

    // Get the oracle token
    LINK.transferFrom(_oracleTokenPool, address(this), _oracleFee);

    // Contact the oracle to request a random number
    bytes32 _requestId = requestRandomness(IOracleManager(deployer).oracleKeyHash(), IOracleManager(deployer).oracleFee());

    // Initialize round
    _rounds[_requestId].id = _requestId;
    _rounds[_requestId].player = _player;
    _rounds[_requestId].status = RoundStatus.Pending;
    _rounds[_requestId].times = _times;
    _pendingRoundsAmount += _times;

    emit RoundStarted(_rounds[_requestId].id, _rounds[_requestId].player, _times);
  }

  /// @inheritdoc VRFConsumerBase
  function fulfillRandomness(bytes32 _requestId, uint256 _randomness) internal override {
    require(_rounds[_requestId].status == RoundStatus.Pending, "The callback was already called for this round");
    uint256[10] memory _tempPrizes;
    // Loop as many times as what was paid for
    for (uint8 _i = 0; _i < _rounds[_requestId].times; _i++) {
      // Get a new random number for this loop
      uint256 _randomNumber = _expandRandomNumber(_randomness, _prizePoolSize - _i);
      // Pull a prize for this loop
      _tempPrizes[_i] = _prizePool[_randomNumber];
      // Reduce by 1 the number of copies for the pulled nft 
      nfts[_prizePool[_randomNumber]].amount--;
      // Remove the nft from the prize pool by overwriting it with the last nft in the prize pool
      _prizePool[_randomNumber] = _prizePool[_prizePoolSize - 1 - _i];
    }

    // Store prizes in the round
    _rounds[_requestId].prizes = _tempPrizes;
    // Decrease the proize pool size by the number of times played
    _prizePoolSize -= _rounds[_requestId].times;
    // Update round status
    _rounds[_requestId].status = RoundStatus.Unclaimed;
    // Update round status
    _pendingRoundsAmount -= _rounds[_requestId].times;
    emit RoundCompleted(_requestId, _rounds[_requestId].player, _rounds[_requestId].times, _rounds[_requestId].prizes);
  }

  function _expandRandomNumber(uint _randomNumber, uint _remainingNftsAmount) private pure returns (uint) {
    // Expand random number
    uint _expandedRandomNumber = uint(keccak256(abi.encode(_randomNumber, _remainingNftsAmount)));

    // Handle modulo bias, if _expandedRandomNumber is in the biased range, reroll it until it isn't
    while (_expandedRandomNumber >= MAX_UINT - (MAX_UINT % _remainingNftsAmount)) {
      // Re-generate random number
      _expandedRandomNumber = uint(keccak256(abi.encode(_randomNumber, _expandedRandomNumber)));
    }

    // Return key to the prize
    return _expandedRandomNumber % _remainingNftsAmount;
  }

  /// @dev Distribute tokens to all the recipent
  function _transferTokens(uint256 amount) private {
    uint256 _ownerShare = amount * ownerRate / 1000;
    uint256 _teamTreasuryShare = amount - _ownerShare;

    // Distribute tokens to owner's profit addresses
    if (_ownerShare > 0) {
      uint256 _dust = _distributeTokensToOwnerProfitsAddresses(_ownerShare);
      _teamTreasuryShare += _dust;
    }

    // Distribute tokens to the address of the team's treasury
    if (_teamTreasuryShare > 0) {
      IERC20(currency).transferFrom(msg.sender, ITreasuryManager(deployer).teamTreasuryAddress(), _teamTreasuryShare);
    }
  }

  /// @dev Will send their share of the profits to every addresses in 'ownerProfitsAddresses'
  function _distributeTokensToOwnerProfitsAddresses(uint256 _tokenAmounts) private returns(uint256) {
    // If there are no profit addresses set, send everything to the owner's address
    if (ownerProfitsAddresses.length == 0) {
      IERC20(currency).transferFrom(msg.sender, owner(), _tokenAmounts);
      return 0;
    }

    uint256 _remaining = _tokenAmounts;
    // For each address, send its share of the tokens
    for(uint8 _i = 0; _i < ownerProfitsAddresses.length; _i++) {
      uint256 _addressShare = _tokenAmounts * ownerProfitsSharePerAddress[ownerProfitsAddresses[_i]] / 1000;
      IERC20(currency).transferFrom(msg.sender, ownerProfitsAddresses[_i], _addressShare);
      _remaining -= _addressShare;
    }

    // Return the dust
    return _remaining;
  }

  /// @notice Transfer the ownership of the gachapon to the provided address
  function transferOwnership(address _newOwner) public override(IGachapon, Ownable) onlyOwner {
    super.transferOwnership(_newOwner);
  }

  /// @inheritdoc IGachapon
  function claimPrizes(bytes32 _requestId) external override {
    require(_rounds[_requestId].status == RoundStatus.Unclaimed, "This round is not ready to be claimed");
    // Update round's status
    _rounds[_requestId].status = RoundStatus.Completed;

    // Loop for each time played
    for (uint i = 0; i < _rounds[_requestId].times; i++) {
      // Send every nft to the player
      if (nfts[_rounds[_requestId].prizes[i]].interfaceId == PrizePoolManager.INTERFACE_ID_ERC1155) {
        IERC1155(nfts[_rounds[_requestId].prizes[i]].collection).safeTransferFrom(address(this), _rounds[_requestId].player, nfts[_rounds[_requestId].prizes[i]].id, 1, '0x');
      } else {
        IERC721(nfts[_rounds[_requestId].prizes[i]].collection).safeTransferFrom(address(this), _rounds[_requestId].player, nfts[_rounds[_requestId].prizes[i]].id);
      }
    }

    emit PrizesClaimed(_requestId);
  }

  /// @inheritdoc IGachapon
  function getRound(bytes32 _roundId) external view override returns (Round memory) {
    return _rounds[_roundId];
  }
  
  /// @inheritdoc IGachapon
  function getNft(uint256 _index) external view override returns(Nft memory) {
    return nfts[_index];
  }

  /// @inheritdoc IGachapon
  function getRemaningPrizesAmount() public view override returns(uint256) {
    return _prizePoolSize - _pendingRoundsAmount;
  }

  /// @notice Deprecated, gachapons don't hold oracle tokens anymore
  function withdrawOracleTokens() external override onlyFromControlTower {
    IERC20(_oracleCurrency).transfer(ITreasuryManager(deployer).teamTreasuryAddress(), IERC20(_oracleCurrency).balanceOf(address(this)));
  }

  /// @inheritdoc StateManager
  function retryRound(bytes32 _requestId) external override onlyFromControlTower {
    require(_rounds[_requestId].status == RoundStatus.Pending, "Only pending rounds can be retried");
    _rounds[_requestId].status = RoundStatus.Cancelled;
    _pendingRoundsAmount -= _rounds[_requestId].times;
    
    emit RoundCancelled(_requestId);
    _startRound(_rounds[_requestId].player, _rounds[_requestId].times);
  }

  
  function registerNft(address _collection, uint _id, uint _amount, bytes4 _interfaceId) internal override(PrizePoolManager) {
    require(isLocked, "You need to lock the gachapon before you can add more NFTs");
    super.registerNft(_collection, _id, _amount, _interfaceId);
  }
}

File 2 of 21 : VRFConsumerBase.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "./interfaces/LinkTokenInterface.sol";

import "./VRFRequestIDBase.sol";

/** ****************************************************************************
 * @notice Interface for contracts using VRF randomness
 * *****************************************************************************
 * @dev PURPOSE
 *
 * @dev Reggie the Random Oracle (not his real job) wants to provide randomness
 * @dev to Vera the verifier in such a way that Vera can be sure he's not
 * @dev making his output up to suit himself. Reggie provides Vera a public key
 * @dev to which he knows the secret key. Each time Vera provides a seed to
 * @dev Reggie, he gives back a value which is computed completely
 * @dev deterministically from the seed and the secret key.
 *
 * @dev Reggie provides a proof by which Vera can verify that the output was
 * @dev correctly computed once Reggie tells it to her, but without that proof,
 * @dev the output is indistinguishable to her from a uniform random sample
 * @dev from the output space.
 *
 * @dev The purpose of this contract is to make it easy for unrelated contracts
 * @dev to talk to Vera the verifier about the work Reggie is doing, to provide
 * @dev simple access to a verifiable source of randomness.
 * *****************************************************************************
 * @dev USAGE
 *
 * @dev Calling contracts must inherit from VRFConsumerBase, and can
 * @dev initialize VRFConsumerBase's attributes in their constructor as
 * @dev shown:
 *
 * @dev   contract VRFConsumer {
 * @dev     constuctor(<other arguments>, address _vrfCoordinator, address _link)
 * @dev       VRFConsumerBase(_vrfCoordinator, _link) public {
 * @dev         <initialization with other arguments goes here>
 * @dev       }
 * @dev   }
 *
 * @dev The oracle will have given you an ID for the VRF keypair they have
 * @dev committed to (let's call it keyHash), and have told you the minimum LINK
 * @dev price for VRF service. Make sure your contract has sufficient LINK, and
 * @dev call requestRandomness(keyHash, fee, seed), where seed is the input you
 * @dev want to generate randomness from.
 *
 * @dev Once the VRFCoordinator has received and validated the oracle's response
 * @dev to your request, it will call your contract's fulfillRandomness method.
 *
 * @dev The randomness argument to fulfillRandomness is the actual random value
 * @dev generated from your seed.
 *
 * @dev The requestId argument is generated from the keyHash and the seed by
 * @dev makeRequestId(keyHash, seed). If your contract could have concurrent
 * @dev requests open, you can use the requestId to track which seed is
 * @dev associated with which randomness. See VRFRequestIDBase.sol for more
 * @dev details. (See "SECURITY CONSIDERATIONS" for principles to keep in mind,
 * @dev if your contract could have multiple requests in flight simultaneously.)
 *
 * @dev Colliding `requestId`s are cryptographically impossible as long as seeds
 * @dev differ. (Which is critical to making unpredictable randomness! See the
 * @dev next section.)
 *
 * *****************************************************************************
 * @dev SECURITY CONSIDERATIONS
 *
 * @dev A method with the ability to call your fulfillRandomness method directly
 * @dev could spoof a VRF response with any random value, so it's critical that
 * @dev it cannot be directly called by anything other than this base contract
 * @dev (specifically, by the VRFConsumerBase.rawFulfillRandomness method).
 *
 * @dev For your users to trust that your contract's random behavior is free
 * @dev from malicious interference, it's best if you can write it so that all
 * @dev behaviors implied by a VRF response are executed *during* your
 * @dev fulfillRandomness method. If your contract must store the response (or
 * @dev anything derived from it) and use it later, you must ensure that any
 * @dev user-significant behavior which depends on that stored value cannot be
 * @dev manipulated by a subsequent VRF request.
 *
 * @dev Similarly, both miners and the VRF oracle itself have some influence
 * @dev over the order in which VRF responses appear on the blockchain, so if
 * @dev your contract could have multiple VRF requests in flight simultaneously,
 * @dev you must ensure that the order in which the VRF responses arrive cannot
 * @dev be used to manipulate your contract's user-significant behavior.
 *
 * @dev Since the ultimate input to the VRF is mixed with the block hash of the
 * @dev block in which the request is made, user-provided seeds have no impact
 * @dev on its economic security properties. They are only included for API
 * @dev compatability with previous versions of this contract.
 *
 * @dev Since the block hash of the block which contains the requestRandomness
 * @dev call is mixed into the input to the VRF *last*, a sufficiently powerful
 * @dev miner could, in principle, fork the blockchain to evict the block
 * @dev containing the request, forcing the request to be included in a
 * @dev different block with a different hash, and therefore a different input
 * @dev to the VRF. However, such an attack would incur a substantial economic
 * @dev cost. This cost scales with the number of blocks the VRF oracle waits
 * @dev until it calls responds to a request.
 */
abstract contract VRFConsumerBase is VRFRequestIDBase {

  /**
   * @notice fulfillRandomness handles the VRF response. Your contract must
   * @notice implement it. See "SECURITY CONSIDERATIONS" above for important
   * @notice principles to keep in mind when implementing your fulfillRandomness
   * @notice method.
   *
   * @dev VRFConsumerBase expects its subcontracts to have a method with this
   * @dev signature, and will call it once it has verified the proof
   * @dev associated with the randomness. (It is triggered via a call to
   * @dev rawFulfillRandomness, below.)
   *
   * @param requestId The Id initially returned by requestRandomness
   * @param randomness the VRF output
   */
  function fulfillRandomness(
    bytes32 requestId,
    uint256 randomness
  )
    internal
    virtual;

  /**
   * @dev In order to keep backwards compatibility we have kept the user
   * seed field around. We remove the use of it because given that the blockhash
   * enters later, it overrides whatever randomness the used seed provides.
   * Given that it adds no security, and can easily lead to misunderstandings,
   * we have removed it from usage and can now provide a simpler API.
   */
  uint256 constant private USER_SEED_PLACEHOLDER = 0;

  /**
   * @notice requestRandomness initiates a request for VRF output given _seed
   *
   * @dev The fulfillRandomness method receives the output, once it's provided
   * @dev by the Oracle, and verified by the vrfCoordinator.
   *
   * @dev The _keyHash must already be registered with the VRFCoordinator, and
   * @dev the _fee must exceed the fee specified during registration of the
   * @dev _keyHash.
   *
   * @dev The _seed parameter is vestigial, and is kept only for API
   * @dev compatibility with older versions. It can't *hurt* to mix in some of
   * @dev your own randomness, here, but it's not necessary because the VRF
   * @dev oracle will mix the hash of the block containing your request into the
   * @dev VRF seed it ultimately uses.
   *
   * @param _keyHash ID of public key against which randomness is generated
   * @param _fee The amount of LINK to send with the request
   *
   * @return requestId unique ID for this request
   *
   * @dev The returned requestId can be used to distinguish responses to
   * @dev concurrent requests. It is passed as the first argument to
   * @dev fulfillRandomness.
   */
  function requestRandomness(
    bytes32 _keyHash,
    uint256 _fee
  )
    internal
    returns (
      bytes32 requestId
    )
  {
    LINK.transferAndCall(vrfCoordinator, _fee, abi.encode(_keyHash, USER_SEED_PLACEHOLDER));
    // This is the seed passed to VRFCoordinator. The oracle will mix this with
    // the hash of the block containing this request to obtain the seed/input
    // which is finally passed to the VRF cryptographic machinery.
    uint256 vRFSeed  = makeVRFInputSeed(_keyHash, USER_SEED_PLACEHOLDER, address(this), nonces[_keyHash]);
    // nonces[_keyHash] must stay in sync with
    // VRFCoordinator.nonces[_keyHash][this], which was incremented by the above
    // successful LINK.transferAndCall (in VRFCoordinator.randomnessRequest).
    // This provides protection against the user repeating their input seed,
    // which would result in a predictable/duplicate output, if multiple such
    // requests appeared in the same block.
    nonces[_keyHash] = nonces[_keyHash] + 1;
    return makeRequestId(_keyHash, vRFSeed);
  }

  LinkTokenInterface immutable internal LINK;
  address immutable private vrfCoordinator;

  // Nonces for each VRF key from which randomness has been requested.
  //
  // Must stay in sync with VRFCoordinator[_keyHash][this]
  mapping(bytes32 /* keyHash */ => uint256 /* nonce */) private nonces;

  /**
   * @param _vrfCoordinator address of VRFCoordinator contract
   * @param _link address of LINK token contract
   *
   * @dev https://docs.chain.link/docs/link-token-contracts
   */
  constructor(
    address _vrfCoordinator,
    address _link
  ) {
    vrfCoordinator = _vrfCoordinator;
    LINK = LinkTokenInterface(_link);
  }

  // rawFulfillRandomness is called by VRFCoordinator when it receives a valid VRF
  // proof. rawFulfillRandomness then calls fulfillRandomness, after validating
  // the origin of the call
  function rawFulfillRandomness(
    bytes32 requestId,
    uint256 randomness
  )
    external
  {
    require(msg.sender == vrfCoordinator, "Only VRFCoordinator can fulfill");
    fulfillRandomness(requestId, randomness);
  }
}

File 3 of 21 : VRFRequestIDBase.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

contract VRFRequestIDBase {

  /**
   * @notice returns the seed which is actually input to the VRF coordinator
   *
   * @dev To prevent repetition of VRF output due to repetition of the
   * @dev user-supplied seed, that seed is combined in a hash with the
   * @dev user-specific nonce, and the address of the consuming contract. The
   * @dev risk of repetition is mostly mitigated by inclusion of a blockhash in
   * @dev the final seed, but the nonce does protect against repetition in
   * @dev requests which are included in a single block.
   *
   * @param _userSeed VRF seed input provided by user
   * @param _requester Address of the requesting contract
   * @param _nonce User-specific nonce at the time of the request
   */
  function makeVRFInputSeed(
    bytes32 _keyHash,
    uint256 _userSeed,
    address _requester,
    uint256 _nonce
  )
    internal
    pure
    returns (
      uint256
    )
  {
    return uint256(keccak256(abi.encode(_keyHash, _userSeed, _requester, _nonce)));
  }

  /**
   * @notice Returns the id for this request
   * @param _keyHash The serviceAgreement ID to be used for this request
   * @param _vRFInputSeed The seed to be passed directly to the VRF
   * @return The id for this request
   *
   * @dev Note that _vRFInputSeed is not the seed passed by the consuming
   * @dev contract, but the one generated by makeVRFInputSeed
   */
  function makeRequestId(
    bytes32 _keyHash,
    uint256 _vRFInputSeed
  )
    internal
    pure
    returns (
      bytes32
    )
  {
    return keccak256(abi.encodePacked(_keyHash, _vRFInputSeed));
  }
}

File 4 of 21 : LinkTokenInterface.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface LinkTokenInterface {

  function allowance(
    address owner,
    address spender
  )
    external
    view
    returns (
      uint256 remaining
    );

  function approve(
    address spender,
    uint256 value
  )
    external
    returns (
      bool success
    );

  function balanceOf(
    address owner
  )
    external
    view
    returns (
      uint256 balance
    );

  function decimals()
    external
    view
    returns (
      uint8 decimalPlaces
    );

  function decreaseApproval(
    address spender,
    uint256 addedValue
  )
    external
    returns (
      bool success
    );

  function increaseApproval(
    address spender,
    uint256 subtractedValue
  ) external;

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

  function symbol()
    external
    view
    returns (
      string memory tokenSymbol
    );

  function totalSupply()
    external
    view
    returns (
      uint256 totalTokensIssued
    );

  function transfer(
    address to,
    uint256 value
  )
    external
    returns (
      bool success
    );

  function transferAndCall(
    address to,
    uint256 value,
    bytes calldata data
  )
    external
    returns (
      bool success
    );

  function transferFrom(
    address from,
    address to,
    uint256 value
  )
    external
    returns (
      bool success
    );

}

File 5 of 21 : Ownable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

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

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _setOwner(_msgSender());
    }

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

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
        _;
    }

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

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _setOwner(newOwner);
    }

    function _setOwner(address newOwner) private {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

File 6 of 21 : IERC1155.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

/**
 * @dev Required interface of an ERC1155 compliant contract, as defined in the
 * https://eips.ethereum.org/EIPS/eip-1155[EIP].
 *
 * _Available since v3.1._
 */
interface IERC1155 is IERC165 {
    /**
     * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.
     */
    event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);

    /**
     * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all
     * transfers.
     */
    event TransferBatch(
        address indexed operator,
        address indexed from,
        address indexed to,
        uint256[] ids,
        uint256[] values
    );

    /**
     * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to
     * `approved`.
     */
    event ApprovalForAll(address indexed account, address indexed operator, bool approved);

    /**
     * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.
     *
     * If an {URI} event was emitted for `id`, the standard
     * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value
     * returned by {IERC1155MetadataURI-uri}.
     */
    event URI(string value, uint256 indexed id);

    /**
     * @dev Returns the amount of tokens of token type `id` owned by `account`.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function balanceOf(address account, uint256 id) external view returns (uint256);

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.
     *
     * Requirements:
     *
     * - `accounts` and `ids` must have the same length.
     */
    function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)
        external
        view
        returns (uint256[] memory);

    /**
     * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,
     *
     * Emits an {ApprovalForAll} event.
     *
     * Requirements:
     *
     * - `operator` cannot be the caller.
     */
    function setApprovalForAll(address operator, bool approved) external;

    /**
     * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.
     *
     * See {setApprovalForAll}.
     */
    function isApprovedForAll(address account, address operator) external view returns (bool);

    /**
     * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - If the caller is not `from`, it must be have been approved to spend ``from``'s tokens via {setApprovalForAll}.
     * - `from` must have a balance of tokens of type `id` of at least `amount`.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
     * acceptance magic value.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 id,
        uint256 amount,
        bytes calldata data
    ) external;

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.
     *
     * Emits a {TransferBatch} event.
     *
     * Requirements:
     *
     * - `ids` and `amounts` must have the same length.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
     * acceptance magic value.
     */
    function safeBatchTransferFrom(
        address from,
        address to,
        uint256[] calldata ids,
        uint256[] calldata amounts,
        bytes calldata data
    ) external;
}

File 7 of 21 : IERC1155Receiver.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

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

/**
 * @dev _Available since v3.1._
 */
interface IERC1155Receiver is IERC165 {
    /**
        @dev Handles the receipt of a single ERC1155 token type. This function is
        called at the end of a `safeTransferFrom` after the balance has been updated.
        To accept the transfer, this must return
        `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))`
        (i.e. 0xf23a6e61, or its own function selector).
        @param operator The address which initiated the transfer (i.e. msg.sender)
        @param from The address which previously owned the token
        @param id The ID of the token being transferred
        @param value The amount of tokens being transferred
        @param data Additional data with no specified format
        @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed
    */
    function onERC1155Received(
        address operator,
        address from,
        uint256 id,
        uint256 value,
        bytes calldata data
    ) external returns (bytes4);

    /**
        @dev Handles the receipt of a multiple ERC1155 token types. This function
        is called at the end of a `safeBatchTransferFrom` after the balances have
        been updated. To accept the transfer(s), this must return
        `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))`
        (i.e. 0xbc197c81, or its own function selector).
        @param operator The address which initiated the batch transfer (i.e. msg.sender)
        @param from The address which previously owned the token
        @param ids An array containing ids of each token being transferred (order and length must match values array)
        @param values An array containing amounts of each token being transferred (order and length must match ids array)
        @param data Additional data with no specified format
        @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed
    */
    function onERC1155BatchReceived(
        address operator,
        address from,
        uint256[] calldata ids,
        uint256[] calldata values,
        bytes calldata data
    ) external returns (bytes4);
}

File 8 of 21 : IERC20.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @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 `recipient`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address recipient, 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 `sender` to `recipient` 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 sender,
        address recipient,
        uint256 amount
    ) external returns (bool);

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

File 9 of 21 : IERC721.sol
// SPDX-License-Identifier: MIT

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`, 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 be 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 Returns the account approved for `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function getApproved(uint256 tokenId) external view returns (address operator);

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

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

File 10 of 21 : IERC721Receiver.sol
// SPDX-License-Identifier: MIT

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

File 11 of 21 : Context.sol
// SPDX-License-Identifier: MIT

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 12 of 21 : ERC165Checker.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "./IERC165.sol";

/**
 * @dev Library used to query support of an interface declared via {IERC165}.
 *
 * Note that these functions return the actual result of the query: they do not
 * `revert` if an interface is not supported. It is up to the caller to decide
 * what to do in these cases.
 */
library ERC165Checker {
    // As per the EIP-165 spec, no interface should ever match 0xffffffff
    bytes4 private constant _INTERFACE_ID_INVALID = 0xffffffff;

    /**
     * @dev Returns true if `account` supports the {IERC165} interface,
     */
    function supportsERC165(address account) internal view returns (bool) {
        // Any contract that implements ERC165 must explicitly indicate support of
        // InterfaceId_ERC165 and explicitly indicate non-support of InterfaceId_Invalid
        return
            _supportsERC165Interface(account, type(IERC165).interfaceId) &&
            !_supportsERC165Interface(account, _INTERFACE_ID_INVALID);
    }

    /**
     * @dev Returns true if `account` supports the interface defined by
     * `interfaceId`. Support for {IERC165} itself is queried automatically.
     *
     * See {IERC165-supportsInterface}.
     */
    function supportsInterface(address account, bytes4 interfaceId) internal view returns (bool) {
        // query support of both ERC165 as per the spec and support of _interfaceId
        return supportsERC165(account) && _supportsERC165Interface(account, interfaceId);
    }

    /**
     * @dev Returns a boolean array where each value corresponds to the
     * interfaces passed in and whether they're supported or not. This allows
     * you to batch check interfaces for a contract where your expectation
     * is that some interfaces may not be supported.
     *
     * See {IERC165-supportsInterface}.
     *
     * _Available since v3.4._
     */
    function getSupportedInterfaces(address account, bytes4[] memory interfaceIds)
        internal
        view
        returns (bool[] memory)
    {
        // an array of booleans corresponding to interfaceIds and whether they're supported or not
        bool[] memory interfaceIdsSupported = new bool[](interfaceIds.length);

        // query support of ERC165 itself
        if (supportsERC165(account)) {
            // query support of each interface in interfaceIds
            for (uint256 i = 0; i < interfaceIds.length; i++) {
                interfaceIdsSupported[i] = _supportsERC165Interface(account, interfaceIds[i]);
            }
        }

        return interfaceIdsSupported;
    }

    /**
     * @dev Returns true if `account` supports all the interfaces defined in
     * `interfaceIds`. Support for {IERC165} itself is queried automatically.
     *
     * Batch-querying can lead to gas savings by skipping repeated checks for
     * {IERC165} support.
     *
     * See {IERC165-supportsInterface}.
     */
    function supportsAllInterfaces(address account, bytes4[] memory interfaceIds) internal view returns (bool) {
        // query support of ERC165 itself
        if (!supportsERC165(account)) {
            return false;
        }

        // query support of each interface in _interfaceIds
        for (uint256 i = 0; i < interfaceIds.length; i++) {
            if (!_supportsERC165Interface(account, interfaceIds[i])) {
                return false;
            }
        }

        // all interfaces supported
        return true;
    }

    /**
     * @notice Query if a contract implements an interface, does not check ERC165 support
     * @param account The address of the contract to query for support of an interface
     * @param interfaceId The interface identifier, as specified in ERC-165
     * @return true if the contract at account indicates support of the interface with
     * identifier interfaceId, false otherwise
     * @dev Assumes that account contains a contract that supports ERC165, otherwise
     * the behavior of this method is undefined. This precondition can be checked
     * with {supportsERC165}.
     * Interface identification is specified in ERC-165.
     */
    function _supportsERC165Interface(address account, bytes4 interfaceId) private view returns (bool) {
        bytes memory encodedParams = abi.encodeWithSelector(IERC165(account).supportsInterface.selector, interfaceId);
        (bool success, bytes memory result) = account.staticcall{gas: 30000}(encodedParams);
        if (result.length < 32) return false;
        return success && abi.decode(result, (bool));
    }
}

File 13 of 21 : IERC165.sol
// SPDX-License-Identifier: MIT

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 14 of 21 : EnumerableSet.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

/**
 * @dev Library for managing
 * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
 * types.
 *
 * Sets have the following properties:
 *
 * - Elements are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Elements are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```
 * contract Example {
 *     // Add the library methods
 *     using EnumerableSet for EnumerableSet.AddressSet;
 *
 *     // Declare a set state variable
 *     EnumerableSet.AddressSet private mySet;
 * }
 * ```
 *
 * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
 * and `uint256` (`UintSet`) are supported.
 */
library EnumerableSet {
    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Set type with
    // bytes32 values.
    // The Set implementation uses private functions, and user-facing
    // implementations (such as AddressSet) are just wrappers around the
    // underlying Set.
    // This means that we can only create new EnumerableSets for types that fit
    // in bytes32.

    struct Set {
        // Storage of set values
        bytes32[] _values;
        // Position of the value in the `values` array, plus 1 because index 0
        // means a value is not in the set.
        mapping(bytes32 => uint256) _indexes;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function _add(Set storage set, bytes32 value) private returns (bool) {
        if (!_contains(set, value)) {
            set._values.push(value);
            // The value is stored at length-1, but we add 1 to all indexes
            // and use 0 as a sentinel value
            set._indexes[value] = set._values.length;
            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function _remove(Set storage set, bytes32 value) private returns (bool) {
        // We read and store the value's index to prevent multiple reads from the same storage slot
        uint256 valueIndex = set._indexes[value];

        if (valueIndex != 0) {
            // Equivalent to contains(set, value)
            // To delete an element from the _values array in O(1), we swap the element to delete with the last one in
            // the array, and then remove the last element (sometimes called as 'swap and pop').
            // This modifies the order of the array, as noted in {at}.

            uint256 toDeleteIndex = valueIndex - 1;
            uint256 lastIndex = set._values.length - 1;

            if (lastIndex != toDeleteIndex) {
                bytes32 lastvalue = set._values[lastIndex];

                // Move the last value to the index where the value to delete is
                set._values[toDeleteIndex] = lastvalue;
                // Update the index for the moved value
                set._indexes[lastvalue] = valueIndex; // Replace lastvalue's index to valueIndex
            }

            // Delete the slot where the moved value was stored
            set._values.pop();

            // Delete the index for the deleted slot
            delete set._indexes[value];

            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function _contains(Set storage set, bytes32 value) private view returns (bool) {
        return set._indexes[value] != 0;
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function _length(Set storage set) private view returns (uint256) {
        return set._values.length;
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function _at(Set storage set, uint256 index) private view returns (bytes32) {
        return set._values[index];
    }

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _add(set._inner, value);
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _remove(set._inner, value);
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
        return _contains(set._inner, value);
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(Bytes32Set storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
        return _at(set._inner, index);
    }

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(AddressSet storage set, address value) internal returns (bool) {
        return _add(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(AddressSet storage set, address value) internal returns (bool) {
        return _remove(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(AddressSet storage set, address value) internal view returns (bool) {
        return _contains(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(AddressSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(AddressSet storage set, uint256 index) internal view returns (address) {
        return address(uint160(uint256(_at(set._inner, index))));
    }

    // UintSet

    struct UintSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(UintSet storage set, uint256 value) internal returns (bool) {
        return _add(set._inner, bytes32(value));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(UintSet storage set, uint256 value) internal returns (bool) {
        return _remove(set._inner, bytes32(value));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(UintSet storage set, uint256 value) internal view returns (bool) {
        return _contains(set._inner, bytes32(value));
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function length(UintSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(UintSet storage set, uint256 index) internal view returns (uint256) {
        return uint256(_at(set._inner, index));
    }
}

File 15 of 21 : PrizePoolManager.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.6;

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
import "@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";

/// @author KirienzoEth for DokiDoki
/// @title Contract managing the prize pool of the gachapon
contract PrizePoolManager is Ownable, IERC1155Receiver, IERC721Receiver {
  using ERC165Checker for address;

  struct Nft {
    address collection;
    uint256 id;
    uint256 amount;
    bytes4 interfaceId;
  }

  /// @dev Interface id of the IERC1155 interface for the ERC165Checker
  bytes4 constant internal INTERFACE_ID_ERC1155 = 0xd9b67a26;
  /// @dev Interface id of the IERC721 interface for the ERC165Checker
  bytes4 constant internal INTERFACE_ID_ERC721 = 0x80ac58cd;
  /// @dev All the nfts that were ever added to this gachapon
  mapping(uint => Nft) internal nfts;
  /// @notice The number of different nfts in the gachapon
  uint public nftsAmount;
  /// @notice Is the gachapon locked forever
  /// @dev This is set to true whenever the owner removes NFTs from the prize pool
  bool public isLockedForever = false;

  /// @dev Contains every nft available as a prize, anything above the index '_prizePoolSize - 1' is invalid
  mapping(uint => uint) internal _prizePool;
  /// @notice The number prizes remaining
  uint internal _prizePoolSize;
  /// @dev Get the index of the nft from its collection and tokenId
  mapping(address => mapping(uint => uint)) internal _collectionToTokenIdToIndex;
  /// @dev the number of rounds that were initialized but didn't receive an answer from the oracle yet
  uint256 internal _pendingRoundsAmount;

  EnumerableSet.AddressSet internal _collectionsSet;

  event NftAdded(address indexed _collection, uint _id, uint _amount);
  event UniqueNftAdded(address indexed _collection, uint _id);
  event NftRemoved(address indexed _collection, uint _id, uint _amount);

  function registerNft(address _collection, uint _id, uint _amount, bytes4 _interfaceId) internal virtual {
    require(!isLockedForever, "You cannot add more NFTs to an unusable machine");
    require(_pendingRoundsAmount == 0, "You can't alter the prize pool when players are waiting for their prizes");

    EnumerableSet.add(_collectionsSet, _collection);
    // If the nft was never previously added
    if (_prizePoolSize == 0 || nfts[_collectionToTokenIdToIndex[_collection][_id]].collection != _collection || nfts[_collectionToTokenIdToIndex[_collection][_id]].id != _id) {
      // Store the index of the nft in the nfts array
      _collectionToTokenIdToIndex[_collection][_id] = nftsAmount;
      // Store the reference to the nft
      nfts[nftsAmount] = Nft(_collection, _id, _amount, _interfaceId);
      // Increase the number of nfts in the machine
      nftsAmount++;
    } else {
      // Increase the amount of copies of the nft present in the machine
      nfts[_collectionToTokenIdToIndex[_collection][_id]].amount += _amount;
    }

    // Add all the copies to the prize pool
    for (uint _i = 0; _i < _amount; _i++) {
      _prizePool[_i + _prizePoolSize] = _collectionToTokenIdToIndex[_collection][_id];
    }
    
    // Increase the number of nft in the prize pool
    _prizePoolSize += _amount;
  }

  /// @notice Remove `_amount` of token ID `_id`, doing this will lock the gachapon forever
  /// @dev Doing this will put the prize pool in an invalid state and make the gachapon unplayable
  function removeNft(address _collection, uint _id, uint _amount) external onlyOwner {
    require(_amount > 0, "You need to remove at least 1 nft");
    require(EnumerableSet.contains(_collectionsSet, _collection), "This collection is not in the gachapon");
    require(_prizePoolSize > 0 && nfts[_collectionToTokenIdToIndex[_collection][_id]].id == _id, "This token ID is not in the gachapon");
    require(nfts[_collectionToTokenIdToIndex[_collection][_id]].amount >= _amount , "There is not enough of this nft in the gachapon");
    require(_pendingRoundsAmount == 0, "You can't alter the prize pool when players are waiting for their prizes");

    // Make the gachapon unusable
    isLockedForever = true;
    // Reduce the supply of said nft
    nfts[_collectionToTokenIdToIndex[_collection][_id]].amount -= _amount;
    // Reduce the number of remaining prizes
    _prizePoolSize -= _amount;
    // Send nfts to the owner
    if (_collection.supportsInterface(INTERFACE_ID_ERC1155)) {
      IERC1155(_collection).safeTransferFrom(address(this), msg.sender, _id, _amount, "");
    } else {
      IERC721(_collection).safeTransferFrom(address(this), msg.sender, _id);
    }

    emit NftRemoved(_collection, _id, _amount);
  }

  /// @notice Remove `_amount` of token ID `_id`, you can only use this method if the NFT isn't in the prize pool, otherwise, use {removeNft} instead
  /// @notice If it's an ERC721 collection, the `_amount` parameter will not be taken into account
  /// @dev Doing this will NOT put the prize pool in an invalid state, as the prize pool remains unchanged
  /// @dev This method is available in case an NFT is sent to the gachapon in a way that wouldn't trigger ERCXXXXReceiver mechanisms (e.g: {transferFrom} instead of {safeTransferFrom} in the ERC721 standard)
  function removeUnregisteredNft(address _collection, uint _id, uint _amount) external onlyOwner {
    require(nfts[_collectionToTokenIdToIndex[_collection][_id]].collection != _collection, "This token ID is registered in the prize pool");

    // Send nfts to the owner
    if (_collection.supportsInterface(INTERFACE_ID_ERC1155)) {
      IERC1155(_collection).safeTransferFrom(address(this), msg.sender, _id, _amount, "");
    } else {
      IERC721(_collection).safeTransferFrom(address(this), msg.sender, _id);
    }
  }

  /// @inheritdoc IERC1155Receiver
  function onERC1155Received(
      address,
      address,
      uint256 _id,
      uint256 _value,
      bytes calldata
  ) override external onlyNftsFromOwner returns (bytes4) {
    require(msg.sender.supportsInterface(INTERFACE_ID_ERC1155), "Only accessible with method safeTransferFrom from your ERC1155 collection");

    registerNft(msg.sender, _id, _value, INTERFACE_ID_ERC1155);
    emit NftAdded(msg.sender, _id, _value);

    return this.onERC1155Received.selector;
  }

  /// @inheritdoc IERC1155Receiver
  function onERC1155BatchReceived(
      address,
      address,
      uint256[] calldata _ids,
      uint256[] calldata _values,
      bytes calldata
  ) override external onlyNftsFromOwner returns (bytes4) {
    require(msg.sender.supportsInterface(INTERFACE_ID_ERC1155), "Only accessible with method safeBatchTransferFrom from your ERC1155 collection");

    // For each token id in the batch
    for (uint _i = 0; _i < _ids.length; _i++) {
      registerNft(msg.sender, _ids[_i], _values[_i], INTERFACE_ID_ERC1155);
      emit NftAdded(msg.sender, _ids[_i], _values[_i]);
    }
    
    return this.onERC1155BatchReceived.selector;
  }

  /// @inheritdoc IERC721Receiver
  function onERC721Received(
      address,
      address,
      uint256 _id,
      bytes calldata
  ) override external onlyNftsFromOwner returns (bytes4) {
    require(msg.sender.supportsInterface(INTERFACE_ID_ERC721), "Only accessible with method safeTransferFrom from your ERC721 collection");

    registerNft(msg.sender, _id, 1, INTERFACE_ID_ERC721);
    emit UniqueNftAdded(msg.sender, _id);

    return this.onERC721Received.selector;
  }

  /// @inheritdoc IERC165
  function supportsInterface(bytes4 _interfaceId) override external pure returns (bool) {
    return 
      _interfaceId == 0x01ffc9a7 || // ERC-165 support
      _interfaceId == 0x4e2312e0 || // ERC-1155 `ERC1155TokenReceiver` support
      _interfaceId == 0x150b7a02;   // ERC-721 `ERC721TokenReceiver` support
  }

  modifier onlyNftsFromOwner {
    require(tx.origin == owner(), "Only the owner can add nfts");
    _;
  }
}

File 16 of 21 : StateManager.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.6;

import "@openzeppelin/contracts/access/Ownable.sol";
import "../interfaces/IDeployerControlledState.sol";
import "../interfaces/IGachaponFactory.sol";

/// @title Contract that 
/// @author KirienzoEth for DokiDoki
abstract contract StateManager is Ownable, IDeployerControlledState {
  /// @notice Get the title of the gachapon
  string public title;
  /// @notice Get the description of the gachapon
  string public description;
  
  /// @notice Is the gachapon locked
  /// @dev A locked gachapon can't be played, the owner can lock and unlock at will
  bool public isLocked = true;
  /// @notice Is the gachapon banned
  /// @dev A banned gachapon can't be played, and can only be unbanned by an admin
  bool public isBanned = false;
  /// @notice Get the price for one play
  uint256 public playOncePrice;
  /// @dev the address of the controle tower that deployed this gachapon
  address public immutable deployer;

  /// @notice Get the percentage allocated to the owner
  uint16 public ownerRate = 950;
  /// @notice Get the percentage allocated to the token mechanics
  uint16 public tokenomicsRate = 0;
  /// @notice Get the percentage allocated to the dao
  uint16 public daoRate = 0;

  /// @notice How much of the owner's share an address will receive
  mapping(address => uint16) public ownerProfitsSharePerAddress;
  /// @notice Array containing all the profits addresses (max 10)
  address[] public ownerProfitsAddresses;
  /// @notice How many profits addresses will receive a share of the payment
  uint256 public ownerProfitsAddressesAmount;
  
  event PlayOncePriceChanged(uint _price);
  event TitleChanged(string _title);
  event DescriptionChanged(string _description);
  event LockStatusChanged(bool _isLocked);
  event OwnerProfitsSharingChanged(address[] _addresses, uint16[] _rates);

  constructor(address _deployer) {
    deployer = _deployer;
    ownerRate = IGachaponFactory(msg.sender).gachaponOwnerDefaultRate();
  }

  /// @notice Set price to `_price` WEI
  function setPlayOncePrice(uint256 _newPrice) external onlyOwner {
    playOncePrice = _newPrice;

    emit PlayOncePriceChanged(_newPrice);
  }

  /// @notice Lock the gachapon
  function lock() external onlyOwner {
    isLocked = true;
    emit LockStatusChanged(isLocked);
  }

  /// @notice Unlock the gachapon
  function unlock() external onlyOwner {
    isLocked = false;
    emit LockStatusChanged(isLocked);
  }

  /// @notice Set `_title` as the title of the gachapon
  function setTitle(string memory _title) external onlyOwner {
    title = _title;
    
    emit TitleChanged(_title);
  }

  /// @notice Set `_description` as the description of the gachapon
  function setDescription(string memory _description) external onlyOwner {
    description = _description;
    
    emit DescriptionChanged(_description);
  }

  /// @inheritdoc IDeployerControlledState
  function ban() external override onlyFromControlTower {
    isBanned = true;
    emit BanStatusChanged(isBanned);
  }

  /// @inheritdoc IDeployerControlledState
  function unban() external override onlyFromControlTower {
    isBanned = false;
    emit BanStatusChanged(isBanned);
  }

  /// @notice Set the addresses and rate of their respective shares of the owner's profits / 1000
  /// @param _addresses Array of addresses that will receive a share of the owner's profits, must be unique
  /// @param _rates Rates for each address, must be equal to 1000
  function setOwnerProfitsSharing(address[] memory _addresses, uint16[] memory _rates) public onlyOwner {
    require(_addresses.length == _rates.length, "The number of addresses should be equal to the number of rates");
    require(_addresses.length <= 10, "You can't set more than 10 addresses");

    // Keep track of the sum of all the rates
    uint16 _sumOfRates = 0;
    // Create an array to check for duplicates
    address[10] memory _addedAddresses;
    // Update the profits addresses
    ownerProfitsAddresses = _addresses;
    // Update the profits addresses amount
    ownerProfitsAddressesAmount = ownerProfitsAddresses.length;
    // For each address provided
    for(uint _i = 0; _i < ownerProfitsAddressesAmount; _i++) {
      // Store its rate
      ownerProfitsSharePerAddress[_addresses[_i]] = _rates[_i];
      // Check if there is no duplicate in the array of addresses
      for(uint _j = 0; _j < _addresses.length; _j++) {
        require(_addedAddresses[_j] != _addresses[_i], "All the addresses in the array should be unique");
      }
      // Add the rate to the sum of all the rates
      _sumOfRates += _rates[_i];
      // Add the address to the array for checking duplicates
      _addedAddresses[_i] = _addresses[_i];
    }

    require(_sumOfRates == 1000, "The sum of all the rates must equal 1000");

    emit OwnerProfitsSharingChanged(_addresses, _rates);
  }

  /// @notice Deprecated, use setOwnerProfitsSharing instead.
  function setArtistProfitsSharing(address[] memory _addresses, uint16[] memory _rates) external override onlyOwner {
    setOwnerProfitsSharing(_addresses, _rates);
  }

  /// @notice Deprecated, use owner instead
  function artist() public view returns(address) {
    return owner();
  }

  /// @notice Deprecated, use ownerRate instead
  function artistRate() public view returns(uint16) {
    return ownerRate;
  }

  /// @notice Deprecated, use ownerProfitsSharePerAddress instead
  function artistProfitsSharePerAddress(address _address) public view returns(uint16) {
    return ownerProfitsSharePerAddress[_address];
  }

  /// @notice Deprecated, use ownerProfitsAddresses instead
  function artistProfitsAddresses(uint _index) public view returns(address) {
    return ownerProfitsAddresses[_index];
  }

  /// @notice Deprecated, use ownerProfitsAddressesAmount instead
  function artistProfitsAddressesAmount() public view returns(uint256) {
    return ownerProfitsAddressesAmount;
  }

  /// @inheritdoc IDeployerControlledState
  function setArtistRate(uint16) external view override onlyFromControlTower {
    revert("Artist rate can't be changed after deployment");
  }

  /// @inheritdoc IDeployerControlledState
  function setTokenomicsRate(uint16) external view override onlyFromControlTower {
    revert("Tokenomics rate can't be changed after deployment");
  }

  /// @inheritdoc IDeployerControlledState
  function setDaoRate(uint16) external view override onlyFromControlTower {
    revert("DAO rate can't be changed after deployment");
  }

  /// @inheritdoc IDeployerControlledState
  function withdrawOracleTokens() external virtual override;

  /// @inheritdoc IDeployerControlledState
  function retryRound(bytes32) external virtual override;

  /// @dev Only authorize the deployer contract to interact with those methods
  modifier onlyFromControlTower() {
    require(address(msg.sender) == deployer, "Only for deployer");
    _;
  }
}

File 17 of 21 : IDeployerControlledState.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.6;

/// @title Interface exposing the gachapon methods that are only callable from the GachaponControlTower
/// @author KirienzoEth for DokiDoki
interface IDeployerControlledState {
  /// @notice Ban the gachapon
  function ban() external;
  /// @notice Unban the gachapon
  function unban() external;

  /// @notice Set the cut of the artist to `_rate` / 1000, the sum of all the rates can't exceed 1000
  function setArtistRate(uint16 _rate) external;
  /// @notice Set the cut of the token mechanics to `_rate` / 1000, the sum of all the rates can't exceed 1000
  function setTokenomicsRate(uint16 _rate) external;
  /// @notice Set the cut of the DAO to `_rate` / 1000, the sum of all the rates can't exceed 1000
  function setDaoRate(uint16 _rate) external;
  /// @notice Set the addresses and rate of their respective shares of the artist's profits / 1000
  /// @param _addresses Array of addresses that will receive a share of the artsit's profits, must be unique
  /// @param _rates Rates for each address, must be equal to 1000
  function setArtistProfitsSharing(address[] memory _addresses, uint16[] memory _rates) external;
  /// @notice Will send all the oracle tokens in the gachapon to the treasury address
  function withdrawOracleTokens() external;
  /// @dev Only use this when the oracle failed to answer for a request ID
  /// @dev NEVER USE OUTSIDE OF THIS SCENARIO
  function retryRound(bytes32) external;

  event ArtistRateChanged(uint16 _rate);
  event ArtistProfitsSharingChanged(address[] _addresses, uint16[] _rates);
  event TokenomicsRateChanged(uint16 _rate);
  event DaoRateChanged(uint16 _rate);
  event BanStatusChanged(bool _isBanned);
}

File 18 of 21 : IGachapon.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.6;

import "../gachapon/PrizePoolManager.sol";

/// @title Interface implemented by all gachapons created by the GachaponControlTower
/// @author KirienzoEth for DokiDoki
interface IGachapon {
  /// @dev Undefined = Round doesn't exist, Pending = waiting for oracle response, Unclaimed = oracle answered, Completed = Prizes were withdrawn
  enum RoundStatus { Undefined, Pending, Unclaimed, Completed, Cancelled }
  struct Round {
    bytes32 id; // request id.
    address player; // address of player.
    RoundStatus status; // status of the round.
    uint8 times; // how many times of this round;
    uint256[10] prizes; // Prizes obtained in this round.
  }

  /// @notice Get the state of a round
  function getRound(bytes32 _roundId) external returns (Round memory);
  /// @notice Get the token address of the currency used by this gachapon
  function currency() external returns (address);
  /// @notice Play the gachapon `_times` times
  function play(uint8 _times) external;
  /// @notice Claim the prizes won in a round
  function claimPrizes(bytes32 _roundId) external;
  /// @notice Transferring ownership also change the artist's address
  function transferOwnership(address _newOwner) external;
  /// @notice Get the nft at index `_index`
  function getNft(uint256 _index) external returns(PrizePoolManager.Nft memory);
  /// @notice Return the number of prizes that are still available
  function getRemaningPrizesAmount() external returns(uint256);

  /// @dev Player paid and oracle was contacted, refer to plays(_playId) to check if the prizes were distributed or not
  event RoundStarted(bytes32 indexed _requestId, address indexed _player, uint8 _times);
  /// @dev Oracle answered and the drawn prizes were stored, numbers in _prizes are indexes of the variable 'nfts'
  event RoundCompleted(bytes32 indexed _requestId, address indexed _player, uint8 _times, uint256[10] _prizes);
  /// @dev Oracle didn't answer and we need to try again
  event RoundCancelled(bytes32 _requestId);
  /// @dev Stored prizes were sent to the user
  event PrizesClaimed(bytes32 indexed _requestId);
}

File 19 of 21 : IGachaponFactory.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.6;

import "./IGachapon.sol";

interface IGachaponFactory {
  /// @notice Deploy a new Gachapon contract and returns its address
  /// @dev Deployed gachapon will always implement the IGachapon interface
  function createGachapon(string memory _machineTitle, address _currency) external returns (IGachapon);
  
  /// @notice Which percentage of the play payment will the owner receive (1000 = 100%)
  function gachaponOwnerDefaultRate() external returns (uint16);

  /// @notice The contract that gachapons will use to get oracle tokens
  function oracleTokenPool() external returns (address);
}

File 20 of 21 : IOracleManager.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.6;

interface IOracleManager {
  /// @notice Get the oracle key hash
  function oracleKeyHash() external returns(bytes32);
  /// @notice Get how much a call tro the VRF oracle costs in WEI
  function oracleFee() external returns(uint256);
  /// @notice Get the oracle currency address
  function oracleToken() external returns(address);
  /// @notice Get the address of the VRF coordinator
  function oracleVRFCoordinator() external returns(address);
}

File 21 of 21 : ITreasuryManager.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.6;

interface ITreasuryManager {
  /// @notice Address of the wallet of the doki team funds
  function teamTreasuryAddress() external returns(address);
  /// @notice Address of the wallet of the DAO treasury
  function daoTreasuryAddress() external returns(address);
  /// @notice Address of the wallet managing buybacks\burns
  function tokenomicsManagerAddress() external returns(address);
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"string","name":"_gachaponTitle","type":"string"},{"internalType":"address","name":"_currency","type":"address"},{"internalType":"address","name":"_deployer","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address[]","name":"_addresses","type":"address[]"},{"indexed":false,"internalType":"uint16[]","name":"_rates","type":"uint16[]"}],"name":"ArtistProfitsSharingChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint16","name":"_rate","type":"uint16"}],"name":"ArtistRateChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"_isBanned","type":"bool"}],"name":"BanStatusChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint16","name":"_rate","type":"uint16"}],"name":"DaoRateChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"_description","type":"string"}],"name":"DescriptionChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"_isLocked","type":"bool"}],"name":"LockStatusChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_collection","type":"address"},{"indexed":false,"internalType":"uint256","name":"_id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"NftAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_collection","type":"address"},{"indexed":false,"internalType":"uint256","name":"_id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"NftRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address[]","name":"_addresses","type":"address[]"},{"indexed":false,"internalType":"uint16[]","name":"_rates","type":"uint16[]"}],"name":"OwnerProfitsSharingChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_price","type":"uint256"}],"name":"PlayOncePriceChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"_requestId","type":"bytes32"}],"name":"PrizesClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"_requestId","type":"bytes32"}],"name":"RoundCancelled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"_requestId","type":"bytes32"},{"indexed":true,"internalType":"address","name":"_player","type":"address"},{"indexed":false,"internalType":"uint8","name":"_times","type":"uint8"},{"indexed":false,"internalType":"uint256[10]","name":"_prizes","type":"uint256[10]"}],"name":"RoundCompleted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"_requestId","type":"bytes32"},{"indexed":true,"internalType":"address","name":"_player","type":"address"},{"indexed":false,"internalType":"uint8","name":"_times","type":"uint8"}],"name":"RoundStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"_title","type":"string"}],"name":"TitleChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint16","name":"_rate","type":"uint16"}],"name":"TokenomicsRateChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_collection","type":"address"},{"indexed":false,"internalType":"uint256","name":"_id","type":"uint256"}],"name":"UniqueNftAdded","type":"event"},{"inputs":[],"name":"artist","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_index","type":"uint256"}],"name":"artistProfitsAddresses","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"artistProfitsAddressesAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"artistProfitsSharePerAddress","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"artistRate","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ban","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_requestId","type":"bytes32"}],"name":"claimPrizes","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"currency","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"daoRate","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"deployer","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"description","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_index","type":"uint256"}],"name":"getNft","outputs":[{"components":[{"internalType":"address","name":"collection","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"internalType":"struct PrizePoolManager.Nft","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getRemaningPrizesAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_roundId","type":"bytes32"}],"name":"getRound","outputs":[{"components":[{"internalType":"bytes32","name":"id","type":"bytes32"},{"internalType":"address","name":"player","type":"address"},{"internalType":"enum IGachapon.RoundStatus","name":"status","type":"uint8"},{"internalType":"uint8","name":"times","type":"uint8"},{"internalType":"uint256[10]","name":"prizes","type":"uint256[10]"}],"internalType":"struct IGachapon.Round","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isBanned","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isLocked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isLockedForever","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"nftsAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256[]","name":"_ids","type":"uint256[]"},{"internalType":"uint256[]","name":"_values","type":"uint256[]"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC1155BatchReceived","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"_id","type":"uint256"},{"internalType":"uint256","name":"_value","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC1155Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"_id","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"ownerProfitsAddresses","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ownerProfitsAddressesAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"ownerProfitsSharePerAddress","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ownerRate","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint8","name":"_times","type":"uint8"}],"name":"play","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"playOncePrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"requestId","type":"bytes32"},{"internalType":"uint256","name":"randomness","type":"uint256"}],"name":"rawFulfillRandomness","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_collection","type":"address"},{"internalType":"uint256","name":"_id","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"removeNft","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_collection","type":"address"},{"internalType":"uint256","name":"_id","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"removeUnregisteredNft","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_requestId","type":"bytes32"}],"name":"retryRound","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_addresses","type":"address[]"},{"internalType":"uint16[]","name":"_rates","type":"uint16[]"}],"name":"setArtistProfitsSharing","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"","type":"uint16"}],"name":"setArtistRate","outputs":[],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"","type":"uint16"}],"name":"setDaoRate","outputs":[],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"_description","type":"string"}],"name":"setDescription","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_addresses","type":"address[]"},{"internalType":"uint16[]","name":"_rates","type":"uint16[]"}],"name":"setOwnerProfitsSharing","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_newPrice","type":"uint256"}],"name":"setPlayOncePrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_title","type":"string"}],"name":"setTitle","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"","type":"uint16"}],"name":"setTokenomicsRate","outputs":[],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"_interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"title","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokenomicsRate","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unban","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unlock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawOracleTokens","outputs":[],"stateMutability":"nonpayable","type":"function"}]

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106102bb5760003560e01c80638a6360b911610182578063bc197c81116100e9578063e5a6b10f116100a2578063f2fde38b1161007c578063f2fde38b14610712578063f62575b514610725578063f83d08ba1461072e578063fa01ab531461073657600080fd5b8063e5a6b10f146106c6578063e91f0ac6146106ed578063f23a6e61146106ff57600080fd5b8063bc197c8114610645578063cf6393b814610658578063d5d9ce911461066e578063d5f3948814610676578063dd2be61d1461069d578063e27f8ac8146106bd57600080fd5b806399d79c871161013b57806399d79c87146105e4578063a419feb2146105f1578063a4e2d63414610615578063a69df4b514610622578063aa3dacf81461062a578063adff16001461063257600080fd5b80638a6360b9146105755780638da5cb5b1461045f57806390c3f38f146105a2578063925fd143146105b557806394985ddd146105c8578063997cfbcd146105db57600080fd5b806353a04b0511610226578063715018a6116101df578063715018a6146105205780637284e4161461052857806372910be01461053057806376eb31a41461054357806385a7d56c1461055657806388d963271461056257600080fd5b806353a04b05146104bf578063581a3c66146104d25780635aaad39f146104e55780635f5e7031146104f8578063672abe181461050a578063688cdba81461051257600080fd5b8063405b4e7e11610278578063405b4e7e1461037a57806341f63bfd1461038d57806343bc16121461045f578063458f8c771461047057806346f8711f146104975780634a79d50c146104aa57600080fd5b806301ffc9a7146102c0578063150b7a02146102e85780632205db9a146103145780632c8664361461033f5780632edd1fec14610354578063403f5af414610367575b600080fd5b6102d36102ce366004613e48565b61073e565b60405190151581526020015b60405180910390f35b6102fb6102f6366004613be5565b610790565b6040516001600160e01b031990911681526020016102df565b610327610322366004613df4565b6108b3565b6040516001600160a01b0390911681526020016102df565b61035261034d366004613d09565b6108e3565b005b610352610362366004613d09565b610c6b565b610352610375366004613cd4565b610ca3565b610352610388366004613cd4565b611080565b61041961039b366004613df4565b60408051608081018252600080825260208201819052918101829052606081019190915250600090815260016020818152604092839020835160808101855281546001600160a01b03168152928101549183019190915260028101549282019290925260039091015460e01b6001600160e01b031916606082015290565b6040516102df919081516001600160a01b0316815260208083015190820152604080830151908201526060918201516001600160e01b0319169181019190915260800190565b6000546001600160a01b0316610327565b600e546104849062010000900461ffff1681565b60405161ffff90911681526020016102df565b6103526104a5366004613f07565b611202565b6104b26112a8565b6040516102df9190614094565b6103526104cd366004613f22565b611336565b6103526104e0366004613df4565b61149a565b6103526104f3366004613df4565b611804565b6011545b6040519081526020016102df565b6104fc61186a565b600e546104849061ffff1681565b61035261187c565b6104b26118b2565b61035261053e366004613e72565b6118bf565b610327610551366004613df4565b61192c565b600e5461ffff16610484565b610352610570366004613df4565b611956565b610484610583366004613aec565b6001600160a01b03166000908152600f602052604090205461ffff1690565b6103526105b0366004613e72565b611ace565b6103526105c3366004613f07565b611b3b565b6103526105d6366004613e26565b611bde565b6104fc600d5481565b6003546102d39060ff1681565b6104846105ff366004613aec565b600f6020526000908152604090205461ffff1681565b600c546102d39060ff1681565b610352611c60565b610352611ccb565b610352610640366004613f07565b611eea565b6102fb610653366004613b26565b611f94565b600e5461048490640100000000900461ffff1681565b610352612142565b6103277f000000000000000000000000c15e5c4fe1730562dc866ad9385f652f1d4c43fd81565b6106b06106ab366004613df4565b6121d5565b6040516102df91906141ac565b6104fc60025481565b6103277f0000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa8417481565b600c546102d390610100900460ff1681565b6102fb61070d366004613c58565b61229a565b610352610720366004613aec565b6123bb565b6104fc60115481565b6103526123ee565b610352612458565b60006301ffc9a760e01b6001600160e01b03198316148061076f5750630271189760e51b6001600160e01b03198316145b8061078a5750630a85bd0160e11b6001600160e01b03198316145b92915050565b600080546001600160a01b031632146107c45760405162461bcd60e51b81526004016107bb90614175565b60405180910390fd5b6107d5336380ac58cd60e01b6124e9565b6108585760405162461bcd60e51b815260206004820152604860248201527f4f6e6c792061636365737369626c652077697468206d6574686f64207361666560448201527f5472616e7366657246726f6d2066726f6d20796f75722045524337323120636f606482015267363632b1ba34b7b760c11b608482015260a4016107bb565b61086c338560016380ac58cd60e01b61250c565b60405184815233907fa5491cd3671e046530e21e09d39979b08e0da848b7f1cdcb23e80df2a7efdcfe9060200160405180910390a250630a85bd0160e11b95945050505050565b6000601082815481106108c8576108c861445c565b6000918252602090912001546001600160a01b031692915050565b6000546001600160a01b0316331461090d5760405162461bcd60e51b81526004016107bb906140d2565b80518251146109845760405162461bcd60e51b815260206004820152603e60248201527f546865206e756d626572206f66206164647265737365732073686f756c64206260448201527f6520657175616c20746f20746865206e756d626572206f66207261746573000060648201526084016107bb565b600a825111156109e25760405162461bcd60e51b8152602060048201526024808201527f596f752063616e277420736574206d6f7265207468616e2031302061646472656044820152637373657360e01b60648201526084016107bb565b60006109ec613860565b83516109ff90601090602087019061387f565b5060105460115560005b601154811015610bc557838181518110610a2557610a2561445c565b6020026020010151600f6000878481518110610a4357610a4361445c565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002060006101000a81548161ffff021916908361ffff16021790555060005b8551811015610b4c57858281518110610aa357610aa361445c565b60200260200101516001600160a01b03168382600a8110610ac657610ac661445c565b60200201516001600160a01b03161415610b3a5760405162461bcd60e51b815260206004820152602f60248201527f416c6c207468652061646472657373657320696e20746865206172726179207360448201526e686f756c6420626520756e6971756560881b60648201526084016107bb565b80610b44816143cb565b915050610a88565b50838181518110610b5f57610b5f61445c565b602002602001015183610b7291906142c5565b9250848181518110610b8657610b8661445c565b60200260200101518282600a8110610ba057610ba061445c565b6001600160a01b03909216602092909202015280610bbd816143cb565b915050610a09565b508161ffff166103e814610c2c5760405162461bcd60e51b815260206004820152602860248201527f5468652073756d206f6620616c6c20746865207261746573206d757374206571604482015267075616c20313030360c41b60648201526084016107bb565b7f8b7a44fb6c4a560918982ce6ce95c95c1d089930b4149110f839ce307ea8eda18484604051610c5d929190614019565b60405180910390a150505050565b6000546001600160a01b03163314610c955760405162461bcd60e51b81526004016107bb906140d2565b610c9f82826108e3565b5050565b6000546001600160a01b03163314610ccd5760405162461bcd60e51b81526004016107bb906140d2565b60008111610d275760405162461bcd60e51b815260206004820152602160248201527f596f75206e65656420746f2072656d6f7665206174206c656173742031206e666044820152601d60fa1b60648201526084016107bb565b610d32600884612596565b610d8d5760405162461bcd60e51b815260206004820152602660248201527f5468697320636f6c6c656374696f6e206973206e6f7420696e2074686520676160448201526531b430b837b760d11b60648201526084016107bb565b6000600554118015610dce57506001600160a01b03831660009081526006602090815260408083208584528252808320548352600191829052909120015482145b610e265760405162461bcd60e51b8152602060048201526024808201527f5468697320746f6b656e204944206973206e6f7420696e20746865206761636860448201526330b837b760e11b60648201526084016107bb565b6001600160a01b038316600090815260066020908152604080832085845282528083205483526001909152902060020154811115610ebe5760405162461bcd60e51b815260206004820152602f60248201527f5468657265206973206e6f7420656e6f756768206f662074686973206e66742060448201526e34b7103a34329033b0b1b430b837b760891b60648201526084016107bb565b60075415610ede5760405162461bcd60e51b81526004016107bb90614107565b6003805460ff191660019081179091556001600160a01b038416600090815260066020908152604080832086845282528083205483529290529081206002018054839290610f2d908490614336565b925050819055508060056000828254610f469190614336565b90915550610f6690506001600160a01b038416636cdb3d1360e11b6124e9565b15610fd457604051637921219560e11b81526001600160a01b0384169063f242432a90610f9d903090339087908790600401613fb1565b600060405180830381600087803b158015610fb757600080fd5b505af1158015610fcb573d6000803e3d6000fd5b50505050611037565b604051632142170760e11b81526001600160a01b038416906342842e0e9061100490309033908790600401613f8d565b600060405180830381600087803b15801561101e57600080fd5b505af1158015611032573d6000803e3d6000fd5b505050505b60408051838152602081018390526001600160a01b038516917f8b97def5e7630af6e805d9b27e764c40231919d962a07096635dcf2b7e19e17e910160405180910390a2505050565b6000546001600160a01b031633146110aa5760405162461bcd60e51b81526004016107bb906140d2565b6001600160a01b0380841660008181526006602090815260408083208784528252808320548352600190915290205490911614156111405760405162461bcd60e51b815260206004820152602d60248201527f5468697320746f6b656e204944206973207265676973746572656420696e207460448201526c1a19481c1c9a5e99481c1bdbdb609a1b60648201526084016107bb565b61115a6001600160a01b038416636cdb3d1360e11b6124e9565b156111c857604051637921219560e11b81526001600160a01b0384169063f242432a90611191903090339087908790600401613fb1565b600060405180830381600087803b1580156111ab57600080fd5b505af11580156111bf573d6000803e3d6000fd5b50505050505050565b604051632142170760e11b81526001600160a01b038416906342842e0e9061119190309033908790600401613f8d565b505050565b905090565b336001600160a01b037f000000000000000000000000c15e5c4fe1730562dc866ad9385f652f1d4c43fd161461124a5760405162461bcd60e51b81526004016107bb906140a7565b60405162461bcd60e51b815260206004820152602d60248201527f41727469737420726174652063616e2774206265206368616e6765642061667460448201526c195c8819195c1b1bde5b595b9d609a1b60648201526084016107bb565b600a80546112b590614390565b80601f01602080910402602001604051908101604052809291908181526020018280546112e190614390565b801561132e5780601f106113035761010080835404028352916020019161132e565b820191906000526020600020905b81548152906001019060200180831161131157829003601f168201915b505050505081565b600c5460ff1615801561134c575060035460ff16155b6113a65760405162461bcd60e51b815260206004820152602560248201527f596f752063616e277420706c617920776974682061206c6f636b6564206761636044820152643430b837b760d91b60648201526084016107bb565b60008160ff161180156113bd5750600a8160ff1611155b61141a5760405162461bcd60e51b815260206004820152602860248201527f596f752063616e206f6e6c7920706c6179206265747765656e203120616e642060448201526731302074696d657360c01b60648201526084016107bb565b61142261186a565b8160ff1611156114745760405162461bcd60e51b815260206004820152601c60248201527f4e6f7420656e6f756768204e465473206c65667420746f20706c61790000000060448201526064016107bb565b61148d8160ff16600d546114889190614317565b6125b8565b6114973382612745565b50565b6002600082815260136020526040902060010154600160a01b900460ff1660048111156114c9576114c9614446565b146115245760405162461bcd60e51b815260206004820152602560248201527f5468697320726f756e64206973206e6f7420726561647920746f20626520636c604482015264185a5b595960da1b60648201526084016107bb565b6000818152601360205260408120600101805460ff60a01b1916600360a01b1790555b600082815260136020526040902060010154600160a81b900460ff168110156117d5576000828152601360205260408120636cdb3d1360e11b9160019160020184600a81106115985761159861445c565b0154815260208101919091526040016000206003015460e01b6001600160e01b03191614156116e15760008281526013602052604081206001919060020183600a81106115e7576115e761445c565b01548152602080820192909252604090810160009081205485825260139093529081206001818101546001600160a01b039485169463f242432a94309492909116929160020187600a811061163e5761163e61445c565b015481526020810191909152604090810160002060019081015491516001600160e01b031960e087901b1681526001600160a01b0394851660048201529390921660248401526044830152606482015260a06084820152600260a482015261060f60f31b60c482015260e401600060405180830381600087803b1580156116c457600080fd5b505af11580156116d8573d6000803e3d6000fd5b505050506117c3565b60008281526013602052604081206001919060020183600a81106117075761170761445c565b01548152602080820192909252604090810160009081205485825260139093529081206001818101546001600160a01b03948516946342842e0e94309492909116929160020187600a811061175e5761175e61445c565b01548152602001908152602001600020600101546040518463ffffffff1660e01b815260040161179093929190613f8d565b600060405180830381600087803b1580156117aa57600080fd5b505af11580156117be573d6000803e3d6000fd5b505050505b806117cd816143cb565b915050611547565b5060405181907f7d7c9e6b4aac59116e67409f5aa4dfce6113cec9596c8acde46f46aa35b89ffc90600090a250565b6000546001600160a01b0316331461182e5760405162461bcd60e51b81526004016107bb906140d2565b600d8190556040518181527f560c7a7a99329e72dc5c91b92587f1778252817729eb61d1545d0e8424d5ab49906020015b60405180910390a150565b60006007546005546111fd9190614336565b6000546001600160a01b031633146118a65760405162461bcd60e51b81526004016107bb906140d2565b6118b06000612c7d565b565b600b80546112b590614390565b6000546001600160a01b031633146118e95760405162461bcd60e51b81526004016107bb906140d2565b80516118fc90600a9060208401906138e4565b507f8e93f5a6ac6ff40debdd7d5c9e93516e8f556635b1dcb941b7975205484fe9d38160405161185f9190614094565b6010818154811061193c57600080fd5b6000918252602090912001546001600160a01b0316905081565b336001600160a01b037f000000000000000000000000c15e5c4fe1730562dc866ad9385f652f1d4c43fd161461199e5760405162461bcd60e51b81526004016107bb906140a7565b6001600082815260136020526040902060010154600160a01b900460ff1660048111156119cd576119cd614446565b14611a255760405162461bcd60e51b815260206004820152602260248201527f4f6e6c792070656e64696e6720726f756e64732063616e206265207265747269604482015261195960f21b60648201526084016107bb565b6000818152601360205260408120600101805460ff60a01b1916600160a21b179081905560078054600160a81b90920460ff16929091611a66908490614336565b90915550506040518181527f35b68b80baf3b9ab3407109641a6f1ea51bdc1c7669f67e2b95a9dbca18b159f9060200160405180910390a1600081815260136020526040902060010154611497906001600160a01b03811690600160a81b900460ff16612745565b6000546001600160a01b03163314611af85760405162461bcd60e51b81526004016107bb906140d2565b8051611b0b90600b9060208401906138e4565b507f8a1bce929b257bfd582fa164d9b9fa4d4b0b7442b10b3aad23e2c56aa4e0d61a8160405161185f9190614094565b336001600160a01b037f000000000000000000000000c15e5c4fe1730562dc866ad9385f652f1d4c43fd1614611b835760405162461bcd60e51b81526004016107bb906140a7565b60405162461bcd60e51b815260206004820152602a60248201527f44414f20726174652063616e2774206265206368616e6765642061667465722060448201526919195c1b1bde5b595b9d60b21b60648201526084016107bb565b336001600160a01b037f0000000000000000000000003d2341adb2d31f1c5530cdc622016af293177ae01614611c565760405162461bcd60e51b815260206004820152601f60248201527f4f6e6c7920565246436f6f7264696e61746f722063616e2066756c66696c6c0060448201526064016107bb565b610c9f8282612ccd565b6000546001600160a01b03163314611c8a5760405162461bcd60e51b81526004016107bb906140d2565b600c805460ff19169055604051600081527f73d173202f9117f42b910c942ad1c76f5572b3fad8926ccf20a8f9491cf6a9d6906020015b60405180910390a1565b336001600160a01b037f000000000000000000000000c15e5c4fe1730562dc866ad9385f652f1d4c43fd1614611d135760405162461bcd60e51b81526004016107bb906140a7565b7f000000000000000000000000b0897686c545045afc77cf20ec7a532e3120e0f16001600160a01b031663a9059cbb7f000000000000000000000000c15e5c4fe1730562dc866ad9385f652f1d4c43fd6001600160a01b0316638e4b786b6040518163ffffffff1660e01b8152600401602060405180830381600087803b158015611d9d57600080fd5b505af1158015611db1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611dd59190613b09565b6040516370a0823160e01b81523060048201527f000000000000000000000000b0897686c545045afc77cf20ec7a532e3120e0f16001600160a01b0316906370a082319060240160206040518083038186803b158015611e3457600080fd5b505afa158015611e48573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e6c9190613e0d565b6040516001600160e01b031960e085901b1681526001600160a01b0390921660048301526024820152604401602060405180830381600087803b158015611eb257600080fd5b505af1158015611ec6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114979190613dd2565b336001600160a01b037f000000000000000000000000c15e5c4fe1730562dc866ad9385f652f1d4c43fd1614611f325760405162461bcd60e51b81526004016107bb906140a7565b60405162461bcd60e51b815260206004820152603160248201527f546f6b656e6f6d69637320726174652063616e2774206265206368616e6765646044820152700818599d195c8819195c1b1bde5b595b9d607a1b60648201526084016107bb565b600080546001600160a01b03163214611fbf5760405162461bcd60e51b81526004016107bb90614175565b611fd033636cdb3d1360e11b6124e9565b6120595760405162461bcd60e51b815260206004820152604e60248201527f4f6e6c792061636365737369626c652077697468206d6574686f64207361666560448201527f42617463685472616e7366657246726f6d2066726f6d20796f7572204552433160648201526d189a9a9031b7b63632b1ba34b7b760911b608482015260a4016107bb565b60005b8681101561212c576120a73389898481811061207a5761207a61445c565b905060200201358888858181106120935761209361445c565b9050602002013563d9b67a2660e01b61250c565b337f31b24015af17348f4d8f446b651f81666a9d46bff21d6f08ef291f9df929ff5b8989848181106120db576120db61445c565b905060200201358888858181106120f4576120f461445c565b90506020020135604051612112929190918252602082015260400190565b60405180910390a280612124816143cb565b91505061205c565b5063bc197c8160e01b9998505050505050505050565b336001600160a01b037f000000000000000000000000c15e5c4fe1730562dc866ad9385f652f1d4c43fd161461218a5760405162461bcd60e51b81526004016107bb906140a7565b600c805461ff001916610100908117918290556040517fdc4b62506a8596e69ddae0f16c5b7e4eedb6e37d41bb6b9086a699aacd1531ce92611cc192900460ff161515815260200190565b6121dd613958565b600082815260136020908152604091829020825160a0810184528154815260018201546001600160a01b0381169382019390935292909190830190600160a01b900460ff16600481111561223357612233614446565b600481111561224457612244614446565b81526001820154600160a81b900460ff1660208201526040805161014081018083529190920191906002840190600a9082845b815481526020019060010190808311612277575050505050815250509050919050565b600080546001600160a01b031632146122c55760405162461bcd60e51b81526004016107bb90614175565b6122d633636cdb3d1360e11b6124e9565b61235a5760405162461bcd60e51b815260206004820152604960248201527f4f6e6c792061636365737369626c652077697468206d6574686f64207361666560448201527f5472616e7366657246726f6d2066726f6d20796f75722045524331313535206360648201526837b63632b1ba34b7b760b91b608482015260a4016107bb565b61236d338686636cdb3d1360e11b61250c565b604080518681526020810186905233917f31b24015af17348f4d8f446b651f81666a9d46bff21d6f08ef291f9df929ff5b910160405180910390a25063f23a6e6160e01b9695505050505050565b6000546001600160a01b031633146123e55760405162461bcd60e51b81526004016107bb906140d2565b61149781612f67565b6000546001600160a01b031633146124185760405162461bcd60e51b81526004016107bb906140d2565b600c805460ff191660019081179091556040519081527f73d173202f9117f42b910c942ad1c76f5572b3fad8926ccf20a8f9491cf6a9d690602001611cc1565b336001600160a01b037f000000000000000000000000c15e5c4fe1730562dc866ad9385f652f1d4c43fd16146124a05760405162461bcd60e51b81526004016107bb906140a7565b600c805461ff001916908190556040517fdc4b62506a8596e69ddae0f16c5b7e4eedb6e37d41bb6b9086a699aacd1531ce91611cc19161010090910460ff161515815260200190565b60006124f483612fff565b801561250557506125058383613032565b9392505050565b600c5460ff166125845760405162461bcd60e51b815260206004820152603a60248201527f596f75206e65656420746f206c6f636b20746865206761636861706f6e20626560448201527f666f726520796f752063616e20616464206d6f7265204e46547300000000000060648201526084016107bb565b6125908484848461311b565b50505050565b6001600160a01b03811660009081526001830160205260408120541515612505565b600e546000906103e8906125d09061ffff1684614317565b6125da9190614303565b905060006125e88284614336565b9050811561260b5760006125fb836133af565b905061260781836142eb565b9150505b80156111f8577f0000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa841746001600160a01b03166323b872dd337f000000000000000000000000c15e5c4fe1730562dc866ad9385f652f1d4c43fd6001600160a01b0316638e4b786b6040518163ffffffff1660e01b8152600401602060405180830381600087803b15801561269c57600080fd5b505af11580156126b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126d49190613b09565b846040518463ffffffff1660e01b81526004016126f393929190613f8d565b602060405180830381600087803b15801561270d57600080fd5b505af1158015612721573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125909190613dd2565b60007f000000000000000000000000c15e5c4fe1730562dc866ad9385f652f1d4c43fd6001600160a01b031663f9cd3ceb6040518163ffffffff1660e01b8152600401602060405180830381600087803b1580156127a257600080fd5b505af11580156127b6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127da9190613e0d565b601454604051636eb1769f60e11b81526001600160a01b03918216600482015230602482015291925082917f000000000000000000000000b0897686c545045afc77cf20ec7a532e3120e0f19091169063dd62ed3e9060440160206040518083038186803b15801561284b57600080fd5b505afa15801561285f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128839190613e0d565b10156128e35760405162461bcd60e51b815260206004820152602960248201527f416c6c6f77616e63652066726f6d206f7261636c6520746f6b656e20706f6f6c6044820152680819195c1b195d195960ba1b60648201526084016107bb565b6014546040516370a0823160e01b81526001600160a01b03918216600482015282917f000000000000000000000000b0897686c545045afc77cf20ec7a532e3120e0f116906370a082319060240160206040518083038186803b15801561294957600080fd5b505afa15801561295d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129819190613e0d565b10156129db5760405162461bcd60e51b815260206004820152602360248201527f4e6f7420656e6f75676820746f6b656e7320746f2070617920746865206f7261604482015262636c6560e81b60648201526084016107bb565b6014546040516323b872dd60e01b81526001600160a01b037f000000000000000000000000b0897686c545045afc77cf20ec7a532e3120e0f18116926323b872dd92612a3292919091169030908690600401613f8d565b602060405180830381600087803b158015612a4c57600080fd5b505af1158015612a60573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a849190613dd2565b506000612bb57f000000000000000000000000c15e5c4fe1730562dc866ad9385f652f1d4c43fd6001600160a01b03166399a933056040518163ffffffff1660e01b8152600401602060405180830381600087803b158015612ae557600080fd5b505af1158015612af9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b1d9190613e0d565b7f000000000000000000000000c15e5c4fe1730562dc866ad9385f652f1d4c43fd6001600160a01b031663f9cd3ceb6040518163ffffffff1660e01b8152600401602060405180830381600087803b158015612b7857600080fd5b505af1158015612b8c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612bb09190613e0d565b6135dd565b600081815260136020526040812082815560010180546001600160a01b0388166001600160a81b031990911617600160a01b1760ff60a81b1916600160a81b60ff881690810291909117909155600780549394509092909190612c199084906142eb565b909155505060008181526013602090815260409182902060018101549054925160ff871681526001600160a01b0390911692917fd4a3c9d93036032a8d88f13703750743282b3cda053ec96297858467b71d541a910160405180910390a350505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600083815260136020526040902060010154600160a01b900460ff166004811115612cfc57612cfc614446565b14612d605760405162461bcd60e51b815260206004820152602e60248201527f5468652063616c6c6261636b2077617320616c72656164792063616c6c65642060448201526d199bdc881d1a1a5cc81c9bdd5b9960921b60648201526084016107bb565b612d68613860565b60005b60008481526013602052604090206001015460ff600160a81b90910481169082161015612e63576000612dae848360ff16600554612da99190614336565b613770565b6000818152600460205260409020549091508360ff8416600a8110612dd557612dd561445c565b6020908102919091019190915260008281526004825260408082205482526001909252908120600201805491612e0a83614379565b9190505550600460008360ff166001600554612e269190614336565b612e309190614336565b81526020808201929092526040908101600090812054938152600490925290205580612e5b816143e6565b915050612d6b565b506000838152601360205260409020612e819060020182600a61398c565b5060008381526013602052604081206001015460058054600160a81b90920460ff16929091612eb1908490614336565b90915550506000838152601360205260408120600101805460ff60a01b1916600160a11b179081905560078054600160a81b90920460ff16929091612ef7908490614336565b909155505060008381526013602052604090819020600181015491516001600160a01b0383169286927f10f78314d725d41cb7445b345c5d11bee93807a6b20725839893232e11f160b392612f5a92600160a81b900460ff169160020190614234565b60405180910390a3505050565b6000546001600160a01b03163314612f915760405162461bcd60e51b81526004016107bb906140d2565b6001600160a01b038116612ff65760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016107bb565b61149781612c7d565b6000613012826301ffc9a760e01b613032565b801561078a575061302b826001600160e01b0319613032565b1592915050565b604080516001600160e01b0319831660248083019190915282518083039091018152604490910182526020810180516001600160e01b03166301ffc9a760e01b179052905160009190829081906001600160a01b0387169061753090613099908690613f71565b6000604051808303818686fa925050503d80600081146130d5576040519150601f19603f3d011682016040523d82523d6000602084013e6130da565b606091505b50915091506020815110156130f5576000935050505061078a565b8180156131115750808060200190518101906131119190613dd2565b9695505050505050565b60035460ff16156131865760405162461bcd60e51b815260206004820152602f60248201527f596f752063616e6e6f7420616464206d6f7265204e46547320746f20616e207560448201526e6e757361626c65206d616368696e6560881b60648201526084016107bb565b600754156131a65760405162461bcd60e51b81526004016107bb90614107565b6131b1600885613801565b5060055415806131f157506001600160a01b0380851660008181526006602090815260408083208884528252808320548352600190915290205490911614155b8061322c57506001600160a01b0384166000908152600660209081526040808320868452825280832054835260019182905290912001548314155b156132e757600280546001600160a01b0386811660008181526006602090815260408083208a8452825280832086905580516080810182529384528382018a81528482018a81526001600160e01b03198a1660608701908152978552600193849052918420945185546001600160a01b031916961695909517845593519083015591518185015591516003909201805463ffffffff191660e09390931c92909217909155815491906132dd836143cb565b919050555061332d565b6001600160a01b038416600090815260066020908152604080832086845282528083205483526001909152812060020180548492906133279084906142eb565b90915550505b60005b82811015613391576001600160a01b0385166000908152600660209081526040808320878452909152812054600554909160049161336e90856142eb565b815260208101919091526040016000205580613389816143cb565b915050613330565b5081600560008282546133a491906142eb565b909155505050505050565b601054600090613475577f0000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa841746001600160a01b03166323b872dd336133fb6000546001600160a01b031690565b856040518463ffffffff1660e01b815260040161341a93929190613f8d565b602060405180830381600087803b15801561343457600080fd5b505af1158015613448573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061346c9190613dd2565b50600092915050565b8160005b60105460ff821610156135d65760006103e8600f600060108560ff16815481106134a5576134a561445c565b60009182526020808320909101546001600160a01b031683528201929092526040019020546134d89061ffff1687614317565b6134e29190614303565b90507f0000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa841746001600160a01b03166323b872dd3360108560ff168154811061352a5761352a61445c565b6000918252602090912001546040516001600160e01b031960e085901b16815261356392916001600160a01b0316908690600401613f8d565b602060405180830381600087803b15801561357d57600080fd5b505af1158015613591573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906135b59190613dd2565b506135c08184614336565b92505080806135ce906143e6565b915050613479565b5092915050565b60007f000000000000000000000000b0897686c545045afc77cf20ec7a532e3120e0f16001600160a01b0316634000aea07f0000000000000000000000003d2341adb2d31f1c5530cdc622016af293177ae08486600060405160200161364d929190918252602082015260400190565b6040516020818303038152906040526040518463ffffffff1660e01b815260040161367a93929190613fe9565b602060405180830381600087803b15801561369457600080fd5b505af11580156136a8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906136cc9190613dd2565b50600083815260126020818152604080842054815180840189905280830186905230606082015260808082018390528351808303909101815260a0909101909252815191830191909120938790529190526137289060016142eb565b6000858152601260205260409020556137688482604080516020808201949094528082019290925280518083038201815260609092019052805191012090565b949350505050565b600080838360405160200161378f929190918252602082015260400190565b6040516020818303038152906040528051906020012060001c90505b6137b783600019614406565b6137c390600019614336565b81106137f75760408051602080820187905281830193909352815180820383018152606090910190915280519101206137ab565b6137688382614406565b6000612505836001600160a01b03841660008181526001830160205260408120546138585750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915561078a565b50600061078a565b604051806101400160405280600a906020820280368337509192915050565b8280548282559060005260206000209081019282156138d4579160200282015b828111156138d457825182546001600160a01b0319166001600160a01b0390911617825560209092019160019091019061389f565b506138e09291506139b9565b5090565b8280546138f090614390565b90600052602060002090601f01602090048101928261391257600085556138d4565b82601f1061392b57805160ff19168380011785556138d4565b828001600101855582156138d4579182015b828111156138d457825182559160200191906001019061393d565b6040805160a0810182526000808252602082018190529091820190815260006020820152604001613987613860565b905290565b82600a81019282156138d457916020028201828111156138d457825182559160200191906001019061393d565b5b808211156138e057600081556001016139ba565b600082601f8301126139df57600080fd5b813560206139f46139ef836142a1565b614270565b80838252828201915082860187848660051b8901011115613a1457600080fd5b60005b85811015613a3a57613a2882613ad5565b84529284019290840190600101613a17565b5090979650505050505050565b60008083601f840112613a5957600080fd5b50813567ffffffffffffffff811115613a7157600080fd5b6020830191508360208260051b8501011115613a8c57600080fd5b9250929050565b60008083601f840112613aa557600080fd5b50813567ffffffffffffffff811115613abd57600080fd5b602083019150836020828501011115613a8c57600080fd5b803561ffff81168114613ae757600080fd5b919050565b600060208284031215613afe57600080fd5b813561250581614488565b600060208284031215613b1b57600080fd5b815161250581614488565b60008060008060008060008060a0898b031215613b4257600080fd5b8835613b4d81614488565b97506020890135613b5d81614488565b9650604089013567ffffffffffffffff80821115613b7a57600080fd5b613b868c838d01613a47565b909850965060608b0135915080821115613b9f57600080fd5b613bab8c838d01613a47565b909650945060808b0135915080821115613bc457600080fd5b50613bd18b828c01613a93565b999c989b5096995094979396929594505050565b600080600080600060808688031215613bfd57600080fd5b8535613c0881614488565b94506020860135613c1881614488565b935060408601359250606086013567ffffffffffffffff811115613c3b57600080fd5b613c4788828901613a93565b969995985093965092949392505050565b60008060008060008060a08789031215613c7157600080fd5b8635613c7c81614488565b95506020870135613c8c81614488565b94506040870135935060608701359250608087013567ffffffffffffffff811115613cb657600080fd5b613cc289828a01613a93565b979a9699509497509295939492505050565b600080600060608486031215613ce957600080fd5b8335613cf481614488565b95602085013595506040909401359392505050565b60008060408385031215613d1c57600080fd5b823567ffffffffffffffff80821115613d3457600080fd5b818501915085601f830112613d4857600080fd5b81356020613d586139ef836142a1565b8083825282820191508286018a848660051b8901011115613d7857600080fd5b600096505b84871015613da4578035613d9081614488565b835260019690960195918301918301613d7d565b5096505086013592505080821115613dbb57600080fd5b50613dc8858286016139ce565b9150509250929050565b600060208284031215613de457600080fd5b8151801515811461250557600080fd5b600060208284031215613e0657600080fd5b5035919050565b600060208284031215613e1f57600080fd5b5051919050565b60008060408385031215613e3957600080fd5b50508035926020909101359150565b600060208284031215613e5a57600080fd5b81356001600160e01b03198116811461250557600080fd5b60006020808385031215613e8557600080fd5b823567ffffffffffffffff80821115613e9d57600080fd5b818501915085601f830112613eb157600080fd5b813581811115613ec357613ec3614472565b613ed5601f8201601f19168501614270565b91508082528684828501011115613eeb57600080fd5b8084840185840137600090820190930192909252509392505050565b600060208284031215613f1957600080fd5b61250582613ad5565b600060208284031215613f3457600080fd5b813560ff8116811461250557600080fd5b60008151808452613f5d81602086016020860161434d565b601f01601f19169290920160200192915050565b60008251613f8381846020870161434d565b9190910192915050565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b0394851681529290931660208301526040820152606081019190915260a06080820181905260009082015260c00190565b60018060a01b03841681528260208201526060604082015260006140106060830184613f45565b95945050505050565b604080825283519082018190526000906020906060840190828701845b8281101561405b5781516001600160a01b031684529284019290840190600101614036565b5050508381038285015284518082528583019183019060005b81811015613a3a57835161ffff1683529284019291840191600101614074565b6020815260006125056020830184613f45565b60208082526011908201527027b7363c903337b9103232b83637bcb2b960791b604082015260600190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526048908201527f596f752063616e277420616c74657220746865207072697a6520706f6f6c207760408201527f68656e20706c6179657273206172652077616974696e6720666f72207468656960608201526772207072697a657360c01b608082015260a00190565b6020808252601b908201527f4f6e6c7920746865206f776e65722063616e20616464206e6674730000000000604082015260600190565b815181526020808301516001600160a01b03168183015260408301516101c083019190600581106141ed57634e487b7160e01b600052602160045260246000fd5b8060408501525060ff606085015116606084015260808401516080840160005b600a81101561422a5782518252918301919083019060010161420d565b5050505092915050565b60ff83168152610160810160208083018460005b600a81101561426557815483529183019160019182019101614248565b505050509392505050565b604051601f8201601f1916810167ffffffffffffffff8111828210171561429957614299614472565b604052919050565b600067ffffffffffffffff8211156142bb576142bb614472565b5060051b60200190565b600061ffff8083168185168083038211156142e2576142e261441a565b01949350505050565b600082198211156142fe576142fe61441a565b500190565b60008261431257614312614430565b500490565b60008160001904831182151516156143315761433161441a565b500290565b6000828210156143485761434861441a565b500390565b60005b83811015614368578181015183820152602001614350565b838111156125905750506000910152565b6000816143885761438861441a565b506000190190565b600181811c908216806143a457607f821691505b602082108114156143c557634e487b7160e01b600052602260045260246000fd5b50919050565b60006000198214156143df576143df61441a565b5060010190565b600060ff821660ff8114156143fd576143fd61441a565b60010192915050565b60008261441557614415614430565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461149757600080fdfea26469706673582212205d4253d5f8d694ee404af89eb7905322bdeb804cbf17c3b4bbe0083baa7e6b4364736f6c63430008060033

Block Transaction Gas Used Reward
view all blocks produced

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

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
[ Download: CSV Export  ]
[ Download: CSV Export  ]

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