ETH Price: $2,663.24 (+8.19%)
 

Overview

ETH Balance

0.002596739582102829 ETH

Eth Value

$6.92 (@ $2,663.24/ETH)

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Withdraw154662652022-09-03 15:53:53795 days ago1662220433IN
0x8dE3D4C6...91c5669Dc
0 ETH0.000282029.29655021
Buy Tickets153852962022-08-21 17:39:52807 days ago1661103592IN
0x8dE3D4C6...91c5669Dc
0 ETH0.003938867.43834952
Buy Tickets153820512022-08-21 5:15:35808 days ago1661058935IN
0x8dE3D4C6...91c5669Dc
0 ETH0.003471194.44545126
Start Lottery153818662022-08-21 4:37:51808 days ago1661056671IN
0x8dE3D4C6...91c5669Dc
0 ETH0.051289724.62365538
Pick Winner153818472022-08-21 4:33:03808 days ago1661056383IN
0x8dE3D4C6...91c5669Dc
0 ETH0.000490274.28756653
Buy Tickets153818062022-08-21 4:22:45808 days ago1661055765IN
0x8dE3D4C6...91c5669Dc
0 ETH0.033579957.19879813
Buy Tickets153817632022-08-21 4:11:45808 days ago1661055105IN
0x8dE3D4C6...91c5669Dc
0 ETH0.001163214.4545545
Buy Tickets153817612022-08-21 4:11:19808 days ago1661055079IN
0x8dE3D4C6...91c5669Dc
0 ETH0.000981254.67953996
Buy Tickets153817182022-08-21 4:02:15808 days ago1661054535IN
0x8dE3D4C6...91c5669Dc
0 ETH0.072428475.25378039
Buy Tickets153816012022-08-21 3:32:50808 days ago1661052770IN
0x8dE3D4C6...91c5669Dc
0 ETH0.0008284.87792503
Buy Tickets153815382022-08-21 3:18:57808 days ago1661051937IN
0x8dE3D4C6...91c5669Dc
0 ETH0.006446536.38712483
Buy Tickets153815322022-08-21 3:17:09808 days ago1661051829IN
0x8dE3D4C6...91c5669Dc
0 ETH0.006114646.16270568
Buy Tickets153815292022-08-21 3:16:11808 days ago1661051771IN
0x8dE3D4C6...91c5669Dc
0 ETH0.011781286.18102412
Buy Tickets153815282022-08-21 3:15:46808 days ago1661051746IN
0x8dE3D4C6...91c5669Dc
0 ETH0.001880815.80638773
Buy Tickets153815092022-08-21 3:11:52808 days ago1661051512IN
0x8dE3D4C6...91c5669Dc
0 ETH0.011144049.00338731
Buy Tickets153814982022-08-21 3:09:02808 days ago1661051342IN
0x8dE3D4C6...91c5669Dc
0 ETH0.001895239.03821457
Buy Tickets153814732022-08-21 3:00:24808 days ago1661050824IN
0x8dE3D4C6...91c5669Dc
0 ETH0.007851336.43203671
Buy Tickets153814612022-08-21 2:56:55808 days ago1661050615IN
0x8dE3D4C6...91c5669Dc
0 ETH0.065985985.72870973
Buy Tickets153814472022-08-21 2:53:45808 days ago1661050425IN
0x8dE3D4C6...91c5669Dc
0 ETH0.069040776.06304585
Buy Tickets153814312022-08-21 2:50:55808 days ago1661050255IN
0x8dE3D4C6...91c5669Dc
0 ETH0.026748397.59388241
Buy Tickets153814252022-08-21 2:49:31808 days ago1661050171IN
0x8dE3D4C6...91c5669Dc
0 ETH0.052335997.68268909
Buy Tickets153814112022-08-21 2:45:45808 days ago1661049945IN
0x8dE3D4C6...91c5669Dc
0 ETH0.031025066.46121746
Buy Tickets153814012022-08-21 2:42:59808 days ago1661049779IN
0x8dE3D4C6...91c5669Dc
0 ETH0.000971646.37113647
Start Lottery153812262022-08-21 2:06:00808 days ago1661047560IN
0x8dE3D4C6...91c5669Dc
0 ETH0.0006944613.49632671
Update Token Use...153755662022-08-20 4:42:16809 days ago1660970536IN
0x8dE3D4C6...91c5669Dc
0 ETH0.000315456.84339233
View all transactions

Latest 25 internal transactions (View All)

