ETH Price: $2,869.12 (-2.46%)

Contract

0xa203E05e09882a44aAAa6BFA076E7296935F0ce2

Overview

ETH Balance

0 ETH

ETH Value

$0.00

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Block
From
To
Deploy Wave2856637982024-12-17 9:53:19404 days ago1734429199IN
0xa203E05e...6935F0ce2
0 ETH0.00003540.01
Deploy Wave2841596242024-12-13 1:09:18409 days ago1734052158IN
0xa203E05e...6935F0ce2
0 ETH0.00009640.027426
Deploy Wave2807532312024-12-03 1:43:44419 days ago1733190224IN
0xa203E05e...6935F0ce2
0 ETH0.000040580.01
Deploy Wave2767482422024-11-21 9:53:18430 days ago1732182798IN
0xa203E05e...6935F0ce2
0 ETH0.000036590.01
Deploy Wave2767465132024-11-21 9:46:05430 days ago1732182365IN
0xa203E05e...6935F0ce2
0 ETH0.000036660.01
Deploy Wave2767453672024-11-21 9:41:18430 days ago1732182078IN
0xa203E05e...6935F0ce2
0 ETH0.000036830.01
Deploy Wave2767376132024-11-21 9:08:45430 days ago1732180125IN
0xa203E05e...6935F0ce2
0 ETH0.000036450.01
Deploy Wave2767348302024-11-21 8:57:04430 days ago1732179424IN
0xa203E05e...6935F0ce2
0 ETH0.00003670.01
Deploy Wave2766560072024-11-21 3:26:22431 days ago1732159582IN
0xa203E05e...6935F0ce2
0 ETH0.000067270.019013
Deploy Wave2766404362024-11-21 2:21:11431 days ago1732155671IN
0xa203E05e...6935F0ce2
0 ETH0.000150650.043061
Deploy Wave2711465632024-11-05 2:37:36447 days ago1730774256IN
0xa203E05e...6935F0ce2
0 ETH0.000035270.01
Deploy Wave2709076052024-11-04 9:57:03447 days ago1730714223IN
0xa203E05e...6935F0ce2
0 ETH0.000035570.01
Deploy Wave2697624702024-11-01 2:01:16451 days ago1730426476IN
0xa203E05e...6935F0ce2
0 ETH0.000055670.015721
Deploy Wave2647596732024-10-17 12:51:42465 days ago1729169502IN
0xa203E05e...6935F0ce2
0 ETH0.000041280.01
Deploy Wave2639521082024-10-15 4:28:35468 days ago1728966515IN
0xa203E05e...6935F0ce2
0 ETH0.000036060.01
Deploy Wave2615210532024-10-08 2:39:48475 days ago1728355188IN
0xa203E05e...6935F0ce2
0 ETH0.000035950.01
Deploy Wave2579992722024-09-27 20:04:54485 days ago1727467494IN
0xa203E05e...6935F0ce2
0 ETH0.000039620.01
Deploy Wave2579992202024-09-27 20:04:41485 days ago1727467481IN
0xa203E05e...6935F0ce2
0 ETH0.000039620.01
Deploy Wave2579991442024-09-27 20:04:22485 days ago1727467462IN
0xa203E05e...6935F0ce2
0 ETH0.000039520.01
Deploy Wave2579987822024-09-27 20:02:51485 days ago1727467371IN
0xa203E05e...6935F0ce2
0 ETH0.000039580.01
Deploy Wave2579987242024-09-27 20:02:36485 days ago1727467356IN
0xa203E05e...6935F0ce2
0 ETH0.000039590.01
Deploy Wave2579984662024-09-27 20:01:30485 days ago1727467290IN
0xa203E05e...6935F0ce2
0 ETH0.00003950.01
Deploy Wave2579983912024-09-27 20:01:11485 days ago1727467271IN
0xa203E05e...6935F0ce2
0 ETH0.000039620.01
Deploy Wave2579980742024-09-27 19:59:51485 days ago1727467191IN
0xa203E05e...6935F0ce2
0 ETH0.000039560.01
Deploy Wave2579979972024-09-27 19:59:32485 days ago1727467172IN
0xa203E05e...6935F0ce2
0 ETH0.000039450.01
View all transactions

Latest 25 internal transactions (View All)

Parent Transaction Hash Block From To
2856637982024-12-17 9:53:19404 days ago1734429199
0xa203E05e...6935F0ce2
 Contract Creation0 ETH
2841596242024-12-13 1:09:18409 days ago1734052158
0xa203E05e...6935F0ce2
 Contract Creation0 ETH
2807532312024-12-03 1:43:44419 days ago1733190224
0xa203E05e...6935F0ce2
 Contract Creation0 ETH
2767482422024-11-21 9:53:18430 days ago1732182798
0xa203E05e...6935F0ce2
 Contract Creation0 ETH
2767465132024-11-21 9:46:05430 days ago1732182365
0xa203E05e...6935F0ce2
 Contract Creation0 ETH
2767453672024-11-21 9:41:18430 days ago1732182078
0xa203E05e...6935F0ce2
 Contract Creation0 ETH
2767376132024-11-21 9:08:45430 days ago1732180125
0xa203E05e...6935F0ce2
 Contract Creation0 ETH
2767348302024-11-21 8:57:04430 days ago1732179424
0xa203E05e...6935F0ce2
 Contract Creation0 ETH
2766560072024-11-21 3:26:22431 days ago1732159582
0xa203E05e...6935F0ce2
 Contract Creation0 ETH
2766404362024-11-21 2:21:11431 days ago1732155671
0xa203E05e...6935F0ce2
 Contract Creation0 ETH
2711465632024-11-05 2:37:36447 days ago1730774256
0xa203E05e...6935F0ce2
 Contract Creation0 ETH
2709076052024-11-04 9:57:03447 days ago1730714223
0xa203E05e...6935F0ce2
 Contract Creation0 ETH
2697624702024-11-01 2:01:16451 days ago1730426476
0xa203E05e...6935F0ce2
 Contract Creation0 ETH
2647596732024-10-17 12:51:42465 days ago1729169502
0xa203E05e...6935F0ce2
 Contract Creation0 ETH
2639521082024-10-15 4:28:35468 days ago1728966515
0xa203E05e...6935F0ce2
 Contract Creation0 ETH
2615210532024-10-08 2:39:48475 days ago1728355188
0xa203E05e...6935F0ce2
 Contract Creation0 ETH
2579992722024-09-27 20:04:54485 days ago1727467494
0xa203E05e...6935F0ce2
 Contract Creation0 ETH
2579992202024-09-27 20:04:41485 days ago1727467481
0xa203E05e...6935F0ce2
 Contract Creation0 ETH
2579991442024-09-27 20:04:22485 days ago1727467462
0xa203E05e...6935F0ce2
 Contract Creation0 ETH
2579987822024-09-27 20:02:51485 days ago1727467371
0xa203E05e...6935F0ce2
 Contract Creation0 ETH
2579987242024-09-27 20:02:36485 days ago1727467356
0xa203E05e...6935F0ce2
 Contract Creation0 ETH
2579984662024-09-27 20:01:30485 days ago1727467290
0xa203E05e...6935F0ce2
 Contract Creation0 ETH
2579983912024-09-27 20:01:11485 days ago1727467271
0xa203E05e...6935F0ce2
 Contract Creation0 ETH
2579980742024-09-27 19:59:51485 days ago1727467191
0xa203E05e...6935F0ce2
 Contract Creation0 ETH
2579979972024-09-27 19:59:32485 days ago1727467172
0xa203E05e...6935F0ce2
 Contract Creation0 ETH
View All Internal Transactions

Cross-Chain Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
WaveFactory

Compiler Version
v0.8.21+commit.d9974bed

Optimization Enabled:
Yes with 200 runs

Other Settings:
paris EvmVersion
// SPDX-License-Identifier: GPL-2.0
pragma solidity 0.8.21;
pragma abicoder v2;

import {Ownable2Step} from "lib/openzeppelin-contracts/contracts/access/Ownable2Step.sol";
import {WaveContract} from "./WaveContract.sol";
import {IWaveFactory} from "../interfaces/IWaveFactory.sol";
import {IERC20} from "lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol";

