BERA Price: $3.68 (+0.13%)

Contract

0xEe6f49Dc2f1D0d9567dDd3FD6D77D8F7edfe7379

Overview

BERA Balance

Berachain LogoBerachain LogoBerachain Logo1,465.7063105239964263 BERA

BERA Value

$5,399.58 (@ $3.68/BERA)
Transaction Hash
Method
Block
From
To
Yeet40881482025-04-23 13:33:466 mins ago1745415226IN
0xEe6f49Dc...7edfe7379
2.94467859 BERA0.000027660.15000099
Yeet40881002025-04-23 13:32:118 mins ago1745415131IN
0xEe6f49Dc...7edfe7379
2.749845 BERA0.000033190.16472683
Yeet40864522025-04-23 12:37:501 hr ago1745411870IN
0xEe6f49Dc...7edfe7379
2.6103 BERA0.000100750.5
Yeet40846722025-04-23 11:39:202 hrs ago1745408360IN
0xEe6f49Dc...7edfe7379
2.57609754 BERA00.0000001
Yeet40837592025-04-23 11:09:172 hrs ago1745406557IN
0xEe6f49Dc...7edfe7379
2.5933 BERA0.000054650.25000003
Yeet40833252025-04-23 10:55:042 hrs ago1745405704IN
0xEe6f49Dc...7edfe7379
2.5849 BERA0.000035790.1637295
Yeet40829822025-04-23 10:43:462 hrs ago1745405026IN
0xEe6f49Dc...7edfe7379
2.55097771 BERA0.000006050.03333
Yeet40829792025-04-23 10:43:412 hrs ago1745405021IN
0xEe6f49Dc...7edfe7379
2.54271389 BERA0.000006050.03333
Yeet40829762025-04-23 10:43:342 hrs ago1745405014IN
0xEe6f49Dc...7edfe7379
2.53447684 BERA0.000006050.03333
Yeet40829732025-04-23 10:43:282 hrs ago1745405008IN
0xEe6f49Dc...7edfe7379
2.52626648 BERA0.000006050.03333
Yeet40829712025-04-23 10:43:242 hrs ago1745405004IN
0xEe6f49Dc...7edfe7379
2.51808271 BERA0.000006050.03333
Yeet40829682025-04-23 10:43:182 hrs ago1745404998IN
0xEe6f49Dc...7edfe7379
2.50992545 BERA0.000006050.03333
Yeet40829652025-04-23 10:43:132 hrs ago1745404993IN
0xEe6f49Dc...7edfe7379
2.50179462 BERA0.000006050.03333
Yeet40829612025-04-23 10:43:062 hrs ago1745404986IN
0xEe6f49Dc...7edfe7379
2.49369013 BERA0.000006050.03333
Yeet40829592025-04-23 10:43:022 hrs ago1745404982IN
0xEe6f49Dc...7edfe7379
2.48561189 BERA0.000006050.03333
Yeet40829562025-04-23 10:42:562 hrs ago1745404976IN
0xEe6f49Dc...7edfe7379
2.47755982 BERA0.000006050.03333
Yeet40829542025-04-23 10:42:512 hrs ago1745404971IN
0xEe6f49Dc...7edfe7379
2.46953383 BERA0.000006050.03333
Yeet40829512025-04-23 10:42:452 hrs ago1745404965IN
0xEe6f49Dc...7edfe7379
2.46153385 BERA0.000006050.03333
Yeet40829482025-04-23 10:42:392 hrs ago1745404959IN
0xEe6f49Dc...7edfe7379
2.45355978 BERA0.000006050.03333
Yeet40829452025-04-23 10:42:342 hrs ago1745404954IN
0xEe6f49Dc...7edfe7379
2.44561154 BERA0.000006050.03333
Yeet40829422025-04-23 10:42:282 hrs ago1745404948IN
0xEe6f49Dc...7edfe7379
2.43768905 BERA0.000006710.03333
Yeet40829372025-04-23 10:42:192 hrs ago1745404939IN
0xEe6f49Dc...7edfe7379
2.42979223 BERA0.000006050.03333
Yeet40829342025-04-23 10:42:132 hrs ago1745404933IN
0xEe6f49Dc...7edfe7379
2.42192098 BERA0.000006050.03333
Yeet40829312025-04-23 10:42:072 hrs ago1745404927IN
0xEe6f49Dc...7edfe7379
2.41407524 BERA0.000006050.03333
Yeet40829292025-04-23 10:42:032 hrs ago1745404923IN
0xEe6f49Dc...7edfe7379
2.40625491 BERA0.000006050.03333
View all transactions

Latest 25 internal transactions (View All)

Parent Transaction Hash Block From To
40881482025-04-23 13:33:466 mins ago1745415226
0xEe6f49Dc...7edfe7379
0.26502107 BERA
40881002025-04-23 13:32:118 mins ago1745415131
0xEe6f49Dc...7edfe7379
0.24748605 BERA
40864522025-04-23 12:37:501 hr ago1745411870
0xEe6f49Dc...7edfe7379
0.234927 BERA
40846722025-04-23 11:39:202 hrs ago1745408360
0xEe6f49Dc...7edfe7379
0.23184877 BERA
40837592025-04-23 11:09:172 hrs ago1745406557
0xEe6f49Dc...7edfe7379
0.233397 BERA
40833252025-04-23 10:55:042 hrs ago1745405704
0xEe6f49Dc...7edfe7379
0.232641 BERA
40829822025-04-23 10:43:462 hrs ago1745405026
0xEe6f49Dc...7edfe7379
0.22958799 BERA
40829792025-04-23 10:43:412 hrs ago1745405021
0xEe6f49Dc...7edfe7379
0.22884425 BERA
40829762025-04-23 10:43:342 hrs ago1745405014
0xEe6f49Dc...7edfe7379
0.22810291 BERA
40829732025-04-23 10:43:282 hrs ago1745405008
0xEe6f49Dc...7edfe7379
0.22736398 BERA
40829712025-04-23 10:43:242 hrs ago1745405004
0xEe6f49Dc...7edfe7379
0.22662744 BERA
40829682025-04-23 10:43:182 hrs ago1745404998
0xEe6f49Dc...7edfe7379
0.22589329 BERA
40829652025-04-23 10:43:132 hrs ago1745404993
0xEe6f49Dc...7edfe7379
0.22516151 BERA
40829612025-04-23 10:43:062 hrs ago1745404986
0xEe6f49Dc...7edfe7379
0.22443211 BERA
40829592025-04-23 10:43:022 hrs ago1745404982
0xEe6f49Dc...7edfe7379
0.22370507 BERA
40829562025-04-23 10:42:562 hrs ago1745404976
0xEe6f49Dc...7edfe7379
0.22298038 BERA
40829542025-04-23 10:42:512 hrs ago1745404971
0xEe6f49Dc...7edfe7379
0.22225804 BERA
40829512025-04-23 10:42:452 hrs ago1745404965
0xEe6f49Dc...7edfe7379
0.22153804 BERA
40829482025-04-23 10:42:392 hrs ago1745404959
0xEe6f49Dc...7edfe7379
0.22082038 BERA
40829452025-04-23 10:42:342 hrs ago1745404954
0xEe6f49Dc...7edfe7379
0.22010503 BERA
40829422025-04-23 10:42:282 hrs ago1745404948
0xEe6f49Dc...7edfe7379
0.21939201 BERA
40829372025-04-23 10:42:192 hrs ago1745404939
0xEe6f49Dc...7edfe7379
0.2186813 BERA
40829342025-04-23 10:42:132 hrs ago1745404933
0xEe6f49Dc...7edfe7379
0.21797288 BERA
40829312025-04-23 10:42:072 hrs ago1745404927
0xEe6f49Dc...7edfe7379
0.21726677 BERA
40829292025-04-23 10:42:032 hrs ago1745404923
0xEe6f49Dc...7edfe7379
0.21656294 BERA
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Yeet

Compiler Version
v0.8.26+commit.8a97fa7a

Optimization Enabled:
Yes with 200 runs

Other Settings:
cancun EvmVersion
File 1 of 44 : Yeet.sol
// SPDX-License-Identifier: AGPL-3.0-or-later
/*
 * Copyright (C) 2024 Squangleding Corporation
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program. If not, see <https://www.gnu.org/licenses/>.
 *
 * Full license text is available at:
 * https://github.com/yeet-protocol/contracts/blob/main/LICENSE.md
 */
pragma solidity ^0.8.19;

import "./Reward.sol";
import "./YeetToken.sol";
import "./Stake.sol";
import "./YeetGameSettings.sol";
import "./INFTContract.sol";
import "@openzeppelin/contracts/utils/Pausable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";

import "./Yeetback.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import "../lib/forge-std/src/console2.sol";
import {StakeV2} from "./StakeV2.sol";

/// @title Core game logic for Yeet
/// @notice The game works by having users yeet in a pot, the last user to yeet before the yeet time ends wins the pot
/// @notice The timer that decides when the yeet time ends is reset every time a user yeets
/// @notice User can get a multiplier on their yeet by owning NFTs
/// @notice The pot is divided into a winner pot and a yeetback pot
/// @notice The Yeetback pot is paid out to random users that yeeted in the round
contract Yeet is Pausable, Ownable, ReentrancyGuard {
    // Errors
    /// @dev InsufficientYeet is when a user tries to yeet less than the minimum yeet point
    error InsufficientYeet(uint256 provided, uint256 minimum);
    /// @dev YeetTimePassed is when a user tries to yeet after the yeet time has passed
    error YeetTimePassed(uint256 currentTime, uint256 endTime);
    /// @dev RoundStillLive is when a user tries to restart the game while the round is still live
    error RoundStillLive(uint256 roundNumber);
    /// @dev NoWinningsToClaim is when a user tries to claim winnings but has none
    error NoWinningsToClaim(address user);
    /// @dev InvalidRandomNumber is when a user tries to restart the game without a random number
    error InvalidRandomNumber();
    /// @dev CooldownNotEnded is when a user tries to restart the game before the cooldown has ended
    error CooldownNotEnded(uint256 currentTime, uint256 cooldownEndTime);
    /// @dev NotEnoughValueToPayEntropyFee is when a user tries to restart the game without paying the entropy fee
    error NotEnoughValueToPayEntropyFee(uint256 value, uint256 fee);
    /// @dev UserDoesNotOwnNFTs is when a user tries to get a boost from NFTs they do not own
    error UserDoesNotOwnNFTs(address user, uint256 tokenId);
    /// @dev NFTNotEligibleForBoost is when a user tries to get a boost from an NFT that is not eligible
    error NFTNotEligibleForBoost(uint256 tokenId);
    /// @dev ToManyTokenIds is when a user tries to yeet with too many tokenIds
    error ToManyTokenIds(uint256 length);
    /// @dev DuplicateTokenId is when a user tries to yeet with duplicate tokenIds
    error DuplicateTokenId(uint256 tokenId);

    // State variables
    /// @dev _lastYeeted is the last user to yeet before the yeet time ends
    address public lastYeeted;
    /// @dev _lastYeetedAt is the timestamp of the last yeet in the round
    uint256 public lastYeetedAt;
    /// @dev _potToWinner is the pot that goes to the winner
    uint256 public potToWinner;
    /// @dev _potToYeetback is the pot that goes to the yeetback
    uint256 public potToYeetback;
    /// @dev _nrOfYeets is the number of yeets in the round
    uint256 public nrOfYeets;
    /// @dev _yeetTimeInSeconds is the time between yeets
    uint256 public yeetTimeInSeconds;
    /// @dev _endOfYeetTime is the timestamp when the yeet time ends, it adds _yeetTimeInSeconds to the current block timestamp
    uint256 public endOfYeetTime;
    /// @notice roundNumber is the current round number
    uint256 public roundNumber = 1;
    /// @notice _roundStartTime is the timestamp when the round started
    uint256 public roundStartTime;

    // Vault
    /// @notice publicGoodsAmount is the amount of public goods tax that has been collected
    uint256 public publicGoodsAmount;
    /// @notice publicGoodsAddress is the address that the public goods tax is sent to
    address public publicGoodsAddress;
    /// @notice treasuryRevenueAddress is the address that the treasury revenue tax is sent to
    address public treasuryRevenueAddress;
    /// @notice treasuryRevenueAmount is the amount of treasury revenue tax that has been collected
    uint256 public treasuryRevenueAmount;

    // Settings from YeetGameSettings
    /// @notice see `YeetGameSettings` for more information
    uint256 public YEET_TIME_SECONDS; // The time between yeets
    uint256 public POT_DIVISION; // 1/xth of the pot eg, x%, 1/200 = 0.5%
    uint256 public TAX_PER_YEET; // The tax per yeet in %
    uint256 public TAX_TO_STAKERS; // The tax to stakers in %
    uint256 public TAX_TO_PUBLIC_GOODS; // The tax to public goods in %
    uint256 public TAX_TO_TREASURY; // The tax to treasury in %
    uint256 public YEETBACK_PERCENTAGE; // The percentage of the pot that goes to yeetback
    uint256 public COOLDOWN_TIME; // The time between rounds
    uint256 public BOOSTRAP_PHASE_DURATION; // The time between rounds
    uint256 public MINIMUM_YEET_POINT; // The minimum amount needed to yeet

    // Contracts
    /// @notice yeetTokenAddress is the address of the YeetToken contract
    address public yeetTokenAddress;
    /// @notice rewardsContract is the Reward contract
    Reward public rewardsContract;
    /// @notice stakingContract is the StakeV2 contract
    StakeV2 public stakingContract;
    /// @notice gameSettings is the YeetGameSettings contract
    YeetGameSettings public gameSettings;
    /// @notice yeetardsNFTsAddress is the address of the NFT contract
    address public yeetardsNFTsAddress;
    /// @notice yeetback is the Yeetback contract
    Yeetback public yeetback;

    // Events
    event Yeet(
        address indexed user,
        uint256 timestamp,
        uint256 basisPointTaxed,
        uint256 amountToPot,
        uint256 amountToYeetback,
        uint256 potAfterYeet,
        uint256 yeetbackAfterYeet,
        uint256 newYeetTimeInSeconds,
        uint256 newMinimumYeetPoint,
        uint256 nrOfYeets,
        uint256 round,
        uint256 timeLeftOnTimer
    );
    event YeetDistribution(
        uint256 totalAmountYeeted,
        uint256 valueToPot,
        uint256 valueToYeetback,
        uint256 valueToStakers,
        uint256 publicGoods,
        uint256 teamRevenue
    );
    event Yeetard(
        address indexed user, uint256 timestamp, uint256 potToWinnerAfter, uint256 newMinimumYeetPoint, uint256 round
    );
    event Claim(address indexed user, uint256 timestamp, uint256 value);
    event RoundWinner(address indexed user, uint256 timestamp, uint256 amount, uint256 round, uint256 nrOfYeets);
    event PublicGoodsPaidOut(address indexed add, uint256 timestamp, uint256 amount);
    event TreasuryRevenuePaidOut(address indexed add, uint256 timestamp, uint256 amount);
    event UpdatedPublicGoodsAddress(address indexed add);
    event UpdatedTreasuryRevenueAddress(address indexed add);
    event UpdatedYeetardsNFTsAddress(address indexed add);
    event RoundStarted(
        uint256 indexed round,
        uint256 startTime,
        uint256 yeetTimeInSeconds,
        uint256 potDivision,
        uint256 taxPerYeet,
        uint256 taxToStakers,
        uint256 taxToPublicGoods,
        uint256 taxToTreasury,
        uint256 yeetbackPercentage,
        uint256 cooldownTime
    );

    // Structs
    struct Winner {
        address user;
        uint256 timestamp;
        uint256 amount;
        uint256 round;
    }

    /// @notice _roundWinners is a mapping of round number to the winner of that round
    /// @dev roundNumber => Winner
    mapping(uint256 => Winner) private _roundWinners;
    /// @notice winnings is a mapping of user to their winnings
    /// @dev address => winnings amount
    mapping(address => uint256) public winnings;

    //Arrays
    /// @notice nftBoostLookup is an array of the NFT boost lookup table
    /// @dev The array index is the number of NFTs owned, the value is the boost in % with a scale of 10000
    uint256[26] public nftBoostLookup = [
        0,
        345,
        540,
        675,
        765,
        840,
        900,
        960,
        1005,
        1050,
        1080,
        1100,
        1155,
        1185,
        1215,
        1245,
        1275,
        1305,
        1335,
        1365,
        1380,
        1400,
        1440,
        1455,
        1470,
        1500
    ];

    constructor(
        address _yeetTokenAddress,
        Reward _reward,
        StakeV2 _staking,
        YeetGameSettings _gameSettings,
        address _publicGoodsAddress,
        address _teamAddress,
        address _yeetardsNFTsAddress,
        address _entropy,
        address _entropyProvider
    ) Ownable(msg.sender) Pausable() {
        require(_publicGoodsAddress != address(0), "Invalid public goods address");
        require(_teamAddress != address(0), "Invalid team address");
        require(_yeetTokenAddress != address(0), "Invalid yeet token address");

        yeetTokenAddress = _yeetTokenAddress;
        rewardsContract = _reward;
        stakingContract = _staking;
        gameSettings = _gameSettings;
        publicGoodsAddress = _publicGoodsAddress;
        treasuryRevenueAddress = _teamAddress;
        yeetardsNFTsAddress = _yeetardsNFTsAddress;

        yeetback = new Yeetback(_entropy, _entropyProvider);
        copySettings();

        lastYeetedAt = block.timestamp;
        endOfYeetTime = block.timestamp + YEET_TIME_SECONDS + BOOSTRAP_PHASE_DURATION;
        roundStartTime = block.timestamp;
        emit RoundStarted(
            roundNumber,
            block.timestamp,
            YEET_TIME_SECONDS,
            POT_DIVISION,
            TAX_PER_YEET,
            TAX_TO_STAKERS,
            TAX_TO_PUBLIC_GOODS,
            TAX_TO_TREASURY,
            YEETBACK_PERCENTAGE,
            COOLDOWN_TIME
        );
    }

    /// @notice this function is used to yeet without any tokenIds (no NFTs)
    function yeet() external payable {
        _yeet(new uint256[](0));
    }

    /// @notice this function is used to yeet with tokenIds (NFTs)
    function yeet(uint256[] memory tokenIds) external payable {
        _yeet(tokenIds);
    }

    /// @notice yeet is the main function of the game, users yeet the native token in the pot
    /// @param tokenIds the tokenIds of the NFTs the user owns, used to calculate the boost
    function _yeet(uint256[] memory tokenIds) internal {
        _verifyTokenIds(tokenIds);

        uint256 timestamp = block.timestamp;
        if (timestamp >= endOfYeetTime) {
            revert YeetTimePassed(timestamp, endOfYeetTime);
        }

        uint256 minimumYeetPoint = _minimumYeetPoint(potToWinner);
        if (msg.value < minimumYeetPoint) {
            revert InsufficientYeet(msg.value, minimumYeetPoint);
        }

        (uint256 valueToPot, uint256 valueToYeetback, uint256 valueToStakers, uint256 publicGoods, uint256 teamRevenue)
        = getDistribution(msg.value);

        publicGoodsAmount += publicGoods;
        treasuryRevenueAmount += teamRevenue;

        yeetTimeInSeconds = YEET_TIME_SECONDS;
        uint256 timeLeftOnTimer = endOfYeetTime - timestamp;

        potToYeetback += valueToYeetback;
        potToWinner += valueToPot;
        nrOfYeets += 1;
        lastYeeted = msg.sender;
        lastYeetedAt = timestamp;
        if (isBoostrapPhase()) {
            endOfYeetTime = roundStartTime + yeetTimeInSeconds + BOOSTRAP_PHASE_DURATION;
        } else {
            endOfYeetTime = timestamp + yeetTimeInSeconds;
        }

        // Useful for the for stats and history
        emit YeetDistribution(msg.value, valueToPot, valueToYeetback, valueToStakers, publicGoods, teamRevenue);
        emit Yeet(
            msg.sender,
            timestamp,
            TAX_PER_YEET,
            valueToPot,
            valueToYeetback,
            potToWinner,
            potToYeetback,
            yeetTimeInSeconds,
            _minimumYeetPoint(potToWinner),
            nrOfYeets,
            roundNumber,
            timeLeftOnTimer
        );
        if (isBoostrapPhase()) {
            uint256 amountOfTickers = msg.value / minimumYeetPoint;
            for (uint256 i = 0; i < amountOfTickers; i++) {
                yeetback.addYeetsInRound(roundNumber, msg.sender);
            }
        } else {
            yeetback.addYeetsInRound(roundNumber, msg.sender);
        }

        uint256 boostedValue = getBoostedValue(msg.sender, valueToPot, tokenIds);
        rewardsContract.addYeetVolume(msg.sender, boostedValue);
        stakingContract.depositReward{value: valueToStakers}();
    }

    /// @notice claim is the function the winner uses to claim their winnings
    function claim() external nonReentrant {
        if (winnings[msg.sender] == 0) {
            revert NoWinningsToClaim(msg.sender);
        }

        uint256 valueWon = winnings[msg.sender];
        winnings[msg.sender] = 0;
        (bool success,) = payable(msg.sender).call{value: valueWon}("");
        require(success, "Transfer failed.");
        emit Claim(msg.sender, block.timestamp, valueWon);
    }

    function hasCooldownEnded() public view returns (bool) {
        return block.timestamp >= endOfYeetTime + COOLDOWN_TIME;
    }

    /// @notice restart is the function that restarts the game, any user can call this function after the yeet time has passed
    /// @dev The function will pay out the yeetback pot to random users that yeeted in the round
    function restart(bytes32 userRandomNumber) external payable whenNotPaused {
        if (userRandomNumber == bytes32(0)) {
            revert InvalidRandomNumber();
        }

        if (!isRoundFinished()) {
            revert RoundStillLive(roundNumber);
        }

        if (!hasCooldownEnded()) {
            revert CooldownNotEnded(block.timestamp, endOfYeetTime + COOLDOWN_TIME);
        }

        emit RoundWinner(lastYeeted, block.timestamp, potToWinner, roundNumber, nrOfYeets);

        uint256 fee = yeetback.getEntropyFee();
        if (msg.value < fee) {
            revert NotEnoughValueToPayEntropyFee(msg.value, fee);
        }
        uint256 remaining = msg.value - fee;

        if (potToYeetback > 0) {
            yeetback.addYeetback{value: fee + potToYeetback}(userRandomNumber, roundNumber, potToYeetback);
        }

        winnings[lastYeeted] += potToWinner;

        _roundWinners[roundNumber] = Winner(lastYeeted, block.timestamp, potToWinner, roundNumber);

        copySettings();
        roundNumber += 1;
        potToYeetback = 0;
        potToWinner = 0;
        nrOfYeets = 0;
        lastYeeted = address(0);
        lastYeetedAt = 0;
        yeetTimeInSeconds = YEET_TIME_SECONDS;
        endOfYeetTime = block.timestamp + yeetTimeInSeconds + BOOSTRAP_PHASE_DURATION;
        roundStartTime = block.timestamp;

        if (remaining > 0) {
            (bool success,) = payable(msg.sender).call{value: remaining}("");
            require(success, "Transfer failed, cant return remaining value to sender");
        }

        emit RoundStarted(
            roundNumber,
            roundStartTime,
            YEET_TIME_SECONDS,
            POT_DIVISION,
            TAX_PER_YEET,
            TAX_TO_STAKERS,
            TAX_TO_PUBLIC_GOODS,
            TAX_TO_TREASURY,
            YEETBACK_PERCENTAGE,
            COOLDOWN_TIME
        );
    }

    function isRoundFinished() public view returns (bool) {
        return block.timestamp >= endOfYeetTime;
    }

    /// @notice getMinimumYeetPoint is a function that returns the minimum yeet amount needed to yeet
    /// @return uint256 the minimum yeet amount
    function minimumYeetPoint() public view returns (uint256) {
        return _minimumYeetPoint(potToWinner);
    }

    /// @notice getDistribution is a function that returns the distribution of the yeet amount
    /// @param yeetAmount the amount yeeted
    /// @return uint256 the value to the pot
    /// @return uint256 the value to the yeetback
    /// @return uint256 the value to the stakers
    /// @return uint256 the value to public goods
    /// @return uint256 the value to the treasury
    function getDistribution(uint256 yeetAmount) public view returns (uint256, uint256, uint256, uint256, uint256) {
        uint256 scale = gameSettings.SCALE();

        uint256 valueAfterTax = (yeetAmount / scale) * (scale - TAX_PER_YEET);
        uint256 valueToYeetBack = (yeetAmount / scale) * (YEETBACK_PERCENTAGE);
        uint256 valueToPot = (yeetAmount / scale) * (scale - YEETBACK_PERCENTAGE - TAX_PER_YEET);
        uint256 tax = yeetAmount - valueAfterTax;

        uint256 valueToStakers = (tax / scale) * TAX_TO_STAKERS;
        uint256 publicGoods = (tax / scale) * TAX_TO_PUBLIC_GOODS;
        uint256 teamRevenue = (tax / scale) * TAX_TO_TREASURY;

        return (valueToPot, valueToYeetBack, valueToStakers, publicGoods, teamRevenue);
    }

    /// @notice _minimumYeetPoint is a function that returns the minimum yeet amount needed to yeet
    /// @param totalPot the total pot
    /// @return uint256 the minimum yeet amount
    function _minimumYeetPoint(uint256 totalPot) private view returns (uint256) {
        if (totalPot == 0) {
            return MINIMUM_YEET_POINT;
        }

        if (isBoostrapPhase()) {
            return MINIMUM_YEET_POINT;
        }

        uint256 min = totalPot / POT_DIVISION;
        if (min < MINIMUM_YEET_POINT) {
            return MINIMUM_YEET_POINT;
        }
        return min;
    }

    /// @notice getWinner is a function that returns the winner of a round
    /// @param round the round to get the winner of
    /// @return Winner the winner of the round
    function getWinner(uint256 round) public view returns (Winner memory) {
        return _roundWinners[round];
    }

    /// @notice Add a fallback function to accept BERA
    fallback() external payable {
        //Sucks to be you ;)
        potToWinner += msg.value;
        emit Yeetard(msg.sender, block.timestamp, potToWinner, _minimumYeetPoint(potToWinner), roundNumber);
    }

    /// @notice Add a receive function to accept BERA
    receive() external payable {
        //Sucks to be you ;)
        potToWinner += msg.value;
        emit Yeetard(msg.sender, block.timestamp, potToWinner, _minimumYeetPoint(potToWinner), roundNumber);
    }

    /// @notice generic payout function
    function _payout(uint256 amount, address payable recipient, string memory errorMessage) private {
        require(amount != 0, errorMessage);
        uint256 payoutAmount = amount;
        (bool success,) = recipient.call{value: payoutAmount}("");
        require(success, "Transfer failed.");
    }

    /// @notice payoutPublicGoods is a function that pays out the public goods tax to the public goods address
    function payoutPublicGoods() external onlyOwner nonReentrant {
        _payout(publicGoodsAmount, payable(publicGoodsAddress), "Yeet: No public goods to pay out");
        emit PublicGoodsPaidOut(publicGoodsAddress, block.timestamp, publicGoodsAmount);
        publicGoodsAmount = 0;
    }

    /// @notice payoutTreasuryRevenue is a function that pays out the treasury revenue tax to the treasury revenue address
    function payoutTreasuryRevenue() external onlyOwner nonReentrant {
        _payout(treasuryRevenueAmount, payable(treasuryRevenueAddress), "Yeet: No Treasury revenue to pay out");
        emit TreasuryRevenuePaidOut(treasuryRevenueAddress, block.timestamp, treasuryRevenueAmount);
        treasuryRevenueAmount = 0;
    }

    /// @notice setPublicGoodsAddress allows the owner to set the public goods address
    function setPublicGoodsAddress(address _publicGoodsAddress) external onlyOwner {
        require(_publicGoodsAddress != address(0), "Invalid public goods address");
        publicGoodsAddress = _publicGoodsAddress;
        emit UpdatedPublicGoodsAddress(_publicGoodsAddress);
    }

    /// @notice setTreasuryRevenueAddress allows the owner to set the treasury revenue address
    function setTreasuryRevenueAddress(address _treasuryRevenueAddress) external onlyOwner {
        require(_treasuryRevenueAddress != address(0), "Invalid treasury revenue address");
        treasuryRevenueAddress = _treasuryRevenueAddress;
        emit UpdatedTreasuryRevenueAddress(_treasuryRevenueAddress);
    }

    /// @notice setYeetardsNFTsAddress allows the owner to set the NFT contract address
    // We might launche the game before we can bridge the NFTs
    function setYeetardsNFTsAddress(address _yeetardsNFTsAddress) external onlyOwner {
        require(_yeetardsNFTsAddress != address(0), "Invalid yeetards NFTs address");
        yeetardsNFTsAddress = _yeetardsNFTsAddress;
        emit UpdatedYeetardsNFTsAddress(_yeetardsNFTsAddress);
    }

    /// @notice updateStakingContract allows the owner to update the staking contract, used for new on vaults
    function updateStakingContract(StakeV2 _staking) external onlyOwner {
        stakingContract = _staking;
    }

    /// @notice copySettings is a function that copies the settings from the YeetGameSettings contract, that way settings cant be changed mid round
    function copySettings() internal {
        YEET_TIME_SECONDS = gameSettings.YEET_TIME_SECONDS();
        POT_DIVISION = gameSettings.POT_DIVISION();
        TAX_PER_YEET = gameSettings.TAX_PER_YEET();
        TAX_TO_STAKERS = gameSettings.TAX_TO_STAKERS();
        TAX_TO_PUBLIC_GOODS = gameSettings.TAX_TO_PUBLIC_GOODS();
        TAX_TO_TREASURY = gameSettings.TAX_TO_TREASURY();
        YEETBACK_PERCENTAGE = gameSettings.YEETBACK_PERCENTAGE();
        COOLDOWN_TIME = gameSettings.COOLDOWN_TIME();
        BOOSTRAP_PHASE_DURATION = gameSettings.BOOSTRAP_PHASE_DURATION();
        MINIMUM_YEET_POINT = gameSettings.MINIMUM_YEET_POINT();
    }

    /// @notice getBoostedValue is a function that returns the boosted value of a yeet based on how many NFTs the user owns
    /// @param sender the user that yeeted
    /// @param value the value of the yeet
    /// @param tokenIds the tokenIds of the NFTs the user owns
    /// @return uint256 the boosted value
    function getBoostedValue(address sender, uint256 value, uint256[] memory tokenIds) public view returns (uint256) {
        uint256 nftBoost = getNFTBoost(sender, tokenIds);
        return value + (value * nftBoost) / 10000;
    }

    function isBoostrapPhase() public view returns (bool) {
        return block.timestamp < roundStartTime + BOOSTRAP_PHASE_DURATION;
    }

    /// @notice getNFTBoost is a function that returns the NFT boost of a user based on how many NFTs the user owns
    function getNFTBoost(address owner, uint256[] memory tokenIds) public view returns (uint256) {
        _verifyTokenIds(tokenIds);
        if (yeetardsNFTsAddress == address(0)) {
            return 0;
        }
        INFTContract nftContract = INFTContract(yeetardsNFTsAddress);

        uint256 balance = tokenIds.length;
        for (uint256 i = 0; i < balance; i++) {
            // make sure the user is the owner of all the tokensIds
            uint256 tokenId = tokenIds[i];
            if (nftContract.ownerOf(tokenId) != owner) {
                revert UserDoesNotOwnNFTs(owner, tokenId);
            }
        }

        if (balance > nftBoostLookup.length - 1) {
            return nftBoostLookup[nftBoostLookup.length - 1];
        }

        return nftBoostLookup[balance];
    }

    function pause() external onlyOwner {
        _pause();
    }

    function unpause() external onlyOwner {
        _unpause();
    }

    function _verifyTokenIds(uint256[] memory tokenIds) internal view {
        if (tokenIds.length > nftBoostLookup.length) {
            revert ToManyTokenIds(tokenIds.length);
        }

        if (tokenIds.length == 0) {
            return;
        }

        for (uint256 i = 0; i < tokenIds.length - 1; i++) {
            if (tokenIds[i] >= tokenIds[i + 1]) {
                revert DuplicateTokenId(tokenIds[i]);
            }
        }
    }
}

File 2 of 44 : Reward.sol
// SPDX-License-Identifier: AGPL-3.0-or-later
/*
 * Copyright (C) 2024 Squangleding Corporation
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program. If not, see <https://www.gnu.org/licenses/>.
 *
 * Full license text is available at:
 * https://github.com/yeet-protocol/contracts/blob/main/LICENSE.md
 */
