ETH Price: $2,669.14 (+10.11%)
Gas: 1 Gwei

Contract

0x1deEF1d1987258C91B27cDa42D5441352f9830e7
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Emergency Withdr...163400392023-01-05 10:37:23581 days ago1672915043IN
0x1deEF1d1...52f9830e7
0 ETH0.0030930416.99560648
Cancel Subscript...163393542023-01-05 8:19:35581 days ago1672906775IN
0x1deEF1d1...52f9830e7
0 ETH0.0019847618.40742717
Emergency Withdr...163315652023-01-04 6:14:59582 days ago1672812899IN
0x1deEF1d1...52f9830e7
0 ETH0.0004569715.01867184
Claim163202922023-01-02 16:29:59584 days ago1672676999IN
0x1deEF1d1...52f9830e7
0 ETH0.0026919517.42399995
Claim163170362023-01-02 5:35:47584 days ago1672637747IN
0x1deEF1d1...52f9830e7
0 ETH0.0019798612.98297028
Claim163064612022-12-31 18:13:23586 days ago1672510403IN
0x1deEF1d1...52f9830e7
0 ETH0.0024666416.17502541
Add Distributor163024262022-12-31 4:41:59587 days ago1672461719IN
0x1deEF1d1...52f9830e7
0.0008 ETH0.00696419.94920172
Claim163007362022-12-30 23:02:35587 days ago1672441355IN
0x1deEF1d1...52f9830e7
0 ETH0.0057018836.90613662
Claim163006242022-12-30 22:40:11587 days ago1672440011IN
0x1deEF1d1...52f9830e7
0 ETH0.0060123238.91545908
Claim163005662022-12-30 22:28:35587 days ago1672439315IN
0x1deEF1d1...52f9830e7
0 ETH0.0067460843.66480601
Claim163004872022-12-30 22:12:47587 days ago1672438367IN
0x1deEF1d1...52f9830e7
0 ETH0.0031778720.5691381
Claim163004822022-12-30 22:11:47587 days ago1672438307IN
0x1deEF1d1...52f9830e7
0 ETH0.0026552417.186357
Claim163004412022-12-30 22:03:35587 days ago1672437815IN
0x1deEF1d1...52f9830e7
0 ETH0.0029680319.21093756
Add Distributor163004392022-12-30 22:03:11587 days ago1672437791IN
0x1deEF1d1...52f9830e7
0.0008 ETH0.0066327118.0145302
Claim163004372022-12-30 22:02:47587 days ago1672437767IN
0x1deEF1d1...52f9830e7
0 ETH0.0028017418.13462886
Claim163004362022-12-30 22:02:35587 days ago1672437755IN
0x1deEF1d1...52f9830e7
0 ETH0.0029612519.16708613
Call Airdrop163004282022-12-30 22:00:59587 days ago1672437659IN
0x1deEF1d1...52f9830e7
0 ETH0.0050064421.6243206
Call Airdrop163004242022-12-30 22:00:11587 days ago1672437611IN
0x1deEF1d1...52f9830e7
0 ETH0.0053854519.13303005
Request Random W...163004092022-12-30 21:57:11587 days ago1672437431IN
0x1deEF1d1...52f9830e7
0 ETH0.0019201520.29436904
Request Random W...163004042022-12-30 21:56:11587 days ago1672437371IN
0x1deEF1d1...52f9830e7
0 ETH0.0019792120.40445636
Request Random W...163003992022-12-30 21:55:11587 days ago1672437311IN
0x1deEF1d1...52f9830e7
0 ETH0.0019929920.54650444
Add Distributor163003612022-12-30 21:47:35587 days ago1672436855IN
0x1deEF1d1...52f9830e7
0.0008 ETH0.0065373818.62041629
Add Distributor163003572022-12-30 21:46:47587 days ago1672436807IN
0x1deEF1d1...52f9830e7
0.0008 ETH0.0067511619.22932073
Add Distributor163002472022-12-30 21:24:47587 days ago1672435487IN
0x1deEF1d1...52f9830e7
0.0008 ETH0.0080748622.99962494
Claim163002362022-12-30 21:22:23587 days ago1672435343IN
0x1deEF1d1...52f9830e7
0 ETH0.0030542219.76884772
View all transactions

Latest 25 internal transactions (View All)

Advanced mode:
Parent Transaction Hash Block From To
163315652023-01-04 6:14:59582 days ago1672812899
0x1deEF1d1...52f9830e7
0.28546722 ETH
163288832023-01-03 21:15:59583 days ago1672780559
0x1deEF1d1...52f9830e7
0.10742107 ETH
163257382023-01-03 10:43:47583 days ago1672742627
0x1deEF1d1...52f9830e7
0.04862007 ETH
163214132023-01-02 20:15:23584 days ago1672690523
0x1deEF1d1...52f9830e7
0.03101059 ETH
163212712023-01-02 19:46:59584 days ago1672688819
0x1deEF1d1...52f9830e7
0.00521268 ETH
163202552023-01-02 16:22:23584 days ago1672676543
0x1deEF1d1...52f9830e7
0.00370115 ETH
163177732023-01-02 8:03:47584 days ago1672646627
0x1deEF1d1...52f9830e7
0.00382097 ETH
163173042023-01-02 6:29:35584 days ago1672640975
0x1deEF1d1...52f9830e7
0.01336914 ETH
163168452023-01-02 4:57:11585 days ago1672635431
0x1deEF1d1...52f9830e7
0.00723667 ETH
163147092023-01-01 21:49:23585 days ago1672609763
0x1deEF1d1...52f9830e7
0.00415242 ETH
163136012023-01-01 18:06:59585 days ago1672596419
0x1deEF1d1...52f9830e7
0.00154246 ETH
163091322023-01-01 3:09:23586 days ago1672542563
0x1deEF1d1...52f9830e7
0.00107836 ETH
163037522022-12-31 9:08:35586 days ago1672477715
0x1deEF1d1...52f9830e7
0.00722307 ETH
163024262022-12-31 4:41:59587 days ago1672461719
0x1deEF1d1...52f9830e7
0.0008 ETH
163020672022-12-31 3:29:35587 days ago1672457375
0x1deEF1d1...52f9830e7
0.0075949 ETH
163020452022-12-31 3:25:11587 days ago1672457111
0x1deEF1d1...52f9830e7
0.01736023 ETH
163004392022-12-30 22:03:11587 days ago1672437791
0x1deEF1d1...52f9830e7
0.0008 ETH
163004282022-12-30 22:00:59587 days ago1672437659
0x1deEF1d1...52f9830e7
0.02545356 ETH
163004282022-12-30 22:00:59587 days ago1672437659
0x1deEF1d1...52f9830e7
0.06363391 ETH
163004282022-12-30 22:00:59587 days ago1672437659
0x1deEF1d1...52f9830e7
0.1527214 ETH
163004242022-12-30 22:00:11587 days ago1672437611
0x1deEF1d1...52f9830e7
0.02545356 ETH
163004242022-12-30 22:00:11587 days ago1672437611
0x1deEF1d1...52f9830e7
0.06363391 ETH
163004242022-12-30 22:00:11587 days ago1672437611
0x1deEF1d1...52f9830e7
0.1527214 ETH
163003612022-12-30 21:47:35587 days ago1672436855
0x1deEF1d1...52f9830e7
0.0008 ETH
163003572022-12-30 21:46:47587 days ago1672436807
0x1deEF1d1...52f9830e7
0.0008 ETH
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
LuckyRooAirdrop

Compiler Version
v0.8.4+commit.c7e474f2

Optimization Enabled:
Yes with 100 runs

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