Advanced mode:
Parent Transaction Hash Block From To
155437412022-09-16 4:12:23782 days ago1663301543
0x8dE3D4C6...91c5669Dc
0.00020322 ETH
155184862022-09-12 2:48:51786 days ago1662950931
0x8dE3D4C6...91c5669Dc
0.00054162 ETH
154694452022-09-04 3:57:19794 days ago1662263839
0x8dE3D4C6...91c5669Dc
0.00185189 ETH
154662652022-09-03 15:53:53795 days ago1662220433
0x8dE3D4C6...91c5669Dc
1.28667568 ETH
154561402022-09-02 0:56:07796 days ago1662080167
0x8dE3D4C6...91c5669Dc
0.0044869 ETH
154198932022-08-27 5:58:14802 days ago1661579894
0x8dE3D4C6...91c5669Dc
0.00212819 ETH
154052432022-08-24 21:18:22804 days ago1661375902
0x8dE3D4C6...91c5669Dc
0.00907526 ETH
154049762022-08-24 20:26:54804 days ago1661372814
0x8dE3D4C6...91c5669Dc
0.0009612 ETH
154031832022-08-24 13:28:59805 days ago1661347739
0x8dE3D4C6...91c5669Dc
0.00215678 ETH
154008672022-08-24 4:36:02805 days ago1661315762
0x8dE3D4C6...91c5669Dc
0.00403071 ETH
153993242022-08-23 22:40:04805 days ago1661294404
0x8dE3D4C6...91c5669Dc
0.00251295 ETH
153993242022-08-23 22:40:04805 days ago1661294404
0x8dE3D4C6...91c5669Dc
0.00506542 ETH
153971022022-08-23 14:23:46806 days ago1661264626
0x8dE3D4C6...91c5669Dc
0.00506542 ETH
153939332022-08-23 2:19:55806 days ago1661221195
0x8dE3D4C6...91c5669Dc
0.00150123 ETH
153938542022-08-23 2:00:20806 days ago1661220020
0x8dE3D4C6...91c5669Dc
0.00462562 ETH
153938362022-08-23 1:56:14806 days ago1661219774
0x8dE3D4C6...91c5669Dc
0.00462562 ETH
153925512022-08-22 21:11:20806 days ago1661202680
0x8dE3D4C6...91c5669Dc
0.00175296 ETH
153916312022-08-22 17:34:02806 days ago1661189642
0x8dE3D4C6...91c5669Dc
0.00449311 ETH
153886072022-08-22 6:03:17807 days ago1661148197
0x8dE3D4C6...91c5669Dc
0.00087437 ETH
153884872022-08-22 5:38:50807 days ago1661146730
0x8dE3D4C6...91c5669Dc
0.00086138 ETH
153877892022-08-22 2:54:36807 days ago1661136876
0x8dE3D4C6...91c5669Dc
0.00536506 ETH
153872962022-08-22 0:59:08807 days ago1661129948
0x8dE3D4C6...91c5669Dc
0.0054912 ETH
153872962022-08-22 0:59:08807 days ago1661129948
0x8dE3D4C6...91c5669Dc
0.00094563 ETH
153871942022-08-22 0:35:14807 days ago1661128514
0x8dE3D4C6...91c5669Dc
0.00388693 ETH
153869832022-08-21 23:47:36807 days ago1661125656
0x8dE3D4C6...91c5669Dc
0.00196337 ETH
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Lottery

Compiler Version
v0.8.13+commit.abaa5c0e

Optimization Enabled:
Yes with 1000 runs

Other Settings:
default evmVersion
File 1 of 13 : Lottery.sol
pragma solidity >=0.8.10 >=0.8.0 <0.9.0;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@uniswap/v2-periphery/contracts/interfaces/IUniswapV2Router02.sol";
import "@uniswap/v2-core/contracts/interfaces/IUniswapV2Factory.sol";
import "@uniswap/v2-core/contracts/interfaces/IUniswapV2Pair.sol";
import "@chainlink/contracts/src/v0.8/interfaces/VRFCoordinatorV2Interface.sol";
import "@chainlink/contracts/src/v0.8/VRFConsumerBaseV2.sol";

//Lottery Inu Lottery Contract.