pragma solidity ^0.8.19;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/access/Ownable2Step.sol";
import {RewardSettings} from "./RewardSettings.sol";

/// @title OnlyYeet
/// @notice A contract that only allows the Yeet contract to call certain functions
contract OnlyYeetContract is Ownable2Step {
    address public yeetContract;

    constructor(address _owner) Ownable(_owner) {}

    modifier onlyYeetOwner() {
        require(msg.sender == yeetContract, "Only yeet contract can call this function");
        _;
    }

    function setYeetContract(address _yeetContract) external onlyOwner {
        require(_yeetContract != address(0), "Invalid address");
        yeetContract = _yeetContract;
    }
}

/// @title Emission contract based on YEETING volume
/// @notice This contract is responsible for distributing rewards based on the volume of YEET that each address does under a certain period of time
contract Reward is OnlyYeetContract {
    /// @notice The token to be distributed as rewards
    IERC20 public token;
    /// @notice The settings for the rewards
    RewardSettings public rewardsSettings;

    /// @notice The total volume of YEET for each epoch
    /// @dev epoch => total volume
    mapping(uint256 => uint256) public totalYeetVolume;
    /// @notice The volume of YEET for each user in each epoch
    /// @dev epoch => user => volume
    mapping(uint256 => mapping(address => uint256)) public userYeetVolume;

    /// @notice The duration of each distribution period
    uint256 private constant DISTRIBUTION_CHANGE = 7 days;
    /// @notice The amount of tokens to be distributed in the first distribution period, eg DISTRIBUTION_CHANGE
    uint256 private constant STARTING_TOKEN_COUNT = 1_312_810 ether;
    /// @notice The length of each epoch in seconds
    uint256 private constant EPOCH_LENGTH = 1 days;
    /// @notice The rate at which the rewards decay
    /// @dev 50 = 0,5% decay per DISTRIBUTION_CHANGE period
    uint256 private constant DECAY_RATE = 50;
    /// @notice The scaling factor for fixed-point arithmetic
    uint256 private constant SCALE_FACTOR = 1e4;

    /// @notice The rewards for each epoch
    /// @dev epoch => rewards
    mapping(uint256 => uint256) public epochRewards;
    /// @notice The last epoch that a user has claimed rewards for
    /// @dev user => epoch
    /// @dev This field is to keep track of the last epoch that a user has claimed, not what epoch the user claimed in, but up to what epoch the user has claimed rewards for.
    mapping(address => uint256) public lastClaimedForEpoch;

    /// @notice The current epoch
    uint256 public currentEpoch;
    /// @notice The timestamp of the end of the current epoch
    uint256 public currentEpochEnd;
    /// @notice The timestamp of the start of the current epoch
    uint256 public currentEpochStart;

    event Rewarded(address indexed user, uint256 amount, uint256 timestamp);
    event EpochStarted(uint256 indexed epoch, uint256 startTime, uint256 endTime, uint256 rewards);
    event ParsecSkipper(address user, uint256 startEpoch, uint256 endEpoch);

    /// @param _token: The token to be distributed as rewards
    /// @param _settings: The settings for the rewards
    constructor(IERC20 _token, RewardSettings _settings) OnlyYeetContract(msg.sender) {
        token = _token;
        rewardsSettings = _settings;
        currentEpochStart = getLastMidnight();
        currentEpochEnd = _calculateEpochEnd();
        currentEpoch = 1;
        epochRewards[currentEpoch] = STARTING_TOKEN_COUNT / (DISTRIBUTION_CHANGE / EPOCH_LENGTH);
        emit EpochStarted(currentEpoch, currentEpochStart, currentEpochEnd, epochRewards[currentEpoch]);
    }

    function getEpochRewardsForCurrentEpoch() public view returns (uint256) {
        return epochRewards[currentEpoch];
    }

    function getLastMidnight() public view returns (uint256) {
        return block.timestamp - (block.timestamp % 1 days);
    }

    function clawbackTokens(uint256 tokenAmount) external onlyOwner {
        bool success = token.transfer(owner(), tokenAmount);
        require(success, "ClawbackTokens: Transfer failed");
    }

    /// @notice Add volume to a user's YEET volume, and the total YEET volume for the current epoch.
    /// @notice If the epoch has ended, end the epoch.
    /// @dev Only the YEET contract can call this function
    function addYeetVolume(address user, uint256 amount) external onlyYeetOwner {
        require(amount > 0, "Amount must be greater than 0");
        require(user != address(0), "Invalid user address");

        if (_shouldEndEpoch()) {
            _endEpoch();
        }

        userYeetVolume[currentEpoch][user] += amount;
        totalYeetVolume[currentEpoch] += amount;
    }

    /// @notice Claim the rewards for the sender
    function claim() external {
        uint256 amountEarned = getClaimableAmount(msg.sender);
        require(amountEarned != 0, "Nothing to claim");
        require(token.balanceOf(address(this)) >= amountEarned, "Not enough tokens in contract");

        lastClaimedForEpoch[msg.sender] = currentEpoch - 1; // This should be the fix.
        token.transfer(msg.sender, amountEarned);
        emit Rewarded(msg.sender, amountEarned, block.timestamp);
    }

    /// @dev We could potentially have a problem here where we jump over multiple epochs
    function _endEpoch() private {
        // Check if it's time to decay the rewards
        if (currentEpoch % (DISTRIBUTION_CHANGE / EPOCH_LENGTH) == 0) {
            uint256 decayAmount = (epochRewards[currentEpoch] * DECAY_RATE) / SCALE_FACTOR;
            epochRewards[currentEpoch + 1] = epochRewards[currentEpoch] - decayAmount;
        } else {
            epochRewards[currentEpoch + 1] = epochRewards[currentEpoch];
        }

        currentEpoch++;
        currentEpochStart = currentEpochEnd;
        currentEpochEnd = _calculateEpochEnd();
        emit EpochStarted(currentEpoch, currentEpochStart, currentEpochEnd, epochRewards[currentEpoch]);
    }

    /// @notice This function sets the epoch to a specific value, its used for new users to save gas on the first claim
    /// @dev calling this function risk losing rewards for the skipped epochs
    /// @dev ONLY CALL THIS FUNCTION IF YOU KNOW WHAT YOU ARE DOING, there is no way to revert this action.
    function punchItChewie(uint256 epoch) external {
        uint256 lastEndedEpoch = currentEpoch - 1;
        uint256 lastClaimedEpoch = lastClaimedForEpoch[msg.sender];
        require(epoch <= lastEndedEpoch, "Can't jump to the future");
        require(epoch > lastClaimedEpoch, "Can't jump to the past");

        lastClaimedForEpoch[msg.sender] = epoch;
        emit ParsecSkipper(msg.sender, lastClaimedEpoch, epoch);
    }

    /// @notice Calculate the amount of tokens that a user can claim
    /// @dev if no one yeets, the epoch will never end, and the user can never claim (should not really be a problem)
    function getClaimableAmount(address user) public view returns (uint256) {
        uint256 totalClaimable;

        // Fixed-point arithmetic for more precision
        uint256 scalingFactor = 1e18;

        for (uint256 epoch = lastClaimedForEpoch[user] + 1; epoch < currentEpoch; epoch++) {
            if (totalYeetVolume[epoch] == 0) continue; // Avoid division by zero

            uint256 userVolume = userYeetVolume[epoch][user];
            uint256 totalVolume = totalYeetVolume[epoch];

            uint256 userShare = (userVolume * scalingFactor) / totalVolume;

            uint256 maxClaimable = (epochRewards[epoch] / rewardsSettings.MAX_CAP_PER_WALLET_PER_EPOCH_FACTOR());
            uint256 claimable = (userShare * epochRewards[epoch]) / scalingFactor;

            if (claimable > maxClaimable) {
                claimable = maxClaimable;
            }

            totalClaimable += claimable;
        }

        return totalClaimable;
    }

    function _calculateEpochEnd() private view returns (uint256) {
        return currentEpochStart + EPOCH_LENGTH;
    }

    function _shouldEndEpoch() private view returns (bool) {
        return block.timestamp >= currentEpochEnd;
    }
}

File 3 of 44 : YeetToken.sol
// SPDX-License-Identifier: AGPL-3.0-or-later
/*
 * Copyright (C) 2024 Squangleding Corporation
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program. If not, see <https://www.gnu.org/licenses/>.
 *
 * Full license text is available at:
 * https://github.com/yeet-protocol/contracts/blob/main/LICENSE.md
 */
pragma solidity ^0.8.19;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";

contract YeetToken is ERC20 {
    constructor() ERC20("YEET", "YEET") {
        _mint(msg.sender, 1_000_000_000 ether);
    }
}

File 4 of 44 : Stake.sol
// SPDX-License-Identifier: AGPL-3.0-or-later
/*
 * Copyright (C) 2024 Squangleding Corporation
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program. If not, see <https://www.gnu.org/licenses/>.
 *
 * Full license text is available at:
 * https://github.com/yeet-protocol/contracts/blob/main/LICENSE.md
 */
pragma solidity ^0.8.19;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/access/Ownable2Step.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";

/// @title DiscreteStakingRewards
/// @notice A simple staking contract that rewards stakers with the chain native token
/// @dev The user can deposit tokens, and then after each `depositReward` call, the user is awarded with rewards on a pro-rata basis based on the amount of tokens staked in the contract
contract DiscreteStakingRewards is ReentrancyGuard, Ownable2Step {
    /// @notice The staking token
    IERC20 public immutable stakingToken;

    /// @notice The balance of each account
    /// @dev address => balance
    mapping(address => uint256) public balanceOf;

    /// @notice The total supply of the staking token
    uint256 public totalSupply;

    /// @notice The multiplier used to calculate rewards
    uint256 private constant MULTIPLIER = 1e18;
    /// @notice The vesting period after the user starts the unstake process
    uint256 private VESTING_PERIOD = 10 days;
    /// @notice The index used to calculate rewards
    uint256 private rewardIndex;
    /// @notice The index of the user at his last contract interaction
    mapping(address => uint256) private rewardIndexOf;
    /// @notice The rewards earned by each account
    mapping(address => uint256) private earned;

    /// @notice The number of times an account has staked
    mapping(address => uint256) public stakedTimes;
    /// @notice The limit of staking times
    uint256 public constant STAKING_LIMIT = 30;

    /// @notice The struct used to store the vesting information
    struct Vesting {
        uint256 amount;
        uint256 start;
        uint256 end;
    }

    /// @notice The vestings of each account
    /// @dev address => Vesting[]
    /// @dev The array of vestings is used to allow multiple unstake processes at the same time
    mapping(address => Vesting[]) public vestings;

    event RewardDeposited(address indexed sender, uint256 amount, uint256 rewardIndex);
    event VestingStarted(address indexed addr, uint256 amount, uint256 index);
    event Stake(address indexed addr, uint256 amount);
    event Unstake(address indexed addr, uint256 amount, uint256 index);
    event RageQuit(address indexed addr, uint256 amount, uint256 amountBurned, uint256 index);
    event Claimed(address indexed addr, uint256 amount);
    event RageQuitEnabled(bool enabled);

    /// @notice The constructor of the contract
    /// @param _stakingToken The staking token
    constructor(IERC20 _stakingToken, address _owner) Ownable(_owner) {
        stakingToken = _stakingToken;
    }

    /// @notice The function used to deposit rewards
    /// @dev The function is called by the YEET game contract, but can be called by anyone
    function depositReward() external payable {
        if (totalSupply == 0) {
            return;
        }
        rewardIndex += (msg.value * MULTIPLIER) / totalSupply;
    }

    /// @notice The function used to calculate the rewards of an account
    /// @param account The account to calculate the rewards for
    function _calculateRewards(address account) private view returns (uint256) {
        uint256 shares = balanceOf[account];
        return (shares * (rewardIndex - rewardIndexOf[account])) / MULTIPLIER;
    }

    /// @notice The function used to update the rewards of an account
    /// @param account The account to update the rewards for
    function _updateRewards(address account) private {
        earned[account] += _calculateRewards(account);
        rewardIndexOf[account] = rewardIndex;
    }

    /// @notice The function used to stake tokens
    /// @param amount The amount of tokens to stake
    /// @dev updates the rewards of the account
    function stake(uint256 amount) external {
        require(amount > 0, "Amount must be greater than 0");
        _updateRewards(msg.sender);

        stakingToken.transferFrom(msg.sender, address(this), amount);

        balanceOf[msg.sender] += amount;
        totalSupply += amount;
        emit Stake(msg.sender, amount);
    }

    /// @notice The function used to start the unstake process
    /// @param unStakeAmount The amount of tokens to unstake
    /// @dev The tokens are locked for the VESTING_PERIOD
    function startUnstake(uint256 unStakeAmount) external {
        require(unStakeAmount > 0, "Amount must be greater than 0");
        require(stakedTimes[msg.sender] < STAKING_LIMIT, "Amount must be less then the STAKING_LIMIT constant"); // DOS protection https://github.com/Enigma-Dark/Yeet/issues/12
        _updateRewards(msg.sender);
        uint256 amount = balanceOf[msg.sender];
        require(amount >= unStakeAmount, "Insufficient balance");

        balanceOf[msg.sender] -= unStakeAmount;
        totalSupply -= unStakeAmount;

        uint256 start = block.timestamp;
        uint256 end = start + VESTING_PERIOD;
        vestings[msg.sender].push(Vesting(unStakeAmount, start, end));
        stakedTimes[msg.sender]++;
        emit VestingStarted(msg.sender, unStakeAmount, vestings[msg.sender].length - 1);
    }

    /// @notice The function used to unstake tokens
    /// @param index The index of the vesting to unstake
    function unstake(uint256 index) external {
        require(block.timestamp >= vestings[msg.sender][index].end, "Vesting period has not ended");
        _unstake(index);
    }

    /// @notice The function used to rage quit
    /// @notice Rage quit is used to unstake before the vesting period ends, will be called in the dApp
    /// @param index The index of the vesting to unstake
    function rageQuit(uint256 index) external {
        _unstake(index);
    }

    /// @notice The function used to unstake the tokens
    /// @param index The index of the vesting to unstake
    function _unstake(uint256 index) private {
        Vesting memory vesting = vestings[msg.sender][index];

        (uint256 unlockedAmount, uint256 lockedAmount) = calculateVesting(vesting);
        require(unlockedAmount != 0, "No unlocked amount");

        stakingToken.transfer(msg.sender, unlockedAmount);
        stakingToken.transfer(address(0x000000dead), lockedAmount);
        _remove(msg.sender, index);
        if (lockedAmount > 0) {
            emit RageQuit(msg.sender, unlockedAmount, lockedAmount, index);
        } else {
            emit Unstake(msg.sender, unlockedAmount, index);
        }
        stakedTimes[msg.sender]--;
    }

    /// @notice The function used to calculate the vesting
    /// @param vesting The vesting to calculate
    /// @return unlockedAmount The amount of tokens that can be unlocked
    /// @return lockedAmount The amount of tokens that are still locked
    function calculateVesting(Vesting memory vesting) public view returns (uint256, uint256) {
        uint256 unlockedAmount;
        uint256 lockedAmount;
        uint256 halfAmount = vesting.amount / 2;
        if (block.timestamp >= vesting.end) {
            unlockedAmount = vesting.amount;
        } else if (block.timestamp >= vesting.start) {
            uint256 timePassed = block.timestamp - vesting.start;
            uint256 timeTotal = vesting.end - vesting.start;
            uint256 linearAmount = (halfAmount * timePassed) / timeTotal;
            unlockedAmount = halfAmount + linearAmount;
            lockedAmount = vesting.amount - unlockedAmount;
        } else {
            lockedAmount = vesting.amount;
        }
        return (unlockedAmount, lockedAmount);
    }

    /// @notice The function used to get the vestings of an account
    /// @notice Used to display the vestings in the dApp
    /// @param addr The account to get the vestings for
    /// @return Vesting[] The array of vestings
    function getVestings(address addr) external view returns (Vesting[] memory) {
        return vestings[addr];
    }

    /// @notice The function used to claim the rewards
    function claim() external nonReentrant {
        _updateRewards(msg.sender);

        uint256 reward = earned[msg.sender];
        require(reward != 0, "No rewards to claim");
        earned[msg.sender] = 0;
        (bool success,) = payable(msg.sender).call{value: reward}("");
        require(success, "Transfer failed.");
        emit Claimed(msg.sender, reward);
    }

    /// @notice The function used to remove a vesting from the array
    /// @param addr The account to remove the vesting from
    /// @param _index The index of the vesting to remove
    function _remove(address addr, uint256 _index) private {
        Vesting[] storage arr = vestings[addr];
        require(_index < arr.length, "index out of bound");
        uint256 length = arr.length;

        for (uint256 i = _index; i < length - 1; i++) {
            arr[i] = arr[i + 1];
        }
        arr.pop();
    }

    function getRewardIndex() external view returns (uint256) {
        return rewardIndex;
    }

    /// @notice The function used to get the rewards earned by an account
    function calculateRewardsEarned(address account) external view returns (uint256) {
        return earned[account] + _calculateRewards(account);
    }

    /// @notice will be used for when we want to incentivize users to migrate to a new contract
    function setRageQuitEnabled(bool _enabled) external onlyOwner {
        if (_enabled) {
            VESTING_PERIOD = 10 days;
        } else {
            VESTING_PERIOD = 0;
        }
    }
}

File 5 of 44 : YeetGameSettings.sol
// SPDX-License-Identifier: AGPL-3.0-or-later
/*
 * Copyright (C) 2024 Squangleding Corporation
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program. If not, see <https://www.gnu.org/licenses/>.
 *
 * Full license text is available at:
 * https://github.com/yeet-protocol/contracts/blob/main/LICENSE.md
 */
pragma solidity ^0.8.19;

import "@openzeppelin/contracts/access/Ownable2Step.sol";

/// @title YeetGameSettings
/// @notice This contract is used to store the settings for the YeetGame
/// @notice Chaning the settings will affect the next round of the game
contract YeetGameSettings is Ownable2Step {
    uint256 public YEET_TIME_SECONDS; // The time between yeets
    uint256 public POT_DIVISION; // 1/xth of the pot eg, x%, 1/200 = 0.5%
    uint256 public TAX_PER_YEET; // The tax per yeet in %
    uint256 public TAX_TO_STAKERS; // The tax to stakers in %
    uint256 public TAX_TO_PUBLIC_GOODS; // The tax to public goods in %
    uint256 public TAX_TO_TREASURY; // The tax to treasury in %
    uint256 public YEETBACK_PERCENTAGE; // The percentage of the pot that goes to yeetback
    uint256 public COOLDOWN_TIME; // The time between rounds
    uint256 public BOOSTRAP_PHASE_DURATION; // The time between rounds
    uint256 public MINIMUM_YEET_POINT; // The minimum amount needed to yeet

    uint256 public constant SCALE = 10000;

    event YeetSettingsChanged(
        uint256 yeetTimeSeconds,
        uint256 potDivision,
        uint256 taxPerYeet,
        uint256 taxToStakers,
        uint256 taxToPublicGoods,
        uint256 taxToTreasury,
        uint256 yeetbackPercentage,
        uint256 cooldownTime,
        uint256 bootstrapPhaseDuration,
        uint256 minimumYeetPoint
    );

    constructor() Ownable(msg.sender) {
        YEET_TIME_SECONDS = 1 hours;
        POT_DIVISION = 200;

        TAX_PER_YEET = 1000;
        TAX_TO_STAKERS = 7000;
        TAX_TO_PUBLIC_GOODS = 1000;
        TAX_TO_TREASURY = 2000;
        YEETBACK_PERCENTAGE = 2000;
        COOLDOWN_TIME = 0 hours;
        BOOSTRAP_PHASE_DURATION = 0 hours;
        MINIMUM_YEET_POINT = 0.001 ether;
    }

    /// @notice Set the settings for the YeetGame
    /// @param _yeetTimeSeconds The time between yeets
    /// @param _potDivision 1/xth of the pot eg, x%, 1/200 = 0.5%
    /// @param _taxPerYeet The tax per yeet in %
    /// @param _taxToStakers The tax to stakers in %
    /// @param _taxToPublicGoods The tax to public goods in %
    /// @param _taxToTreasury The tax to treasury in %
    /// @param _yeetbackPercentage The percentage of the pot that goes to yeetback
    /// @param _cooldownTime The time between rounds
    /// @dev All values are in basis points except _yeetTimeSeconds, _cooldownTime and _potDivision
    function setYeetSettings(
        uint256 _yeetTimeSeconds,
        uint256 _potDivision,
        uint256 _taxPerYeet,
        uint256 _taxToStakers,
        uint256 _taxToPublicGoods,
        uint256 _taxToTreasury,
        uint256 _yeetbackPercentage,
        uint256 _cooldownTime,
        uint256 _bootstrapPhaseDuration,
        uint256 _minimumYeetPoint
    ) external onlyOwner {
        require(_yeetTimeSeconds >= 60, "YeetGameSettings: yeetTimeSeconds must be greater than 60 seconds");
        require(_yeetTimeSeconds <= 1 days, "YeetGameSettings: yeetTimeSeconds must be less than 1 day");

        require(_potDivision >= 10, "YeetGameSettings: potDivision must be greater than 10"); // 10% of the pot
        require(_potDivision <= 1000, "YeetGameSettings: potDivision must be less than 1000"); // 0.1% of the pot

        require(_taxPerYeet >= 100, "YeetGameSettings: taxPerYeet must be greater than 1%");
        require(_taxPerYeet <= 2000, "YeetGameSettings: taxPerYeet must be less than 20%");

        require(_taxToStakers >= 5000, "YeetGameSettings: taxToStakers must be greater than 50%");
        require(_taxToStakers <= 9000, "YeetGameSettings: taxToStakers must be less than 90%");

        require(_taxToPublicGoods >= 0, "YeetGameSettings: taxToPublicGoods must be positive");
        require(_taxToPublicGoods <= 2000, "YeetGameSettings: taxToPublicGoods must be less than 20%");

        require(_taxToTreasury >= 0, "YeetGameSettings: taxToTreasury must be positive");
        require(_taxToTreasury <= 5000, "YeetGameSettings: taxToTreasury must be less than 50%");

        require(_yeetbackPercentage >= 0, "YeetGameSettings: yeetbackPercentage must be positive");
        require(_yeetbackPercentage <= 2000, "YeetGameSettings: yeetbackPercentage must be less than 20%");

        require(
            _taxToStakers + _taxToPublicGoods + _taxToTreasury == 10000,
            "YeetGameSettings: taxToStakers + taxToPublicGoods + taxToTreasury must equal 100%"
        );

        require(_cooldownTime <= 3 days, "YeetGameSettings: cooldownTime must be less than 3 day");

        require(_bootstrapPhaseDuration <= 3 days, "YeetGameSettings: bootstrapPhaseDuration must be less than 3 day");
        require(_bootstrapPhaseDuration >= 0, "YeetGameSettings: bootstrapPhaseDuration must be greater than 0");

        require(_minimumYeetPoint >= 0.001 ether, "YeetGameSettings: minimumYeetPoint must be greater than 0.001 ether");

        YEET_TIME_SECONDS = _yeetTimeSeconds;
        POT_DIVISION = _potDivision;
        TAX_PER_YEET = _taxPerYeet;
        TAX_TO_STAKERS = _taxToStakers;
        TAX_TO_PUBLIC_GOODS = _taxToPublicGoods;
        TAX_TO_TREASURY = _taxToTreasury;
        YEETBACK_PERCENTAGE = _yeetbackPercentage;
        COOLDOWN_TIME = _cooldownTime;
        BOOSTRAP_PHASE_DURATION = _bootstrapPhaseDuration;
        MINIMUM_YEET_POINT = _minimumYeetPoint;

        emit YeetSettingsChanged(
            YEET_TIME_SECONDS,
            POT_DIVISION,
            TAX_PER_YEET,
            TAX_TO_STAKERS,
            TAX_TO_PUBLIC_GOODS,
            TAX_TO_TREASURY,
            YEETBACK_PERCENTAGE,
            COOLDOWN_TIME,
            BOOSTRAP_PHASE_DURATION,
            MINIMUM_YEET_POINT
        );
    }
}

File 6 of 44 : INFTContract.sol
// SPDX-License-Identifier: AGPL-3.0-or-later
/*
 * Copyright (C) 2024 Squangleding Corporation
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program. If not, see <https://www.gnu.org/licenses/>.
 *
 * Full license text is available at:
 * https://github.com/yeet-protocol/contracts/blob/main/LICENSE.md
 */
pragma solidity ^0.8.19;

interface INFTContract {
    function balanceOf(address owner) external view returns (uint256);

    function ownerOf(uint256 tokenId) external view returns (address);

    function transfer(address to, uint256 tokenId) external;
}

File 7 of 44 : Pausable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Pausable.sol)

pragma solidity ^0.8.20;

import {Context} from "../utils/Context.sol";

/**
 * @dev Contract module which allows children to implement an emergency stop
 * mechanism that can be triggered by an authorized account.
 *
 * This module is used through inheritance. It will make available the
 * modifiers `whenNotPaused` and `whenPaused`, which can be applied to
 * the functions of your contract. Note that they will not be pausable by
 * simply including this module, only once the modifiers are put in place.
 */
abstract contract Pausable is Context {
    bool private _paused;

    /**
     * @dev Emitted when the pause is triggered by `account`.
     */
    event Paused(address account);

    /**
     * @dev Emitted when the pause is lifted by `account`.
     */
    event Unpaused(address account);

    /**
     * @dev The operation failed because the contract is paused.
     */
    error EnforcedPause();

    /**
     * @dev The operation failed because the contract is not paused.
     */
    error ExpectedPause();

    /**
     * @dev Initializes the contract in unpaused state.
     */
    constructor() {
        _paused = false;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is not paused.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    modifier whenNotPaused() {
        _requireNotPaused();
        _;
    }

    /**
     * @dev Modifier to make a function callable only when the contract is paused.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    modifier whenPaused() {
        _requirePaused();
        _;
    }

    /**
     * @dev Returns true if the contract is paused, and false otherwise.
     */
    function paused() public view virtual returns (bool) {
        return _paused;
    }

    /**
     * @dev Throws if the contract is paused.
     */
    function _requireNotPaused() internal view virtual {
        if (paused()) {
            revert EnforcedPause();
        }
    }

    /**
     * @dev Throws if the contract is not paused.
     */
    function _requirePaused() internal view virtual {
        if (!paused()) {
            revert ExpectedPause();
        }
    }

    /**
     * @dev Triggers stopped state.
     *
     * Requirements:
     *
     * - The contract must not be paused.
     */
    function _pause() internal virtual whenNotPaused {
        _paused = true;
        emit Paused(_msgSender());
    }

    /**
     * @dev Returns to normal state.
     *
     * Requirements:
     *
     * - The contract must be paused.
     */
    function _unpause() internal virtual whenPaused {
        _paused = false;
        emit Unpaused(_msgSender());
    }
}

File 8 of 44 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)

pragma solidity ^0.8.20;

import {Context} from "../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.
 *
 * The initial owner is set to the address provided by the deployer. 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;

    /**
     * @dev The caller account is not authorized to perform an operation.
     */
    error OwnableUnauthorizedAccount(address account);

    /**
     * @dev The owner is not a valid owner account. (eg. `address(0)`)
     */
    error OwnableInvalidOwner(address owner);

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

    /**
     * @dev Initializes the contract setting the address provided by the deployer as the initial owner.
     */
    constructor(address initialOwner) {
        if (initialOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(initialOwner);
    }

    /**
     * @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 {
        if (owner() != _msgSender()) {
            revert OwnableUnauthorizedAccount(_msgSender());
        }
    }

    /**
     * @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 {
        if (newOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(newOwner);
    }

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

File 9 of 44 : Yeetback.sol
// SPDX-License-Identifier: AGPL-3.0-or-later
/*
 * Copyright (C) 2024 Squangleding Corporation
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program. If not, see <https://www.gnu.org/licenses/>.
 *
 * Full license text is available at:
 * https://github.com/yeet-protocol/contracts/blob/main/LICENSE.md
 */
pragma solidity ^0.8.19;

import {IEntropyConsumer} from "@pythnetwork/entropy-sdk-solidity/IEntropyConsumer.sol";
import {IEntropy} from "@pythnetwork/entropy-sdk-solidity/IEntropy.sol";
import "@openzeppelin/contracts/access/Ownable2Step.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";

/// @title Yeetback contract, a contract that allows users to participate in a yeetback and win some BERA from the current pot
/// @notice Every round have a yeetback pot, 10 winners are selected from the yeets in the round and they get 10% each of the yeetback pot
/// @dev The contract uses the Pyth Network Entropy SDK to generate random numbers
contract Yeetback is Ownable2Step, IEntropyConsumer, ReentrancyGuard {
    /// @dev The entropy contract address
    IEntropy private entropy;
    /// @dev The address of the entropy provider
    address private entropyProvider;

    //Mapping
    mapping(uint256 => mapping(address => uint16)) public amountOfWins;
    mapping(uint256 => mapping(address => bool)) public claimed;
    mapping(uint256 => uint256) public amountToWinners;

    /// @notice Mapping of the pot value for each round
    /// @dev round => pot value
    mapping(uint256 => uint256) public potForRound;
    /// @notice Mapping of the yeets in each round
    /// @dev round => yeets
    mapping(uint256 => address[]) public yeetsInRound;
    /// @notice Mapping of the sequence number to the round
    /// @dev sequence number => round
    mapping(uint256 => uint256) public sequenceToRound;
    /// @notice Mapping of the sequence number to VRF randomness callback status
    /// @dev sequence number => bool
    mapping(uint256 => bool) public finishedSequenceNumbers;

    event RandomNumberRequested(uint256 indexed sequenceNumber);
    event YeetbackAdded(uint256 indexed round, uint256 amount);
    event YeetbackWinner(uint256 indexed round, address indexed winner, uint256 amount, uint256 winningYeetIndex);
    event Claimed(uint256 indexed round, address indexed user, uint256 amount);

    constructor(address _entropy, address _entropyProvider) Ownable(msg.sender) {
        require(_entropy != address(0), "Yeetback: Invalid entropy address");
        require(_entropyProvider != address(0), "Yeetback: Invalid entropy provider address");
        entropy = IEntropy(_entropy);
        entropyProvider = _entropyProvider;
    }

    /// @notice Drafts the winners for the round using the random number generated by the entropy contract
    /// @dev The random number is used to select the winners from the yeets in the round
    /// @dev We don't want to get 10 random numbers from the entropy contract because it's expensive, so we use a single random number and seed it with some entropy
    /// @dev We hash the smaller number so that its distribution is more uniform
    function draftWinners(uint256 randomNumber, uint256 round) private {
        uint256 potValue = potForRound[round];
        uint256 nrOfYeets = yeetsInRound[round].length;
        uint256 nrOfWinners = 10;

        uint256 winnings = potValue / nrOfWinners;
        amountToWinners[round] = winnings;

        for (uint256 i; i < nrOfWinners; i++) {
            uint256 randomDataNumber = uint256(keccak256(abi.encodePacked(randomNumber, i)));
            uint256 winningYeetIndex = randomDataNumber % nrOfYeets; // index of the winning yeet
            address winnerAddress = yeetsInRound[round][winningYeetIndex];

            // Update amountToWinners and amountOfWins
            amountOfWins[round][winnerAddress] += 1;

            emit YeetbackWinner(round, winnerAddress, winnings, winningYeetIndex);
        }
    }

    /// @notice Adds a user to the yeets in the round, this is done from the YEET contract and will be used to select the winners
    /// @param round The round number
    /// @param user The user address
    function addYeetsInRound(uint256 round, address user) public onlyOwner {
        require(user != address(0), "Yeetback: Invalid user address");
        require(round != 0, "Invalid round");
        yeetsInRound[round].push(user);
    }

    function getYeetsInRound(uint256 round) public view returns (address[] memory) {
        return yeetsInRound[round];
    }

    /// @notice Adds a yeetback to the pot for the round, this is done after the YEET contract has finished a round
    /// @param userRandomNumber The user random number
    /// @param round The round number
    /// @param amount The amount to add to the pot
    function addYeetback(bytes32 userRandomNumber, uint256 round, uint256 amount) public payable onlyOwner {
        require(userRandomNumber != bytes32(0), "Invalid number");
        require(round != 0, "Invalid round");
        require(amount != 0, "Invalid amount");
        potForRound[round] = amount;

        uint256 fee = getEntropyFee();
        uint64 sequenceNumber = entropy.requestWithCallback{value: fee}(entropyProvider, userRandomNumber);
        sequenceToRound[sequenceNumber] = round;
        emit RandomNumberRequested(sequenceNumber);
        emit YeetbackAdded(round, amount);
    }

    /// @notice Claims the winnings for the user
    /// @param round The round number
    function claim(uint256 round) public nonReentrant {
        require(round != 0, "Yeetback: Invalid round");
        uint16 nrOfWins = amountOfWins[round][msg.sender];
        require(nrOfWins != 0, "Yeetback: No winnings to claim");
        require(!claimed[round][msg.sender], "Yeetback: Already claimed");

        claimed[round][msg.sender] = true;
        uint256 amount = amountToWinners[round] * nrOfWins;
        (bool success,) = payable(msg.sender).call{value: amount}("");
        require(success, "Transfer failed.");
        emit Claimed(round, msg.sender, amount);
    }

    /// @notice Returns the amount that the user can claim
    /// @param round The round number
    /// @param user The user address
    /// @return The amount that the user can claim
    function claimable(uint256 round, address user) public view returns (uint256) {
        uint16 nrOfWins = amountOfWins[round][user];
        uint256 amount = amountToWinners[round] * nrOfWins;
        bool haveClaimed = claimed[round][user];
        if (haveClaimed || amount == 0) {
            return 0;
        }

        return amount;
    }

    /// @notice Returns the entropy fee, used in the dApp to show the user how much they need to pay
    function getEntropyFee() public view returns (uint128) {
        return entropy.getFee(entropyProvider);
    }

    /// @dev This needs to be less then 500K in gas, otherwise the transaction will fail.
    // This method is required by the IEntropyConsumer interface.
    // It is called by the entropy contract when a random number is generated.
    function entropyCallback(
        uint64 sequenceNumber,
        // If your app uses multiple providers, you can use this argument
        // to distinguish which one is calling the app back. This app only
        // uses one provider so this argument is not used.
        address,
        bytes32 randomData
    ) internal override {
        require(!finishedSequenceNumbers[sequenceNumber], "Yeetback: Already processed");
        finishedSequenceNumbers[sequenceNumber] = true;
        draftWinners(uint256(randomData), sequenceToRound[sequenceNumber]);
    }

    // This method is required by the IEntropyConsumer interface.
    // It returns the address of the entropy contract which will call the callback.
    function getEntropy() internal view override returns (address) {
        return address(entropy);
    }
}

File 10 of 44 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/ReentrancyGuard.sol)

