ETH Price: $2,511.54 (+0.17%)

Contract

0x536203E6731cbC4F1ae441C71eEb75e9fCDaC8a8
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Emergency Withdr...169654932023-04-03 2:17:47579 days ago1680488267IN
0x536203E6...9fCDaC8a8
0 ETH0.0012386140.76675009
Emergency Withdr...164499052023-01-20 18:47:23651 days ago1674240443IN
0x536203E6...9fCDaC8a8
0 ETH0.0007131223.47122922
Request Random W...164499032023-01-20 18:46:59651 days ago1674240419IN
0x536203E6...9fCDaC8a8
0 ETH0.0024720526.13805252
Call The Offerin...157151582022-10-10 3:56:47753 days ago1665374207IN
0x536203E6...9fCDaC8a8
0 ETH0.0139996541.93422178
Request Random W...156490112022-09-30 22:02:47763 days ago1664575367IN
0x536203E6...9fCDaC8a8
0 ETH0.0014664715.50563149
Call Distributor156490062022-09-30 22:01:47763 days ago1664575307IN
0x536203E6...9fCDaC8a8
0 ETH0.0009827414.31860198
Call The Offerin...156490012022-09-30 22:00:47763 days ago1664575247IN
0x536203E6...9fCDaC8a8
0 ETH0.0042990714.11985263
Request Random W...156346962022-09-28 22:02:59765 days ago1664402579IN
0x536203E6...9fCDaC8a8
0 ETH0.0016550317.49933893
Call Distributor156346902022-09-28 22:01:47765 days ago1664402507IN
0x536203E6...9fCDaC8a8
0 ETH0.0013625119.8518654
Call The Offerin...156346852022-09-28 22:00:47765 days ago1664402447IN
0x536203E6...9fCDaC8a8
0 ETH0.0074163520.4202583
Request Random W...156203892022-09-26 22:02:35767 days ago1664229755IN
0x536203E6...9fCDaC8a8
0 ETH0.0025942827.43045118
Call Distributor156203842022-09-26 22:01:35767 days ago1664229695IN
0x536203E6...9fCDaC8a8
0 ETH0.0019622328.58983825
Call The Offerin...156203792022-09-26 22:00:35767 days ago1664229635IN
0x536203E6...9fCDaC8a8
0 ETH0.005717427.58714555
Request Random W...156109812022-09-25 14:27:35768 days ago1664116055IN
0x536203E6...9fCDaC8a8
0 ETH0.0010187512.8181754
Request Random W...156109802022-09-25 14:27:23768 days ago1664116043IN
0x536203E6...9fCDaC8a8
0 ETH0.0011270111.91639778
Call Distributor156109772022-09-25 14:26:35768 days ago1664115995IN
0x536203E6...9fCDaC8a8
0 ETH0.0008178711.91639778
Call The Offerin...156109722022-09-25 14:25:35768 days ago1664115935IN
0x536203E6...9fCDaC8a8
0 ETH0.0036717112.07311916
Request Random W...155775722022-09-20 22:09:35773 days ago1663711775IN
0x536203E6...9fCDaC8a8
0 ETH0.0012689613.41728684
Call Distributor155775662022-09-20 22:08:23773 days ago1663711703IN
0x536203E6...9fCDaC8a8
0 ETH0.0009933614.47334858
Call The Offerin...155775612022-09-20 22:07:23773 days ago1663711643IN
0x536203E6...9fCDaC8a8
0 ETH0.0036383211.56580988
Request Random W...155700972022-09-19 21:01:23774 days ago1663621283IN
0x536203E6...9fCDaC8a8
0 ETH0.0013507314.28187338
Call Distributor155700922022-09-19 21:00:23774 days ago1663621223IN
0x536203E6...9fCDaC8a8
0 ETH0.0007555911.00909847
Call The Offerin...155700872022-09-19 20:59:23774 days ago1663621163IN
0x536203E6...9fCDaC8a8
0 ETH0.0032600110.70717209
Request Random W...155535312022-09-17 13:14:47776 days ago1663420487IN
0x536203E6...9fCDaC8a8
0 ETH0.000509835.39071656
Call Distributor155535262022-09-17 13:13:47776 days ago1663420427IN
0x536203E6...9fCDaC8a8
0 ETH0.000371995.4199436
View all transactions

Latest 25 internal transactions (View All)

Advanced mode:
Parent Transaction Hash Block From To
169654932023-04-03 2:17:47579 days ago1680488267
0x536203E6...9fCDaC8a8
0.02740382 ETH
167952472023-03-10 4:01:47602 days ago1678420907
0x536203E6...9fCDaC8a8
0.01097243 ETH
165210832023-01-30 17:17:59641 days ago1675099079
0x536203E6...9fCDaC8a8
0.01643139 ETH
164499052023-01-20 18:47:23651 days ago1674240443
0x536203E6...9fCDaC8a8
0.40322789 ETH
163537412023-01-07 8:33:47664 days ago1673080427
0x536203E6...9fCDaC8a8
0.00949946 ETH
163347122023-01-04 16:47:11667 days ago1672850831
0x536203E6...9fCDaC8a8
0.03049228 ETH
163347012023-01-04 16:44:59667 days ago1672850699
0x536203E6...9fCDaC8a8
0.01383267 ETH
161543102022-12-10 12:29:23692 days ago1670675363
0x536203E6...9fCDaC8a8
0.0139475 ETH
160823402022-11-30 10:55:11702 days ago1669805711
0x536203E6...9fCDaC8a8
0.01216312 ETH
160704912022-11-28 19:11:11704 days ago1669662671
0x536203E6...9fCDaC8a8
0.01247413 ETH
159648182022-11-14 0:53:35719 days ago1668387215
0x536203E6...9fCDaC8a8
0.0288247 ETH
159631652022-11-13 19:22:23719 days ago1668367343
0x536203E6...9fCDaC8a8
0.03491974 ETH
159304632022-11-09 5:43:11723 days ago1667972591
0x536203E6...9fCDaC8a8
0.01538624 ETH
158962972022-11-04 11:17:23728 days ago1667560643
0x536203E6...9fCDaC8a8
0.01511027 ETH
158799882022-11-02 4:36:11730 days ago1667363771
0x536203E6...9fCDaC8a8
0.03252187 ETH
158786502022-11-02 0:06:47731 days ago1667347607
0x536203E6...9fCDaC8a8
0.01718028 ETH
158540682022-10-29 13:39:47734 days ago1667050787
0x536203E6...9fCDaC8a8
0.02083593 ETH
158108512022-10-23 12:36:11740 days ago1666528571
0x536203E6...9fCDaC8a8
0.01779142 ETH
157622262022-10-16 17:40:11747 days ago1665942011
0x536203E6...9fCDaC8a8
0.0175274 ETH
157267682022-10-11 18:50:47752 days ago1665514247
0x536203E6...9fCDaC8a8
0.02453926 ETH
157151582022-10-10 3:56:47753 days ago1665374207
0x536203E6...9fCDaC8a8
0.00220978 ETH
157151502022-10-10 3:55:11753 days ago1665374111
0x536203E6...9fCDaC8a8
0.04542396 ETH
156548622022-10-01 17:41:59762 days ago1664646119
0x536203E6...9fCDaC8a8
0.02005428 ETH
156490062022-09-30 22:01:47763 days ago1664575307
0x536203E6...9fCDaC8a8
0.01909423 ETH
156490062022-09-30 22:01:47763 days ago1664575307
0x536203E6...9fCDaC8a8
0.01527538 ETH
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
JigsawDistributor

Compiler Version
v0.8.4+commit.c7e474f2

Optimization Enabled:
Yes with 100 runs

Other Settings:
default evmVersion
File 1 of 10 : JigsawDistributor.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
pragma abicoder v2;

/**
 * @author Brewlabs
 * This treasury contract has been developed by brewlabs.info
 */
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@chainlink/contracts/src/v0.8/interfaces/LinkTokenInterface.sol";
import "@chainlink/contracts/src/v0.8/interfaces/VRFCoordinatorV2Interface.sol";
import "@chainlink/contracts/src/v0.8/VRFConsumerBaseV2.sol";

interface IJigsawToken {
    function getNumberOfTokenHolders() external view returns(uint256);
    function getTokenHolderAtIndex(uint256 accountIndex) external view returns(address);
    function balanceOf(address account) external view returns (uint256);
}
interface IPegSwap{
    function swap(uint256 amount, address source, address target) external;
    function getSwappableAmount(address source, address target) external view returns(uint);
}