contract Lottery is VRFConsumerBaseV2, Ownable {
    using SafeMath for uint256;
    VRFCoordinatorV2Interface COORDINATOR;

    //VRF values
    uint64 s_subscriptionId;
    address vrfCoordinator = 0x271682DEB8C4E0901D1a1550aD2e64D568E69909;
    bytes32 keyHash = 0x8af398995b04c28e9951adb9721ef74c74f93e6a478f39e7e0777be13527e7ef;
    uint32 callbackGasLimit = 600000;
    uint16 requestConfirmations = 3;
    uint32 numWords =  1;
    uint256 public s_requestId;

    //Game Values
    enum LOTTERY_STATE { OPEN, CLOSED, CALCULATING_WINNER }
    LOTTERY_STATE public lottery_state;
    address payable[] public players;
    uint256 public lotteryId;
    uint public lotteryStartDate;
    uint public lotteryEndDate;
    uint256 ticketCost = 100 * 1e18;

    //Player info
    struct player{
        uint256 ticketsBought;
        uint256 gamesWon;
    }

    mapping(address => player) public playerStats;

    //events
    event LotteryOpen(uint256 _lotteryId);
    event LotteryClose(uint256 _lotteryId);
    event LotteryWinner(
        uint256 _lotteryId,
        uint256 _randomness,
        uint256 _index,
        address indexed _from,
        uint256 _amount
    );
    event PlayerJoined(uint256 _lotteryId, address indexed _from);

    //Lottery Inu Token
    IERC20 lottoToken;

    //modifier to check state of game
    modifier atState(LOTTERY_STATE _state) {
        require(lottery_state == _state, "Function cannot be called at this time.");
        _;
    }

    //constructor
    constructor(uint64 subscriptionId) VRFConsumerBaseV2(vrfCoordinator) {
    COORDINATOR = VRFCoordinatorV2Interface(vrfCoordinator);
    s_subscriptionId = subscriptionId;
    lotteryId = 1;
    lottery_state = LOTTERY_STATE.CLOSED;
  }

  receive() external payable {}

  function UpdateTokenUsedToPay(address token) public onlyOwner{
    lottoToken = IERC20(token);
  }

  function setLotteryTicketPrice(uint256 ticketPrice) public onlyOwner{
    uint256 totalSuypply = lottoToken.totalSupply();
    require(ticketPrice < ( totalSuypply* 5) / 1000, "Set a reasonable price ticket cost has to be lower then .5%");
    ticketCost = ticketPrice;
  }

  function startLottery() public onlyOwner {
    require(lottery_state == LOTTERY_STATE.CLOSED, "can't start a new lottery yet");
    players = new address payable[](0);
    lotteryStartDate = block.timestamp;
    lottery_state = LOTTERY_STATE.OPEN;
    emit LotteryOpen(lotteryId);
  }

  function getAmountOfTicketsOwned(address _address) public view returns(uint256 amountOfTickets){
        uint256 amount = players.length;
        uint256 tickets = 0;
        for (uint i=0; i < amount; i++) {
          if(players[i] == _address){
            tickets += 1;
          }
        }

        return tickets;
  }

  function PickWinner() public onlyOwner {
    require(lottery_state == LOTTERY_STATE.OPEN);
    lottery_state = LOTTERY_STATE.CALCULATING_WINNER;
    requestRandomWords();
  }

  function Withdraw() public onlyOwner{
    bool success;
    (success, ) = address(msg.sender).call{value: address(this).balance}("");
  }

  function buyTicket() public payable atState(LOTTERY_STATE.OPEN) {
        uint256 balance = lottoToken.balanceOf(msg.sender);
        require(balance >= ticketCost, "You must pay the proper amount for ticket");
        uint256 allowance = lottoToken.allowance(msg.sender, address(this));
        require(allowance >= ticketCost, "Check token allowance");

        lottoToken.transferFrom(msg.sender, address(0xdead), ticketCost);

        //add player and set info
        players.push(payable(msg.sender));
        playerStats[msg.sender].ticketsBought +=1;
        emit PlayerJoined(lotteryId, msg.sender);
    }

 function buyTickets(uint256 numberOfTickets) public payable atState(LOTTERY_STATE.OPEN) {
        uint256 balance = lottoToken.balanceOf(msg.sender);
        uint256 amount = ticketCost * numberOfTickets;
        require(balance >= amount, "You must pay the proper amount for ticket");
        uint256 allowance = lottoToken.allowance(msg.sender, address(this));
        require(allowance >= amount, "Check token allowance");

        lottoToken.transferFrom(msg.sender, address(0xdead), amount);

        //add player and set info
        for (uint i=1; i <= numberOfTickets; i++) {
            players.push(payable(msg.sender));
            playerStats[msg.sender].ticketsBought +=1;
        }

        emit PlayerJoined(lotteryId, msg.sender);
    }



    //gets random number
    function requestRandomWords() private {
    // 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 {
      //pick winner
      uint256 index = randomWords[0] % players.length;
      uint256 winnings = address(this).balance / 2;
      address winner = players[index];
      //pay winner
       bool success;
      (success, ) = address(winner).call{value: winnings}("");

      lottery_state = LOTTERY_STATE.CLOSED;
      
      emit LotteryWinner(lotteryId, randomWords[0], index, winner, winnings);
      emit LotteryClose(lotteryId);

      lotteryId = lotteryId + 1;

    }
}

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

pragma solidity ^0.8.0;

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

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

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

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

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

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

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

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

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

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

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

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

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

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

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

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

        return true;
    }

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

        _beforeTokenTransfer(from, to, amount);

        uint256 fromBalance = _balances[from];
        require(fromBalance >= amount, "ERC20: transfer amount exceeds balance");
        unchecked {
            _balances[from] = fromBalance - amount;
        }
        _balances[to] += amount;

        emit Transfer(from, to, amount);

        _afterTokenTransfer(from, to, amount);
    }

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

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

        _totalSupply += amount;
        _balances[account] += amount;
        emit Transfer(address(0), account, amount);

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

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

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

        uint256 accountBalance = _balances[account];
        require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
        unchecked {
            _balances[account] = accountBalance - amount;
        }
        _totalSupply -= amount;

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

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

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

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

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

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

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

File 3 of 13 : 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 4 of 13 : SafeMath.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (utils/math/SafeMath.sol)

pragma solidity ^0.8.0;

// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.

/**
 * @dev Wrappers over Solidity's arithmetic operations.
 *
 * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler
 * now has built in overflow checking.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            uint256 c = a + b;
            if (c < a) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b > a) return (false, 0);
            return (true, a - b);
        }
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
            // benefit is lost if 'b' is also tested.
            // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
            if (a == 0) return (true, 0);
            uint256 c = a * b;
            if (c / a != b) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the division of two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a / b);
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
     *
     * _Available since v3.4._
     */
    function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a % b);
        }
    }

    /**
     * @dev Returns the addition of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     *
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        return a + b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        return a - b;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     *
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        return a * b;
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator.
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        return a / b;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b) internal pure returns (uint256) {
        return a % b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {trySub}.
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        unchecked {
            require(b <= a, errorMessage);
            return a - b;
        }
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting with custom message on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        unchecked {
            require(b > 0, errorMessage);
            return a / b;
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting with custom message when dividing by zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryMod}.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        unchecked {
            require(b > 0, errorMessage);
            return a % b;
        }
    }
}

File 5 of 13 : IUniswapV2Router02.sol
pragma solidity >=0.6.2;

import './IUniswapV2Router01.sol';

interface IUniswapV2Router02 is IUniswapV2Router01 {
    function removeLiquidityETHSupportingFeeOnTransferTokens(
        address token,
        uint liquidity,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline
    ) external returns (uint amountETH);
    function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(
        address token,
        uint liquidity,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline,
        bool approveMax, uint8 v, bytes32 r, bytes32 s
    ) external returns (uint amountETH);

    function swapExactTokensForTokensSupportingFeeOnTransferTokens(
        uint amountIn,
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external;
    function swapExactETHForTokensSupportingFeeOnTransferTokens(
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external payable;
    function swapExactTokensForETHSupportingFeeOnTransferTokens(
        uint amountIn,
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external;
}

File 6 of 13 : IUniswapV2Factory.sol
pragma solidity >=0.5.0;

interface IUniswapV2Factory {
    event PairCreated(address indexed token0, address indexed token1, address pair, uint);

    function feeTo() external view returns (address);
    function feeToSetter() external view returns (address);

    function getPair(address tokenA, address tokenB) external view returns (address pair);
    function allPairs(uint) external view returns (address pair);
    function allPairsLength() external view returns (uint);

    function createPair(address tokenA, address tokenB) external returns (address pair);

    function setFeeTo(address) external;
    function setFeeToSetter(address) external;
}

File 7 of 13 : IUniswapV2Pair.sol
pragma solidity >=0.5.0;

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

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

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

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

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

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

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

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

    function initialize(address, address) external;
}

File 8 of 13 : 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 9 of 13 : 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 10 of 13 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);

    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

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

    /**
     * @dev Moves `amount` tokens from the caller's account to `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, uint256 amount) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 amount) external returns (bool);

    /**
     * @dev Moves `amount` tokens from `from` to `to` using the
     * allowance mechanism. `amount` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 amount
    ) external returns (bool);
}

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

pragma solidity ^0.8.0;

import "../IERC20.sol";

/**
 * @dev Interface for the optional metadata functions from the ERC20 standard.
 *
 * _Available since v4.1._
 */