pragma solidity ^0.8.20;

/**
 * @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 EIP-1153 (transient storage) is available on the chain you're deploying at,
 * consider using {ReentrancyGuardTransient} instead.
 *
 * 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;

    /**
     * @dev Unauthorized reentrant call.
     */
    error ReentrancyGuardReentrantCall();

    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
        if (_status == ENTERED) {
            revert ReentrancyGuardReentrantCall();
        }

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

File 11 of 44 : console2.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.22 <0.9.0;

import {console as console2} from "./console.sol";

File 12 of 44 : StakeV2.sol
// SPDX-License-Identifier: AGPL-3.0-or-later
/*
 * Copyright (C) 2024 Squangleding Corporation
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program. If not, see <https://www.gnu.org/licenses/>.
 *
 * Full license text is available at:
 * https://github.com/yeet-protocol/contracts/blob/main/LICENSE.md
 */
pragma solidity ^0.8.19;

import "./interfaces/IWETH.sol";
import "./interfaces/IZapper.sol";
import "@openzeppelin/contracts/access/Ownable2Step.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";

interface IManager {
    function addManager(address _manager) external;

    function removeManager(address _manager) external;
}

contract Manager is IManager, Ownable {
    mapping(address => bool) public managers;

    constructor(address _owner, address _manager) Ownable(_owner) {
        managers[_owner] = true;
        managers[_manager] = true;
    }

    modifier onlyManager() {
        require(managers[msg.sender], "Only manager can call this function");
        _;
    }

    function addManager(address _manager) external override onlyOwner {
        require(!managers[_manager], "Manager already exists");
        require(_manager != address(0), "Invalid address");
        managers[_manager] = true;
    }

    function removeManager(address _manager) external override onlyOwner {
        require(managers[_manager], "Manager does not exist");
        require(_manager != address(0), "Invalid address");
        managers[_manager] = false;
    }
}

/// @title DiscreteStakingRewards
/// @notice A contract that allows a third party to deposit rewards, that later gets put in to a vault and rewards are distributed to the users based on their share of the total staked tokens
contract StakeV2 is Manager, ReentrancyGuard {
    /// @notice The staking token
    IERC20 public immutable stakingToken;
    IZapper public immutable zapper;
    /// @notice The WETH token, used for native zapping.
    IWETH public immutable wbera;

    /// @notice The balance of each account
    /// @dev address => balance
    mapping(address => uint256) public balanceOf;

    /// @notice The total supply of the staking token
    uint256 public totalSupply;

    /// @notice The multiplier used to calculate rewards
    uint256 private constant MULTIPLIER = 1e18;
    /// @notice The vesting period after the user starts the unstake process
    uint256 private constant VESTING_PERIOD = 10 days;
    /// @notice The index used to calculate rewards
    uint256 public rewardIndex;
    /// @notice The index of the user at his last contract interaction
    mapping(address => uint256) private rewardIndexOf;
    /// @notice The rewards earned by each account
    mapping(address => uint256) private earned;

    /// @notice The number of times an account has staked
    mapping(address => uint256) public stakedTimes;
    /// @notice The limit of staking times
    uint256 public constant STAKING_LIMIT = 30;
    /// @notice The accumulated rewards, that are later distributed when a manager calls the executeRewardDistribution function
    uint256 public accumulatedRewards;
    /// @notice The total amount of vault shares
    uint256 public totalVaultShares;

    /// @notice The struct used to store the vesting information
    struct Vesting {
        uint256 amount;
        uint256 start;
        uint256 end;
    }

    /// @notice The vestings of each account
    /// @dev address => Vesting[]
    /// @dev The array of vestings is used to allow multiple unstake processes at the same time
    mapping(address => Vesting[]) public vestings;

    event RewardDeposited(address indexed sender, uint256 amount);
    event RewardsDistributed(uint256 amount, uint256 rewardIndex);
    event RewardsDistributedToken0(uint256 amount, uint256 rewardIndex);
    event VestingStarted(address indexed addr, uint256 amount, uint256 index);
    event Stake(address indexed addr, uint256 amount);
    event Unstake(address indexed addr, uint256 amount, uint256 index);
    event RageQuit(address indexed addr, uint256 amount, uint256 amountBurned, uint256 index);
    event Claimed(address indexed addr, uint256 amount);
    event RageQuitEnabled(bool enabled);

    /// @notice The constructor of the contract
    /// @param _stakingToken The staking token
    constructor(IERC20 _stakingToken, IZapper _zapper, address owner, address initialManager, IWETH _wbera) Manager(owner, initialManager) {
        stakingToken = _stakingToken;
        zapper = _zapper;
        wbera = _wbera;
    }

    /// @notice The function used to deposit rewards
    /// @dev The rewards are accumulated and later distributed with the executeRewardDistribution function
    function depositReward() public payable {
        require(msg.value > 0, "Must send value");
        accumulatedRewards += msg.value;
        emit RewardDeposited(msg.sender, msg.value);
    }

    // called by WBERA when withdrawing
    fallback() external payable {}

    function depositWBERA(uint256 amount) external {
        wbera.withdraw(amount);
        this.depositReward{
                value: amount
            }();
    }

    /// @notice The function used to calculate the accumulated rewards that gets return by the zapper since swaps are not 100% efficient
    // @dev The function is used to calculate the rewards that are not distributed yet
    /// @return The accumulated rewards in YEET tokens
    function accumulatedDeptRewardsYeet() public view returns (uint256) {
        return stakingToken.balanceOf(address(this)) - totalSupply;
    }

    /// @notice The function used to distribute excess rewards to the vault.
    function executeRewardDistributionYeet(
        IZapper.SingleTokenSwap calldata swap,
        IZapper.KodiakVaultStakingParams calldata stakingParams,
        IZapper.VaultDepositParams calldata vaultParams
    ) external onlyManager nonReentrant {
        uint256 accRevToken0 = accumulatedDeptRewardsYeet();
        require(accRevToken0 > 0, "No rewards to distribute");
        require(swap.inputAmount <= accRevToken0, "Insufficient rewards to distribute");

        stakingToken.approve(address(zapper), accRevToken0);
        IERC20 token0 = IKodiakVaultV1(stakingParams.kodiakVault).token0();
        IERC20 token1 = IKodiakVaultV1(stakingParams.kodiakVault).token1();

        uint256 vaultSharesMinted;
        require(
            address(token0) == address(stakingToken) || address(token1) == address(stakingToken),
            "Neither token0 nor token1 match staking token"
        );

        if (address(token0) == address(stakingToken)) {
            (, vaultSharesMinted) = zapper.zapInToken0(swap, stakingParams, vaultParams);
        } else {
            (, vaultSharesMinted) = zapper.zapInToken1(swap, stakingParams, vaultParams);
        }

        _handleVaultShares(vaultSharesMinted);
        emit RewardsDistributedToken0(accRevToken0, rewardIndex);
    }

    function executeRewardDistribution(
        IZapper.SingleTokenSwap calldata swap0,
        IZapper.SingleTokenSwap calldata swap1,
        IZapper.KodiakVaultStakingParams calldata stakingParams,
        IZapper.VaultDepositParams calldata vaultParams
    ) external onlyManager nonReentrant {
        require(accumulatedRewards > 0, "No rewards to distribute");

        // take all wrapper BERA

        uint256 amountToDistribute = accumulatedRewards;
        accumulatedRewards = 0;

        // Use Zapper to swap accumulated BERA and deposit into vault
        (uint256 _islandTokens, uint256 vaultSharesMinted) =
                            zapper.zapInNative{value: amountToDistribute}(swap0, swap1, stakingParams, vaultParams);

        _handleVaultShares(vaultSharesMinted);
        emit RewardsDistributed(amountToDistribute, rewardIndex);
    }

    /// @notice Updates total vault shares and reward index after minting new shares
    /// @dev This is an internal function used by both reward distribution methods
    /// @param vaultSharesMinted The number of vault shares that were minted
    function _handleVaultShares(uint256 vaultSharesMinted) internal {
        require(vaultSharesMinted != 0, "No vault shares minted");
        totalVaultShares += vaultSharesMinted;

        // Update reward index
        if (totalSupply > 0) {
            rewardIndex += (vaultSharesMinted * MULTIPLIER) / totalSupply;
        }
    }

    /// @notice The function used to calculate the rewards of an account
    /// @param account The account to calculate the rewards for
    function _calculateRewards(address account) private view returns (uint256) {
        uint256 shares = balanceOf[account];
        return (shares * (rewardIndex - rewardIndexOf[account])) / MULTIPLIER;
    }

    /// @notice The function used to update the rewards of an account
    /// @param account The account to update the rewards for
    function _updateRewards(address account) private {
        earned[account] += _calculateRewards(account);
        rewardIndexOf[account] = rewardIndex;
    }

    /// @notice The function used to stake tokens
    /// @param amount The amount of tokens to stake
    /// @dev updates the rewards of the account
    function stake(uint256 amount) external {
        require(amount > 0, "Amount must be greater than 0");
        _updateRewards(msg.sender);

        stakingToken.transferFrom(msg.sender, address(this), amount);

        balanceOf[msg.sender] += amount;
        totalSupply += amount;
        emit Stake(msg.sender, amount);
    }

    /// @notice The function used to start the unstake process
    /// @param unStakeAmount The amount of tokens to unstake
    /// @dev The tokens are locked for the VESTING_PERIOD
    function startUnstake(uint256 unStakeAmount) external {
        require(unStakeAmount > 0, "Amount must be greater than 0");
        require(stakedTimes[msg.sender] < STAKING_LIMIT, "Amount must be less then the STAKING_LIMIT constant"); // DOS protection https://github.com/Enigma-Dark/Yeet/issues/12
        _updateRewards(msg.sender);
        uint256 amount = balanceOf[msg.sender];
        require(amount >= unStakeAmount, "Insufficient balance");

        balanceOf[msg.sender] -= unStakeAmount;
        totalSupply -= unStakeAmount;

        uint256 start = block.timestamp;
        uint256 end = start + VESTING_PERIOD;
        vestings[msg.sender].push(Vesting(unStakeAmount, start, end));
        stakedTimes[msg.sender]++;
        emit VestingStarted(msg.sender, unStakeAmount, vestings[msg.sender].length - 1);
    }

    /// @notice The function used to unstake tokens
    /// @param index The index of the vesting to unstake
    function unstake(uint256 index) external {
        require(block.timestamp >= vestings[msg.sender][index].end, "Vesting period has not ended");
        _unstake(index);
    }

    /// @notice The function used to rage quit
    /// @notice Rage quit is used to unstake before the vesting period ends, will be called in the dApp
    /// @param index The index of the vesting to unstake
    function rageQuit(uint256 index) external {
        _unstake(index);
    }

    /// @notice The function used to unstake the tokens
    /// @param index The index of the vesting to unstake
    function _unstake(uint256 index) private {
        Vesting memory vesting = vestings[msg.sender][index];

        (uint256 unlockedAmount, uint256 lockedAmount) = calculateVesting(vesting);
        require(unlockedAmount != 0, "No unlocked amount");

        stakingToken.transfer(msg.sender, unlockedAmount);
        stakingToken.transfer(address(0x000000dead), lockedAmount);
        _remove(msg.sender, index);
        if (lockedAmount > 0) {
            emit RageQuit(msg.sender, unlockedAmount, lockedAmount, index);
        } else {
            emit Unstake(msg.sender, unlockedAmount, index);
        }
        stakedTimes[msg.sender]--;
    }

    /// @notice The function used to calculate the vesting
    /// @param vesting The vesting to calculate
    /// @return unlockedAmount The amount of tokens that can be unlocked
    /// @return lockedAmount The amount of tokens that are still locked
    function calculateVesting(Vesting memory vesting) public view returns (uint256, uint256) {
        uint256 unlockedAmount;
        uint256 lockedAmount;
        uint256 halfAmount = vesting.amount / 2;
        if (block.timestamp >= vesting.end) {
            unlockedAmount = vesting.amount;
        } else if (block.timestamp >= vesting.start) {
            uint256 timePassed = block.timestamp - vesting.start;
            uint256 timeTotal = vesting.end - vesting.start;
            uint256 linearAmount = (halfAmount * timePassed) / timeTotal;
            unlockedAmount = halfAmount + linearAmount;
            lockedAmount = vesting.amount - unlockedAmount;
        } else {
            lockedAmount = vesting.amount;
        }
        return (unlockedAmount, lockedAmount);
    }

    /// @notice The function used to get the vestings of an account
    /// @notice Used to display the vestings in the dApp
    /// @param addr The account to get the vestings for
    /// @return Vesting[] The array of vestings
    function getVestings(address addr) external view returns (Vesting[] memory) {
        return vestings[addr];
    }

    function claimRewardsInNative(
        uint256 amountToWithdraw,
        IZapper.SingleTokenSwap calldata swapData0,
        IZapper.SingleTokenSwap calldata swapData1,
        IZapper.KodiakVaultUnstakingParams calldata unstakeParams,
        IZapper.VaultRedeemParams calldata redeemParams
    ) external nonReentrant {
        _updateRewards(msg.sender);

        IZapper.VaultRedeemParams memory updatedRedeemParams = _verifyAndPrepareClaim(amountToWithdraw, redeemParams);

        IERC20(redeemParams.vault).approve(address(zapper), amountToWithdraw);
        uint256 receivedAmount =
                            zapper.zapOutNative(msg.sender, swapData0, swapData1, unstakeParams, updatedRedeemParams);

        emit Claimed(msg.sender, receivedAmount);
    }

    function claimRewardsInToken0(
        uint256 amountToWithdraw,
        IZapper.SingleTokenSwap calldata swapData,
        IZapper.KodiakVaultUnstakingParams calldata unstakeParams,
        IZapper.VaultRedeemParams calldata redeemParams
    ) external nonReentrant {
        _updateRewards(msg.sender);

        IZapper.VaultRedeemParams memory updatedRedeemParams = _verifyAndPrepareClaim(amountToWithdraw, redeemParams);

        IERC20(redeemParams.vault).approve(address(zapper), amountToWithdraw);
        uint256 receivedAmount = zapper.zapOutToToken0(msg.sender, swapData, unstakeParams, updatedRedeemParams);

        emit Claimed(msg.sender, receivedAmount);
    }

    function claimRewardsInToken1(
        uint256 amountToWithdraw,
        IZapper.SingleTokenSwap calldata swapData,
        IZapper.KodiakVaultUnstakingParams calldata unstakeParams,
        IZapper.VaultRedeemParams calldata redeemParams
    ) external nonReentrant {
        _updateRewards(msg.sender);

        IZapper.VaultRedeemParams memory updatedRedeemParams = _verifyAndPrepareClaim(amountToWithdraw, redeemParams);

        IERC20(redeemParams.vault).approve(address(zapper), amountToWithdraw);
        uint256 receivedAmount = zapper.zapOutToToken1(msg.sender, swapData, unstakeParams, updatedRedeemParams);

        emit Claimed(msg.sender, receivedAmount);
    }

    function claimRewardsInToken(
        uint256 amountToWithdraw,
        address outputToken,
        IZapper.SingleTokenSwap calldata swap0,
        IZapper.SingleTokenSwap calldata swap1,
        IZapper.KodiakVaultUnstakingParams calldata unstakeParams,
        IZapper.VaultRedeemParams calldata redeemParams
    ) external nonReentrant {
        _updateRewards(msg.sender);

        IZapper.VaultRedeemParams memory updatedRedeemParams = _verifyAndPrepareClaim(amountToWithdraw, redeemParams);

        IERC20(redeemParams.vault).approve(address(zapper), amountToWithdraw);
        uint256 receivedAmount =
                            zapper.zapOut(outputToken, msg.sender, swap0, swap1, unstakeParams, updatedRedeemParams);

        emit Claimed(msg.sender, receivedAmount);
    }

    /// @notice The function used to remove a vesting from the array
    /// @param addr The account to remove the vesting from
    /// @param _index The index of the vesting to remove
    function _remove(address addr, uint256 _index) private {
        Vesting[] storage arr = vestings[addr];
        require(_index < arr.length, "index out of bound");
        uint256 length = arr.length;

        for (uint256 i = _index; i < length - 1; i++) {
            arr[i] = arr[i + 1];
        }
        arr.pop();
    }

    function getRewardIndex() external view returns (uint256) {
        return rewardIndex;
    }

    /// @notice The function used to get the rewards earned by an account
    function calculateRewardsEarned(address account) external view returns (uint256) {
        return earned[account] + _calculateRewards(account);
    }

    function _verifyAndPrepareClaim(uint256 amountToClaim, IZapper.VaultRedeemParams calldata redeemParams)
    private
    returns (IZapper.VaultRedeemParams memory)
    {
        uint256 userReward = earned[msg.sender];
        require(userReward > 0, "No rewards to claim");
        require(amountToClaim <= userReward, "Amount to claim exceeds rewards earned");
        earned[msg.sender] -= amountToClaim;
        totalVaultShares -= amountToClaim;

        return IZapper.VaultRedeemParams({
            vault: redeemParams.vault,
            receiver: redeemParams.receiver,
            shares: amountToClaim,
            minAssets: redeemParams.minAssets
        });
    }
}

File 13 of 44 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC-20 standard as defined in the ERC.
 */
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 value of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

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

    /**
     * @dev Moves a `value` amount of 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 value) 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 a `value` amount of tokens 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 value) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to` using the
     * allowance mechanism. `value` 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 value) external returns (bool);
}

File 14 of 44 : Ownable2Step.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (access/Ownable2Step.sol)

pragma solidity ^0.8.20;

import {Ownable} from "./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.
 *
 * This extension of the {Ownable} contract includes a two-step mechanism to transfer
 * ownership, where the new owner must call {acceptOwnership} in order to replace the
 * old one. This can help prevent common mistakes, such as transfers of ownership to
 * incorrect accounts, or to contracts that are unable to interact with the
 * permission system.
 *
 * The initial owner is specified at deployment time in the constructor for `Ownable`. 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.
     *
     * Setting `newOwner` to the zero address is allowed; this can be used to cancel an initiated ownership transfer.
     */
    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();
        if (pendingOwner() != sender) {
            revert OwnableUnauthorizedAccount(sender);
        }
        _transferOwnership(sender);
    }
}

File 15 of 44 : RewardSettings.sol
// SPDX-License-Identifier: AGPL-3.0-or-later
/*
 * Copyright (C) 2024 Squangleding Corporation
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program. If not, see <https://www.gnu.org/licenses/>.
 *
 * Full license text is available at:
 * https://github.com/yeet-protocol/contracts/blob/main/LICENSE.md
 */
pragma solidity ^0.8.19;

import "@openzeppelin/contracts/access/Ownable2Step.sol";

/// @title RewardSettings, a contract for managing reward settings
/// @notice This contract allows the owner to set the reward settings to be used by the reward contract
contract RewardSettings is Ownable2Step {
    /// @dev The max rewards a wallet can get per epoch
    uint256 public MAX_CAP_PER_WALLET_PER_EPOCH_FACTOR;

    event YeetRewardSettingsChanged(uint256 indexed maxCapPerWalletPerEpoch);

    constructor() Ownable(msg.sender) {
        /// @dev this is in percentage, 1/10 of the total rewards
        MAX_CAP_PER_WALLET_PER_EPOCH_FACTOR = 30;
    }

    /// @notice Set the reward settings
    /// @param _maxCapPerWalletPerEpochFactor The max rewards a wallet can get per epoch
    /// @dev This function can only be called by the owner
    function setYeetRewardsSettings(uint256 _maxCapPerWalletPerEpochFactor) external onlyOwner {
        require(
            _maxCapPerWalletPerEpochFactor >= 1,
            "YeetRewardSettings: maxCapPerWalletPerEpochFactor must be greater than 1"
        ); // 1/1 of the total rewards
        require(
            _maxCapPerWalletPerEpochFactor <= 100,
            "YeetRewardSettings: maxCapPerWalletPerEpochFactor must be less than 100"
        ); // 1/100 of the total rewards

        MAX_CAP_PER_WALLET_PER_EPOCH_FACTOR = _maxCapPerWalletPerEpochFactor;

        emit YeetRewardSettingsChanged(MAX_CAP_PER_WALLET_PER_EPOCH_FACTOR);
    }
}

File 16 of 44 : ERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/ERC20.sol)

pragma solidity ^0.8.20;

import {IERC20} from "./IERC20.sol";
import {IERC20Metadata} from "./extensions/IERC20Metadata.sol";
import {Context} from "../../utils/Context.sol";
import {IERC20Errors} from "../../interfaces/draft-IERC6093.sol";

/**
 * @dev Implementation of the {IERC20} interface.
 *
 * This implementation is agnostic to the way tokens are created. This means
 * that a supply mechanism has to be added in a derived contract using {_mint}.
 *
 * TIP: For a detailed writeup see our guide
 * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How
 * to implement supply mechanisms].
 *
 * The default value of {decimals} is 18. To change this, you should override
 * this function so it returns a different value.
 *
 * We have followed general OpenZeppelin Contracts guidelines: functions revert
 * instead returning `false` on failure. This behavior is nonetheless
 * conventional and does not conflict with the expectations of ERC-20
 * applications.
 */