contract WaveFactory is Ownable2Step, IWaveFactory {
    address[] public waves;
    address public keeper;
    address public trustedForwarder;
    address public verifier;
    address public raffleManager;
    mapping(address => bool) public isRaffleWave;

    error TooManyRewards();

    event WaveCreated(address indexed wave, address indexed owner);

    constructor(address _keeper, address _trustedForwarder, address _verifier, address _raffleManager) Ownable2Step() {
        keeper = _keeper;
        trustedForwarder = _trustedForwarder;
        verifier = _verifier;
        raffleManager = _raffleManager;
    }

    /// @dev changes the keeper associated with the factory
    /// @param _keeper address of the new keeper
    function changeKeeper(address _keeper) public onlyOwner {
        keeper = _keeper;
    }

    /// @dev changes the trusted forwarder for EIP-2771 meta transactions
    /// @param _trustedForwarder address of the new trusted forwarder
    function changeTrustedForwarder(address _trustedForwarder) public onlyOwner {
        trustedForwarder = _trustedForwarder;
    }

    /// @dev changes the verifier for EIP-712 signatures
    /// @param _verifier address of the new verifier
    function changeVerifier(address _verifier) public onlyOwner {
        verifier = _verifier;
    }

    /// @dev changes the raffle manager for the factory
    /// @param _raffleManager address of the new raffle manager
    function changeRaffleManager(address _raffleManager) public onlyOwner {
        raffleManager = _raffleManager;
    }

    /// @inheritdoc IWaveFactory
    function deployWave(
        string memory _name,
        string memory _symbol,
        string memory _baseURI,
        uint256 _startTimestamp,
        uint256 _endTimestamp,
        bool _isSoulbound,
        IWaveFactory.TokenRewards memory _tokenRewards
    ) public {
        WaveContract wave = new WaveContract(
            _name, _symbol, _baseURI, _startTimestamp, _endTimestamp, _isSoulbound, trustedForwarder, _tokenRewards
        );

        waves.push(address(wave));
        wave.transferOwnership(msg.sender);

        if (_tokenRewards.isRaffle) {
            isRaffleWave[address(wave)] = true;
        }

        if (_tokenRewards.token != address(0)) {
            _initiateRewards(_tokenRewards, address(wave));
        }

        emit WaveCreated(address(wave), msg.sender);
    }

    /// @notice funds the campaign with the specified token rewards
    /// @param _tokenRewards array of token rewards
    /// @param wave address of the campaign
    function _initiateRewards(IWaveFactory.TokenRewards memory _tokenRewards, address wave) internal {
        IERC20(_tokenRewards.token).transferFrom(
            msg.sender, wave, _tokenRewards.amountPerUser * _tokenRewards.rewardsLeft
        );
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable2Step.sol)

pragma solidity ^0.8.0;

import "./Ownable.sol";

/**
 * @dev Contract module which provides 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} and {acceptOwnership}.
 *
 * This module is used through inheritance. It will make available all functions
 * from parent (Ownable).
 */
abstract contract Ownable2Step is Ownable {
    address private _pendingOwner;

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

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

    /**
     * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual override onlyOwner {
        _pendingOwner = newOwner;
        emit OwnershipTransferStarted(owner(), newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual override {
        delete _pendingOwner;
        super._transferOwnership(newOwner);
    }

    /**
     * @dev The new owner accepts the ownership transfer.
     */
    function acceptOwnership() public virtual {
        address sender = _msgSender();
        require(pendingOwner() == sender, "Ownable2Step: caller is not the new owner");
        _transferOwnership(sender);
    }
}

// SPDX-License-Identifier: GPL-2.0
pragma solidity 0.8.21;
pragma abicoder v2;

import {Strings} from "lib/openzeppelin-contracts/contracts/utils/Strings.sol";
import {Ownable} from "lib/openzeppelin-contracts/contracts/access/Ownable.sol";
import {ERC2771Context, Context} from "lib/openzeppelin-contracts/contracts/metatx/ERC2771Context.sol";
import {IWaveFactory} from "../interfaces/IWaveFactory.sol";
import {IWaveContract} from "../interfaces/IWaveContract.sol";
import {IRaffleManager} from "../interfaces/IRaffleManager.sol";
import {ERC721} from "lib/openzeppelin-contracts/contracts/token/ERC721/ERC721.sol";
import {IERC20} from "lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol";
import {SafeERC20} from "lib/openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol";
import {ReentrancyGuard} from "lib/openzeppelin-contracts/contracts/security/ReentrancyGuard.sol";
import {SignatureVerifier} from "../helpers/SignatureVerifier.sol";

contract WaveContract is ERC2771Context, Ownable, ERC721, SignatureVerifier, ReentrancyGuard, IWaveContract {
    using SafeERC20 for IERC20;

    IWaveFactory public factory;

    struct TokenRewardInfo {
        bool hasWon;
        bool hasAlreadyClaimed;
        bool isDisqualified;
    }

    uint256 public lastId;
    uint256 public startTimestamp;
    uint256 public endTimestamp;
    uint256 public deployedTimestamp;
    uint256 public mintsPerClaim = 1;
    uint256 public randomNumber;
    uint256 public raffleWithdrawableAmount;
    uint256 public constant TOKEN_LOCK_TIME = 60 * 60 * 24 * 365;

    string _metadataBaseURI;

    bool public customMetadata;
    bool public isSoulbound;
    bool public isERC20Campaign;
    bool public raffleCompleted;
    bool public shouldVerifySignature = true;

    mapping(address => bool) _claimed;
    mapping(uint256 => TokenRewardInfo) public tokenIdToTokenRewardInfo;
    uint256 public disqualifiedTokenIdsCount;

    IWaveFactory.TokenRewards public tokenRewards;

    error OnlyRaffleFulfillers();
    error OnlyAuthorized();
    error OnlyGovernance();
    error InvalidTimings();
    error CampaignNotActive();
    error CampaignNotEnded();
    error RewardAlreadyClaimed();
    error PermitDeadlineExpired();
    error NotTransferrable();

    event Claimed(address indexed user, uint256 indexed tokenId);
    event FCFSAwarded(address indexed user, address indexed token, uint256 amount);
    event RaffleWon(uint256 indexed tokenId, address indexed token, uint256 amount);
    event RaffleWithdrawn(address indexed user, address indexed token, uint256 amount);
    event RaffleStarted(address indexed user);
    event RaffleCompleted();
    event CampaignForceEnded();
    event FundsWithdrawn(address indexed token, uint256 indexed amount);

    modifier onlyGovernance() {
        if (_msgSender() != factory.keeper()) {
            revert OnlyGovernance();
        }
        _;
    }

    modifier onlyAuthorized() {
        if (_msgSender() != factory.keeper() && _msgSender() != owner()) {
            revert OnlyAuthorized();
        }
        _;
    }

    modifier onlyRaffleFulfillers() {
        if (_msgSender() != factory.raffleManager() && _msgSender() != factory.keeper() && _msgSender() != owner()) {
            revert OnlyRaffleFulfillers();
        }
        _;
    }

    modifier onlyActive() {
        if (block.timestamp < startTimestamp || block.timestamp > endTimestamp) {
            revert CampaignNotActive();
        }
        _;
    }

    modifier onlyEnded() {
        if (block.timestamp < endTimestamp) revert CampaignNotEnded();
        _;
    }

    constructor(
        string memory _name,
        string memory _symbol,
        string memory _uri,
        uint256 _startTimestamp,
        uint256 _endTimestamp,
        bool _isSoulbound,
        address _trustedForwarder,
        IWaveFactory.TokenRewards memory _tokenRewards
    ) ERC2771Context(_trustedForwarder) Ownable() ERC721(_name, _symbol) SignatureVerifier(_name) {
        if (_startTimestamp > _endTimestamp || _endTimestamp < block.timestamp) {
            revert InvalidTimings();
        }

        factory = IWaveFactory(_msgSender());
        _metadataBaseURI = _uri;

        if (_startTimestamp < block.timestamp) {
            startTimestamp = block.timestamp;
        } else {
            startTimestamp = _startTimestamp;
        }
        endTimestamp = _endTimestamp;
        deployedTimestamp = block.timestamp;
        isSoulbound = _isSoulbound;
        tokenRewards = _tokenRewards;

        if (_tokenRewards.token != address(0)) {
            isERC20Campaign = true;
        }
    }

    /// @inheritdoc IWaveContract
    function changeBaseURI(string calldata _uri, bool _customMetadata) public onlyAuthorized {
        _metadataBaseURI = _uri;
        customMetadata = _customMetadata;
    }

    /// @inheritdoc IWaveContract
    function setStartTimestamp(uint256 _startTimestamp) public onlyAuthorized {
        require(block.timestamp < _startTimestamp && _startTimestamp < endTimestamp, "Invalid start timestamp");
        startTimestamp = _startTimestamp;
    }

    /// @inheritdoc IWaveContract
    function setEndTimestamp(uint256 _endTimestamp) public onlyAuthorized {
        /// @dev the wave should end before the contract deployment + 1 year and after the start timestamp
        require(
            _endTimestamp > block.timestamp && _endTimestamp > startTimestamp
                && _endTimestamp < deployedTimestamp + 31536000,
            "Invalid end timestamp"
        );
        endTimestamp = _endTimestamp;
    }

    /// @dev set the `shouldVerifySignature` boolean
    function setVerifySignature(bool _shouldVerifySignature) public onlyGovernance {
        shouldVerifySignature = _shouldVerifySignature;
    }

    /// @dev change the number of mints per claim with the specified number
    function setMintsPerClaim(uint256 _mintsPerClaim) public onlyGovernance {
        mintsPerClaim = _mintsPerClaim;
    }

    /// @inheritdoc IWaveContract
    function endCampaign() public onlyActive onlyAuthorized {
        endTimestamp = block.timestamp;
        emit CampaignForceEnded();
    }

    /// @inheritdoc IWaveContract
    function withdrawFunds() public onlyEnded onlyAuthorized {
        IERC20 token = IERC20(tokenRewards.token);
        uint256 amount = token.balanceOf(address(this));

        // after TOKEN_LOCK_TIME, unclaimed tokens become withdrawable by the owner
        if (tokenRewards.isRaffle && block.timestamp < endTimestamp + TOKEN_LOCK_TIME) {
            amount = raffleWithdrawableAmount;
            raffleWithdrawableAmount = 0;
        }

        _returnTokenToOwner(token, amount);
    }

    /// @notice allow to disqualify or requalify the `tokenIds` to win raffle rewards
    /// @param tokenIds the token ids to disqualify or requalify
    /// @param areDisqualified whether `tokenIds` should be disqualified or requalified
    function qualifyTokenIds(uint256[] calldata tokenIds, bool areDisqualified) public onlyAuthorized {
        require(tokenRewards.isRaffle, "Can qualify token ids only if raffle wave");
        uint256 changedUsersCount;

        for (uint256 i = 0; i < tokenIds.length; i++) {
            uint256 tokenId = tokenIds[i];
            require(tokenId != 0 && tokenId <= lastId, "Invalid tokenId to qualify");
            // @dev increment the counter only if
            // the tokenId is not alredy set with the right qualification
            if (tokenIdToTokenRewardInfo[tokenId].isDisqualified != areDisqualified) {
                tokenIdToTokenRewardInfo[tokenId].isDisqualified = areDisqualified;
                changedUsersCount++;
            }
        }

        disqualifiedTokenIdsCount = areDisqualified
            ? disqualifiedTokenIdsCount + changedUsersCount
            : disqualifiedTokenIdsCount - changedUsersCount;
    }

    /// @inheritdoc IWaveContract
    function claim(uint256 deadline, uint8 v, bytes32 r, bytes32 s) public virtual onlyActive {
        if (_claimed[_msgSender()]) {
            revert RewardAlreadyClaimed();
        }
        if (block.timestamp > deadline) revert PermitDeadlineExpired();

        if (shouldVerifySignature) {
            _verifySignature(_msgSender(), deadline, v, r, s, factory.verifier());
        }

        for (uint256 i = 0; i < mintsPerClaim; i++) {
            _mintBadge(_msgSender());
        }

        if (isERC20Campaign && !tokenRewards.isRaffle) {
            _emitERC20Rewards(_msgSender());
        }
    }

    /// @inheritdoc IWaveContract
    function startRaffle() public onlyEnded {
        require(!raffleCompleted, "Raffle already done");
        require(tokenRewards.isRaffle, "Not a raffle wave");

        emit RaffleStarted(_msgSender());
        address raffleManager = factory.raffleManager();
        IRaffleManager(raffleManager).makeRequestUint256();
    }

    /// @inheritdoc IWaveContract
    function fulfillRaffle(uint256 _randomNumber) public onlyEnded onlyRaffleFulfillers {
        require(randomNumber == 0, "Random number has already been extracted");
        require(_randomNumber != 0, "Random number extracted cant be 0");
        randomNumber = _randomNumber;
    }

    /// @inheritdoc IWaveContract
    function executeRaffle() public onlyEnded {
        require(!raffleCompleted, "Raffle already done");
        require(randomNumber != 0, "Random number was not extracted yet");

        uint256 rewardsLeft = tokenRewards.rewardsLeft;

        uint256 eligibleTokenIdsCount = lastId - disqualifiedTokenIdsCount;
        uint256 rewardsToAssign = eligibleTokenIdsCount < rewardsLeft ? eligibleTokenIdsCount : rewardsLeft;

        uint256 counter = 0;

        for (uint256 assigned = 0; assigned < rewardsToAssign; assigned++) {
            uint256 tokenId;
            do {
                tokenId = (uint256(keccak256(abi.encodePacked(randomNumber, counter))) % lastId) + 1;
                counter++;
                // @dev skip disqualified users
                if (tokenIdToTokenRewardInfo[tokenId].isDisqualified) continue;
            } while (tokenIdToTokenRewardInfo[tokenId].hasWon);

            emit RaffleWon(tokenId, tokenRewards.token, tokenRewards.amountPerUser);
            tokenIdToTokenRewardInfo[tokenId].hasWon = true;
        }

        uint256 tokenBalance = IERC20(tokenRewards.token).balanceOf(address(this));

        // if there are leftover tokens from rewards assignment, project can withdraw them
        raffleWithdrawableAmount = tokenBalance - rewardsToAssign * tokenRewards.amountPerUser;

        raffleCompleted = true;
        emit RaffleCompleted();
    }

    /// @inheritdoc IWaveContract
    function withdrawTokenReward(uint256 tokenId) public onlyEnded nonReentrant {
        require(isERC20Campaign, "Not an ERC20 campaign");
        require(raffleCompleted, "Raffle not completed yet");
        require(tokenRewards.isRaffle, "Not a raffle wave");
        require(tokenId != 0 && tokenId <= lastId, "Invalid tokenId to withdraw");
        address winner = ownerOf(tokenId);
        require(_msgSender() == winner, "Only token owner can withdraw the reward");
        require(tokenIdToTokenRewardInfo[tokenId].hasWon, "Token has not won the raffle");
        require(tokenIdToTokenRewardInfo[tokenId].hasAlreadyClaimed == false, "Token has already claimed the reward");

        address tokenAddress = tokenRewards.token;
        uint256 amountPerUser = tokenRewards.amountPerUser;
        IERC20 token = IERC20(tokenAddress);
        token.safeTransfer(winner, amountPerUser);

        tokenIdToTokenRewardInfo[tokenId].hasAlreadyClaimed = true;
        emit RaffleWithdrawn(winner, tokenAddress, amountPerUser);
    }

    /// @notice returns the URI for a given token ID
    /// @param tokenId The token ID to get the URI for
    /// @return string The URI for the given token ID
    function tokenURI(uint256 tokenId) public view override returns (string memory) {
        _requireMinted(tokenId);
        return customMetadata
            ? string(abi.encodePacked(_metadataBaseURI, "/", Strings.toString(tokenId), ".json"))
            : string(abi.encodePacked(_metadataBaseURI, "/metadata.json"));
    }

    /// @dev override the transfer function to allow transfers only if not soulbound
    /// @param from The address to transfer from
    /// @param to The address to transfer to
    /// @param tokenId The token ID to transfer
    function _transfer(address from, address to, uint256 tokenId) internal override {
        if (isSoulbound) revert NotTransferrable();
        super._transfer(from, to, tokenId);
    }

    /// @dev internal function to mint a reward for a user
    /// @param user The user to mint the reward for
    function _mintBadge(address user) internal {
        _claimed[user] = true;
        _safeMint(user, ++lastId);
        emit Claimed(user, lastId);
    }

    ///@dev use ERC2771Context to get msg data
    ///@return bytes calldata
    function _msgData() internal view override(ERC2771Context, Context) returns (bytes calldata) {
        return ERC2771Context._msgData();
    }

    ///@dev use ERC2771Context to get msg sender
    ///@return address sender
    function _msgSender() internal view override(ERC2771Context, Context) returns (address) {
        return ERC2771Context._msgSender();
    }

    /// @dev internal function to emit the first FCFS ERC20 reward available
    /// @param claimer The address to emit the rewards to
    function _emitERC20Rewards(address claimer) internal {
        IERC20 token = IERC20(tokenRewards.token);
        uint256 amountPerUser = tokenRewards.amountPerUser;
        bool enoughBalance = amountPerUser <= token.balanceOf(address(this));

        if (tokenRewards.rewardsLeft != 0 && enoughBalance) {
            token.safeTransfer(claimer, amountPerUser);
            emit FCFSAwarded(claimer, tokenRewards.token, amountPerUser);
            tokenRewards.rewardsLeft--;
        }
    }

    /// @dev internal function to call when withdrawing funds after campaign is ended
    /// @param token the token address of which balance has to be returned to the owner
    function _returnTokenToOwner(IERC20 token, uint256 amount) internal {
        if (amount != 0) {
            token.safeTransfer(owner(), amount);
        }
        emit FundsWithdrawn(address(token), amount);
    }

    function _isGovernance() internal view returns (bool) {
        return _msgSender() == factory.keeper();
    }
}

// SPDX-License-Identifier: GPL-2.0
pragma solidity 0.8.21;
pragma abicoder v2;

interface IWaveFactory {
    struct TokenRewards {
        uint256 rewardsLeft;
        uint256 amountPerUser;
        address token;
        bool isRaffle;
    }

    /// @notice deploys a new campaign
    /// @param _name name of the campaign
    /// @param _symbol symbol of the campaign
    /// @param _baseURI base URI of the ERC-721 metadata
    /// @param _startTimestamp start timestamp of the campaign
    /// @param _endTimestamp end timestamp of the campaign
    /// @param _isSoulbound whether the wave badges will be soulbound
    /// @param _tokenRewards rewards in ERC20 tokens
    function deployWave(
        string memory _name,
        string memory _symbol,
        string memory _baseURI,
        uint256 _startTimestamp,
        uint256 _endTimestamp,
        bool _isSoulbound,
        IWaveFactory.TokenRewards memory _tokenRewards
    ) external;

    function keeper() external view returns (address);

    function verifier() external view returns (address);

    function raffleManager() external view returns (address);

    function isRaffleWave(address) external view returns (bool);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.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);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (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 Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

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

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby disabling 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);
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)

pragma solidity ^0.8.0;

import "./math/Math.sol";
import "./math/SignedMath.sol";