interface IERC20Metadata is IERC20 {
    /**
     * @dev Returns the name of the token.
     */
    function name() external view returns (string memory);

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

    /**
     * @dev Returns the decimals places of the token.
     */
    function decimals() external view returns (uint8);
}

File 12 of 13 : 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 13 of 13 : IUniswapV2Router01.sol
pragma solidity >=0.6.2;

interface IUniswapV2Router01 {
    function factory() external pure returns (address);
    function WETH() external pure returns (address);

    function addLiquidity(
        address tokenA,
        address tokenB,
        uint amountADesired,
        uint amountBDesired,
        uint amountAMin,
        uint amountBMin,
        address to,
        uint deadline
    ) external returns (uint amountA, uint amountB, uint liquidity);
    function addLiquidityETH(
        address token,
        uint amountTokenDesired,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline
    ) external payable returns (uint amountToken, uint amountETH, uint liquidity);
    function removeLiquidity(
        address tokenA,
        address tokenB,
        uint liquidity,
        uint amountAMin,
        uint amountBMin,
        address to,
        uint deadline
    ) external returns (uint amountA, uint amountB);
    function removeLiquidityETH(
        address token,
        uint liquidity,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline
    ) external returns (uint amountToken, uint amountETH);
    function removeLiquidityWithPermit(
        address tokenA,
        address tokenB,
        uint liquidity,
        uint amountAMin,
        uint amountBMin,
        address to,
        uint deadline,
        bool approveMax, uint8 v, bytes32 r, bytes32 s
    ) external returns (uint amountA, uint amountB);
    function removeLiquidityETHWithPermit(
        address token,
        uint liquidity,
        uint amountTokenMin,
        uint amountETHMin,
        address to,
        uint deadline,
        bool approveMax, uint8 v, bytes32 r, bytes32 s
    ) external returns (uint amountToken, uint amountETH);
    function swapExactTokensForTokens(
        uint amountIn,
        uint amountOutMin,
        address[] calldata path,
        address to,
        uint deadline
    ) external returns (uint[] memory amounts);
    function swapTokensForExactTokens(
        uint amountOut,
        uint amountInMax,
        address[] calldata path,
        address to,
        uint deadline
    ) external returns (uint[] memory amounts);
    function swapExactETHForTokens(uint amountOutMin, address[] calldata path, address to, uint deadline)
        external
        payable
        returns (uint[] memory amounts);
    function swapTokensForExactETH(uint amountOut, uint amountInMax, address[] calldata path, address to, uint deadline)
        external
        returns (uint[] memory amounts);
    function swapExactTokensForETH(uint amountIn, uint amountOutMin, address[] calldata path, address to, uint deadline)
        external
        returns (uint[] memory amounts);
    function swapETHForExactTokens(uint amountOut, address[] calldata path, address to, uint deadline)
        external
        payable
        returns (uint[] memory amounts);

    function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB);
    function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut);
    function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn);
    function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);
    function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts);
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"uint64","name":"subscriptionId","type":"uint64"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"have","type":"address"},{"internalType":"address","name":"want","type":"address"}],"name":"OnlyCoordinatorCanFulfill","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_lotteryId","type":"uint256"}],"name":"LotteryClose","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_lotteryId","type":"uint256"}],"name":"LotteryOpen","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_lotteryId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_randomness","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_index","type":"uint256"},{"indexed":true,"internalType":"address","name":"_from","type":"address"},{"indexed":false,"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"LotteryWinner","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"_lotteryId","type":"uint256"},{"indexed":true,"internalType":"address","name":"_from","type":"address"}],"name":"PlayerJoined","type":"event"},{"inputs":[],"name":"PickWinner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"UpdateTokenUsedToPay","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"Withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"buyTicket","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"numberOfTickets","type":"uint256"}],"name":"buyTickets","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"getAmountOfTicketsOwned","outputs":[{"internalType":"uint256","name":"amountOfTickets","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lotteryEndDate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lotteryId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lotteryStartDate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lottery_state","outputs":[{"internalType":"enum Lottery.LOTTERY_STATE","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"playerStats","outputs":[{"internalType":"uint256","name":"ticketsBought","type":"uint256"},{"internalType":"uint256","name":"gamesWon","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"players","outputs":[{"internalType":"address payable","name":"","type":"address"}],"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":"s_requestId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"ticketPrice","type":"uint256"}],"name":"setLotteryTicketPrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"startLottery","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]