/**
 * @author Brewlabs
 * This 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";

import "../libs/IPriceOracle.sol";

interface IPegSwap{
    function swap(uint256 amount, address source, address target) external;
    function getSwappableAmount(address source, address target) external view returns(uint);
}

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

    VRFCoordinatorV2Interface COORDINATOR;
    LinkTokenInterface LINKTOKEN;

    bool public initialized = false;
    IERC20 public token;
    IPriceOracle private oracle;

    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 AirdropResult {
        address[3] winner;
        uint256[3] amount;
    }
    uint256 public currentID = 1;
    uint256 public distributeRate = 9500;
    uint256 public distributorLimit = 500 ether;
    uint256[3] public airdropRates = [6000, 2500, 1000];
    mapping(uint256 => AirdropResult) private results;
    uint256 public lastAirdropTime;

    struct DistributorInfo {
        uint256 amount;
        uint256 regAirdropID;
    }
    mapping(address => DistributorInfo) public userInfo;
    address[] public distributors;
    
    address public treasury = 0xE64812272f989c63907B002843973b302E85c023;
    uint256 public performanceFee = 0.0008 ether;
    
    // BSC Mainnet ERC20_LINK_ADDRESS
    address public constant ERC20_LINK_ADDRESS = 0xF8A0BF9cF54Bb92F17374d9e9A321E6a111a51bD;
    address public constant PEGSWAP_ADDRESS = 0x1FCc3B22955e76Ca48bF025f1A6993685975Bb9e;

    event AddDistributor(address user, uint256 amount);
    event Claim(address user, uint256 amount);
    event HolderDistributed(uint256 id, address[3] winners, uint256[3] amounts);
    event SetDistributorLimit(uint256 limit);
    event SetDistributorRates(uint256[3] rates);
    event ServiceInfoUpadted(address addr, uint256 fee);

    /**
     * @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 _oracle) external onlyOwner {
        require(!initialized, "Contract already initialized");
        initialized = true;

        token = IERC20(_token);
        oracle = IPriceOracle(_oracle);
    }

    function addDistributor() external payable nonReentrant {
        require(initialized, "Contract not initialized");
        require(!isContract(msg.sender), "contract cannot be distributor");

        DistributorInfo storage user = userInfo[msg.sender];
        require(user.regAirdropID < currentID, "already added");
        require(user.amount == 0, "claim previous stake first");

        _transferPerformanceFee();
        
        uint256 tokenPrice = oracle.getTokenPrice(address(token));
        uint256 tokenBal = token.balanceOf(msg.sender);
        uint256 amount = distributorLimit * 1 ether / tokenPrice;
        require(tokenPrice > 0, "LUCKY ROO price is missing");
        require(tokenBal >= amount, "insufficient holder balance");
        
        uint256 beforeAmt = token.balanceOf(address(this));
        token.safeTransferFrom(msg.sender, address(this), amount);
        uint256 realAmt = token.balanceOf(address(this)) - beforeAmt;
        if(realAmt > amount) realAmt = amount;

        user.amount = realAmt;
        user.regAirdropID = currentID;
        distributors.push(msg.sender);

        emit AddDistributor(msg.sender, realAmt);
    }

    function claim() external {
        DistributorInfo storage user = userInfo[msg.sender];
        require(user.amount > 0, "not registered");
        require(user.regAirdropID < currentID, "can claim after this round is finished");

        token.safeTransfer(msg.sender, user.amount);
        user.amount = 0;
    }

    function _transferPerformanceFee() internal {
        require(msg.value >= performanceFee, 'should pay small gas to add as a distributor');

        payable(treasury).transfer(performanceFee);
        if(msg.value > performanceFee) {
            payable(msg.sender).transfer(msg.value - performanceFee);
        }
    }

    function numDistributors() external view returns (uint256) {
        return distributors.length;
    }

    /**
     * @notice Distribute the prizes to the three winners
     * @dev This function must be called by the owner of the contract.
     */
    function callAirdrop() 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 = distributors.length;
        require(numHolders > 3, "Not enough distributors");

        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;
            }
        }

        AirdropResult storage airdropResult = results[currentID];

        uint256 amount = address(this).balance;
        amount = amount * distributeRate / 10000;
        for(uint i = 0; i < 3; i++) {
            address winnerA = distributors[idx[i]];
            airdropResult.winner[i] = winnerA;

            uint256 amountA = amount * airdropRates[i] / 10000;
            airdropResult.amount[i] = amountA;
            payable(winnerA).transfer(amountA);
        }
        emit HolderDistributed(currentID, airdropResult.winner, airdropResult.amount);

        currentID = currentID + 1;
        lastAirdropTime = block.timestamp;
        distributors = new address[](0);
    }

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

    /**
     * @notice Set the distribution rates for the three wallets
     * @dev This function must be called by the owner of the contract.
     */
    function setAirdropRates(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");

        airdropRates = [_rateA, _rateB, _rateC];
        emit SetDistributorRates(airdropRates);
    }
    
    /**
     * @notice Set the minimum holding tokens to add distributor in usd
     * @dev This function must be called by the owner of the contract.
     */
    function setDistributorBalanceLimit(uint256 _min) external onlyOwner {
        distributorLimit = _min * 1 ether;
        emit SetDistributorLimit(_min);
    }

    function setServiceInfo(address _treasury, uint256 _fee) external {
        require(msg.sender == treasury, "setServiceInfo: FORBIDDEN");
        require(_treasury != address(0x0), "Invalid address");

        treasury = _treasury;
        performanceFee = _fee;

        emit ServiceInfoUpadted(_treasury, _fee);
    }

    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 11 : 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 11 : 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 11 : 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 11 : 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 11 : 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 11 : 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 11 : 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 11 : IPriceOracle.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;

interface IPriceOracle {
    /**
      * @notice Get the price of a token
      * @param token The token to get the price of
      * @return The asset price mantissa (scaled by 1e18).
      *  Zero means the price is unavailable.
      */
    function getTokenPrice(address token) external view returns (uint);
}

File 10 of 11 : 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 11 of 11 : 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":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"AddDistributor","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Claim","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"id","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":[{"indexed":false,"internalType":"address","name":"addr","type":"address"},{"indexed":false,"internalType":"uint256","name":"fee","type":"uint256"}],"name":"ServiceInfoUpadted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"limit","type":"uint256"}],"name":"SetDistributorLimit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256[3]","name":"rates","type":"uint256[3]"}],"name":"SetDistributorRates","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":"addDistributor","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"airdropRates","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"callAirdrop","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"cancelSubscription","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"currentID","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"distributeRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"distributorLimit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"distributors","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","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":[{"internalType":"uint256","name":"_id","type":"uint256"}],"name":"getAirdropResult","outputs":[{"internalType":"address[3]","name":"","type":"address[3]"},{"internalType":"uint256[3]","name":"","type":"uint256[3]"}],"stateMutability":"view","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","name":"_oracle","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"initialized","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastAirdropTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"numDistributors","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":"performanceFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"r_requestId","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":[{"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":"uint256","name":"_rateA","type":"uint256"},{"internalType":"uint256","name":"_rateB","type":"uint256"},{"internalType":"uint256","name":"_rateC","type":"uint256"}],"name":"setAirdropRates","outputs":[],"stateMutability":"nonpayable","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":"_min","type":"uint256"}],"name":"setDistributorBalanceLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_treasury","type":"address"},{"internalType":"uint256","name":"_fee","type":"uint256"}],"name":"setServiceInfo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_vrfCoordinator","type":"address"}],"name":"startSubscription","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"token","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"treasury","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"userInfo","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"regAirdropID","type":"uint256"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]