/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant _SYMBOLS = "0123456789abcdef";
    uint8 private constant _ADDRESS_LENGTH = 20;

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        unchecked {
            uint256 length = Math.log10(value) + 1;
            string memory buffer = new string(length);
            uint256 ptr;
            /// @solidity memory-safe-assembly
            assembly {
                ptr := add(buffer, add(32, length))
            }
            while (true) {
                ptr--;
                /// @solidity memory-safe-assembly
                assembly {
                    mstore8(ptr, byte(mod(value, 10), _SYMBOLS))
                }
                value /= 10;
                if (value == 0) break;
            }
            return buffer;
        }
    }

    /**
     * @dev Converts a `int256` to its ASCII `string` decimal representation.
     */
    function toString(int256 value) internal pure returns (string memory) {
        return string(abi.encodePacked(value < 0 ? "-" : "", toString(SignedMath.abs(value))));
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        unchecked {
            return toHexString(value, Math.log256(value) + 1);
        }
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
     */
    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
        bytes memory buffer = new bytes(2 * length + 2);
        buffer[0] = "0";
        buffer[1] = "x";
        for (uint256 i = 2 * length + 1; i > 1; --i) {
            buffer[i] = _SYMBOLS[value & 0xf];
            value >>= 4;
        }
        require(value == 0, "Strings: hex length insufficient");
        return string(buffer);
    }

    /**
     * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
     */
    function toHexString(address addr) internal pure returns (string memory) {
        return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
    }

    /**
     * @dev Returns true if the two strings are equal.
     */
    function equal(string memory a, string memory b) internal pure returns (bool) {
        return keccak256(bytes(a)) == keccak256(bytes(b));
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (metatx/ERC2771Context.sol)

pragma solidity ^0.8.9;

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

/**
 * @dev Context variant with ERC2771 support.
 */
abstract contract ERC2771Context is Context {
    /// @custom:oz-upgrades-unsafe-allow state-variable-immutable
    address private immutable _trustedForwarder;

    /// @custom:oz-upgrades-unsafe-allow constructor
    constructor(address trustedForwarder) {
        _trustedForwarder = trustedForwarder;
    }

    function isTrustedForwarder(address forwarder) public view virtual returns (bool) {
        return forwarder == _trustedForwarder;
    }

    function _msgSender() internal view virtual override returns (address sender) {
        if (isTrustedForwarder(msg.sender)) {
            // The assembly code is more direct than the Solidity version using `abi.decode`.
            /// @solidity memory-safe-assembly
            assembly {
                sender := shr(96, calldataload(sub(calldatasize(), 20)))
            }
        } else {
            return super._msgSender();
        }
    }

    function _msgData() internal view virtual override returns (bytes calldata) {
        if (isTrustedForwarder(msg.sender)) {
            return msg.data[:msg.data.length - 20];
        } else {
            return super._msgData();
        }
    }
}

// SPDX-License-Identifier: GPL-2.0
pragma solidity 0.8.21;
pragma abicoder v2;

interface IWaveContract {
    /// @notice Allows the governance to set metadata base URI for all tokens
    /// @param _uri The base URI to set
    /// @param _customMetadata Whether the metadata is encoded with tokenId
    function changeBaseURI(string memory _uri, bool _customMetadata) external;

    /// @notice Allows the owner to set the campaign start timestamp
    function setStartTimestamp(uint256 _startTimestamp) external;

    /// @notice Allows the governance to set the campaign end timestamp
    function setEndTimestamp(uint256 _endTimestamp) external;

    /// @notice Allows the owner to end the campaign early
    function endCampaign() external;

    /// @notice Allows to withdraw funds if certain conditions are met
    function withdrawFunds() external;

    /// @notice Execute the mint with permit by verifying the off-chain verifier signature
    /// @param deadline The deadline for the permit
    /// @param v The v component of the signature
    /// @param r The r component of the signature
    /// @param s The s component of the signature
    function claim(uint256 deadline, uint8 v, bytes32 r, bytes32 s) external;

    /// @notice sends a request for random numbers to the raffle manager
    function startRaffle() external;

    /// @notice saves the random number in the contract storage
    /// @param randomNumber the random number to use for the raffle
    function fulfillRaffle(uint256 randomNumber) external;

    /// @notice execute the raffle using the saved random number
    /// and emitting the tokens. Then, returns the remaining funds for raffle rewards
    /// to the owner
    /// @dev the set of winning token ids per reward is generated by the single
    /// random number previously provided by the raffle manager
    function executeRaffle() external;

    /// @notice Allows user that own a token to withdraw the reward
    /// if they are the winners of the raffle
    /// @param tokenId the token id to withdraw the reward for
    function withdrawTokenReward(uint256 tokenId) external;
}

//SPDX-License-Identifier: MIT
pragma solidity 0.8.21;

interface IRaffleManager {
    /// @notice Sets parameters used in requesting QRNG services
    /// @param _airnode Airnode address
    /// @param _endpointIdUint256Array Endpoint ID used to request a `uint256[]`
    /// @param _sponsor address used to sponsor this requester
    /// @param _sponsorWallet Sponsor wallet address
    function setRequestParameters(
        address _airnode,
        bytes32 _endpointIdUint256Array,
        address _sponsor,
        address _sponsorWallet
    ) external;

    /// @notice Requests a `uint256`
    /// @return requestId the 32 bytes of the request id
    function makeRequestUint256() external returns (bytes32 requestId);

    /// @notice Called by the Airnode through the AirnodeRrp contract to
    /// fulfill the request
    /// @param requestId Request ID
    /// @param data ABI-encoded response
    function fulfillUint256(bytes32 requestId, bytes calldata data) external;
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/ERC721.sol)

pragma solidity ^0.8.0;

import "./IERC721.sol";
import "./IERC721Receiver.sol";
import "./extensions/IERC721Metadata.sol";
import "../../utils/Address.sol";
import "../../utils/Context.sol";
import "../../utils/Strings.sol";
import "../../utils/introspection/ERC165.sol";

/**
 * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including
 * the Metadata extension, but not including the Enumerable extension, which is available separately as
 * {ERC721Enumerable}.
 */
contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
    using Address for address;
    using Strings for uint256;

    // Token name
    string private _name;

    // Token symbol
    string private _symbol;

    // Mapping from token ID to owner address
    mapping(uint256 => address) private _owners;

    // Mapping owner address to token count
    mapping(address => uint256) private _balances;

    // Mapping from token ID to approved address
    mapping(uint256 => address) private _tokenApprovals;

    // Mapping from owner to operator approvals
    mapping(address => mapping(address => bool)) private _operatorApprovals;

    /**
     * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection.
     */
    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
        return
            interfaceId == type(IERC721).interfaceId ||
            interfaceId == type(IERC721Metadata).interfaceId ||
            super.supportsInterface(interfaceId);
    }

    /**
     * @dev See {IERC721-balanceOf}.
     */
    function balanceOf(address owner) public view virtual override returns (uint256) {
        require(owner != address(0), "ERC721: address zero is not a valid owner");
        return _balances[owner];
    }

    /**
     * @dev See {IERC721-ownerOf}.
     */
    function ownerOf(uint256 tokenId) public view virtual override returns (address) {
        address owner = _ownerOf(tokenId);
        require(owner != address(0), "ERC721: invalid token ID");
        return owner;
    }

    /**
     * @dev See {IERC721Metadata-name}.
     */
    function name() public view virtual override returns (string memory) {
        return _name;
    }

    /**
     * @dev See {IERC721Metadata-symbol}.
     */
    function symbol() public view virtual override returns (string memory) {
        return _symbol;
    }

    /**
     * @dev See {IERC721Metadata-tokenURI}.
     */
    function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
        _requireMinted(tokenId);

        string memory baseURI = _baseURI();
        return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : "";
    }

    /**
     * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each
     * token will be the concatenation of the `baseURI` and the `tokenId`. Empty
     * by default, can be overridden in child contracts.
     */
    function _baseURI() internal view virtual returns (string memory) {
        return "";
    }

    /**
     * @dev See {IERC721-approve}.
     */
    function approve(address to, uint256 tokenId) public virtual override {
        address owner = ERC721.ownerOf(tokenId);
        require(to != owner, "ERC721: approval to current owner");

        require(
            _msgSender() == owner || isApprovedForAll(owner, _msgSender()),
            "ERC721: approve caller is not token owner or approved for all"
        );

        _approve(to, tokenId);
    }

    /**
     * @dev See {IERC721-getApproved}.
     */
    function getApproved(uint256 tokenId) public view virtual override returns (address) {
        _requireMinted(tokenId);

        return _tokenApprovals[tokenId];
    }

    /**
     * @dev See {IERC721-setApprovalForAll}.
     */
    function setApprovalForAll(address operator, bool approved) public virtual override {
        _setApprovalForAll(_msgSender(), operator, approved);
    }

    /**
     * @dev See {IERC721-isApprovedForAll}.
     */
    function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
        return _operatorApprovals[owner][operator];
    }

    /**
     * @dev See {IERC721-transferFrom}.
     */
    function transferFrom(address from, address to, uint256 tokenId) public virtual override {
        //solhint-disable-next-line max-line-length
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not token owner or approved");

        _transfer(from, to, tokenId);
    }

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(address from, address to, uint256 tokenId) public virtual override {
        safeTransferFrom(from, to, tokenId, "");
    }

    /**
     * @dev See {IERC721-safeTransferFrom}.
     */
    function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public virtual override {
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not token owner or approved");
        _safeTransfer(from, to, tokenId, data);
    }

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
     * are aware of the ERC721 protocol to prevent tokens from being forever locked.
     *
     * `data` is additional data, it has no specified format and it is sent in call to `to`.
     *
     * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g.
     * implement alternative mechanisms to perform token transfer, such as signature-based.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeTransfer(address from, address to, uint256 tokenId, bytes memory data) internal virtual {
        _transfer(from, to, tokenId);
        require(_checkOnERC721Received(from, to, tokenId, data), "ERC721: transfer to non ERC721Receiver implementer");
    }

    /**
     * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist
     */
    function _ownerOf(uint256 tokenId) internal view virtual returns (address) {
        return _owners[tokenId];
    }

    /**
     * @dev Returns whether `tokenId` exists.
     *
     * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}.
     *
     * Tokens start existing when they are minted (`_mint`),
     * and stop existing when they are burned (`_burn`).
     */
    function _exists(uint256 tokenId) internal view virtual returns (bool) {
        return _ownerOf(tokenId) != address(0);
    }

    /**
     * @dev Returns whether `spender` is allowed to manage `tokenId`.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {
        address owner = ERC721.ownerOf(tokenId);
        return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);
    }

    /**
     * @dev Safely mints `tokenId` and transfers it to `to`.
     *
     * Requirements:
     *
     * - `tokenId` must not exist.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function _safeMint(address to, uint256 tokenId) internal virtual {
        _safeMint(to, tokenId, "");
    }

    /**
     * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is
     * forwarded in {IERC721Receiver-onERC721Received} to contract recipients.
     */
    function _safeMint(address to, uint256 tokenId, bytes memory data) internal virtual {
        _mint(to, tokenId);
        require(
            _checkOnERC721Received(address(0), to, tokenId, data),
            "ERC721: transfer to non ERC721Receiver implementer"
        );
    }

    /**
     * @dev Mints `tokenId` and transfers it to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible
     *
     * Requirements:
     *
     * - `tokenId` must not exist.
     * - `to` cannot be the zero address.
     *
     * Emits a {Transfer} event.
     */
    function _mint(address to, uint256 tokenId) internal virtual {
        require(to != address(0), "ERC721: mint to the zero address");
        require(!_exists(tokenId), "ERC721: token already minted");

        _beforeTokenTransfer(address(0), to, tokenId, 1);

        // Check that tokenId was not minted by `_beforeTokenTransfer` hook
        require(!_exists(tokenId), "ERC721: token already minted");

        unchecked {
            // Will not overflow unless all 2**256 token ids are minted to the same owner.
            // Given that tokens are minted one by one, it is impossible in practice that
            // this ever happens. Might change if we allow batch minting.
            // The ERC fails to describe this case.
            _balances[to] += 1;
        }

        _owners[tokenId] = to;

        emit Transfer(address(0), to, tokenId);

        _afterTokenTransfer(address(0), to, tokenId, 1);
    }

    /**
     * @dev Destroys `tokenId`.
     * The approval is cleared when the token is burned.
     * This is an internal function that does not check if the sender is authorized to operate on the token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     *
     * Emits a {Transfer} event.
     */
    function _burn(uint256 tokenId) internal virtual {
        address owner = ERC721.ownerOf(tokenId);

        _beforeTokenTransfer(owner, address(0), tokenId, 1);

        // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook
        owner = ERC721.ownerOf(tokenId);

        // Clear approvals
        delete _tokenApprovals[tokenId];

        unchecked {
            // Cannot overflow, as that would require more tokens to be burned/transferred
            // out than the owner initially received through minting and transferring in.
            _balances[owner] -= 1;
        }
        delete _owners[tokenId];

        emit Transfer(owner, address(0), tokenId);

        _afterTokenTransfer(owner, address(0), tokenId, 1);
    }

    /**
     * @dev Transfers `tokenId` from `from` to `to`.
     *  As opposed to {transferFrom}, this imposes no restrictions on msg.sender.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     *
     * Emits a {Transfer} event.
     */
    function _transfer(address from, address to, uint256 tokenId) internal virtual {
        require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner");
        require(to != address(0), "ERC721: transfer to the zero address");

        _beforeTokenTransfer(from, to, tokenId, 1);

        // Check that tokenId was not transferred by `_beforeTokenTransfer` hook
        require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner");

        // Clear approvals from the previous owner
        delete _tokenApprovals[tokenId];

        unchecked {
            // `_balances[from]` cannot overflow for the same reason as described in `_burn`:
            // `from`'s balance is the number of token held, which is at least one before the current
            // transfer.
            // `_balances[to]` could overflow in the conditions described in `_mint`. That would require
            // all 2**256 token ids to be minted, which in practice is impossible.
            _balances[from] -= 1;
            _balances[to] += 1;
        }
        _owners[tokenId] = to;

        emit Transfer(from, to, tokenId);

        _afterTokenTransfer(from, to, tokenId, 1);
    }

    /**
     * @dev Approve `to` to operate on `tokenId`
     *
     * Emits an {Approval} event.
     */
    function _approve(address to, uint256 tokenId) internal virtual {
        _tokenApprovals[tokenId] = to;
        emit Approval(ERC721.ownerOf(tokenId), to, tokenId);
    }

    /**
     * @dev Approve `operator` to operate on all of `owner` tokens
     *
     * Emits an {ApprovalForAll} event.
     */
    function _setApprovalForAll(address owner, address operator, bool approved) internal virtual {
        require(owner != operator, "ERC721: approve to caller");
        _operatorApprovals[owner][operator] = approved;
        emit ApprovalForAll(owner, operator, approved);
    }

    /**
     * @dev Reverts if the `tokenId` has not been minted yet.
     */
    function _requireMinted(uint256 tokenId) internal view virtual {
        require(_exists(tokenId), "ERC721: invalid token ID");
    }

    /**
     * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address.
     * The call is not executed if the target address is not a contract.
     *
     * @param from address representing the previous owner of the given token ID
     * @param to target address that will receive the tokens
     * @param tokenId uint256 ID of the token to be transferred
     * @param data bytes optional data to send along with the call
     * @return bool whether the call correctly returned the expected magic value
     */
    function _checkOnERC721Received(
        address from,
        address to,
        uint256 tokenId,
        bytes memory data
    ) private returns (bool) {
        if (to.isContract()) {
            try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) {
                return retval == IERC721Receiver.onERC721Received.selector;
            } catch (bytes memory reason) {
                if (reason.length == 0) {
                    revert("ERC721: transfer to non ERC721Receiver implementer");
                } else {
                    /// @solidity memory-safe-assembly
                    assembly {
                        revert(add(32, reason), mload(reason))
                    }
                }
            }
        } else {
            return true;
        }
    }

    /**
     * @dev Hook that is called before any token transfer. This includes minting and burning. If {ERC721Consecutive} is
     * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.
     *
     * Calling conditions:
     *
     * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`.
     * - When `from` is zero, the tokens will be minted for `to`.
     * - When `to` is zero, ``from``'s tokens will be burned.
     * - `from` and `to` are never both zero.
     * - `batchSize` is non-zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _beforeTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}

    /**
     * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is
     * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1.
     *
     * Calling conditions:
     *
     * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`.
     * - When `from` is zero, the tokens were minted for `to`.
     * - When `to` is zero, ``from``'s tokens were burned.
     * - `from` and `to` are never both zero.
     * - `batchSize` is non-zero.
     *
     * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
     */
    function _afterTokenTransfer(address from, address to, uint256 firstTokenId, uint256 batchSize) internal virtual {}

    /**
     * @dev Unsafe write access to the balances, used by extensions that "mint" tokens using an {ownerOf} override.
     *
     * WARNING: Anyone calling this MUST ensure that the balances remain consistent with the ownership. The invariant
     * being that for any address `a` the value returned by `balanceOf(a)` must be equal to the number of tokens such
     * that `ownerOf(tokenId)` is `a`.
     */
    // solhint-disable-next-line func-name-mixedcase
    function __unsafe_increaseBalance(address account, uint256 amount) internal {
        _balances[account] += amount;
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../extensions/IERC20Permit.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;

    /**
     * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeTransfer(IERC20 token, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    /**
     * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
     * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
     */
    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));
    }

    /**
     * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 oldAllowance = token.allowance(address(this), spender);
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));
    }

    /**
     * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    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");
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));
        }
    }

    /**
     * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful. Compatible with tokens that require the approval to be set to
     * 0 before setting it to a non-zero value.
     */
    function forceApprove(IERC20 token, address spender, uint256 value) internal {
        bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);

        if (!_callOptionalReturnBool(token, approvalCall)) {
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));
            _callOptionalReturn(token, approvalCall);
        }
    }

    /**
     * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.
     * Revert on invalid signature.
     */
    function safePermit(
        IERC20Permit token,
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal {
        uint256 nonceBefore = token.nonces(owner);
        token.permit(owner, spender, value, deadline, v, r, s);
        uint256 nonceAfter = token.nonces(owner);
        require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
    }

    /**
     * @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");
        require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
    }

    /**
     * @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).
     *
     * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
     */
    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
        // 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 cannot use {Address-functionCall} here since this should return false
        // and not revert is the subcall reverts.

        (bool success, bytes memory returndata) = address(token).call(data);
        return
            success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (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() {
        _nonReentrantBefore();
        _;
        _nonReentrantAfter();
    }

    function _nonReentrantBefore() private {
        // On the first call to nonReentrant, _status will be _NOT_ENTERED
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

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

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

    /**
     * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
     * `nonReentrant` function in the call stack.
     */
    function _reentrancyGuardEntered() internal view returns (bool) {
        return _status == _ENTERED;
    }
}

// SPDX-License-Identifier: GPL-2.0
pragma solidity 0.8.21;
pragma abicoder v2;

import {IERC721} from "../../lib/openzeppelin-contracts/contracts/token/ERC721/IERC721.sol";

contract SignatureVerifier {
    struct Permit {
        address spender;
        uint256 deadline;
        address wave;
    }

    bytes32 public immutable DOMAIN_SEPARATOR;
    bytes32 public immutable PERMIT_TYPEHASH;

    error InvalidSignature();

    constructor(string memory _name) {
        DOMAIN_SEPARATOR = _computeDomainSeparator(bytes(_name));
        PERMIT_TYPEHASH = keccak256("Permit(address spender,uint256 deadline,address wave)");
    }

    /// @dev reverts if that the message was not signed by the verifier or if the deadline is passed
    /// @param sender transaction sender
    /// @param deadline signature deadline
    /// @param v v component of the signed message
    /// @param r r component of the signed message
    /// @param s s component of the signed message
    /// @param verifier address of the verifier
    function _verifySignature(address sender, uint256 deadline, uint8 v, bytes32 r, bytes32 s, address verifier)
        internal
        view
    {
        bytes32 typedDataHash = getTypedDataHash(Permit(sender, deadline, address(this)));
        address recoveredAddress = ecrecover(_prefixed(typedDataHash), v, r, s);

        if (recoveredAddress == address(0) || recoveredAddress != verifier) revert InvalidSignature();
    }

    /// @dev computes the hash of the fully encoded EIP-712 message for the domain,
    /// which can be used to recover the signer
    /// @param _permit The permit struct
    /// @return bytes32 The hash of the fully encoded EIP-712 message for the domain
    function getTypedDataHash(Permit memory _permit) public view returns (bytes32) {
        return keccak256(abi.encodePacked("\x19\x01", DOMAIN_SEPARATOR, _getStructHash(_permit)));
    }

    /// @dev returns the domain separator for the contract
    /// @param _name The name of the contract
    /// @return bytes32 The domain separator for the contract
    function _computeDomainSeparator(bytes memory _name) internal view virtual returns (bytes32) {
        return keccak256(
            abi.encode(
                keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"),
                keccak256(_name),
                keccak256("1"),
                block.chainid,
                address(this)
            )
        );
    }

    /// @dev computes the hash of a permit struct
    /// @param _permit The permit struct
    /// @return bytes32 The hash of the permit struct
    function _getStructHash(Permit memory _permit) internal view returns (bytes32) {
        return keccak256(abi.encode(PERMIT_TYPEHASH, _permit.spender, _permit.deadline));
    }

    /// @dev Builds a prefixed hash to mimic the behavior of eth_sign.
    /// @param hash The hash to prefix
    /// @return bytes32 The prefixed hash
    function _prefixed(bytes32 hash) internal pure returns (bytes32) {
        return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash));
    }
}

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)