60a0604052600280546001600160a01b03191673271682deb8c4e0901d1a1550ad2e64d568e699091790557f8af398995b04c28e9951adb9721ef74c74f93e6a478f39e7e0777be13527e7ef6003556004805466010003000927c06001600160501b031990911617905568056bc75e2d63100000600b5534801561008257600080fd5b506040516118753803806118758339810160408190526100a191610158565b6002546001600160a01b03166080526100b933610108565b600254600180546001600160a01b039092166001600160e01b031990921691909117600160a01b6001600160401b0384160217815560088190556006805460ff19168280021790555050610188565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60006020828403121561016a57600080fd5b81516001600160401b038116811461018157600080fd5b9392505050565b6080516116cb6101aa600039600081816104c6015261052101526116cb6000f3fe6080604052600436106101485760003560e01c8063a0ede5a4116100c0578063e580f47b11610074578063edca914c11610059578063edca914c1461034a578063f2fde38b14610352578063f71d96cb1461037257600080fd5b8063e580f47b1461031e578063e89e106a1461033457600080fd5b8063bf0e6329116100a5578063bf0e63291461029f578063ccee2cec146102b5578063cdafbbb6146102d557600080fd5b8063a0ede5a41461026a578063b7d2c6541461028a57600080fd5b8063715018a61161011757806381447999116100fc57806381447999146101f15780638da5cb5b1461021857806397ca40cd1461024a57600080fd5b8063715018a6146101b3578063745d6adf146101c857600080fd5b8063160344e2146101545780631fe543e31461016b5780632f3666371461018b57806357ea89b61461019e57600080fd5b3661014f57005b600080fd5b34801561016057600080fd5b50610169610392565b005b34801561017757600080fd5b5061016961018636600461144f565b6104bb565b610169610199366004611519565b61055c565b3480156101aa57600080fd5b506101696108ba565b3480156101bf57600080fd5b50610169610961565b3480156101d457600080fd5b506101de600a5481565b6040519081526020015b60405180910390f35b3480156101fd57600080fd5b5060065461020b9060ff1681565b6040516101e89190611548565b34801561022457600080fd5b506000546001600160a01b03165b6040516001600160a01b0390911681526020016101e8565b34801561025657600080fd5b50610169610265366004611570565b6109c7565b34801561027657600080fd5b50610169610285366004611519565b610a43565b34801561029657600080fd5b50610169610bb8565b3480156102ab57600080fd5b506101de60095481565b3480156102c157600080fd5b506101de6102d0366004611570565b610c4a565b3480156102e157600080fd5b506103096102f0366004611570565b600c602052600090815260409020805460019091015482565b604080519283526020830191909152016101e8565b34801561032a57600080fd5b506101de60085481565b34801561034057600080fd5b506101de60055481565b610169610cba565b34801561035e57600080fd5b5061016961036d366004611570565b610fee565b34801561037e57600080fd5b5061023261038d366004611519565b6110d0565b6000546001600160a01b031633146103f15760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b600160065460ff16600281111561040a5761040a611532565b146104575760405162461bcd60e51b815260206004820152601d60248201527f63616e27742073746172742061206e6577206c6f74746572792079657400000060448201526064016103e8565b6040805160008152602081019182905251610474916007916113bf565b50426009556006805460ff191690556008546040519081527ff4885742b80fc966577b7a9182bdcbd78d52622fef47fabbd28ceb2459ecf3e69060200160405180910390a1565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461054e576040517f1cf993f40000000000000000000000000000000000000000000000000000000081523360048201526001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001660248201526044016103e8565b61055882826110fa565b5050565b60008060065460ff16600281111561057657610576611532565b146105d35760405162461bcd60e51b815260206004820152602760248201527f46756e6374696f6e2063616e6e6f742062652063616c6c65642061742074686960448201526639903a34b6b29760c91b60648201526084016103e8565b600d546040516370a0823160e01b81523360048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa15801561061c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061064091906115a0565b9050600083600b5461065291906115cf565b9050808210156106b65760405162461bcd60e51b815260206004820152602960248201527f596f75206d75737420706179207468652070726f70657220616d6f756e7420666044820152681bdc881d1a58dad95d60ba1b60648201526084016103e8565b600d54604051636eb1769f60e11b81523360048201523060248201526000916001600160a01b03169063dd62ed3e90604401602060405180830381865afa158015610705573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061072991906115a0565b90508181101561077b5760405162461bcd60e51b815260206004820152601560248201527f436865636b20746f6b656e20616c6c6f77616e6365000000000000000000000060448201526064016103e8565b600d546040516323b872dd60e01b815233600482015261dead6024820152604481018490526001600160a01b03909116906323b872dd906064016020604051808303816000875af11580156107d4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107f891906115ee565b5060015b85811161087a576007805460018181019092557fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c6880180546001600160a01b031916339081179091556000908152600c602052604081208054909190610862908490611610565b9091555081905061087281611628565b9150506107fc565b5060085460405190815233907f87969bc7faf902221a147b95ceba76e011c5efb0339a0a8ee7a2bb82d9cfbbd69060200160405180910390a25050505050565b6000546001600160a01b031633146109145760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016103e8565b604051600090339047908381818185875af1925050503d8060008114610956576040519150601f19603f3d011682016040523d82523d6000602084013e61095b565b606091505b50505050565b6000546001600160a01b031633146109bb5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016103e8565b6109c56000611283565b565b6000546001600160a01b03163314610a215760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016103e8565b600d80546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b03163314610a9d5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016103e8565b600d54604080517f18160ddd00000000000000000000000000000000000000000000000000000000815290516000926001600160a01b0316916318160ddd9160048083019260209291908290030181865afa158015610b00573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b2491906115a0565b90506103e8610b348260056115cf565b610b3e9190611657565b8210610bb25760405162461bcd60e51b815260206004820152603b60248201527f536574206120726561736f6e61626c65207072696365207469636b657420636f60448201527f73742068617320746f206265206c6f776572207468656e202e3525000000000060648201526084016103e8565b50600b55565b6000546001600160a01b03163314610c125760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016103e8565b600060065460ff166002811115610c2b57610c2b611532565b14610c3557600080fd5b6006805460ff191660021790556109c56112d3565b60075460009081805b82811015610cb257846001600160a01b031660078281548110610c7857610c7861166b565b6000918252602090912001546001600160a01b031603610ca057610c9d600183611610565b91505b80610caa81611628565b915050610c53565b509392505050565b60008060065460ff166002811115610cd457610cd4611532565b14610d315760405162461bcd60e51b815260206004820152602760248201527f46756e6374696f6e2063616e6e6f742062652063616c6c65642061742074686960448201526639903a34b6b29760c91b60648201526084016103e8565b600d546040516370a0823160e01b81523360048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa158015610d7a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d9e91906115a0565b9050600b54811015610e045760405162461bcd60e51b815260206004820152602960248201527f596f75206d75737420706179207468652070726f70657220616d6f756e7420666044820152681bdc881d1a58dad95d60ba1b60648201526084016103e8565b600d54604051636eb1769f60e11b81523360048201523060248201526000916001600160a01b03169063dd62ed3e90604401602060405180830381865afa158015610e53573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e7791906115a0565b9050600b54811015610ecb5760405162461bcd60e51b815260206004820152601560248201527f436865636b20746f6b656e20616c6c6f77616e6365000000000000000000000060448201526064016103e8565b600d54600b546040516323b872dd60e01b815233600482015261dead602482015260448101919091526001600160a01b03909116906323b872dd906064016020604051808303816000875af1158015610f28573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f4c91906115ee565b506007805460018181019092557fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c6880180546001600160a01b031916339081179091556000908152600c602052604081208054909190610fac908490611610565b909155505060085460405190815233907f87969bc7faf902221a147b95ceba76e011c5efb0339a0a8ee7a2bb82d9cfbbd69060200160405180910390a2505050565b6000546001600160a01b031633146110485760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016103e8565b6001600160a01b0381166110c45760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016103e8565b6110cd81611283565b50565b600781815481106110e057600080fd5b6000918252602090912001546001600160a01b0316905081565b6000600780549050826000815181106111155761111561166b565b60200260200101516111279190611681565b90506000611136600247611657565b905060006007838154811061114d5761114d61166b565b60009182526020822001546040516001600160a01b039091169250829084908381818185875af1925050503d80600081146111a4576040519150601f19603f3d011682016040523d82523d6000602084013e6111a9565b606091505b50506006805491925060019160ff191682800217905550816001600160a01b03167f21ee4556ea7503d8f50b9e9823956fe6b20e5e343e704131bff9f777f6d2db11600854876000815181106112015761120161166b565b602090810291909101810151604080519384529183015281018790526060810186905260800160405180910390a27f8bc84e5d97533c428862626ac41fe7bc09b1ea2ed5e9e330d84092db8df1536660085460405161126291815260200190565b60405180910390a1600854611278906001611610565b600855505050505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600154600354600480546040517f5d3b1d300000000000000000000000000000000000000000000000000000000081529182019290925274010000000000000000000000000000000000000000830467ffffffffffffffff166024820152640100000000820461ffff16604482015263ffffffff8083166064830152660100000000000090920490911660848201526001600160a01b0390911690635d3b1d309060a4016020604051808303816000875af1158015611396573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113ba91906115a0565b600555565b828054828255906000526020600020908101928215611414579160200282015b8281111561141457825182546001600160a01b0319166001600160a01b039091161782556020909201916001909101906113df565b50611420929150611424565b5090565b5b808211156114205760008155600101611425565b634e487b7160e01b600052604160045260246000fd5b6000806040838503121561146257600080fd5b8235915060208084013567ffffffffffffffff8082111561148257600080fd5b818601915086601f83011261149657600080fd5b8135818111156114a8576114a8611439565b8060051b604051601f19603f830116810181811085821117156114cd576114cd611439565b6040529182528482019250838101850191898311156114eb57600080fd5b938501935b82851015611509578435845293850193928501926114f0565b8096505050505050509250929050565b60006020828403121561152b57600080fd5b5035919050565b634e487b7160e01b600052602160045260246000fd5b602081016003831061156a57634e487b7160e01b600052602160045260246000fd5b91905290565b60006020828403121561158257600080fd5b81356001600160a01b038116811461159957600080fd5b9392505050565b6000602082840312156115b257600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b60008160001904831182151516156115e9576115e96115b9565b500290565b60006020828403121561160057600080fd5b8151801515811461159957600080fd5b60008219821115611623576116236115b9565b500190565b60006001820161163a5761163a6115b9565b5060010190565b634e487b7160e01b600052601260045260246000fd5b60008261166657611666611641565b500490565b634e487b7160e01b600052603260045260246000fd5b60008261169057611690611641565b50069056fea2646970667358221220396047825832115ebfcee722f6cd398a0f14318db104cd9b7412d476ce61fc3e64736f6c634300080d00330000000000000000000000000000000000000000000000000000000000000134