abstract contract ERC20 is Context, IERC20, IERC20Metadata, IERC20Errors {
    mapping(address account => uint256) private _balances;

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

    uint256 private _totalSupply;

    string private _name;
    string private _symbol;

    /**
     * @dev Sets the values for {name} and {symbol}.
     *
     * All two of these values are immutable: they can only be set once during
     * construction.
     */
    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

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

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

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

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

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

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

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

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

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

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to`.
     *
     * This internal function is equivalent to {transfer}, and can be used to
     * e.g. implement automatic token fees, slashing mechanisms, etc.
     *
     * Emits a {Transfer} event.
     *
     * NOTE: This function is not virtual, {_update} should be overridden instead.
     */
    function _transfer(address from, address to, uint256 value) internal {
        if (from == address(0)) {
            revert ERC20InvalidSender(address(0));
        }
        if (to == address(0)) {
            revert ERC20InvalidReceiver(address(0));
        }
        _update(from, to, value);
    }

    /**
     * @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints (or burns) if `from`
     * (or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding
     * this function.
     *
     * Emits a {Transfer} event.
     */
    function _update(address from, address to, uint256 value) internal virtual {
        if (from == address(0)) {
            // Overflow check required: The rest of the code assumes that totalSupply never overflows
            _totalSupply += value;
        } else {
            uint256 fromBalance = _balances[from];
            if (fromBalance < value) {
                revert ERC20InsufficientBalance(from, fromBalance, value);
            }
            unchecked {
                // Overflow not possible: value <= fromBalance <= totalSupply.
                _balances[from] = fromBalance - value;
            }
        }

        if (to == address(0)) {
            unchecked {
                // Overflow not possible: value <= totalSupply or value <= fromBalance <= totalSupply.
                _totalSupply -= value;
            }
        } else {
            unchecked {
                // Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256.
                _balances[to] += value;
            }
        }

        emit Transfer(from, to, value);
    }

    /**
     * @dev Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0).
     * Relies on the `_update` mechanism
     *
     * Emits a {Transfer} event with `from` set to the zero address.
     *
     * NOTE: This function is not virtual, {_update} should be overridden instead.
     */
    function _mint(address account, uint256 value) internal {
        if (account == address(0)) {
            revert ERC20InvalidReceiver(address(0));
        }
        _update(address(0), account, value);
    }

    /**
     * @dev Destroys a `value` amount of tokens from `account`, lowering the total supply.
     * Relies on the `_update` mechanism.
     *
     * Emits a {Transfer} event with `to` set to the zero address.
     *
     * NOTE: This function is not virtual, {_update} should be overridden instead
     */
    function _burn(address account, uint256 value) internal {
        if (account == address(0)) {
            revert ERC20InvalidSender(address(0));
        }
        _update(account, address(0), value);
    }

    /**
     * @dev Sets `value` as the allowance of `spender` over the `owner` s tokens.
     *
     * This internal function is equivalent to `approve`, and can be used to
     * e.g. set automatic allowances for certain subsystems, etc.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `owner` cannot be the zero address.
     * - `spender` cannot be the zero address.
     *
     * Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument.
     */
    function _approve(address owner, address spender, uint256 value) internal {
        _approve(owner, spender, value, true);
    }

    /**
     * @dev Variant of {_approve} with an optional flag to enable or disable the {Approval} event.
     *
     * By default (when calling {_approve}) the flag is set to true. On the other hand, approval changes made by
     * `_spendAllowance` during the `transferFrom` operation set the flag to false. This saves gas by not emitting any
     * `Approval` event during `transferFrom` operations.
     *
     * Anyone who wishes to continue emitting `Approval` events on the`transferFrom` operation can force the flag to
     * true using the following override:
     *
     * ```solidity
     * function _approve(address owner, address spender, uint256 value, bool) internal virtual override {
     *     super._approve(owner, spender, value, true);
     * }
     * ```
     *
     * Requirements are the same as {_approve}.
     */
    function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual {
        if (owner == address(0)) {
            revert ERC20InvalidApprover(address(0));
        }
        if (spender == address(0)) {
            revert ERC20InvalidSpender(address(0));
        }
        _allowances[owner][spender] = value;
        if (emitEvent) {
            emit Approval(owner, spender, value);
        }
    }

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

File 17 of 44 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)

pragma solidity ^0.8.20;

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

    function _contextSuffixLength() internal view virtual returns (uint256) {
        return 0;
    }
}

File 18 of 44 : IEntropyConsumer.sol
// SPDX-License-Identifier: Apache 2
pragma solidity ^0.8.0;

abstract contract IEntropyConsumer {
    // This method is called by Entropy to provide the random number to the consumer.
    // It asserts that the msg.sender is the Entropy contract. It is not meant to be
    // override by the consumer.
    function _entropyCallback(
        uint64 sequence,
        address provider,
        bytes32 randomNumber
    ) external {
        address entropy = getEntropy();
        require(entropy != address(0), "Entropy address not set");
        require(msg.sender == entropy, "Only Entropy can call this function");

        entropyCallback(sequence, provider, randomNumber);
    }

    // getEntropy returns Entropy contract address. The method is being used to check that the
    // callback is indeed from Entropy contract. The consumer is expected to implement this method.
    // Entropy address can be found here - https://docs.pyth.network/entropy/contract-addresses
    function getEntropy() internal view virtual returns (address);

    // This method is expected to be implemented by the consumer to handle the random number.
    // It will be called by _entropyCallback after _entropyCallback ensures that the call is
    // indeed from Entropy contract.
    function entropyCallback(
        uint64 sequence,
        address provider,
        bytes32 randomNumber
    ) internal virtual;
}

File 19 of 44 : IEntropy.sol
// SPDX-License-Identifier: Apache 2
pragma solidity ^0.8.0;

import "./EntropyEvents.sol";

interface IEntropy is EntropyEvents {
    // Register msg.sender as a randomness provider. The arguments are the provider's configuration parameters
    // and initial commitment. Re-registering the same provider rotates the provider's commitment (and updates
    // the feeInWei).
    //
    // chainLength is the number of values in the hash chain *including* the commitment, that is, chainLength >= 1.
    function register(
        uint128 feeInWei,
        bytes32 commitment,
        bytes calldata commitmentMetadata,
        uint64 chainLength,
        bytes calldata uri
    ) external;

    // Withdraw a portion of the accumulated fees for the provider msg.sender.
    // Calling this function will transfer `amount` wei to the caller (provided that they have accrued a sufficient
    // balance of fees in the contract).
    function withdraw(uint128 amount) external;

    // As a user, request a random number from `provider`. Prior to calling this method, the user should
    // generate a random number x and keep it secret. The user should then compute hash(x) and pass that
    // as the userCommitment argument. (You may call the constructUserCommitment method to compute the hash.)
    //
    // This method returns a sequence number. The user should pass this sequence number to
    // their chosen provider (the exact method for doing so will depend on the provider) to retrieve the provider's
    // number. The user should then call fulfillRequest to construct the final random number.
    //
    // This method will revert unless the caller provides a sufficient fee (at least getFee(provider)) as msg.value.
    // Note that excess value is *not* refunded to the caller.
    function request(
        address provider,
        bytes32 userCommitment,
        bool useBlockHash
    ) external payable returns (uint64 assignedSequenceNumber);

    // Request a random number. The method expects the provider address and a secret random number
    // in the arguments. It returns a sequence number.
    //
    // The address calling this function should be a contract that inherits from the IEntropyConsumer interface.
    // The `entropyCallback` method on that interface will receive a callback with the generated random number.
    //
    // This method will revert unless the caller provides a sufficient fee (at least getFee(provider)) as msg.value.
    // Note that excess value is *not* refunded to the caller.
    function requestWithCallback(
        address provider,
        bytes32 userRandomNumber
    ) external payable returns (uint64 assignedSequenceNumber);

    // Fulfill a request for a random number. This method validates the provided userRandomness and provider's proof
    // against the corresponding commitments in the in-flight request. If both values are validated, this function returns
    // the corresponding random number.
    //
    // Note that this function can only be called once per in-flight request. Calling this function deletes the stored
    // request information (so that the contract doesn't use a linear amount of storage in the number of requests).
    // If you need to use the returned random number more than once, you are responsible for storing it.
    function reveal(
        address provider,
        uint64 sequenceNumber,
        bytes32 userRevelation,
        bytes32 providerRevelation
    ) external returns (bytes32 randomNumber);

    // Fulfill a request for a random number. This method validates the provided userRandomness
    // and provider's revelation against the corresponding commitment in the in-flight request. If both values are validated
    // and the requestor address is a contract address, this function calls the requester's entropyCallback method with the
    // sequence number, provider address and the random number as arguments. Else if the requestor is an EOA, it won't call it.
    //
    // Note that this function can only be called once per in-flight request. Calling this function deletes the stored
    // request information (so that the contract doesn't use a linear amount of storage in the number of requests).
    // If you need to use the returned random number more than once, you are responsible for storing it.
    //
    // Anyone can call this method to fulfill a request, but the callback will only be made to the original requester.
    function revealWithCallback(
        address provider,
        uint64 sequenceNumber,
        bytes32 userRandomNumber,
        bytes32 providerRevelation
    ) external;

    function getProviderInfo(
        address provider
    ) external view returns (EntropyStructs.ProviderInfo memory info);

    function getDefaultProvider() external view returns (address provider);

    function getRequest(
        address provider,
        uint64 sequenceNumber
    ) external view returns (EntropyStructs.Request memory req);

    function getFee(address provider) external view returns (uint128 feeAmount);

    function getAccruedPythFees()
        external
        view
        returns (uint128 accruedPythFeesInWei);

    function setProviderFee(uint128 newFeeInWei) external;

    function setProviderUri(bytes calldata newUri) external;

    function constructUserCommitment(
        bytes32 userRandomness
    ) external pure returns (bytes32 userCommitment);

    function combineRandomValues(
        bytes32 userRandomness,
        bytes32 providerRandomness,
        bytes32 blockHash
    ) external pure returns (bytes32 combinedRandomness);
}

File 20 of 44 : console.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.22 <0.9.0;

library console {
    address constant CONSOLE_ADDRESS = address(0x000000000000000000636F6e736F6c652e6c6f67);

    function _castLogPayloadViewToPure(
        function(bytes memory) internal view fnIn
    ) internal pure returns (function(bytes memory) internal pure fnOut) {
        assembly {
            fnOut := fnIn
        }
    }

    function _sendLogPayload(bytes memory payload) internal pure {
        _castLogPayloadViewToPure(_sendLogPayloadView)(payload);
    }

    function _sendLogPayloadView(bytes memory payload) private view {
        uint256 payloadLength = payload.length;
        address consoleAddress = CONSOLE_ADDRESS;
        /// @solidity memory-safe-assembly
        assembly {
            let payloadStart := add(payload, 32)
            let r := staticcall(gas(), consoleAddress, payloadStart, payloadLength, 0, 0)
        }
    }

    function log() internal pure {
        _sendLogPayload(abi.encodeWithSignature("log()"));
    }

    function logInt(int p0) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(int)", p0));
    }

    function logUint(uint p0) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(uint)", p0));
    }

    function logString(string memory p0) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(string)", p0));
    }

    function logBool(bool p0) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bool)", p0));
    }

    function logAddress(address p0) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(address)", p0));
    }

    function logBytes(bytes memory p0) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bytes)", p0));
    }

    function logBytes1(bytes1 p0) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bytes1)", p0));
    }

    function logBytes2(bytes2 p0) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bytes2)", p0));
    }

    function logBytes3(bytes3 p0) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bytes3)", p0));
    }

    function logBytes4(bytes4 p0) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bytes4)", p0));
    }

    function logBytes5(bytes5 p0) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bytes5)", p0));
    }

    function logBytes6(bytes6 p0) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bytes6)", p0));
    }

    function logBytes7(bytes7 p0) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bytes7)", p0));
    }

    function logBytes8(bytes8 p0) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bytes8)", p0));
    }

    function logBytes9(bytes9 p0) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bytes9)", p0));
    }

    function logBytes10(bytes10 p0) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bytes10)", p0));
    }

    function logBytes11(bytes11 p0) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bytes11)", p0));
    }

    function logBytes12(bytes12 p0) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bytes12)", p0));
    }

    function logBytes13(bytes13 p0) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bytes13)", p0));
    }

    function logBytes14(bytes14 p0) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bytes14)", p0));
    }

    function logBytes15(bytes15 p0) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bytes15)", p0));
    }

    function logBytes16(bytes16 p0) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bytes16)", p0));
    }

    function logBytes17(bytes17 p0) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bytes17)", p0));
    }

    function logBytes18(bytes18 p0) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bytes18)", p0));
    }

    function logBytes19(bytes19 p0) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bytes19)", p0));
    }

    function logBytes20(bytes20 p0) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bytes20)", p0));
    }

    function logBytes21(bytes21 p0) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bytes21)", p0));
    }

    function logBytes22(bytes22 p0) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bytes22)", p0));
    }

    function logBytes23(bytes23 p0) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bytes23)", p0));
    }

    function logBytes24(bytes24 p0) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bytes24)", p0));
    }

    function logBytes25(bytes25 p0) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bytes25)", p0));
    }

    function logBytes26(bytes26 p0) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bytes26)", p0));
    }

    function logBytes27(bytes27 p0) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bytes27)", p0));
    }

    function logBytes28(bytes28 p0) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bytes28)", p0));
    }

    function logBytes29(bytes29 p0) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bytes29)", p0));
    }

    function logBytes30(bytes30 p0) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bytes30)", p0));
    }

    function logBytes31(bytes31 p0) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bytes31)", p0));
    }

    function logBytes32(bytes32 p0) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bytes32)", p0));
    }

    function log(uint p0) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(uint)", p0));
    }

    function log(int p0) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(int)", p0));
    }

    function log(string memory p0) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(string)", p0));
    }

    function log(bool p0) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bool)", p0));
    }

    function log(address p0) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(address)", p0));
    }

    function log(uint p0, uint p1) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(uint,uint)", p0, p1));
    }

    function log(uint p0, string memory p1) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(uint,string)", p0, p1));
    }

    function log(uint p0, bool p1) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(uint,bool)", p0, p1));
    }

    function log(uint p0, address p1) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(uint,address)", p0, p1));
    }

    function log(string memory p0, uint p1) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(string,uint)", p0, p1));
    }

    function log(string memory p0, int p1) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(string,int)", p0, p1));
    }

    function log(string memory p0, string memory p1) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(string,string)", p0, p1));
    }

    function log(string memory p0, bool p1) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(string,bool)", p0, p1));
    }

    function log(string memory p0, address p1) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(string,address)", p0, p1));
    }

    function log(bool p0, uint p1) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bool,uint)", p0, p1));
    }

    function log(bool p0, string memory p1) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bool,string)", p0, p1));
    }

    function log(bool p0, bool p1) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bool,bool)", p0, p1));
    }

    function log(bool p0, address p1) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bool,address)", p0, p1));
    }

    function log(address p0, uint p1) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(address,uint)", p0, p1));
    }

    function log(address p0, string memory p1) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(address,string)", p0, p1));
    }

    function log(address p0, bool p1) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(address,bool)", p0, p1));
    }

    function log(address p0, address p1) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(address,address)", p0, p1));
    }

    function log(uint p0, uint p1, uint p2) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(uint,uint,uint)", p0, p1, p2));
    }

    function log(uint p0, uint p1, string memory p2) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(uint,uint,string)", p0, p1, p2));
    }

    function log(uint p0, uint p1, bool p2) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(uint,uint,bool)", p0, p1, p2));
    }

    function log(uint p0, uint p1, address p2) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(uint,uint,address)", p0, p1, p2));
    }

    function log(uint p0, string memory p1, uint p2) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(uint,string,uint)", p0, p1, p2));
    }

    function log(uint p0, string memory p1, string memory p2) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(uint,string,string)", p0, p1, p2));
    }

    function log(uint p0, string memory p1, bool p2) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(uint,string,bool)", p0, p1, p2));
    }

    function log(uint p0, string memory p1, address p2) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(uint,string,address)", p0, p1, p2));
    }

    function log(uint p0, bool p1, uint p2) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(uint,bool,uint)", p0, p1, p2));
    }

    function log(uint p0, bool p1, string memory p2) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(uint,bool,string)", p0, p1, p2));
    }

    function log(uint p0, bool p1, bool p2) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(uint,bool,bool)", p0, p1, p2));
    }

    function log(uint p0, bool p1, address p2) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(uint,bool,address)", p0, p1, p2));
    }

    function log(uint p0, address p1, uint p2) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(uint,address,uint)", p0, p1, p2));
    }

    function log(uint p0, address p1, string memory p2) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(uint,address,string)", p0, p1, p2));
    }

    function log(uint p0, address p1, bool p2) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(uint,address,bool)", p0, p1, p2));
    }

    function log(uint p0, address p1, address p2) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(uint,address,address)", p0, p1, p2));
    }

    function log(string memory p0, uint p1, uint p2) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(string,uint,uint)", p0, p1, p2));
    }

    function log(string memory p0, uint p1, string memory p2) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(string,uint,string)", p0, p1, p2));
    }

    function log(string memory p0, uint p1, bool p2) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(string,uint,bool)", p0, p1, p2));
    }

    function log(string memory p0, uint p1, address p2) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(string,uint,address)", p0, p1, p2));
    }

    function log(string memory p0, string memory p1, uint p2) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(string,string,uint)", p0, p1, p2));
    }

    function log(string memory p0, string memory p1, string memory p2) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(string,string,string)", p0, p1, p2));
    }

    function log(string memory p0, string memory p1, bool p2) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(string,string,bool)", p0, p1, p2));
    }

    function log(string memory p0, string memory p1, address p2) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(string,string,address)", p0, p1, p2));
    }

    function log(string memory p0, bool p1, uint p2) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(string,bool,uint)", p0, p1, p2));
    }

    function log(string memory p0, bool p1, string memory p2) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(string,bool,string)", p0, p1, p2));
    }

    function log(string memory p0, bool p1, bool p2) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(string,bool,bool)", p0, p1, p2));
    }

    function log(string memory p0, bool p1, address p2) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(string,bool,address)", p0, p1, p2));
    }

    function log(string memory p0, address p1, uint p2) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(string,address,uint)", p0, p1, p2));
    }

    function log(string memory p0, address p1, string memory p2) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(string,address,string)", p0, p1, p2));
    }

    function log(string memory p0, address p1, bool p2) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(string,address,bool)", p0, p1, p2));
    }

    function log(string memory p0, address p1, address p2) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(string,address,address)", p0, p1, p2));
    }

    function log(bool p0, uint p1, uint p2) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bool,uint,uint)", p0, p1, p2));
    }

    function log(bool p0, uint p1, string memory p2) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bool,uint,string)", p0, p1, p2));
    }

    function log(bool p0, uint p1, bool p2) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bool,uint,bool)", p0, p1, p2));
    }

    function log(bool p0, uint p1, address p2) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bool,uint,address)", p0, p1, p2));
    }

    function log(bool p0, string memory p1, uint p2) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bool,string,uint)", p0, p1, p2));
    }

    function log(bool p0, string memory p1, string memory p2) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bool,string,string)", p0, p1, p2));
    }

    function log(bool p0, string memory p1, bool p2) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bool,string,bool)", p0, p1, p2));
    }

    function log(bool p0, string memory p1, address p2) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bool,string,address)", p0, p1, p2));
    }

    function log(bool p0, bool p1, uint p2) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bool,bool,uint)", p0, p1, p2));
    }

    function log(bool p0, bool p1, string memory p2) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bool,bool,string)", p0, p1, p2));
    }

    function log(bool p0, bool p1, bool p2) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bool,bool,bool)", p0, p1, p2));
    }

    function log(bool p0, bool p1, address p2) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bool,bool,address)", p0, p1, p2));
    }

    function log(bool p0, address p1, uint p2) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bool,address,uint)", p0, p1, p2));
    }

    function log(bool p0, address p1, string memory p2) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bool,address,string)", p0, p1, p2));
    }

    function log(bool p0, address p1, bool p2) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bool,address,bool)", p0, p1, p2));
    }

    function log(bool p0, address p1, address p2) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bool,address,address)", p0, p1, p2));
    }

    function log(address p0, uint p1, uint p2) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(address,uint,uint)", p0, p1, p2));
    }

    function log(address p0, uint p1, string memory p2) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(address,uint,string)", p0, p1, p2));
    }

    function log(address p0, uint p1, bool p2) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(address,uint,bool)", p0, p1, p2));
    }

    function log(address p0, uint p1, address p2) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(address,uint,address)", p0, p1, p2));
    }

    function log(address p0, string memory p1, uint p2) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(address,string,uint)", p0, p1, p2));
    }

    function log(address p0, string memory p1, string memory p2) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(address,string,string)", p0, p1, p2));
    }

    function log(address p0, string memory p1, bool p2) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(address,string,bool)", p0, p1, p2));
    }

    function log(address p0, string memory p1, address p2) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(address,string,address)", p0, p1, p2));
    }

    function log(address p0, bool p1, uint p2) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(address,bool,uint)", p0, p1, p2));
    }

    function log(address p0, bool p1, string memory p2) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(address,bool,string)", p0, p1, p2));
    }

    function log(address p0, bool p1, bool p2) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(address,bool,bool)", p0, p1, p2));
    }

    function log(address p0, bool p1, address p2) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(address,bool,address)", p0, p1, p2));
    }

    function log(address p0, address p1, uint p2) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(address,address,uint)", p0, p1, p2));
    }

    function log(address p0, address p1, string memory p2) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(address,address,string)", p0, p1, p2));
    }

    function log(address p0, address p1, bool p2) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(address,address,bool)", p0, p1, p2));
    }

    function log(address p0, address p1, address p2) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(address,address,address)", p0, p1, p2));
    }

    function log(uint p0, uint p1, uint p2, uint p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(uint,uint,uint,uint)", p0, p1, p2, p3));
    }

    function log(uint p0, uint p1, uint p2, string memory p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(uint,uint,uint,string)", p0, p1, p2, p3));
    }

    function log(uint p0, uint p1, uint p2, bool p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(uint,uint,uint,bool)", p0, p1, p2, p3));
    }

    function log(uint p0, uint p1, uint p2, address p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(uint,uint,uint,address)", p0, p1, p2, p3));
    }

    function log(uint p0, uint p1, string memory p2, uint p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(uint,uint,string,uint)", p0, p1, p2, p3));
    }

    function log(uint p0, uint p1, string memory p2, string memory p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(uint,uint,string,string)", p0, p1, p2, p3));
    }

    function log(uint p0, uint p1, string memory p2, bool p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(uint,uint,string,bool)", p0, p1, p2, p3));
    }

    function log(uint p0, uint p1, string memory p2, address p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(uint,uint,string,address)", p0, p1, p2, p3));
    }

    function log(uint p0, uint p1, bool p2, uint p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(uint,uint,bool,uint)", p0, p1, p2, p3));
    }

    function log(uint p0, uint p1, bool p2, string memory p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(uint,uint,bool,string)", p0, p1, p2, p3));
    }

    function log(uint p0, uint p1, bool p2, bool p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(uint,uint,bool,bool)", p0, p1, p2, p3));
    }

    function log(uint p0, uint p1, bool p2, address p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(uint,uint,bool,address)", p0, p1, p2, p3));
    }

    function log(uint p0, uint p1, address p2, uint p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(uint,uint,address,uint)", p0, p1, p2, p3));
    }

    function log(uint p0, uint p1, address p2, string memory p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(uint,uint,address,string)", p0, p1, p2, p3));
    }

    function log(uint p0, uint p1, address p2, bool p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(uint,uint,address,bool)", p0, p1, p2, p3));
    }

    function log(uint p0, uint p1, address p2, address p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(uint,uint,address,address)", p0, p1, p2, p3));
    }

    function log(uint p0, string memory p1, uint p2, uint p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(uint,string,uint,uint)", p0, p1, p2, p3));
    }

    function log(uint p0, string memory p1, uint p2, string memory p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(uint,string,uint,string)", p0, p1, p2, p3));
    }

    function log(uint p0, string memory p1, uint p2, bool p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(uint,string,uint,bool)", p0, p1, p2, p3));
    }

    function log(uint p0, string memory p1, uint p2, address p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(uint,string,uint,address)", p0, p1, p2, p3));
    }

    function log(uint p0, string memory p1, string memory p2, uint p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(uint,string,string,uint)", p0, p1, p2, p3));
    }

    function log(uint p0, string memory p1, string memory p2, string memory p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(uint,string,string,string)", p0, p1, p2, p3));
    }

    function log(uint p0, string memory p1, string memory p2, bool p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(uint,string,string,bool)", p0, p1, p2, p3));
    }

    function log(uint p0, string memory p1, string memory p2, address p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(uint,string,string,address)", p0, p1, p2, p3));
    }

    function log(uint p0, string memory p1, bool p2, uint p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(uint,string,bool,uint)", p0, p1, p2, p3));
    }

    function log(uint p0, string memory p1, bool p2, string memory p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(uint,string,bool,string)", p0, p1, p2, p3));
    }

    function log(uint p0, string memory p1, bool p2, bool p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(uint,string,bool,bool)", p0, p1, p2, p3));
    }

    function log(uint p0, string memory p1, bool p2, address p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(uint,string,bool,address)", p0, p1, p2, p3));
    }

    function log(uint p0, string memory p1, address p2, uint p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(uint,string,address,uint)", p0, p1, p2, p3));
    }

    function log(uint p0, string memory p1, address p2, string memory p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(uint,string,address,string)", p0, p1, p2, p3));
    }

    function log(uint p0, string memory p1, address p2, bool p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(uint,string,address,bool)", p0, p1, p2, p3));
    }

    function log(uint p0, string memory p1, address p2, address p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(uint,string,address,address)", p0, p1, p2, p3));
    }

    function log(uint p0, bool p1, uint p2, uint p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(uint,bool,uint,uint)", p0, p1, p2, p3));
    }

    function log(uint p0, bool p1, uint p2, string memory p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(uint,bool,uint,string)", p0, p1, p2, p3));
    }

    function log(uint p0, bool p1, uint p2, bool p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(uint,bool,uint,bool)", p0, p1, p2, p3));
    }

    function log(uint p0, bool p1, uint p2, address p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(uint,bool,uint,address)", p0, p1, p2, p3));
    }

    function log(uint p0, bool p1, string memory p2, uint p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(uint,bool,string,uint)", p0, p1, p2, p3));
    }

    function log(uint p0, bool p1, string memory p2, string memory p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(uint,bool,string,string)", p0, p1, p2, p3));
    }

    function log(uint p0, bool p1, string memory p2, bool p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(uint,bool,string,bool)", p0, p1, p2, p3));
    }

    function log(uint p0, bool p1, string memory p2, address p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(uint,bool,string,address)", p0, p1, p2, p3));
    }

    function log(uint p0, bool p1, bool p2, uint p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(uint,bool,bool,uint)", p0, p1, p2, p3));
    }

    function log(uint p0, bool p1, bool p2, string memory p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(uint,bool,bool,string)", p0, p1, p2, p3));
    }

    function log(uint p0, bool p1, bool p2, bool p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(uint,bool,bool,bool)", p0, p1, p2, p3));
    }

    function log(uint p0, bool p1, bool p2, address p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(uint,bool,bool,address)", p0, p1, p2, p3));
    }

    function log(uint p0, bool p1, address p2, uint p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(uint,bool,address,uint)", p0, p1, p2, p3));
    }

    function log(uint p0, bool p1, address p2, string memory p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(uint,bool,address,string)", p0, p1, p2, p3));
    }

    function log(uint p0, bool p1, address p2, bool p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(uint,bool,address,bool)", p0, p1, p2, p3));
    }

    function log(uint p0, bool p1, address p2, address p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(uint,bool,address,address)", p0, p1, p2, p3));
    }

    function log(uint p0, address p1, uint p2, uint p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(uint,address,uint,uint)", p0, p1, p2, p3));
    }

    function log(uint p0, address p1, uint p2, string memory p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(uint,address,uint,string)", p0, p1, p2, p3));
    }

    function log(uint p0, address p1, uint p2, bool p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(uint,address,uint,bool)", p0, p1, p2, p3));
    }

    function log(uint p0, address p1, uint p2, address p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(uint,address,uint,address)", p0, p1, p2, p3));
    }

    function log(uint p0, address p1, string memory p2, uint p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(uint,address,string,uint)", p0, p1, p2, p3));
    }

    function log(uint p0, address p1, string memory p2, string memory p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(uint,address,string,string)", p0, p1, p2, p3));
    }

    function log(uint p0, address p1, string memory p2, bool p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(uint,address,string,bool)", p0, p1, p2, p3));
    }

    function log(uint p0, address p1, string memory p2, address p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(uint,address,string,address)", p0, p1, p2, p3));
    }

    function log(uint p0, address p1, bool p2, uint p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(uint,address,bool,uint)", p0, p1, p2, p3));
    }

    function log(uint p0, address p1, bool p2, string memory p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(uint,address,bool,string)", p0, p1, p2, p3));
    }

    function log(uint p0, address p1, bool p2, bool p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(uint,address,bool,bool)", p0, p1, p2, p3));
    }

    function log(uint p0, address p1, bool p2, address p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(uint,address,bool,address)", p0, p1, p2, p3));
    }

    function log(uint p0, address p1, address p2, uint p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(uint,address,address,uint)", p0, p1, p2, p3));
    }

    function log(uint p0, address p1, address p2, string memory p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(uint,address,address,string)", p0, p1, p2, p3));
    }

    function log(uint p0, address p1, address p2, bool p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(uint,address,address,bool)", p0, p1, p2, p3));
    }

    function log(uint p0, address p1, address p2, address p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(uint,address,address,address)", p0, p1, p2, p3));
    }

    function log(string memory p0, uint p1, uint p2, uint p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(string,uint,uint,uint)", p0, p1, p2, p3));
    }

    function log(string memory p0, uint p1, uint p2, string memory p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(string,uint,uint,string)", p0, p1, p2, p3));
    }

    function log(string memory p0, uint p1, uint p2, bool p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(string,uint,uint,bool)", p0, p1, p2, p3));
    }

    function log(string memory p0, uint p1, uint p2, address p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(string,uint,uint,address)", p0, p1, p2, p3));
    }

    function log(string memory p0, uint p1, string memory p2, uint p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(string,uint,string,uint)", p0, p1, p2, p3));
    }

    function log(string memory p0, uint p1, string memory p2, string memory p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(string,uint,string,string)", p0, p1, p2, p3));
    }

    function log(string memory p0, uint p1, string memory p2, bool p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(string,uint,string,bool)", p0, p1, p2, p3));
    }

    function log(string memory p0, uint p1, string memory p2, address p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(string,uint,string,address)", p0, p1, p2, p3));
    }

    function log(string memory p0, uint p1, bool p2, uint p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(string,uint,bool,uint)", p0, p1, p2, p3));
    }

    function log(string memory p0, uint p1, bool p2, string memory p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(string,uint,bool,string)", p0, p1, p2, p3));
    }

    function log(string memory p0, uint p1, bool p2, bool p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(string,uint,bool,bool)", p0, p1, p2, p3));
    }

    function log(string memory p0, uint p1, bool p2, address p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(string,uint,bool,address)", p0, p1, p2, p3));
    }

    function log(string memory p0, uint p1, address p2, uint p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(string,uint,address,uint)", p0, p1, p2, p3));
    }

    function log(string memory p0, uint p1, address p2, string memory p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(string,uint,address,string)", p0, p1, p2, p3));
    }

    function log(string memory p0, uint p1, address p2, bool p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(string,uint,address,bool)", p0, p1, p2, p3));
    }

    function log(string memory p0, uint p1, address p2, address p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(string,uint,address,address)", p0, p1, p2, p3));
    }

    function log(string memory p0, string memory p1, uint p2, uint p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(string,string,uint,uint)", p0, p1, p2, p3));
    }

    function log(string memory p0, string memory p1, uint p2, string memory p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(string,string,uint,string)", p0, p1, p2, p3));
    }

    function log(string memory p0, string memory p1, uint p2, bool p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(string,string,uint,bool)", p0, p1, p2, p3));
    }

    function log(string memory p0, string memory p1, uint p2, address p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(string,string,uint,address)", p0, p1, p2, p3));
    }

    function log(string memory p0, string memory p1, string memory p2, uint p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(string,string,string,uint)", p0, p1, p2, p3));
    }

    function log(string memory p0, string memory p1, string memory p2, string memory p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(string,string,string,string)", p0, p1, p2, p3));
    }

    function log(string memory p0, string memory p1, string memory p2, bool p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(string,string,string,bool)", p0, p1, p2, p3));
    }

    function log(string memory p0, string memory p1, string memory p2, address p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(string,string,string,address)", p0, p1, p2, p3));
    }

    function log(string memory p0, string memory p1, bool p2, uint p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(string,string,bool,uint)", p0, p1, p2, p3));
    }

    function log(string memory p0, string memory p1, bool p2, string memory p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(string,string,bool,string)", p0, p1, p2, p3));
    }

    function log(string memory p0, string memory p1, bool p2, bool p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(string,string,bool,bool)", p0, p1, p2, p3));
    }

    function log(string memory p0, string memory p1, bool p2, address p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(string,string,bool,address)", p0, p1, p2, p3));
    }

    function log(string memory p0, string memory p1, address p2, uint p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(string,string,address,uint)", p0, p1, p2, p3));
    }

    function log(string memory p0, string memory p1, address p2, string memory p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(string,string,address,string)", p0, p1, p2, p3));
    }

    function log(string memory p0, string memory p1, address p2, bool p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(string,string,address,bool)", p0, p1, p2, p3));
    }

    function log(string memory p0, string memory p1, address p2, address p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(string,string,address,address)", p0, p1, p2, p3));
    }

    function log(string memory p0, bool p1, uint p2, uint p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(string,bool,uint,uint)", p0, p1, p2, p3));
    }

    function log(string memory p0, bool p1, uint p2, string memory p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(string,bool,uint,string)", p0, p1, p2, p3));
    }

    function log(string memory p0, bool p1, uint p2, bool p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(string,bool,uint,bool)", p0, p1, p2, p3));
    }

    function log(string memory p0, bool p1, uint p2, address p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(string,bool,uint,address)", p0, p1, p2, p3));
    }

    function log(string memory p0, bool p1, string memory p2, uint p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(string,bool,string,uint)", p0, p1, p2, p3));
    }

    function log(string memory p0, bool p1, string memory p2, string memory p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(string,bool,string,string)", p0, p1, p2, p3));
    }

    function log(string memory p0, bool p1, string memory p2, bool p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(string,bool,string,bool)", p0, p1, p2, p3));
    }

    function log(string memory p0, bool p1, string memory p2, address p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(string,bool,string,address)", p0, p1, p2, p3));
    }

    function log(string memory p0, bool p1, bool p2, uint p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(string,bool,bool,uint)", p0, p1, p2, p3));
    }

    function log(string memory p0, bool p1, bool p2, string memory p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(string,bool,bool,string)", p0, p1, p2, p3));
    }

    function log(string memory p0, bool p1, bool p2, bool p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(string,bool,bool,bool)", p0, p1, p2, p3));
    }

    function log(string memory p0, bool p1, bool p2, address p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(string,bool,bool,address)", p0, p1, p2, p3));
    }

    function log(string memory p0, bool p1, address p2, uint p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(string,bool,address,uint)", p0, p1, p2, p3));
    }

    function log(string memory p0, bool p1, address p2, string memory p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(string,bool,address,string)", p0, p1, p2, p3));
    }

    function log(string memory p0, bool p1, address p2, bool p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(string,bool,address,bool)", p0, p1, p2, p3));
    }

    function log(string memory p0, bool p1, address p2, address p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(string,bool,address,address)", p0, p1, p2, p3));
    }

    function log(string memory p0, address p1, uint p2, uint p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(string,address,uint,uint)", p0, p1, p2, p3));
    }

    function log(string memory p0, address p1, uint p2, string memory p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(string,address,uint,string)", p0, p1, p2, p3));
    }

    function log(string memory p0, address p1, uint p2, bool p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(string,address,uint,bool)", p0, p1, p2, p3));
    }

    function log(string memory p0, address p1, uint p2, address p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(string,address,uint,address)", p0, p1, p2, p3));
    }

    function log(string memory p0, address p1, string memory p2, uint p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(string,address,string,uint)", p0, p1, p2, p3));
    }

    function log(string memory p0, address p1, string memory p2, string memory p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(string,address,string,string)", p0, p1, p2, p3));
    }

    function log(string memory p0, address p1, string memory p2, bool p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(string,address,string,bool)", p0, p1, p2, p3));
    }

    function log(string memory p0, address p1, string memory p2, address p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(string,address,string,address)", p0, p1, p2, p3));
    }

    function log(string memory p0, address p1, bool p2, uint p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(string,address,bool,uint)", p0, p1, p2, p3));
    }

    function log(string memory p0, address p1, bool p2, string memory p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(string,address,bool,string)", p0, p1, p2, p3));
    }

    function log(string memory p0, address p1, bool p2, bool p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(string,address,bool,bool)", p0, p1, p2, p3));
    }

    function log(string memory p0, address p1, bool p2, address p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(string,address,bool,address)", p0, p1, p2, p3));
    }

    function log(string memory p0, address p1, address p2, uint p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(string,address,address,uint)", p0, p1, p2, p3));
    }

    function log(string memory p0, address p1, address p2, string memory p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(string,address,address,string)", p0, p1, p2, p3));
    }

    function log(string memory p0, address p1, address p2, bool p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(string,address,address,bool)", p0, p1, p2, p3));
    }

    function log(string memory p0, address p1, address p2, address p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(string,address,address,address)", p0, p1, p2, p3));
    }

    function log(bool p0, uint p1, uint p2, uint p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bool,uint,uint,uint)", p0, p1, p2, p3));
    }

    function log(bool p0, uint p1, uint p2, string memory p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bool,uint,uint,string)", p0, p1, p2, p3));
    }

    function log(bool p0, uint p1, uint p2, bool p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bool,uint,uint,bool)", p0, p1, p2, p3));
    }

    function log(bool p0, uint p1, uint p2, address p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bool,uint,uint,address)", p0, p1, p2, p3));
    }

    function log(bool p0, uint p1, string memory p2, uint p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bool,uint,string,uint)", p0, p1, p2, p3));
    }

    function log(bool p0, uint p1, string memory p2, string memory p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bool,uint,string,string)", p0, p1, p2, p3));
    }

    function log(bool p0, uint p1, string memory p2, bool p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bool,uint,string,bool)", p0, p1, p2, p3));
    }

    function log(bool p0, uint p1, string memory p2, address p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bool,uint,string,address)", p0, p1, p2, p3));
    }

    function log(bool p0, uint p1, bool p2, uint p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bool,uint,bool,uint)", p0, p1, p2, p3));
    }

    function log(bool p0, uint p1, bool p2, string memory p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bool,uint,bool,string)", p0, p1, p2, p3));
    }

    function log(bool p0, uint p1, bool p2, bool p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bool,uint,bool,bool)", p0, p1, p2, p3));
    }

    function log(bool p0, uint p1, bool p2, address p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bool,uint,bool,address)", p0, p1, p2, p3));
    }

    function log(bool p0, uint p1, address p2, uint p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bool,uint,address,uint)", p0, p1, p2, p3));
    }

    function log(bool p0, uint p1, address p2, string memory p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bool,uint,address,string)", p0, p1, p2, p3));
    }

    function log(bool p0, uint p1, address p2, bool p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bool,uint,address,bool)", p0, p1, p2, p3));
    }

    function log(bool p0, uint p1, address p2, address p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bool,uint,address,address)", p0, p1, p2, p3));
    }

    function log(bool p0, string memory p1, uint p2, uint p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bool,string,uint,uint)", p0, p1, p2, p3));
    }

    function log(bool p0, string memory p1, uint p2, string memory p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bool,string,uint,string)", p0, p1, p2, p3));
    }

    function log(bool p0, string memory p1, uint p2, bool p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bool,string,uint,bool)", p0, p1, p2, p3));
    }

    function log(bool p0, string memory p1, uint p2, address p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bool,string,uint,address)", p0, p1, p2, p3));
    }

    function log(bool p0, string memory p1, string memory p2, uint p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bool,string,string,uint)", p0, p1, p2, p3));
    }

    function log(bool p0, string memory p1, string memory p2, string memory p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bool,string,string,string)", p0, p1, p2, p3));
    }

    function log(bool p0, string memory p1, string memory p2, bool p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bool,string,string,bool)", p0, p1, p2, p3));
    }

    function log(bool p0, string memory p1, string memory p2, address p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bool,string,string,address)", p0, p1, p2, p3));
    }

    function log(bool p0, string memory p1, bool p2, uint p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bool,string,bool,uint)", p0, p1, p2, p3));
    }

    function log(bool p0, string memory p1, bool p2, string memory p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bool,string,bool,string)", p0, p1, p2, p3));
    }

    function log(bool p0, string memory p1, bool p2, bool p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bool,string,bool,bool)", p0, p1, p2, p3));
    }

    function log(bool p0, string memory p1, bool p2, address p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bool,string,bool,address)", p0, p1, p2, p3));
    }

    function log(bool p0, string memory p1, address p2, uint p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bool,string,address,uint)", p0, p1, p2, p3));
    }

    function log(bool p0, string memory p1, address p2, string memory p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bool,string,address,string)", p0, p1, p2, p3));
    }

    function log(bool p0, string memory p1, address p2, bool p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bool,string,address,bool)", p0, p1, p2, p3));
    }

    function log(bool p0, string memory p1, address p2, address p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bool,string,address,address)", p0, p1, p2, p3));
    }

    function log(bool p0, bool p1, uint p2, uint p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bool,bool,uint,uint)", p0, p1, p2, p3));
    }

    function log(bool p0, bool p1, uint p2, string memory p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bool,bool,uint,string)", p0, p1, p2, p3));
    }

    function log(bool p0, bool p1, uint p2, bool p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bool,bool,uint,bool)", p0, p1, p2, p3));
    }

    function log(bool p0, bool p1, uint p2, address p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bool,bool,uint,address)", p0, p1, p2, p3));
    }

    function log(bool p0, bool p1, string memory p2, uint p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bool,bool,string,uint)", p0, p1, p2, p3));
    }

    function log(bool p0, bool p1, string memory p2, string memory p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bool,bool,string,string)", p0, p1, p2, p3));
    }

    function log(bool p0, bool p1, string memory p2, bool p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bool,bool,string,bool)", p0, p1, p2, p3));
    }

    function log(bool p0, bool p1, string memory p2, address p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bool,bool,string,address)", p0, p1, p2, p3));
    }

    function log(bool p0, bool p1, bool p2, uint p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bool,bool,bool,uint)", p0, p1, p2, p3));
    }

    function log(bool p0, bool p1, bool p2, string memory p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bool,bool,bool,string)", p0, p1, p2, p3));
    }

    function log(bool p0, bool p1, bool p2, bool p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bool,bool,bool,bool)", p0, p1, p2, p3));
    }

    function log(bool p0, bool p1, bool p2, address p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bool,bool,bool,address)", p0, p1, p2, p3));
    }

    function log(bool p0, bool p1, address p2, uint p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bool,bool,address,uint)", p0, p1, p2, p3));
    }

    function log(bool p0, bool p1, address p2, string memory p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bool,bool,address,string)", p0, p1, p2, p3));
    }

    function log(bool p0, bool p1, address p2, bool p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bool,bool,address,bool)", p0, p1, p2, p3));
    }

    function log(bool p0, bool p1, address p2, address p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bool,bool,address,address)", p0, p1, p2, p3));
    }

    function log(bool p0, address p1, uint p2, uint p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bool,address,uint,uint)", p0, p1, p2, p3));
    }

    function log(bool p0, address p1, uint p2, string memory p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bool,address,uint,string)", p0, p1, p2, p3));
    }

    function log(bool p0, address p1, uint p2, bool p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bool,address,uint,bool)", p0, p1, p2, p3));
    }

    function log(bool p0, address p1, uint p2, address p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bool,address,uint,address)", p0, p1, p2, p3));
    }

    function log(bool p0, address p1, string memory p2, uint p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bool,address,string,uint)", p0, p1, p2, p3));
    }

    function log(bool p0, address p1, string memory p2, string memory p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bool,address,string,string)", p0, p1, p2, p3));
    }

    function log(bool p0, address p1, string memory p2, bool p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bool,address,string,bool)", p0, p1, p2, p3));
    }

    function log(bool p0, address p1, string memory p2, address p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bool,address,string,address)", p0, p1, p2, p3));
    }

    function log(bool p0, address p1, bool p2, uint p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bool,address,bool,uint)", p0, p1, p2, p3));
    }

    function log(bool p0, address p1, bool p2, string memory p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bool,address,bool,string)", p0, p1, p2, p3));
    }

    function log(bool p0, address p1, bool p2, bool p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bool,address,bool,bool)", p0, p1, p2, p3));
    }

    function log(bool p0, address p1, bool p2, address p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bool,address,bool,address)", p0, p1, p2, p3));
    }

    function log(bool p0, address p1, address p2, uint p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bool,address,address,uint)", p0, p1, p2, p3));
    }

    function log(bool p0, address p1, address p2, string memory p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bool,address,address,string)", p0, p1, p2, p3));
    }

    function log(bool p0, address p1, address p2, bool p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bool,address,address,bool)", p0, p1, p2, p3));
    }

    function log(bool p0, address p1, address p2, address p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(bool,address,address,address)", p0, p1, p2, p3));
    }

    function log(address p0, uint p1, uint p2, uint p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(address,uint,uint,uint)", p0, p1, p2, p3));
    }

    function log(address p0, uint p1, uint p2, string memory p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(address,uint,uint,string)", p0, p1, p2, p3));
    }

    function log(address p0, uint p1, uint p2, bool p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(address,uint,uint,bool)", p0, p1, p2, p3));
    }

    function log(address p0, uint p1, uint p2, address p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(address,uint,uint,address)", p0, p1, p2, p3));
    }

    function log(address p0, uint p1, string memory p2, uint p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(address,uint,string,uint)", p0, p1, p2, p3));
    }

    function log(address p0, uint p1, string memory p2, string memory p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(address,uint,string,string)", p0, p1, p2, p3));
    }

    function log(address p0, uint p1, string memory p2, bool p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(address,uint,string,bool)", p0, p1, p2, p3));
    }

    function log(address p0, uint p1, string memory p2, address p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(address,uint,string,address)", p0, p1, p2, p3));
    }

    function log(address p0, uint p1, bool p2, uint p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(address,uint,bool,uint)", p0, p1, p2, p3));
    }

    function log(address p0, uint p1, bool p2, string memory p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(address,uint,bool,string)", p0, p1, p2, p3));
    }

    function log(address p0, uint p1, bool p2, bool p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(address,uint,bool,bool)", p0, p1, p2, p3));
    }

    function log(address p0, uint p1, bool p2, address p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(address,uint,bool,address)", p0, p1, p2, p3));
    }

    function log(address p0, uint p1, address p2, uint p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(address,uint,address,uint)", p0, p1, p2, p3));
    }

    function log(address p0, uint p1, address p2, string memory p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(address,uint,address,string)", p0, p1, p2, p3));
    }

    function log(address p0, uint p1, address p2, bool p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(address,uint,address,bool)", p0, p1, p2, p3));
    }

    function log(address p0, uint p1, address p2, address p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(address,uint,address,address)", p0, p1, p2, p3));
    }

    function log(address p0, string memory p1, uint p2, uint p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(address,string,uint,uint)", p0, p1, p2, p3));
    }

    function log(address p0, string memory p1, uint p2, string memory p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(address,string,uint,string)", p0, p1, p2, p3));
    }

    function log(address p0, string memory p1, uint p2, bool p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(address,string,uint,bool)", p0, p1, p2, p3));
    }

    function log(address p0, string memory p1, uint p2, address p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(address,string,uint,address)", p0, p1, p2, p3));
    }

    function log(address p0, string memory p1, string memory p2, uint p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(address,string,string,uint)", p0, p1, p2, p3));
    }

    function log(address p0, string memory p1, string memory p2, string memory p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(address,string,string,string)", p0, p1, p2, p3));
    }

    function log(address p0, string memory p1, string memory p2, bool p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(address,string,string,bool)", p0, p1, p2, p3));
    }

    function log(address p0, string memory p1, string memory p2, address p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(address,string,string,address)", p0, p1, p2, p3));
    }

    function log(address p0, string memory p1, bool p2, uint p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(address,string,bool,uint)", p0, p1, p2, p3));
    }

    function log(address p0, string memory p1, bool p2, string memory p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(address,string,bool,string)", p0, p1, p2, p3));
    }

    function log(address p0, string memory p1, bool p2, bool p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(address,string,bool,bool)", p0, p1, p2, p3));
    }

    function log(address p0, string memory p1, bool p2, address p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(address,string,bool,address)", p0, p1, p2, p3));
    }

    function log(address p0, string memory p1, address p2, uint p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(address,string,address,uint)", p0, p1, p2, p3));
    }

    function log(address p0, string memory p1, address p2, string memory p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(address,string,address,string)", p0, p1, p2, p3));
    }

    function log(address p0, string memory p1, address p2, bool p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(address,string,address,bool)", p0, p1, p2, p3));
    }

    function log(address p0, string memory p1, address p2, address p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(address,string,address,address)", p0, p1, p2, p3));
    }

    function log(address p0, bool p1, uint p2, uint p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(address,bool,uint,uint)", p0, p1, p2, p3));
    }

    function log(address p0, bool p1, uint p2, string memory p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(address,bool,uint,string)", p0, p1, p2, p3));
    }

    function log(address p0, bool p1, uint p2, bool p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(address,bool,uint,bool)", p0, p1, p2, p3));
    }

    function log(address p0, bool p1, uint p2, address p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(address,bool,uint,address)", p0, p1, p2, p3));
    }

    function log(address p0, bool p1, string memory p2, uint p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(address,bool,string,uint)", p0, p1, p2, p3));
    }

    function log(address p0, bool p1, string memory p2, string memory p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(address,bool,string,string)", p0, p1, p2, p3));
    }

    function log(address p0, bool p1, string memory p2, bool p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(address,bool,string,bool)", p0, p1, p2, p3));
    }

    function log(address p0, bool p1, string memory p2, address p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(address,bool,string,address)", p0, p1, p2, p3));
    }

    function log(address p0, bool p1, bool p2, uint p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(address,bool,bool,uint)", p0, p1, p2, p3));
    }

    function log(address p0, bool p1, bool p2, string memory p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(address,bool,bool,string)", p0, p1, p2, p3));
    }

    function log(address p0, bool p1, bool p2, bool p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(address,bool,bool,bool)", p0, p1, p2, p3));
    }

    function log(address p0, bool p1, bool p2, address p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(address,bool,bool,address)", p0, p1, p2, p3));
    }

    function log(address p0, bool p1, address p2, uint p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(address,bool,address,uint)", p0, p1, p2, p3));
    }

    function log(address p0, bool p1, address p2, string memory p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(address,bool,address,string)", p0, p1, p2, p3));
    }

    function log(address p0, bool p1, address p2, bool p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(address,bool,address,bool)", p0, p1, p2, p3));
    }

    function log(address p0, bool p1, address p2, address p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(address,bool,address,address)", p0, p1, p2, p3));
    }

    function log(address p0, address p1, uint p2, uint p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(address,address,uint,uint)", p0, p1, p2, p3));
    }

    function log(address p0, address p1, uint p2, string memory p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(address,address,uint,string)", p0, p1, p2, p3));
    }

    function log(address p0, address p1, uint p2, bool p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(address,address,uint,bool)", p0, p1, p2, p3));
    }

    function log(address p0, address p1, uint p2, address p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(address,address,uint,address)", p0, p1, p2, p3));
    }

    function log(address p0, address p1, string memory p2, uint p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(address,address,string,uint)", p0, p1, p2, p3));
    }

    function log(address p0, address p1, string memory p2, string memory p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(address,address,string,string)", p0, p1, p2, p3));
    }

    function log(address p0, address p1, string memory p2, bool p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(address,address,string,bool)", p0, p1, p2, p3));
    }

    function log(address p0, address p1, string memory p2, address p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(address,address,string,address)", p0, p1, p2, p3));
    }

    function log(address p0, address p1, bool p2, uint p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(address,address,bool,uint)", p0, p1, p2, p3));
    }

    function log(address p0, address p1, bool p2, string memory p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(address,address,bool,string)", p0, p1, p2, p3));
    }

    function log(address p0, address p1, bool p2, bool p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(address,address,bool,bool)", p0, p1, p2, p3));
    }

    function log(address p0, address p1, bool p2, address p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(address,address,bool,address)", p0, p1, p2, p3));
    }

    function log(address p0, address p1, address p2, uint p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(address,address,address,uint)", p0, p1, p2, p3));
    }

    function log(address p0, address p1, address p2, string memory p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(address,address,address,string)", p0, p1, p2, p3));
    }

    function log(address p0, address p1, address p2, bool p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(address,address,address,bool)", p0, p1, p2, p3));
    }

    function log(address p0, address p1, address p2, address p3) internal pure {
        _sendLogPayload(abi.encodeWithSignature("log(address,address,address,address)", p0, p1, p2, p3));
    }
}

File 21 of 44 : IWETH.sol
pragma solidity >=0.5.0;

import {IERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol";

interface IWETH is IERC20 {
    function deposit() external payable;
    function withdraw(uint256) external;
}

File 22 of 44 : IZapper.sol
// SPDX-License-Identifier: AGPL-3.0-or-later
/*
 * Copyright (C) 2024 Squangleding Corporation
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program. If not, see <https://www.gnu.org/licenses/>.
 *
 * Full license text is available at:
 * https://github.com/yeet-protocol/contracts/blob/main/LICENSE.md
 */
pragma solidity ^0.8.19;

import {IOBRouter} from "./oogabooga/IOBRouter.sol";
import {IKodiakV1RouterStaking} from "./kodiak/IKodiakV1RouterStaking.sol";
import {IKodiakVaultV1} from "./kodiak/IKodiakVaultV1.sol";
import {IERC20} from "@openzeppelin/contracts/interfaces/IERC20.sol";

interface IZapper {
    struct MultiSwapParams {
        address[] inputTokens;
        SingleTokenSwap[] swapToToken0;
        SingleTokenSwap[] swapToToken1;
    }

    struct VaultDepositParams {
        address vault;
        address receiver;
        uint256 minShares; // front-running protection!!
    }

    struct VaultRedeemParams {
        address vault;
        address receiver;
        uint256 shares;
        uint256 minAssets; // front-running protection!!
    }

    struct KodiakVaultStakingParams {
        address kodiakVault;
        uint256 amount0Max;
        uint256 amount1Max;
        uint256 amount0Min;
        uint256 amount1Min;
        uint256 amountSharesMin;
        address receiver;
    }

    struct KodiakVaultUnstakingParams {
        address kodiakVault;
        uint256 amount0Min;
        uint256 amount1Min;
        address receiver;
    }

    struct SingleTokenSwap {
        uint256 inputAmount;
        uint256 outputQuote;
        uint256 outputMin;
        address executor;
        bytes path;
    }

    function zapInWithoutSwap(KodiakVaultStakingParams calldata stakingParams, VaultDepositParams calldata vaultParams)
        external
        returns (uint256 islandTokensReceived, uint256 vaultSharesReceived);

    function zapInToken0(
        SingleTokenSwap calldata swapData,
        KodiakVaultStakingParams calldata stakingParams,
        VaultDepositParams calldata vaultParams
    ) external returns (uint256 vaultAssetsReceived, uint256 vaultSharesMinted);

    function zapInToken1(
        SingleTokenSwap calldata swapData,
        KodiakVaultStakingParams calldata stakingParams,
        VaultDepositParams calldata vaultParams
    ) external returns (uint256 vaultAssetsReceived, uint256 vaultSharesMinted);

    function zapIn(
        address inputToken,
        SingleTokenSwap calldata swapToToken0,
        SingleTokenSwap calldata swapToToken1,
        KodiakVaultStakingParams calldata stakingParams,
        VaultDepositParams calldata vaultParams
    ) external returns (uint256, uint256);

    function zapInNative(
        SingleTokenSwap calldata swap0,
        SingleTokenSwap calldata swap1,
        IZapper.KodiakVaultStakingParams calldata stakingParams,
        IZapper.VaultDepositParams calldata vaultParams
    ) external payable returns (uint256, uint256);

    function zapOutToToken0(
        address receiver,
        SingleTokenSwap calldata swapData,
        KodiakVaultUnstakingParams calldata unstakeParams,
        VaultRedeemParams calldata redeemParams
    ) external returns (uint256 totalAmountOut);

    function zapOutToToken1(
        address receiver,
        SingleTokenSwap calldata swapData,
        KodiakVaultUnstakingParams calldata unstakeParams,
        VaultRedeemParams calldata redeemParams
    ) external returns (uint256 totalAmountOut);

    function zapOutNative(
        address receiver,
        SingleTokenSwap calldata swapData0,
        SingleTokenSwap calldata swapData1,
        KodiakVaultUnstakingParams calldata unstakeParams,
        VaultRedeemParams calldata redeemParams
    ) external returns (uint256 totalAmountOut);

    function zapOut(
        address outputToken,
        address receiver,
        SingleTokenSwap calldata swap0,
        SingleTokenSwap calldata swap1,
        KodiakVaultUnstakingParams calldata unstakeParams,
        VaultRedeemParams calldata redeemParams
    ) external returns (uint256 totalAmountOut);

    function zapInWithMultipleTokens(
        MultiSwapParams calldata swapParams,
        KodiakVaultStakingParams calldata stakingParams,
        VaultDepositParams calldata vaultParams
    ) external returns (uint256, uint256);

    function setSwapRouter(address _swapRouter) external;

    function updateSwappableTokens(address token, bool isWhitelisted) external;

    function updateWhitelistedKodiakVault(address vault, bool isWhitelisted) external;

    function setKodiakStakingRouter(address router) external;

    function setReferralCode(uint32 code) external;

    function setCompoundingVault(address vault, bool isWhitelisted) external;

    function swapRouter() external view returns (IOBRouter);

    function kodiakStakingRouter() external view returns (IKodiakV1RouterStaking);

    function referralCode() external view returns (uint32);
}

File 23 of 44 : IERC20Metadata.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/extensions/IERC20Metadata.sol)

pragma solidity ^0.8.20;

import {IERC20} from "../IERC20.sol";

/**
 * @dev Interface for the optional metadata functions from the ERC-20 standard.
 */
interface IERC20Metadata is IERC20 {
    /**
     * @dev Returns the name of the token.
     */
    function name() external view returns (string memory);

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

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

File 24 of 44 : draft-IERC6093.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (interfaces/draft-IERC6093.sol)
pragma solidity ^0.8.20;

/**
 * @dev Standard ERC-20 Errors
 * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-20 tokens.
 */
interface IERC20Errors {
    /**
     * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     * @param balance Current balance for the interacting account.
     * @param needed Minimum amount required to perform a transfer.
     */
    error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed);

    /**
     * @dev Indicates a failure with the token `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     */
    error ERC20InvalidSender(address sender);

    /**
     * @dev Indicates a failure with the token `receiver`. Used in transfers.
     * @param receiver Address to which tokens are being transferred.
     */
    error ERC20InvalidReceiver(address receiver);

    /**
     * @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers.
     * @param spender Address that may be allowed to operate on tokens without being their owner.
     * @param allowance Amount of tokens a `spender` is allowed to operate with.
     * @param needed Minimum amount required to perform a transfer.
     */
    error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed);

    /**
     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
     * @param approver Address initiating an approval operation.
     */
    error ERC20InvalidApprover(address approver);

    /**
     * @dev Indicates a failure with the `spender` to be approved. Used in approvals.
     * @param spender Address that may be allowed to operate on tokens without being their owner.
     */
    error ERC20InvalidSpender(address spender);
}