contract JigsawDistributor is ReentrancyGuard, VRFConsumerBaseV2, Ownable {
    using SafeERC20 for IERC20;

    VRFCoordinatorV2Interface COORDINATOR;
    LinkTokenInterface LINKTOKEN;

    bool public initialized = false;
    IJigsawToken public jigsawToken;

    uint64 public s_subscriptionId;

    bytes32 keyHash;
    uint32 callbackGasLimit = 150000;
    uint16 requestConfirmations = 3;
    uint32 numWords =  3;

    uint256 public s_requestId;
    uint256 public r_requestId;
    uint256[] public s_randomWords;

    struct TheOfferingResult {
        address[3] winner;
        uint256[3] amount;
    }
    uint256 public theOfferingID;
    uint256 public theOfferingRate = 2500;
    uint256[3] public theOfferingHolderRates = [6000, 2500, 1000];
    mapping(uint256 => TheOfferingResult) private theOfferingResults;
    uint256 public winnerBalanceLimit = 20000 * 1 ether;

    mapping(address => bool) private isWinner;
    address[] private winnerList;
    uint256 public oneTimeResetCount = 1000;

    address[3] public wallets;
    uint256[3] public rates = [2500, 2000, 2500];
    
    // BSC Mainnet ERC20_LINK_ADDRESS
    address public constant ERC20_LINK_ADDRESS = 0x53E0bca35eC356BD5ddDFebbD1Fc0fD03FaBad39;
    address public constant PEGSWAP_ADDRESS = 0xF8A0BF9cF54Bb92F17374d9e9A321E6a111a51bD;

    event SetDistributors(address walletA, address walletB, address walletC);
    event SetDistributorRates(uint256 rateA, uint256 rateB, uint256 rateC);
    event SetTheOfferingRate(uint256 rate);
    event SetTheOfferingHolderRates(uint256 rateA, uint256 rateB, uint256 rateC);
    event SetWinnerBalanceLimit(uint256 amount);
    event Distributed(uint256 amountA, uint256 amountB, uint256 amountC);
    event HolderDistributed(uint256 triadID, address[3] winners, uint256[3] amounts);
    event SetOneTimeResetCount(uint256 num);
    event ResetWinnerList();

    /**
     * @notice Constructor
     * @dev RandomNumberGenerator must be deployed prior to this contract
     */
    constructor(address _vrfCoordinator, address _link, bytes32 _keyHash) VRFConsumerBaseV2(_vrfCoordinator) {
        COORDINATOR = VRFCoordinatorV2Interface(_vrfCoordinator);
        s_subscriptionId = COORDINATOR.createSubscription();
        keyHash = _keyHash;

        COORDINATOR.addConsumer(s_subscriptionId, address(this));
        LINKTOKEN = LinkTokenInterface(_link);
    }

    /**
     * @notice Initialize the contract
     * @dev This function must be called by the owner of the contract.
     */
    function initialize(address _token, address[3] memory _wallets) external onlyOwner {
        require(!initialized, "Contract already initialized");
        initialized = true;

        jigsawToken = IJigsawToken(_token);
        wallets = _wallets;
    }

    /**
     * @notice Distribute the ETH to the three distributors
     * @dev This function must be called by the owner of the contract.
     */
    function callDistributor() external onlyOwner {
        require(initialized, "Contract not initialized");

        uint256 amount = address(this).balance;
        require(amount > 3, "Not enough ETH to distribute");

        uint256 amountA = amount * rates[0] / 10000;
        uint256 amountB = amount * rates[1] / 10000;
        uint256 amountC = amount * rates[2] / 10000;
        payable(wallets[0]).transfer(amountA);
        payable(wallets[1]).transfer(amountB);
        payable(wallets[2]).transfer(amountC);

        emit Distributed(amountA, amountB, amountC);
    }

    /**
     * @notice Distribute the prizes to the three winners
     * @dev This function must be called by the owner of the contract.
     */
    function callTheOffering() external onlyOwner {
        require(initialized, "Contract not initialized");
        require(s_requestId == r_requestId, "Request IDs do not match");
        require(s_randomWords.length == numWords, "Number of words does not match");

        uint256 numHolders = jigsawToken.getNumberOfTokenHolders();
        require(numHolders > 3, "Not enough token holders");

        s_requestId = 0;
        
        uint256[3] memory idx;
        uint256[3] memory sortedIdx;
        for(uint i = 0; i < 3; i++) {
            idx[i] = s_randomWords[i] % (numHolders - i);
            for(uint j = 0; j < i; j++) {
                if (idx[i] >= sortedIdx[j]) {
                    idx[i] = idx[i] + 1;
                } else {
                    break;
                }
            }

            idx[i] = idx[i] % numHolders;
            sortedIdx[i] = idx[i];
            if(i > 0 && sortedIdx[i] < sortedIdx[i - 1]) {
                uint256 t = sortedIdx[i];
                sortedIdx[i] = sortedIdx[i - 1];
                sortedIdx[i - 1] = t;
            }
        }

        theOfferingID = theOfferingID + 1;        
        TheOfferingResult storage triadResult = theOfferingResults[theOfferingID];

        uint256 amount = address(this).balance;
        amount = amount * theOfferingRate / 10000;
        for(uint i = 0; i < 3; i++) {
            address winnerA = jigsawToken.getTokenHolderAtIndex(idx[i]);
            triadResult.winner[i] = winnerA;

            if(isWinner[winnerA]) continue;
            isWinner[winnerA] = true;
            winnerList.push(winnerA);

            if(isContract(winnerA)) continue;
            if(jigsawToken.balanceOf(winnerA) < winnerBalanceLimit) continue;

            uint256 amountA = amount * theOfferingHolderRates[i] / 10000;
            triadResult.amount[i] = amountA;
            payable(winnerA).transfer(amountA);
        }

        emit HolderDistributed(theOfferingID, triadResult.winner, triadResult.amount);
    }

    function offeringResult(uint256 _id) external view returns(address[3] memory, uint256[3] memory) {
        return (theOfferingResults[_id].winner, theOfferingResults[_id].amount);
    }

    function totalWinners() external view returns(uint256) {
        return winnerList.length;
    }

    function resetWinnerList() external onlyOwner {
        uint count = winnerList.length;
        for(uint i = 0; i < count; i++) {
            if(i >= oneTimeResetCount) break;
            
            address winner = winnerList[winnerList.length - 1];
            isWinner[winner] = false;
            winnerList.pop();
        }

        emit ResetWinnerList();
    }

    function setOneTimeResetCount(uint256 num) external onlyOwner {
        oneTimeResetCount = num;
        emit SetOneTimeResetCount(num);
    }

    /**
     * @notice Set the distribution rates for the three wallets
     * @dev This function must be called by the owner of the contract.
     */
    function setDistributorRates(uint256 _rateA, uint256 _rateB, uint256 _rateC) external onlyOwner {        
        require(_rateA > 0, "Rate A must be greater than 0");
        require(_rateB > 0, "Rate B must be greater than 0");
        require(_rateC > 0, "Rate C must be greater than 0");
        require(_rateA + _rateB + _rateC < 10000, "Total rate must be less than 10000");

        rates = [_rateA, _rateB, _rateC];
        emit SetDistributorRates(_rateA, _rateB, _rateC);
    }

    /**
     * @notice Set the three wallets for the distribution
     * @dev This function must be called by the owner of the contract.
     */
    function setWallets(address[3] memory _wallets) external onlyOwner {
        require(initialized, "Contract not initialized");

        require(_wallets[0] != address(0), "Wallet A must be set");
        require(_wallets[1] != address(0), "Wallet B must be set");
        require(_wallets[2] != address(0), "Wallet C must be set");
        require(_wallets[0] != _wallets[1], "Wallet A and B must be different");
        require(_wallets[0] != _wallets[2], "Wallet A and C must be different");
        require(_wallets[1] != _wallets[2], "Wallet B and C must be different");

        wallets = _wallets;
        emit SetDistributors(wallets[0], wallets[1], wallets[2]);
    }

    /**
     * @notice Set the distribution rate for the three wallets
     * @dev This function must be called by the owner of the contract.
     */
    function setTheOfferingRate(uint256 _rate) external onlyOwner {
        require(_rate > 0, "Rate must be greater than 0");
        theOfferingRate = _rate;
        emit SetTheOfferingRate(_rate);
    }
    
    /**
     * @notice Set the minimum balance to receive ETH from call offering
     * @dev This function must be called by the owner of the contract.
     */
    function setWinnerBalanceLimit(uint256 _min) external onlyOwner {
        winnerBalanceLimit = _min * 1 ether;
        emit SetWinnerBalanceLimit(winnerBalanceLimit);
    }

    /**
     * @notice Set the distribution rates for three winners
     * @dev This function must be called by the owner of the contract.
     */
    function setTheOfferingHolderRates(uint256 _rateA, uint256 _rateB, uint256 _rateC) external onlyOwner {
        require(_rateA > 0, "Rate A must be greater than 0");
        require(_rateB > 0, "Rate B must be greater than 0");
        require(_rateC > 0, "Rate C must be greater than 0");
        require(_rateA + _rateB + _rateC < 10000, "Total rate must be less than 10000");

        theOfferingHolderRates = [_rateA, _rateB, _rateC];
        emit SetTheOfferingHolderRates(_rateA, _rateB, _rateC);
    }

    function setCoordiatorConfig(bytes32 _keyHash, uint32 _gasLimit, uint32 _numWords ) external onlyOwner {
        keyHash = _keyHash;
        callbackGasLimit = _gasLimit;
        numWords = _numWords;
    }

    /**
     * @notice fetch subscription information from the VRF coordinator
     */
    function getSubscriptionInfo() external view returns (uint96 balance, uint64 reqCount, address owner, address[] memory consumers) {
        return COORDINATOR.getSubscription(s_subscriptionId);
    }

    /**
     * @notice cancle subscription from the VRF coordinator
     * @dev This function must be called by the owner of the contract.
     */
    function cancelSubscription() external onlyOwner {
        COORDINATOR.cancelSubscription(s_subscriptionId, msg.sender);
        s_subscriptionId = 0;
    }

    /**
     * @notice subscribe to the VRF coordinator
     * @dev This function must be called by the owner of the contract.
     */
    function startSubscription(address _vrfCoordinator) external onlyOwner {
        require(s_subscriptionId == 0, "Subscription already started");

        COORDINATOR = VRFCoordinatorV2Interface(_vrfCoordinator);
        s_subscriptionId = COORDINATOR.createSubscription();
        COORDINATOR.addConsumer(s_subscriptionId, address(this));
    }

    /**
     * @notice Fund link token from the VRF coordinator for subscription
     * @dev This function must be called by the owner of the contract.
     */
    function fundToCoordiator(uint96 _amount) external onlyOwner {
        LINKTOKEN.transferFrom(msg.sender, address(this), _amount);
        LINKTOKEN.transferAndCall(
            address(COORDINATOR),
            _amount,
            abi.encode(s_subscriptionId)
        );
    }

    /**
     * @notice Fund link token from the VRF coordinator for subscription
     * @dev This function must be called by the owner of the contract.
     */
    function fundPeggedLinkToCoordiator(uint256 _amount) external onlyOwner {
        IERC20(ERC20_LINK_ADDRESS).transferFrom(msg.sender, address(this), _amount);
        IERC20(ERC20_LINK_ADDRESS).approve(PEGSWAP_ADDRESS, _amount);
        IPegSwap(PEGSWAP_ADDRESS).swap(_amount, ERC20_LINK_ADDRESS, address(LINKTOKEN));
        
        uint256 tokenBal = LINKTOKEN.balanceOf(address(this));
        LINKTOKEN.transferAndCall(
            address(COORDINATOR),
            tokenBal,
            abi.encode(s_subscriptionId)
        );
    }

    /**
     * @notice Request random words from the VRF coordinator
     * @dev This function must be called by the owner of the contract.
     */
    function requestRandomWords() external onlyOwner {
        r_requestId = 0;
        // Will revert if subscription is not set and funded.
        s_requestId = COORDINATOR.requestRandomWords(
            keyHash,
            s_subscriptionId,
            requestConfirmations,
            callbackGasLimit,
            numWords
        );
    }

    function fulfillRandomWords(uint256 requestId, uint256[] memory randomWords) internal override {
        r_requestId = requestId;
        s_randomWords = randomWords;
    }

    
    function emergencyWithdrawETH() external onlyOwner {
        uint256 _tokenAmount = address(this).balance;
        payable(msg.sender).transfer(_tokenAmount);
    }

    /**
     * @notice It allows the admin to recover wrong tokens sent to the contract
     * @param _token: the address of the token to withdraw
     * @dev This function is only callable by admin.
     */
    function emergencyWithdrawToken(address _token) external onlyOwner {
        uint256 _tokenAmount = IERC20(_token).balanceOf(address(this));
        IERC20(_token).safeTransfer(msg.sender, _tokenAmount);
    }

    function isContract(address _addr) internal view returns (bool) {
        uint256 size;
        assembly { size := extcodesize(_addr) }
        return size > 0;
    }

    receive() external payable {}
}