pragma solidity ^0.8.0;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    enum Rounding {
        Down, // Toward negative infinity
        Up, // Toward infinity
        Zero // Toward zero
    }

    /**
     * @dev Returns the largest of two numbers.
     */
    function max(uint256 a, uint256 b) internal pure returns (uint256) {
        return a > b ? a : b;
    }

    /**
     * @dev Returns the smallest of two numbers.
     */
    function min(uint256 a, uint256 b) internal pure returns (uint256) {
        return a < b ? a : b;
    }

    /**
     * @dev Returns the average of two numbers. The result is rounded towards
     * zero.
     */
    function average(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b) / 2 can overflow.
        return (a & b) + (a ^ b) / 2;
    }

    /**
     * @dev Returns the ceiling of the division of two numbers.
     *
     * This differs from standard division with `/` in that it rounds up instead
     * of rounding down.
     */
    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b - 1) / b can overflow on addition, so we distribute.
        return a == 0 ? 0 : (a - 1) / b + 1;
    }

    /**
     * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
     * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
     * with further edits by Uniswap Labs also under MIT license.
     */
    function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {
        unchecked {
            // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
            // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
            // variables such that product = prod1 * 2^256 + prod0.
            uint256 prod0; // Least significant 256 bits of the product
            uint256 prod1; // Most significant 256 bits of the product
            assembly {
                let mm := mulmod(x, y, not(0))
                prod0 := mul(x, y)
                prod1 := sub(sub(mm, prod0), lt(mm, prod0))
            }

            // Handle non-overflow cases, 256 by 256 division.
            if (prod1 == 0) {
                // Solidity will revert if denominator == 0, unlike the div opcode on its own.
                // The surrounding unchecked block does not change this fact.
                // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
                return prod0 / denominator;
            }

            // Make sure the result is less than 2^256. Also prevents denominator == 0.
            require(denominator > prod1, "Math: mulDiv overflow");

            ///////////////////////////////////////////////
            // 512 by 256 division.
            ///////////////////////////////////////////////

            // Make division exact by subtracting the remainder from [prod1 prod0].
            uint256 remainder;
            assembly {
                // Compute remainder using mulmod.
                remainder := mulmod(x, y, denominator)

                // Subtract 256 bit number from 512 bit number.
                prod1 := sub(prod1, gt(remainder, prod0))
                prod0 := sub(prod0, remainder)
            }

            // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
            // See https://cs.stackexchange.com/q/138556/92363.

            // Does not overflow because the denominator cannot be zero at this stage in the function.
            uint256 twos = denominator & (~denominator + 1);
            assembly {
                // Divide denominator by twos.
                denominator := div(denominator, twos)

                // Divide [prod1 prod0] by twos.
                prod0 := div(prod0, twos)

                // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
                twos := add(div(sub(0, twos), twos), 1)
            }

            // Shift in bits from prod1 into prod0.
            prod0 |= prod1 * twos;

            // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
            // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
            // four bits. That is, denominator * inv = 1 mod 2^4.
            uint256 inverse = (3 * denominator) ^ 2;

            // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
            // in modular arithmetic, doubling the correct bits in each step.
            inverse *= 2 - denominator * inverse; // inverse mod 2^8
            inverse *= 2 - denominator * inverse; // inverse mod 2^16
            inverse *= 2 - denominator * inverse; // inverse mod 2^32
            inverse *= 2 - denominator * inverse; // inverse mod 2^64
            inverse *= 2 - denominator * inverse; // inverse mod 2^128
            inverse *= 2 - denominator * inverse; // inverse mod 2^256

            // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
            // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
            // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
            // is no longer required.
            result = prod0 * inverse;
            return result;
        }
    }

    /**
     * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
     */
    function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {
        uint256 result = mulDiv(x, y, denominator);
        if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
            result += 1;
        }
        return result;
    }

    /**
     * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.
     *
     * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
     */
    function sqrt(uint256 a) internal pure returns (uint256) {
        if (a == 0) {
            return 0;
        }

        // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
        //
        // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
        // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
        //
        // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
        // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
        // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
        //
        // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
        uint256 result = 1 << (log2(a) >> 1);

        // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
        // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
        // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
        // into the expected uint128 result.
        unchecked {
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            return min(result, a / result);
        }
    }

    /**
     * @notice Calculates sqrt(a), following the selected rounding direction.
     */
    function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = sqrt(a);
            return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 2, rounded down, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 128;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 64;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 32;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 16;
            }
            if (value >> 8 > 0) {
                value >>= 8;
                result += 8;
            }
            if (value >> 4 > 0) {
                value >>= 4;
                result += 4;
            }
            if (value >> 2 > 0) {
                value >>= 2;
                result += 2;
            }
            if (value >> 1 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 2, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log2(value);
            return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 10, rounded down, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >= 10 ** 64) {
                value /= 10 ** 64;
                result += 64;
            }
            if (value >= 10 ** 32) {
                value /= 10 ** 32;
                result += 32;
            }
            if (value >= 10 ** 16) {
                value /= 10 ** 16;
                result += 16;
            }
            if (value >= 10 ** 8) {
                value /= 10 ** 8;
                result += 8;
            }
            if (value >= 10 ** 4) {
                value /= 10 ** 4;
                result += 4;
            }
            if (value >= 10 ** 2) {
                value /= 10 ** 2;
                result += 2;
            }
            if (value >= 10 ** 1) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log10(value);
            return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 256, rounded down, of a positive value.
     * Returns 0 if given 0.
     *
     * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
     */
    function log256(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 16;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 8;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 4;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 2;
            }
            if (value >> 8 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 256, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log256(value);
            return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);
        }
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)

pragma solidity ^0.8.0;

/**
 * @dev Standard signed math utilities missing in the Solidity language.
 */
library SignedMath {
    /**
     * @dev Returns the largest of two signed numbers.
     */
    function max(int256 a, int256 b) internal pure returns (int256) {
        return a > b ? a : b;
    }

    /**
     * @dev Returns the smallest of two signed numbers.
     */
    function min(int256 a, int256 b) internal pure returns (int256) {
        return a < b ? a : b;
    }

    /**
     * @dev Returns the average of two signed numbers without overflow.
     * The result is rounded towards zero.
     */
    function average(int256 a, int256 b) internal pure returns (int256) {
        // Formula from the book "Hacker's Delight"
        int256 x = (a & b) + ((a ^ b) >> 1);
        return x + (int256(uint256(x) >> 255) & (a ^ b));
    }

    /**
     * @dev Returns the absolute unsigned value of a signed value.
     */
    function abs(int256 n) internal pure returns (uint256) {
        unchecked {
            // must be unchecked in order to support `n = type(int256).min`
            return uint256(n >= 0 ? n : -n);
        }
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)

pragma solidity ^0.8.0;

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

/**
 * @dev Required interface of an ERC721 compliant contract.
 */
interface IERC721 is IERC165 {
    /**
     * @dev Emitted when `tokenId` token is transferred from `from` to `to`.
     */
    event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
     */
    event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
     */
    event ApprovalForAll(address indexed owner, address indexed operator, bool approved);

    /**
     * @dev Returns the number of tokens in ``owner``'s account.
     */
    function balanceOf(address owner) external view returns (uint256 balance);

    /**
     * @dev Returns the owner of the `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function ownerOf(uint256 tokenId) external view returns (address owner);

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
     * are aware of the ERC721 protocol to prevent tokens from being forever locked.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(address from, address to, uint256 tokenId) external;

    /**
     * @dev Transfers `tokenId` token from `from` to `to`.
     *
     * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721
     * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must
     * understand this adds an external call which potentially creates a reentrancy vulnerability.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address from, address to, uint256 tokenId) external;

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

    /**
     * @dev Approve or remove `operator` as an operator for the caller.
     * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
     *
     * Requirements:
     *
     * - The `operator` cannot be the caller.
     *
     * Emits an {ApprovalForAll} event.
     */
    function setApprovalForAll(address operator, bool approved) external;

    /**
     * @dev Returns the account approved for `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function getApproved(uint256 tokenId) external view returns (address operator);

    /**
     * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
     *
     * See {setApprovalForAll}
     */
    function isApprovedForAll(address owner, address operator) external view returns (bool);
}

File 19 of 24 : IERC721Receiver.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)

pragma solidity ^0.8.0;

/**
 * @title ERC721 token receiver interface
 * @dev Interface for any contract that wants to support safeTransfers
 * from ERC721 asset contracts.
 */
interface IERC721Receiver {
    /**
     * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
     * by `operator` from `from`, this function is called.
     *
     * It must return its Solidity selector to confirm the token transfer.
     * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
     *
     * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.
     */
    function onERC721Received(
        address operator,
        address from,
        uint256 tokenId,
        bytes calldata data
    ) external returns (bytes4);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol)

pragma solidity ^0.8.0;

import "../IERC721.sol";

/**
 * @title ERC-721 Non-Fungible Token Standard, optional metadata extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721Metadata is IERC721 {
    /**
     * @dev Returns the token collection name.
     */
    function name() external view returns (string memory);

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

    /**
     * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
     */
    function tokenURI(uint256 tokenId) external view returns (string memory);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @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
     *
     * Furthermore, `isContract` will also return true if the target contract within
     * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
     * which only has an effect at the end of a transaction.
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 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://consensys.net/diligence/blog/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.8.0/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 functionCallWithValue(target, data, 0, "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");
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, 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) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResultFromTarget(target, 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) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
     * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
     *
     * _Available since v4.8._
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        if (success) {
            if (returndata.length == 0) {
                // only check isContract if the call was successful and the return data is empty
                // otherwise we already know that it was a contract
                require(isContract(target), "Address: call to non-contract");
            }
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason or 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 {
            _revert(returndata, errorMessage);
        }
    }

    function _revert(bytes memory returndata, string memory errorMessage) private pure {
        // 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
            /// @solidity memory-safe-assembly
            assembly {
                let returndata_size := mload(returndata)
                revert(add(32, returndata), returndata_size)
            }
        } else {
            revert(errorMessage);
        }
    }
}

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

pragma solidity ^0.8.0;

import "./IERC165.sol";

/**
 * @dev Implementation of the {IERC165} interface.
 *
 * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
 * for the additional interface id that will be supported. For example:
 *
 * ```solidity
 * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
 *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
 * }
 * ```
 *
 * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
 */
abstract contract ERC165 is IERC165 {
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IERC165).interfaceId;
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 */
interface IERC20Permit {
    /**
     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
     * given ``owner``'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    /**
     * @dev Returns the current nonce for `owner`. This value must be
     * included whenever a signature is generated for {permit}.
     *
     * Every successful call to {permit} increases ``owner``'s nonce by one. This
     * prevents a signature from being used multiple times.
     */
    function nonces(address owner) external view returns (uint256);