/**
 * @dev Standard ERC-721 Errors
 * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-721 tokens.
 */
interface IERC721Errors {
    /**
     * @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in ERC-20.
     * Used in balance queries.
     * @param owner Address of the current owner of a token.
     */
    error ERC721InvalidOwner(address owner);

    /**
     * @dev Indicates a `tokenId` whose `owner` is the zero address.
     * @param tokenId Identifier number of a token.
     */
    error ERC721NonexistentToken(uint256 tokenId);

    /**
     * @dev Indicates an error related to the ownership over a particular token. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     * @param tokenId Identifier number of a token.
     * @param owner Address of the current owner of a token.
     */
    error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner);

    /**
     * @dev Indicates a failure with the token `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     */
    error ERC721InvalidSender(address sender);

    /**
     * @dev Indicates a failure with the token `receiver`. Used in transfers.
     * @param receiver Address to which tokens are being transferred.
     */
    error ERC721InvalidReceiver(address receiver);

    /**
     * @dev Indicates a failure with the `operator`’s approval. Used in transfers.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     * @param tokenId Identifier number of a token.
     */
    error ERC721InsufficientApproval(address operator, uint256 tokenId);

    /**
     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
     * @param approver Address initiating an approval operation.
     */
    error ERC721InvalidApprover(address approver);

    /**
     * @dev Indicates a failure with the `operator` to be approved. Used in approvals.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     */
    error ERC721InvalidOperator(address operator);
}

/**
 * @dev Standard ERC-1155 Errors
 * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC-1155 tokens.
 */
interface IERC1155Errors {
    /**
     * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     * @param balance Current balance for the interacting account.
     * @param needed Minimum amount required to perform a transfer.
     * @param tokenId Identifier number of a token.
     */
    error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId);

    /**
     * @dev Indicates a failure with the token `sender`. Used in transfers.
     * @param sender Address whose tokens are being transferred.
     */
    error ERC1155InvalidSender(address sender);

    /**
     * @dev Indicates a failure with the token `receiver`. Used in transfers.
     * @param receiver Address to which tokens are being transferred.
     */
    error ERC1155InvalidReceiver(address receiver);

    /**
     * @dev Indicates a failure with the `operator`’s approval. Used in transfers.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     * @param owner Address of the current owner of a token.
     */
    error ERC1155MissingApprovalForAll(address operator, address owner);

    /**
     * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals.
     * @param approver Address initiating an approval operation.
     */
    error ERC1155InvalidApprover(address approver);

    /**
     * @dev Indicates a failure with the `operator` to be approved. Used in approvals.
     * @param operator Address that may be allowed to operate on tokens without being their owner.
     */
    error ERC1155InvalidOperator(address operator);

    /**
     * @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation.
     * Used in batch transfers.
     * @param idsLength Length of the array of token identifiers
     * @param valuesLength Length of the array of token amounts
     */
    error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength);
}

File 25 of 44 : EntropyEvents.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;

import "./EntropyStructs.sol";

interface EntropyEvents {
    event Registered(EntropyStructs.ProviderInfo provider);

    event Requested(EntropyStructs.Request request);
    event RequestedWithCallback(
        address indexed provider,
        address indexed requestor,
        uint64 indexed sequenceNumber,
        bytes32 userRandomNumber,
        EntropyStructs.Request request
    );

    event Revealed(
        EntropyStructs.Request request,
        bytes32 userRevelation,
        bytes32 providerRevelation,
        bytes32 blockHash,
        bytes32 randomNumber
    );
    event RevealedWithCallback(
        EntropyStructs.Request request,
        bytes32 userRandomNumber,
        bytes32 providerRevelation,
        bytes32 randomNumber
    );

    event ProviderFeeUpdated(address provider, uint128 oldFee, uint128 newFee);

    event ProviderUriUpdated(address provider, bytes oldUri, bytes newUri);
}

File 26 of 44 : IOBRouter.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.26;

interface IOBRouter {
    /// @dev Contains all information needed to describe the input and output for a swap
    struct permit2Info {
        address contractAddress;
        uint256 nonce;
        uint256 deadline;
        bytes signature;
    }

    /// @dev Contains all information needed to describe the input and output for a swap
    struct erc20PermitInfo {
        uint256 value;
        uint256 deadline;
        // Signature data
        uint8 v;
        bytes32 r;
        bytes32 s;
    }

    /// @dev Contains all information needed to describe the input and output for a swap
    struct swapTokenInfo {
        address inputToken;
        uint256 inputAmount;
        address outputToken;
        uint256 outputQuote;
        uint256 outputMin;
        address outputReceiver;
    }

    // @dev event for swapping one token for another
    event Swap(
        address sender,
        uint256 inputAmount,
        address inputToken,
        uint256 amountOut,
        address outputToken,
        int256 slippage,
        uint32 referralCode
    );

    /// @dev Holds all information for a given referral
    struct referralInfo {
        uint64 referralFee;
        address beneficiary;
        bool registered;
    }
    /// @notice Externally facing interface for swapping two tokens
    /// @param tokenInfo All information about the tokens being swapped
    /// @param pathDefinition Encoded path definition for executor
    /// @param executor Address of contract that will execute the path
    /// @param referralCode referral code to specify the source of the swap

    function swap(swapTokenInfo memory tokenInfo, bytes calldata pathDefinition, address executor, uint32 referralCode)
        external
        payable
        returns (uint256 amountOut);

    /// @notice Externally facing interface for swapping two tokens
    /// @param permit2 All additional info for Permit2 transfers
    /// @param tokenInfo All information about the tokens being swapped
    /// @param pathDefinition Encoded path definition for executor
    /// @param executor Address of contract that will execute the path
    /// @param referralCode referral code to specify the source of the swap
    function swapPermit2(
        permit2Info memory permit2,
        swapTokenInfo memory tokenInfo,
        bytes calldata pathDefinition,
        address executor,
        uint32 referralCode
    ) external returns (uint256 amountOut);

    /// @notice Externally facing interface for swapping two tokens
    /// @param permit All additional info for ERC20Permit transfers
    /// @param tokenInfo All information about the tokens being swapped
    /// @param pathDefinition Encoded path definition for executor
    /// @param executor Address of contract that will execute the path
    /// @param referralCode referral code to specify the source of the swap
    function swapERC20Permit(
        erc20PermitInfo calldata permit,
        swapTokenInfo calldata tokenInfo,
        bytes calldata pathDefinition,
        address executor,
        uint32 referralCode
    ) external returns (uint256 amountOut);
}

File 27 of 44 : IKodiakV1RouterStaking.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.20;

import {IGauge} from "./IGauge.sol";
import {IKodiakVaultV1} from "./IKodiakVaultV1.sol";

interface IKodiakV1RouterStaking {
    function addLiquidity(
        IKodiakVaultV1 pool,
        uint256 amount0Max,
        uint256 amount1Max,
        uint256 amount0Min,
        uint256 amount1Min,
        uint256 amountSharesMin,
        address receiver
    ) external returns (uint256 amount0, uint256 amount1, uint256 mintAmount);

    function addLiquidityETH(
        IKodiakVaultV1 pool,
        uint256 amount0Max,
        uint256 amount1Max,
        uint256 amount0Min,
        uint256 amount1Min,
        uint256 amountSharesMin,
        address receiver
    ) external payable returns (uint256 amount0, uint256 amount1, uint256 mintAmount);

    function addLiquidityAndStake(
        IGauge gauge,
        uint256 amount0Max,
        uint256 amount1Max,
        uint256 amount0Min,
        uint256 amount1Min,
        uint256 amountSharesMin,
        address receiver
    ) external returns (uint256 amount0, uint256 amount1, uint256 mintAmount);

    function addLiquidityETHAndStake(
        IGauge gauge,
        uint256 amount0Max,
        uint256 amount1Max,
        uint256 amount0Min,
        uint256 amount1Min,
        uint256 amountSharesMin,
        address receiver
    ) external payable returns (uint256 amount0, uint256 amount1, uint256 mintAmount);

    function removeLiquidity(
        IKodiakVaultV1 pool,
        uint256 burnAmount,
        uint256 amount0Min,
        uint256 amount1Min,
        address receiver
    ) external returns (uint256 amount0, uint256 amount1, uint128 liquidityBurned);

    function removeLiquidityETH(
        IKodiakVaultV1 pool,
        uint256 burnAmount,
        uint256 amount0Min,
        uint256 amount1Min,
        address payable receiver
    ) external returns (uint256 amount0, uint256 amount1, uint128 liquidityBurned);

    function removeLiquidityAndUnstake(
        IGauge gauge,
        uint256 burnAmount,
        uint256 amount0Min,
        uint256 amount1Min,
        address receiver
    ) external returns (uint256 amount0, uint256 amount1, uint128 liquidityBurned);

    function removeLiquidityETHAndUnstake(
        IGauge gauge,
        uint256 burnAmount,
        uint256 amount0Min,
        uint256 amount1Min,
        address payable receiver
    ) external returns (uint256 amount0, uint256 amount1, uint128 liquidityBurned);
}

// | Function Name | Sighash    | Function Signature |
// | ------------- | ---------- | ------------------ |
// | initialize | 8129fc1c | initialize() |
// | pause | 8456cb59 | pause() |
// | unpause | 3f4ba83a | unpause() |
// | addLiquidity | 74dbc248 | addLiquidity(address,uint256,uint256,uint256,uint256,uint256,address) |
// | addLiquidityAndStake | a6446c89 | addLiquidityAndStake(address,uint256,uint256,uint256,uint256,uint256,address) |
// | addLiquidityETH | 938398b7 | addLiquidityETH(address,uint256,uint256,uint256,uint256,uint256,address) |
// | addLiquidityETHAndStake | 8c220973 | addLiquidityETHAndStake(address,uint256,uint256,uint256,uint256,uint256,address) |
// | removeLiquidity | 59f842b2 | removeLiquidity(address,uint256,uint256,uint256,address) |
// | removeLiquidityAndUnstake | b83a75b3 | removeLiquidityAndUnstake(address,uint256,uint256,uint256,address) |
// | removeLiquidityETH | 6587e4ce | removeLiquidityETH(address,uint256,uint256,uint256,address) |
// | removeLiquidityETHAndUnstake | 5de56ba8 | removeLiquidityETHAndUnstake(address,uint256,uint256,uint256,address) |

File 28 of 44 : IKodiakVaultV1.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.20;

import {IERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {IUniswapV3Pool} from "@kodiak-finance/v3-core/contracts/interfaces/IUniswapV3Pool.sol";

interface IKodiakVaultV1 {
    function mint(uint256 mintAmount, address receiver)
        external
        returns (uint256 amount0, uint256 amount1, uint128 liquidityMinted);

    function burn(uint256 burnAmount, address receiver)
        external
        returns (uint256 amount0, uint256 amount1, uint128 liquidityBurned);

    function getMintAmounts(uint256 amount0Max, uint256 amount1Max)
        external
        view
        returns (uint256 amount0, uint256 amount1, uint256 mintAmount);

    function getUnderlyingBalances() external view returns (uint256 amount0, uint256 amount1);

    function getPositionID() external view returns (bytes32 positionID);

    function token0() external view returns (IERC20);

    function token1() external view returns (IERC20);

    function upperTick() external view returns (int24);

    function lowerTick() external view returns (int24);

    function pool() external view returns (IUniswapV3Pool);

    function totalSupply() external view returns (uint256);

    function balanceOf(address account) external view returns (uint256);
}

File 29 of 44 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC20.sol)

pragma solidity ^0.8.20;

import {IERC20} from "../token/ERC20/IERC20.sol";

File 30 of 44 : EntropyStructs.sol
// SPDX-License-Identifier: Apache 2

pragma solidity ^0.8.0;

contract EntropyStructs {
    struct ProviderInfo {
        uint128 feeInWei;
        uint128 accruedFeesInWei;
        // The commitment that the provider posted to the blockchain, and the sequence number
        // where they committed to this. This value is not advanced after the provider commits,
        // and instead is stored to help providers track where they are in the hash chain.
        bytes32 originalCommitment;
        uint64 originalCommitmentSequenceNumber;
        // Metadata for the current commitment. Providers may optionally use this field to to help
        // manage rotations (i.e., to pick the sequence number from the correct hash chain).
        bytes commitmentMetadata;
        // Optional URI where clients can retrieve revelations for the provider.
        // Client SDKs can use this field to automatically determine how to retrieve random values for each provider.
        // TODO: specify the API that must be implemented at this URI
        bytes uri;
        // The first sequence number that is *not* included in the current commitment (i.e., an exclusive end index).
        // The contract maintains the invariant that sequenceNumber <= endSequenceNumber.
        // If sequenceNumber == endSequenceNumber, the provider must rotate their commitment to add additional random values.
        uint64 endSequenceNumber;
        // The sequence number that will be assigned to the next inbound user request.
        uint64 sequenceNumber;
        // The current commitment represents an index/value in the provider's hash chain.
        // These values are used to verify requests for future sequence numbers. Note that
        // currentCommitmentSequenceNumber < sequenceNumber.
        //
        // The currentCommitment advances forward through the provider's hash chain as values
        // are revealed on-chain.
        bytes32 currentCommitment;
        uint64 currentCommitmentSequenceNumber;
    }

    struct Request {
        // Storage slot 1 //
        address provider;
        uint64 sequenceNumber;
        // The number of hashes required to verify the provider revelation.
        uint32 numHashes;
        // Storage slot 2 //
        // The commitment is keccak256(userCommitment, providerCommitment). Storing the hash instead of both saves 20k gas by
        // eliminating 1 store.
        bytes32 commitment;
        // Storage slot 3 //
        // The number of the block where this request was created.
        // Note that we're using a uint64 such that we have an additional space for an address and other fields in
        // this storage slot. Although block.number returns a uint256, 64 bits should be plenty to index all of the
        // blocks ever generated.
        uint64 blockNumber;
        // The address that requested this random number.
        address requester;
        // If true, incorporate the blockhash of blockNumber into the generated random value.
        bool useBlockhash;
        // If true, the requester will be called back with the generated random value.
        bool isRequestWithCallback;
        // There are 2 remaining bytes of free space in this slot.
    }
}

File 31 of 44 : IGauge.sol
// SPDX-License-Identifier: GPL-3.0

pragma solidity ^0.8.20;

interface IGauge {
    function deposit(uint256 amount, address account) external;

    function withdraw(uint256 amount) external;

    // solhint-disable-next-line func-name-mixedcase
    function claim_rewards(address account) external;

    // solhint-disable-next-line func-name-mixedcase
    function staking_token() external returns (address);
}

File 32 of 44 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.20;

import {IERC20} from "../IERC20.sol";
import {IERC1363} from "../../../interfaces/IERC1363.sol";
import {Address} from "../../../utils/Address.sol";