File 2 of 10 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)

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() {
        _transferOwnership(_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 {
        _transferOwnership(address(0));
    }

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

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

File 3 of 10 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;

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

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

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        // On the first call to nonReentrant, _notEntered will be true
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

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

        _;

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

File 4 of 10 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/IERC20.sol)

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 5 of 10 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../../../utils/Address.sol";

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

    function safeTransfer(
        IERC20 token,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    function safeTransferFrom(
        IERC20 token,
        address from,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

    /**
     * @dev Deprecated. This function has issues similar to the ones found in
     * {IERC20-approve}, and its usage is discouraged.
     *
     * Whenever possible, use {safeIncreaseAllowance} and
     * {safeDecreaseAllowance} instead.
     */
    function safeApprove(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        // safeApprove should only be called when setting an initial allowance,
        // or when resetting it to zero. To increase and decrease it, use
        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
        require(
            (value == 0) || (token.allowance(address(this), spender) == 0),
            "SafeERC20: approve from non-zero to non-zero allowance"
        );
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
    }

    function safeIncreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        uint256 newAllowance = token.allowance(address(this), spender) + value;
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    function safeDecreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            uint256 newAllowance = oldAllowance - value;
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
        }
    }

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

        bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
        if (returndata.length > 0) {
            // Return data is optional
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}

File 6 of 10 : 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 7 of 10 : VRFCoordinatorV2Interface.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface VRFCoordinatorV2Interface {
  /**
   * @notice Get configuration relevant for making requests
   * @return minimumRequestConfirmations global min for request confirmations
   * @return maxGasLimit global max for request gas limit
   * @return s_provingKeyHashes list of registered key hashes
   */
  function getRequestConfig()
    external
    view
    returns (
      uint16,
      uint32,
      bytes32[] memory
    );

  /**
   * @notice Request a set of random words.
   * @param keyHash - Corresponds to a particular oracle job which uses
   * that key for generating the VRF proof. Different keyHash's have different gas price
   * ceilings, so you can select a specific one to bound your maximum per request cost.
   * @param subId  - The ID of the VRF subscription. Must be funded
   * with the minimum subscription balance required for the selected keyHash.
   * @param minimumRequestConfirmations - How many blocks you'd like the
   * oracle to wait before responding to the request. See SECURITY CONSIDERATIONS
   * for why you may want to request more. The acceptable range is
   * [minimumRequestBlockConfirmations, 200].
   * @param callbackGasLimit - How much gas you'd like to receive in your
   * fulfillRandomWords callback. Note that gasleft() inside fulfillRandomWords
   * may be slightly less than this amount because of gas used calling the function
   * (argument decoding etc.), so you may need to request slightly more than you expect
   * to have inside fulfillRandomWords. The acceptable range is
   * [0, maxGasLimit]
   * @param numWords - The number of uint256 random values you'd like to receive
   * in your fulfillRandomWords callback. Note these numbers are expanded in a
   * secure way by the VRFCoordinator from a single random value supplied by the oracle.
   * @return requestId - A unique identifier of the request. Can be used to match
   * a request to a response in fulfillRandomWords.
   */
  function requestRandomWords(
    bytes32 keyHash,
    uint64 subId,
    uint16 minimumRequestConfirmations,
    uint32 callbackGasLimit,
    uint32 numWords
  ) external returns (uint256 requestId);

  /**
   * @notice Create a VRF subscription.
   * @return subId - A unique subscription id.
   * @dev You can manage the consumer set dynamically with addConsumer/removeConsumer.
   * @dev Note to fund the subscription, use transferAndCall. For example
   * @dev  LINKTOKEN.transferAndCall(
   * @dev    address(COORDINATOR),
   * @dev    amount,
   * @dev    abi.encode(subId));
   */
  function createSubscription() external returns (uint64 subId);

  /**
   * @notice Get a VRF subscription.
   * @param subId - ID of the subscription
   * @return balance - LINK balance of the subscription in juels.
   * @return reqCount - number of requests for this subscription, determines fee tier.
   * @return owner - owner of the subscription.
   * @return consumers - list of consumer address which are able to use this subscription.
   */
  function getSubscription(uint64 subId)
    external
    view
    returns (
      uint96 balance,
      uint64 reqCount,
      address owner,
      address[] memory consumers
    );

  /**
   * @notice Request subscription owner transfer.
   * @param subId - ID of the subscription
   * @param newOwner - proposed new owner of the subscription
   */
  function requestSubscriptionOwnerTransfer(uint64 subId, address newOwner) external;

  /**
   * @notice Request subscription owner transfer.
   * @param subId - ID of the subscription
   * @dev will revert if original owner of subId has
   * not requested that msg.sender become the new owner.
   */
  function acceptSubscriptionOwnerTransfer(uint64 subId) external;

  /**
   * @notice Add a consumer to a VRF subscription.
   * @param subId - ID of the subscription
   * @param consumer - New consumer which can use the subscription
   */
  function addConsumer(uint64 subId, address consumer) external;

  /**
   * @notice Remove a consumer from a VRF subscription.
   * @param subId - ID of the subscription
   * @param consumer - Consumer to remove from the subscription
   */
  function removeConsumer(uint64 subId, address consumer) external;

  /**
   * @notice Cancel a subscription
   * @param subId - ID of the subscription
   * @param to - Where to send the remaining LINK to
   */
  function cancelSubscription(uint64 subId, address to) external;
}

File 8 of 10 : VRFConsumerBaseV2.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

/** ****************************************************************************
 * @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. It ensures 2 things:
 * @dev 1. The fulfillment came from the VRFCoordinator
 * @dev 2. The consumer contract implements fulfillRandomWords.
 * *****************************************************************************
 * @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     constructor(<other arguments>, address _vrfCoordinator, address _link)
 * @dev       VRFConsumerBase(_vrfCoordinator) 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). Create subscription, fund it
 * @dev and your consumer contract as a consumer of it (see VRFCoordinatorInterface
 * @dev subscription management functions).
 * @dev Call requestRandomWords(keyHash, subId, minimumRequestConfirmations,
 * @dev callbackGasLimit, numWords),
 * @dev see (VRFCoordinatorInterface for a description of the arguments).
 *
 * @dev Once the VRFCoordinator has received and validated the oracle's response
 * @dev to your request, it will call your contract's fulfillRandomWords method.
 *
 * @dev The randomness argument to fulfillRandomWords is a set of random words
 * @dev generated from your requestId and the blockHash of the request.
 *
 * @dev If your contract could have concurrent requests open, you can use the
 * @dev requestId returned from requestRandomWords to track which response is associated
 * @dev with which randomness request.
 * @dev 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.
 *
 * *****************************************************************************
 * @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 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. It is for this reason that
 * @dev that you can signal to an oracle you'd like them to wait longer before
 * @dev responding to the request (however this is not enforced in the contract
 * @dev and so remains effective only in the case of unmodified oracle software).
 */
abstract contract VRFConsumerBaseV2 {
  error OnlyCoordinatorCanFulfill(address have, address want);
  address private immutable vrfCoordinator;

  /**
   * @param _vrfCoordinator address of VRFCoordinator contract
   */
  constructor(address _vrfCoordinator) {
    vrfCoordinator = _vrfCoordinator;
  }

  /**
   * @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 VRFConsumerBaseV2 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 randomWords the VRF output expanded to the requested number of words
   */
  function fulfillRandomWords(uint256 requestId, uint256[] memory randomWords) internal virtual;

  // rawFulfillRandomness is called by VRFCoordinator when it receives a valid VRF
  // proof. rawFulfillRandomness then calls fulfillRandomness, after validating
  // the origin of the call
  function rawFulfillRandomWords(uint256 requestId, uint256[] memory randomWords) external {
    if (msg.sender != vrfCoordinator) {
      revert OnlyCoordinatorCanFulfill(msg.sender, vrfCoordinator);
    }
    fulfillRandomWords(requestId, randomWords);
  }
}

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

pragma solidity ^0.8.0;

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

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

File 10 of 10 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Address.sol)

pragma solidity ^0.8.0;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        assembly {
            size := extcodesize(account)
        }
        return size > 0;
    }

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

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

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

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

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

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

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

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

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        require(isContract(target), "Address: static call to non-contract");

        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

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

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(isContract(target), "Address: delegate call to non-contract");

        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_vrfCoordinator","type":"address"},{"internalType":"address","name":"_link","type":"address"},{"internalType":"bytes32","name":"_keyHash","type":"bytes32"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"have","type":"address"},{"internalType":"address","name":"want","type":"address"}],"name":"OnlyCoordinatorCanFulfill","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amountA","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountB","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountC","type":"uint256"}],"name":"Distributed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"triadID","type":"uint256"},{"indexed":false,"internalType":"address[3]","name":"winners","type":"address[3]"},{"indexed":false,"internalType":"uint256[3]","name":"amounts","type":"uint256[3]"}],"name":"HolderDistributed","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":[],"name":"ResetWinnerList","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"rateA","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"rateB","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"rateC","type":"uint256"}],"name":"SetDistributorRates","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"walletA","type":"address"},{"indexed":false,"internalType":"address","name":"walletB","type":"address"},{"indexed":false,"internalType":"address","name":"walletC","type":"address"}],"name":"SetDistributors","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"num","type":"uint256"}],"name":"SetOneTimeResetCount","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"rateA","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"rateB","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"rateC","type":"uint256"}],"name":"SetTheOfferingHolderRates","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"rate","type":"uint256"}],"name":"SetTheOfferingRate","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"SetWinnerBalanceLimit","type":"event"},{"inputs":[],"name":"ERC20_LINK_ADDRESS","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PEGSWAP_ADDRESS","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"callDistributor","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"callTheOffering","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"cancelSubscription","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"emergencyWithdrawETH","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"emergencyWithdrawToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"fundPeggedLinkToCoordiator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint96","name":"_amount","type":"uint96"}],"name":"fundToCoordiator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getSubscriptionInfo","outputs":[{"internalType":"uint96","name":"balance","type":"uint96"},{"internalType":"uint64","name":"reqCount","type":"uint64"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"address[]","name":"consumers","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"address[3]","name":"_wallets","type":"address[3]"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"initialized","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"jigsawToken","outputs":[{"internalType":"contract IJigsawToken","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_id","type":"uint256"}],"name":"offeringResult","outputs":[{"internalType":"address[3]","name":"","type":"address[3]"},{"internalType":"uint256[3]","name":"","type":"uint256[3]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"oneTimeResetCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"r_requestId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"rates","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"requestId","type":"uint256"},{"internalType":"uint256[]","name":"randomWords","type":"uint256[]"}],"name":"rawFulfillRandomWords","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"requestRandomWords","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"resetWinnerList","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"s_randomWords","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"s_requestId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"s_subscriptionId","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_keyHash","type":"bytes32"},{"internalType":"uint32","name":"_gasLimit","type":"uint32"},{"internalType":"uint32","name":"_numWords","type":"uint32"}],"name":"setCoordiatorConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_rateA","type":"uint256"},{"internalType":"uint256","name":"_rateB","type":"uint256"},{"internalType":"uint256","name":"_rateC","type":"uint256"}],"name":"setDistributorRates","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"num","type":"uint256"}],"name":"setOneTimeResetCount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_rateA","type":"uint256"},{"internalType":"uint256","name":"_rateB","type":"uint256"},{"internalType":"uint256","name":"_rateC","type":"uint256"}],"name":"setTheOfferingHolderRates","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_rate","type":"uint256"}],"name":"setTheOfferingRate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[3]","name":"_wallets","type":"address[3]"}],"name":"setWallets","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_min","type":"uint256"}],"name":"setWinnerBalanceLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_vrfCoordinator","type":"address"}],"name":"startSubscription","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"theOfferingHolderRates","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"theOfferingID","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"theOfferingRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalWinners","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"wallets","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"winnerBalanceLimit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]