    /**
     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view returns (bytes32);
}

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

pragma solidity ^0.8.0;

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

Settings
{
  "remappings": [
    "@openzeppelin/=lib/openzeppelin-contracts/",
    "airnode/=lib/airnode/",
    "ds-test/=lib/forge-std/lib/ds-test/src/",
    "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
    "forge-std/=lib/forge-std/src/",
    "openzeppelin-contracts/=lib/openzeppelin-contracts/",
    "openzeppelin/=lib/openzeppelin-contracts/contracts/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "metadata": {
    "useLiteralContent": false,
    "bytecodeHash": "ipfs",
    "appendCBOR": true
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "paris",
  "viaIR": false,
  "libraries": {}
}

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"address","name":"_keeper","type":"address"},{"internalType":"address","name":"_trustedForwarder","type":"address"},{"internalType":"address","name":"_verifier","type":"address"},{"internalType":"address","name":"_raffleManager","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"TooManyRewards","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferStarted","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":true,"internalType":"address","name":"wave","type":"address"},{"indexed":true,"internalType":"address","name":"owner","type":"address"}],"name":"WaveCreated","type":"event"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_keeper","type":"address"}],"name":"changeKeeper","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_raffleManager","type":"address"}],"name":"changeRaffleManager","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_trustedForwarder","type":"address"}],"name":"changeTrustedForwarder","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_verifier","type":"address"}],"name":"changeVerifier","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"},{"internalType":"string","name":"_baseURI","type":"string"},{"internalType":"uint256","name":"_startTimestamp","type":"uint256"},{"internalType":"uint256","name":"_endTimestamp","type":"uint256"},{"internalType":"bool","name":"_isSoulbound","type":"bool"},{"components":[{"internalType":"uint256","name":"rewardsLeft","type":"uint256"},{"internalType":"uint256","name":"amountPerUser","type":"uint256"},{"internalType":"address","name":"token","type":"address"},{"internalType":"bool","name":"isRaffle","type":"bool"}],"internalType":"struct IWaveFactory.TokenRewards","name":"_tokenRewards","type":"tuple"}],"name":"deployWave","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isRaffleWave","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"keeper","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"raffleManager","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"trustedForwarder","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"verifier","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"waves","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

608060405234801561001057600080fd5b5060405162004f3b38038062004f3b83398101604081905261003191610115565b61003a3361008d565b600380546001600160a01b039586166001600160a01b0319918216179091556004805494861694821694909417909355600580549285169284169290921790915560068054919093169116179055610169565b600180546001600160a01b03191690556100a6816100a9565b50565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80516001600160a01b038116811461011057600080fd5b919050565b6000806000806080858703121561012b57600080fd5b610134856100f9565b9350610142602086016100f9565b9250610150604086016100f9565b915061015e606086016100f9565b905092959194509250565b614dc280620001796000396000f3fe60806040523480156200001157600080fd5b5060043610620001155760003560e01c8063aa6527d911620000a3578063cf04fb94116200006e578063cf04fb941462000242578063d3f8a33a1462000259578063e30c39781462000270578063f2fde38b146200028257600080fd5b8063aa6527d914620001cc578063aced166114620001e0578063b553469914620001f4578063c781267a146200022b57600080fd5b8063715018a611620000e4578063715018a6146200019257806379ba5097146200019c5780637da0a87714620001a65780638da5cb5b14620001ba57600080fd5b806304056c12146200011a57806308c7a8dd146200013357806309779838146200014a5780632b7ac3f31462000161575b600080fd5b620001316200012b36600462000862565b62000299565b005b62000131620001443660046200099c565b62000428565b620001316200015b3660046200099c565b62000454565b60055462000175906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b6200013162000480565b6200013162000498565b60045462000175906001600160a01b031681565b6000546001600160a01b031662000175565b60065462000175906001600160a01b031681565b60035462000175906001600160a01b031681565b6200021a620002053660046200099c565b60076020526000908152604090205460ff1681565b604051901515815260200162000189565b620001756200023c366004620009c1565b6200051a565b62000131620002533660046200099c565b62000545565b620001316200026a3660046200099c565b62000571565b6001546001600160a01b031662000175565b62000131620002933660046200099c565b6200059d565b6000878787878787600460009054906101000a90046001600160a01b031688604051620002c6906200077d565b620002d998979695949392919062000a23565b604051809103906000f080158015620002f6573d6000803e3d6000fd5b50600280546001810182556000919091527f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace0180546001600160a01b0319166001600160a01b03831690811790915560405163f2fde38b60e01b81523360048201529192509063f2fde38b90602401600060405180830381600087803b1580156200038057600080fd5b505af115801562000395573d6000803e3d6000fd5b50505050816060015115620003c8576001600160a01b0381166000908152600760205260409020805460ff191660011790555b60408201516001600160a01b031615620003e857620003e8828262000611565b60405133906001600160a01b038316907fb49597eb6ae32b938af897f271f3c6f6448014880f91ccee242476f2db9af06c90600090a35050505050505050565b62000432620006bc565b600480546001600160a01b0319166001600160a01b0392909216919091179055565b6200045e620006bc565b600380546001600160a01b0319166001600160a01b0392909216919091179055565b6200048a620006bc565b62000496600062000718565b565b60015433906001600160a01b031681146200050c5760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b60648201526084015b60405180910390fd5b620005178162000718565b50565b600281815481106200052b57600080fd5b6000918252602090912001546001600160a01b0316905081565b6200054f620006bc565b600580546001600160a01b0319166001600160a01b0392909216919091179055565b6200057b620006bc565b600680546001600160a01b0319166001600160a01b0392909216919091179055565b620005a7620006bc565b600180546001600160a01b0383166001600160a01b03199091168117909155620005d96000546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b81604001516001600160a01b03166323b872dd3383856000015186602001516200063c919062000ac7565b6040516001600160e01b031960e086901b1681526001600160a01b03938416600482015292909116602483015260448201526064016020604051808303816000875af115801562000691573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620006b7919062000af3565b505050565b6000546001600160a01b03163314620004965760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640162000503565b600180546001600160a01b03191690556200051781600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6142798062000b1483390190565b634e487b7160e01b600052604160045260246000fd5b600082601f830112620007b357600080fd5b813567ffffffffffffffff80821115620007d157620007d16200078b565b604051601f8301601f19908116603f01168101908282118183101715620007fc57620007fc6200078b565b816040528381528660208588010111156200081657600080fd5b836020870160208301376000602085830101528094505050505092915050565b80151581146200051757600080fd5b80356001600160a01b03811681146200085d57600080fd5b919050565b60008060008060008060008789036101408112156200088057600080fd5b883567ffffffffffffffff808211156200089957600080fd5b620008a78c838d01620007a1565b995060208b0135915080821115620008be57600080fd5b620008cc8c838d01620007a1565b985060408b0135915080821115620008e357600080fd5b620008f18c838d01620007a1565b975060608b0135965060808b0135955060a08b01359150620009138262000836565b819450608060bf19840112156200092957600080fd5b604051925060808301915082821081831117156200094b576200094b6200078b565b5060405260c0890135815260e089013560208201526200096f6101008a0162000845565b6040820152610120890135620009858162000836565b806060830152508091505092959891949750929550565b600060208284031215620009af57600080fd5b620009ba8262000845565b9392505050565b600060208284031215620009d457600080fd5b5035919050565b6000815180845260005b8181101562000a0357602081850181015186830182015201620009e5565b506000602082860101526020601f19601f83011685010191505092915050565b600061016080835262000a398184018c620009db565b9050828103602084015262000a4f818b620009db565b9050828103604084015262000a65818a620009db565b6060848101999099526080840197909752505092151560a08401526001600160a01b0391821660c0840152805160e084015260208101516101008401526040810151909116610120830152909201511515610140909201919091529392505050565b808202811582820484141762000aed57634e487b7160e01b600052601160045260246000fd5b92915050565b60006020828403121562000b0657600080fd5b8151620009ba816200083656fe60e06040526001600d556011805460ff60201b19166401000000001790553480156200002a57600080fd5b5060405162004279380380620042798339810160408190526200004d9162000461565b6001600160a01b038216608052878088620000716200006b620001d2565b620001e3565b60016200007f8382620005ce565b5060026200008e8282620005ce565b505050620000a2816200023360201b60201c565b60a052507fe2d15b1b8b219df1de91adda0da74db4530273a2a7be5c582902b7ccfdf7fb8a60c052600160075583851180620000dd57504284105b15620000fc5760405163c6e369f960e01b815260040160405180910390fd5b62000106620001d2565b600880546001600160a01b0319166001600160a01b03929092169190911790556010620001348782620005ce565b5042851015620001485742600a556200014e565b600a8590555b600b84905542600c55601180548415156101000261ff00199091161790558051601555602081015160165560408101516017805460608401511515600160a01b026001600160a81b03199091166001600160a01b0390931692831717905515620001c4576011805462ff00001916620100001790555b50505050505050506200069a565b6000620001de620002ba565b905090565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b8051602091820120604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f81850152808201929092527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608301524660808301523060a0808401919091528151808403909101815260c09092019052805191012090565b6080516000906001600160a01b03163303620002dd575060131936013560601c90565b503390565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715620003235762000323620002e2565b604052919050565b600082601f8301126200033d57600080fd5b81516001600160401b03811115620003595762000359620002e2565b60206200036f601f8301601f19168201620002f8565b82815285828487010111156200038457600080fd5b60005b83811015620003a457858101830151828201840152820162000387565b506000928101909101919091529392505050565b80518015158114620003c957600080fd5b919050565b80516001600160a01b0381168114620003c957600080fd5b600060808284031215620003f957600080fd5b604051608081016001600160401b03811182821017156200041e576200041e620002e2565b806040525080915082518152602083015160208201526200044260408401620003ce565b60408201526200045560608401620003b8565b60608201525092915050565b600080600080600080600080610160898b0312156200047f57600080fd5b88516001600160401b03808211156200049757600080fd5b620004a58c838d016200032b565b995060208b0151915080821115620004bc57600080fd5b620004ca8c838d016200032b565b985060408b0151915080821115620004e157600080fd5b50620004f08b828c016200032b565b96505060608901519450608089015193506200050f60a08a01620003b8565b92506200051f60c08a01620003ce565b9150620005308a60e08b01620003e6565b90509295985092959890939650565b600181811c908216806200055457607f821691505b6020821081036200057557634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115620005c957600081815260208120601f850160051c81016020861015620005a45750805b601f850160051c820191505b81811015620005c557828155600101620005b0565b5050505b505050565b81516001600160401b03811115620005ea57620005ea620002e2565b6200060281620005fb84546200053f565b846200057b565b602080601f8311600181146200063a5760008415620006215750858301515b600019600386901b1c1916600185901b178555620005c5565b600085815260208120601f198616915b828110156200066b578886015182559484019460019091019084016200064a565b50858210156200068a5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60805160a05160c051613b9a620006df6000396000818161043d015261287e01526000818161046401526119b101526000818161051a0152612a580152613b9a6000f3fe608060405234801561001057600080fd5b50600436106102d65760003560e01c80637df6a6c811610182578063c87b56dd116100e9578063e6fd48bc116100a2578063f2fde38b1161007c578063f2fde38b146106f3578063f7eca6d014610706578063fb16fb7214610718578063fdc48e311461072057600080fd5b8063e6fd48bc146106a5578063e985e9c5146106ae578063efb596a0146106ea57600080fd5b8063c87b56dd14610650578063ccbac9f514610663578063cea3bdfd1461066c578063d5c688d61461067f578063d7cb697014610693578063e6bbe4241461069c57600080fd5b8063a22cb4651161013b578063a22cb465146105f2578063a85adeab14610605578063b88d4fde1461060e578063c1292cc314610621578063c44bef751461062a578063c45a01551461063d57600080fd5b80637df6a6c8146105935780638a06e013146105a65780638da5cb5b146105b957806395d89b41146105ca57806398428dbf146105d257806399178408146105df57600080fd5b806324600fc3116102415780635576b871116101fa57806370a08231116101d457806370a082311461055d578063715018a61461057057806371aac7f91461057857806378ce8b401461058057600080fd5b80635576b871146104f7578063572b6c051461050a5780636352211e1461054a57600080fd5b806324600fc31461043057806330adf81f146104385780633644e5151461045f578063394c99f41461048657806342842e0e146104db578063482ddde2146104ee57600080fd5b80630ba0f2ae116102935780630ba0f2ae146103c35780631278e00a146103d657806315043931146103e957806322868fbe146103fc57806323b872dd14610415578063242284f11461042857600080fd5b806301ffc9a7146102db57806304386f521461030357806306fdde0314610318578063081812fc1461032d578063091c76f514610358578063095ea7b3146103b0575b600080fd5b6102ee6102e9366004613262565b610735565b60405190151581526020015b60405180910390f35b610316610311366004613286565b610787565b005b61032061083b565b6040516102fa91906132ef565b61034061033b366004613286565b6108cd565b6040516001600160a01b0390911681526020016102fa565b60155460165460175461037f9291906001600160a01b03811690600160a01b900460ff1684565b6040516102fa949392919093845260208401929092526001600160a01b031660408301521515606082015260800190565b6103166103be366004613317565b6108f4565b6011546102ee9062010000900460ff1681565b6103166103e4366004613343565b610a20565b6103166103f7366004613286565b610bc2565b6104076301e1338081565b6040519081526020016102fa565b610316610423366004613386565b610f28565b610316610f60565b610316611135565b6104077f000000000000000000000000000000000000000000000000000000000000000081565b6104077f000000000000000000000000000000000000000000000000000000000000000081565b6104bc610494366004613286565b60136020526000908152604090205460ff808216916101008104821691620100009091041683565b60408051931515845291151560208401521515908201526060016102fa565b6103166104e9366004613386565b6112e7565b610407600d5481565b6103166105053660046133d5565b611302565b6102ee6105183660046133f2565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0390811691161490565b610340610558366004613286565b6113d1565b61040761056b3660046133f2565b611431565b6103166114b7565b6103166114cb565b61031661058e36600461340f565b611601565b6103166105a1366004613286565b611861565b6104076105b43660046134dc565b6119ad565b6000546001600160a01b0316610340565b610320611a15565b6011546102ee9060ff1681565b6103166105ed366004613545565b611a24565b6103166106003660046135a7565b611b1f565b610407600b5481565b61031661061c3660046135e0565b611b31565b61040760095481565b610316610638366004613286565b611b6a565b600854610340906001600160a01b031681565b61032061065e366004613286565b611ca3565b610407600e5481565b61031661067a366004613286565b611d0f565b6011546102ee906301000000900460ff1681565b61040760145481565b610407600c5481565b610407600a5481565b6102ee6106bc3660046136a4565b6001600160a01b03918216600090815260066020908152604080832093909416825291909152205460ff1690565b610407600f5481565b6103166107013660046133f2565b611f65565b6011546102ee90610100900460ff1681565b610316611fdb565b6011546102ee90640100000000900460ff1681565b60006001600160e01b031982166380ac58cd60e01b148061076657506001600160e01b03198216635b5e139f60e01b145b8061078157506301ffc9a760e01b6001600160e01b03198316145b92915050565b600860009054906101000a90046001600160a01b03166001600160a01b031663aced16616040518163ffffffff1660e01b8152600401602060405180830381865afa1580156107da573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107fe91906136d2565b6001600160a01b031661080f612294565b6001600160a01b031614610836576040516354348f0360e01b815260040160405180910390fd5b600d55565b60606001805461084a906136ef565b80601f0160208091040260200160405190810160405280929190818152602001828054610876906136ef565b80156108c35780601f10610898576101008083540402835291602001916108c3565b820191906000526020600020905b8154815290600101906020018083116108a657829003601f168201915b5050505050905090565b60006108d8826122a3565b506000908152600560205260409020546001600160a01b031690565b60006108ff826113d1565b9050806001600160a01b0316836001600160a01b0316036109715760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084015b60405180910390fd5b806001600160a01b0316610983612294565b6001600160a01b0316148061099f575061099f816106bc612294565b610a115760405162461bcd60e51b815260206004820152603d60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c0000006064820152608401610968565b610a1b8383612302565b505050565b600a54421080610a315750600b5442115b15610a4f5760405163219a945b60e11b815260040160405180910390fd5b60126000610a5b612294565b6001600160a01b0316815260208101919091526040016000205460ff1615610a9657604051632cfe303760e21b815260040160405180910390fd5b83421115610ab7576040516305787bdf60e01b815260040160405180910390fd5b601154640100000000900460ff1615610b5557610b55610ad5612294565b85858585600860009054906101000a90046001600160a01b03166001600160a01b0316632b7ac3f36040518163ffffffff1660e01b8152600401602060405180830381865afa158015610b2c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b5091906136d2565b612370565b60005b600d54811015610b8457610b72610b6d612294565b612461565b80610b7c8161373f565b915050610b58565b5060115462010000900460ff168015610ba75750601754600160a01b900460ff16155b15610bbc57610bbc610bb7612294565b6124dc565b50505050565b600b54421015610be55760405163cc76115360e01b815260040160405180910390fd5b610bed6125dd565b60115462010000900460ff16610c3d5760405162461bcd60e51b81526020600482015260156024820152742737ba1030b71022a92199181031b0b6b830b4b3b760591b6044820152606401610968565b6011546301000000900460ff16610c965760405162461bcd60e51b815260206004820152601860248201527f526166666c65206e6f7420636f6d706c657465642079657400000000000000006044820152606401610968565b601754600160a01b900460ff16610ce35760405162461bcd60e51b81526020600482015260116024820152704e6f74206120726166666c65207761766560781b6044820152606401610968565b8015801590610cf457506009548111155b610d405760405162461bcd60e51b815260206004820152601b60248201527f496e76616c696420746f6b656e496420746f20776974686472617700000000006044820152606401610968565b6000610d4b826113d1565b9050806001600160a01b0316610d5f612294565b6001600160a01b031614610dc65760405162461bcd60e51b815260206004820152602860248201527f4f6e6c7920746f6b656e206f776e65722063616e20776974686472617720746860448201526719481c995dd85c9960c21b6064820152608401610968565b60008281526013602052604090205460ff16610e245760405162461bcd60e51b815260206004820152601c60248201527f546f6b656e20686173206e6f7420776f6e2074686520726166666c65000000006044820152606401610968565b600082815260136020526040902054610100900460ff1615610e945760405162461bcd60e51b8152602060048201526024808201527f546f6b656e2068617320616c726561647920636c61696d6564207468652072656044820152631dd85c9960e21b6064820152608401610968565b6017546016546001600160a01b039091169081610eb2818584612636565b60008581526013602052604090819020805461ff001916610100179055516001600160a01b0380851691908616907f808814f761e5bc2d39ba59152df35a813dcc50deb49d1978d94831ba68f9154990610f0f9086815260200190565b60405180910390a350505050610f256001600755565b50565b610f39610f33612294565b82612688565b610f555760405162461bcd60e51b815260040161096890613758565b610a1b838383612707565b600b54421015610f835760405163cc76115360e01b815260040160405180910390fd5b6011546301000000900460ff1615610fd35760405162461bcd60e51b8152602060048201526013602482015272526166666c6520616c726561647920646f6e6560681b6044820152606401610968565b601754600160a01b900460ff166110205760405162461bcd60e51b81526020600482015260116024820152704e6f74206120726166666c65207761766560781b6044820152606401610968565b611028612294565b6001600160a01b03167fe5ed10a2abb6a808edb6fbb7ae5cd09aad196ddaa1bd4e9295688a4d508460c860405160405180910390a26008546040805163aa6527d960e01b815290516000926001600160a01b03169163aa6527d99160048083019260209291908290030181865afa1580156110a7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110cb91906136d2565b9050806001600160a01b031663dea12bad6040518163ffffffff1660e01b81526004016020604051808303816000875af115801561110d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061113191906137a5565b5050565b600b544210156111585760405163cc76115360e01b815260040160405180910390fd5b600860009054906101000a90046001600160a01b03166001600160a01b031663aced16616040518163ffffffff1660e01b8152600401602060405180830381865afa1580156111ab573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111cf91906136d2565b6001600160a01b03166111e0612294565b6001600160a01b03161415801561121257506000546001600160a01b0316611206612294565b6001600160a01b031614155b1561123057604051637d7b71b560e01b815260040160405180910390fd5b6017546040516370a0823160e01b81523060048201526001600160a01b039091169060009082906370a0823190602401602060405180830381865afa15801561127d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112a191906137a5565b601754909150600160a01b900460ff1680156112cd57506301e13380600b546112ca91906137be565b42105b156112dd5750600f805460009091555b611131828261273b565b610a1b83838360405180602001604052806000815250611b31565b600860009054906101000a90046001600160a01b03166001600160a01b031663aced16616040518163ffffffff1660e01b8152600401602060405180830381865afa158015611355573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061137991906136d2565b6001600160a01b031661138a612294565b6001600160a01b0316146113b1576040516354348f0360e01b815260040160405180910390fd5b601180549115156401000000000264ff0000000019909216919091179055565b6000818152600360205260408120546001600160a01b0316806107815760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b6044820152606401610968565b60006001600160a01b03821661149b5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b6064820152608401610968565b506001600160a01b031660009081526004602052604090205490565b6114bf6127a1565b6114c9600061281a565b565b600a544210806114dc5750600b5442115b156114fa5760405163219a945b60e11b815260040160405180910390fd5b600860009054906101000a90046001600160a01b03166001600160a01b031663aced16616040518163ffffffff1660e01b8152600401602060405180830381865afa15801561154d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061157191906136d2565b6001600160a01b0316611582612294565b6001600160a01b0316141580156115b457506000546001600160a01b03166115a8612294565b6001600160a01b031614155b156115d257604051637d7b71b560e01b815260040160405180910390fd5b42600b556040517f434b671a95fb0071b0127874981939c3cd42e8f1f7d602b761482102d4a5507290600090a1565b600860009054906101000a90046001600160a01b03166001600160a01b031663aced16616040518163ffffffff1660e01b8152600401602060405180830381865afa158015611654573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061167891906136d2565b6001600160a01b0316611689612294565b6001600160a01b0316141580156116bb57506000546001600160a01b03166116af612294565b6001600160a01b031614155b156116d957604051637d7b71b560e01b815260040160405180910390fd5b601754600160a01b900460ff166117445760405162461bcd60e51b815260206004820152602960248201527f43616e207175616c69667920746f6b656e20696473206f6e6c7920696620726160448201526866666c65207761766560b81b6064820152608401610968565b6000805b83811015611831576000858583818110611764576117646137d1565b9050602002013590508060001415801561178057506009548111155b6117cc5760405162461bcd60e51b815260206004820152601a60248201527f496e76616c696420746f6b656e496420746f207175616c6966790000000000006044820152606401610968565b60008181526013602052604090205460ff620100009091041615158415151461181e576000818152601360205260409020805462ff0000191662010000861515021790558261181a8161373f565b9350505b50806118298161373f565b915050611748565b508161184a578060145461184591906137e7565b611858565b8060145461185891906137be565b60145550505050565b600860009054906101000a90046001600160a01b03166001600160a01b031663aced16616040518163ffffffff1660e01b8152600401602060405180830381865afa1580156118b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118d891906136d2565b6001600160a01b03166118e9612294565b6001600160a01b03161415801561191b57506000546001600160a01b031661190f612294565b6001600160a01b031614155b1561193957604051637d7b71b560e01b815260040160405180910390fd5b42811180156119495750600a5481115b80156119645750600c54611961906301e133806137be565b81105b6119a85760405162461bcd60e51b81526020600482015260156024820152740496e76616c696420656e642074696d657374616d7605c1b6044820152606401610968565b600b55565b60007f00000000000000000000000000000000000000000000000000000000000000006119d98361286a565b60405161190160f01b6020820152602281019290925260428201526062015b604051602081830303815290604052805190602001209050919050565b60606002805461084a906136ef565b600860009054906101000a90046001600160a01b03166001600160a01b031663aced16616040518163ffffffff1660e01b8152600401602060405180830381865afa158015611a77573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a9b91906136d2565b6001600160a01b0316611aac612294565b6001600160a01b031614158015611ade57506000546001600160a01b0316611ad2612294565b6001600160a01b031614155b15611afc57604051637d7b71b560e01b815260040160405180910390fd5b6010611b09838583613848565b506011805460ff19169115159190911790555050565b611131611b2a612294565b83836128c0565b611b42611b3c612294565b83612688565b611b5e5760405162461bcd60e51b815260040161096890613758565b610bbc8484848461298e565b600860009054906101000a90046001600160a01b03166001600160a01b031663aced16616040518163ffffffff1660e01b8152600401602060405180830381865afa158015611bbd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611be191906136d2565b6001600160a01b0316611bf2612294565b6001600160a01b031614158015611c2457506000546001600160a01b0316611c18612294565b6001600160a01b031614155b15611c4257604051637d7b71b560e01b815260040160405180910390fd5b8042108015611c525750600b5481105b611c9e5760405162461bcd60e51b815260206004820152601760248201527f496e76616c69642073746172742074696d657374616d700000000000000000006044820152606401610968565b600a55565b6060611cae826122a3565b60115460ff16611cde576010604051602001611cca919061397c565b604051602081830303815290604052610781565b6010611ce9836129c1565b604051602001611cfa9291906139a6565b60405160208183030381529060405292915050565b600b54421015611d325760405163cc76115360e01b815260040160405180910390fd5b600860009054906101000a90046001600160a01b03166001600160a01b031663aa6527d96040518163ffffffff1660e01b8152600401602060405180830381865afa158015611d85573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611da991906136d2565b6001600160a01b0316611dba612294565b6001600160a01b031614158015611e605750600860009054906101000a90046001600160a01b03166001600160a01b031663aced16616040518163ffffffff1660e01b8152600401602060405180830381865afa158015611e1f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e4391906136d2565b6001600160a01b0316611e54612294565b6001600160a01b031614155b8015611e8757506000546001600160a01b0316611e7b612294565b6001600160a01b031614155b15611ea557604051636c94aad360e01b815260040160405180910390fd5b600e5415611f065760405162461bcd60e51b815260206004820152602860248201527f52616e646f6d206e756d6265722068617320616c7265616479206265656e20656044820152671e1d1c9858dd195960c21b6064820152608401610968565b80600003611f605760405162461bcd60e51b815260206004820152602160248201527f52616e646f6d206e756d626572206578747261637465642063616e74206265206044820152600360fc1b6064820152608401610968565b600e55565b611f6d6127a1565b6001600160a01b038116611fd25760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610968565b610f258161281a565b600b54421015611ffe5760405163cc76115360e01b815260040160405180910390fd5b6011546301000000900460ff161561204e5760405162461bcd60e51b8152602060048201526013602482015272526166666c6520616c726561647920646f6e6560681b6044820152606401610968565b600e546000036120ac5760405162461bcd60e51b815260206004820152602360248201527f52616e646f6d206e756d62657220776173206e6f7420657874726163746564206044820152621e595d60ea1b6064820152608401610968565b6015546014546009546000916120c1916137e7565b905060008282106120d257826120d4565b815b90506000805b828110156121c65760005b600954600e5460408051602081019290925281018590526060016040516020818303038152906040528051906020012060001c61212291906139ea565b61212d9060016137be565b9050826121398161373f565b60008381526013602052604090205490945060ff1690506120e5576017546016546040519081526001600160a01b039091169082907f0b5f1921ec57653b997f4376bbfc357ce426e20b9770ae548b5c7ab97a40d54c9060200160405180910390a36000908152601360205260409020805460ff19166001179055806121be8161373f565b9150506120da565b506017546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa158015612210573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061223491906137a5565b6016549091506122449084613a0c565b61224e90826137e7565b600f556011805463ff000000191663010000001790556040517f27570828a3b3d654a69144a8ca6c7e066e01acd2e5c41405c83fa9f03011831290600090a15050505050565b600061229e612a54565b905090565b6000818152600360205260409020546001600160a01b0316610f255760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b6044820152606401610968565b600081815260056020526040902080546001600160a01b0319166001600160a01b0384169081179091558190612337826113d1565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b60006123a76040518060600160405280896001600160a01b03168152602001888152602001306001600160a01b03168152506119ad565b9050600060016123b683612a98565b6040805160008152602081018083529290925260ff891690820152606081018790526080810186905260a0016020604051602081039080840390855afa158015612404573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811615806124395750826001600160a01b0316816001600160a01b031614155b1561245757604051638baa579f60e01b815260040160405180910390fd5b5050505050505050565b6001600160a01b0381166000908152601260205260408120805460ff19166001179055600980546124a2928492916124989061373f565b9182905550612ad3565b6009546040516001600160a01b038316907fd8138f8a3f377c5259ca548e70e4c2de94f129f5a11036a15b69513cba2b426a90600090a350565b6017546016546040516370a0823160e01b81523060048201526001600160a01b039092169160009083906370a0823190602401602060405180830381865afa15801561252c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061255091906137a5565b601554908311159150158015906125645750805b15610bbc5761257d6001600160a01b0384168584612636565b6017546040518381526001600160a01b03918216918616907f2b5a46847b5904937aa26c09373883ac411399d3404814f716b47721af04ff4f9060200160405180910390a3601580549060006125d283613a23565b919050555050505050565b60026007540361262f5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610968565b6002600755565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052610a1b908490612aed565b600080612694836113d1565b9050806001600160a01b0316846001600160a01b031614806126db57506001600160a01b0380821660009081526006602090815260408083209388168352929052205460ff165b806126ff5750836001600160a01b03166126f4846108cd565b6001600160a01b0316145b949350505050565b601154610100900460ff1615612730576040516354ee515160e01b815260040160405180910390fd5b610a1b838383612bc2565b8015612767576127676127566000546001600160a01b031690565b6001600160a01b0384169083612636565b60405181906001600160a01b038416907feaff4b37086828766ad3268786972c0cd24259d4c87a80f9d3963a3c3d999b0d90600090a35050565b6127a9612294565b6001600160a01b03166127c46000546001600160a01b031690565b6001600160a01b0316146114c95760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610968565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80516020808301516040516000936119f8937f0000000000000000000000000000000000000000000000000000000000000000939192019283526001600160a01b03919091166020830152604082015260600190565b816001600160a01b0316836001600160a01b0316036129215760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610968565b6001600160a01b03838116600081815260066020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b612999848484612707565b6129a584848484612d26565b610bbc5760405162461bcd60e51b815260040161096890613a3a565b606060006129ce83612e2e565b600101905060008167ffffffffffffffff8111156129ee576129ee613495565b6040519080825280601f01601f191660200182016040528015612a18576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a8504945084612a2257509392505050565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03163303612a93575060131936013560601c90565b503390565b6040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c8101829052600090605c016119f8565b611131828260405180602001604052806000815250612f06565b6000612b42826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612f399092919063ffffffff16565b9050805160001480612b63575080806020019051810190612b639190613a8c565b610a1b5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610968565b826001600160a01b0316612bd5826113d1565b6001600160a01b031614612bfb5760405162461bcd60e51b815260040161096890613aa9565b6001600160a01b038216612c5d5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610968565b826001600160a01b0316612c70826113d1565b6001600160a01b031614612c965760405162461bcd60e51b815260040161096890613aa9565b600081815260056020908152604080832080546001600160a01b03199081169091556001600160a01b0387811680865260048552838620805460001901905590871680865283862080546001019055868652600390945282852080549092168417909155905184937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b60006001600160a01b0384163b15612e2357836001600160a01b031663150b7a02612d4f612294565b8786866040518563ffffffff1660e01b8152600401612d719493929190613aee565b6020604051808303816000875af1925050508015612dac575060408051601f3d908101601f19168201909252612da991810190613b2b565b60015b612e09573d808015612dda576040519150601f19603f3d011682016040523d82523d6000602084013e612ddf565b606091505b508051600003612e015760405162461bcd60e51b815260040161096890613a3a565b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490506126ff565b506001949350505050565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b8310612e6d5772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef81000000008310612e99576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc100008310612eb757662386f26fc10000830492506010015b6305f5e1008310612ecf576305f5e100830492506008015b6127108310612ee357612710830492506004015b60648310612ef5576064830492506002015b600a83106107815760010192915050565b612f108383612f48565b612f1d6000848484612d26565b610a1b5760405162461bcd60e51b815260040161096890613a3a565b60606126ff84846000856130d3565b6001600160a01b038216612f9e5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610968565b6000818152600360205260409020546001600160a01b0316156130035760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610968565b6000818152600360205260409020546001600160a01b0316156130685760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610968565b6001600160a01b038216600081815260046020908152604080832080546001019055848352600390915280822080546001600160a01b0319168417905551839291907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b6060824710156131345760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610968565b600080866001600160a01b031685876040516131509190613b48565b60006040518083038185875af1925050503d806000811461318d576040519150601f19603f3d011682016040523d82523d6000602084013e613192565b606091505b50915091506131a3878383876131ae565b979650505050505050565b6060831561321d578251600003613216576001600160a01b0385163b6132165760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610968565b50816126ff565b6126ff83838151156132325781518083602001fd5b8060405162461bcd60e51b815260040161096891906132ef565b6001600160e01b031981168114610f2557600080fd5b60006020828403121561327457600080fd5b813561327f8161324c565b9392505050565b60006020828403121561329857600080fd5b5035919050565b60005b838110156132ba5781810151838201526020016132a2565b50506000910152565b600081518084526132db81602086016020860161329f565b601f01601f19169290920160200192915050565b60208152600061327f60208301846132c3565b6001600160a01b0381168114610f2557600080fd5b6000806040838503121561332a57600080fd5b823561333581613302565b946020939093013593505050565b6000806000806080858703121561335957600080fd5b84359350602085013560ff8116811461337157600080fd5b93969395505050506040820135916060013590565b60008060006060848603121561339b57600080fd5b83356133a681613302565b925060208401356133b681613302565b929592945050506040919091013590565b8015158114610f2557600080fd5b6000602082840312156133e757600080fd5b813561327f816133c7565b60006020828403121561340457600080fd5b813561327f81613302565b60008060006040848603121561342457600080fd5b833567ffffffffffffffff8082111561343c57600080fd5b818601915086601f83011261345057600080fd5b81358181111561345f57600080fd5b8760208260051b850101111561347457600080fd5b6020928301955093505084013561348a816133c7565b809150509250925092565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff811182821017156134d4576134d4613495565b604052919050565b6000606082840312156134ee57600080fd5b6040516060810181811067ffffffffffffffff8211171561351157613511613495565b604052823561351f81613302565b815260208381013590820152604083013561353981613302565b60408201529392505050565b60008060006040848603121561355a57600080fd5b833567ffffffffffffffff8082111561357257600080fd5b818601915086601f83011261358657600080fd5b81358181111561359557600080fd5b87602082850101111561347457600080fd5b600080604083850312156135ba57600080fd5b82356135c581613302565b915060208301356135d5816133c7565b809150509250929050565b600080600080608085870312156135f657600080fd5b843561360181613302565b935060208581013561361281613302565b935060408601359250606086013567ffffffffffffffff8082111561363657600080fd5b818801915088601f83011261364a57600080fd5b81358181111561365c5761365c613495565b61366e601f8201601f191685016134ab565b9150808252898482850101111561368457600080fd5b808484018584013760008482840101525080935050505092959194509250565b600080604083850312156136b757600080fd5b82356136c281613302565b915060208301356135d581613302565b6000602082840312156136e457600080fd5b815161327f81613302565b600181811c9082168061370357607f821691505b60208210810361372357634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b60006001820161375157613751613729565b5060010190565b6020808252602d908201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560408201526c1c881bdc88185c1c1c9bdd9959609a1b606082015260800190565b6000602082840312156137b757600080fd5b5051919050565b8082018082111561078157610781613729565b634e487b7160e01b600052603260045260246000fd5b8181038181111561078157610781613729565b601f821115610a1b57600081815260208120601f850160051c810160208610156138215750805b601f850160051c820191505b818110156138405782815560010161382d565b505050505050565b67ffffffffffffffff83111561386057613860613495565b6138748361386e83546136ef565b836137fa565b6000601f8411600181146138a857600085156138905750838201355b600019600387901b1c1916600186901b178355613902565b600083815260209020601f19861690835b828110156138d957868501358255602094850194600190920191016138b9565b50868210156138f65760001960f88860031b161c19848701351681555b505060018560011b0183555b5050505050565b60008154613916816136ef565b6001828116801561392e576001811461394357613972565b60ff1984168752821515830287019450613972565b8560005260208060002060005b858110156139695781548a820152908401908201613950565b50505082870194505b5050505092915050565b60006139888284613909565b6d17b6b2ba30b230ba30973539b7b760911b8152600e019392505050565b60006139b28285613909565b602f60f81b815283516139cc81600184016020880161329f565b64173539b7b760d91b60019290910191820152600601949350505050565b600082613a0757634e487b7160e01b600052601260045260246000fd5b500690565b808202811582820484141761078157610781613729565b600081613a3257613a32613729565b506000190190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b600060208284031215613a9e57600080fd5b815161327f816133c7565b60208082526025908201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060408201526437bbb732b960d91b606082015260800190565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090613b21908301846132c3565b9695505050505050565b600060208284031215613b3d57600080fd5b815161327f8161324c565b60008251613b5a81846020870161329f565b919091019291505056fea2646970667358221220cafc4024a1506375a3f05ca224ce61a1cc4fbc49977d608c9e3362862133b79e64736f6c63430008150033a2646970667358221220088e4432e5f9b4b8a8b188a92b86a3c8dcf9043492559fe5f03ff0b381931ed964736f6c63430008150033000000000000000000000000607291c9b3b03d8c2dc1f5f7f8db2b6a06c91183000000000000000000000000afa1853e44e547f1a9770fd37c4556b4faf5467400000000000000000000000075d14f0ae59003c0806b625b402a40340ffde6340000000000000000000000000000000000000000000000000000000000000000

Deployed Bytecode

0x60806040523480156200001157600080fd5b5060043610620001155760003560e01c8063aa6527d911620000a3578063cf04fb94116200006e578063cf04fb941462000242578063d3f8a33a1462000259578063e30c39781462000270578063f2fde38b146200028257600080fd5b8063aa6527d914620001cc578063aced166114620001e0578063b553469914620001f4578063c781267a146200022b57600080fd5b8063715018a611620000e4578063715018a6146200019257806379ba5097146200019c5780637da0a87714620001a65780638da5cb5b14620001ba57600080fd5b806304056c12146200011a57806308c7a8dd146200013357806309779838146200014a5780632b7ac3f31462000161575b600080fd5b620001316200012b36600462000862565b62000299565b005b62000131620001443660046200099c565b62000428565b620001316200015b3660046200099c565b62000454565b60055462000175906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b6200013162000480565b6200013162000498565b60045462000175906001600160a01b031681565b6000546001600160a01b031662000175565b60065462000175906001600160a01b031681565b60035462000175906001600160a01b031681565b6200021a620002053660046200099c565b60076020526000908152604090205460ff1681565b604051901515815260200162000189565b620001756200023c366004620009c1565b6200051a565b62000131620002533660046200099c565b62000545565b620001316200026a3660046200099c565b62000571565b6001546001600160a01b031662000175565b62000131620002933660046200099c565b6200059d565b6000878787878787600460009054906101000a90046001600160a01b031688604051620002c6906200077d565b620002d998979695949392919062000a23565b604051809103906000f080158015620002f6573d6000803e3d6000fd5b50600280546001810182556000919091527f405787fa12a823e0f2b7631cc41b3ba8828b3321ca811111fa75cd3aa3bb5ace0180546001600160a01b0319166001600160a01b03831690811790915560405163f2fde38b60e01b81523360048201529192509063f2fde38b90602401600060405180830381600087803b1580156200038057600080fd5b505af115801562000395573d6000803e3d6000fd5b50505050816060015115620003c8576001600160a01b0381166000908152600760205260409020805460ff191660011790555b60408201516001600160a01b031615620003e857620003e8828262000611565b60405133906001600160a01b038316907fb49597eb6ae32b938af897f271f3c6f6448014880f91ccee242476f2db9af06c90600090a35050505050505050565b62000432620006bc565b600480546001600160a01b0319166001600160a01b0392909216919091179055565b6200045e620006bc565b600380546001600160a01b0319166001600160a01b0392909216919091179055565b6200048a620006bc565b62000496600062000718565b565b60015433906001600160a01b031681146200050c5760405162461bcd60e51b815260206004820152602960248201527f4f776e61626c6532537465703a2063616c6c6572206973206e6f7420746865206044820152683732bb9037bbb732b960b91b60648201526084015b60405180910390fd5b620005178162000718565b50565b600281815481106200052b57600080fd5b6000918252602090912001546001600160a01b0316905081565b6200054f620006bc565b600580546001600160a01b0319166001600160a01b0392909216919091179055565b6200057b620006bc565b600680546001600160a01b0319166001600160a01b0392909216919091179055565b620005a7620006bc565b600180546001600160a01b0383166001600160a01b03199091168117909155620005d96000546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b81604001516001600160a01b03166323b872dd3383856000015186602001516200063c919062000ac7565b6040516001600160e01b031960e086901b1681526001600160a01b03938416600482015292909116602483015260448201526064016020604051808303816000875af115801562000691573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620006b7919062000af3565b505050565b6000546001600160a01b03163314620004965760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640162000503565b600180546001600160a01b03191690556200051781600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6142798062000b1483390190565b634e487b7160e01b600052604160045260246000fd5b600082601f830112620007b357600080fd5b813567ffffffffffffffff80821115620007d157620007d16200078b565b604051601f8301601f19908116603f01168101908282118183101715620007fc57620007fc6200078b565b816040528381528660208588010111156200081657600080fd5b836020870160208301376000602085830101528094505050505092915050565b80151581146200051757600080fd5b80356001600160a01b03811681146200085d57600080fd5b919050565b60008060008060008060008789036101408112156200088057600080fd5b883567ffffffffffffffff808211156200089957600080fd5b620008a78c838d01620007a1565b995060208b0135915080821115620008be57600080fd5b620008cc8c838d01620007a1565b985060408b0135915080821115620008e357600080fd5b620008f18c838d01620007a1565b975060608b0135965060808b0135955060a08b01359150620009138262000836565b819450608060bf19840112156200092957600080fd5b604051925060808301915082821081831117156200094b576200094b6200078b565b5060405260c0890135815260e089013560208201526200096f6101008a0162000845565b6040820152610120890135620009858162000836565b806060830152508091505092959891949750929550565b600060208284031215620009af57600080fd5b620009ba8262000845565b9392505050565b600060208284031215620009d457600080fd5b5035919050565b6000815180845260005b8181101562000a0357602081850181015186830182015201620009e5565b506000602082860101526020601f19601f83011685010191505092915050565b600061016080835262000a398184018c620009db565b9050828103602084015262000a4f818b620009db565b9050828103604084015262000a65818a620009db565b6060848101999099526080840197909752505092151560a08401526001600160a01b0391821660c0840152805160e084015260208101516101008401526040810151909116610120830152909201511515610140909201919091529392505050565b808202811582820484141762000aed57634e487b7160e01b600052601160045260246000fd5b92915050565b60006020828403121562000b0657600080fd5b8151620009ba816200083656fe60e06040526001600d556011805460ff60201b19166401000000001790553480156200002a57600080fd5b5060405162004279380380620042798339810160408190526200004d9162000461565b6001600160a01b038216608052878088620000716200006b620001d2565b620001e3565b60016200007f8382620005ce565b5060026200008e8282620005ce565b505050620000a2816200023360201b60201c565b60a052507fe2d15b1b8b219df1de91adda0da74db4530273a2a7be5c582902b7ccfdf7fb8a60c052600160075583851180620000dd57504284105b15620000fc5760405163c6e369f960e01b815260040160405180910390fd5b62000106620001d2565b600880546001600160a01b0319166001600160a01b03929092169190911790556010620001348782620005ce565b5042851015620001485742600a556200014e565b600a8590555b600b84905542600c55601180548415156101000261ff00199091161790558051601555602081015160165560408101516017805460608401511515600160a01b026001600160a81b03199091166001600160a01b0390931692831717905515620001c4576011805462ff00001916620100001790555b50505050505050506200069a565b6000620001de620002ba565b905090565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b8051602091820120604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f81850152808201929092527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608301524660808301523060a0808401919091528151808403909101815260c09092019052805191012090565b6080516000906001600160a01b03163303620002dd575060131936013560601c90565b503390565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715620003235762000323620002e2565b604052919050565b600082601f8301126200033d57600080fd5b81516001600160401b03811115620003595762000359620002e2565b60206200036f601f8301601f19168201620002f8565b82815285828487010111156200038457600080fd5b60005b83811015620003a457858101830151828201840152820162000387565b506000928101909101919091529392505050565b80518015158114620003c957600080fd5b919050565b80516001600160a01b0381168114620003c957600080fd5b600060808284031215620003f957600080fd5b604051608081016001600160401b03811182821017156200041e576200041e620002e2565b806040525080915082518152602083015160208201526200044260408401620003ce565b60408201526200045560608401620003b8565b60608201525092915050565b600080600080600080600080610160898b0312156200047f57600080fd5b88516001600160401b03808211156200049757600080fd5b620004a58c838d016200032b565b995060208b0151915080821115620004bc57600080fd5b620004ca8c838d016200032b565b985060408b0151915080821115620004e157600080fd5b50620004f08b828c016200032b565b96505060608901519450608089015193506200050f60a08a01620003b8565b92506200051f60c08a01620003ce565b9150620005308a60e08b01620003e6565b90509295985092959890939650565b600181811c908216806200055457607f821691505b6020821081036200057557634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115620005c957600081815260208120601f850160051c81016020861015620005a45750805b601f850160051c820191505b81811015620005c557828155600101620005b0565b5050505b505050565b81516001600160401b03811115620005ea57620005ea620002e2565b6200060281620005fb84546200053f565b846200057b565b602080601f8311600181146200063a5760008415620006215750858301515b600019600386901b1c1916600185901b178555620005c5565b600085815260208120601f198616915b828110156200066b578886015182559484019460019091019084016200064a565b50858210156200068a5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60805160a05160c051613b9a620006df6000396000818161043d015261287e01526000818161046401526119b101526000818161051a0152612a580152613b9a6000f3fe608060405234801561001057600080fd5b50600436106102d65760003560e01c80637df6a6c811610182578063c87b56dd116100e9578063e6fd48bc116100a2578063f2fde38b1161007c578063f2fde38b146106f3578063f7eca6d014610706578063fb16fb7214610718578063fdc48e311461072057600080fd5b8063e6fd48bc146106a5578063e985e9c5146106ae578063efb596a0146106ea57600080fd5b8063c87b56dd14610650578063ccbac9f514610663578063cea3bdfd1461066c578063d5c688d61461067f578063d7cb697014610693578063e6bbe4241461069c57600080fd5b8063a22cb4651161013b578063a22cb465146105f2578063a85adeab14610605578063b88d4fde1461060e578063c1292cc314610621578063c44bef751461062a578063c45a01551461063d57600080fd5b80637df6a6c8146105935780638a06e013146105a65780638da5cb5b146105b957806395d89b41146105ca57806398428dbf146105d257806399178408146105df57600080fd5b806324600fc3116102415780635576b871116101fa57806370a08231116101d457806370a082311461055d578063715018a61461057057806371aac7f91461057857806378ce8b401461058057600080fd5b80635576b871146104f7578063572b6c051461050a5780636352211e1461054a57600080fd5b806324600fc31461043057806330adf81f146104385780633644e5151461045f578063394c99f41461048657806342842e0e146104db578063482ddde2146104ee57600080fd5b80630ba0f2ae116102935780630ba0f2ae146103c35780631278e00a146103d657806315043931146103e957806322868fbe146103fc57806323b872dd14610415578063242284f11461042857600080fd5b806301ffc9a7146102db57806304386f521461030357806306fdde0314610318578063081812fc1461032d578063091c76f514610358578063095ea7b3146103b0575b600080fd5b6102ee6102e9366004613262565b610735565b60405190151581526020015b60405180910390f35b610316610311366004613286565b610787565b005b61032061083b565b6040516102fa91906132ef565b61034061033b366004613286565b6108cd565b6040516001600160a01b0390911681526020016102fa565b60155460165460175461037f9291906001600160a01b03811690600160a01b900460ff1684565b6040516102fa949392919093845260208401929092526001600160a01b031660408301521515606082015260800190565b6103166103be366004613317565b6108f4565b6011546102ee9062010000900460ff1681565b6103166103e4366004613343565b610a20565b6103166103f7366004613286565b610bc2565b6104076301e1338081565b6040519081526020016102fa565b610316610423366004613386565b610f28565b610316610f60565b610316611135565b6104077f000000000000000000000000000000000000000000000000000000000000000081565b6104077f000000000000000000000000000000000000000000000000000000000000000081565b6104bc610494366004613286565b60136020526000908152604090205460ff808216916101008104821691620100009091041683565b60408051931515845291151560208401521515908201526060016102fa565b6103166104e9366004613386565b6112e7565b610407600d5481565b6103166105053660046133d5565b611302565b6102ee6105183660046133f2565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0390811691161490565b610340610558366004613286565b6113d1565b61040761056b3660046133f2565b611431565b6103166114b7565b6103166114cb565b61031661058e36600461340f565b611601565b6103166105a1366004613286565b611861565b6104076105b43660046134dc565b6119ad565b6000546001600160a01b0316610340565b610320611a15565b6011546102ee9060ff1681565b6103166105ed366004613545565b611a24565b6103166106003660046135a7565b611b1f565b610407600b5481565b61031661061c3660046135e0565b611b31565b61040760095481565b610316610638366004613286565b611b6a565b600854610340906001600160a01b031681565b61032061065e366004613286565b611ca3565b610407600e5481565b61031661067a366004613286565b611d0f565b6011546102ee906301000000900460ff1681565b61040760145481565b610407600c5481565b610407600a5481565b6102ee6106bc3660046136a4565b6001600160a01b03918216600090815260066020908152604080832093909416825291909152205460ff1690565b610407600f5481565b6103166107013660046133f2565b611f65565b6011546102ee90610100900460ff1681565b610316611fdb565b6011546102ee90640100000000900460ff1681565b60006001600160e01b031982166380ac58cd60e01b148061076657506001600160e01b03198216635b5e139f60e01b145b8061078157506301ffc9a760e01b6001600160e01b03198316145b92915050565b600860009054906101000a90046001600160a01b03166001600160a01b031663aced16616040518163ffffffff1660e01b8152600401602060405180830381865afa1580156107da573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107fe91906136d2565b6001600160a01b031661080f612294565b6001600160a01b031614610836576040516354348f0360e01b815260040160405180910390fd5b600d55565b60606001805461084a906136ef565b80601f0160208091040260200160405190810160405280929190818152602001828054610876906136ef565b80156108c35780601f10610898576101008083540402835291602001916108c3565b820191906000526020600020905b8154815290600101906020018083116108a657829003601f168201915b5050505050905090565b60006108d8826122a3565b506000908152600560205260409020546001600160a01b031690565b60006108ff826113d1565b9050806001600160a01b0316836001600160a01b0316036109715760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084015b60405180910390fd5b806001600160a01b0316610983612294565b6001600160a01b0316148061099f575061099f816106bc612294565b610a115760405162461bcd60e51b815260206004820152603d60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c0000006064820152608401610968565b610a1b8383612302565b505050565b600a54421080610a315750600b5442115b15610a4f5760405163219a945b60e11b815260040160405180910390fd5b60126000610a5b612294565b6001600160a01b0316815260208101919091526040016000205460ff1615610a9657604051632cfe303760e21b815260040160405180910390fd5b83421115610ab7576040516305787bdf60e01b815260040160405180910390fd5b601154640100000000900460ff1615610b5557610b55610ad5612294565b85858585600860009054906101000a90046001600160a01b03166001600160a01b0316632b7ac3f36040518163ffffffff1660e01b8152600401602060405180830381865afa158015610b2c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b5091906136d2565b612370565b60005b600d54811015610b8457610b72610b6d612294565b612461565b80610b7c8161373f565b915050610b58565b5060115462010000900460ff168015610ba75750601754600160a01b900460ff16155b15610bbc57610bbc610bb7612294565b6124dc565b50505050565b600b54421015610be55760405163cc76115360e01b815260040160405180910390fd5b610bed6125dd565b60115462010000900460ff16610c3d5760405162461bcd60e51b81526020600482015260156024820152742737ba1030b71022a92199181031b0b6b830b4b3b760591b6044820152606401610968565b6011546301000000900460ff16610c965760405162461bcd60e51b815260206004820152601860248201527f526166666c65206e6f7420636f6d706c657465642079657400000000000000006044820152606401610968565b601754600160a01b900460ff16610ce35760405162461bcd60e51b81526020600482015260116024820152704e6f74206120726166666c65207761766560781b6044820152606401610968565b8015801590610cf457506009548111155b610d405760405162461bcd60e51b815260206004820152601b60248201527f496e76616c696420746f6b656e496420746f20776974686472617700000000006044820152606401610968565b6000610d4b826113d1565b9050806001600160a01b0316610d5f612294565b6001600160a01b031614610dc65760405162461bcd60e51b815260206004820152602860248201527f4f6e6c7920746f6b656e206f776e65722063616e20776974686472617720746860448201526719481c995dd85c9960c21b6064820152608401610968565b60008281526013602052604090205460ff16610e245760405162461bcd60e51b815260206004820152601c60248201527f546f6b656e20686173206e6f7420776f6e2074686520726166666c65000000006044820152606401610968565b600082815260136020526040902054610100900460ff1615610e945760405162461bcd60e51b8152602060048201526024808201527f546f6b656e2068617320616c726561647920636c61696d6564207468652072656044820152631dd85c9960e21b6064820152608401610968565b6017546016546001600160a01b039091169081610eb2818584612636565b60008581526013602052604090819020805461ff001916610100179055516001600160a01b0380851691908616907f808814f761e5bc2d39ba59152df35a813dcc50deb49d1978d94831ba68f9154990610f0f9086815260200190565b60405180910390a350505050610f256001600755565b50565b610f39610f33612294565b82612688565b610f555760405162461bcd60e51b815260040161096890613758565b610a1b838383612707565b600b54421015610f835760405163cc76115360e01b815260040160405180910390fd5b6011546301000000900460ff1615610fd35760405162461bcd60e51b8152602060048201526013602482015272526166666c6520616c726561647920646f6e6560681b6044820152606401610968565b601754600160a01b900460ff166110205760405162461bcd60e51b81526020600482015260116024820152704e6f74206120726166666c65207761766560781b6044820152606401610968565b611028612294565b6001600160a01b03167fe5ed10a2abb6a808edb6fbb7ae5cd09aad196ddaa1bd4e9295688a4d508460c860405160405180910390a26008546040805163aa6527d960e01b815290516000926001600160a01b03169163aa6527d99160048083019260209291908290030181865afa1580156110a7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110cb91906136d2565b9050806001600160a01b031663dea12bad6040518163ffffffff1660e01b81526004016020604051808303816000875af115801561110d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061113191906137a5565b5050565b600b544210156111585760405163cc76115360e01b815260040160405180910390fd5b600860009054906101000a90046001600160a01b03166001600160a01b031663aced16616040518163ffffffff1660e01b8152600401602060405180830381865afa1580156111ab573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111cf91906136d2565b6001600160a01b03166111e0612294565b6001600160a01b03161415801561121257506000546001600160a01b0316611206612294565b6001600160a01b031614155b1561123057604051637d7b71b560e01b815260040160405180910390fd5b6017546040516370a0823160e01b81523060048201526001600160a01b039091169060009082906370a0823190602401602060405180830381865afa15801561127d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112a191906137a5565b601754909150600160a01b900460ff1680156112cd57506301e13380600b546112ca91906137be565b42105b156112dd5750600f805460009091555b611131828261273b565b610a1b83838360405180602001604052806000815250611b31565b600860009054906101000a90046001600160a01b03166001600160a01b031663aced16616040518163ffffffff1660e01b8152600401602060405180830381865afa158015611355573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061137991906136d2565b6001600160a01b031661138a612294565b6001600160a01b0316146113b1576040516354348f0360e01b815260040160405180910390fd5b601180549115156401000000000264ff0000000019909216919091179055565b6000818152600360205260408120546001600160a01b0316806107815760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b6044820152606401610968565b60006001600160a01b03821661149b5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b6064820152608401610968565b506001600160a01b031660009081526004602052604090205490565b6114bf6127a1565b6114c9600061281a565b565b600a544210806114dc5750600b5442115b156114fa5760405163219a945b60e11b815260040160405180910390fd5b600860009054906101000a90046001600160a01b03166001600160a01b031663aced16616040518163ffffffff1660e01b8152600401602060405180830381865afa15801561154d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061157191906136d2565b6001600160a01b0316611582612294565b6001600160a01b0316141580156115b457506000546001600160a01b03166115a8612294565b6001600160a01b031614155b156115d257604051637d7b71b560e01b815260040160405180910390fd5b42600b556040517f434b671a95fb0071b0127874981939c3cd42e8f1f7d602b761482102d4a5507290600090a1565b600860009054906101000a90046001600160a01b03166001600160a01b031663aced16616040518163ffffffff1660e01b8152600401602060405180830381865afa158015611654573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061167891906136d2565b6001600160a01b0316611689612294565b6001600160a01b0316141580156116bb57506000546001600160a01b03166116af612294565b6001600160a01b031614155b156116d957604051637d7b71b560e01b815260040160405180910390fd5b601754600160a01b900460ff166117445760405162461bcd60e51b815260206004820152602960248201527f43616e207175616c69667920746f6b656e20696473206f6e6c7920696620726160448201526866666c65207761766560b81b6064820152608401610968565b6000805b83811015611831576000858583818110611764576117646137d1565b9050602002013590508060001415801561178057506009548111155b6117cc5760405162461bcd60e51b815260206004820152601a60248201527f496e76616c696420746f6b656e496420746f207175616c6966790000000000006044820152606401610968565b60008181526013602052604090205460ff620100009091041615158415151461181e576000818152601360205260409020805462ff0000191662010000861515021790558261181a8161373f565b9350505b50806118298161373f565b915050611748565b508161184a578060145461184591906137e7565b611858565b8060145461185891906137be565b60145550505050565b600860009054906101000a90046001600160a01b03166001600160a01b031663aced16616040518163ffffffff1660e01b8152600401602060405180830381865afa1580156118b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118d891906136d2565b6001600160a01b03166118e9612294565b6001600160a01b03161415801561191b57506000546001600160a01b031661190f612294565b6001600160a01b031614155b1561193957604051637d7b71b560e01b815260040160405180910390fd5b42811180156119495750600a5481115b80156119645750600c54611961906301e133806137be565b81105b6119a85760405162461bcd60e51b81526020600482015260156024820152740496e76616c696420656e642074696d657374616d7605c1b6044820152606401610968565b600b55565b60007f00000000000000000000000000000000000000000000000000000000000000006119d98361286a565b60405161190160f01b6020820152602281019290925260428201526062015b604051602081830303815290604052805190602001209050919050565b60606002805461084a906136ef565b600860009054906101000a90046001600160a01b03166001600160a01b031663aced16616040518163ffffffff1660e01b8152600401602060405180830381865afa158015611a77573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a9b91906136d2565b6001600160a01b0316611aac612294565b6001600160a01b031614158015611ade57506000546001600160a01b0316611ad2612294565b6001600160a01b031614155b15611afc57604051637d7b71b560e01b815260040160405180910390fd5b6010611b09838583613848565b506011805460ff19169115159190911790555050565b611131611b2a612294565b83836128c0565b611b42611b3c612294565b83612688565b611b5e5760405162461bcd60e51b815260040161096890613758565b610bbc8484848461298e565b600860009054906101000a90046001600160a01b03166001600160a01b031663aced16616040518163ffffffff1660e01b8152600401602060405180830381865afa158015611bbd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611be191906136d2565b6001600160a01b0316611bf2612294565b6001600160a01b031614158015611c2457506000546001600160a01b0316611c18612294565b6001600160a01b031614155b15611c4257604051637d7b71b560e01b815260040160405180910390fd5b8042108015611c525750600b5481105b611c9e5760405162461bcd60e51b815260206004820152601760248201527f496e76616c69642073746172742074696d657374616d700000000000000000006044820152606401610968565b600a55565b6060611cae826122a3565b60115460ff16611cde576010604051602001611cca919061397c565b604051602081830303815290604052610781565b6010611ce9836129c1565b604051602001611cfa9291906139a6565b60405160208183030381529060405292915050565b600b54421015611d325760405163cc76115360e01b815260040160405180910390fd5b600860009054906101000a90046001600160a01b03166001600160a01b031663aa6527d96040518163ffffffff1660e01b8152600401602060405180830381865afa158015611d85573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611da991906136d2565b6001600160a01b0316611dba612294565b6001600160a01b031614158015611e605750600860009054906101000a90046001600160a01b03166001600160a01b031663aced16616040518163ffffffff1660e01b8152600401602060405180830381865afa158015611e1f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e4391906136d2565b6001600160a01b0316611e54612294565b6001600160a01b031614155b8015611e8757506000546001600160a01b0316611e7b612294565b6001600160a01b031614155b15611ea557604051636c94aad360e01b815260040160405180910390fd5b600e5415611f065760405162461bcd60e51b815260206004820152602860248201527f52616e646f6d206e756d6265722068617320616c7265616479206265656e20656044820152671e1d1c9858dd195960c21b6064820152608401610968565b80600003611f605760405162461bcd60e51b815260206004820152602160248201527f52616e646f6d206e756d626572206578747261637465642063616e74206265206044820152600360fc1b6064820152608401610968565b600e55565b611f6d6127a1565b6001600160a01b038116611fd25760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610968565b610f258161281a565b600b54421015611ffe5760405163cc76115360e01b815260040160405180910390fd5b6011546301000000900460ff161561204e5760405162461bcd60e51b8152602060048201526013602482015272526166666c6520616c726561647920646f6e6560681b6044820152606401610968565b600e546000036120ac5760405162461bcd60e51b815260206004820152602360248201527f52616e646f6d206e756d62657220776173206e6f7420657874726163746564206044820152621e595d60ea1b6064820152608401610968565b6015546014546009546000916120c1916137e7565b905060008282106120d257826120d4565b815b90506000805b828110156121c65760005b600954600e5460408051602081019290925281018590526060016040516020818303038152906040528051906020012060001c61212291906139ea565b61212d9060016137be565b9050826121398161373f565b60008381526013602052604090205490945060ff1690506120e5576017546016546040519081526001600160a01b039091169082907f0b5f1921ec57653b997f4376bbfc357ce426e20b9770ae548b5c7ab97a40d54c9060200160405180910390a36000908152601360205260409020805460ff19166001179055806121be8161373f565b9150506120da565b506017546040516370a0823160e01b81523060048201526000916001600160a01b0316906370a0823190602401602060405180830381865afa158015612210573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061223491906137a5565b6016549091506122449084613a0c565b61224e90826137e7565b600f556011805463ff000000191663010000001790556040517f27570828a3b3d654a69144a8ca6c7e066e01acd2e5c41405c83fa9f03011831290600090a15050505050565b600061229e612a54565b905090565b6000818152600360205260409020546001600160a01b0316610f255760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b6044820152606401610968565b600081815260056020526040902080546001600160a01b0319166001600160a01b0384169081179091558190612337826113d1565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b60006123a76040518060600160405280896001600160a01b03168152602001888152602001306001600160a01b03168152506119ad565b9050600060016123b683612a98565b6040805160008152602081018083529290925260ff891690820152606081018790526080810186905260a0016020604051602081039080840390855afa158015612404573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811615806124395750826001600160a01b0316816001600160a01b031614155b1561245757604051638baa579f60e01b815260040160405180910390fd5b5050505050505050565b6001600160a01b0381166000908152601260205260408120805460ff19166001179055600980546124a2928492916124989061373f565b9182905550612ad3565b6009546040516001600160a01b038316907fd8138f8a3f377c5259ca548e70e4c2de94f129f5a11036a15b69513cba2b426a90600090a350565b6017546016546040516370a0823160e01b81523060048201526001600160a01b039092169160009083906370a0823190602401602060405180830381865afa15801561252c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061255091906137a5565b601554908311159150158015906125645750805b15610bbc5761257d6001600160a01b0384168584612636565b6017546040518381526001600160a01b03918216918616907f2b5a46847b5904937aa26c09373883ac411399d3404814f716b47721af04ff4f9060200160405180910390a3601580549060006125d283613a23565b919050555050505050565b60026007540361262f5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610968565b6002600755565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052610a1b908490612aed565b600080612694836113d1565b9050806001600160a01b0316846001600160a01b031614806126db57506001600160a01b0380821660009081526006602090815260408083209388168352929052205460ff165b806126ff5750836001600160a01b03166126f4846108cd565b6001600160a01b0316145b949350505050565b601154610100900460ff1615612730576040516354ee515160e01b815260040160405180910390fd5b610a1b838383612bc2565b8015612767576127676127566000546001600160a01b031690565b6001600160a01b0384169083612636565b60405181906001600160a01b038416907feaff4b37086828766ad3268786972c0cd24259d4c87a80f9d3963a3c3d999b0d90600090a35050565b6127a9612294565b6001600160a01b03166127c46000546001600160a01b031690565b6001600160a01b0316146114c95760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610968565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80516020808301516040516000936119f8937f0000000000000000000000000000000000000000000000000000000000000000939192019283526001600160a01b03919091166020830152604082015260600190565b816001600160a01b0316836001600160a01b0316036129215760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610968565b6001600160a01b03838116600081815260066020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b612999848484612707565b6129a584848484612d26565b610bbc5760405162461bcd60e51b815260040161096890613a3a565b606060006129ce83612e2e565b600101905060008167ffffffffffffffff8111156129ee576129ee613495565b6040519080825280601f01601f191660200182016040528015612a18576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a8504945084612a2257509392505050565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03163303612a93575060131936013560601c90565b503390565b6040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c8101829052600090605c016119f8565b611131828260405180602001604052806000815250612f06565b6000612b42826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612f399092919063ffffffff16565b9050805160001480612b63575080806020019051810190612b639190613a8c565b610a1b5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610968565b826001600160a01b0316612bd5826113d1565b6001600160a01b031614612bfb5760405162461bcd60e51b815260040161096890613aa9565b6001600160a01b038216612c5d5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610968565b826001600160a01b0316612c70826113d1565b6001600160a01b031614612c965760405162461bcd60e51b815260040161096890613aa9565b600081815260056020908152604080832080546001600160a01b03199081169091556001600160a01b0387811680865260048552838620805460001901905590871680865283862080546001019055868652600390945282852080549092168417909155905184937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b60006001600160a01b0384163b15612e2357836001600160a01b031663150b7a02612d4f612294565b8786866040518563ffffffff1660e01b8152600401612d719493929190613aee565b6020604051808303816000875af1925050508015612dac575060408051601f3d908101601f19168201909252612da991810190613b2b565b60015b612e09573d808015612dda576040519150601f19603f3d011682016040523d82523d6000602084013e612ddf565b606091505b508051600003612e015760405162461bcd60e51b815260040161096890613a3a565b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490506126ff565b506001949350505050565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b8310612e6d5772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef81000000008310612e99576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc100008310612eb757662386f26fc10000830492506010015b6305f5e1008310612ecf576305f5e100830492506008015b6127108310612ee357612710830492506004015b60648310612ef5576064830492506002015b600a83106107815760010192915050565b612f108383612f48565b612f1d6000848484612d26565b610a1b5760405162461bcd60e51b815260040161096890613a3a565b60606126ff84846000856130d3565b6001600160a01b038216612f9e5760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610968565b6000818152600360205260409020546001600160a01b0316156130035760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610968565b6000818152600360205260409020546001600160a01b0316156130685760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610968565b6001600160a01b038216600081815260046020908152604080832080546001019055848352600390915280822080546001600160a01b0319168417905551839291907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b6060824710156131345760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610968565b600080866001600160a01b031685876040516131509190613b48565b60006040518083038185875af1925050503d806000811461318d576040519150601f19603f3d011682016040523d82523d6000602084013e613192565b606091505b50915091506131a3878383876131ae565b979650505050505050565b6060831561321d578251600003613216576001600160a01b0385163b6132165760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610968565b50816126ff565b6126ff83838151156132325781518083602001fd5b8060405162461bcd60e51b815260040161096891906132ef565b6001600160e01b031981168114610f2557600080fd5b60006020828403121561327457600080fd5b813561327f8161324c565b9392505050565b60006020828403121561329857600080fd5b5035919050565b60005b838110156132ba5781810151838201526020016132a2565b50506000910152565b600081518084526132db81602086016020860161329f565b601f01601f19169290920160200192915050565b60208152600061327f60208301846132c3565b6001600160a01b0381168114610f2557600080fd5b6000806040838503121561332a57600080fd5b823561333581613302565b946020939093013593505050565b6000806000806080858703121561335957600080fd5b84359350602085013560ff8116811461337157600080fd5b93969395505050506040820135916060013590565b60008060006060848603121561339b57600080fd5b83356133a681613302565b925060208401356133b681613302565b929592945050506040919091013590565b8015158114610f2557600080fd5b6000602082840312156133e757600080fd5b813561327f816133c7565b60006020828403121561340457600080fd5b813561327f81613302565b60008060006040848603121561342457600080fd5b833567ffffffffffffffff8082111561343c57600080fd5b818601915086601f83011261345057600080fd5b81358181111561345f57600080fd5b8760208260051b850101111561347457600080fd5b6020928301955093505084013561348a816133c7565b809150509250925092565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff811182821017156134d4576134d4613495565b604052919050565b6000606082840312156134ee57600080fd5b6040516060810181811067ffffffffffffffff8211171561351157613511613495565b604052823561351f81613302565b815260208381013590820152604083013561353981613302565b60408201529392505050565b60008060006040848603121561355a57600080fd5b833567ffffffffffffffff8082111561357257600080fd5b818601915086601f83011261358657600080fd5b81358181111561359557600080fd5b87602082850101111561347457600080fd5b600080604083850312156135ba57600080fd5b82356135c581613302565b915060208301356135d5816133c7565b809150509250929050565b600080600080608085870312156135f657600080fd5b843561360181613302565b935060208581013561361281613302565b935060408601359250606086013567ffffffffffffffff8082111561363657600080fd5b818801915088601f83011261364a57600080fd5b81358181111561365c5761365c613495565b61366e601f8201601f191685016134ab565b9150808252898482850101111561368457600080fd5b808484018584013760008482840101525080935050505092959194509250565b600080604083850312156136b757600080fd5b82356136c281613302565b915060208301356135d581613302565b6000602082840312156136e457600080fd5b815161327f81613302565b600181811c9082168061370357607f821691505b60208210810361372357634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b60006001820161375157613751613729565b5060010190565b6020808252602d908201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560408201526c1c881bdc88185c1c1c9bdd9959609a1b606082015260800190565b6000602082840312156137b757600080fd5b5051919050565b8082018082111561078157610781613729565b634e487b7160e01b600052603260045260246000fd5b8181038181111561078157610781613729565b601f821115610a1b57600081815260208120601f850160051c810160208610156138215750805b601f850160051c820191505b818110156138405782815560010161382d565b505050505050565b67ffffffffffffffff83111561386057613860613495565b6138748361386e83546136ef565b836137fa565b6000601f8411600181146138a857600085156138905750838201355b600019600387901b1c1916600186901b178355613902565b600083815260209020601f19861690835b828110156138d957868501358255602094850194600190920191016138b9565b50868210156138f65760001960f88860031b161c19848701351681555b505060018560011b0183555b5050505050565b60008154613916816136ef565b6001828116801561392e576001811461394357613972565b60ff1984168752821515830287019450613972565b8560005260208060002060005b858110156139695781548a820152908401908201613950565b50505082870194505b5050505092915050565b60006139888284613909565b6d17b6b2ba30b230ba30973539b7b760911b8152600e019392505050565b60006139b28285613909565b602f60f81b815283516139cc81600184016020880161329f565b64173539b7b760d91b60019290910191820152600601949350505050565b600082613a0757634e487b7160e01b600052601260045260246000fd5b500690565b808202811582820484141761078157610781613729565b600081613a3257613a32613729565b506000190190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b600060208284031215613a9e57600080fd5b815161327f816133c7565b60208082526025908201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060408201526437bbb732b960d91b606082015260800190565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090613b21908301846132c3565b9695505050505050565b600060208284031215613b3d57600080fd5b815161327f8161324c565b60008251613b5a81846020870161329f565b919091019291505056fea2646970667358221220cafc4024a1506375a3f05ca224ce61a1cc4fbc49977d608c9e3362862133b79e64736f6c63430008150033a2646970667358221220088e4432e5f9b4b8a8b188a92b86a3c8dcf9043492559fe5f03ff0b381931ed964736f6c63430008150033

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

000000000000000000000000607291c9b3b03d8c2dc1f5f7f8db2b6a06c91183000000000000000000000000afa1853e44e547f1a9770fd37c4556b4faf5467400000000000000000000000075d14f0ae59003c0806b625b402a40340ffde6340000000000000000000000000000000000000000000000000000000000000000

-----Decoded View---------------
Arg [0] : _keeper (address): 0x607291C9B3b03D8C2DC1F5f7F8db2B6A06C91183
Arg [1] : _trustedForwarder (address): 0xafA1853E44e547F1A9770Fd37c4556b4Faf54674
Arg [2] : _verifier (address): 0x75d14F0Ae59003C0806B625B402a40340Ffde634
Arg [3] : _raffleManager (address): 0x0000000000000000000000000000000000000000

-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 000000000000000000000000607291c9b3b03d8c2dc1f5f7f8db2b6a06c91183
Arg [1] : 000000000000000000000000afa1853e44e547f1a9770fd37c4556b4faf54674
Arg [2] : 00000000000000000000000075d14f0ae59003c0806b625b402a40340ffde634
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000000


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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