/**
 * @title SafeERC20
 * @dev Wrappers around ERC-20 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 {
    /**
     * @dev An operation with an ERC-20 token failed.
     */
    error SafeERC20FailedOperation(address token);

    /**
     * @dev Indicates a failed `decreaseAllowance` request.
     */
    error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);

    /**
     * @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.encodeCall(token.transfer, (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.encodeCall(token.transferFrom, (from, to, 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.
     *
     * IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client"
     * smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using
     * this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract
     * that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.
     */
    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 oldAllowance = token.allowance(address(this), spender);
        forceApprove(token, spender, oldAllowance + value);
    }

    /**
     * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no
     * value, non-reverting calls are assumed to be successful.
     *
     * IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client"
     * smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using
     * this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract
     * that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.
     */
    function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {
        unchecked {
            uint256 currentAllowance = token.allowance(address(this), spender);
            if (currentAllowance < requestedDecrease) {
                revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);
            }
            forceApprove(token, spender, currentAllowance - requestedDecrease);
        }
    }

    /**
     * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
     * to be set to zero before setting it to a non-zero value, such as USDT.
     *
     * NOTE: If the token implements ERC-7674, this function will not modify any temporary allowance. This function
     * only sets the "standard" allowance. Any temporary allowance will remain active, in addition to the value being
     * set here.
     */
    function forceApprove(IERC20 token, address spender, uint256 value) internal {
        bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));

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

    /**
     * @dev Performs an {ERC1363} transferAndCall, with a fallback to the simple {ERC20} transfer if the target has no
     * code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
     * targeting contracts.
     *
     * Reverts if the returned value is other than `true`.
     */
    function transferAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {
        if (to.code.length == 0) {
            safeTransfer(token, to, value);
        } else if (!token.transferAndCall(to, value, data)) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @dev Performs an {ERC1363} transferFromAndCall, with a fallback to the simple {ERC20} transferFrom if the target
     * has no code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
     * targeting contracts.
     *
     * Reverts if the returned value is other than `true`.
     */
    function transferFromAndCallRelaxed(
        IERC1363 token,
        address from,
        address to,
        uint256 value,
        bytes memory data
    ) internal {
        if (to.code.length == 0) {
            safeTransferFrom(token, from, to, value);
        } else if (!token.transferFromAndCall(from, to, value, data)) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @dev Performs an {ERC1363} approveAndCall, with a fallback to the simple {ERC20} approve if the target has no
     * code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
     * targeting contracts.
     *
     * NOTE: When the recipient address (`to`) has no code (i.e. is an EOA), this function behaves as {forceApprove}.
     * Opposedly, when the recipient address (`to`) has code, this function only attempts to call {ERC1363-approveAndCall}
     * once without retrying, and relies on the returned value to be true.
     *
     * Reverts if the returned value is other than `true`.
     */
    function approveAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {
        if (to.code.length == 0) {
            forceApprove(token, to, value);
        } else if (!token.approveAndCall(to, value, data)) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @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 {_callOptionalReturnBool} that reverts if call fails to meet the requirements.
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        uint256 returnSize;
        uint256 returnValue;
        assembly ("memory-safe") {
            let success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20)
            // bubble errors
            if iszero(success) {
                let ptr := mload(0x40)
                returndatacopy(ptr, 0, returndatasize())
                revert(ptr, returndatasize())
            }
            returnSize := returndatasize()
            returnValue := mload(0)
        }

        if (returnSize == 0 ? address(token).code.length == 0 : returnValue != 1) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @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 silently catches all reverts and returns a bool instead.
     */
    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
        bool success;
        uint256 returnSize;
        uint256 returnValue;
        assembly ("memory-safe") {
            success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20)
            returnSize := returndatasize()
            returnValue := mload(0)
        }
        return success && (returnSize == 0 ? address(token).code.length > 0 : returnValue == 1);
    }
}

File 33 of 44 : IUniswapV3Pool.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

import './pool/IUniswapV3PoolImmutables.sol';
import './pool/IUniswapV3PoolState.sol';
import './pool/IUniswapV3PoolDerivedState.sol';
import './pool/IUniswapV3PoolActions.sol';
import './pool/IUniswapV3PoolOwnerActions.sol';
import './pool/IUniswapV3PoolEvents.sol';

/// @title The interface for a Uniswap V3 Pool
/// @notice A Uniswap pool facilitates swapping and automated market making between any two assets that strictly conform
/// to the ERC20 specification
/// @dev The pool interface is broken up into many smaller pieces
interface IUniswapV3Pool is
    IUniswapV3PoolImmutables,
    IUniswapV3PoolState,
    IUniswapV3PoolDerivedState,
    IUniswapV3PoolActions,
    IUniswapV3PoolOwnerActions,
    IUniswapV3PoolEvents
{

}

File 34 of 44 : IERC1363.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (interfaces/IERC1363.sol)

pragma solidity ^0.8.20;

import {IERC20} from "./IERC20.sol";
import {IERC165} from "./IERC165.sol";

/**
 * @title IERC1363
 * @dev Interface of the ERC-1363 standard as defined in the https://eips.ethereum.org/EIPS/eip-1363[ERC-1363].
 *
 * Defines an extension interface for ERC-20 tokens that supports executing code on a recipient contract
 * after `transfer` or `transferFrom`, or code on a spender contract after `approve`, in a single transaction.
 */
interface IERC1363 is IERC20, IERC165 {
    /*
     * Note: the ERC-165 identifier for this interface is 0xb0202a11.
     * 0xb0202a11 ===
     *   bytes4(keccak256('transferAndCall(address,uint256)')) ^
     *   bytes4(keccak256('transferAndCall(address,uint256,bytes)')) ^
     *   bytes4(keccak256('transferFromAndCall(address,address,uint256)')) ^
     *   bytes4(keccak256('transferFromAndCall(address,address,uint256,bytes)')) ^
     *   bytes4(keccak256('approveAndCall(address,uint256)')) ^
     *   bytes4(keccak256('approveAndCall(address,uint256,bytes)'))
     */

    /**
     * @dev Moves a `value` amount of tokens from the caller's account to `to`
     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.
     * @param to The address which you want to transfer to.
     * @param value The amount of tokens to be transferred.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function transferAndCall(address to, uint256 value) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from the caller's account to `to`
     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.
     * @param to The address which you want to transfer to.
     * @param value The amount of tokens to be transferred.
     * @param data Additional data with no specified format, sent in call to `to`.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function transferAndCall(address to, uint256 value, bytes calldata data) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism
     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.
     * @param from The address which you want to send tokens from.
     * @param to The address which you want to transfer to.
     * @param value The amount of tokens to be transferred.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function transferFromAndCall(address from, address to, uint256 value) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism
     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.
     * @param from The address which you want to send tokens from.
     * @param to The address which you want to transfer to.
     * @param value The amount of tokens to be transferred.
     * @param data Additional data with no specified format, sent in call to `to`.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function transferFromAndCall(address from, address to, uint256 value, bytes calldata data) external returns (bool);

    /**
     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the
     * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.
     * @param spender The address which will spend the funds.
     * @param value The amount of tokens to be spent.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function approveAndCall(address spender, uint256 value) external returns (bool);

    /**
     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the
     * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.
     * @param spender The address which will spend the funds.
     * @param value The amount of tokens to be spent.
     * @param data Additional data with no specified format, sent in call to `spender`.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function approveAndCall(address spender, uint256 value, bytes calldata data) external returns (bool);
}

File 35 of 44 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/Address.sol)

pragma solidity ^0.8.20;

import {Errors} from "./Errors.sol";

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev There's no code at `target` (it is not a contract).
     */
    error AddressEmptyCode(address target);

    /**
     * @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.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        if (address(this).balance < amount) {
            revert Errors.InsufficientBalance(address(this).balance, amount);
        }

        (bool success, ) = recipient.call{value: amount}("");
        if (!success) {
            revert Errors.FailedCall();
        }
    }

    /**
     * @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 or custom error, it is bubbled
     * up by this function (like regular Solidity function calls). However, if
     * the call reverted with no returned reason, this function reverts with a
     * {Errors.FailedCall} error.
     *
     * 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.
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0);
    }

    /**
     * @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`.
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
        if (address(this).balance < value) {
            revert Errors.InsufficientBalance(address(this).balance, value);
        }
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target
     * was not a contract or bubbling up the revert reason (falling back to {Errors.FailedCall}) in case
     * of an unsuccessful call.
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata
    ) internal view returns (bytes memory) {
        if (!success) {
            _revert(returndata);
        } else {
            // only check if target is a contract if the call was successful and the return data is empty
            // otherwise we already know that it was a contract
            if (returndata.length == 0 && target.code.length == 0) {
                revert AddressEmptyCode(target);
            }
            return returndata;
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the
     * revert reason or with a default {Errors.FailedCall} error.
     */
    function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {
        if (!success) {
            _revert(returndata);
        } else {
            return returndata;
        }
    }

    /**
     * @dev Reverts with returndata if present. Otherwise reverts with {Errors.FailedCall}.
     */
    function _revert(bytes memory returndata) 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
            assembly ("memory-safe") {
                let returndata_size := mload(returndata)
                revert(add(32, returndata), returndata_size)
            }
        } else {
            revert Errors.FailedCall();
        }
    }
}

File 36 of 44 : IUniswapV3PoolImmutables.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title Pool state that never changes
/// @notice These parameters are fixed for a pool forever, i.e., the methods will always return the same values
interface IUniswapV3PoolImmutables {
    /// @notice The contract that deployed the pool, which must adhere to the IUniswapV3Factory interface
    /// @return The contract address
    function factory() external view returns (address);

    /// @notice The first of the two tokens of the pool, sorted by address
    /// @return The token contract address
    function token0() external view returns (address);

    /// @notice The second of the two tokens of the pool, sorted by address
    /// @return The token contract address
    function token1() external view returns (address);

    /// @notice The pool's fee in hundredths of a bip, i.e. 1e-6
    /// @return The fee
    function fee() external view returns (uint24);

    /// @notice The pool tick spacing
    /// @dev Ticks can only be used at multiples of this value, minimum of 1 and always positive
    /// e.g.: a tickSpacing of 3 means ticks can be initialized every 3rd tick, i.e., ..., -6, -3, 0, 3, 6, ...
    /// This value is an int24 to avoid casting even though it is always positive.
    /// @return The tick spacing
    function tickSpacing() external view returns (int24);

    /// @notice The maximum amount of position liquidity that can use any tick in the range
    /// @dev This parameter is enforced per tick to prevent liquidity from overflowing a uint128 at any point, and
    /// also prevents out-of-range liquidity from being used to prevent adding in-range liquidity to a pool
    /// @return The max amount of liquidity per tick
    function maxLiquidityPerTick() external view returns (uint128);
}

File 37 of 44 : IUniswapV3PoolState.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title Pool state that can change
/// @notice These methods compose the pool's state, and can change with any frequency including multiple times
/// per transaction
interface IUniswapV3PoolState {
    /// @notice The 0th storage slot in the pool stores many values, and is exposed as a single method to save gas
    /// when accessed externally.
    /// @return sqrtPriceX96 The current price of the pool as a sqrt(token1/token0) Q64.96 value
    /// tick The current tick of the pool, i.e. according to the last tick transition that was run.
    /// This value may not always be equal to SqrtTickMath.getTickAtSqrtRatio(sqrtPriceX96) if the price is on a tick
    /// boundary.
    /// observationIndex The index of the last oracle observation that was written,
    /// observationCardinality The current maximum number of observations stored in the pool,
    /// observationCardinalityNext The next maximum number of observations, to be updated when the observation.
    /// feeProtocol The protocol fee for both tokens of the pool.
    /// Encoded as two 4 bit values, where the protocol fee of token1 is shifted 4 bits and the protocol fee of token0
    /// is the lower 4 bits. Used as the denominator of a fraction of the swap fee, e.g. 4 means 1/4th of the swap fee.
    /// unlocked Whether the pool is currently locked to reentrancy
    function slot0()
        external
        view
        returns (
            uint160 sqrtPriceX96,
            int24 tick,
            uint16 observationIndex,
            uint16 observationCardinality,
            uint16 observationCardinalityNext,
            uint32 feeProtocol,
            bool unlocked
        );

    /// @notice The fee growth as a Q128.128 fees of token0 collected per unit of liquidity for the entire life of the pool
    /// @dev This value can overflow the uint256
    function feeGrowthGlobal0X128() external view returns (uint256);

    /// @notice The fee growth as a Q128.128 fees of token1 collected per unit of liquidity for the entire life of the pool
    /// @dev This value can overflow the uint256
    function feeGrowthGlobal1X128() external view returns (uint256);

    /// @notice The amounts of token0 and token1 that are owed to the protocol
    /// @dev Protocol fees will never exceed uint128 max in either token
    function protocolFees() external view returns (uint128 token0, uint128 token1);

    /// @notice The currently in range liquidity available to the pool
    /// @dev This value has no relationship to the total liquidity across all ticks
    function liquidity() external view returns (uint128);

    /// @notice Look up information about a specific tick in the pool
    /// @param tick The tick to look up
    /// @return liquidityGross the total amount of position liquidity that uses the pool either as tick lower or
    /// tick upper,
    /// liquidityNet how much liquidity changes when the pool price crosses the tick,
    /// feeGrowthOutside0X128 the fee growth on the other side of the tick from the current tick in token0,
    /// feeGrowthOutside1X128 the fee growth on the other side of the tick from the current tick in token1,
    /// tickCumulativeOutside the cumulative tick value on the other side of the tick from the current tick
    /// secondsPerLiquidityOutsideX128 the seconds spent per liquidity on the other side of the tick from the current tick,
    /// secondsOutside the seconds spent on the other side of the tick from the current tick,
    /// initialized Set to true if the tick is initialized, i.e. liquidityGross is greater than 0, otherwise equal to false.
    /// Outside values can only be used if the tick is initialized, i.e. if liquidityGross is greater than 0.
    /// In addition, these values are only relative and must be used only in comparison to previous snapshots for
    /// a specific position.
    function ticks(int24 tick)
        external
        view
        returns (
            uint128 liquidityGross,
            int128 liquidityNet,
            uint256 feeGrowthOutside0X128,
            uint256 feeGrowthOutside1X128,
            int56 tickCumulativeOutside,
            uint160 secondsPerLiquidityOutsideX128,
            uint32 secondsOutside,
            bool initialized
        );

    /// @notice Returns 256 packed tick initialized boolean values. See TickBitmap for more information
    function tickBitmap(int16 wordPosition) external view returns (uint256);

    /// @notice Returns the information about a position by the position's key
    /// @param key The position's key is a hash of a preimage composed by the owner, tickLower and tickUpper
    /// @return _liquidity The amount of liquidity in the position,
    /// Returns feeGrowthInside0LastX128 fee growth of token0 inside the tick range as of the last mint/burn/poke,
    /// Returns feeGrowthInside1LastX128 fee growth of token1 inside the tick range as of the last mint/burn/poke,
    /// Returns tokensOwed0 the computed amount of token0 owed to the position as of the last mint/burn/poke,
    /// Returns tokensOwed1 the computed amount of token1 owed to the position as of the last mint/burn/poke
    function positions(bytes32 key)
        external
        view
        returns (
            uint128 _liquidity,
            uint256 feeGrowthInside0LastX128,
            uint256 feeGrowthInside1LastX128,
            uint128 tokensOwed0,
            uint128 tokensOwed1
        );

    /// @notice Returns data about a specific observation index
    /// @param index The element of the observations array to fetch
    /// @dev You most likely want to use #observe() instead of this method to get an observation as of some amount of time
    /// ago, rather than at a specific index in the array.
    /// @return blockTimestamp The timestamp of the observation,
    /// Returns tickCumulative the tick multiplied by seconds elapsed for the life of the pool as of the observation timestamp,
    /// Returns secondsPerLiquidityCumulativeX128 the seconds per in range liquidity for the life of the pool as of the observation timestamp,
    /// Returns initialized whether the observation has been initialized and the values are safe to use
    function observations(uint256 index)
        external
        view
        returns (
            uint32 blockTimestamp,
            int56 tickCumulative,
            uint160 secondsPerLiquidityCumulativeX128,
            bool initialized
        );
}

File 38 of 44 : IUniswapV3PoolDerivedState.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title Pool state that is not stored
/// @notice Contains view functions to provide information about the pool that is computed rather than stored on the
/// blockchain. The functions here may have variable gas costs.
interface IUniswapV3PoolDerivedState {
    /// @notice Returns the cumulative tick and liquidity as of each timestamp `secondsAgo` from the current block timestamp
    /// @dev To get a time weighted average tick or liquidity-in-range, you must call this with two values, one representing
    /// the beginning of the period and another for the end of the period. E.g., to get the last hour time-weighted average tick,
    /// you must call it with secondsAgos = [3600, 0].
    /// @dev The time weighted average tick represents the geometric time weighted average price of the pool, in
    /// log base sqrt(1.0001) of token1 / token0. The TickMath library can be used to go from a tick value to a ratio.
    /// @param secondsAgos From how long ago each cumulative tick and liquidity value should be returned
    /// @return tickCumulatives Cumulative tick values as of each `secondsAgos` from the current block timestamp
    /// @return secondsPerLiquidityCumulativeX128s Cumulative seconds per liquidity-in-range value as of each `secondsAgos` from the current block
    /// timestamp
    function observe(uint32[] calldata secondsAgos)
        external
        view
        returns (int56[] memory tickCumulatives, uint160[] memory secondsPerLiquidityCumulativeX128s);

    /// @notice Returns a snapshot of the tick cumulative, seconds per liquidity and seconds inside a tick range
    /// @dev Snapshots must only be compared to other snapshots, taken over a period for which a position existed.
    /// I.e., snapshots cannot be compared if a position is not held for the entire period between when the first
    /// snapshot is taken and the second snapshot is taken.
    /// @param tickLower The lower tick of the range
    /// @param tickUpper The upper tick of the range
    /// @return tickCumulativeInside The snapshot of the tick accumulator for the range
    /// @return secondsPerLiquidityInsideX128 The snapshot of seconds per liquidity for the range
    /// @return secondsInside The snapshot of seconds per liquidity for the range
    function snapshotCumulativesInside(int24 tickLower, int24 tickUpper)
        external
        view
        returns (
            int56 tickCumulativeInside,
            uint160 secondsPerLiquidityInsideX128,
            uint32 secondsInside
        );
}

File 39 of 44 : IUniswapV3PoolActions.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title Permissionless pool actions
/// @notice Contains pool methods that can be called by anyone
interface IUniswapV3PoolActions {
    /// @notice Sets the initial price for the pool
    /// @dev Price is represented as a sqrt(amountToken1/amountToken0) Q64.96 value
    /// @param sqrtPriceX96 the initial sqrt price of the pool as a Q64.96
    function initialize(uint160 sqrtPriceX96) external;

    /// @notice Adds liquidity for the given recipient/tickLower/tickUpper position
    /// @dev The caller of this method receives a callback in the form of IUniswapV3MintCallback#uniswapV3MintCallback
    /// in which they must pay any token0 or token1 owed for the liquidity. The amount of token0/token1 due depends
    /// on tickLower, tickUpper, the amount of liquidity, and the current price.
    /// @param recipient The address for which the liquidity will be created
    /// @param tickLower The lower tick of the position in which to add liquidity
    /// @param tickUpper The upper tick of the position in which to add liquidity
    /// @param amount The amount of liquidity to mint
    /// @param data Any data that should be passed through to the callback
    /// @return amount0 The amount of token0 that was paid to mint the given amount of liquidity. Matches the value in the callback
    /// @return amount1 The amount of token1 that was paid to mint the given amount of liquidity. Matches the value in the callback
    function mint(
        address recipient,
        int24 tickLower,
        int24 tickUpper,
        uint128 amount,
        bytes calldata data
    ) external returns (uint256 amount0, uint256 amount1);

    /// @notice Collects tokens owed to a position
    /// @dev Does not recompute fees earned, which must be done either via mint or burn of any amount of liquidity.
    /// Collect must be called by the position owner. To withdraw only token0 or only token1, amount0Requested or
    /// amount1Requested may be set to zero. To withdraw all tokens owed, caller may pass any value greater than the
    /// actual tokens owed, e.g. type(uint128).max. Tokens owed may be from accumulated swap fees or burned liquidity.
    /// @param recipient The address which should receive the fees collected
    /// @param tickLower The lower tick of the position for which to collect fees
    /// @param tickUpper The upper tick of the position for which to collect fees
    /// @param amount0Requested How much token0 should be withdrawn from the fees owed
    /// @param amount1Requested How much token1 should be withdrawn from the fees owed
    /// @return amount0 The amount of fees collected in token0
    /// @return amount1 The amount of fees collected in token1
    function collect(
        address recipient,
        int24 tickLower,
        int24 tickUpper,
        uint128 amount0Requested,
        uint128 amount1Requested
    ) external returns (uint128 amount0, uint128 amount1);

    /// @notice Burn liquidity from the sender and account tokens owed for the liquidity to the position
    /// @dev Can be used to trigger a recalculation of fees owed to a position by calling with an amount of 0
    /// @dev Fees must be collected separately via a call to #collect
    /// @param tickLower The lower tick of the position for which to burn liquidity
    /// @param tickUpper The upper tick of the position for which to burn liquidity
    /// @param amount How much liquidity to burn
    /// @return amount0 The amount of token0 sent to the recipient
    /// @return amount1 The amount of token1 sent to the recipient
    function burn(
        int24 tickLower,
        int24 tickUpper,
        uint128 amount
    ) external returns (uint256 amount0, uint256 amount1);

    /// @notice Swap token0 for token1, or token1 for token0
    /// @dev The caller of this method receives a callback in the form of IUniswapV3SwapCallback#uniswapV3SwapCallback
    /// @param recipient The address to receive the output of the swap
    /// @param zeroForOne The direction of the swap, true for token0 to token1, false for token1 to token0
    /// @param amountSpecified The amount of the swap, which implicitly configures the swap as exact input (positive), or exact output (negative)
    /// @param sqrtPriceLimitX96 The Q64.96 sqrt price limit. If zero for one, the price cannot be less than this
    /// value after the swap. If one for zero, the price cannot be greater than this value after the swap
    /// @param data Any data to be passed through to the callback
    /// @return amount0 The delta of the balance of token0 of the pool, exact when negative, minimum when positive
    /// @return amount1 The delta of the balance of token1 of the pool, exact when negative, minimum when positive
    function swap(
        address recipient,
        bool zeroForOne,
        int256 amountSpecified,
        uint160 sqrtPriceLimitX96,
        bytes calldata data
    ) external returns (int256 amount0, int256 amount1);

    /// @notice Receive token0 and/or token1 and pay it back, plus a fee, in the callback
    /// @dev The caller of this method receives a callback in the form of IUniswapV3FlashCallback#uniswapV3FlashCallback
    /// @dev Can be used to donate underlying tokens pro-rata to currently in-range liquidity providers by calling
    /// with 0 amount{0,1} and sending the donation amount(s) from the callback
    /// @param recipient The address which will receive the token0 and token1 amounts
    /// @param amount0 The amount of token0 to send
    /// @param amount1 The amount of token1 to send
    /// @param data Any data to be passed through to the callback
    function flash(
        address recipient,
        uint256 amount0,
        uint256 amount1,
        bytes calldata data
    ) external;

    /// @notice Increase the maximum number of price and liquidity observations that this pool will store
    /// @dev This method is no-op if the pool already has an observationCardinalityNext greater than or equal to
    /// the input observationCardinalityNext.
    /// @param observationCardinalityNext The desired minimum number of observations for the pool to store
    function increaseObservationCardinalityNext(uint16 observationCardinalityNext) external;
}

File 40 of 44 : IUniswapV3PoolOwnerActions.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title Permissioned pool actions
/// @notice Contains pool methods that may only be called by the factory owner
interface IUniswapV3PoolOwnerActions {
    /// @notice Set the denominator of the protocol's % share of the fees
    /// @param feeProtocol0 new protocol fee for token0 of the pool
    /// @param feeProtocol1 new protocol fee for token1 of the pool
    function setFeeProtocol(uint32 feeProtocol0, uint32 feeProtocol1) external;

    /// @notice Collect the protocol fee accrued to the pool
    /// @param recipient The address to which collected protocol fees should be sent
    /// @param amount0Requested The maximum amount of token0 to send, can be 0 to collect fees in only token1
    /// @param amount1Requested The maximum amount of token1 to send, can be 0 to collect fees in only token0
    /// @return amount0 The protocol fee collected in token0
    /// @return amount1 The protocol fee collected in token1
    function collectProtocol(
        address recipient,
        uint128 amount0Requested,
        uint128 amount1Requested
    ) external returns (uint128 amount0, uint128 amount1);
}

File 41 of 44 : IUniswapV3PoolEvents.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title Events emitted by a pool
/// @notice Contains all events emitted by the pool
interface IUniswapV3PoolEvents {
    /// @notice Emitted exactly once by a pool when #initialize is first called on the pool
    /// @dev Mint/Burn/Swap cannot be emitted by the pool before Initialize
    /// @param sqrtPriceX96 The initial sqrt price of the pool, as a Q64.96
    /// @param tick The initial tick of the pool, i.e. log base 1.0001 of the starting price of the pool
    event Initialize(uint160 sqrtPriceX96, int24 tick);

    /// @notice Emitted when liquidity is minted for a given position
    /// @param sender The address that minted the liquidity
    /// @param owner The owner of the position and recipient of any minted liquidity
    /// @param tickLower The lower tick of the position
    /// @param tickUpper The upper tick of the position
    /// @param amount The amount of liquidity minted to the position range
    /// @param amount0 How much token0 was required for the minted liquidity
    /// @param amount1 How much token1 was required for the minted liquidity
    event Mint(
        address sender,
        address indexed owner,
        int24 indexed tickLower,
        int24 indexed tickUpper,
        uint128 amount,
        uint256 amount0,
        uint256 amount1
    );

    /// @notice Emitted when fees are collected by the owner of a position
    /// @dev Collect events may be emitted with zero amount0 and amount1 when the caller chooses not to collect fees
    /// @param owner The owner of the position for which fees are collected
    /// @param tickLower The lower tick of the position
    /// @param tickUpper The upper tick of the position
    /// @param amount0 The amount of token0 fees collected
    /// @param amount1 The amount of token1 fees collected
    event Collect(
        address indexed owner,
        address recipient,
        int24 indexed tickLower,
        int24 indexed tickUpper,
        uint128 amount0,
        uint128 amount1
    );

    /// @notice Emitted when a position's liquidity is removed
    /// @dev Does not withdraw any fees earned by the liquidity position, which must be withdrawn via #collect
    /// @param owner The owner of the position for which liquidity is removed
    /// @param tickLower The lower tick of the position
    /// @param tickUpper The upper tick of the position
    /// @param amount The amount of liquidity to remove
    /// @param amount0 The amount of token0 withdrawn
    /// @param amount1 The amount of token1 withdrawn
    event Burn(
        address indexed owner,
        int24 indexed tickLower,
        int24 indexed tickUpper,
        uint128 amount,
        uint256 amount0,
        uint256 amount1
    );

    /// @notice Emitted by the pool for any swaps between token0 and token1
    /// @param sender The address that initiated the swap call, and that received the callback
    /// @param recipient The address that received the output of the swap
    /// @param amount0 The delta of the token0 balance of the pool
    /// @param amount1 The delta of the token1 balance of the pool
    /// @param sqrtPriceX96 The sqrt(price) of the pool after the swap, as a Q64.96
    /// @param liquidity The liquidity of the pool after the swap
    /// @param tick The log base 1.0001 of price of the pool after the swap
    event Swap(
        address indexed sender,
        address indexed recipient,
        int256 amount0,
        int256 amount1,
        uint160 sqrtPriceX96,
        uint128 liquidity,
        int24 tick
    );

    /// @notice Emitted when fees are earned
    /// @param amount0 The amount of token0 fees earned
    /// @param amount1 The amount of token1 fees earned
    event ProtocolFeesEarned(
        uint128 amount0,
        uint128 amount1
    );

    /// @notice Emitted by the pool for any flashes of token0/token1
    /// @param sender The address that initiated the swap call, and that received the callback
    /// @param recipient The address that received the tokens from flash
    /// @param amount0 The amount of token0 that was flashed
    /// @param amount1 The amount of token1 that was flashed
    /// @param paid0 The amount of token0 paid for the flash, which can exceed the amount0 plus the fee
    /// @param paid1 The amount of token1 paid for the flash, which can exceed the amount1 plus the fee
    event Flash(
        address indexed sender,
        address indexed recipient,
        uint256 amount0,
        uint256 amount1,
        uint256 paid0,
        uint256 paid1
    );

    /// @notice Emitted by the pool for increases to the number of observations that can be stored
    /// @dev observationCardinalityNext is not the observation cardinality until an observation is written at the index
    /// just before a mint/swap/burn.
    /// @param observationCardinalityNextOld The previous value of the next observation cardinality
    /// @param observationCardinalityNextNew The updated value of the next observation cardinality
    event IncreaseObservationCardinalityNext(
        uint16 observationCardinalityNextOld,
        uint16 observationCardinalityNextNew
    );

    /// @notice Emitted when the protocol fee is changed by the pool
    /// @param feeProtocol0Old The previous value of the token0 protocol fee
    /// @param feeProtocol1Old The previous value of the token1 protocol fee
    /// @param feeProtocol0New The updated value of the token0 protocol fee
    /// @param feeProtocol1New The updated value of the token1 protocol fee
    event SetFeeProtocol(uint32 feeProtocol0Old, uint32 feeProtocol1Old, uint32 feeProtocol0New, uint32 feeProtocol1New);

    /// @notice Emitted when the collected protocol fees are withdrawn by the factory owner
    /// @param sender The address that collects the protocol fees
    /// @param recipient The address that receives the collected protocol fees
    /// @param amount0 The amount of token0 protocol fees that is withdrawn
    /// @param amount0 The amount of token1 protocol fees that is withdrawn
    event CollectProtocol(address indexed sender, address indexed recipient, uint128 amount0, uint128 amount1);
}

File 42 of 44 : IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC165.sol)

pragma solidity ^0.8.20;

import {IERC165} from "../utils/introspection/IERC165.sol";

File 43 of 44 : Errors.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/Errors.sol)

pragma solidity ^0.8.20;

/**
 * @dev Collection of common custom errors used in multiple contracts
 *
 * IMPORTANT: Backwards compatibility is not guaranteed in future versions of the library.
 * It is recommended to avoid relying on the error API for critical functionality.
 *
 * _Available since v5.1._
 */
library Errors {
    /**
     * @dev The ETH balance of the account is not enough to perform the operation.
     */
    error InsufficientBalance(uint256 balance, uint256 needed);

    /**
     * @dev A call to an address target failed. The target may have reverted.
     */
    error FailedCall();

    /**
     * @dev The deployment failed.
     */
    error FailedDeployment();

    /**
     * @dev A necessary precompile is missing.
     */
    error MissingPrecompile(address);
}