6003805460ff60a01b19168155600780546001600160501b03191666030003000249f01790556001600b5561251c600c55681b1ae4d6e2ef500000600d5561010060405261177060a09081526109c460c0526103e860e0526200006691600e919062000291565b50601580546001600160a01b03191673e64812272f989c63907b002843973b302e85c0231790556602d79883d20000601655348015620000a557600080fd5b50604051620034c5380380620034c5833981016040819052620000c8916200030e565b6001600055606083901b6001600160601b031916608052620000ea336200023f565b600280546001600160a01b0319166001600160a01b0385169081179091556040805163288688f960e21b8152905163a21a23e4916004808201926020929091908290030181600087803b1580156200014157600080fd5b505af115801562000156573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200017c91906200034e565b60058054600160a01b600160e01b031916600160a01b6001600160401b03938416810291909117918290556006849055600254604051631cd0704360e21b81529190920490921660048301523060248301526001600160a01b031690637341c10c90604401600060405180830381600087803b158015620001fc57600080fd5b505af115801562000211573d6000803e3d6000fd5b5050600380546001600160a01b0319166001600160a01b039590951694909417909355506200037e92505050565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b8260038101928215620002c8579160200282015b82811115620002c8578251829061ffff16905591602001919060010190620002a5565b50620002d6929150620002da565b5090565b5b80821115620002d65760008155600101620002db565b80516001600160a01b03811681146200030957600080fd5b919050565b60008060006060848603121562000323578283fd5b6200032e84620002f1565b92506200033e60208501620002f1565b9150604084015190509250925092565b60006020828403121562000360578081fd5b81516001600160401b038116811462000377578182fd5b9392505050565b60805160601c613121620003a4600039600081816109c90152610a0b01526131216000f3fe6080604052600436106102245760003560e01c806385d52d431161012e578063c4b1ea15116100ab578063e89e106a1161006f578063e89e106a1461066d578063f2fde38b14610683578063f6eaffc8146106a3578063fc0c546a146106c3578063fde1baca146106e357600080fd5b8063c4b1ea15146105de578063cd697315146105fe578063cdd2efd014610613578063d72310d114610638578063e0c862891461065857600080fd5b8063a9d8e968116100f2578063a9d8e9681461055c578063ac52480e1461057c578063ae503a9414610584578063b1c2b3e41461059a578063c3890403146105b057600080fd5b806385d52d43146104aa57806387788782146104ca5780638ac00021146104e05780638da5cb5b1461051f5780638ef40ffd1461053457600080fd5b80634b18b3df116101bc578063715018a611610180578063715018a61461042257806376ce6b401461043757806381b619481461045f578063843cf8511461047f578063845360171461049557600080fd5b80634b18b3df146103805780634e71d92d146103a057806350b492ba146103b55780635f795b4d146103e257806361d027b31461040257600080fd5b8063133f265014610230578063158ef93e146102525780631959a002146102885780631af03203146102d15780631c75cfb4146102f15780631fe543e31461031557806324e9edb01461033557806339096c331461034a578063485cc9551461036057600080fd5b3661022b57005b600080fd5b34801561023c57600080fd5b5061025061024b366004612b48565b6106f8565b005b34801561025e57600080fd5b5060035461027390600160a01b900460ff1681565b60405190151581526020015b60405180910390f35b34801561029457600080fd5b506102bc6102a336600461299b565b6013602052600090815260409020805460019091015482565b6040805192835260208301919091520161027f565b3480156102dd57600080fd5b506102506102ec36600461299b565b6108f6565b3480156102fd57600080fd5b50610307600b5481565b60405190815260200161027f565b34801561032157600080fd5b50610250610330366004612aa5565b6109be565b34801561034157600080fd5b50610250610a42565b34801561035657600080fd5b5061030760125481565b34801561036c57600080fd5b5061025061037b3660046129b7565b610afe565b34801561038c57600080fd5b5061025061039b366004612a75565b610bc8565b3480156103ac57600080fd5b50610250610c42565b3480156103c157600080fd5b506103d56103d0366004612a75565b610d16565b60405161027f9190612ce6565b3480156103ee57600080fd5b506102506103fd366004612b8d565b610d40565b34801561040e57600080fd5b506015546103d5906001600160a01b031681565b34801561042e57600080fd5b50610250610ebb565b34801561044357600080fd5b506103d573f8a0bf9cf54bb92f17374d9e9a321e6a111a51bd81565b34801561046b57600080fd5b5061025061047a3660046129ef565b610ef6565b34801561048b57600080fd5b50610307600d5481565b3480156104a157600080fd5b50610250610ff2565b3480156104b657600080fd5b506102506104c5366004612a75565b611050565b3480156104d657600080fd5b5061030760165481565b3480156104ec57600080fd5b5060055461050790600160a01b90046001600160401b031681565b6040516001600160401b03909116815260200161027f565b34801561052b57600080fd5b506103d5611385565b34801561054057600080fd5b506103d5731fcc3b22955e76ca48bf025f1a6993685975bb9e81565b34801561056857600080fd5b5061025061057736600461299b565b611394565b610250611546565b34801561059057600080fd5b50610307600c5481565b3480156105a657600080fd5b5061030760095481565b3480156105bc57600080fd5b506105d06105cb366004612a75565b611a5e565b60405161027f929190612d9a565b3480156105ea57600080fd5b506102506105f9366004612a3a565b611af4565b34801561060a57600080fd5b50610250611b57565b34801561061f57600080fd5b506106286121c8565b60405161027f9493929190612ef6565b34801561064457600080fd5b50610307610653366004612a75565b612272565b34801561066457600080fd5b50610250612289565b34801561067957600080fd5b5061030760085481565b34801561068f57600080fd5b5061025061069e36600461299b565b61238c565b3480156106af57600080fd5b506103076106be366004612a75565b61242c565b3480156106cf57600080fd5b506004546103d5906001600160a01b031681565b3480156106ef57600080fd5b50601454610307565b33610701611385565b6001600160a01b0316146107305760405162461bcd60e51b815260040161072790612e26565b60405180910390fd5b600083116107805760405162461bcd60e51b815260206004820152601d60248201527f526174652041206d7573742062652067726561746572207468616e20300000006044820152606401610727565b600082116107d05760405162461bcd60e51b815260206004820152601d60248201527f526174652042206d7573742062652067726561746572207468616e20300000006044820152606401610727565b600081116108205760405162461bcd60e51b815260206004820152601d60248201527f526174652043206d7573742062652067726561746572207468616e20300000006044820152606401610727565b6127108161082e8486612fc2565b6108389190612fc2565b106108905760405162461bcd60e51b815260206004820152602260248201527f546f74616c2072617465206d757374206265206c657373207468616e20313030604482015261030360f41b6064820152608401610727565b60408051606081018252848152602081018490529081018290526108b890600e90600361286b565b507f9790ef7c1f45d72c28f24be5b24c0bfc1066f8d9d8ed0093f34e330a392ae5ae600e6040516108e99190612dff565b60405180910390a1505050565b336108ff611385565b6001600160a01b0316146109255760405162461bcd60e51b815260040161072790612e26565b6040516370a0823160e01b81526000906001600160a01b038316906370a0823190610954903090600401612ce6565b60206040518083038186803b15801561096c57600080fd5b505afa158015610980573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109a49190612a8d565b90506109ba6001600160a01b038316338361244d565b5050565b336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610a385760405163073e64fd60e21b81523360048201526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000166024820152604401610727565b6109ba82826124a3565b33610a4b611385565b6001600160a01b031614610a715760405162461bcd60e51b815260040161072790612e26565b600254600554604051630d7ae1d360e41b81526001600160a01b039092169163d7ae1d3091610ab691600160a01b9091046001600160401b0316903390600401612ed4565b600060405180830381600087803b158015610ad057600080fd5b505af1158015610ae4573d6000803e3d6000fd5b50506005805467ffffffffffffffff60a01b191690555050565b33610b07611385565b6001600160a01b031614610b2d5760405162461bcd60e51b815260040161072790612e26565b600354600160a01b900460ff1615610b875760405162461bcd60e51b815260206004820152601c60248201527f436f6e747261637420616c726561647920696e697469616c697a6564000000006044820152606401610727565b6003805460ff60a01b1916600160a01b179055600480546001600160a01b039384166001600160a01b03199182161790915560058054929093169116179055565b33610bd1611385565b6001600160a01b031614610bf75760405162461bcd60e51b815260040161072790612e26565b610c0981670de0b6b3a7640000612fee565b600d556040518181527f60ecaa7da6b4bb3a399ca8b025cdc06c0950a0c9b03644ebf721bf5985ac848d9060200160405180910390a150565b3360009081526013602052604090208054610c905760405162461bcd60e51b815260206004820152600e60248201526d1b9bdd081c9959da5cdd195c995960921b6044820152606401610727565b600b54816001015410610cf45760405162461bcd60e51b815260206004820152602660248201527f63616e20636c61696d206166746572207468697320726f756e642069732066696044820152651b9a5cda195960d21b6064820152608401610727565b8054600454610d10916001600160a01b0390911690339061244d565b60009055565b60148181548110610d2657600080fd5b6000918252602090912001546001600160a01b0316905081565b33610d49611385565b6001600160a01b031614610d6f5760405162461bcd60e51b815260040161072790612e26565b6003546040516323b872dd60e01b81523360048201523060248201526001600160601b03831660448201526001600160a01b03909116906323b872dd90606401602060405180830381600087803b158015610dc957600080fd5b505af1158015610ddd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e019190612a1a565b5060035460025460055460408051600160a01b9092046001600160401b031660208301526001600160a01b0393841693634000aea09316918591016040516020818303038152906040526040518463ffffffff1660e01b8152600401610e6993929190612d67565b602060405180830381600087803b158015610e8357600080fd5b505af1158015610e97573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109ba9190612a1a565b33610ec4611385565b6001600160a01b031614610eea5760405162461bcd60e51b815260040161072790612e26565b610ef460006124bb565b565b6015546001600160a01b03163314610f4c5760405162461bcd60e51b815260206004820152601960248201527839b2ba29b2b93b34b1b2a4b733379d102327a92124a22222a760391b6044820152606401610727565b6001600160a01b038216610f945760405162461bcd60e51b815260206004820152600f60248201526e496e76616c6964206164647265737360881b6044820152606401610727565b601580546001600160a01b0319166001600160a01b03841617905560168190556040517f232f2e6280d2064b1e439bf40ecdada042d84eefbb55039e4c49e8dc4f4c90c990610fe69084908490612d1e565b60405180910390a15050565b33610ffb611385565b6001600160a01b0316146110215760405162461bcd60e51b815260040161072790612e26565b6040514790339082156108fc029083906000818181858888f193505050501580156109ba573d6000803e3d6000fd5b33611059611385565b6001600160a01b03161461107f5760405162461bcd60e51b815260040161072790612e26565b6040516323b872dd60e01b815273f8a0bf9cf54bb92f17374d9e9a321e6a111a51bd906323b872dd906110ba90339030908690600401612cfa565b602060405180830381600087803b1580156110d457600080fd5b505af11580156110e8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061110c9190612a1a565b5060405163095ea7b360e01b815273f8a0bf9cf54bb92f17374d9e9a321e6a111a51bd9063095ea7b39061115a90731fcc3b22955e76ca48bf025f1a6993685975bb9e908590600401612d1e565b602060405180830381600087803b15801561117457600080fd5b505af1158015611188573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111ac9190612a1a565b50600354604051632b7f092360e01b81526004810183905273f8a0bf9cf54bb92f17374d9e9a321e6a111a51bd60248201526001600160a01b039091166044820152731fcc3b22955e76ca48bf025f1a6993685975bb9e90632b7f092390606401600060405180830381600087803b15801561122757600080fd5b505af115801561123b573d6000803e3d6000fd5b50506003546040516370a0823160e01b8152600093506001600160a01b0390911691506370a0823190611272903090600401612ce6565b60206040518083038186803b15801561128a57600080fd5b505afa15801561129e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112c29190612a8d565b60035460025460055460408051600160a01b9092046001600160401b031660208301529394506001600160a01b0392831693634000aea093909216918591016040516020818303038152906040526040518463ffffffff1660e01b815260040161132e93929190612d37565b602060405180830381600087803b15801561134857600080fd5b505af115801561135c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113809190612a1a565b505050565b6001546001600160a01b031690565b3361139d611385565b6001600160a01b0316146113c35760405162461bcd60e51b815260040161072790612e26565b600554600160a01b90046001600160401b0316156114235760405162461bcd60e51b815260206004820152601c60248201527f537562736372697074696f6e20616c72656164792073746172746564000000006044820152606401610727565b600280546001600160a01b0319166001600160a01b0383169081179091556040805163288688f960e21b8152905163a21a23e4916004808201926020929091908290030181600087803b15801561147957600080fd5b505af115801561148d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114b19190612b73565b6005805467ffffffffffffffff60a01b1916600160a01b6001600160401b0393841681029190911791829055600254604051631cd0704360e21b81526001600160a01b0390911693637341c10c9361151193900416903090600401612ed4565b600060405180830381600087803b15801561152b57600080fd5b505af115801561153f573d6000803e3d6000fd5b5050505050565b600260005414156115995760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610727565b6002600055600354600160a01b900460ff166115c75760405162461bcd60e51b815260040161072790612e5b565b333b156116165760405162461bcd60e51b815260206004820152601e60248201527f636f6e74726163742063616e6e6f74206265206469737472696275746f7200006044820152606401610727565b336000908152601360205260409020600b5460018201541061166a5760405162461bcd60e51b815260206004820152600d60248201526c185b1c9958591e481859191959609a1b6044820152606401610727565b8054156116b95760405162461bcd60e51b815260206004820152601a60248201527f636c61696d2070726576696f7573207374616b652066697273740000000000006044820152606401610727565b6116c161250d565b60055460048054604051630681320d60e51b81526000936001600160a01b039081169363d02641a0936116f79392169101612ce6565b60206040518083038186803b15801561170f57600080fd5b505afa158015611723573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117479190612a8d565b600480546040516370a0823160e01b81529293506000926001600160a01b03909116916370a082319161177c91339101612ce6565b60206040518083038186803b15801561179457600080fd5b505afa1580156117a8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117cc9190612a8d565b9050600082600d54670de0b6b3a76400006117e79190612fee565b6117f19190612fda565b9050600083116118435760405162461bcd60e51b815260206004820152601a60248201527f4c55434b5920524f4f207072696365206973206d697373696e670000000000006044820152606401610727565b808210156118935760405162461bcd60e51b815260206004820152601b60248201527f696e73756666696369656e7420686f6c6465722062616c616e636500000000006044820152606401610727565b600480546040516370a0823160e01b81526000926001600160a01b03909216916370a08231916118c591309101612ce6565b60206040518083038186803b1580156118dd57600080fd5b505afa1580156118f1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119159190612a8d565b600454909150611930906001600160a01b03163330856125f6565b600480546040516370a0823160e01b815260009284926001600160a01b0316916370a082319161196291309101612ce6565b60206040518083038186803b15801561197a57600080fd5b505afa15801561198e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119b29190612a8d565b6119bc919061300d565b9050828111156119c95750815b808655600b546001808801919091556014805491820181556000527fce6d7b5282bd9a3661ae061feed1dbda4e52ab073b1f9285be6e155d9c38d4ec0180546001600160a01b031916339081179091556040517fa5babb86a45dcaf11bfb2fb70a03b04ce046203b581637539f567d01f6e8c68391611a49918490612d1e565b60405180910390a15050600160005550505050565b611a666128a9565b611a6e6128a9565b600083815260116020526040908190208151606081019283905290916003808401929184919082845b81546001600160a01b03168152600190910190602001808311611a9757505060408051606081019182905294965085935060039250905082845b815481526020019060010190808311611ad1575050505050905091509150915091565b33611afd611385565b6001600160a01b031614611b235760405162461bcd60e51b815260040161072790612e26565b6006929092556007805463ffffffff938416600160301b0269ffffffff0000ffffffff199091169390921692909217179055565b33611b60611385565b6001600160a01b031614611b865760405162461bcd60e51b815260040161072790612e26565b600354600160a01b900460ff16611baf5760405162461bcd60e51b815260040161072790612e5b565b60095460085414611bfd5760405162461bcd60e51b81526020600482015260186024820152770a4cae2eacae6e8409288e640c8de40dcdee840dac2e8c6d60431b6044820152606401610727565b600754600a54600160301b90910463ffffffff1614611c5e5760405162461bcd60e51b815260206004820152601e60248201527f4e756d626572206f6620776f72647320646f6573206e6f74206d6174636800006044820152606401610727565b60145460038111611cab5760405162461bcd60e51b81526020600482015260176024820152764e6f7420656e6f756768206469737472696275746f727360481b6044820152606401610727565b6000600855611cb86128a9565b611cc06128a9565b60005b6003811015611fc257611cd6818561300d565b600a8281548110611cf757634e487b7160e01b600052603260045260246000fd5b9060005260206000200154611d0c919061306b565b838260038110611d2c57634e487b7160e01b600052603260045260246000fd5b602002015260005b81811015611dfc57828160038110611d5c57634e487b7160e01b600052603260045260246000fd5b6020020151848360038110611d8157634e487b7160e01b600052603260045260246000fd5b602002015110611de557838260038110611dab57634e487b7160e01b600052603260045260246000fd5b6020020151611dbb906001612fc2565b848360038110611ddb57634e487b7160e01b600052603260045260246000fd5b6020020152611dea565b611dfc565b80611df481613050565b915050611d34565b5083838260038110611e1e57634e487b7160e01b600052603260045260246000fd5b6020020151611e2d919061306b565b838260038110611e4d57634e487b7160e01b600052603260045260246000fd5b6020020152828160038110611e7257634e487b7160e01b600052603260045260246000fd5b6020020151828260038110611e9757634e487b7160e01b600052603260045260246000fd5b60200201528015801590611efc575081611eb260018361300d565b60038110611ed057634e487b7160e01b600052603260045260246000fd5b6020020151828260038110611ef557634e487b7160e01b600052603260045260246000fd5b6020020151105b15611fb0576000828260038110611f2357634e487b7160e01b600052603260045260246000fd5b6020020151905082611f3660018461300d565b60038110611f5457634e487b7160e01b600052603260045260246000fd5b6020020151838360038110611f7957634e487b7160e01b600052603260045260246000fd5b60200201528083611f8b60018561300d565b60038110611fa957634e487b7160e01b600052603260045260246000fd5b6020020152505b80611fba81613050565b915050611cc3565b50600b546000908152601160205260409020600c54479061271090611fe79083612fee565b611ff19190612fda565b905060005b600381101561214d576000601486836003811061202357634e487b7160e01b600052603260045260246000fd5b60200201518154811061204657634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b031690508084836003811061207e57634e487b7160e01b600052603260045260246000fd5b0180546001600160a01b0319166001600160a01b03929092169190911790556000612710600e84600381106120c357634e487b7160e01b600052603260045260246000fd5b01546120cf9086612fee565b6120d99190612fda565b9050808560030184600381106120ff57634e487b7160e01b600052603260045260246000fd5b01556040516001600160a01b0383169082156108fc029083906000818181858888f19350505050158015612137573d6000803e3d6000fd5b505050808061214590613050565b915050611ff6565b50600b546040517ff60d42537d8c91b054cdf2259dbc4355292892f0cf4b936e64a1025bfb62dcf8916121869185906003820190612e8d565b60405180910390a1600b5461219c906001612fc2565b600b554260125560408051600081526020810191829052516121c0916014916128c7565b505050505050565b60025460055460405163523e3b4b60e11b8152600160a01b9091046001600160401b03166004820152600091829182916060916001600160a01b039091169063a47c76969060240160006040518083038186803b15801561222857600080fd5b505afa15801561223c573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526122649190810190612ba9565b935093509350935090919293565b600e816003811061228257600080fd5b0154905081565b33612292611385565b6001600160a01b0316146122b85760405162461bcd60e51b815260040161072790612e26565b60006009556002546006546005546007546040516305d3b1d360e41b81526004810193909352600160a01b9091046001600160401b03166024830152640100000000810461ffff16604483015263ffffffff8082166064840152600160301b9091041660848201526001600160a01b0390911690635d3b1d309060a401602060405180830381600087803b15801561234f57600080fd5b505af1158015612363573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123879190612a8d565b600855565b33612395611385565b6001600160a01b0316146123bb5760405162461bcd60e51b815260040161072790612e26565b6001600160a01b0381166124205760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610727565b612429816124bb565b50565b600a818154811061243c57600080fd5b600091825260209091200154905081565b6113808363a9059cbb60e01b848460405160240161246c929190612d1e565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915261261d565b6009829055805161138090600a90602084019061291c565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6016543410156125745760405162461bcd60e51b815260206004820152602c60248201527f73686f756c642070617920736d616c6c2067617320746f20616464206173206160448201526b103234b9ba3934b13aba37b960a11b6064820152608401610727565b6015546016546040516001600160a01b039092169181156108fc0291906000818181858888f193505050501580156125b0573d6000803e3d6000fd5b50601654341115610ef45760165433906108fc906125ce903461300d565b6040518115909202916000818181858888f19350505050158015612429573d6000803e3d6000fd5b612617846323b872dd60e01b85858560405160240161246c93929190612cfa565b50505050565b6000612672826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166126ef9092919063ffffffff16565b80519091501561138057808060200190518101906126909190612a1a565b6113805760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610727565b60606126fe8484600085612708565b90505b9392505050565b6060824710156127695760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610727565b843b6127b75760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610727565b600080866001600160a01b031685876040516127d39190612cca565b60006040518083038185875af1925050503d8060008114612810576040519150601f19603f3d011682016040523d82523d6000602084013e612815565b606091505b5091509150612825828286612832565b925050505b949350505050565b60608315612841575081612701565b8251156128515782518084602001fd5b8160405162461bcd60e51b81526004016107279190612e13565b8260038101928215612899579160200282015b8281111561289957825182559160200191906001019061287e565b506128a5929150612956565b5090565b60405180606001604052806003906020820280368337509192915050565b828054828255906000526020600020908101928215612899579160200282015b8281111561289957825182546001600160a01b0319166001600160a01b039091161782556020909201916001909101906128e7565b828054828255906000526020600020908101928215612899579160200282018281111561289957825182559160200191906001019061287e565b5b808211156128a55760008155600101612957565b803563ffffffff8116811461297f57600080fd5b919050565b80516001600160401b038116811461297f57600080fd5b6000602082840312156129ac578081fd5b8135612701816130c1565b600080604083850312156129c9578081fd5b82356129d4816130c1565b915060208301356129e4816130c1565b809150509250929050565b60008060408385031215612a01578182fd5b8235612a0c816130c1565b946020939093013593505050565b600060208284031215612a2b578081fd5b81518015158114612701578182fd5b600080600060608486031215612a4e578081fd5b83359250612a5e6020850161296b565b9150612a6c6040850161296b565b90509250925092565b600060208284031215612a86578081fd5b5035919050565b600060208284031215612a9e578081fd5b5051919050565b60008060408385031215612ab7578182fd5b823591506020808401356001600160401b03811115612ad4578283fd5b8401601f81018613612ae4578283fd5b8035612af7612af282612f9f565b612f6f565b80828252848201915084840189868560051b8701011115612b16578687fd5b8694505b83851015612b38578035835260019490940193918501918501612b1a565b5080955050505050509250929050565b600080600060608486031215612b5c578283fd5b505081359360208301359350604090920135919050565b600060208284031215612b84578081fd5b61270182612984565b600060208284031215612b9e578081fd5b8135612701816130d6565b60008060008060808587031215612bbe578182fd5b8451612bc9816130d6565b93506020612bd8868201612984565b93506040860151612be8816130c1565b60608701519093506001600160401b03811115612c03578283fd5b8601601f81018813612c13578283fd5b8051612c21612af282612f9f565b8082825284820191508484018b868560051b8701011115612c40578687fd5b8694505b83851015612c6b578051612c57816130c1565b835260019490940193918501918501612c44565b50979a9699509497505050505050565b8060005b6003811015612617578154845260209093019260019182019101612c7f565b60008151808452612cb6816020860160208601613024565b601f01601f19169290920160200192915050565b60008251612cdc818460208701613024565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03929092168252602082015260400190565b60018060a01b0384168152826020820152606060408201526000612d5e6060830184612c9e565b95945050505050565b6001600160a01b03841681526001600160601b0383166020820152606060408201819052600090612d5e90830184612c9e565b60c08101818460005b6003811015612dcb5781516001600160a01b0316835260209283019290910190600101612da3565b505050606082018360005b6003811015612df5578151835260209283019290910190600101612dd6565b5050509392505050565b60608101612e0d8284612c7b565b92915050565b6020815260006127016020830184612c9e565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526018908201527710dbdb9d1c9858dd081b9bdd081a5b9a5d1a585b1a5e995960421b604082015260600190565b83815260e0810160208083018560005b6003811015612ec35781546001600160a01b031683529183019160019182019101612e9d565b5050505061282a6080830184612c7b565b6001600160401b039290921682526001600160a01b0316602082015260400190565b6000608082016001600160601b038716835260206001600160401b0387168185015260018060a01b0380871660408601526080606086015282865180855260a0870191508388019450855b81811015612f5f578551841683529484019491840191600101612f41565b50909a9950505050505050505050565b604051601f8201601f191681016001600160401b0381118282101715612f9757612f976130ab565b604052919050565b60006001600160401b03821115612fb857612fb86130ab565b5060051b60200190565b60008219821115612fd557612fd561307f565b500190565b600082612fe957612fe9613095565b500490565b60008160001904831182151516156130085761300861307f565b500290565b60008282101561301f5761301f61307f565b500390565b60005b8381101561303f578181015183820152602001613027565b838111156126175750506000910152565b60006000198214156130645761306461307f565b5060010190565b60008261307a5761307a613095565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461242957600080fd5b6001600160601b038116811461242957600080fdfea2646970667358221220a2cf034b309a4f969303e8903f6f2a640811c8c2c004c2fbf11e4f55b528262364736f6c63430008040033000000000000000000000000271682deb8c4e0901d1a1550ad2e64d568e69909000000000000000000000000514910771af9ca656af840dff83e8264ecf986caff8dedfbfa60af186cf3c830acbc32c05aae823045ae5ea7da1e45fbfaba4f92