Deployed Bytecode

0x6080604052600436106101485760003560e01c8063a0ede5a4116100c0578063e580f47b11610074578063edca914c11610059578063edca914c1461034a578063f2fde38b14610352578063f71d96cb1461037257600080fd5b8063e580f47b1461031e578063e89e106a1461033457600080fd5b8063bf0e6329116100a5578063bf0e63291461029f578063ccee2cec146102b5578063cdafbbb6146102d557600080fd5b8063a0ede5a41461026a578063b7d2c6541461028a57600080fd5b8063715018a61161011757806381447999116100fc57806381447999146101f15780638da5cb5b1461021857806397ca40cd1461024a57600080fd5b8063715018a6146101b3578063745d6adf146101c857600080fd5b8063160344e2146101545780631fe543e31461016b5780632f3666371461018b57806357ea89b61461019e57600080fd5b3661014f57005b600080fd5b34801561016057600080fd5b50610169610392565b005b34801561017757600080fd5b5061016961018636600461144f565b6104bb565b610169610199366004611519565b61055c565b3480156101aa57600080fd5b506101696108ba565b3480156101bf57600080fd5b50610169610961565b3480156101d457600080fd5b506101de600a5481565b6040519081526020015b60405180910390f35b3480156101fd57600080fd5b5060065461020b9060ff1681565b6040516101e89190611548565b34801561022457600080fd5b506000546001600160a01b03165b6040516001600160a01b0390911681526020016101e8565b34801561025657600080fd5b50610169610265366004611570565b6109c7565b34801561027657600080fd5b50610169610285366004611519565b610a43565b34801561029657600080fd5b50610169610bb8565b3480156102ab57600080fd5b506101de60095481565b3480156102c157600080fd5b506101de6102d0366004611570565b610c4a565b3480156102e157600080fd5b506103096102f0366004611570565b600c602052600090815260409020805460019091015482565b604080519283526020830191909152016101e8565b34801561032a57600080fd5b506101de60085481565b34801561034057600080fd5b506101de60055481565b610169610cba565b34801561035e57600080fd5b5061016961036d366004611570565b610fee565b34801561037e57600080fd5b5061023261038d366004611519565b6110d0565b6000546001600160a01b031633146103f15760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064015b60405180910390fd5b600160065460ff16600281111561040a5761040a611532565b146104575760405162461bcd60e51b815260206004820152601d60248201527f63616e27742073746172742061206e6577206c6f74746572792079657400000060448201526064016103e8565b6040805160008152602081019182905251610474916007916113bf565b50426009556006805460ff191690556008546040519081527ff4885742b80fc966577b7a9182bdcbd78d52622fef47fabbd28ceb2459ecf3e69060200160405180910390a1565b336001600160a01b037f000000000000000000000000271682deb8c4e0901d1a1550ad2e64d568e69909161461054e576040517f1cf993f40000000000000000000000000000000000000000000000000000000081523360048201526001600160a01b037f000000000000000000000000271682deb8c4e0901d1a1550ad2e64d568e699091660248201526044016103e8565b61055882826110fa565b5050565b60008060065460ff16600281111561057657610576611532565b146105d35760405162461bcd60e51b815260206004820152602760248201527f46756e6374696f6e2063616e6e6f742062652063616c6c65642061742074686960448201526639903a34b6b29760c91b60648201526084016103e8565b600d546040516370a0823160e01b81523360048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa15801561061c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061064091906115a0565b9050600083600b5461065291906115cf565b9050808210156106b65760405162461bcd60e51b815260206004820152602960248201527f596f75206d75737420706179207468652070726f70657220616d6f756e7420666044820152681bdc881d1a58dad95d60ba1b60648201526084016103e8565b600d54604051636eb1769f60e11b81523360048201523060248201526000916001600160a01b03169063dd62ed3e90604401602060405180830381865afa158015610705573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061072991906115a0565b90508181101561077b5760405162461bcd60e51b815260206004820152601560248201527f436865636b20746f6b656e20616c6c6f77616e6365000000000000000000000060448201526064016103e8565b600d546040516323b872dd60e01b815233600482015261dead6024820152604481018490526001600160a01b03909116906323b872dd906064016020604051808303816000875af11580156107d4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107f891906115ee565b5060015b85811161087a576007805460018181019092557fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c6880180546001600160a01b031916339081179091556000908152600c602052604081208054909190610862908490611610565b9091555081905061087281611628565b9150506107fc565b5060085460405190815233907f87969bc7faf902221a147b95ceba76e011c5efb0339a0a8ee7a2bb82d9cfbbd69060200160405180910390a25050505050565b6000546001600160a01b031633146109145760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016103e8565b604051600090339047908381818185875af1925050503d8060008114610956576040519150601f19603f3d011682016040523d82523d6000602084013e61095b565b606091505b50505050565b6000546001600160a01b031633146109bb5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016103e8565b6109c56000611283565b565b6000546001600160a01b03163314610a215760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016103e8565b600d80546001600160a01b0319166001600160a01b0392909216919091179055565b6000546001600160a01b03163314610a9d5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016103e8565b600d54604080517f18160ddd00000000000000000000000000000000000000000000000000000000815290516000926001600160a01b0316916318160ddd9160048083019260209291908290030181865afa158015610b00573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b2491906115a0565b90506103e8610b348260056115cf565b610b3e9190611657565b8210610bb25760405162461bcd60e51b815260206004820152603b60248201527f536574206120726561736f6e61626c65207072696365207469636b657420636f60448201527f73742068617320746f206265206c6f776572207468656e202e3525000000000060648201526084016103e8565b50600b55565b6000546001600160a01b03163314610c125760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016103e8565b600060065460ff166002811115610c2b57610c2b611532565b14610c3557600080fd5b6006805460ff191660021790556109c56112d3565b60075460009081805b82811015610cb257846001600160a01b031660078281548110610c7857610c7861166b565b6000918252602090912001546001600160a01b031603610ca057610c9d600183611610565b91505b80610caa81611628565b915050610c53565b509392505050565b60008060065460ff166002811115610cd457610cd4611532565b14610d315760405162461bcd60e51b815260206004820152602760248201527f46756e6374696f6e2063616e6e6f742062652063616c6c65642061742074686960448201526639903a34b6b29760c91b60648201526084016103e8565b600d546040516370a0823160e01b81523360048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa158015610d7a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d9e91906115a0565b9050600b54811015610e045760405162461bcd60e51b815260206004820152602960248201527f596f75206d75737420706179207468652070726f70657220616d6f756e7420666044820152681bdc881d1a58dad95d60ba1b60648201526084016103e8565b600d54604051636eb1769f60e11b81523360048201523060248201526000916001600160a01b03169063dd62ed3e90604401602060405180830381865afa158015610e53573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e7791906115a0565b9050600b54811015610ecb5760405162461bcd60e51b815260206004820152601560248201527f436865636b20746f6b656e20616c6c6f77616e6365000000000000000000000060448201526064016103e8565b600d54600b546040516323b872dd60e01b815233600482015261dead602482015260448101919091526001600160a01b03909116906323b872dd906064016020604051808303816000875af1158015610f28573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f4c91906115ee565b506007805460018181019092557fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c6880180546001600160a01b031916339081179091556000908152600c602052604081208054909190610fac908490611610565b909155505060085460405190815233907f87969bc7faf902221a147b95ceba76e011c5efb0339a0a8ee7a2bb82d9cfbbd69060200160405180910390a2505050565b6000546001600160a01b031633146110485760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016103e8565b6001600160a01b0381166110c45760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016103e8565b6110cd81611283565b50565b600781815481106110e057600080fd5b6000918252602090912001546001600160a01b0316905081565b6000600780549050826000815181106111155761111561166b565b60200260200101516111279190611681565b90506000611136600247611657565b905060006007838154811061114d5761114d61166b565b60009182526020822001546040516001600160a01b039091169250829084908381818185875af1925050503d80600081146111a4576040519150601f19603f3d011682016040523d82523d6000602084013e6111a9565b606091505b50506006805491925060019160ff191682800217905550816001600160a01b03167f21ee4556ea7503d8f50b9e9823956fe6b20e5e343e704131bff9f777f6d2db11600854876000815181106112015761120161166b565b602090810291909101810151604080519384529183015281018790526060810186905260800160405180910390a27f8bc84e5d97533c428862626ac41fe7bc09b1ea2ed5e9e330d84092db8df1536660085460405161126291815260200190565b60405180910390a1600854611278906001611610565b600855505050505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600154600354600480546040517f5d3b1d300000000000000000000000000000000000000000000000000000000081529182019290925274010000000000000000000000000000000000000000830467ffffffffffffffff166024820152640100000000820461ffff16604482015263ffffffff8083166064830152660100000000000090920490911660848201526001600160a01b0390911690635d3b1d309060a4016020604051808303816000875af1158015611396573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113ba91906115a0565b600555565b828054828255906000526020600020908101928215611414579160200282015b8281111561141457825182546001600160a01b0319166001600160a01b039091161782556020909201916001909101906113df565b50611420929150611424565b5090565b5b808211156114205760008155600101611425565b634e487b7160e01b600052604160045260246000fd5b6000806040838503121561146257600080fd5b8235915060208084013567ffffffffffffffff8082111561148257600080fd5b818601915086601f83011261149657600080fd5b8135818111156114a8576114a8611439565b8060051b604051601f19603f830116810181811085821117156114cd576114cd611439565b6040529182528482019250838101850191898311156114eb57600080fd5b938501935b82851015611509578435845293850193928501926114f0565b8096505050505050509250929050565b60006020828403121561152b57600080fd5b5035919050565b634e487b7160e01b600052602160045260246000fd5b602081016003831061156a57634e487b7160e01b600052602160045260246000fd5b91905290565b60006020828403121561158257600080fd5b81356001600160a01b038116811461159957600080fd5b9392505050565b6000602082840312156115b257600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b60008160001904831182151516156115e9576115e96115b9565b500290565b60006020828403121561160057600080fd5b8151801515811461159957600080fd5b60008219821115611623576116236115b9565b500190565b60006001820161163a5761163a6115b9565b5060010190565b634e487b7160e01b600052601260045260246000fd5b60008261166657611666611641565b500490565b634e487b7160e01b600052603260045260246000fd5b60008261169057611690611641565b50069056fea2646970667358221220396047825832115ebfcee722f6cd398a0f14318db104cd9b7412d476ce61fc3e64736f6c634300080d0033

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

0000000000000000000000000000000000000000000000000000000000000134

-----Decoded View---------------
Arg [0] : subscriptionId (uint64): 308

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


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.