6003805460ff60a01b19168155600680546001600160501b03191666030003000249f01790556109c4600b81905561010060405261177060a090815260c0919091526103e860e0526200005691600c919062000297565b5069043c33c19375648000006010556103e8601355604080516060810182526109c48082526107d06020830152918101919091526200009a90601790600362000297565b50348015620000a857600080fd5b506040516200376b3803806200376b833981016040819052620000cb9162000314565b6001600055606083901b6001600160601b031916608052620000ed3362000245565b600280546001600160a01b0319166001600160a01b0385169081179091556040805163288688f960e21b8152905163a21a23e4916004808201926020929091908290030181600087803b1580156200014457600080fd5b505af115801562000159573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200017f919062000354565b60048054600160a01b600160e01b031916600160a01b6001600160401b039384168102919091178083556005859055600254604051631cd0704360e21b815292909104909316918101919091523060248201526001600160a01b0390911690637341c10c90604401600060405180830381600087803b1580156200020257600080fd5b505af115801562000217573d6000803e3d6000fd5b5050600380546001600160a01b0319166001600160a01b039590951694909417909355506200038492505050565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b8260038101928215620002ce579160200282015b82811115620002ce578251829061ffff16905591602001919060010190620002ab565b50620002dc929150620002e0565b5090565b5b80821115620002dc5760008155600101620002e1565b80516001600160a01b03811681146200030f57600080fd5b919050565b60008060006060848603121562000329578283fd5b6200033484620002f7565b92506200034460208501620002f7565b9150604084015190509250925092565b60006020828403121562000366578081fd5b81516001600160401b03811681146200037d578182fd5b9392505050565b60805160601c6133c1620003aa600039600081816107fd015261083f01526133c16000f3fe60806040526004361061023f5760003560e01c80638ac000211161012e578063cdd2efd0116100ab578063edd6cc7c1161006f578063edd6cc7c14610681578063f08cad93146106a1578063f2fde38b146106c1578063f4481c16146106e1578063f6eaffc81461070157600080fd5b8063cdd2efd0146105f1578063dd418ae214610616578063e0c8628914610636578063e89e106a1461064b578063ea3c20401461066157600080fd5b8063a3577fd5116100f2578063a3577fd514610570578063a9d8e96814610586578063b1c2b3e4146105a6578063bcc941b6146105bc578063c4b1ea15146105d157600080fd5b80638ac00021146104be5780638da5cb5b146104fd5780638ef40ffd1461051257806390baea531461053a57806393a601351461055a57600080fd5b80635a4b4f10116101bc5780637ad71f72116101805780637ad71f7214610429578063803d00ba14610449578063845360171461046957806385d52d431461047e5780638621d2ed1461049e57600080fd5b80635a4b4f101461038a5780635f795b4d146103aa57806370e2ce86146103ca578063715018a6146103df57806376ce6b40146103f457600080fd5b806324e9edb01161020357806324e9edb0146102fc57806327681251146103115780633cb562f8146103275780635000a9b914610347578063514f76021461037557600080fd5b8063158ef93e1461024b57806317653f23146102815780631af03203146102a55780631fe543e3146102c757806322bd206e146102e757600080fd5b3661024657005b600080fd5b34801561025757600080fd5b5060035461026c90600160a01b900460ff1681565b60405190151581526020015b60405180910390f35b34801561028d57600080fd5b5061029760135481565b604051908152602001610278565b3480156102b157600080fd5b506102c56102c0366004612b98565b610721565b005b3480156102d357600080fd5b506102c56102e2366004612cab565b6107f2565b3480156102f357600080fd5b506102c5610876565b34801561030857600080fd5b506102c56109a4565b34801561031d57600080fd5b50610297600a5481565b34801561033357600080fd5b506102c5610342366004612c7b565b610a5e565b34801561035357600080fd5b50610367610362366004612c7b565b610b19565b604051610278929190612f40565b34801561038157600080fd5b506102c5610baf565b34801561039657600080fd5b506102976103a5366004612c7b565b6113f3565b3480156103b657600080fd5b506102c56103c5366004612d93565b61140a565b3480156103d657600080fd5b506102c5611585565b3480156103eb57600080fd5b506102c5611787565b34801561040057600080fd5b5061041c7353e0bca35ec356bd5dddfebbd1fc0fd03fabad3981565b6040516102789190612ec9565b34801561043557600080fd5b5061041c610444366004612c7b565b6117c2565b34801561045557600080fd5b506102c5610464366004612d4e565b6117e2565b34801561047557600080fd5b506102c5611916565b34801561048a57600080fd5b506102c5610499366004612c7b565b611974565b3480156104aa57600080fd5b5060045461041c906001600160a01b031681565b3480156104ca57600080fd5b506004546104e590600160a01b90046001600160401b031681565b6040516001600160401b039091168152602001610278565b34801561050957600080fd5b5061041c611cad565b34801561051e57600080fd5b5061041c73f8a0bf9cf54bb92f17374d9e9a321e6a111a51bd81565b34801561054657600080fd5b506102c5610555366004612d4e565b611cbc565b34801561056657600080fd5b5061029760105481565b34801561057c57600080fd5b50610297600b5481565b34801561059257600080fd5b506102c56105a1366004612b98565b611de7565b3480156105b257600080fd5b5061029760085481565b3480156105c857600080fd5b50601254610297565b3480156105dd57600080fd5b506102c56105ec366004612c40565b611f97565b3480156105fd57600080fd5b50610606611ffa565b6040516102789493929190613192565b34801561062257600080fd5b50610297610631366004612c7b565b6120a7565b34801561064257600080fd5b506102c56120b7565b34801561065757600080fd5b5061029760075481565b34801561066d57600080fd5b506102c561067c366004612c7b565b6121bb565b34801561068d57600080fd5b506102c561069c366004612bd0565b612231565b3480156106ad57600080fd5b506102c56106bc366004612c7b565b6122f8565b3480156106cd57600080fd5b506102c56106dc366004612b98565b61235c565b3480156106ed57600080fd5b506102c56106fc366004612c05565b6123fc565b34801561070d57600080fd5b5061029761071c366004612c7b565b6126d0565b3361072a611cad565b6001600160a01b0316146107595760405162461bcd60e51b815260040161075090613068565b60405180910390fd5b6040516370a0823160e01b81526000906001600160a01b038316906370a0823190610788903090600401612ec9565b60206040518083038186803b1580156107a057600080fd5b505afa1580156107b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107d89190612c93565b90506107ee6001600160a01b03831633836126f1565b5050565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461086c5760405163073e64fd60e21b81523360048201526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000166024820152604401610750565b6107ee8282612743565b3361087f611cad565b6001600160a01b0316146108a55760405162461bcd60e51b815260040161075090613068565b60125460005b818110156109775760135481106108c157610977565b60128054600091906108d5906001906132a9565b815481106108f357634e487b7160e01b600052603260045260246000fd5b60009182526020808320909101546001600160a01b031680835260119091526040909120805460ff1916905560128054919250908061094257634e487b7160e01b600052603160045260246000fd5b600082815260209020810160001990810180546001600160a01b0319169055019055508061096f816132f0565b9150506108ab565b506040517fd5f4f05fac2138e810a7a1049f89241456de85fb8c52c2c30dc146592739d61990600090a150565b336109ad611cad565b6001600160a01b0316146109d35760405162461bcd60e51b815260040161075090613068565b60025460048054604051630d7ae1d360e41b81526001600160a01b039093169263d7ae1d3092610a1692600160a01b90046001600160401b031691339101613170565b600060405180830381600087803b158015610a3057600080fd5b505af1158015610a44573d6000803e3d6000fd5b50506004805467ffffffffffffffff60a01b191690555050565b33610a67611cad565b6001600160a01b031614610a8d5760405162461bcd60e51b815260040161075090613068565b60008111610add5760405162461bcd60e51b815260206004820152601b60248201527f52617465206d7573742062652067726561746572207468616e203000000000006044820152606401610750565b600b8190556040518181527fbbd2bbef825c7b9ef34fa08f17fd7f48cf5c29a05ccfe52d2ce49f76e5b00a41906020015b60405180910390a150565b610b216129f9565b610b296129f9565b6000838152600f6020526040908190208151606081019283905290916003808401929184919082845b81546001600160a01b03168152600190910190602001808311610b5257505060408051606081019182905294965085935060039250905082845b815481526020019060010190808311610b8c575050505050905091509150915091565b33610bb8611cad565b6001600160a01b031614610bde5760405162461bcd60e51b815260040161075090613068565b600354600160a01b900460ff16610c075760405162461bcd60e51b8152600401610750906130d4565b60085460075414610c555760405162461bcd60e51b81526020600482015260186024820152770a4cae2eacae6e8409288e640c8de40dcdee840dac2e8c6d60431b6044820152606401610750565b600654600954600160301b90910463ffffffff1614610cb65760405162461bcd60e51b815260206004820152601e60248201527f4e756d626572206f6620776f72647320646f6573206e6f74206d6174636800006044820152606401610750565b6000600460009054906101000a90046001600160a01b03166001600160a01b03166309bbedde6040518163ffffffff1660e01b815260040160206040518083038186803b158015610d0657600080fd5b505afa158015610d1a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d3e9190612c93565b905060038111610d8b5760405162461bcd60e51b81526020600482015260186024820152774e6f7420656e6f75676820746f6b656e20686f6c6465727360401b6044820152606401610750565b6000600755610d986129f9565b610da06129f9565b60005b60038110156110a257610db681856132a9565b60098281548110610dd757634e487b7160e01b600052603260045260246000fd5b9060005260206000200154610dec919061330b565b838260038110610e0c57634e487b7160e01b600052603260045260246000fd5b602002015260005b81811015610edc57828160038110610e3c57634e487b7160e01b600052603260045260246000fd5b6020020151848360038110610e6157634e487b7160e01b600052603260045260246000fd5b602002015110610ec557838260038110610e8b57634e487b7160e01b600052603260045260246000fd5b6020020151610e9b90600161325e565b848360038110610ebb57634e487b7160e01b600052603260045260246000fd5b6020020152610eca565b610edc565b80610ed4816132f0565b915050610e14565b5083838260038110610efe57634e487b7160e01b600052603260045260246000fd5b6020020151610f0d919061330b565b838260038110610f2d57634e487b7160e01b600052603260045260246000fd5b6020020152828160038110610f5257634e487b7160e01b600052603260045260246000fd5b6020020151828260038110610f7757634e487b7160e01b600052603260045260246000fd5b60200201528015801590610fdc575081610f926001836132a9565b60038110610fb057634e487b7160e01b600052603260045260246000fd5b6020020151828260038110610fd557634e487b7160e01b600052603260045260246000fd5b6020020151105b1561109057600082826003811061100357634e487b7160e01b600052603260045260246000fd5b60200201519050826110166001846132a9565b6003811061103457634e487b7160e01b600052603260045260246000fd5b602002015183836003811061105957634e487b7160e01b600052603260045260246000fd5b6020020152808361106b6001856132a9565b6003811061108957634e487b7160e01b600052603260045260246000fd5b6020020152505b8061109a816132f0565b915050610da3565b50600a546110b190600161325e565b600a8190556000908152600f60205260409020600b544790612710906110d7908361328a565b6110e19190613276565b905060005b60038110156113ab576004546000906001600160a01b031663c8f7d11587846003811061112357634e487b7160e01b600052603260045260246000fd5b60200201516040518263ffffffff1660e01b815260040161114691815260200190565b60206040518083038186803b15801561115e57600080fd5b505afa158015611172573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111969190612bb4565b9050808483600381106111b957634e487b7160e01b600052603260045260246000fd5b0180546001600160a01b0319166001600160a01b03928316179055811660009081526011602052604090205460ff16156111f35750611399565b6001600160a01b0381166000818152601160205260408120805460ff191660019081179091556012805491820181559091527fbb8a6a4669ba250d26cd7a459eca9d215f8307e33aebe50379bc5a3617ec34440180546001600160a01b0319169091179055611262813b151590565b1561126d5750611399565b601054600480546040516370a0823160e01b81526001600160a01b03909116916370a082319161129f91869101612ec9565b60206040518083038186803b1580156112b757600080fd5b505afa1580156112cb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112ef9190612c93565b10156112fb5750611399565b6000612710600c846003811061132157634e487b7160e01b600052603260045260246000fd5b015461132d908661328a565b6113379190613276565b90508085600301846003811061135d57634e487b7160e01b600052603260045260246000fd5b01556040516001600160a01b0383169082156108fc029083906000818181858888f19350505050158015611395573d6000803e3d6000fd5b5050505b806113a3816132f0565b9150506110e6565b50600a546040517ff60d42537d8c91b054cdf2259dbc4355292892f0cf4b936e64a1025bfb62dcf8916113e49185906003820190613106565b60405180910390a15050505050565b600c816003811061140357600080fd5b0154905081565b33611413611cad565b6001600160a01b0316146114395760405162461bcd60e51b815260040161075090613068565b6003546040516323b872dd60e01b81523360048201523060248201526001600160601b03831660448201526001600160a01b03909116906323b872dd90606401602060405180830381600087803b15801561149357600080fd5b505af11580156114a7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114cb9190612c20565b5060035460025460045460408051600160a01b9092046001600160401b031660208301526001600160a01b0393841693634000aea09316918591016040516020818303038152906040526040518463ffffffff1660e01b815260040161153393929190612f0d565b602060405180830381600087803b15801561154d57600080fd5b505af1158015611561573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107ee9190612c20565b3361158e611cad565b6001600160a01b0316146115b45760405162461bcd60e51b815260040161075090613068565b600354600160a01b900460ff166115dd5760405162461bcd60e51b8152600401610750906130d4565b476003811161162e5760405162461bcd60e51b815260206004820152601c60248201527f4e6f7420656e6f7567682045544820746f2064697374726962757465000000006044820152606401610750565b60006127106017820154611642908461328a565b61164c9190613276565b90506000612710601760010154611663908561328a565b61166d9190613276565b90506000612710601760020154611684908661328a565b61168e9190613276565b6014546040519192506001600160a01b0316906108fc8515029085906000818181858888f193505050501580156116c9573d6000803e3d6000fd5b506015546040516001600160a01b03909116906108fc8415029084906000818181858888f19350505050158015611704573d6000803e3d6000fd5b506016546040516001600160a01b03909116906108fc8315029083906000818181858888f1935050505015801561173f573d6000803e3d6000fd5b5060408051848152602081018490529081018290527fc5d35a65af09b3042394b742529d10f7fbf9a37294d6b13e4d63d06f9909a15b9060600160405180910390a150505050565b33611790611cad565b6001600160a01b0316146117b65760405162461bcd60e51b815260040161075090613068565b6117c0600061275b565b565b601481600381106117d257600080fd5b01546001600160a01b0316905081565b336117eb611cad565b6001600160a01b0316146118115760405162461bcd60e51b815260040161075090613068565b600083116118315760405162461bcd60e51b81526004016107509061309d565b600082116118515760405162461bcd60e51b815260040161075090612fef565b600081116118715760405162461bcd60e51b815260040161075090612fb8565b6127108161187f848661325e565b611889919061325e565b106118a65760405162461bcd60e51b815260040161075090613026565b60408051606081018252848152602081018490529081018290526118ce90600c906003612a17565b5060408051848152602081018490529081018290527f8f34fcf76b26d358257fb187fbca8df01b92ed4a436dbde6f18eba04a7f030d7906060015b60405180910390a1505050565b3361191f611cad565b6001600160a01b0316146119455760405162461bcd60e51b815260040161075090613068565b6040514790339082156108fc029083906000818181858888f193505050501580156107ee573d6000803e3d6000fd5b3361197d611cad565b6001600160a01b0316146119a35760405162461bcd60e51b815260040161075090613068565b6040516323b872dd60e01b8152336004820152306024820152604481018290527353e0bca35ec356bd5dddfebbd1fc0fd03fabad39906323b872dd90606401602060405180830381600087803b1580156119fc57600080fd5b505af1158015611a10573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a349190612c20565b5060405163095ea7b360e01b815273f8a0bf9cf54bb92f17374d9e9a321e6a111a51bd6004820152602481018290527353e0bca35ec356bd5dddfebbd1fc0fd03fabad399063095ea7b390604401602060405180830381600087803b158015611a9c57600080fd5b505af1158015611ab0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ad49190612c20565b50600354604051632b7f092360e01b8152600481018390527353e0bca35ec356bd5dddfebbd1fc0fd03fabad3960248201526001600160a01b03909116604482015273f8a0bf9cf54bb92f17374d9e9a321e6a111a51bd90632b7f092390606401600060405180830381600087803b158015611b4f57600080fd5b505af1158015611b63573d6000803e3d6000fd5b50506003546040516370a0823160e01b8152600093506001600160a01b0390911691506370a0823190611b9a903090600401612ec9565b60206040518083038186803b158015611bb257600080fd5b505afa158015611bc6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bea9190612c93565b60035460025460045460408051600160a01b9092046001600160401b031660208301529394506001600160a01b0392831693634000aea093909216918591016040516020818303038152906040526040518463ffffffff1660e01b8152600401611c5693929190612edd565b602060405180830381600087803b158015611c7057600080fd5b505af1158015611c84573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ca89190612c20565b505050565b6001546001600160a01b031690565b33611cc5611cad565b6001600160a01b031614611ceb5760405162461bcd60e51b815260040161075090613068565b60008311611d0b5760405162461bcd60e51b81526004016107509061309d565b60008211611d2b5760405162461bcd60e51b815260040161075090612fef565b60008111611d4b5760405162461bcd60e51b815260040161075090612fb8565b61271081611d59848661325e565b611d63919061325e565b10611d805760405162461bcd60e51b815260040161075090613026565b6040805160608101825284815260208101849052908101829052611da8906017906003612a17565b5060408051848152602081018490529081018290527f14092e5675f77e5b73f9821af329446bab431477934da298b4572ab87281410a90606001611909565b33611df0611cad565b6001600160a01b031614611e165760405162461bcd60e51b815260040161075090613068565b600454600160a01b90046001600160401b031615611e765760405162461bcd60e51b815260206004820152601c60248201527f537562736372697074696f6e20616c72656164792073746172746564000000006044820152606401610750565b600280546001600160a01b0319166001600160a01b0383169081179091556040805163288688f960e21b8152905163a21a23e4916004808201926020929091908290030181600087803b158015611ecc57600080fd5b505af1158015611ee0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f049190612d79565b6004805467ffffffffffffffff60a01b1916600160a01b6001600160401b03938416810291909117808355600254604051631cd0704360e21b81526001600160a01b0390911694637341c10c94611f62949093041691309101613170565b600060405180830381600087803b158015611f7c57600080fd5b505af1158015611f90573d6000803e3d6000fd5b5050505050565b33611fa0611cad565b6001600160a01b031614611fc65760405162461bcd60e51b815260040161075090613068565b6005929092556006805463ffffffff938416600160301b0269ffffffff0000ffffffff199091169390921692909217179055565b6002546004805460405163523e3b4b60e11b8152600160a01b9091046001600160401b031691810191909152600091829182916060916001600160a01b039091169063a47c76969060240160006040518083038186803b15801561205d57600080fd5b505afa158015612071573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526120999190810190612daf565b935093509350935090919293565b6017816003811061140357600080fd5b336120c0611cad565b6001600160a01b0316146120e65760405162461bcd60e51b815260040161075090613068565b6000600855600254600554600480546006546040516305d3b1d360e41b815292830193909352600160a01b90046001600160401b03166024820152640100000000820461ffff16604482015263ffffffff8083166064830152600160301b90920490911660848201526001600160a01b0390911690635d3b1d309060a401602060405180830381600087803b15801561217e57600080fd5b505af1158015612192573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121b69190612c93565b600755565b336121c4611cad565b6001600160a01b0316146121ea5760405162461bcd60e51b815260040161075090613068565b6121fc81670de0b6b3a764000061328a565b60108190556040519081527fccb6af188ca15ee28e14e92df94f1f910b94982161f56b8e07bfe0e45a165c8c90602001610b0e565b3361223a611cad565b6001600160a01b0316146122605760405162461bcd60e51b815260040161075090613068565b600354600160a01b900460ff16156122ba5760405162461bcd60e51b815260206004820152601c60248201527f436f6e747261637420616c726561647920696e697469616c697a6564000000006044820152606401610750565b6003805460ff60a01b1916600160a01b178155600480546001600160a01b0385166001600160a01b0319909116179055611ca8906014908390612a55565b33612301611cad565b6001600160a01b0316146123275760405162461bcd60e51b815260040161075090613068565b60138190556040518181527fe7b491378608e641b122eb4e7d48a1ad1b2bfb6b089fde2426467e3dd88f6b2090602001610b0e565b33612365611cad565b6001600160a01b03161461238b5760405162461bcd60e51b815260040161075090613068565b6001600160a01b0381166123f05760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610750565b6123f98161275b565b50565b33612405611cad565b6001600160a01b03161461242b5760405162461bcd60e51b815260040161075090613068565b600354600160a01b900460ff166124545760405162461bcd60e51b8152600401610750906130d4565b80516001600160a01b03166124a25760405162461bcd60e51b815260206004820152601460248201527315d85b1b195d0810481b5d5cdd081899481cd95d60621b6044820152606401610750565b60208101516001600160a01b03166124f35760405162461bcd60e51b815260206004820152601460248201527315d85b1b195d0810881b5d5cdd081899481cd95d60621b6044820152606401610750565b60408101516001600160a01b03166125445760405162461bcd60e51b815260206004820152601460248201527315d85b1b195d0810c81b5d5cdd081899481cd95d60621b6044820152606401610750565b602081015181516001600160a01b03908116911614156125a65760405162461bcd60e51b815260206004820181905260248201527f57616c6c6574204120616e642042206d75737420626520646966666572656e746044820152606401610750565b604081015181516001600160a01b03908116911614156126085760405162461bcd60e51b815260206004820181905260248201527f57616c6c6574204120616e642043206d75737420626520646966666572656e746044820152606401610750565b604081015160208201516001600160a01b039081169116141561266d5760405162461bcd60e51b815260206004820181905260248201527f57616c6c6574204220616e642043206d75737420626520646966666572656e746044820152606401610750565b61267a6014826003612a55565b50601454601554601654604080516001600160a01b03948516815292841660208401529216918101919091527f9a9c0a3a146202b89616db292ac78d2c1829635727b072e4c797d1cbbad6eb4390606001610b0e565b600981815481106126e057600080fd5b600091825260209091200154905081565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052611ca89084906127ad565b60088290558051611ca8906009906020840190612a9d565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000612802826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661287f9092919063ffffffff16565b805190915015611ca857808060200190518101906128209190612c20565b611ca85760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610750565b606061288e8484600085612898565b90505b9392505050565b6060824710156128f95760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610750565b843b6129475760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610750565b600080866001600160a01b031685876040516129639190612ead565b60006040518083038185875af1925050503d80600081146129a0576040519150601f19603f3d011682016040523d82523d6000602084013e6129a5565b606091505b50915091506129b58282866129c0565b979650505050505050565b606083156129cf575081612891565b8251156129df5782518084602001fd5b8160405162461bcd60e51b81526004016107509190612fa5565b60405180606001604052806003906020820280368337509192915050565b8260038101928215612a45579160200282015b82811115612a45578251825591602001919060010190612a2a565b50612a51929150612ad7565b5090565b8260038101928215612a45579160200282015b82811115612a4557825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190612a68565b828054828255906000526020600020908101928215612a455791602002820182811115612a45578251825591602001919060010190612a2a565b5b80821115612a515760008155600101612ad8565b600082601f830112612afc578081fd5b604051606081018181106001600160401b0382111715612b1e57612b1e61334b565b604052808360608101861015612b32578384fd5b835b6003811015612b5d578135612b4881613361565b83526020928301929190910190600101612b34565b509195945050505050565b803563ffffffff81168114612b7c57600080fd5b919050565b80516001600160401b0381168114612b7c57600080fd5b600060208284031215612ba9578081fd5b813561289181613361565b600060208284031215612bc5578081fd5b815161289181613361565b60008060808385031215612be2578081fd5b8235612bed81613361565b9150612bfc8460208501612aec565b90509250929050565b600060608284031215612c16578081fd5b6128918383612aec565b600060208284031215612c31578081fd5b81518015158114612891578182fd5b600080600060608486031215612c54578081fd5b83359250612c6460208501612b68565b9150612c7260408501612b68565b90509250925092565b600060208284031215612c8c578081fd5b5035919050565b600060208284031215612ca4578081fd5b5051919050565b60008060408385031215612cbd578182fd5b823591506020808401356001600160401b03811115612cda578283fd5b8401601f81018613612cea578283fd5b8035612cfd612cf88261323b565b61320b565b80828252848201915084840189868560051b8701011115612d1c578687fd5b8694505b83851015612d3e578035835260019490940193918501918501612d20565b5080955050505050509250929050565b600080600060608486031215612d62578081fd5b505081359360208301359350604090920135919050565b600060208284031215612d8a578081fd5b61289182612b81565b600060208284031215612da4578081fd5b813561289181613376565b60008060008060808587031215612dc4578182fd5b8451612dcf81613376565b93506020612dde868201612b81565b93506040860151612dee81613361565b60608701519093506001600160401b03811115612e09578283fd5b8601601f81018813612e19578283fd5b8051612e27612cf88261323b565b8082825284820191508484018b868560051b8701011115612e46578687fd5b8694505b83851015612e71578051612e5d81613361565b835260019490940193918501918501612e4a565b50979a9699509497505050505050565b60008151808452612e998160208601602086016132c0565b601f01601f19169290920160200192915050565b60008251612ebf8184602087016132c0565b9190910192915050565b6001600160a01b0391909116815260200190565b60018060a01b0384168152826020820152606060408201526000612f046060830184612e81565b95945050505050565b6001600160a01b03841681526001600160601b0383166020820152606060408201819052600090612f0490830184612e81565b60c08101818460005b6003811015612f715781516001600160a01b0316835260209283019290910190600101612f49565b505050606082018360005b6003811015612f9b578151835260209283019290910190600101612f7c565b5050509392505050565b6020815260006128916020830184612e81565b6020808252601d908201527f526174652043206d7573742062652067726561746572207468616e2030000000604082015260600190565b6020808252601d908201527f526174652042206d7573742062652067726561746572207468616e2030000000604082015260600190565b60208082526022908201527f546f74616c2072617465206d757374206265206c657373207468616e20313030604082015261030360f41b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252601d908201527f526174652041206d7573742062652067726561746572207468616e2030000000604082015260600190565b60208082526018908201527710dbdb9d1c9858dd081b9bdd081a5b9a5d1a585b1a5e995960421b604082015260600190565b83815260e0810160208083018560005b600381101561313c5781546001600160a01b031683529183019160019182019101613116565b505050608083018460005b600381101561316457815483529183019160019182019101613147565b50505050949350505050565b6001600160401b039290921682526001600160a01b0316602082015260400190565b6000608082016001600160601b038716835260206001600160401b0387168185015260018060a01b0380871660408601526080606086015282865180855260a0870191508388019450855b818110156131fb5785518416835294840194918401916001016131dd565b50909a9950505050505050505050565b604051601f8201601f191681016001600160401b03811182821017156132335761323361334b565b604052919050565b60006001600160401b038211156132545761325461334b565b5060051b60200190565b600082198211156132715761327161331f565b500190565b60008261328557613285613335565b500490565b60008160001904831182151516156132a4576132a461331f565b500290565b6000828210156132bb576132bb61331f565b500390565b60005b838110156132db5781810151838201526020016132c3565b838111156132ea576000848401525b50505050565b60006000198214156133045761330461331f565b5060010190565b60008261331a5761331a613335565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146123f957600080fd5b6001600160601b03811681146123f957600080fdfea26469706673582212209ab35299532e30dd9979cab74b1e01e777e5f062cccc3a03bc7ab050de82881864736f6c63430008040033000000000000000000000000271682deb8c4e0901d1a1550ad2e64d568e69909000000000000000000000000514910771af9ca656af840dff83e8264ecf986caff8dedfbfa60af186cf3c830acbc32c05aae823045ae5ea7da1e45fbfaba4f92