File 44 of 44 : IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/introspection/IERC165.sol)

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC-165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[ERC].
 *
 * 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[ERC 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": [
    "@pythnetwork/entropy-sdk-solidity/=node_modules/@pythnetwork/entropy-sdk-solidity/",
    "@openzeppelin/contracts/=lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/",
    "@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/",
    "surl/=lib/surl/src/",
    "@kodiak-finance/=node_modules/@kodiak-finance/",
    "contracts/=src/contracts/",
    "interfaces/=src/interfaces/",
    "ds-test/=lib/surl/lib/forge-std/lib/ds-test/src/",
    "erc4626-tests/=lib/erc4626-tests/",
    "forge-std/=lib/forge-std/src/",
    "halmos-cheatcodes/=lib/openzeppelin-contracts-upgradeable/lib/halmos-cheatcodes/src/",
    "openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/",
    "openzeppelin-contracts/=lib/openzeppelin-contracts/",
    "openzeppelin-foundry-upgrades/=lib/openzeppelin-foundry-upgrades/src/",
    "openzeppelin/=lib/openzeppelin-contracts/contracts/",
    "solidity-stringutils/=lib/openzeppelin-foundry-upgrades/lib/solidity-stringutils/",
    "solmate/=lib/solmate/src/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "metadata": {
    "useLiteralContent": false,
    "bytecodeHash": "ipfs",
    "appendCBOR": true
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "cancun",
  "viaIR": false,
  "libraries": {}
}

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"address","name":"_yeetTokenAddress","type":"address"},{"internalType":"contract Reward","name":"_reward","type":"address"},{"internalType":"contract StakeV2","name":"_staking","type":"address"},{"internalType":"contract YeetGameSettings","name":"_gameSettings","type":"address"},{"internalType":"address","name":"_publicGoodsAddress","type":"address"},{"internalType":"address","name":"_teamAddress","type":"address"},{"internalType":"address","name":"_yeetardsNFTsAddress","type":"address"},{"internalType":"address","name":"_entropy","type":"address"},{"internalType":"address","name":"_entropyProvider","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"uint256","name":"currentTime","type":"uint256"},{"internalType":"uint256","name":"cooldownEndTime","type":"uint256"}],"name":"CooldownNotEnded","type":"error"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"DuplicateTokenId","type":"error"},{"inputs":[],"name":"EnforcedPause","type":"error"},{"inputs":[],"name":"ExpectedPause","type":"error"},{"inputs":[{"internalType":"uint256","name":"provided","type":"uint256"},{"internalType":"uint256","name":"minimum","type":"uint256"}],"name":"InsufficientYeet","type":"error"},{"inputs":[],"name":"InvalidRandomNumber","type":"error"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"NFTNotEligibleForBoost","type":"error"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"NoWinningsToClaim","type":"error"},{"inputs":[{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"fee","type":"uint256"}],"name":"NotEnoughValueToPayEntropyFee","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"inputs":[{"internalType":"uint256","name":"roundNumber","type":"uint256"}],"name":"RoundStillLive","type":"error"},{"inputs":[{"internalType":"uint256","name":"length","type":"uint256"}],"name":"ToManyTokenIds","type":"error"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"UserDoesNotOwnNFTs","type":"error"},{"inputs":[{"internalType":"uint256","name":"currentTime","type":"uint256"},{"internalType":"uint256","name":"endTime","type":"uint256"}],"name":"YeetTimePassed","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Claim","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"add","type":"address"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"PublicGoodsPaidOut","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"round","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"startTime","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"yeetTimeInSeconds","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"potDivision","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"taxPerYeet","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"taxToStakers","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"taxToPublicGoods","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"taxToTreasury","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"yeetbackPercentage","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"cooldownTime","type":"uint256"}],"name":"RoundStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"round","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"nrOfYeets","type":"uint256"}],"name":"RoundWinner","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"add","type":"address"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"TreasuryRevenuePaidOut","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"add","type":"address"}],"name":"UpdatedPublicGoodsAddress","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"add","type":"address"}],"name":"UpdatedTreasuryRevenueAddress","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"add","type":"address"}],"name":"UpdatedYeetardsNFTsAddress","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"basisPointTaxed","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountToPot","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountToYeetback","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"potAfterYeet","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"yeetbackAfterYeet","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newYeetTimeInSeconds","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newMinimumYeetPoint","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"nrOfYeets","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"round","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timeLeftOnTimer","type":"uint256"}],"name":"Yeet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"totalAmountYeeted","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"valueToPot","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"valueToYeetback","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"valueToStakers","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"publicGoods","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"teamRevenue","type":"uint256"}],"name":"YeetDistribution","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"potToWinnerAfter","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newMinimumYeetPoint","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"round","type":"uint256"}],"name":"Yeetard","type":"event"},{"stateMutability":"payable","type":"fallback"},{"inputs":[],"name":"BOOSTRAP_PHASE_DURATION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"COOLDOWN_TIME","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MINIMUM_YEET_POINT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"POT_DIVISION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TAX_PER_YEET","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TAX_TO_PUBLIC_GOODS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TAX_TO_STAKERS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TAX_TO_TREASURY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"YEETBACK_PERCENTAGE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"YEET_TIME_SECONDS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"endOfYeetTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"gameSettings","outputs":[{"internalType":"contract YeetGameSettings","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"getBoostedValue","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"yeetAmount","type":"uint256"}],"name":"getDistribution","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"getNFTBoost","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"round","type":"uint256"}],"name":"getWinner","outputs":[{"components":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"timestamp","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"round","type":"uint256"}],"internalType":"struct Yeet.Winner","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"hasCooldownEnded","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isBoostrapPhase","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isRoundFinished","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastYeeted","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastYeetedAt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minimumYeetPoint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"nftBoostLookup","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nrOfYeets","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"payoutPublicGoods","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"payoutTreasuryRevenue","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"potToWinner","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"potToYeetback","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"publicGoodsAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"publicGoodsAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"userRandomNumber","type":"bytes32"}],"name":"restart","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"rewardsContract","outputs":[{"internalType":"contract Reward","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"roundNumber","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"roundStartTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_publicGoodsAddress","type":"address"}],"name":"setPublicGoodsAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_treasuryRevenueAddress","type":"address"}],"name":"setTreasuryRevenueAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_yeetardsNFTsAddress","type":"address"}],"name":"setYeetardsNFTsAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"stakingContract","outputs":[{"internalType":"contract StakeV2","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"treasuryRevenueAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"treasuryRevenueAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract StakeV2","name":"_staking","type":"address"}],"name":"updateStakingContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"winnings","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"yeet","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"yeet","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"yeetTimeInSeconds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"yeetTokenAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"yeetardsNFTsAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"yeetback","outputs":[{"internalType":"contract Yeetback","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]

60016009556103c060408190525f608090815261015960a05261021c60c0526102a360e0526102fd610100526103486101205261038461014052610160919091526103ed6101805261041a6101a0526104386101c05261044c6101e052610483610200526104a1610220526104bf610240526104dd610260526104fb610280526105196102a0526105376102c0526105556102e05261056461030052610578610320526105a0610340526105af610360526105be610380526105dc6103a0526100cc90602190601a610883565b503480156100d8575f80fd5b506040516144293803806144298339810160408190526100f7916108ff565b5f805460ff19169055338061012657604051631e4fbdf760e01b81525f60048201526024015b60405180910390fd5b61012f816103cb565b50600180556001600160a01b03851661018a5760405162461bcd60e51b815260206004820152601c60248201527f496e76616c6964207075626c696320676f6f6473206164647265737300000000604482015260640161011d565b6001600160a01b0384166101e05760405162461bcd60e51b815260206004820152601460248201527f496e76616c6964207465616d2061646472657373000000000000000000000000604482015260640161011d565b6001600160a01b0389166102365760405162461bcd60e51b815260206004820152601a60248201527f496e76616c6964207965657420746f6b656e2061646472657373000000000000604482015260640161011d565b601980546001600160a01b03199081166001600160a01b038c811691909117909255601a805482168b8416179055601b805482168a8416179055601c80548216898416179055600c80548216888416179055600d80548216878416179055601d8054909116918516919091179055604051829082906102b4906108c7565b6001600160a01b03928316815291166020820152604001604051809103905ff0801580156102e4573d5f803e3d5ffd5b50601e80546001600160a01b0319166001600160a01b039290921691909117905561030d610423565b42600381905550601754600f544261032591906109bd565b61032f91906109bd565b60085542600a819055600954600f54601054601154601254601354601454601554601654604080519a8b5260208b0198909852968901959095526060880193909352608087019190915260a086015260c085015260e0840152610100830152907f431aa8ec9b311e05124c0e0185532efa3be627d1f3a2c1d7ad11f1bf1bc76eb7906101200160405180910390a25050505050505050506109f9565b5f80546001600160a01b03838116610100818102610100600160a81b0319851617855560405193049190911692909183917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a35050565b601c5f9054906101000a90046001600160a01b03166001600160a01b03166325c8dbab6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610473573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061049791906109e2565b600f55601c5460408051631dcb3eb560e31b815290516001600160a01b039092169163ee59f5a8916004808201926020929091908290030181865afa1580156104e2573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061050691906109e2565b601055601c546040805163a5cb412f60e01b815290516001600160a01b039092169163a5cb412f916004808201926020929091908290030181865afa158015610551573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061057591906109e2565b601155601c546040805163a126f1ed60e01b815290516001600160a01b039092169163a126f1ed916004808201926020929091908290030181865afa1580156105c0573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906105e491906109e2565b601255601c54604080516349c56bd960e01b815290516001600160a01b03909216916349c56bd9916004808201926020929091908290030181865afa15801561062f573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061065391906109e2565b601355601c546040805163e4b77f3360e01b815290516001600160a01b039092169163e4b77f33916004808201926020929091908290030181865afa15801561069e573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906106c291906109e2565b601455601c5460408051633d9fc6e560e01b815290516001600160a01b0390921691633d9fc6e5916004808201926020929091908290030181865afa15801561070d573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061073191906109e2565b601555601c5460408051637d26324560e01b815290516001600160a01b0390921691637d263245916004808201926020929091908290030181865afa15801561077c573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906107a091906109e2565b601655601c54604080516357352fab60e11b815290516001600160a01b039092169163ae6a5f56916004808201926020929091908290030181865afa1580156107eb573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061080f91906109e2565b601755601c54604080516368f4763b60e11b815290516001600160a01b039092169163d1e8ec76916004808201926020929091908290030181865afa15801561085a573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061087e91906109e2565b601855565b82601a81019282156108b7579160200282015b828111156108b7578251829061ffff16905591602001919060010190610896565b506108c39291506108d4565b5090565b6113a78061308283390190565b5b808211156108c3575f81556001016108d5565b6001600160a01b03811681146108fc575f80fd5b50565b5f805f805f805f805f6101208a8c031215610918575f80fd5b8951610923816108e8565b60208b0151909950610934816108e8565b60408b0151909850610945816108e8565b60608b0151909750610956816108e8565b60808b0151909650610967816108e8565b60a08b0151909550610978816108e8565b60c08b0151909450610989816108e8565b60e08b015190935061099a816108e8565b6101008b01519092506109ac816108e8565b809150509295985092959850929598565b808201808211156109dc57634e487b7160e01b5f52601160045260245ffd5b92915050565b5f602082840312156109f2575f80fd5b5051919050565b61267c80610a065f395ff3fe608060405260043610610353575f3560e01c8063715018a6116101c5578063c92a1bd9116100f6578063e4b77f3311610094578063ee99205c1161006e578063ee99205c14610950578063ef31fa841461096f578063f2fde38b1461098e578063f3653f01146109ad576103c8565b8063e4b77f33146108fc578063ea3a149914610911578063ee59f5a81461093b576103c8565b8063d1e8ec76116100d0578063d1e8ec76146108a8578063d22238a7146108bd578063d54931e3146108d2578063dd4f8f74146108e7576103c8565b8063c92a1bd914610855578063cba416b214610874578063cfec100914610889576103c8565b80638ef3bd3411610163578063a126f1ed1161013d578063a126f1ed146107f7578063a5cb412f1461080c578063ae6a5f5614610821578063b7297cf314610836576103c8565b80638ef3bd34146107b05780639a72337a146107cf5780639d328086146107e4576103c8565b80637d2632451161019f5780637d2632451461075e5780638456cb59146107735780638bbefe4b146107875780638da5cb5b1461078f576103c8565b8063715018a61461072157806371e0c11e14610735578063798fc62e1461074a576103c8565b80633d9fc6e51161029f5780634e2786fb1161023d5780635dbb8c90116102175780635dbb8c90146106ba57806362c03491146106d95780636364e87b146106ed5780636c6531bd14610702576103c8565b80634e2786fb1461067b5780634e71d92d146106905780635c975abb146106a4576103c8565b80634129b2c9116102795780634129b2c9146105d857806349c56bd9146106335780634bc9188e146106485780634bf1dd1914610667576103c8565b80633d9fc6e5146105905780633f4ba83a146105a55780633f567f88146105b9576103c8565b8063220cce971161030c5780632fe3085d116102e65780632fe3085d146104ec5780633041384d1461050b5780633347e4d61461052a5780633b345a8714610549576103c8565b8063220cce97146104a357806325c8dbab146104c257806329d32999146104d7576103c8565b8063056f3575146103d957806306c8ff2b146103ee5780630c961e77146104165780630d4193cd1461044d57806319e9c476146104615780631a10b75014610480576103c8565b366103c8573460045f828254610369919061234c565b909155505060045433907f214b008bb453820a28cab09232f8b39f2a8c64711fbb5721d205ee5dbf3f37c99042906103a0816109c1565b60095460408051948552602085019390935291830152606082015260800160405180910390a2005b3460045f828254610369919061234c565b6103ec6103e736600461235f565b610a11565b005b3480156103f9575f80fd5b50610403600e5481565b6040519081526020015b60405180910390f35b348015610421575f80fd5b50601954610435906001600160a01b031681565b6040516001600160a01b03909116815260200161040d565b348015610458575f80fd5b506103ec610e8c565b34801561046c575f80fd5b506103ec61047b36600461238a565b610f2a565b34801561048b575f80fd5b506008544210155b604051901515815260200161040d565b3480156104ae575f80fd5b50601a54610435906001600160a01b031681565b3480156104cd575f80fd5b50610403600f5481565b3480156104e2575f80fd5b5061040360075481565b3480156104f7575f80fd5b506103ec61050636600461238a565b610fd1565b348015610516575f80fd5b50600c54610435906001600160a01b031681565b348015610535575f80fd5b506103ec61054436600461238a565b611078565b348015610554575f80fd5b5061056861056336600461235f565b6110a2565b604080519586526020860194909452928401919091526060830152608082015260a00161040d565b34801561059b575f80fd5b5061040360155481565b3480156105b0575f80fd5b506103ec611207565b3480156105c4575f80fd5b50600254610435906001600160a01b031681565b3480156105e3575f80fd5b506105f76105f236600461235f565b611217565b60405161040d919081516001600160a01b0316815260208083015190820152604080830151908201526060918201519181019190915260800190565b34801561063e575f80fd5b5061040360135481565b348015610653575f80fd5b506103ec61066236600461238a565b611294565b348015610672575f80fd5b5061049361133b565b348015610686575f80fd5b5061040360095481565b34801561069b575f80fd5b506103ec611354565b3480156106af575f80fd5b505f5460ff16610493565b3480156106c5575f80fd5b50601e54610435906001600160a01b031681565b3480156106e4575f80fd5b5061040361146b565b3480156106f8575f80fd5b5061040360085481565b34801561070d575f80fd5b5061040361071c36600461245c565b61147c565b34801561072c575f80fd5b506103ec6114b4565b348015610740575f80fd5b5061040360065481565b348015610755575f80fd5b506104936114c5565b348015610769575f80fd5b5061040360165481565b34801561077e575f80fd5b506103ec6114dd565b6103ec6114ed565b34801561079a575f80fd5b505f5461010090046001600160a01b0316610435565b3480156107bb575f80fd5b506104036107ca3660046124b1565b611504565b3480156107da575f80fd5b50610403600b5481565b6103ec6107f23660046124fe565b611671565b348015610802575f80fd5b5061040360125481565b348015610817575f80fd5b5061040360115481565b34801561082c575f80fd5b5061040360175481565b348015610841575f80fd5b50601c54610435906001600160a01b031681565b348015610860575f80fd5b5061040361086f36600461235f565b61167d565b34801561087f575f80fd5b5061040360045481565b348015610894575f80fd5b50600d54610435906001600160a01b031681565b3480156108b3575f80fd5b5061040360185481565b3480156108c8575f80fd5b5061040360035481565b3480156108dd575f80fd5b5061040360055481565b3480156108f2575f80fd5b50610403600a5481565b348015610907575f80fd5b5061040360145481565b34801561091c575f80fd5b5061040361092b36600461238a565b602080525f908152604090205481565b348015610946575f80fd5b5061040360105481565b34801561095b575f80fd5b50601b54610435906001600160a01b031681565b34801561097a575f80fd5b50601d54610435906001600160a01b031681565b348015610999575f80fd5b506103ec6109a836600461238a565b611693565b3480156109b8575f80fd5b506103ec6116cd565b5f815f036109d157505060185490565b6109d96114c5565b156109e657505060185490565b5f601054836109f59190612538565b9050601854811015610a0b575050601854919050565b92915050565b610a19611784565b80610a37576040516324a9fc7b60e21b815260040160405180910390fd5b600854421015610a69576009546040516382824a5760e01b8152600401610a6091815260200190565b60405180910390fd5b610a7161133b565b610aa85742601654600854610a86919061234c565b6040516366b45e4160e01b815260048101929092526024820152604401610a60565b60025460045460095460065460408051428152602081019490945283019190915260608201526001600160a01b03909116907f39f80b5d1b6c8cb5f8aae39e22b894b4ed7a0632afc0be5f1216449ad424d3a79060800160405180910390a2601e5460408051632d971e6360e01b815290515f926001600160a01b031691632d971e639160048083019260209291908290030181865afa158015610b4e573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610b729190612557565b6001600160801b0316905080341015610ba757604051638942ddab60e01b815234600482015260248101829052604401610a60565b5f610bb2823461257d565b60055490915015610c3f57601e546005546001600160a01b039091169063fc45cc8990610bdf908561234c565b6009546005546040516001600160e01b031960e086901b16815260048101899052602481019290925260448201526064015f604051808303818588803b158015610c27575f80fd5b505af1158015610c39573d5f803e3d5ffd5b50505050505b6004546002546001600160a01b03165f90815260208052604081208054909190610c6a90849061234c565b909155505060408051608081018252600280546001600160a01b039081168352426020808501918252600454858701908152600954606087018181525f918252601f90935296909620945185546001600160a01b03191693169290921784555160018401559251908201559051600390910155610ce56117a7565b600160095f828254610cf7919061234c565b90915550505f600581905560048190556006819055600280546001600160a01b0319169055600355600f54600781905560175490610d35904261234c565b610d3f919061234c565b60085542600a558015610e02576040515f90339083908381818185875af1925050503d805f8114610d8b576040519150601f19603f3d011682016040523d82523d5f602084013e610d90565b606091505b5050905080610e005760405162461bcd60e51b815260206004820152603660248201527f5472616e73666572206661696c65642c2063616e742072657475726e2072656d60448201527530b4b734b733903b30b63ab2903a379039b2b73232b960511b6064820152608401610a60565b505b600954600a54600f5460105460115460125460135460145460155460165460408051998a5260208a0198909852888801969096526060880194909452608087019290925260a086015260c085015260e0840152610100830152517f431aa8ec9b311e05124c0e0185532efa3be627d1f3a2c1d7ad11f1bf1bc76eb7918190036101200190a2505050565b610e94611c07565b610e9c611c39565b600e54600d5460408051606081019091526024808252610ecf93926001600160a01b031691906126236020830139611c63565b600d54600e546040805142815260208101929092526001600160a01b03909216917fea026e0b32b8aa964391771c53b692375ee74c7c014ebf72922bb6537f1e3d91910160405180910390a25f600e55610f2860018055565b565b610f32611c07565b6001600160a01b038116610f885760405162461bcd60e51b815260206004820181905260248201527f496e76616c696420747265617375727920726576656e756520616464726573736044820152606401610a60565b600d80546001600160a01b0319166001600160a01b0383169081179091556040517fac6cbbd95b5091bb9b26c594e42bfe8b06efb9e4a376ffafbd5565bbf890175a905f90a250565b610fd9611c07565b6001600160a01b03811661102f5760405162461bcd60e51b815260206004820152601d60248201527f496e76616c6964207965657461726473204e46547320616464726573730000006044820152606401610a60565b601d80546001600160a01b0319166001600160a01b0383169081179091556040517fc4b4eb10312e1608f8a01c68ccbb2a7fa17f3ec234da159da9e4071ef7a11e25905f90a250565b611080611c07565b601b80546001600160a01b0319166001600160a01b0392909216919091179055565b5f805f805f80601c5f9054906101000a90046001600160a01b03166001600160a01b031663eced55266040518163ffffffff1660e01b8152600401602060405180830381865afa1580156110f8573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061111c9190612590565b90505f6011548261112d919061257d565b611137838a612538565b61114191906125a7565b90505f601554838a6111539190612538565b61115d91906125a7565b90505f60115460155485611171919061257d565b61117b919061257d565b611185858c612538565b61118f91906125a7565b90505f61119c848c61257d565b90505f60125486836111ae9190612538565b6111b891906125a7565b90505f60135487846111ca9190612538565b6111d491906125a7565b90505f60145488856111e69190612538565b6111f091906125a7565b949e959d50919b5099509197509195505050505050565b61120f611c07565b610f28611d1d565b61124760405180608001604052805f6001600160a01b031681526020015f81526020015f81526020015f81525090565b505f908152601f6020908152604091829020825160808101845281546001600160a01b03168152600182015492810192909252600281015492820192909252600390910154606082015290565b61129c611c07565b6001600160a01b0381166112f25760405162461bcd60e51b815260206004820152601c60248201527f496e76616c6964207075626c696320676f6f64732061646472657373000000006044820152606401610a60565b600c80546001600160a01b0319166001600160a01b0383169081179091556040517f91cb59f8a6f8c638f12974755f740e015697ed45501305bbe9dca709976a7cb1905f90a250565b5f60165460085461134c919061234c565b421015905090565b61135c611c39565b335f908152602080526040812054900361138b5760405163ba8072bb60e01b8152336004820152602401610a60565b335f818152602080526040808220805490839055905190929083908381818185875af1925050503d805f81146113dc576040519150601f19603f3d011682016040523d82523d5f602084013e6113e1565b606091505b50509050806114255760405162461bcd60e51b815260206004820152601060248201526f2a3930b739b332b9103330b4b632b21760811b6044820152606401610a60565b604080514281526020810184905233917f34fcbac0073d7c3d388e51312faf357774904998eeb8fca628b9e6f65ee1cbf7910160405180910390a25050610f2860018055565b5f6114776004546109c1565b905090565b5f806114888584611504565b905061271061149782866125a7565b6114a19190612538565b6114ab908561234c565b95945050505050565b6114bc611c07565b610f285f611d6e565b5f601754600a546114d6919061234c565b4210905090565b6114e5611c07565b610f28611dc6565b604080515f815260208101909152610f2890611e02565b5f61150e82612244565b601d546001600160a01b031661152557505f610a0b565b601d5482516001600160a01b03909116905f5b81811015611616575f858281518110611553576115536125be565b60200260200101519050866001600160a01b0316846001600160a01b0316636352211e836040518263ffffffff1660e01b815260040161159591815260200190565b602060405180830381865afa1580156115b0573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906115d491906125d2565b6001600160a01b03161461160d57604051631fd0d94f60e01b81526001600160a01b038816600482015260248101829052604401610a60565b50600101611538565b506116236001601a61257d565b8111156116535760216116386001601a61257d565b601a8110611648576116486125be565b015492505050610a0b565b602181601a8110611666576116666125be565b015495945050505050565b61167a81611e02565b50565b602181601a811061168c575f80fd5b0154905081565b61169b611c07565b6001600160a01b0381166116c457604051631e4fbdf760e01b81525f6004820152602401610a60565b61167a81611d6e565b6116d5611c07565b6116dd611c39565b600b54600c546040805180820190915260208082527f596565743a204e6f207075626c696320676f6f647320746f20706179206f75749082015261172b92916001600160a01b031690611c63565b600c54600b546040805142815260208101929092526001600160a01b03909216917fa646871159ee6929e4f2b328a50c7c9776c64c98a4deead1a159ba6470c066f4910160405180910390a25f600b55610f2860018055565b5f5460ff1615610f285760405163d93c066560e01b815260040160405180910390fd5b601c5f9054906101000a90046001600160a01b03166001600160a01b03166325c8dbab6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156117f7573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061181b9190612590565b600f55601c5460408051631dcb3eb560e31b815290516001600160a01b039092169163ee59f5a8916004808201926020929091908290030181865afa158015611866573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061188a9190612590565b601055601c546040805163a5cb412f60e01b815290516001600160a01b039092169163a5cb412f916004808201926020929091908290030181865afa1580156118d5573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906118f99190612590565b601155601c546040805163a126f1ed60e01b815290516001600160a01b039092169163a126f1ed916004808201926020929091908290030181865afa158015611944573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906119689190612590565b601255601c54604080516349c56bd960e01b815290516001600160a01b03909216916349c56bd9916004808201926020929091908290030181865afa1580156119b3573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906119d79190612590565b601355601c546040805163e4b77f3360e01b815290516001600160a01b039092169163e4b77f33916004808201926020929091908290030181865afa158015611a22573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611a469190612590565b601455601c5460408051633d9fc6e560e01b815290516001600160a01b0390921691633d9fc6e5916004808201926020929091908290030181865afa158015611a91573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611ab59190612590565b601555601c5460408051637d26324560e01b815290516001600160a01b0390921691637d263245916004808201926020929091908290030181865afa158015611b00573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611b249190612590565b601655601c54604080516357352fab60e11b815290516001600160a01b039092169163ae6a5f56916004808201926020929091908290030181865afa158015611b6f573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611b939190612590565b601755601c54604080516368f4763b60e11b815290516001600160a01b039092169163d1e8ec76916004808201926020929091908290030181865afa158015611bde573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611c029190612590565b601855565b5f546001600160a01b03610100909104163314610f285760405163118cdaa760e01b8152336004820152602401610a60565b600260015403611c5c57604051633ee5aeb560e01b815260040160405180910390fd5b6002600155565b8083611c825760405162461bcd60e51b8152600401610a6091906125ed565b5060405183905f906001600160a01b0385169083908381818185875af1925050503d805f8114611ccd576040519150601f19603f3d011682016040523d82523d5f602084013e611cd2565b606091505b5050905080611d165760405162461bcd60e51b815260206004820152601060248201526f2a3930b739b332b9103330b4b632b21760811b6044820152606401610a60565b5050505050565b611d25612316565b5f805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b5f80546001600160a01b03838116610100818102610100600160a81b0319851617855560405193049190911692909183917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a35050565b611dce611784565b5f805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258611d513390565b611e0b81612244565b60085442908110611e3d57600854604051635451bc7560e11b8152610a60918391600401918252602082015260400190565b5f611e496004546109c1565b905080341015611e755760405163014c51fd60e41b815234600482015260248101829052604401610a60565b5f805f805f611e83346110a2565b9450945094509450945081600b5f828254611e9e919061234c565b9250508190555080600e5f828254611eb6919061234c565b9091555050600f546007556008545f90611ed190899061257d565b90508460055f828254611ee4919061234c565b925050819055508560045f828254611efc919061234c565b92505081905550600160065f828254611f15919061234c565b9091555050600280546001600160a01b031916331790556003889055611f396114c5565b15611f6357601754600754600a54611f51919061234c565b611f5b919061234c565b600855611f74565b600754611f70908961234c565b6008555b6040805134815260208101889052908101869052606081018590526080810184905260a081018390527fb4ca49a886358ee90d8e23cfe814480bd2135ca56db0e46a4481c450983827a29060c00160405180910390a1336001600160a01b03167f4c8886135814ba442d2fc0da83be4cadcd18375e5a3f589276e82ba5e5d8b1c189601154898960045460055460075461200f6004546109c1565b600654600954604080519a8b5260208b0199909952978901969096526060880194909452608087019290925260a086015260c085015260e084015261010083015261012082015261014081018490526101600160405180910390a26120726114c5565b15612104575f6120828834612538565b90505f5b818110156120fd57601e5460095460405163157a4fb760e01b815260048101919091523360248201526001600160a01b039091169063157a4fb7906044015f604051808303815f87803b1580156120db575f80fd5b505af11580156120ed573d5f803e3d5ffd5b5050600190920191506120869050565b5050612168565b601e5460095460405163157a4fb760e01b815260048101919091523360248201526001600160a01b039091169063157a4fb7906044015f604051808303815f87803b158015612151575f80fd5b505af1158015612163573d5f803e3d5ffd5b505050505b5f61217433888c61147c565b601a5460405163da3e57b560e01b8152336004820152602481018390529192506001600160a01b03169063da3e57b5906044015f604051808303815f87803b1580156121be575f80fd5b505af11580156121d0573d5f803e3d5ffd5b50505050601b5f9054906101000a90046001600160a01b03166001600160a01b0316635ec2dc8d866040518263ffffffff1660e01b81526004015f604051808303818588803b158015612221575f80fd5b505af1158015612233573d5f803e3d5ffd5b505050505050505050505050505050565b601a8151111561226c578051604051632b027c3960e01b8152600401610a6091815260200190565b80515f036122775750565b5f5b60018251612287919061257d565b811015612312578161229a82600161234c565b815181106122aa576122aa6125be565b60200260200101518282815181106122c4576122c46125be565b60200260200101511061230a578181815181106122e3576122e36125be565b6020026020010151604051600162d0a51b60e01b03198152600401610a6091815260200190565b600101612279565b5050565b5f5460ff16610f2857604051638dfc202b60e01b815260040160405180910390fd5b634e487b7160e01b5f52601160045260245ffd5b80820180821115610a0b57610a0b612338565b5f6020828403121561236f575f80fd5b5035919050565b6001600160a01b038116811461167a575f80fd5b5f6020828403121561239a575f80fd5b81356123a581612376565b9392505050565b634e487b7160e01b5f52604160045260245ffd5b5f82601f8301126123cf575f80fd5b813567ffffffffffffffff8111156123e9576123e96123ac565b8060051b604051601f19603f830116810181811067ffffffffffffffff82111715612416576124166123ac565b604052918252602081850181019290810186841115612433575f80fd5b6020860192505b8383101561245257823581526020928301920161243a565b5095945050505050565b5f805f6060848603121561246e575f80fd5b833561247981612376565b925060208401359150604084013567ffffffffffffffff81111561249b575f80fd5b6124a7868287016123c0565b9150509250925092565b5f80604083850312156124c2575f80fd5b82356124cd81612376565b9150602083013567ffffffffffffffff8111156124e8575f80fd5b6124f4858286016123c0565b9150509250929050565b5f6020828403121561250e575f80fd5b813567ffffffffffffffff811115612524575f80fd5b612530848285016123c0565b949350505050565b5f8261255257634e487b7160e01b5f52601260045260245ffd5b500490565b5f60208284031215612567575f80fd5b81516001600160801b03811681146123a5575f80fd5b81810381811115610a0b57610a0b612338565b5f602082840312156125a0575f80fd5b5051919050565b8082028115828204841417610a0b57610a0b612338565b634e487b7160e01b5f52603260045260245ffd5b5f602082840312156125e2575f80fd5b81516123a581612376565b602081525f82518060208401528060208501604085015e5f604082850101526040601f19601f8301168401019150509291505056fe596565743a204e6f20547265617375727920726576656e756520746f20706179206f7574a26469706673582212204ac5834ae14207c7fb807780bedd2e904a23e43b427f4ce3b99368d22895c2f964736f6c634300081a0033608060405234801561000f575f80fd5b506040516113a73803806113a783398101604081905261002e916101e3565b338061005457604051631e4fbdf760e01b81525f60048201526024015b60405180910390fd5b61005d8161015d565b5060016002556001600160a01b0382166100c35760405162461bcd60e51b815260206004820152602160248201527f596565746261636b3a20496e76616c696420656e74726f7079206164647265736044820152607360f81b606482015260840161004b565b6001600160a01b03811661012c5760405162461bcd60e51b815260206004820152602a60248201527f596565746261636b3a20496e76616c696420656e74726f70792070726f7669646044820152696572206164647265737360b01b606482015260840161004b565b600380546001600160a01b039384166001600160a01b03199182161790915560048054929093169116179055610214565b600180546001600160a01b031916905561017681610179565b50565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80516001600160a01b03811681146101de575f80fd5b919050565b5f80604083850312156101f4575f80fd5b6101fd836101c8565b915061020b602084016101c8565b90509250929050565b611186806102215f395ff3fe608060405260043610610110575f3560e01c80637688c0af1161009d578063a529633f11610062578063a529633f1461036e578063c3b8cfdc1461038d578063e30c3978146103b9578063f2fde38b146103d6578063fc45cc89146103f5575f80fd5b80637688c0af1461029357806379ba5097146102be5780638b9b06e7146102d25780638da5cb5b1461031f578063a0c7f71c1461034f575f80fd5b8063379607f5116100e3578063379607f5146101dd5780634e713d2f146101fc57806352a5f1f8146102355780636171a64514610254578063715018a61461027f575f80fd5b806310a5dc0614610114578063120aa87714610157578063157a4fb7146101905780632d971e63146101b1575b5f80fd5b34801561011f575f80fd5b5061014261012e366004610f1b565b600b6020525f908152604090205460ff1681565b60405190151581526020015b60405180910390f35b348015610162575f80fd5b50610142610171366004610f4d565b600660209081525f928352604080842090915290825290205460ff1681565b34801561019b575f80fd5b506101af6101aa366004610f4d565b610408565b005b3480156101bc575f80fd5b506101c56104e8565b6040516001600160801b03909116815260200161014e565b3480156101e8575f80fd5b506101af6101f7366004610f1b565b61055f565b348015610207575f80fd5b50610227610216366004610f1b565b60076020525f908152604090205481565b60405190815260200161014e565b348015610240575f80fd5b506101af61024f366004610f8c565b61079b565b34801561025f575f80fd5b5061022761026e366004610f1b565b60086020525f908152604090205481565b34801561028a575f80fd5b506101af61087b565b34801561029e575f80fd5b506102276102ad366004610f1b565b600a6020525f908152604090205481565b3480156102c9575f80fd5b506101af61088e565b3480156102dd575f80fd5b5061030c6102ec366004610f4d565b600560209081525f928352604080842090915290825290205461ffff1681565b60405161ffff909116815260200161014e565b34801561032a575f80fd5b505f546001600160a01b03165b6040516001600160a01b03909116815260200161014e565b34801561035a575f80fd5b50610227610369366004610f4d565b6108cf565b348015610379575f80fd5b50610337610388366004610fc8565b61095d565b348015610398575f80fd5b506103ac6103a7366004610f1b565b610991565b60405161014e9190610fe8565b3480156103c4575f80fd5b506001546001600160a01b0316610337565b3480156103e1575f80fd5b506101af6103f0366004611033565b6109fa565b6101af610403366004611053565b610a6a565b610410610c5b565b6001600160a01b03811661046b5760405162461bcd60e51b815260206004820152601e60248201527f596565746261636b3a20496e76616c696420757365722061646472657373000060448201526064015b60405180910390fd5b815f036104aa5760405162461bcd60e51b815260206004820152600d60248201526c125b9d985b1a59081c9bdd5b99609a1b6044820152606401610462565b5f91825260096020908152604083208054600181018255908452922090910180546001600160a01b0319166001600160a01b03909216919091179055565b60035460048054604051631711922960e31b81526001600160a01b03918216928101929092525f92169063b88c914890602401602060405180830381865afa158015610536573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061055a919061107c565b905090565b610567610c87565b805f036105b65760405162461bcd60e51b815260206004820152601760248201527f596565746261636b3a20496e76616c696420726f756e640000000000000000006044820152606401610462565b5f81815260056020908152604080832033845290915281205461ffff16908190036106235760405162461bcd60e51b815260206004820152601e60248201527f596565746261636b3a204e6f2077696e6e696e677320746f20636c61696d00006044820152606401610462565b5f82815260066020908152604080832033845290915290205460ff161561068c5760405162461bcd60e51b815260206004820152601960248201527f596565746261636b3a20416c726561647920636c61696d6564000000000000006044820152606401610462565b5f8281526006602090815260408083203384528252808320805460ff1916600117905584835260079091528120546106c99061ffff8416906110b6565b6040519091505f90339083908381818185875af1925050503d805f811461070b576040519150601f19603f3d011682016040523d82523d5f602084013e610710565b606091505b50509050806107545760405162461bcd60e51b815260206004820152601060248201526f2a3930b739b332b9103330b4b632b21760811b6044820152606401610462565b604051828152339085907f4ec90e965519d92681267467f775ada5bd214aa92c0dc93d90a5e880ce9ed0269060200160405180910390a35050506107986001600255565b50565b5f6107ae6003546001600160a01b031690565b90506001600160a01b0381166108065760405162461bcd60e51b815260206004820152601760248201527f456e74726f70792061646472657373206e6f74207365740000000000000000006044820152606401610462565b336001600160a01b0382161461086a5760405162461bcd60e51b815260206004820152602360248201527f4f6e6c7920456e74726f70792063616e2063616c6c20746869732066756e637460448201526234b7b760e91b6064820152608401610462565b610875848484610caf565b50505050565b610883610c5b565b61088c5f610d56565b565b60015433906001600160a01b031681146108c65760405163118cdaa760e01b81526001600160a01b0382166004820152602401610462565b61079881610d56565b5f8281526005602090815260408083206001600160a01b0385168452825280832054858452600790925282205461ffff9091169082906109109083906110b6565b5f8681526006602090815260408083206001600160a01b038916845290915290205490915060ff168080610942575081155b15610952575f9350505050610957565b509150505b92915050565b6009602052815f5260405f208181548110610976575f80fd5b5f918252602090912001546001600160a01b03169150829050565b5f818152600960209081526040918290208054835181840281018401909452808452606093928301828280156109ee57602002820191905f5260205f20905b81546001600160a01b031681526001909101906020018083116109d0575b50505050509050919050565b610a02610c5b565b600180546001600160a01b0383166001600160a01b03199091168117909155610a325f546001600160a01b031690565b6001600160a01b03167f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e2270060405160405180910390a350565b610a72610c5b565b82610ab05760405162461bcd60e51b815260206004820152600e60248201526d24b73b30b634b210373ab6b132b960911b6044820152606401610462565b815f03610aef5760405162461bcd60e51b815260206004820152600d60248201526c125b9d985b1a59081c9bdd5b99609a1b6044820152606401610462565b805f03610b2f5760405162461bcd60e51b815260206004820152600e60248201526d125b9d985b1a5908185b5bdd5b9d60921b6044820152606401610462565b5f828152600860205260408120829055610b476104e8565b600354600480546040516319cb825f60e01b81526001600160a01b0391821692810192909252602482018890526001600160801b039390931693505f92909116906319cb825f90849060440160206040518083038185885af1158015610baf573d5f803e3d5ffd5b50505050506040513d601f19601f82011682018060405250810190610bd491906110cd565b67ffffffffffffffff81165f818152600a60205260408082208890555192935090917f5a82a565b8cc97bc62f2041e057e918f6b3b7b4185104d7d4a52ed5c711e72329190a2837f4b35f3fe379a69a7d11ffb8d66531f50832fc05875582aba3931bd8244121d7884604051610c4c91815260200190565b60405180910390a25050505050565b5f546001600160a01b0316331461088c5760405163118cdaa760e01b8152336004820152602401610462565b6002805403610ca957604051633ee5aeb560e01b815260040160405180910390fd5b60028055565b67ffffffffffffffff83165f908152600b602052604090205460ff1615610d185760405162461bcd60e51b815260206004820152601b60248201527f596565746261636b3a20416c72656164792070726f63657373656400000000006044820152606401610462565b67ffffffffffffffff83165f908152600b60209081526040808320805460ff19166001179055600a909152902054610d51908290610d6f565b505050565b600180546001600160a01b031916905561079881610ecc565b5f8181526008602090815260408083205460099092528220549091600a90610d9782856110fc565b5f8681526007602052604081208290559091505b82811015610ec3576040805160208082018a9052818301849052825180830384018152606090920190925280519101205f610de6868361110f565b5f8981526009602052604081208054929350909183908110610e0a57610e0a611122565b5f9182526020808320909101548b83526005825260408084206001600160a01b039092168085529190925290822080549193506001929091610e5190849061ffff16611136565b92506101000a81548161ffff021916908361ffff160217905550806001600160a01b0316897fba262046319e99138f831e46cf6459b4d4bd3a8bf11f025f422fd1c9547b73d88785604051610eb0929190918252602082015260400190565b60405180910390a3505050600101610dab565b50505050505050565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b5f60208284031215610f2b575f80fd5b5035919050565b80356001600160a01b0381168114610f48575f80fd5b919050565b5f8060408385031215610f5e575f80fd5b82359150610f6e60208401610f32565b90509250929050565b67ffffffffffffffff81168114610798575f80fd5b5f805f60608486031215610f9e575f80fd5b8335610fa981610f77565b9250610fb760208501610f32565b929592945050506040919091013590565b5f8060408385031215610fd9575f80fd5b50508035926020909101359150565b602080825282518282018190525f918401906040840190835b818110156110285783516001600160a01b0316835260209384019390920191600101611001565b509095945050505050565b5f60208284031215611043575f80fd5b61104c82610f32565b9392505050565b5f805f60608486031215611065575f80fd5b505081359360208301359350604090920135919050565b5f6020828403121561108c575f80fd5b81516001600160801b038116811461104c575f80fd5b634e487b7160e01b5f52601160045260245ffd5b8082028115828204841417610957576109576110a2565b5f602082840312156110dd575f80fd5b815161104c81610f77565b634e487b7160e01b5f52601260045260245ffd5b5f8261110a5761110a6110e8565b500490565b5f8261111d5761111d6110e8565b500690565b634e487b7160e01b5f52603260045260245ffd5b61ffff8181168382160190811115610957576109576110a256fea26469706673582212204c5be3a77c36ca08db46815cadced0763379436356f1ccef084c616111f3ae7e64736f6c634300081a003300000000000000000000000008a38caa631de329ff2dad1656ce789f31af3142000000000000000000000000bb6b33ec5bf34dfd41134c90ec51012b82a7e3010000000000000000000000005cf74fff31ac34853d4e5e9f4c5996baf829cafc000000000000000000000000822862c8d4d21fa49eca2c008c2a15f0196f1a2300000000000000000000000083223b1f4897933558112175990c54f8fb55c852000000000000000000000000fed81be9a026211d82cd06a3a2f384853cd0bb2b000000000000000000000000a6b1948b42ea485c391730bb721d9f2001ebe50400000000000000000000000036825bf3fbdf5a29e2d5148bfe7dcf7b5639e32000000000000000000000000052deaa1c84233f7bb8c8a45baede41091c616506