Deployed Bytecode

0x6080604052600436106102245760003560e01c806385d52d431161012e578063c4b1ea15116100ab578063e89e106a1161006f578063e89e106a1461066d578063f2fde38b14610683578063f6eaffc8146106a3578063fc0c546a146106c3578063fde1baca146106e357600080fd5b8063c4b1ea15146105de578063cd697315146105fe578063cdd2efd014610613578063d72310d114610638578063e0c862891461065857600080fd5b8063a9d8e968116100f2578063a9d8e9681461055c578063ac52480e1461057c578063ae503a9414610584578063b1c2b3e41461059a578063c3890403146105b057600080fd5b806385d52d43146104aa57806387788782146104ca5780638ac00021146104e05780638da5cb5b1461051f5780638ef40ffd1461053457600080fd5b80634b18b3df116101bc578063715018a611610180578063715018a61461042257806376ce6b401461043757806381b619481461045f578063843cf8511461047f578063845360171461049557600080fd5b80634b18b3df146103805780634e71d92d146103a057806350b492ba146103b55780635f795b4d146103e257806361d027b31461040257600080fd5b8063133f265014610230578063158ef93e146102525780631959a002146102885780631af03203146102d15780631c75cfb4146102f15780631fe543e31461031557806324e9edb01461033557806339096c331461034a578063485cc9551461036057600080fd5b3661022b57005b600080fd5b34801561023c57600080fd5b5061025061024b366004612b48565b6106f8565b005b34801561025e57600080fd5b5060035461027390600160a01b900460ff1681565b60405190151581526020015b60405180910390f35b34801561029457600080fd5b506102bc6102a336600461299b565b6013602052600090815260409020805460019091015482565b6040805192835260208301919091520161027f565b3480156102dd57600080fd5b506102506102ec36600461299b565b6108f6565b3480156102fd57600080fd5b50610307600b5481565b60405190815260200161027f565b34801561032157600080fd5b50610250610330366004612aa5565b6109be565b34801561034157600080fd5b50610250610a42565b34801561035657600080fd5b5061030760125481565b34801561036c57600080fd5b5061025061037b3660046129b7565b610afe565b34801561038c57600080fd5b5061025061039b366004612a75565b610bc8565b3480156103ac57600080fd5b50610250610c42565b3480156103c157600080fd5b506103d56103d0366004612a75565b610d16565b60405161027f9190612ce6565b3480156103ee57600080fd5b506102506103fd366004612b8d565b610d40565b34801561040e57600080fd5b506015546103d5906001600160a01b031681565b34801561042e57600080fd5b50610250610ebb565b34801561044357600080fd5b506103d573f8a0bf9cf54bb92f17374d9e9a321e6a111a51bd81565b34801561046b57600080fd5b5061025061047a3660046129ef565b610ef6565b34801561048b57600080fd5b50610307600d5481565b3480156104a157600080fd5b50610250610ff2565b3480156104b657600080fd5b506102506104c5366004612a75565b611050565b3480156104d657600080fd5b5061030760165481565b3480156104ec57600080fd5b5060055461050790600160a01b90046001600160401b031681565b6040516001600160401b03909116815260200161027f565b34801561052b57600080fd5b506103d5611385565b34801561054057600080fd5b506103d5731fcc3b22955e76ca48bf025f1a6993685975bb9e81565b34801561056857600080fd5b5061025061057736600461299b565b611394565b610250611546565b34801561059057600080fd5b50610307600c5481565b3480156105a657600080fd5b5061030760095481565b3480156105bc57600080fd5b506105d06105cb366004612a75565b611a5e565b60405161027f929190612d9a565b3480156105ea57600080fd5b506102506105f9366004612a3a565b611af4565b34801561060a57600080fd5b50610250611b57565b34801561061f57600080fd5b506106286121c8565b60405161027f9493929190612ef6565b34801561064457600080fd5b50610307610653366004612a75565b612272565b34801561066457600080fd5b50610250612289565b34801561067957600080fd5b5061030760085481565b34801561068f57600080fd5b5061025061069e36600461299b565b61238c565b3480156106af57600080fd5b506103076106be366004612a75565b61242c565b3480156106cf57600080fd5b506004546103d5906001600160a01b031681565b3480156106ef57600080fd5b50601454610307565b33610701611385565b6001600160a01b0316146107305760405162461bcd60e51b815260040161072790612e26565b60405180910390fd5b600083116107805760405162461bcd60e51b815260206004820152601d60248201527f526174652041206d7573742062652067726561746572207468616e20300000006044820152606401610727565b600082116107d05760405162461bcd60e51b815260206004820152601d60248201527f526174652042206d7573742062652067726561746572207468616e20300000006044820152606401610727565b600081116108205760405162461bcd60e51b815260206004820152601d60248201527f526174652043206d7573742062652067726561746572207468616e20300000006044820152606401610727565b6127108161082e8486612fc2565b6108389190612fc2565b106108905760405162461bcd60e51b815260206004820152602260248201527f546f74616c2072617465206d757374206265206c657373207468616e20313030604482015261030360f41b6064820152608401610727565b60408051606081018252848152602081018490529081018290526108b890600e90600361286b565b507f9790ef7c1f45d72c28f24be5b24c0bfc1066f8d9d8ed0093f34e330a392ae5ae600e6040516108e99190612dff565b60405180910390a1505050565b336108ff611385565b6001600160a01b0316146109255760405162461bcd60e51b815260040161072790612e26565b6040516370a0823160e01b81526000906001600160a01b038316906370a0823190610954903090600401612ce6565b60206040518083038186803b15801561096c57600080fd5b505afa158015610980573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109a49190612a8d565b90506109ba6001600160a01b038316338361244d565b5050565b336001600160a01b037f000000000000000000000000271682deb8c4e0901d1a1550ad2e64d568e699091614610a385760405163073e64fd60e21b81523360048201526001600160a01b037f000000000000000000000000271682deb8c4e0901d1a1550ad2e64d568e69909166024820152604401610727565b6109ba82826124a3565b33610a4b611385565b6001600160a01b031614610a715760405162461bcd60e51b815260040161072790612e26565b600254600554604051630d7ae1d360e41b81526001600160a01b039092169163d7ae1d3091610ab691600160a01b9091046001600160401b0316903390600401612ed4565b600060405180830381600087803b158015610ad057600080fd5b505af1158015610ae4573d6000803e3d6000fd5b50506005805467ffffffffffffffff60a01b191690555050565b33610b07611385565b6001600160a01b031614610b2d5760405162461bcd60e51b815260040161072790612e26565b600354600160a01b900460ff1615610b875760405162461bcd60e51b815260206004820152601c60248201527f436f6e747261637420616c726561647920696e697469616c697a6564000000006044820152606401610727565b6003805460ff60a01b1916600160a01b179055600480546001600160a01b039384166001600160a01b03199182161790915560058054929093169116179055565b33610bd1611385565b6001600160a01b031614610bf75760405162461bcd60e51b815260040161072790612e26565b610c0981670de0b6b3a7640000612fee565b600d556040518181527f60ecaa7da6b4bb3a399ca8b025cdc06c0950a0c9b03644ebf721bf5985ac848d9060200160405180910390a150565b3360009081526013602052604090208054610c905760405162461bcd60e51b815260206004820152600e60248201526d1b9bdd081c9959da5cdd195c995960921b6044820152606401610727565b600b54816001015410610cf45760405162461bcd60e51b815260206004820152602660248201527f63616e20636c61696d206166746572207468697320726f756e642069732066696044820152651b9a5cda195960d21b6064820152608401610727565b8054600454610d10916001600160a01b0390911690339061244d565b60009055565b60148181548110610d2657600080fd5b6000918252602090912001546001600160a01b0316905081565b33610d49611385565b6001600160a01b031614610d6f5760405162461bcd60e51b815260040161072790612e26565b6003546040516323b872dd60e01b81523360048201523060248201526001600160601b03831660448201526001600160a01b03909116906323b872dd90606401602060405180830381600087803b158015610dc957600080fd5b505af1158015610ddd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e019190612a1a565b5060035460025460055460408051600160a01b9092046001600160401b031660208301526001600160a01b0393841693634000aea09316918591016040516020818303038152906040526040518463ffffffff1660e01b8152600401610e6993929190612d67565b602060405180830381600087803b158015610e8357600080fd5b505af1158015610e97573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109ba9190612a1a565b33610ec4611385565b6001600160a01b031614610eea5760405162461bcd60e51b815260040161072790612e26565b610ef460006124bb565b565b6015546001600160a01b03163314610f4c5760405162461bcd60e51b815260206004820152601960248201527839b2ba29b2b93b34b1b2a4b733379d102327a92124a22222a760391b6044820152606401610727565b6001600160a01b038216610f945760405162461bcd60e51b815260206004820152600f60248201526e496e76616c6964206164647265737360881b6044820152606401610727565b601580546001600160a01b0319166001600160a01b03841617905560168190556040517f232f2e6280d2064b1e439bf40ecdada042d84eefbb55039e4c49e8dc4f4c90c990610fe69084908490612d1e565b60405180910390a15050565b33610ffb611385565b6001600160a01b0316146110215760405162461bcd60e51b815260040161072790612e26565b6040514790339082156108fc029083906000818181858888f193505050501580156109ba573d6000803e3d6000fd5b33611059611385565b6001600160a01b03161461107f5760405162461bcd60e51b815260040161072790612e26565b6040516323b872dd60e01b815273f8a0bf9cf54bb92f17374d9e9a321e6a111a51bd906323b872dd906110ba90339030908690600401612cfa565b602060405180830381600087803b1580156110d457600080fd5b505af11580156110e8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061110c9190612a1a565b5060405163095ea7b360e01b815273f8a0bf9cf54bb92f17374d9e9a321e6a111a51bd9063095ea7b39061115a90731fcc3b22955e76ca48bf025f1a6993685975bb9e908590600401612d1e565b602060405180830381600087803b15801561117457600080fd5b505af1158015611188573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111ac9190612a1a565b50600354604051632b7f092360e01b81526004810183905273f8a0bf9cf54bb92f17374d9e9a321e6a111a51bd60248201526001600160a01b039091166044820152731fcc3b22955e76ca48bf025f1a6993685975bb9e90632b7f092390606401600060405180830381600087803b15801561122757600080fd5b505af115801561123b573d6000803e3d6000fd5b50506003546040516370a0823160e01b8152600093506001600160a01b0390911691506370a0823190611272903090600401612ce6565b60206040518083038186803b15801561128a57600080fd5b505afa15801561129e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112c29190612a8d565b60035460025460055460408051600160a01b9092046001600160401b031660208301529394506001600160a01b0392831693634000aea093909216918591016040516020818303038152906040526040518463ffffffff1660e01b815260040161132e93929190612d37565b602060405180830381600087803b15801561134857600080fd5b505af115801561135c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113809190612a1a565b505050565b6001546001600160a01b031690565b3361139d611385565b6001600160a01b0316146113c35760405162461bcd60e51b815260040161072790612e26565b600554600160a01b90046001600160401b0316156114235760405162461bcd60e51b815260206004820152601c60248201527f537562736372697074696f6e20616c72656164792073746172746564000000006044820152606401610727565b600280546001600160a01b0319166001600160a01b0383169081179091556040805163288688f960e21b8152905163a21a23e4916004808201926020929091908290030181600087803b15801561147957600080fd5b505af115801561148d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114b19190612b73565b6005805467ffffffffffffffff60a01b1916600160a01b6001600160401b0393841681029190911791829055600254604051631cd0704360e21b81526001600160a01b0390911693637341c10c9361151193900416903090600401612ed4565b600060405180830381600087803b15801561152b57600080fd5b505af115801561153f573d6000803e3d6000fd5b5050505050565b600260005414156115995760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610727565b6002600055600354600160a01b900460ff166115c75760405162461bcd60e51b815260040161072790612e5b565b333b156116165760405162461bcd60e51b815260206004820152601e60248201527f636f6e74726163742063616e6e6f74206265206469737472696275746f7200006044820152606401610727565b336000908152601360205260409020600b5460018201541061166a5760405162461bcd60e51b815260206004820152600d60248201526c185b1c9958591e481859191959609a1b6044820152606401610727565b8054156116b95760405162461bcd60e51b815260206004820152601a60248201527f636c61696d2070726576696f7573207374616b652066697273740000000000006044820152606401610727565b6116c161250d565b60055460048054604051630681320d60e51b81526000936001600160a01b039081169363d02641a0936116f79392169101612ce6565b60206040518083038186803b15801561170f57600080fd5b505afa158015611723573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117479190612a8d565b600480546040516370a0823160e01b81529293506000926001600160a01b03909116916370a082319161177c91339101612ce6565b60206040518083038186803b15801561179457600080fd5b505afa1580156117a8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117cc9190612a8d565b9050600082600d54670de0b6b3a76400006117e79190612fee565b6117f19190612fda565b9050600083116118435760405162461bcd60e51b815260206004820152601a60248201527f4c55434b5920524f4f207072696365206973206d697373696e670000000000006044820152606401610727565b808210156118935760405162461bcd60e51b815260206004820152601b60248201527f696e73756666696369656e7420686f6c6465722062616c616e636500000000006044820152606401610727565b600480546040516370a0823160e01b81526000926001600160a01b03909216916370a08231916118c591309101612ce6565b60206040518083038186803b1580156118dd57600080fd5b505afa1580156118f1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119159190612a8d565b600454909150611930906001600160a01b03163330856125f6565b600480546040516370a0823160e01b815260009284926001600160a01b0316916370a082319161196291309101612ce6565b60206040518083038186803b15801561197a57600080fd5b505afa15801561198e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119b29190612a8d565b6119bc919061300d565b9050828111156119c95750815b808655600b546001808801919091556014805491820181556000527fce6d7b5282bd9a3661ae061feed1dbda4e52ab073b1f9285be6e155d9c38d4ec0180546001600160a01b031916339081179091556040517fa5babb86a45dcaf11bfb2fb70a03b04ce046203b581637539f567d01f6e8c68391611a49918490612d1e565b60405180910390a15050600160005550505050565b611a666128a9565b611a6e6128a9565b600083815260116020526040908190208151606081019283905290916003808401929184919082845b81546001600160a01b03168152600190910190602001808311611a9757505060408051606081019182905294965085935060039250905082845b815481526020019060010190808311611ad1575050505050905091509150915091565b33611afd611385565b6001600160a01b031614611b235760405162461bcd60e51b815260040161072790612e26565b6006929092556007805463ffffffff938416600160301b0269ffffffff0000ffffffff199091169390921692909217179055565b33611b60611385565b6001600160a01b031614611b865760405162461bcd60e51b815260040161072790612e26565b600354600160a01b900460ff16611baf5760405162461bcd60e51b815260040161072790612e5b565b60095460085414611bfd5760405162461bcd60e51b81526020600482015260186024820152770a4cae2eacae6e8409288e640c8de40dcdee840dac2e8c6d60431b6044820152606401610727565b600754600a54600160301b90910463ffffffff1614611c5e5760405162461bcd60e51b815260206004820152601e60248201527f4e756d626572206f6620776f72647320646f6573206e6f74206d6174636800006044820152606401610727565b60145460038111611cab5760405162461bcd60e51b81526020600482015260176024820152764e6f7420656e6f756768206469737472696275746f727360481b6044820152606401610727565b6000600855611cb86128a9565b611cc06128a9565b60005b6003811015611fc257611cd6818561300d565b600a8281548110611cf757634e487b7160e01b600052603260045260246000fd5b9060005260206000200154611d0c919061306b565b838260038110611d2c57634e487b7160e01b600052603260045260246000fd5b602002015260005b81811015611dfc57828160038110611d5c57634e487b7160e01b600052603260045260246000fd5b6020020151848360038110611d8157634e487b7160e01b600052603260045260246000fd5b602002015110611de557838260038110611dab57634e487b7160e01b600052603260045260246000fd5b6020020151611dbb906001612fc2565b848360038110611ddb57634e487b7160e01b600052603260045260246000fd5b6020020152611dea565b611dfc565b80611df481613050565b915050611d34565b5083838260038110611e1e57634e487b7160e01b600052603260045260246000fd5b6020020151611e2d919061306b565b838260038110611e4d57634e487b7160e01b600052603260045260246000fd5b6020020152828160038110611e7257634e487b7160e01b600052603260045260246000fd5b6020020151828260038110611e9757634e487b7160e01b600052603260045260246000fd5b60200201528015801590611efc575081611eb260018361300d565b60038110611ed057634e487b7160e01b600052603260045260246000fd5b6020020151828260038110611ef557634e487b7160e01b600052603260045260246000fd5b6020020151105b15611fb0576000828260038110611f2357634e487b7160e01b600052603260045260246000fd5b6020020151905082611f3660018461300d565b60038110611f5457634e487b7160e01b600052603260045260246000fd5b6020020151838360038110611f7957634e487b7160e01b600052603260045260246000fd5b60200201528083611f8b60018561300d565b60038110611fa957634e487b7160e01b600052603260045260246000fd5b6020020152505b80611fba81613050565b915050611cc3565b50600b546000908152601160205260409020600c54479061271090611fe79083612fee565b611ff19190612fda565b905060005b600381101561214d576000601486836003811061202357634e487b7160e01b600052603260045260246000fd5b60200201518154811061204657634e487b7160e01b600052603260045260246000fd5b6000918252602090912001546001600160a01b031690508084836003811061207e57634e487b7160e01b600052603260045260246000fd5b0180546001600160a01b0319166001600160a01b03929092169190911790556000612710600e84600381106120c357634e487b7160e01b600052603260045260246000fd5b01546120cf9086612fee565b6120d99190612fda565b9050808560030184600381106120ff57634e487b7160e01b600052603260045260246000fd5b01556040516001600160a01b0383169082156108fc029083906000818181858888f19350505050158015612137573d6000803e3d6000fd5b505050808061214590613050565b915050611ff6565b50600b546040517ff60d42537d8c91b054cdf2259dbc4355292892f0cf4b936e64a1025bfb62dcf8916121869185906003820190612e8d565b60405180910390a1600b5461219c906001612fc2565b600b554260125560408051600081526020810191829052516121c0916014916128c7565b505050505050565b60025460055460405163523e3b4b60e11b8152600160a01b9091046001600160401b03166004820152600091829182916060916001600160a01b039091169063a47c76969060240160006040518083038186803b15801561222857600080fd5b505afa15801561223c573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526122649190810190612ba9565b935093509350935090919293565b600e816003811061228257600080fd5b0154905081565b33612292611385565b6001600160a01b0316146122b85760405162461bcd60e51b815260040161072790612e26565b60006009556002546006546005546007546040516305d3b1d360e41b81526004810193909352600160a01b9091046001600160401b03166024830152640100000000810461ffff16604483015263ffffffff8082166064840152600160301b9091041660848201526001600160a01b0390911690635d3b1d309060a401602060405180830381600087803b15801561234f57600080fd5b505af1158015612363573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123879190612a8d565b600855565b33612395611385565b6001600160a01b0316146123bb5760405162461bcd60e51b815260040161072790612e26565b6001600160a01b0381166124205760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610727565b612429816124bb565b50565b600a818154811061243c57600080fd5b600091825260209091200154905081565b6113808363a9059cbb60e01b848460405160240161246c929190612d1e565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915261261d565b6009829055805161138090600a90602084019061291c565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6016543410156125745760405162461bcd60e51b815260206004820152602c60248201527f73686f756c642070617920736d616c6c2067617320746f20616464206173206160448201526b103234b9ba3934b13aba37b960a11b6064820152608401610727565b6015546016546040516001600160a01b039092169181156108fc0291906000818181858888f193505050501580156125b0573d6000803e3d6000fd5b50601654341115610ef45760165433906108fc906125ce903461300d565b6040518115909202916000818181858888f19350505050158015612429573d6000803e3d6000fd5b612617846323b872dd60e01b85858560405160240161246c93929190612cfa565b50505050565b6000612672826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166126ef9092919063ffffffff16565b80519091501561138057808060200190518101906126909190612a1a565b6113805760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610727565b60606126fe8484600085612708565b90505b9392505050565b6060824710156127695760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610727565b843b6127b75760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610727565b600080866001600160a01b031685876040516127d39190612cca565b60006040518083038185875af1925050503d8060008114612810576040519150601f19603f3d011682016040523d82523d6000602084013e612815565b606091505b5091509150612825828286612832565b925050505b949350505050565b60608315612841575081612701565b8251156128515782518084602001fd5b8160405162461bcd60e51b81526004016107279190612e13565b8260038101928215612899579160200282015b8281111561289957825182559160200191906001019061287e565b506128a5929150612956565b5090565b60405180606001604052806003906020820280368337509192915050565b828054828255906000526020600020908101928215612899579160200282015b8281111561289957825182546001600160a01b0319166001600160a01b039091161782556020909201916001909101906128e7565b828054828255906000526020600020908101928215612899579160200282018281111561289957825182559160200191906001019061287e565b5b808211156128a55760008155600101612957565b803563ffffffff8116811461297f57600080fd5b919050565b80516001600160401b038116811461297f57600080fd5b6000602082840312156129ac578081fd5b8135612701816130c1565b600080604083850312156129c9578081fd5b82356129d4816130c1565b915060208301356129e4816130c1565b809150509250929050565b60008060408385031215612a01578182fd5b8235612a0c816130c1565b946020939093013593505050565b600060208284031215612a2b578081fd5b81518015158114612701578182fd5b600080600060608486031215612a4e578081fd5b83359250612a5e6020850161296b565b9150612a6c6040850161296b565b90509250925092565b600060208284031215612a86578081fd5b5035919050565b600060208284031215612a9e578081fd5b5051919050565b60008060408385031215612ab7578182fd5b823591506020808401356001600160401b03811115612ad4578283fd5b8401601f81018613612ae4578283fd5b8035612af7612af282612f9f565b612f6f565b80828252848201915084840189868560051b8701011115612b16578687fd5b8694505b83851015612b38578035835260019490940193918501918501612b1a565b5080955050505050509250929050565b600080600060608486031215612b5c578283fd5b505081359360208301359350604090920135919050565b600060208284031215612b84578081fd5b61270182612984565b600060208284031215612b9e578081fd5b8135612701816130d6565b60008060008060808587031215612bbe578182fd5b8451612bc9816130d6565b93506020612bd8868201612984565b93506040860151612be8816130c1565b60608701519093506001600160401b03811115612c03578283fd5b8601601f81018813612c13578283fd5b8051612c21612af282612f9f565b8082825284820191508484018b868560051b8701011115612c40578687fd5b8694505b83851015612c6b578051612c57816130c1565b835260019490940193918501918501612c44565b50979a9699509497505050505050565b8060005b6003811015612617578154845260209093019260019182019101612c7f565b60008151808452612cb6816020860160208601613024565b601f01601f19169290920160200192915050565b60008251612cdc818460208701613024565b9190910192915050565b6001600160a01b0391909116815260200190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03929092168252602082015260400190565b60018060a01b0384168152826020820152606060408201526000612d5e6060830184612c9e565b95945050505050565b6001600160a01b03841681526001600160601b0383166020820152606060408201819052600090612d5e90830184612c9e565b60c08101818460005b6003811015612dcb5781516001600160a01b0316835260209283019290910190600101612da3565b505050606082018360005b6003811015612df5578151835260209283019290910190600101612dd6565b5050509392505050565b60608101612e0d8284612c7b565b92915050565b6020815260006127016020830184612c9e565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526018908201527710dbdb9d1c9858dd081b9bdd081a5b9a5d1a585b1a5e995960421b604082015260600190565b83815260e0810160208083018560005b6003811015612ec35781546001600160a01b031683529183019160019182019101612e9d565b5050505061282a6080830184612c7b565b6001600160401b039290921682526001600160a01b0316602082015260400190565b6000608082016001600160601b038716835260206001600160401b0387168185015260018060a01b0380871660408601526080606086015282865180855260a0870191508388019450855b81811015612f5f578551841683529484019491840191600101612f41565b50909a9950505050505050505050565b604051601f8201601f191681016001600160401b0381118282101715612f9757612f976130ab565b604052919050565b60006001600160401b03821115612fb857612fb86130ab565b5060051b60200190565b60008219821115612fd557612fd561307f565b500190565b600082612fe957612fe9613095565b500490565b60008160001904831182151516156130085761300861307f565b500290565b60008282101561301f5761301f61307f565b500390565b60005b8381101561303f578181015183820152602001613027565b838111156126175750506000910152565b60006000198214156130645761306461307f565b5060010190565b60008261307a5761307a613095565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461242957600080fd5b6001600160601b038116811461242957600080fdfea2646970667358221220a2cf034b309a4f969303e8903f6f2a640811c8c2c004c2fbf11e4f55b528262364736f6c63430008040033

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.