Deployed Bytecode

0x60806040526004361061023f5760003560e01c80638ac000211161012e578063cdd2efd0116100ab578063edd6cc7c1161006f578063edd6cc7c14610681578063f08cad93146106a1578063f2fde38b146106c1578063f4481c16146106e1578063f6eaffc81461070157600080fd5b8063cdd2efd0146105f1578063dd418ae214610616578063e0c8628914610636578063e89e106a1461064b578063ea3c20401461066157600080fd5b8063a3577fd5116100f2578063a3577fd514610570578063a9d8e96814610586578063b1c2b3e4146105a6578063bcc941b6146105bc578063c4b1ea15146105d157600080fd5b80638ac00021146104be5780638da5cb5b146104fd5780638ef40ffd1461051257806390baea531461053a57806393a601351461055a57600080fd5b80635a4b4f10116101bc5780637ad71f72116101805780637ad71f7214610429578063803d00ba14610449578063845360171461046957806385d52d431461047e5780638621d2ed1461049e57600080fd5b80635a4b4f101461038a5780635f795b4d146103aa57806370e2ce86146103ca578063715018a6146103df57806376ce6b40146103f457600080fd5b806324e9edb01161020357806324e9edb0146102fc57806327681251146103115780633cb562f8146103275780635000a9b914610347578063514f76021461037557600080fd5b8063158ef93e1461024b57806317653f23146102815780631af03203146102a55780631fe543e3146102c757806322bd206e146102e757600080fd5b3661024657005b600080fd5b34801561025757600080fd5b5060035461026c90600160a01b900460ff1681565b60405190151581526020015b60405180910390f35b34801561028d57600080fd5b5061029760135481565b604051908152602001610278565b3480156102b157600080fd5b506102c56102c0366004612b98565b610721565b005b3480156102d357600080fd5b506102c56102e2366004612cab565b6107f2565b3480156102f357600080fd5b506102c5610876565b34801561030857600080fd5b506102c56109a4565b34801561031d57600080fd5b50610297600a5481565b34801561033357600080fd5b506102c5610342366004612c7b565b610a5e565b34801561035357600080fd5b50610367610362366004612c7b565b610b19565b604051610278929190612f40565b34801561038157600080fd5b506102c5610baf565b34801561039657600080fd5b506102976103a5366004612c7b565b6113f3565b3480156103b657600080fd5b506102c56103c5366004612d93565b61140a565b3480156103d657600080fd5b506102c5611585565b3480156103eb57600080fd5b506102c5611787565b34801561040057600080fd5b5061041c7353e0bca35ec356bd5dddfebbd1fc0fd03fabad3981565b6040516102789190612ec9565b34801561043557600080fd5b5061041c610444366004612c7b565b6117c2565b34801561045557600080fd5b506102c5610464366004612d4e565b6117e2565b34801561047557600080fd5b506102c5611916565b34801561048a57600080fd5b506102c5610499366004612c7b565b611974565b3480156104aa57600080fd5b5060045461041c906001600160a01b031681565b3480156104ca57600080fd5b506004546104e590600160a01b90046001600160401b031681565b6040516001600160401b039091168152602001610278565b34801561050957600080fd5b5061041c611cad565b34801561051e57600080fd5b5061041c73f8a0bf9cf54bb92f17374d9e9a321e6a111a51bd81565b34801561054657600080fd5b506102c5610555366004612d4e565b611cbc565b34801561056657600080fd5b5061029760105481565b34801561057c57600080fd5b50610297600b5481565b34801561059257600080fd5b506102c56105a1366004612b98565b611de7565b3480156105b257600080fd5b5061029760085481565b3480156105c857600080fd5b50601254610297565b3480156105dd57600080fd5b506102c56105ec366004612c40565b611f97565b3480156105fd57600080fd5b50610606611ffa565b6040516102789493929190613192565b34801561062257600080fd5b50610297610631366004612c7b565b6120a7565b34801561064257600080fd5b506102c56120b7565b34801561065757600080fd5b5061029760075481565b34801561066d57600080fd5b506102c561067c366004612c7b565b6121bb565b34801561068d57600080fd5b506102c561069c366004612bd0565b612231565b3480156106ad57600080fd5b506102c56106bc366004612c7b565b6122f8565b3480156106cd57600080fd5b506102c56106dc366004612b98565b61235c565b3480156106ed57600080fd5b506102c56106fc366004612c05565b6123fc565b34801561070d57600080fd5b5061029761071c366004612c7b565b6126d0565b3361072a611cad565b6001600160a01b0316146107595760405162461bcd60e51b815260040161075090613068565b60405180910390fd5b6040516370a0823160e01b81526000906001600160a01b038316906370a0823190610788903090600401612ec9565b60206040518083038186803b1580156107a057600080fd5b505afa1580156107b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107d89190612c93565b90506107ee6001600160a01b03831633836126f1565b5050565b336001600160a01b037f000000000000000000000000271682deb8c4e0901d1a1550ad2e64d568e69909161461086c5760405163073e64fd60e21b81523360048201526001600160a01b037f000000000000000000000000271682deb8c4e0901d1a1550ad2e64d568e69909166024820152604401610750565b6107ee8282612743565b3361087f611cad565b6001600160a01b0316146108a55760405162461bcd60e51b815260040161075090613068565b60125460005b818110156109775760135481106108c157610977565b60128054600091906108d5906001906132a9565b815481106108f357634e487b7160e01b600052603260045260246000fd5b60009182526020808320909101546001600160a01b031680835260119091526040909120805460ff1916905560128054919250908061094257634e487b7160e01b600052603160045260246000fd5b600082815260209020810160001990810180546001600160a01b0319169055019055508061096f816132f0565b9150506108ab565b506040517fd5f4f05fac2138e810a7a1049f89241456de85fb8c52c2c30dc146592739d61990600090a150565b336109ad611cad565b6001600160a01b0316146109d35760405162461bcd60e51b815260040161075090613068565b60025460048054604051630d7ae1d360e41b81526001600160a01b039093169263d7ae1d3092610a1692600160a01b90046001600160401b031691339101613170565b600060405180830381600087803b158015610a3057600080fd5b505af1158015610a44573d6000803e3d6000fd5b50506004805467ffffffffffffffff60a01b191690555050565b33610a67611cad565b6001600160a01b031614610a8d5760405162461bcd60e51b815260040161075090613068565b60008111610add5760405162461bcd60e51b815260206004820152601b60248201527f52617465206d7573742062652067726561746572207468616e203000000000006044820152606401610750565b600b8190556040518181527fbbd2bbef825c7b9ef34fa08f17fd7f48cf5c29a05ccfe52d2ce49f76e5b00a41906020015b60405180910390a150565b610b216129f9565b610b296129f9565b6000838152600f6020526040908190208151606081019283905290916003808401929184919082845b81546001600160a01b03168152600190910190602001808311610b5257505060408051606081019182905294965085935060039250905082845b815481526020019060010190808311610b8c575050505050905091509150915091565b33610bb8611cad565b6001600160a01b031614610bde5760405162461bcd60e51b815260040161075090613068565b600354600160a01b900460ff16610c075760405162461bcd60e51b8152600401610750906130d4565b60085460075414610c555760405162461bcd60e51b81526020600482015260186024820152770a4cae2eacae6e8409288e640c8de40dcdee840dac2e8c6d60431b6044820152606401610750565b600654600954600160301b90910463ffffffff1614610cb65760405162461bcd60e51b815260206004820152601e60248201527f4e756d626572206f6620776f72647320646f6573206e6f74206d6174636800006044820152606401610750565b6000600460009054906101000a90046001600160a01b03166001600160a01b03166309bbedde6040518163ffffffff1660e01b815260040160206040518083038186803b158015610d0657600080fd5b505afa158015610d1a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d3e9190612c93565b905060038111610d8b5760405162461bcd60e51b81526020600482015260186024820152774e6f7420656e6f75676820746f6b656e20686f6c6465727360401b6044820152606401610750565b6000600755610d986129f9565b610da06129f9565b60005b60038110156110a257610db681856132a9565b60098281548110610dd757634e487b7160e01b600052603260045260246000fd5b9060005260206000200154610dec919061330b565b838260038110610e0c57634e487b7160e01b600052603260045260246000fd5b602002015260005b81811015610edc57828160038110610e3c57634e487b7160e01b600052603260045260246000fd5b6020020151848360038110610e6157634e487b7160e01b600052603260045260246000fd5b602002015110610ec557838260038110610e8b57634e487b7160e01b600052603260045260246000fd5b6020020151610e9b90600161325e565b848360038110610ebb57634e487b7160e01b600052603260045260246000fd5b6020020152610eca565b610edc565b80610ed4816132f0565b915050610e14565b5083838260038110610efe57634e487b7160e01b600052603260045260246000fd5b6020020151610f0d919061330b565b838260038110610f2d57634e487b7160e01b600052603260045260246000fd5b6020020152828160038110610f5257634e487b7160e01b600052603260045260246000fd5b6020020151828260038110610f7757634e487b7160e01b600052603260045260246000fd5b60200201528015801590610fdc575081610f926001836132a9565b60038110610fb057634e487b7160e01b600052603260045260246000fd5b6020020151828260038110610fd557634e487b7160e01b600052603260045260246000fd5b6020020151105b1561109057600082826003811061100357634e487b7160e01b600052603260045260246000fd5b60200201519050826110166001846132a9565b6003811061103457634e487b7160e01b600052603260045260246000fd5b602002015183836003811061105957634e487b7160e01b600052603260045260246000fd5b6020020152808361106b6001856132a9565b6003811061108957634e487b7160e01b600052603260045260246000fd5b6020020152505b8061109a816132f0565b915050610da3565b50600a546110b190600161325e565b600a8190556000908152600f60205260409020600b544790612710906110d7908361328a565b6110e19190613276565b905060005b60038110156113ab576004546000906001600160a01b031663c8f7d11587846003811061112357634e487b7160e01b600052603260045260246000fd5b60200201516040518263ffffffff1660e01b815260040161114691815260200190565b60206040518083038186803b15801561115e57600080fd5b505afa158015611172573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111969190612bb4565b9050808483600381106111b957634e487b7160e01b600052603260045260246000fd5b0180546001600160a01b0319166001600160a01b03928316179055811660009081526011602052604090205460ff16156111f35750611399565b6001600160a01b0381166000818152601160205260408120805460ff191660019081179091556012805491820181559091527fbb8a6a4669ba250d26cd7a459eca9d215f8307e33aebe50379bc5a3617ec34440180546001600160a01b0319169091179055611262813b151590565b1561126d5750611399565b601054600480546040516370a0823160e01b81526001600160a01b03909116916370a082319161129f91869101612ec9565b60206040518083038186803b1580156112b757600080fd5b505afa1580156112cb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112ef9190612c93565b10156112fb5750611399565b6000612710600c846003811061132157634e487b7160e01b600052603260045260246000fd5b015461132d908661328a565b6113379190613276565b90508085600301846003811061135d57634e487b7160e01b600052603260045260246000fd5b01556040516001600160a01b0383169082156108fc029083906000818181858888f19350505050158015611395573d6000803e3d6000fd5b5050505b806113a3816132f0565b9150506110e6565b50600a546040517ff60d42537d8c91b054cdf2259dbc4355292892f0cf4b936e64a1025bfb62dcf8916113e49185906003820190613106565b60405180910390a15050505050565b600c816003811061140357600080fd5b0154905081565b33611413611cad565b6001600160a01b0316146114395760405162461bcd60e51b815260040161075090613068565b6003546040516323b872dd60e01b81523360048201523060248201526001600160601b03831660448201526001600160a01b03909116906323b872dd90606401602060405180830381600087803b15801561149357600080fd5b505af11580156114a7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114cb9190612c20565b5060035460025460045460408051600160a01b9092046001600160401b031660208301526001600160a01b0393841693634000aea09316918591016040516020818303038152906040526040518463ffffffff1660e01b815260040161153393929190612f0d565b602060405180830381600087803b15801561154d57600080fd5b505af1158015611561573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107ee9190612c20565b3361158e611cad565b6001600160a01b0316146115b45760405162461bcd60e51b815260040161075090613068565b600354600160a01b900460ff166115dd5760405162461bcd60e51b8152600401610750906130d4565b476003811161162e5760405162461bcd60e51b815260206004820152601c60248201527f4e6f7420656e6f7567682045544820746f2064697374726962757465000000006044820152606401610750565b60006127106017820154611642908461328a565b61164c9190613276565b90506000612710601760010154611663908561328a565b61166d9190613276565b90506000612710601760020154611684908661328a565b61168e9190613276565b6014546040519192506001600160a01b0316906108fc8515029085906000818181858888f193505050501580156116c9573d6000803e3d6000fd5b506015546040516001600160a01b03909116906108fc8415029084906000818181858888f19350505050158015611704573d6000803e3d6000fd5b506016546040516001600160a01b03909116906108fc8315029083906000818181858888f1935050505015801561173f573d6000803e3d6000fd5b5060408051848152602081018490529081018290527fc5d35a65af09b3042394b742529d10f7fbf9a37294d6b13e4d63d06f9909a15b9060600160405180910390a150505050565b33611790611cad565b6001600160a01b0316146117b65760405162461bcd60e51b815260040161075090613068565b6117c0600061275b565b565b601481600381106117d257600080fd5b01546001600160a01b0316905081565b336117eb611cad565b6001600160a01b0316146118115760405162461bcd60e51b815260040161075090613068565b600083116118315760405162461bcd60e51b81526004016107509061309d565b600082116118515760405162461bcd60e51b815260040161075090612fef565b600081116118715760405162461bcd60e51b815260040161075090612fb8565b6127108161187f848661325e565b611889919061325e565b106118a65760405162461bcd60e51b815260040161075090613026565b60408051606081018252848152602081018490529081018290526118ce90600c906003612a17565b5060408051848152602081018490529081018290527f8f34fcf76b26d358257fb187fbca8df01b92ed4a436dbde6f18eba04a7f030d7906060015b60405180910390a1505050565b3361191f611cad565b6001600160a01b0316146119455760405162461bcd60e51b815260040161075090613068565b6040514790339082156108fc029083906000818181858888f193505050501580156107ee573d6000803e3d6000fd5b3361197d611cad565b6001600160a01b0316146119a35760405162461bcd60e51b815260040161075090613068565b6040516323b872dd60e01b8152336004820152306024820152604481018290527353e0bca35ec356bd5dddfebbd1fc0fd03fabad39906323b872dd90606401602060405180830381600087803b1580156119fc57600080fd5b505af1158015611a10573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a349190612c20565b5060405163095ea7b360e01b815273f8a0bf9cf54bb92f17374d9e9a321e6a111a51bd6004820152602481018290527353e0bca35ec356bd5dddfebbd1fc0fd03fabad399063095ea7b390604401602060405180830381600087803b158015611a9c57600080fd5b505af1158015611ab0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ad49190612c20565b50600354604051632b7f092360e01b8152600481018390527353e0bca35ec356bd5dddfebbd1fc0fd03fabad3960248201526001600160a01b03909116604482015273f8a0bf9cf54bb92f17374d9e9a321e6a111a51bd90632b7f092390606401600060405180830381600087803b158015611b4f57600080fd5b505af1158015611b63573d6000803e3d6000fd5b50506003546040516370a0823160e01b8152600093506001600160a01b0390911691506370a0823190611b9a903090600401612ec9565b60206040518083038186803b158015611bb257600080fd5b505afa158015611bc6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bea9190612c93565b60035460025460045460408051600160a01b9092046001600160401b031660208301529394506001600160a01b0392831693634000aea093909216918591016040516020818303038152906040526040518463ffffffff1660e01b8152600401611c5693929190612edd565b602060405180830381600087803b158015611c7057600080fd5b505af1158015611c84573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ca89190612c20565b505050565b6001546001600160a01b031690565b33611cc5611cad565b6001600160a01b031614611ceb5760405162461bcd60e51b815260040161075090613068565b60008311611d0b5760405162461bcd60e51b81526004016107509061309d565b60008211611d2b5760405162461bcd60e51b815260040161075090612fef565b60008111611d4b5760405162461bcd60e51b815260040161075090612fb8565b61271081611d59848661325e565b611d63919061325e565b10611d805760405162461bcd60e51b815260040161075090613026565b6040805160608101825284815260208101849052908101829052611da8906017906003612a17565b5060408051848152602081018490529081018290527f14092e5675f77e5b73f9821af329446bab431477934da298b4572ab87281410a90606001611909565b33611df0611cad565b6001600160a01b031614611e165760405162461bcd60e51b815260040161075090613068565b600454600160a01b90046001600160401b031615611e765760405162461bcd60e51b815260206004820152601c60248201527f537562736372697074696f6e20616c72656164792073746172746564000000006044820152606401610750565b600280546001600160a01b0319166001600160a01b0383169081179091556040805163288688f960e21b8152905163a21a23e4916004808201926020929091908290030181600087803b158015611ecc57600080fd5b505af1158015611ee0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f049190612d79565b6004805467ffffffffffffffff60a01b1916600160a01b6001600160401b03938416810291909117808355600254604051631cd0704360e21b81526001600160a01b0390911694637341c10c94611f62949093041691309101613170565b600060405180830381600087803b158015611f7c57600080fd5b505af1158015611f90573d6000803e3d6000fd5b5050505050565b33611fa0611cad565b6001600160a01b031614611fc65760405162461bcd60e51b815260040161075090613068565b6005929092556006805463ffffffff938416600160301b0269ffffffff0000ffffffff199091169390921692909217179055565b6002546004805460405163523e3b4b60e11b8152600160a01b9091046001600160401b031691810191909152600091829182916060916001600160a01b039091169063a47c76969060240160006040518083038186803b15801561205d57600080fd5b505afa158015612071573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526120999190810190612daf565b935093509350935090919293565b6017816003811061140357600080fd5b336120c0611cad565b6001600160a01b0316146120e65760405162461bcd60e51b815260040161075090613068565b6000600855600254600554600480546006546040516305d3b1d360e41b815292830193909352600160a01b90046001600160401b03166024820152640100000000820461ffff16604482015263ffffffff8083166064830152600160301b90920490911660848201526001600160a01b0390911690635d3b1d309060a401602060405180830381600087803b15801561217e57600080fd5b505af1158015612192573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121b69190612c93565b600755565b336121c4611cad565b6001600160a01b0316146121ea5760405162461bcd60e51b815260040161075090613068565b6121fc81670de0b6b3a764000061328a565b60108190556040519081527fccb6af188ca15ee28e14e92df94f1f910b94982161f56b8e07bfe0e45a165c8c90602001610b0e565b3361223a611cad565b6001600160a01b0316146122605760405162461bcd60e51b815260040161075090613068565b600354600160a01b900460ff16156122ba5760405162461bcd60e51b815260206004820152601c60248201527f436f6e747261637420616c726561647920696e697469616c697a6564000000006044820152606401610750565b6003805460ff60a01b1916600160a01b178155600480546001600160a01b0385166001600160a01b0319909116179055611ca8906014908390612a55565b33612301611cad565b6001600160a01b0316146123275760405162461bcd60e51b815260040161075090613068565b60138190556040518181527fe7b491378608e641b122eb4e7d48a1ad1b2bfb6b089fde2426467e3dd88f6b2090602001610b0e565b33612365611cad565b6001600160a01b03161461238b5760405162461bcd60e51b815260040161075090613068565b6001600160a01b0381166123f05760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610750565b6123f98161275b565b50565b33612405611cad565b6001600160a01b03161461242b5760405162461bcd60e51b815260040161075090613068565b600354600160a01b900460ff166124545760405162461bcd60e51b8152600401610750906130d4565b80516001600160a01b03166124a25760405162461bcd60e51b815260206004820152601460248201527315d85b1b195d0810481b5d5cdd081899481cd95d60621b6044820152606401610750565b60208101516001600160a01b03166124f35760405162461bcd60e51b815260206004820152601460248201527315d85b1b195d0810881b5d5cdd081899481cd95d60621b6044820152606401610750565b60408101516001600160a01b03166125445760405162461bcd60e51b815260206004820152601460248201527315d85b1b195d0810c81b5d5cdd081899481cd95d60621b6044820152606401610750565b602081015181516001600160a01b03908116911614156125a65760405162461bcd60e51b815260206004820181905260248201527f57616c6c6574204120616e642042206d75737420626520646966666572656e746044820152606401610750565b604081015181516001600160a01b03908116911614156126085760405162461bcd60e51b815260206004820181905260248201527f57616c6c6574204120616e642043206d75737420626520646966666572656e746044820152606401610750565b604081015160208201516001600160a01b039081169116141561266d5760405162461bcd60e51b815260206004820181905260248201527f57616c6c6574204220616e642043206d75737420626520646966666572656e746044820152606401610750565b61267a6014826003612a55565b50601454601554601654604080516001600160a01b03948516815292841660208401529216918101919091527f9a9c0a3a146202b89616db292ac78d2c1829635727b072e4c797d1cbbad6eb4390606001610b0e565b600981815481106126e057600080fd5b600091825260209091200154905081565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052611ca89084906127ad565b60088290558051611ca8906009906020840190612a9d565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000612802826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661287f9092919063ffffffff16565b805190915015611ca857808060200190518101906128209190612c20565b611ca85760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610750565b606061288e8484600085612898565b90505b9392505050565b6060824710156128f95760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610750565b843b6129475760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610750565b600080866001600160a01b031685876040516129639190612ead565b60006040518083038185875af1925050503d80600081146129a0576040519150601f19603f3d011682016040523d82523d6000602084013e6129a5565b606091505b50915091506129b58282866129c0565b979650505050505050565b606083156129cf575081612891565b8251156129df5782518084602001fd5b8160405162461bcd60e51b81526004016107509190612fa5565b60405180606001604052806003906020820280368337509192915050565b8260038101928215612a45579160200282015b82811115612a45578251825591602001919060010190612a2a565b50612a51929150612ad7565b5090565b8260038101928215612a45579160200282015b82811115612a4557825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190612a68565b828054828255906000526020600020908101928215612a455791602002820182811115612a45578251825591602001919060010190612a2a565b5b80821115612a515760008155600101612ad8565b600082601f830112612afc578081fd5b604051606081018181106001600160401b0382111715612b1e57612b1e61334b565b604052808360608101861015612b32578384fd5b835b6003811015612b5d578135612b4881613361565b83526020928301929190910190600101612b34565b509195945050505050565b803563ffffffff81168114612b7c57600080fd5b919050565b80516001600160401b0381168114612b7c57600080fd5b600060208284031215612ba9578081fd5b813561289181613361565b600060208284031215612bc5578081fd5b815161289181613361565b60008060808385031215612be2578081fd5b8235612bed81613361565b9150612bfc8460208501612aec565b90509250929050565b600060608284031215612c16578081fd5b6128918383612aec565b600060208284031215612c31578081fd5b81518015158114612891578182fd5b600080600060608486031215612c54578081fd5b83359250612c6460208501612b68565b9150612c7260408501612b68565b90509250925092565b600060208284031215612c8c578081fd5b5035919050565b600060208284031215612ca4578081fd5b5051919050565b60008060408385031215612cbd578182fd5b823591506020808401356001600160401b03811115612cda578283fd5b8401601f81018613612cea578283fd5b8035612cfd612cf88261323b565b61320b565b80828252848201915084840189868560051b8701011115612d1c578687fd5b8694505b83851015612d3e578035835260019490940193918501918501612d20565b5080955050505050509250929050565b600080600060608486031215612d62578081fd5b505081359360208301359350604090920135919050565b600060208284031215612d8a578081fd5b61289182612b81565b600060208284031215612da4578081fd5b813561289181613376565b60008060008060808587031215612dc4578182fd5b8451612dcf81613376565b93506020612dde868201612b81565b93506040860151612dee81613361565b60608701519093506001600160401b03811115612e09578283fd5b8601601f81018813612e19578283fd5b8051612e27612cf88261323b565b8082825284820191508484018b868560051b8701011115612e46578687fd5b8694505b83851015612e71578051612e5d81613361565b835260019490940193918501918501612e4a565b50979a9699509497505050505050565b60008151808452612e998160208601602086016132c0565b601f01601f19169290920160200192915050565b60008251612ebf8184602087016132c0565b9190910192915050565b6001600160a01b0391909116815260200190565b60018060a01b0384168152826020820152606060408201526000612f046060830184612e81565b95945050505050565b6001600160a01b03841681526001600160601b0383166020820152606060408201819052600090612f0490830184612e81565b60c08101818460005b6003811015612f715781516001600160a01b0316835260209283019290910190600101612f49565b505050606082018360005b6003811015612f9b578151835260209283019290910190600101612f7c565b5050509392505050565b6020815260006128916020830184612e81565b6020808252601d908201527f526174652043206d7573742062652067726561746572207468616e2030000000604082015260600190565b6020808252601d908201527f526174652042206d7573742062652067726561746572207468616e2030000000604082015260600190565b60208082526022908201527f546f74616c2072617465206d757374206265206c657373207468616e20313030604082015261030360f41b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6020808252601d908201527f526174652041206d7573742062652067726561746572207468616e2030000000604082015260600190565b60208082526018908201527710dbdb9d1c9858dd081b9bdd081a5b9a5d1a585b1a5e995960421b604082015260600190565b83815260e0810160208083018560005b600381101561313c5781546001600160a01b031683529183019160019182019101613116565b505050608083018460005b600381101561316457815483529183019160019182019101613147565b50505050949350505050565b6001600160401b039290921682526001600160a01b0316602082015260400190565b6000608082016001600160601b038716835260206001600160401b0387168185015260018060a01b0380871660408601526080606086015282865180855260a0870191508388019450855b818110156131fb5785518416835294840194918401916001016131dd565b50909a9950505050505050505050565b604051601f8201601f191681016001600160401b03811182821017156132335761323361334b565b604052919050565b60006001600160401b038211156132545761325461334b565b5060051b60200190565b600082198211156132715761327161331f565b500190565b60008261328557613285613335565b500490565b60008160001904831182151516156132a4576132a461331f565b500290565b6000828210156132bb576132bb61331f565b500390565b60005b838110156132db5781810151838201526020016132c3565b838111156132ea576000848401525b50505050565b60006000198214156133045761330461331f565b5060010190565b60008261331a5761331a613335565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146123f957600080fd5b6001600160601b03811681146123f957600080fdfea26469706673582212209ab35299532e30dd9979cab74b1e01e777e5f062cccc3a03bc7ab050de82881864736f6c63430008040033

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

000000000000000000000000271682deb8c4e0901d1a1550ad2e64d568e69909000000000000000000000000514910771af9ca656af840dff83e8264ecf986caff8dedfbfa60af186cf3c830acbc32c05aae823045ae5ea7da1e45fbfaba4f92

-----Decoded View---------------
Arg [0] : _vrfCoordinator (address): 0x271682DEB8C4E0901D1a1550aD2e64D568E69909
Arg [1] : _link (address): 0x514910771AF9Ca656af840dff83E8264EcF986CA
Arg [2] : _keyHash (bytes32): 0xff8dedfbfa60af186cf3c830acbc32c05aae823045ae5ea7da1e45fbfaba4f92

-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 000000000000000000000000271682deb8c4e0901d1a1550ad2e64d568e69909
Arg [1] : 000000000000000000000000514910771af9ca656af840dff83e8264ecf986ca
Arg [2] : ff8dedfbfa60af186cf3c830acbc32c05aae823045ae5ea7da1e45fbfaba4f92


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

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

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