Deployed Bytecode

0x608060405260043610610353575f3560e01c8063715018a6116101c5578063c92a1bd9116100f6578063e4b77f3311610094578063ee99205c1161006e578063ee99205c14610950578063ef31fa841461096f578063f2fde38b1461098e578063f3653f01146109ad576103c8565b8063e4b77f33146108fc578063ea3a149914610911578063ee59f5a81461093b576103c8565b8063d1e8ec76116100d0578063d1e8ec76146108a8578063d22238a7146108bd578063d54931e3146108d2578063dd4f8f74146108e7576103c8565b8063c92a1bd914610855578063cba416b214610874578063cfec100914610889576103c8565b80638ef3bd3411610163578063a126f1ed1161013d578063a126f1ed146107f7578063a5cb412f1461080c578063ae6a5f5614610821578063b7297cf314610836576103c8565b80638ef3bd34146107b05780639a72337a146107cf5780639d328086146107e4576103c8565b80637d2632451161019f5780637d2632451461075e5780638456cb59146107735780638bbefe4b146107875780638da5cb5b1461078f576103c8565b8063715018a61461072157806371e0c11e14610735578063798fc62e1461074a576103c8565b80633d9fc6e51161029f5780634e2786fb1161023d5780635dbb8c90116102175780635dbb8c90146106ba57806362c03491146106d95780636364e87b146106ed5780636c6531bd14610702576103c8565b80634e2786fb1461067b5780634e71d92d146106905780635c975abb146106a4576103c8565b80634129b2c9116102795780634129b2c9146105d857806349c56bd9146106335780634bc9188e146106485780634bf1dd1914610667576103c8565b80633d9fc6e5146105905780633f4ba83a146105a55780633f567f88146105b9576103c8565b8063220cce971161030c5780632fe3085d116102e65780632fe3085d146104ec5780633041384d1461050b5780633347e4d61461052a5780633b345a8714610549576103c8565b8063220cce97146104a357806325c8dbab146104c257806329d32999146104d7576103c8565b8063056f3575146103d957806306c8ff2b146103ee5780630c961e77146104165780630d4193cd1461044d57806319e9c476146104615780631a10b75014610480576103c8565b366103c8573460045f828254610369919061234c565b909155505060045433907f214b008bb453820a28cab09232f8b39f2a8c64711fbb5721d205ee5dbf3f37c99042906103a0816109c1565b60095460408051948552602085019390935291830152606082015260800160405180910390a2005b3460045f828254610369919061234c565b6103ec6103e736600461235f565b610a11565b005b3480156103f9575f80fd5b50610403600e5481565b6040519081526020015b60405180910390f35b348015610421575f80fd5b50601954610435906001600160a01b031681565b6040516001600160a01b03909116815260200161040d565b348015610458575f80fd5b506103ec610e8c565b34801561046c575f80fd5b506103ec61047b36600461238a565b610f2a565b34801561048b575f80fd5b506008544210155b604051901515815260200161040d565b3480156104ae575f80fd5b50601a54610435906001600160a01b031681565b3480156104cd575f80fd5b50610403600f5481565b3480156104e2575f80fd5b5061040360075481565b3480156104f7575f80fd5b506103ec61050636600461238a565b610fd1565b348015610516575f80fd5b50600c54610435906001600160a01b031681565b348015610535575f80fd5b506103ec61054436600461238a565b611078565b348015610554575f80fd5b5061056861056336600461235f565b6110a2565b604080519586526020860194909452928401919091526060830152608082015260a00161040d565b34801561059b575f80fd5b5061040360155481565b3480156105b0575f80fd5b506103ec611207565b3480156105c4575f80fd5b50600254610435906001600160a01b031681565b3480156105e3575f80fd5b506105f76105f236600461235f565b611217565b60405161040d919081516001600160a01b0316815260208083015190820152604080830151908201526060918201519181019190915260800190565b34801561063e575f80fd5b5061040360135481565b348015610653575f80fd5b506103ec61066236600461238a565b611294565b348015610672575f80fd5b5061049361133b565b348015610686575f80fd5b5061040360095481565b34801561069b575f80fd5b506103ec611354565b3480156106af575f80fd5b505f5460ff16610493565b3480156106c5575f80fd5b50601e54610435906001600160a01b031681565b3480156106e4575f80fd5b5061040361146b565b3480156106f8575f80fd5b5061040360085481565b34801561070d575f80fd5b5061040361071c36600461245c565b61147c565b34801561072c575f80fd5b506103ec6114b4565b348015610740575f80fd5b5061040360065481565b348015610755575f80fd5b506104936114c5565b348015610769575f80fd5b5061040360165481565b34801561077e575f80fd5b506103ec6114dd565b6103ec6114ed565b34801561079a575f80fd5b505f5461010090046001600160a01b0316610435565b3480156107bb575f80fd5b506104036107ca3660046124b1565b611504565b3480156107da575f80fd5b50610403600b5481565b6103ec6107f23660046124fe565b611671565b348015610802575f80fd5b5061040360125481565b348015610817575f80fd5b5061040360115481565b34801561082c575f80fd5b5061040360175481565b348015610841575f80fd5b50601c54610435906001600160a01b031681565b348015610860575f80fd5b5061040361086f36600461235f565b61167d565b34801561087f575f80fd5b5061040360045481565b348015610894575f80fd5b50600d54610435906001600160a01b031681565b3480156108b3575f80fd5b5061040360185481565b3480156108c8575f80fd5b5061040360035481565b3480156108dd575f80fd5b5061040360055481565b3480156108f2575f80fd5b50610403600a5481565b348015610907575f80fd5b5061040360145481565b34801561091c575f80fd5b5061040361092b36600461238a565b602080525f908152604090205481565b348015610946575f80fd5b5061040360105481565b34801561095b575f80fd5b50601b54610435906001600160a01b031681565b34801561097a575f80fd5b50601d54610435906001600160a01b031681565b348015610999575f80fd5b506103ec6109a836600461238a565b611693565b3480156109b8575f80fd5b506103ec6116cd565b5f815f036109d157505060185490565b6109d96114c5565b156109e657505060185490565b5f601054836109f59190612538565b9050601854811015610a0b575050601854919050565b92915050565b610a19611784565b80610a37576040516324a9fc7b60e21b815260040160405180910390fd5b600854421015610a69576009546040516382824a5760e01b8152600401610a6091815260200190565b60405180910390fd5b610a7161133b565b610aa85742601654600854610a86919061234c565b6040516366b45e4160e01b815260048101929092526024820152604401610a60565b60025460045460095460065460408051428152602081019490945283019190915260608201526001600160a01b03909116907f39f80b5d1b6c8cb5f8aae39e22b894b4ed7a0632afc0be5f1216449ad424d3a79060800160405180910390a2601e5460408051632d971e6360e01b815290515f926001600160a01b031691632d971e639160048083019260209291908290030181865afa158015610b4e573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610b729190612557565b6001600160801b0316905080341015610ba757604051638942ddab60e01b815234600482015260248101829052604401610a60565b5f610bb2823461257d565b60055490915015610c3f57601e546005546001600160a01b039091169063fc45cc8990610bdf908561234c565b6009546005546040516001600160e01b031960e086901b16815260048101899052602481019290925260448201526064015f604051808303818588803b158015610c27575f80fd5b505af1158015610c39573d5f803e3d5ffd5b50505050505b6004546002546001600160a01b03165f90815260208052604081208054909190610c6a90849061234c565b909155505060408051608081018252600280546001600160a01b039081168352426020808501918252600454858701908152600954606087018181525f918252601f90935296909620945185546001600160a01b03191693169290921784555160018401559251908201559051600390910155610ce56117a7565b600160095f828254610cf7919061234c565b90915550505f600581905560048190556006819055600280546001600160a01b0319169055600355600f54600781905560175490610d35904261234c565b610d3f919061234c565b60085542600a558015610e02576040515f90339083908381818185875af1925050503d805f8114610d8b576040519150601f19603f3d011682016040523d82523d5f602084013e610d90565b606091505b5050905080610e005760405162461bcd60e51b815260206004820152603660248201527f5472616e73666572206661696c65642c2063616e742072657475726e2072656d60448201527530b4b734b733903b30b63ab2903a379039b2b73232b960511b6064820152608401610a60565b505b600954600a54600f5460105460115460125460135460145460155460165460408051998a5260208a0198909852888801969096526060880194909452608087019290925260a086015260c085015260e0840152610100830152517f431aa8ec9b311e05124c0e0185532efa3be627d1f3a2c1d7ad11f1bf1bc76eb7918190036101200190a2505050565b610e94611c07565b610e9c611c39565b600e54600d5460408051606081019091526024808252610ecf93926001600160a01b031691906126236020830139611c63565b600d54600e546040805142815260208101929092526001600160a01b03909216917fea026e0b32b8aa964391771c53b692375ee74c7c014ebf72922bb6537f1e3d91910160405180910390a25f600e55610f2860018055565b565b610f32611c07565b6001600160a01b038116610f885760405162461bcd60e51b815260206004820181905260248201527f496e76616c696420747265617375727920726576656e756520616464726573736044820152606401610a60565b600d80546001600160a01b0319166001600160a01b0383169081179091556040517fac6cbbd95b5091bb9b26c594e42bfe8b06efb9e4a376ffafbd5565bbf890175a905f90a250565b610fd9611c07565b6001600160a01b03811661102f5760405162461bcd60e51b815260206004820152601d60248201527f496e76616c6964207965657461726473204e46547320616464726573730000006044820152606401610a60565b601d80546001600160a01b0319166001600160a01b0383169081179091556040517fc4b4eb10312e1608f8a01c68ccbb2a7fa17f3ec234da159da9e4071ef7a11e25905f90a250565b611080611c07565b601b80546001600160a01b0319166001600160a01b0392909216919091179055565b5f805f805f80601c5f9054906101000a90046001600160a01b03166001600160a01b031663eced55266040518163ffffffff1660e01b8152600401602060405180830381865afa1580156110f8573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061111c9190612590565b90505f6011548261112d919061257d565b611137838a612538565b61114191906125a7565b90505f601554838a6111539190612538565b61115d91906125a7565b90505f60115460155485611171919061257d565b61117b919061257d565b611185858c612538565b61118f91906125a7565b90505f61119c848c61257d565b90505f60125486836111ae9190612538565b6111b891906125a7565b90505f60135487846111ca9190612538565b6111d491906125a7565b90505f60145488856111e69190612538565b6111f091906125a7565b949e959d50919b5099509197509195505050505050565b61120f611c07565b610f28611d1d565b61124760405180608001604052805f6001600160a01b031681526020015f81526020015f81526020015f81525090565b505f908152601f6020908152604091829020825160808101845281546001600160a01b03168152600182015492810192909252600281015492820192909252600390910154606082015290565b61129c611c07565b6001600160a01b0381166112f25760405162461bcd60e51b815260206004820152601c60248201527f496e76616c6964207075626c696320676f6f64732061646472657373000000006044820152606401610a60565b600c80546001600160a01b0319166001600160a01b0383169081179091556040517f91cb59f8a6f8c638f12974755f740e015697ed45501305bbe9dca709976a7cb1905f90a250565b5f60165460085461134c919061234c565b421015905090565b61135c611c39565b335f908152602080526040812054900361138b5760405163ba8072bb60e01b8152336004820152602401610a60565b335f818152602080526040808220805490839055905190929083908381818185875af1925050503d805f81146113dc576040519150601f19603f3d011682016040523d82523d5f602084013e6113e1565b606091505b50509050806114255760405162461bcd60e51b815260206004820152601060248201526f2a3930b739b332b9103330b4b632b21760811b6044820152606401610a60565b604080514281526020810184905233917f34fcbac0073d7c3d388e51312faf357774904998eeb8fca628b9e6f65ee1cbf7910160405180910390a25050610f2860018055565b5f6114776004546109c1565b905090565b5f806114888584611504565b905061271061149782866125a7565b6114a19190612538565b6114ab908561234c565b95945050505050565b6114bc611c07565b610f285f611d6e565b5f601754600a546114d6919061234c565b4210905090565b6114e5611c07565b610f28611dc6565b604080515f815260208101909152610f2890611e02565b5f61150e82612244565b601d546001600160a01b031661152557505f610a0b565b601d5482516001600160a01b03909116905f5b81811015611616575f858281518110611553576115536125be565b60200260200101519050866001600160a01b0316846001600160a01b0316636352211e836040518263ffffffff1660e01b815260040161159591815260200190565b602060405180830381865afa1580156115b0573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906115d491906125d2565b6001600160a01b03161461160d57604051631fd0d94f60e01b81526001600160a01b038816600482015260248101829052604401610a60565b50600101611538565b506116236001601a61257d565b8111156116535760216116386001601a61257d565b601a8110611648576116486125be565b015492505050610a0b565b602181601a8110611666576116666125be565b015495945050505050565b61167a81611e02565b50565b602181601a811061168c575f80fd5b0154905081565b61169b611c07565b6001600160a01b0381166116c457604051631e4fbdf760e01b81525f6004820152602401610a60565b61167a81611d6e565b6116d5611c07565b6116dd611c39565b600b54600c546040805180820190915260208082527f596565743a204e6f207075626c696320676f6f647320746f20706179206f75749082015261172b92916001600160a01b031690611c63565b600c54600b546040805142815260208101929092526001600160a01b03909216917fa646871159ee6929e4f2b328a50c7c9776c64c98a4deead1a159ba6470c066f4910160405180910390a25f600b55610f2860018055565b5f5460ff1615610f285760405163d93c066560e01b815260040160405180910390fd5b601c5f9054906101000a90046001600160a01b03166001600160a01b03166325c8dbab6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156117f7573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061181b9190612590565b600f55601c5460408051631dcb3eb560e31b815290516001600160a01b039092169163ee59f5a8916004808201926020929091908290030181865afa158015611866573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061188a9190612590565b601055601c546040805163a5cb412f60e01b815290516001600160a01b039092169163a5cb412f916004808201926020929091908290030181865afa1580156118d5573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906118f99190612590565b601155601c546040805163a126f1ed60e01b815290516001600160a01b039092169163a126f1ed916004808201926020929091908290030181865afa158015611944573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906119689190612590565b601255601c54604080516349c56bd960e01b815290516001600160a01b03909216916349c56bd9916004808201926020929091908290030181865afa1580156119b3573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906119d79190612590565b601355601c546040805163e4b77f3360e01b815290516001600160a01b039092169163e4b77f33916004808201926020929091908290030181865afa158015611a22573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611a469190612590565b601455601c5460408051633d9fc6e560e01b815290516001600160a01b0390921691633d9fc6e5916004808201926020929091908290030181865afa158015611a91573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611ab59190612590565b601555601c5460408051637d26324560e01b815290516001600160a01b0390921691637d263245916004808201926020929091908290030181865afa158015611b00573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611b249190612590565b601655601c54604080516357352fab60e11b815290516001600160a01b039092169163ae6a5f56916004808201926020929091908290030181865afa158015611b6f573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611b939190612590565b601755601c54604080516368f4763b60e11b815290516001600160a01b039092169163d1e8ec76916004808201926020929091908290030181865afa158015611bde573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611c029190612590565b601855565b5f546001600160a01b03610100909104163314610f285760405163118cdaa760e01b8152336004820152602401610a60565b600260015403611c5c57604051633ee5aeb560e01b815260040160405180910390fd5b6002600155565b8083611c825760405162461bcd60e51b8152600401610a6091906125ed565b5060405183905f906001600160a01b0385169083908381818185875af1925050503d805f8114611ccd576040519150601f19603f3d011682016040523d82523d5f602084013e611cd2565b606091505b5050905080611d165760405162461bcd60e51b815260206004820152601060248201526f2a3930b739b332b9103330b4b632b21760811b6044820152606401610a60565b5050505050565b611d25612316565b5f805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b5f80546001600160a01b03838116610100818102610100600160a81b0319851617855560405193049190911692909183917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a35050565b611dce611784565b5f805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258611d513390565b611e0b81612244565b60085442908110611e3d57600854604051635451bc7560e11b8152610a60918391600401918252602082015260400190565b5f611e496004546109c1565b905080341015611e755760405163014c51fd60e41b815234600482015260248101829052604401610a60565b5f805f805f611e83346110a2565b9450945094509450945081600b5f828254611e9e919061234c565b9250508190555080600e5f828254611eb6919061234c565b9091555050600f546007556008545f90611ed190899061257d565b90508460055f828254611ee4919061234c565b925050819055508560045f828254611efc919061234c565b92505081905550600160065f828254611f15919061234c565b9091555050600280546001600160a01b031916331790556003889055611f396114c5565b15611f6357601754600754600a54611f51919061234c565b611f5b919061234c565b600855611f74565b600754611f70908961234c565b6008555b6040805134815260208101889052908101869052606081018590526080810184905260a081018390527fb4ca49a886358ee90d8e23cfe814480bd2135ca56db0e46a4481c450983827a29060c00160405180910390a1336001600160a01b03167f4c8886135814ba442d2fc0da83be4cadcd18375e5a3f589276e82ba5e5d8b1c189601154898960045460055460075461200f6004546109c1565b600654600954604080519a8b5260208b0199909952978901969096526060880194909452608087019290925260a086015260c085015260e084015261010083015261012082015261014081018490526101600160405180910390a26120726114c5565b15612104575f6120828834612538565b90505f5b818110156120fd57601e5460095460405163157a4fb760e01b815260048101919091523360248201526001600160a01b039091169063157a4fb7906044015f604051808303815f87803b1580156120db575f80fd5b505af11580156120ed573d5f803e3d5ffd5b5050600190920191506120869050565b5050612168565b601e5460095460405163157a4fb760e01b815260048101919091523360248201526001600160a01b039091169063157a4fb7906044015f604051808303815f87803b158015612151575f80fd5b505af1158015612163573d5f803e3d5ffd5b505050505b5f61217433888c61147c565b601a5460405163da3e57b560e01b8152336004820152602481018390529192506001600160a01b03169063da3e57b5906044015f604051808303815f87803b1580156121be575f80fd5b505af11580156121d0573d5f803e3d5ffd5b50505050601b5f9054906101000a90046001600160a01b03166001600160a01b0316635ec2dc8d866040518263ffffffff1660e01b81526004015f604051808303818588803b158015612221575f80fd5b505af1158015612233573d5f803e3d5ffd5b505050505050505050505050505050565b601a8151111561226c578051604051632b027c3960e01b8152600401610a6091815260200190565b80515f036122775750565b5f5b60018251612287919061257d565b811015612312578161229a82600161234c565b815181106122aa576122aa6125be565b60200260200101518282815181106122c4576122c46125be565b60200260200101511061230a578181815181106122e3576122e36125be565b6020026020010151604051600162d0a51b60e01b03198152600401610a6091815260200190565b600101612279565b5050565b5f5460ff16610f2857604051638dfc202b60e01b815260040160405180910390fd5b634e487b7160e01b5f52601160045260245ffd5b80820180821115610a0b57610a0b612338565b5f6020828403121561236f575f80fd5b5035919050565b6001600160a01b038116811461167a575f80fd5b5f6020828403121561239a575f80fd5b81356123a581612376565b9392505050565b634e487b7160e01b5f52604160045260245ffd5b5f82601f8301126123cf575f80fd5b813567ffffffffffffffff8111156123e9576123e96123ac565b8060051b604051601f19603f830116810181811067ffffffffffffffff82111715612416576124166123ac565b604052918252602081850181019290810186841115612433575f80fd5b6020860192505b8383101561245257823581526020928301920161243a565b5095945050505050565b5f805f6060848603121561246e575f80fd5b833561247981612376565b925060208401359150604084013567ffffffffffffffff81111561249b575f80fd5b6124a7868287016123c0565b9150509250925092565b5f80604083850312156124c2575f80fd5b82356124cd81612376565b9150602083013567ffffffffffffffff8111156124e8575f80fd5b6124f4858286016123c0565b9150509250929050565b5f6020828403121561250e575f80fd5b813567ffffffffffffffff811115612524575f80fd5b612530848285016123c0565b949350505050565b5f8261255257634e487b7160e01b5f52601260045260245ffd5b500490565b5f60208284031215612567575f80fd5b81516001600160801b03811681146123a5575f80fd5b81810381811115610a0b57610a0b612338565b5f602082840312156125a0575f80fd5b5051919050565b8082028115828204841417610a0b57610a0b612338565b634e487b7160e01b5f52603260045260245ffd5b5f602082840312156125e2575f80fd5b81516123a581612376565b602081525f82518060208401528060208501604085015e5f604082850101526040601f19601f8301168401019150509291505056fe596565743a204e6f20547265617375727920726576656e756520746f20706179206f7574a26469706673582212204ac5834ae14207c7fb807780bedd2e904a23e43b427f4ce3b99368d22895c2f964736f6c634300081a0033

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

00000000000000000000000008a38caa631de329ff2dad1656ce789f31af3142000000000000000000000000bb6b33ec5bf34dfd41134c90ec51012b82a7e3010000000000000000000000005cf74fff31ac34853d4e5e9f4c5996baf829cafc000000000000000000000000822862c8d4d21fa49eca2c008c2a15f0196f1a2300000000000000000000000083223b1f4897933558112175990c54f8fb55c852000000000000000000000000fed81be9a026211d82cd06a3a2f384853cd0bb2b000000000000000000000000a6b1948b42ea485c391730bb721d9f2001ebe50400000000000000000000000036825bf3fbdf5a29e2d5148bfe7dcf7b5639e32000000000000000000000000052deaa1c84233f7bb8c8a45baede41091c616506

-----Decoded View---------------
Arg [0] : _yeetTokenAddress (address): 0x08A38Caa631DE329FF2DAD1656CE789F31AF3142
Arg [1] : _reward (address): 0xbb6b33Ec5bF34DFd41134c90Ec51012b82a7e301
Arg [2] : _staking (address): 0x5cf74FfF31aC34853D4e5e9F4C5996baF829cAFC
Arg [3] : _gameSettings (address): 0x822862C8d4D21fa49EcA2c008C2a15f0196f1A23
Arg [4] : _publicGoodsAddress (address): 0x83223B1f4897933558112175990C54F8fb55C852
Arg [5] : _teamAddress (address): 0xFeD81bE9A026211d82Cd06A3A2f384853cD0bB2B
Arg [6] : _yeetardsNFTsAddress (address): 0xa6B1948b42ea485c391730bb721d9f2001EBE504
Arg [7] : _entropy (address): 0x36825bf3Fbdf5a29E2d5148bfe7Dcf7B5639e320
Arg [8] : _entropyProvider (address): 0x52DeaA1c84233F7bb8C8A45baeDE41091c616506

-----Encoded View---------------
9 Constructor Arguments found :
Arg [0] : 00000000000000000000000008a38caa631de329ff2dad1656ce789f31af3142
Arg [1] : 000000000000000000000000bb6b33ec5bf34dfd41134c90ec51012b82a7e301
Arg [2] : 0000000000000000000000005cf74fff31ac34853d4e5e9f4c5996baf829cafc
Arg [3] : 000000000000000000000000822862c8d4d21fa49eca2c008c2a15f0196f1a23
Arg [4] : 00000000000000000000000083223b1f4897933558112175990c54f8fb55c852
Arg [5] : 000000000000000000000000fed81be9a026211d82cd06a3a2f384853cd0bb2b
Arg [6] : 000000000000000000000000a6b1948b42ea485c391730bb721d9f2001ebe504
Arg [7] : 00000000000000000000000036825bf3fbdf5a29e2d5148bfe7dcf7b5639e320
Arg [8] : 00000000000000000000000052deaa1c84233f7bb8c8a45baede41091c616506


Block Transaction Gas Used Reward
view all blocks produced

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

Validator Index Block Amount
View All Withdrawals

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

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