POL Price: $0.46708 (-10.28%)
 

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Withdraw552225332024-03-29 17:59:56265 days ago1711735196IN
Halofi : Cupid Pool
0 POL0.036976997.46127225
Withdraw552224932024-03-29 17:57:58265 days ago1711735078IN
Halofi : Cupid Pool
0 POL0.04097751108.00582541
Withdraw548961412024-03-21 0:27:42273 days ago1710980862IN
Halofi : Cupid Pool
0 POL0.0186492752.86136764
Withdraw548958692024-03-21 0:16:50273 days ago1710980210IN
Halofi : Cupid Pool
0 POL0.0116958833.15197196
Withdraw548958272024-03-21 0:14:58273 days ago1710980098IN
Halofi : Cupid Pool
0 POL0.0118435433.57052569
Withdraw548957472024-03-21 0:11:28273 days ago1710979888IN
Halofi : Cupid Pool
0 POL0.0119089533.75592182
Withdraw548956902024-03-21 0:09:18273 days ago1710979758IN
Halofi : Cupid Pool
0 POL0.0116289432.96224407
Withdraw548955512024-03-21 0:04:08273 days ago1710979448IN
Halofi : Cupid Pool
0 POL0.0115143734.3
Withdraw548954842024-03-21 0:00:56273 days ago1710979256IN
Halofi : Cupid Pool
0 POL0.0120986534.29363862
Withdraw548954562024-03-20 23:59:58273 days ago1710979198IN
Halofi : Cupid Pool
0 POL0.0112950932.1
Withdraw548954242024-03-20 23:58:50273 days ago1710979130IN
Halofi : Cupid Pool
0 POL0.0118446533.57367007
Withdraw548953852024-03-20 23:57:26273 days ago1710979046IN
Halofi : Cupid Pool
0 POL0.0131776237.3519782
Withdraw548952452024-03-20 23:50:32273 days ago1710978632IN
Halofi : Cupid Pool
0 POL0.0116469633.1
Withdraw548951892024-03-20 23:48:34273 days ago1710978514IN
Halofi : Cupid Pool
0 POL0.0149741242.44414615
Withdraw548950982024-03-20 23:44:46273 days ago1710978286IN
Halofi : Cupid Pool
0 POL0.0172046334.8
Withdraw548949362024-03-20 23:37:53273 days ago1710977873IN
Halofi : Cupid Pool
0 POL0.0181365336.90001071
Withdraw548947972024-03-20 23:31:47273 days ago1710977507IN
Halofi : Cupid Pool
0 POL0.0161451332.84863657
Withdraw545447692024-03-11 21:21:21282 days ago1710192081IN
Halofi : Cupid Pool
0 POL0.0405435182.4891722
Withdraw545443272024-03-11 21:05:05282 days ago1710191105IN
Halofi : Cupid Pool
0 POL0.0444704890.4789377
Withdraw545439682024-03-11 20:52:14282 days ago1710190334IN
Halofi : Cupid Pool
0 POL0.0391460379.64589878
Withdraw545439002024-03-11 20:49:48282 days ago1710190188IN
Halofi : Cupid Pool
0 POL0.0371372378.28236519
Withdraw545434902024-03-11 20:34:34282 days ago1710189274IN
Halofi : Cupid Pool
0 POL0.0433355791.34797706
Withdraw511842892023-12-16 4:53:02369 days ago1702702382IN
Halofi : Cupid Pool
0 POL0.05383734113.50474884
Withdraw501260172023-11-19 8:46:54396 days ago1700383614IN
Halofi : Cupid Pool
0 POL0.0218408544.47813129
Withdraw488478212023-10-18 2:29:48428 days ago1697596188IN
Halofi : Cupid Pool
0 POL0.0365158377.04624669
View all transactions

Parent Transaction Hash Block From To
View All Internal Transactions
Loading...
Loading

Similar Match Source Code
This contract matches the deployed Bytecode of the Source Code for Contract 0xF9DD24A4...6f33Bd520
The constructor portion of the code might be different and could alter the actual behaviour of the contract

Contract Name:
Pool

Compiler Version
v0.8.7+commit.e28d00a7

Optimization Enabled:
Yes with 1500 runs

Other Settings:
default evmVersion
File 1 of 7 : Pool.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.7;

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "./strategies/IStrategy.sol";

//*********************************************************************//
// --------------------------- custom errors ------------------------- //
//*********************************************************************//
error ADMIN_FEE_WITHDRAWN();
error DEPOSIT_NOT_ALLOWED();
error EARLY_EXIT_NOT_POSSIBLE();
error GAME_ALREADY_INITIALIZED();
error GAME_ALREADY_STARTED();
error GAME_COMPLETED();
error GAME_NOT_COMPLETED();
error GAME_NOT_INITIALIZED();
error INVALID_CUSTOM_FEE();
error INVALID_DEPOSIT_COUNT();
error INVALID_EARLY_WITHDRAW_FEE();
error INVALID_FLEXIBLE_AMOUNT();
error INVALID_INBOUND_TOKEN();
error INVALID_INCENTIVE_TOKEN();
error INVALID_MAX_FLEXIBLE_AMOUNT();
error INVALID_MAX_PLAYER_COUNT();
error INVALID_NET_DEPOSIT_AMOUNT();
error INVALID_TRANSACTIONAL_TOKEN_SENDER();
error INVALID_OWNER();
error INVALID_SEGMENT_LENGTH();
error INVALID_SEGMENT_PAYMENT();
error INVALID_TRANSACTIONAL_TOKEN_AMOUNT();
error INVALID_STRATEGY();
error INVALID_WAITING_ROUND_SEGMENT_LENGTH();
error MAX_PLAYER_COUNT_REACHED();
error NOT_PLAYER();
error PLAYER_ALREADY_JOINED();
error PLAYER_ALREADY_PAID_IN_CURRENT_SEGMENT();
error PLAYER_DID_NOT_PAID_PREVIOUS_SEGMENT();
error PLAYER_ALREADY_WITHDREW_EARLY();
error PLAYER_ALREADY_WITHDREW();
error PLAYER_DOES_NOT_EXIST();
error TOKEN_TRANSFER_FAILURE();
error TRANSACTIONAL_TOKEN_TRANSFER_FAILURE();
error RENOUNCE_OWNERSHIP_NOT_ALLOWED();

/**
@title GoodGhosting V2 Hodl Contract
@notice Allows users to join a pool with a yield bearing strategy, the winners get interest and rewards, losers get their principal back.
@author Francis Odisi & Viraz Malhotra.
*/
contract Pool is Ownable, Pausable, ReentrancyGuard {
    /// @notice Multiplier used for calculating playerIndex to avoid precision issues.
    uint256 public constant MULTIPLIER = 10**6;

    /// @notice Maximum Flexible Deposit Amount in case of flexible pools.
    uint256 public immutable maxFlexibleSegmentPaymentAmount;

    /// @notice The time duration (in seconds) of each segment.
    uint64 public immutable segmentLength;

    /// @notice The performance admin fee (percentage).
    uint64 public immutable adminFee;

    /// @notice The time duration (in seconds) of last segment (waiting round).
    uint64 public immutable waitingRoundSegmentLength;

    /// @notice Defines the max quantity of players allowed in the game.
    uint64 public immutable maxPlayersCount;

    /// @notice The amount to be paid on each segment in case "flexibleSegmentPayment" is false (fixed payments).
    uint256 public immutable segmentPayment;

    /// @notice Address of the token used for depositing into the game by players.
    address public immutable inboundToken;

    /// @notice Flag which determines whether the segment payment is fixed or not.
    bool public immutable flexibleSegmentPayment;

    /// @notice Flag which determines whether the deposit token is a transactional token like eth or matic (blockchain native token, not ERC20).
    bool public immutable isTransactionalToken;

    /// @notice When the game started (game initialized timestamp).
    uint64 public firstSegmentStart;

    /// @notice Timestamp when the waiting segment starts.
    uint64 public waitingRoundSegmentStart;

    /// @notice The number of segments in the game (segment count).
    uint64 public depositCount;

    /// @notice The early withdrawal fee (percentage).
    uint64 public earlyWithdrawalFee;

    /// @notice Controls the amount of active players in the game (ignores players that early withdraw).
    uint64 public activePlayersCount;

    /// @notice winner counter to track no of winners.
    uint64 public winnerCount;

    /// @notice the % share of interest accrued during the total duration of deposit rounds.
    /// @dev the interest/rewards/incentive accounting is divided in two phases:
    ///     a) the total duration of deposit rounds in the game
    ///     b) the total duration of the waiting round in the game
    /// These are compared against the total game duration to calculate the weight
    uint64 public depositRoundInterestSharePercentage;

    /// @notice Stores the total amount of net interest received in the game.
    uint256 public totalGameInterest;

    /// @notice net total principal amount to reduce the slippage imapct from amm strategies.
    uint256 public netTotalGamePrincipal;

    /// @notice total principal amount only used to keep a track of the gross deposits.
    uint256 public totalGamePrincipal;

    /// @notice performance fee amount allocated to the admin.
    uint256[] public adminFeeAmount;

    /// @notice total amount of incentive tokens to be distributed among winners.
    uint256 public totalIncentiveAmount;

    /// @notice share % from impermanent loss.
    uint256 public impermanentLossShare;

    /// @notice total rewardTokenAmounts.
    uint256[] public rewardTokenAmounts;

    /// @notice emaergency withdraw flag.
    bool public emergencyWithdraw;

    /// @notice Checks if admin fee has been assigned.
    bool public adminFeeSet;

    /// @notice Controls if reward tokens are to be claimed at the time of redeem.
    bool public disableRewardTokenClaim;

    /// @notice controls if admin withdrew or not the performance fee.
    bool public adminWithdraw;

    /// @notice Ownership Control flag.
    bool public allowRenouncingOwnership;

    /// @notice Strategy Contract Address
    IStrategy public strategy;

    /// @notice Defines an optional token address used to provide additional incentives to users. Accepts "0x0" adresses when no incentive token exists.
    IERC20 public incentiveToken;

    /// @notice address of additional reward token accured from investing via different strategies like wmatic.
    IERC20[] public rewardTokens;

    /// @notice struct for storing all player stats.
    /// @param withdrawn boolean flag indicating whether a player has withdrawn or not
    /// @param canRejoin boolean flag indicating whether a player can re-join or not
    /// @param isWinner boolean flag indicating whether a player is a winner or not
    /// @param addr player address
    /// @param withdrawalSegment segment at which a player withdraws
    /// @param mostRecentSegmentPaid is the most recent segment in which the deposit was made by the player
    /// @param amountPaid the total amount paid by a player
    /// @param netAmountPaid the new total amount paid by a player considering the slippage & fees for amm strategies
    /// @param depositAmount the deposit amount the player has decided to pay per segment needed for variable deposit game
    struct Player {
        bool withdrawn;
        bool canRejoin;
        bool isWinner;
        address addr;
        uint64 withdrawalSegment;
        uint64 mostRecentSegmentPaid;
        uint256 amountPaid;
        uint256 netAmountPaid;
        uint256 depositAmount;
    }

    /// @notice Stores info about the players in the game.
    mapping(address => Player) public players;

    /// @notice Stores info about the player index which is used to determine the share of interest of each winner.
    mapping(address => mapping(uint256 => uint256)) public playerIndex;

    /// @notice Stores info of the no of players that deposited in each segment.
    mapping(uint256 => uint256) public segmentCounter;

    /// @notice Stores info of cumulativePlayerIndexSum for each segment for early exit scenario.
    /// so if for the key as segment `3` cumulativePlayerIndexSum will have player index sum
    /// of all players who have deposited in segment `3` from the current segment and previous segments.
    mapping(uint256 => uint256) public cumulativePlayerIndexSum;

    /// @notice Stores the total deposited amount by winners in each segment.
    /// @dev we need this for calculating the waiting round share amount of the
    /// winners depending on their total deposit size (individual ratio compared to all winners).
    /// totalWinnerDepositsPerSegment for let's say segment `3` will be the sum of deposits from
    // all winning players who have deposited in segment `3` & other previous segments.
    mapping(uint256 => uint256) public totalWinnerDepositsPerSegment;

    /// @notice list of players.
    address[] public iterablePlayers;

    //*********************************************************************//
    // ------------------------- events -------------------------- //
    //*********************************************************************//
    event JoinedGame(address indexed player, uint256 amount, uint256 netAmount);

    event Deposit(address indexed player, uint256 indexed segment, uint256 amount, uint256 netAmount);

    event WithdrawInboundTokens(address indexed player, uint256 amount);

    event WithdrawIncentiveToken(address indexed player, uint256 amount);

    event WithdrawRewardTokens(address indexed player, uint256[] amounts);

    event UpdateGameStats(
        address indexed player,
        uint256 totalBalance,
        uint256 totalGamePrincipal,
        uint256 netTotalGamePrincipal, 
        uint256 totalGameInterest,
        uint256 totalIncentiveAmount,
        uint256[] totalRewardAmounts,
        uint256 impermanentLossShare
    );

    event EarlyWithdrawal(
        address indexed player,
        uint256 amount,
        uint256 totalGamePrincipal,
        uint256 netTotalGamePrincipal
    );

    event AdminWithdrawal(
        address indexed admin,
        uint256 totalGameInterest,
        uint256 adminIncentiveAmount,
        uint256[] adminFeeAmounts
    );

    event EndGameStats(
        address indexed player,
        uint256 totalBalance,
        uint256 totalGamePrincipal,
        uint256 netTotalGamePricipal,
        uint256 totalGameInterest,
        uint256[] grossRewardTokenAmount,
        uint256 totalIncentiveAmount,
        uint256 impermanentLossShare
    );

    event AdminFee(uint256[] adminFeeAmounts);

    event ExternalTokenTransferError(address indexed token, bytes reason);

    event ExternalTokenGetBalanceError(address indexed token, bytes reason);

    event Initialized(uint64 firstSegmentStart, uint64 waitingRoundSegmentStart);

    event IncentiveTokenSet(address token);

    event EmergencyWithdrawalEnabled(
        uint64 currentSegment,
        uint64 winnerCount,
        uint64 depositRoundInterestSharePercentage
    );

    event EarlyWithdrawalFeeChanged(uint64 currentSegment, uint64 oldFee, uint64 newFee);

    event ClaimRewardTokensDisabled(uint64 currentSegment);

    //*********************************************************************//
    // ------------------------- modifiers -------------------------- //
    //*********************************************************************//
    modifier whenGameIsCompleted() {
        if (!isGameCompleted()) {
            revert GAME_NOT_COMPLETED();
        }
        _;
    }

    modifier whenGameIsNotCompleted() {
        if (isGameCompleted()) {
            revert GAME_COMPLETED();
        }
        _;
    }

    modifier whenGameIsInitialized() {
        if (firstSegmentStart == 0) {
            revert GAME_NOT_INITIALIZED();
        }
        _;
    }

    modifier whenGameIsNotInitialized() {
        if (firstSegmentStart != 0) {
            revert GAME_ALREADY_INITIALIZED();
        }
        _;
    }

    //*********************************************************************//
    // ------------------------- external views -------------------------- //
    //*********************************************************************//
    /// @dev Checks if the game is completed or not.
    /// @return "true" if completeted; otherwise, "false".
    function isGameCompleted() public view returns (bool) {
        // Game is completed when the current segment is greater than "depositCount" of the game
        // or if "emergencyWithdraw" was enabled.
        return getCurrentSegment() > depositCount || emergencyWithdraw;
    }

    /// @dev Checks if player is a winner.
    /// @param _player player address
    /// @return "true" if player is a winner; otherwise, return "false".
    function isWinner(address _player) external view returns (bool) {
        if (players[_player].amountPaid == 0) {
            return false;
        }

        return _isWinner(players[_player], depositCount);
    }

    /// @dev gets the number of players in the game.
    /// @return number of players.
    function getNumberOfPlayers() external view returns (uint256) {
        return iterablePlayers.length;
    }

    /// @dev Calculates the current segment of the game.
    /// @return current game segment.
    // UPDATE - A1 Audit Report
    function getCurrentSegment() public view whenGameIsInitialized returns (uint64) {
        uint256 currentSegment;
        // to avoid SLOAD multiple times
        uint256 _waitingRoundSegmentStart = waitingRoundSegmentStart;
        uint256 endOfWaitingRound = _waitingRoundSegmentStart + waitingRoundSegmentLength;
        // logic for getting the current segment while the game is on waiting round
        if (_waitingRoundSegmentStart <= block.timestamp && block.timestamp < endOfWaitingRound) {
            currentSegment = depositCount;
        } else if (block.timestamp >= endOfWaitingRound) {
            // logic for getting the current segment after the game completes (waiting round is over)
            currentSegment = depositCount + 1 + ((block.timestamp - endOfWaitingRound) / segmentLength);
        } else {
            // logic for getting the current segment during segments that allows depositing (before waiting round)
            currentSegment = (block.timestamp - firstSegmentStart) / segmentLength;
        }
        return uint64(currentSegment);
    }

    /// @dev Checks if the game has been initialized or not.
    function isInitialized() external view returns (bool) {
        return firstSegmentStart != 0;
    }

    //*********************************************************************//
    // ------------------------- constructor -------------------------- //
    //*********************************************************************//
    /**
        Creates a new instance of GoodGhosting game
        @param _inboundCurrency Smart contract address of inbound currency used for the game.
        @param _maxFlexibleSegmentPaymentAmount Maximum Flexible Deposit Amount in case of flexible pools.
        @param _depositCount Number of segments in the game.
        @param _segmentLength Lenght of each segment, in seconds (i.e., 180 (sec) => 3 minutes).
        @param _waitingRoundSegmentLength Lenght of waiting round segment, in seconds (i.e., 180 (sec) => 3 minutes).
        @param _segmentPayment Amount of tokens each player needs to contribute per segment
        @param _earlyWithdrawalFee Fee paid by users on early withdrawals (before the game completes). Used as an integer percentage (i.e., 10 represents 10%).
        @param _customFee performance fee charged by admin. Used as an integer percentage (i.e., 10 represents 10%). Does not accept "decimal" fees like "0.5".
        @param _maxPlayersCount max quantity of players allowed to join the game
        @param _strategy investment strategy contract address.
        @param _isTransactionalToken isTransactionalToken flag.
     */
    constructor(
        address _inboundCurrency,
        uint256 _maxFlexibleSegmentPaymentAmount,
        uint64 _depositCount,
        uint64 _segmentLength,
        uint64 _waitingRoundSegmentLength,
        uint256 _segmentPayment,
        uint64 _earlyWithdrawalFee,
        uint64 _customFee,
        uint64 _maxPlayersCount,
        bool _flexibleSegmentPayment,
        IStrategy _strategy,
        bool _isTransactionalToken
    ) {
        flexibleSegmentPayment = _flexibleSegmentPayment;
        isTransactionalToken = _isTransactionalToken;
        if (_customFee > 100) {
            revert INVALID_CUSTOM_FEE();
        }
        if (_earlyWithdrawalFee > 100) {
            revert INVALID_EARLY_WITHDRAW_FEE();
        }
        if (_maxPlayersCount == 0) {
            revert INVALID_MAX_PLAYER_COUNT();
        }

        if (address(_inboundCurrency) == address(0) && !_isTransactionalToken) {
            revert INVALID_INBOUND_TOKEN();
        }
        if (address(_strategy) == address(0)) {
            revert INVALID_STRATEGY();
        }
        if (_depositCount == 0) {
            revert INVALID_DEPOSIT_COUNT();
        }
        if (_segmentLength == 0) {
            revert INVALID_SEGMENT_LENGTH();
        }
        if (!_flexibleSegmentPayment && _segmentPayment == 0) {
            revert INVALID_SEGMENT_PAYMENT();
        }
        if (_waitingRoundSegmentLength == 0) {
            revert INVALID_WAITING_ROUND_SEGMENT_LENGTH();
        }
        if (_waitingRoundSegmentLength < _segmentLength) {
            revert INVALID_WAITING_ROUND_SEGMENT_LENGTH();
        }

        if (_flexibleSegmentPayment && _maxFlexibleSegmentPaymentAmount == 0) {
            revert INVALID_MAX_FLEXIBLE_AMOUNT();
        }
        address _underlyingAsset = _strategy.getUnderlyingAsset();

        // UPDATE - A4 Audit Report
        if (_underlyingAsset != _inboundCurrency && !_isTransactionalToken) {
            revert INVALID_INBOUND_TOKEN();
        }

        // Initializes default variables
        depositCount = _depositCount;
        segmentLength = _segmentLength;
        waitingRoundSegmentLength = _waitingRoundSegmentLength;
        segmentPayment = _segmentPayment;
        earlyWithdrawalFee = _earlyWithdrawalFee;
        adminFee = _customFee;
        inboundToken = _inboundCurrency;
        strategy = _strategy;
        maxPlayersCount = _maxPlayersCount;
        maxFlexibleSegmentPaymentAmount = _maxFlexibleSegmentPaymentAmount;
        rewardTokens = strategy.getRewardTokens();
        rewardTokenAmounts = new uint256[](rewardTokens.length);
        // length of the array is more, considering the inbound token since there would be fee on interest
        adminFeeAmount = new uint256[](rewardTokens.length + 1);
    }

    /**
    @dev Initializes the pool by setting the start time, the waiting round start time, incentive token (optional) & updates the interest share % of the deposit phase
    @param _incentiveToken Incentive token address (optional to set).
    */
    function initialize(IERC20 _incentiveToken) public virtual onlyOwner whenGameIsNotInitialized whenNotPaused {
        if (strategy.strategyOwner() != address(this)) {
            revert INVALID_OWNER();
        }
        firstSegmentStart = uint64(block.timestamp); //gets current time
        unchecked {
            waitingRoundSegmentStart = firstSegmentStart + (segmentLength * depositCount);
        }
        _updateInterestShares(0);
        setIncentiveToken(_incentiveToken);
        emit Initialized(firstSegmentStart, waitingRoundSegmentStart);
    }

    //*********************************************************************//
    // ------------------------- internal methods -------------------------- //
    //*********************************************************************//
    /**
    @dev Transfer external tokens with try/catch in place so the external token transfer failures don't affect the transaction confirmation
    @param _token token address.
    @param _to recipient of the token.
    @param _amount transfer amount.
    */
    // UPDATE - N1 Audit Report
    function _transferTokenOrContinueOnFailure(
        address _token,
        address _to,
        uint256 _amount
    ) internal returns (uint256) {
        try IERC20(_token).balanceOf(address(this)) returns (uint256 tokenBalance) {
            if (_amount > tokenBalance) {
                _amount = tokenBalance;
            }
        } catch (bytes memory reason) {
            _amount = 0;
            emit ExternalTokenGetBalanceError(_token, reason);
        }
        if (_amount != 0) {
            try IERC20(_token).transfer(_to, _amount) returns (bool success) {
                if (!success) {
                    // forces error event to be emitted in case false is returned from ERC20.transfer.
                    revert TOKEN_TRANSFER_FAILURE();
                }
            } catch (bytes memory reason) {
                emit ExternalTokenTransferError(_token, reason);
            }
        }
        return _amount;
    }

    /**
    @dev Winner interest accounting based on the interest amount share in the deposit rounds & waiting round.
    @param _segment last deposit segment for the winners.
    @param _impermanentLossShare impermanent loss share during the current withdrawal.
    @return _playerIndexSharePercentage is the percentage share of the winners during deposit rounds for getting interest/rewards/incentives based on player index.
    @return _playerDepositAmountSharePercentage is the percentage share of the winners during waiting round for getting interest/rewards/incentives based on player deposits.
    @return _payout total amount to be transferred to the winners.
    */
    function _calculateAndUpdateWinnerInterestAccounting(uint64 _segment, uint256 _impermanentLossShare)
        internal
        returns (
            uint256 _playerIndexSharePercentage,
            uint256 _playerDepositAmountSharePercentage,
            uint256 _payout
        )
    {
        // memory variables for the player interest amount accounting for both deposits and waiting rounds.
        uint256 playerInterestAmountDuringDepositRounds;
        uint256 playerInterestAmountDuringWaitingRounds;

        // winners of the game get a share of the interest, reward & incentive tokens based on how early they deposit, the amount they deposit in case of avriable deposit pool & the ratio of the deposit & waiting round.
        // Calculate Cummalative index of the withdrawing player
        uint256 playerIndexSum = 0;

        // calculate playerIndexSum for each player
        for (uint256 i = 0; i <= _segment; ) {
            playerIndexSum += playerIndex[msg.sender][i];
            unchecked {
                ++i;
            }
        }

        // calculate playerIndexSharePercentage for each player
        // UPDATE - H3 Audit Report
        _playerIndexSharePercentage = (playerIndexSum * MULTIPLIER) / cumulativePlayerIndexSum[_segment];

        // reduce cumulativePlayerIndexSum since a winner only withdraws their own funds.
        cumulativePlayerIndexSum[_segment] -= playerIndexSum;

        _payout = players[msg.sender].netAmountPaid;


        // calculate _playerDepositAmountSharePercentage for each player for waiting round calculations depending on how much deposit share the player has.
        // have a safety check players[msg.sender].netAmountPaid > totalWinnerDepositsPerSegment[segment] in case of a impermanent loss
        // in case of a impermanent loss although we probably won't need it since we reduce player's netAmountPaid too but just in case.
        _playerDepositAmountSharePercentage = _payout >
            totalWinnerDepositsPerSegment[_segment]
            ? MULTIPLIER // UPDATE - H3 Audit Report
            : (_payout * MULTIPLIER) / totalWinnerDepositsPerSegment[_segment];


        // update storage vars since each winner withdraws only funds entitled to them.
        if (totalWinnerDepositsPerSegment[_segment] < _payout) {
            totalWinnerDepositsPerSegment[_segment] = 0;
        } else {
            totalWinnerDepositsPerSegment[_segment] -= _payout;
        }

        // checking for impermenent loss
        if (_impermanentLossShare != 0) {
            // new payput in case of impermanent loss
            _payout = (_payout * _impermanentLossShare) / 100;
            
            // update netAmountPaid in case of impermanent loss
             players[msg.sender].netAmountPaid = _payout;
        }
    
        // checking for impermenent loss
        // save gas by checking the interest before entering in the if block
        if (_impermanentLossShare == 0 && totalGameInterest != 0) {
            // calculating the interest amount accrued in waiting & deposit Rounds.
            uint256 interestAccruedDuringDepositRounds = (totalGameInterest * depositRoundInterestSharePercentage) /
                MULTIPLIER;
            // we calculate interestAccruedDuringWaitingRound by subtracting the totalGameInterest by interestAccruedDuringDepositRounds
            uint256 interestAccruedDuringWaitingRound = depositRoundInterestSharePercentage == MULTIPLIER
                ? 0
                : totalGameInterest - interestAccruedDuringDepositRounds;

            // calculating the player interest share split b/w the waiting & deposit rounds.
            playerInterestAmountDuringWaitingRounds =
                (interestAccruedDuringWaitingRound * _playerDepositAmountSharePercentage) /
                MULTIPLIER;

            playerInterestAmountDuringDepositRounds =
                (interestAccruedDuringDepositRounds * _playerIndexSharePercentage) /
                MULTIPLIER;

            // update the total amount to be redeemed
            _payout += playerInterestAmountDuringDepositRounds + playerInterestAmountDuringWaitingRounds;

            // reduce totalGameInterest since a winner only withdraws their own funds.
            totalGameInterest -= (playerInterestAmountDuringDepositRounds + playerInterestAmountDuringWaitingRounds);
        }
    }

    /**
    @dev Non-winner amount accounting.
    @param _impermanentLossShare impermanent loss share %.
    @param _netAmountPaid net amount paid by the player.
    @return payout amount to be sent to the player.
    */
    function _calculateAndUpdateNonWinnerAccounting(uint256 _impermanentLossShare, uint256 _netAmountPaid)
        internal
        returns (uint256 payout)
    {
        if (_impermanentLossShare != 0) {
            // new payput in case of impermanent loss
            payout = (_netAmountPaid * _impermanentLossShare) / 100;
            // reduce player netAmountPaid in case of impermanent loss
            players[msg.sender].netAmountPaid = payout;
        } else {
            payout = _netAmountPaid;
        }

        // non-winners don't get any rewards/incentives
        uint256[] memory rewardAmounts = new uint256[](rewardTokens.length);
        emit WithdrawIncentiveToken(msg.sender, 0);
        emit WithdrawRewardTokens(msg.sender, rewardAmounts);
    }

    /**
    @dev Winner reward accounting based on the player amount share % calculated based on player index & total deposits made.
    @param playerDepositAmountSharePercentage Deposit amount share %.
    @param playerIndexSharePercentage Player index share %..
    */
    function _calculateAndUpdateWinnerRewardAccounting(
        uint256 playerDepositAmountSharePercentage,
        uint256 playerIndexSharePercentage
    ) internal {
        // calculating winners share of the reward amounts
        // memory vars to avoid SLOADS & for the player rewards share accounting
        IERC20[] memory _rewardTokens = rewardTokens;
        uint256[] memory _rewardTokenAmounts = rewardTokenAmounts;
        uint256[] memory playerRewards = new uint256[](_rewardTokens.length);
        // reference for array length to save gas
        uint256 _rewardLength = _rewardTokens.length;

        for (uint256 i = 0; i < _rewardLength; ) {
            if (address(_rewardTokens[i]) != address(0) && _rewardTokenAmounts[i] != 0) {
                // calculating the reward token amount split b/w waiting & deposit Rounds.
                uint256 totalRewardAmountsDuringDepositRounds = (_rewardTokenAmounts[i] *
                    depositRoundInterestSharePercentage) / MULTIPLIER;
                // we calculate totalRewardAmountsWaitingRounds by subtracting the rewardTokenAmounts by totalRewardAmountsDuringDepositRounds
                uint256 totalRewardAmountsWaitingRounds = depositRoundInterestSharePercentage == MULTIPLIER
                    ? 0
                    : _rewardTokenAmounts[i] - totalRewardAmountsDuringDepositRounds;

                // calculating the winner reward token amount share split b/w the waiting & deposit rounds.
                uint256 playerRewardShareAmountDuringDepositRounds = (totalRewardAmountsDuringDepositRounds *
                    playerIndexSharePercentage) / MULTIPLIER;
                uint256 playerRewardShareAmountDuringWaitingRounds = (totalRewardAmountsWaitingRounds *
                    playerDepositAmountSharePercentage) / MULTIPLIER;

                // update the rewards to be transferred
                playerRewards[i] =
                    playerRewardShareAmountDuringDepositRounds +
                    playerRewardShareAmountDuringWaitingRounds;

                // update storage var since each winner withdraws only funds entitled to them.
                _rewardTokenAmounts[i] -= playerRewards[i];

                // transferring the reward token share to the winner
                // updates variable value to make sure on a failure, event is emitted w/ correct value.
                // UPDATE - Related to N1 Audit Report (If an external protocol reward token get's compromised)
                playerRewards[i] = _transferTokenOrContinueOnFailure(
                    address(_rewardTokens[i]),
                    msg.sender,
                    playerRewards[i]
                );
            }
            unchecked {
                ++i;
            }
        }
        // avoid SSTORE inside loop
        rewardTokenAmounts = _rewardTokenAmounts;

        // We have to ignore the "check-effects-interactions" pattern here and emit the event
        // only at the end of the function, in order to emit it w/ the correct withdrawal amount.
        // In case the safety checks above are evaluated to true, payout, playerIncentiv and playerReward
        // are updated, so we need the event to be emitted with the correct info.
        emit WithdrawRewardTokens(msg.sender, playerRewards);
    }

    /**
    @dev Winner incentive accounting based on the player amount share % calculated based on player index & total deposits made.
    @param playerDepositAmountSharePercentage Deposit amount share %.
    @param playerIndexSharePercentage Player index share %..
    */
    function _calculateAndUpdateWinnerIncentivesAccounting(
        uint256 playerDepositAmountSharePercentage,
        uint256 playerIndexSharePercentage
    ) internal {
        uint256 playerIncentive;
        if (totalIncentiveAmount != 0) {
            // calculating the incentive amount split b/w waiting & deposit Rounds.
            uint256 incentiveAmountSharedDuringDepositRounds = (totalIncentiveAmount *
                depositRoundInterestSharePercentage) / MULTIPLIER;
            // we calculate incentiveAmountShareDuringWaitingRound by subtracting the totalIncentiveAmount by incentiveAmountSharedDuringDepositRounds
            uint256 incentiveAmountShareDuringWaitingRound = depositRoundInterestSharePercentage == MULTIPLIER
                ? 0
                : totalIncentiveAmount - incentiveAmountSharedDuringDepositRounds;

            // calculating the winner incentive amount share split b/w the waiting & deposit rounds.
            uint256 playerIncentiveAmountDuringDepositRounds = (incentiveAmountSharedDuringDepositRounds *
                playerIndexSharePercentage) / MULTIPLIER;
            uint256 playerIncentiveAmountDuringWaitingRounds = (incentiveAmountShareDuringWaitingRound *
                playerDepositAmountSharePercentage) / MULTIPLIER;

            playerIncentive = playerIncentiveAmountDuringDepositRounds + playerIncentiveAmountDuringWaitingRounds;

            // update storage var since each winner withdraws only funds entitled to them.
            totalIncentiveAmount -= playerIncentive;

            // transferring the incentive share to the winner
            // updates variable value to make sure on a failure, event is emitted w/ correct value.
            // UPDATE - N1 Audit Report
            playerIncentive = _transferTokenOrContinueOnFailure(address(incentiveToken), msg.sender, playerIncentive);
        }
        // We have to ignore the "check-effects-interactions" pattern here and emit the event
        // only at the end of the function, in order to emit it w/ the correct withdrawal amount.
        // In case the safety checks above are evaluated to true, payout, playerIncentiv and playerReward
        // are updated, so we need the event to be emitted with the correct info.
        emit WithdrawIncentiveToken(msg.sender, playerIncentive);
    }

    /**
    @notice updates the waiting and deposit rounds time percentages based on the total duration of the pool, total deposit round & waiting round duration.
    @param _currentSegment current segment value.
    */
    function _updateInterestShares(uint64 _currentSegment) internal {
        // if emergencyWithdraw hasn't been enabled then the calculation of the percentages is pretty straightforward
        // we get the total durations of the deposit and waiting round and get the % share out of the total duration
        if (!emergencyWithdraw) {
            uint64 endOfWaitingRound = waitingRoundSegmentStart + waitingRoundSegmentLength;
            uint64 totalGameDuration = endOfWaitingRound - firstSegmentStart;
            depositRoundInterestSharePercentage = uint64(
                (segmentLength * depositCount * MULTIPLIER) / totalGameDuration
            );
        } else {
            // if emergencyWithdraw is enabled & it got enabled during the waiting round then we re-calculate the waiting round period
            // we then get the total durations of the deposit and waiting round and get the % share out of the total duration
            if (_currentSegment == depositCount) {
                uint64 totalGameDuration = uint64(block.timestamp) - firstSegmentStart;
                depositRoundInterestSharePercentage = uint64(
                    (segmentLength * depositCount * MULTIPLIER) / totalGameDuration
                );
            } else {
                // if emergencyWithdraw is enabled & it got enabled before the waiting round then we set the depositRoundInterestSharePercentage to 100 % and waitingRoundInterestSharePercentage will indirectly be 0.
                depositRoundInterestSharePercentage = uint64(MULTIPLIER);
            }
        }
    }

    /**
    @notice check if there are any rewards to claim for the admin.
    @param _adminFeeAmount admin fee amount value.
    */
    function _checkRewardsClaimableByAdmin(uint256[] memory _adminFeeAmount) internal pure returns (bool) {
        // reference for array length to save gas
        uint256 _adminFeeAmountsLength = _adminFeeAmount.length;
        // starts loop from 1, because first spot of _adminFeeAmount is reserved for admin interest share.
        for (uint256 i = 1; i < _adminFeeAmountsLength; ) {
            if (_adminFeeAmount[i] != 0) {
                return true;
            }
            unchecked {
                ++i;
            }
        }
        return false;
    }

    /**
    @notice Transfer funds after balance checks to the players / admin.
    @param _recepient address which will receive tokens.
    @param _amount transfer amount.
    */
    // UPDATE - A3 Audit Report
    function _transferFundsSafelyOrFail(address _recepient, uint256 _amount) internal returns (uint256) {
        if (isTransactionalToken) {
            // safety check
            // this scenario is very tricky to mock
            // and our mock contracts are pretty complex currently so haven't tested this line with unit tests
            if (_amount > address(this).balance) {
                _amount = address(this).balance;
            }
            (bool success, ) = _recepient.call{ value: _amount }("");
            if (!success) {
                revert TRANSACTIONAL_TOKEN_TRANSFER_FAILURE();
            }
        } else {
            // safety check
            if (_amount > IERC20(inboundToken).balanceOf(address(this))) {
                _amount = IERC20(inboundToken).balanceOf(address(this));
            }
            bool success = IERC20(inboundToken).transfer(_recepient, _amount);
            if (!success) {
                revert TOKEN_TRANSFER_FAILURE();
            }
        }
        return _amount;
    }

    /**
    @notice
    Calculates and updates's game accounting called by methods _setGlobalPoolParams.
    Updates the game storage vars used for calculating player interest, incentives etc.
    @param _totalBalance Total inbound token balance in the contract.
    @param _grossRewardTokenAmount Gross reward amounts.
    */
    function _calculateAndUpdateGameAccounting(uint256 _totalBalance, uint256[] memory _grossRewardTokenAmount)
        internal
        returns (uint256)
    {
        uint256 _grossInterest = 0;

        if (_totalBalance >= netTotalGamePrincipal) {
            // calculates the gross interest
            _grossInterest = _totalBalance - netTotalGamePrincipal;
        } else {
            // handling impermanent loss case
            impermanentLossShare = (_totalBalance * 100) / netTotalGamePrincipal;
            netTotalGamePrincipal = _totalBalance;
        }
        // sets the totalIncentiveAmount if available
        // UPDATE - N1 Audit Report
        address _incentiveToken = address(incentiveToken);
        if (_incentiveToken != address(0)) {
            try IERC20(_incentiveToken).balanceOf(address(this)) returns (uint256 _totalIncentiveAmount) {
                totalIncentiveAmount = _totalIncentiveAmount;
            } catch (bytes memory reason) {
                emit ExternalTokenGetBalanceError(_incentiveToken, reason);
            }
        }
        // this condition is added because emit is to only be emitted when adminFeeSet flag is false but this mehtod is called for every player withdrawal in variable deposit pool.
        if (!adminFeeSet) {
            emit EndGameStats(
                msg.sender,
                _totalBalance,
                totalGamePrincipal,
                netTotalGamePrincipal,
                _grossInterest,
                _grossRewardTokenAmount,
                totalIncentiveAmount,
                impermanentLossShare
            );
        }
        return _grossInterest;
    }

    /**
    @notice
    Calculates and set's admin accounting called by methods _setGlobalPoolParams.
    Updates the admin fee storage var used for admin fee.
    @param _grossInterest Gross interest amount.
    @param _grossRewardTokenAmount Gross reward amount array.
    */
    function _calculateAndSetAdminAccounting(uint256 _grossInterest, uint256[] memory _grossRewardTokenAmount)
        internal
    {
        // calculates the performance/admin fee (takes a cut - the admin percentage fee - from the pool's interest, strategy rewards).
        // calculates the "gameInterest" (net interest) that will be split among winners in the game
        // calculates the rewardTokenAmounts that will be split among winners in the game
        // when there's no winners, admin takes all the interest + rewards
        // to avoid SLOAD multiple times
        IERC20[] memory _rewardTokens = rewardTokens;
        uint256[] memory _adminFeeAmount = adminFeeAmount;
        uint256[] memory _rewardTokenAmounts = rewardTokenAmounts;

        // handling the scenario when some winners withdraw later so they should get extra interest/rewards
        // the scenario wasn't handled before
        if (adminFeeSet) {
            // if the admin fee is set a check is made to check whether the admin has withdrawn or not
            if (adminWithdraw) {
                // we update the totalGameInterest/reward amounts as the gross values
                totalGameInterest = _grossInterest;
                _rewardTokenAmounts = _grossRewardTokenAmount;
            } else {
                // if the admin hasn't withdrawn then we consider the admin fee into account while calculating the totalGameInterest/reward amounts
                if (_grossInterest >= _adminFeeAmount[0]) {
                    totalGameInterest = (_grossInterest - _adminFeeAmount[0]);
                } else {
                    totalGameInterest = 0;
                }

                // reference for array length to save gas
                uint256 _rewardsLength = _rewardTokens.length;
                for (uint256 i = 0; i < _rewardsLength; ) {
                    // first slot is reserved for admin interest amount, so starts at 1.
                    if (_grossRewardTokenAmount[i] >= _adminFeeAmount[i + 1]) {
                        _rewardTokenAmounts[i] = _grossRewardTokenAmount[i] - _adminFeeAmount[i + 1];
                    } else {
                        _rewardTokenAmounts[i] = 0;
                    }
                    unchecked {
                        ++i;
                    }
                }
            }
        } else {
            // reference for array length to save gas
            uint256 _rewardsLength = _rewardTokens.length;
            // if the admin fee isn't set then we set it in the else part
            // UPDATE - N2 Audit Report
            if (winnerCount == 0) {
                // in case of no winners the admin takes all the interest and the rewards & the incentive amount (check adminFeeWithdraw method)
                _adminFeeAmount[0] = _grossInterest;
                // just setting these for consistency since if there are no winners then for accounting both these vars aren't used
                totalGameInterest = _grossInterest;

                for (uint256 i = 0; i < _rewardsLength; ) {
                    _rewardTokenAmounts[i] = _grossRewardTokenAmount[i];
                    // first slot is reserved for admin interest amount, so starts at 1.
                    _adminFeeAmount[i + 1] = _grossRewardTokenAmount[i];
                    unchecked {
                        ++i;
                    }
                }
                // avoid SSTORE in loop
                adminFeeAmount = _adminFeeAmount;
            } else if (adminFee != 0) {
                // if admin fee != 0 then the admin get's a share based on the adminFee %
                _adminFeeAmount[0] = (_grossInterest * adminFee) / 100;
                totalGameInterest = _grossInterest - _adminFeeAmount[0];

                for (uint256 i = 0; i < _rewardsLength; ) {
                    // first slot is reserved for admin interest amount, so starts at 1.
                    _adminFeeAmount[i + 1] = (_grossRewardTokenAmount[i] * adminFee) / 100;
                    _rewardTokenAmounts[i] = _grossRewardTokenAmount[i] - _adminFeeAmount[i + 1];
                    unchecked {
                        ++i;
                    }
                }
                // avoid SSTORE in loop
                adminFeeAmount = _adminFeeAmount;
            } else {
                // if there are winners and there is no admin fee in that case the admin fee will always be 0
                totalGameInterest = _grossInterest;

                for (uint256 i = 0; i < _rewardsLength; ) {
                    _rewardTokenAmounts[i] = _grossRewardTokenAmount[i];
                    unchecked {
                        ++i;
                    }
                }
            }
            emit AdminFee(adminFeeAmount);
        }

        // avoid SSTORE in loop
        rewardTokenAmounts = _rewardTokenAmounts;
    }

    /**
    @dev Initializes the player stats when they join.
    @param _minAmount Slippage based amount to cover for impermanent loss scenario.
    @param _depositAmount Variable Deposit Amount in case of a variable deposit pool.
    */
    function _joinGame(uint256 _minAmount, uint256 _depositAmount) internal virtual {
        if (getCurrentSegment() != 0) {
            revert GAME_ALREADY_STARTED();
        }
        bool canRejoin = players[msg.sender].canRejoin;

        if (players[msg.sender].addr == msg.sender && !canRejoin) {
            revert PLAYER_ALREADY_JOINED();
        }

        activePlayersCount += 1;
        if (activePlayersCount > maxPlayersCount) {
            revert MAX_PLAYER_COUNT_REACHED();
        }

        if (flexibleSegmentPayment && (_depositAmount == 0 || _depositAmount > maxFlexibleSegmentPaymentAmount)) {
            revert INVALID_FLEXIBLE_AMOUNT();
        }
        uint256 amount = flexibleSegmentPayment ? _depositAmount : segmentPayment;
        if (isTransactionalToken) {
            if (msg.value != amount) {
                revert INVALID_TRANSACTIONAL_TOKEN_AMOUNT();
            }
        } else {
            if (msg.value != 0) {
                revert INVALID_TRANSACTIONAL_TOKEN_AMOUNT();
            }
        }
        // get net deposit amount from the strategy
        uint256 netAmount = strategy.getNetDepositAmount(amount);
        if (netAmount == 0) {
            revert INVALID_NET_DEPOSIT_AMOUNT();
        }

        Player memory newPlayer = Player({
            addr: msg.sender,
            withdrawalSegment: 0,
            mostRecentSegmentPaid: 0,
            amountPaid: 0,
            netAmountPaid: 0,
            withdrawn: false,
            canRejoin: false,
            isWinner: false,
            depositAmount: amount
        });
        players[msg.sender] = newPlayer;
        if (!canRejoin) {
            iterablePlayers.push(msg.sender);
        }

        emit JoinedGame(msg.sender, amount, netAmount);
        _transferInboundTokenToContract(_minAmount, amount, netAmount);
    }

    /**
        @dev Manages the transfer of funds from the player to the specific strategy used for the game/pool and updates the player index 
        which determines the interest and reward share of the winner based on the deposit amount amount and the time they deposit in a particular segment.
        @param _minAmount Slippage based amount to cover for impermanent loss scenario.
        @param _depositAmount Variable Deposit Amount in case of a variable deposit pool.
        @param _netDepositAmount Net deposit amount.
     */
    function _transferInboundTokenToContract(
        uint256 _minAmount,
        uint256 _depositAmount,
        uint256 _netDepositAmount
    ) internal virtual {
        // this scenario given the inputs to the mock contract methods isn't possible to mock locally
        // UPDATE - H1 Audit Report
        if (_netDepositAmount > _depositAmount) {
            revert INVALID_NET_DEPOSIT_AMOUNT();
        }
        uint64 currentSegment = getCurrentSegment();
        players[msg.sender].mostRecentSegmentPaid = currentSegment;

        players[msg.sender].amountPaid += _depositAmount;
        players[msg.sender].netAmountPaid += _netDepositAmount;

        // PLAYER INDEX CALCULATION TO DETERMINE INTEREST SHARE
        // player index = prev. segment player index + segment amount deposited / difference in time of deposit from the current segment starting time
        // UPDATE - H2 Audit Report
        uint256 currentSegmentplayerIndex = (_netDepositAmount * MULTIPLIER) /
            (segmentLength + block.timestamp - (firstSegmentStart + (currentSegment * segmentLength)));
        playerIndex[msg.sender][currentSegment] = currentSegmentplayerIndex;

        // updating the cummulative player Index with all the deposits made by the player till that segment
        // Avoids SLOAD in loop
        uint256 cummalativePlayerIndexSumInMemory = cumulativePlayerIndexSum[currentSegment];
        for (uint256 i = 0; i <= currentSegment; ) {
            cummalativePlayerIndexSumInMemory += playerIndex[msg.sender][i];
            unchecked {
                ++i;
            }
        }
        cumulativePlayerIndexSum[currentSegment] = cummalativePlayerIndexSumInMemory;

        // update totalWinnerDepositsPerSegment for every segment for every deposit made
        totalWinnerDepositsPerSegment[currentSegment] += players[msg.sender].netAmountPaid;
        // check if this is deposit for the last segment. If yes, the player is a winner.
        // since both join game and deposit method call this method so having it here
        if (currentSegment == (depositCount - 1)) {
            // array indexes start from 0
            unchecked {
                winnerCount += 1;
            }
            players[msg.sender].isWinner = true;
        }

        // segment counter calculation
        unchecked {
            segmentCounter[currentSegment] += 1;
            if (currentSegment != 0 && segmentCounter[currentSegment - 1] != 0) {
                segmentCounter[currentSegment - 1] -= 1;
            }
        }

        // updating both totalGamePrincipal & netTotalGamePrincipal to maintain consistency
        totalGamePrincipal += _depositAmount;
        netTotalGamePrincipal += _netDepositAmount;

        if (!isTransactionalToken) {
            bool success = IERC20(inboundToken).transferFrom(msg.sender, address(strategy), _depositAmount);
            if (!success) {
                revert TOKEN_TRANSFER_FAILURE();
            }
        }

        strategy.invest{ value: msg.value }(inboundToken, _minAmount);
    }

    /// @dev Sets the game stats without redeeming the funds from the strategy.
    /// Can only be called after the game is completed when each player withdraws.
    function _setGlobalPoolParams() internal virtual whenGameIsCompleted {
        // this method is called everytime a player decides to withdraw,
        // to update the game storage vars because every player withdraw's their entitled amount that includes the incentive & reward tokens.
        // so totalBalance keeps a track of the ucrrent balance & the accumulated principal + interest stored in the strategy protocol.
        uint256 totalBalance = isTransactionalToken
            ? address(this).balance + strategy.getTotalAmount()
            : IERC20(inboundToken).balanceOf(address(this)) + strategy.getTotalAmount();

        // to avoid SLOAD multiple times
        IERC20[] memory _rewardTokens = rewardTokens;
        uint256[] memory _rewardTokenAmounts = rewardTokenAmounts;
        uint256[] memory grossRewardTokenAmount = new uint256[](_rewardTokens.length);
        // get the accumulated reward tokens from the strategy
        uint256[] memory accumulatedRewardTokenAmount = strategy.getAccumulatedRewardTokenAmounts(
            disableRewardTokenClaim
        );

        // reference for array length to save gas
        uint256 _rewardsLength = _rewardTokens.length;
        // iterate through the reward token array to set the total reward amounts accumulated
        for (uint256 i = 0; i < _rewardsLength; ) {
            // the reward calculation is the sum of the current reward amount the remaining rewards being accumulated in the strategy protocols.
            // the reason being like totalBalance for every player this is updated and prev. value is used to add any left over value
            if (address(_rewardTokens[i]) != address(0) && inboundToken != address(_rewardTokens[i])) {
                grossRewardTokenAmount[i] = _rewardTokenAmounts[i] + accumulatedRewardTokenAmount[i];
            }
            unchecked {
                ++i;
            }
        }
        // gets the grossInterest after updating the game accounting
        uint256 grossInterest = _calculateAndUpdateGameAccounting(totalBalance, grossRewardTokenAmount);

        _calculateAndSetAdminAccounting(grossInterest, grossRewardTokenAmount);
        adminFeeSet = true;
    }

    /// @dev Checks if player is a winner.
    /// @dev this function assumes that the player has already joined the game.
    /// We check if the player is a participant in the pool before using this function.
    /// @return "true" if player is a winner; otherwise, return "false".
    function _isWinner(Player storage _player, uint64 _depositCountMemory) internal view returns (bool) {
        // considers the emergency withdraw scenario too where if a player has paid in that or the previous segment they are considered as a winner
        return
            _player.isWinner ||
            (emergencyWithdraw &&
                (
                    _depositCountMemory == 0
                        ? _player.mostRecentSegmentPaid >= _depositCountMemory
                        : _player.mostRecentSegmentPaid >= (_depositCountMemory - 1)
                ));
    }
    /**
       Returns the maximum amount that can be redeemed from a strategy for a player/admin
     */
    function getRedemptionValue(uint256 _amountToRedeem, uint256 _totalAmount) internal returns(uint256) {
        if (_amountToRedeem > _totalAmount) {
            return _totalAmount;
        }
        return _amountToRedeem;
    }

    //*********************************************************************//
    // ------------------------- external/public methods -------------------------- //
    //*********************************************************************//

    /**
    @dev Enable early game completion in case of a emergency like the strategy contract becomes inactive in the midddle of the game etc.
    // Once enabled players can withdraw their funds along with interest for winners.
    */
    function enableEmergencyWithdraw() external onlyOwner whenGameIsNotCompleted {
        if (totalGamePrincipal == 0) {
            revert EARLY_EXIT_NOT_POSSIBLE();
        }
        uint64 currentSegment = getCurrentSegment();
        // UPDATE - N2 Audit Report
        // updates the winner count based on the segment counter
        winnerCount = currentSegment != 0
            ? uint64(segmentCounter[currentSegment] + segmentCounter[currentSegment - 1])
            : uint64(segmentCounter[currentSegment]);

        emergencyWithdraw = true;
        // updates the interest shhare % for the deposit round
        _updateInterestShares(currentSegment);
        // setting depositCount as current segment to manage all scenario's to handle emergency withdraw
        depositCount = currentSegment;

        emit EmergencyWithdrawalEnabled(currentSegment, winnerCount, depositRoundInterestSharePercentage);
    }

    /**
    @dev Set's the incentive token address.
    @param _incentiveToken Incentive token address
    */
    function setIncentiveToken(IERC20 _incentiveToken) public onlyOwner whenGameIsNotCompleted {
        // incentiveToken can only be set once, so we check if it has already been set if not then we check the inbound token is same as incentive token
        if (
            (address(incentiveToken) != address(0)) ||
            (inboundToken != address(0) && inboundToken == address(_incentiveToken))
        ) {
            revert INVALID_INCENTIVE_TOKEN();
        }
        // incentiveToken cannot be the same as one of the reward tokens.
        IERC20[] memory _rewardTokens = rewardTokens;

        // reference for array length to save gas
        uint256 _rewardsLength = _rewardTokens.length;
        for (uint256 i = 0; i < _rewardsLength; ) {
            if ((address(_rewardTokens[i]) != address(0) && address(_rewardTokens[i]) == address(_incentiveToken))) {
                revert INVALID_INCENTIVE_TOKEN();
            }
            unchecked {
                ++i;
            }
        }
        incentiveToken = _incentiveToken;
        emit IncentiveTokenSet(address(_incentiveToken));
    }

    /**
    @dev Disable claiming reward tokens for emergency scenarios, like when external reward contracts become
        inactive or rewards funds aren't available, allowing users to withdraw principal + interest from contract.
    */
    function disableClaimingRewardTokens() external onlyOwner whenGameIsNotCompleted {
        disableRewardTokenClaim = true;
        emit ClaimRewardTokensDisabled(getCurrentSegment());
    }

    /// @dev pauses the game. This function can be called only by the contract's admin.
    function pause() external onlyOwner whenNotPaused {
        _pause();
    }

    /// @dev unpauses the game. This function can be called only by the contract's admin.
    function unpause() external onlyOwner whenPaused {
        _unpause();
    }

    /// @dev Unlocks renounceOwnership.
    function unlockRenounceOwnership() external onlyOwner {
        allowRenouncingOwnership = true;
    }

    /// @dev Renounces Ownership.
    function renounceOwnership() public override onlyOwner {
        if (!allowRenouncingOwnership) {
            revert RENOUNCE_OWNERSHIP_NOT_ALLOWED();
        }
        super.renounceOwnership();
    }

    /**
    @dev Allows admin to set a lower early withdrawal fee.
    @param _newEarlyWithdrawFee New earlywithdrawal fee.
    */
    function lowerEarlyWithdrawFee(uint64 _newEarlyWithdrawFee) external virtual onlyOwner {
        uint64 currentFee = earlyWithdrawalFee;
        if (_newEarlyWithdrawFee >= currentFee) {
            revert INVALID_EARLY_WITHDRAW_FEE();
        }
        earlyWithdrawalFee = _newEarlyWithdrawFee;
        emit EarlyWithdrawalFeeChanged(
            getCurrentSegment(),
            currentFee,
            _newEarlyWithdrawFee
        );
    }

    /// @dev Allows the admin to withdraw the performance fee, if applicable. This function can be called only by the contract's admin.
    /// Cannot be called before the game ends.
    /// @param _minAmount Slippage based amount to cover for impermanent loss scenario.
    function adminFeeWithdraw(uint256 _minAmount) external virtual onlyOwner whenGameIsCompleted {
        if (adminWithdraw) {
            revert ADMIN_FEE_WITHDRAWN();
        }
        adminWithdraw = true;

        // UPDATE - C2 Audit Report - removing redeem method
        _setGlobalPoolParams();
        // to avoid SLOAD multiple times
        // UPDATE - A5 Audit Report
        uint256[] memory _adminFeeAmount = adminFeeAmount;
        IERC20[] memory _rewardTokens = rewardTokens;

        // flag that indicates if there are any rewards claimable by the admin
        bool _claimableRewards = _checkRewardsClaimableByAdmin(_adminFeeAmount);

        // have to check for both since the rewards, interest accumulated along with the total deposit is withdrawn in a single redeem call
        if (_adminFeeAmount[0] != 0 || _claimableRewards) {
            // safety check in case some incentives in the form of the deposit tokens are transferred to the pool
            uint256 _amountToRedeem = getRedemptionValue(_adminFeeAmount[0], strategy.getTotalAmount());
            strategy.redeem(inboundToken, _amountToRedeem, _minAmount, disableRewardTokenClaim);

            // need the updated value for the event
            // balance check before transferring the funds
            _adminFeeAmount[0] = _transferFundsSafelyOrFail(owner(), _adminFeeAmount[0]);

            if (_claimableRewards) {
                // reference for array length to save gas
                uint256 _rewardsLength = _rewardTokens.length;
                for (uint256 i = 0; i < _rewardsLength; ) {
                    if (address(_rewardTokens[i]) != address(0)) {
                        // updates variable value to make sure on a failure, event is emitted w/ correct value.
                        // first slot is reserved for admin interest amount, so starts at 1.
                        _adminFeeAmount[i + 1] = _transferTokenOrContinueOnFailure(
                            address(_rewardTokens[i]),
                            owner(),
                            _adminFeeAmount[i + 1]
                        );
                    }
                    unchecked {
                        ++i;
                    }
                }
            }
        }

        uint256 _adminIncentiveAmount;
        // winnerCount will always have the correct number of winners fetched from segment counter if emergency withdraw is enabled.
        // UPDATE - N2 Audit Report
        if (winnerCount == 0) {
            if (totalIncentiveAmount != 0) {
                // updates variable value to make sure on a failure, event is emitted w/ correct value.
                // UPDATE - N1 Audit Report
                _adminIncentiveAmount = _transferTokenOrContinueOnFailure(
                    address(incentiveToken),
                    owner(),
                    totalIncentiveAmount
                );
            }
        }

        // emitting it here since to avoid duplication made the if block common for incentive and reward tokens
        emit AdminWithdrawal(owner(), totalGameInterest, _adminIncentiveAmount, _adminFeeAmount);
    }

    /**
    @dev Allows a player to join the game/pool by makking the first deposit.
    @param _minAmount Slippage based amount to cover for impermanent loss scenario.
    @param _depositAmount Variable Deposit Amount in case of a variable deposit pool.
    */
    function joinGame(uint256 _minAmount, uint256 _depositAmount)
        external
        payable
        virtual
        whenGameIsInitialized
        whenNotPaused
        whenGameIsNotCompleted
        nonReentrant
    {
        _joinGame(_minAmount, _depositAmount);
    }

    /**
    @dev Allows a player to withdraw funds before the game ends. An early withdrawal fee is charged.
    @param _minAmount Slippage based amount to cover for impermanent loss scenario in case of a amm strategy like curve or mobius.
    */
    // UPDATE - L1 Audit Report
    function earlyWithdraw(uint256 _minAmount) external whenNotPaused whenGameIsNotCompleted nonReentrant {
        Player storage player = players[msg.sender];
        if (player.amountPaid == 0) {
            revert PLAYER_DOES_NOT_EXIST();
        }
        if (player.withdrawn) {
            revert PLAYER_ALREADY_WITHDREW_EARLY();
        }
        player.withdrawn = true;
        activePlayersCount -= 1;

        // In an early withdraw, users get their principal minus the earlyWithdrawalFee % defined in the constructor & it also considers the impermanent loss.
        uint256 _totalBalance = isTransactionalToken
            ? address(this).balance + strategy.getTotalAmount()
            : IERC20(inboundToken).balanceOf(address(this)) + strategy.getTotalAmount();
        
        uint256 withdrawAmount = player.netAmountPaid - ((player.netAmountPaid * earlyWithdrawalFee) / 100);
        if (_totalBalance < netTotalGamePrincipal) {
            // handling impermanent loss case
            uint256 _impermanentLossShare = (_totalBalance * 100) / netTotalGamePrincipal;
            withdrawAmount = (withdrawAmount * _impermanentLossShare) / 100;
        }

        // Decreases the totalGamePrincipal & netTotalGamePrincipal on earlyWithdraw
        totalGamePrincipal -= player.amountPaid;
        netTotalGamePrincipal -= player.netAmountPaid;

        uint64 currentSegment = getCurrentSegment();
        player.withdrawalSegment = currentSegment;

        uint256 playerIndexSum;
        // calculate playerIndexSum for each player
        for (uint256 i = 0; i <= player.mostRecentSegmentPaid; ) {
            playerIndexSum += playerIndex[msg.sender][i];
            unchecked {
                ++i;
            }
        }
        // Users that early withdraw during the first segment, are allowed to rejoin.
        if (currentSegment == 0) {
            player.canRejoin = true;
            playerIndex[msg.sender][currentSegment] = 0;
        }

        // FIX - C3 Audit Report
        // reduce the cumulativePlayerIndexSum for the segment where the player doing the early withdraw deposited last
        // cumulativePlayerIndexSum has the value of the player index sums for all player till the current segment.
        cumulativePlayerIndexSum[player.mostRecentSegmentPaid] -= playerIndexSum;
        // reduce the totalWinnerDepositsPerSegment for the segment.
        totalWinnerDepositsPerSegment[player.mostRecentSegmentPaid] -= player.netAmountPaid;

        unchecked {
            // update winner count
            if (winnerCount != 0 && player.isWinner) {
                winnerCount -= 1;
                player.isWinner = false;
            }

            // segment counter calculation needed for ui as backup in case graph goes down
            if (segmentCounter[currentSegment] != 0) {
                segmentCounter[currentSegment] -= 1;
            }
        }

        strategy.earlyWithdraw(inboundToken, withdrawAmount, _minAmount);

        // balance check before transferring the funds
        uint256 actualTransferredAmount = _transferFundsSafelyOrFail(msg.sender, withdrawAmount);

        // We have to ignore the "check-effects-interactions" pattern here and emit the event
        // only at the end of the function, in order to emit it w/ the correct withdrawal amount.
        // In case the safety checks above are evaluated to true, withdrawAmount is updated,
        // so we need the event to be emitted with the correct info.
        emit EarlyWithdrawal(msg.sender, actualTransferredAmount, totalGamePrincipal, netTotalGamePrincipal);
    }

    /**
    @dev Allows player to withdraw their funds after the game ends with no loss (fee). Winners get a share of the interest earned & additional rewards based on the player index.
    @param _minAmount Slippage based amount to cover for impermanent loss scenario in case of a amm strategy like curve or mobius.
    */
    // UPDATE - L1 Audit Report
    function withdraw(uint256 _minAmount) external virtual nonReentrant {
        Player storage player = players[msg.sender];
        if (player.amountPaid == 0) {
            revert PLAYER_DOES_NOT_EXIST();
        }
        if (player.withdrawn) {
            revert PLAYER_ALREADY_WITHDREW();
        }
        player.withdrawn = true;

        // UPDATE - C2 Audit Report - removing redeem method
        _setGlobalPoolParams();

        // to avoid SLOAD multiple times
        uint64 depositCountMemory = depositCount;
        uint256 _impermanentLossShare = impermanentLossShare;

        uint256 payout;

        if (_isWinner(player, depositCountMemory)) {
            // determining last game segment considering the possibility of emergencyWithdraw
            uint64 segment = depositCountMemory == 0 ? 0 : uint64(depositCountMemory - 1);
            (
                uint256 playerIndexSharePercentage,
                uint256 playerDepositAmountSharePercentage,
                uint256 _payout
            ) = _calculateAndUpdateWinnerInterestAccounting(segment, _impermanentLossShare);
            payout = _payout;
            // safety check in case some incentives in the form of the deposit tokens are transferred to the pool\
            uint256 _amountToRedeem = getRedemptionValue(payout, strategy.getTotalAmount());

            strategy.redeem(inboundToken, _amountToRedeem, _minAmount, disableRewardTokenClaim);

            // calculating winners share of the incentive amount
            _calculateAndUpdateWinnerIncentivesAccounting(
                playerDepositAmountSharePercentage,
                playerIndexSharePercentage
            );

            // calculating winners share of the reward earned from the external protocol deposits/no_strategy
            _calculateAndUpdateWinnerRewardAccounting(playerDepositAmountSharePercentage, playerIndexSharePercentage);

        } else {
            payout = _calculateAndUpdateNonWinnerAccounting(_impermanentLossShare, player.netAmountPaid);
            // safety check in case some incentives in the form of the deposit tokens are transferred to the pool
            uint256 _amountToRedeem = getRedemptionValue(payout, strategy.getTotalAmount());
            // Withdraws the principal for non-winners
            strategy.redeem(inboundToken, _amountToRedeem, _minAmount, disableRewardTokenClaim);
        }

        // sets withdrawalSegment for the player
        player.withdrawalSegment = getCurrentSegment();
        if (_impermanentLossShare != 0) {
            // resetting I.Loss Share % after every withdrawal to be consistent
            impermanentLossShare = 0;
        }

        // Updating total principal as well after each player withdraws this is separate since we have to do this for non-players
        if (netTotalGamePrincipal < player.netAmountPaid) {
            netTotalGamePrincipal = 0;
            totalGamePrincipal = 0;
        } else {
            netTotalGamePrincipal -= player.netAmountPaid;
            totalGamePrincipal -= player.amountPaid;
        }

        // sending the inbound token amount i.e principal + interest to the winners and just the principal in case of players
        // adding a balance safety check to ensure the tx does not revert in case of impermanent loss
        uint256 actualTransferredAmount = _transferFundsSafelyOrFail(msg.sender, payout);

        // We have to ignore the "check-effects-interactions" pattern here and emit the event
        // only at the end of the function, in order to emit it w/ the correct withdrawal amount.
        // In case the safety checks above are evaluated to true, payout, playerIncentive and playerReward
        // are updated, so we need the event to be emitted with the correct info.
        emit WithdrawInboundTokens(msg.sender, actualTransferredAmount);

        emit UpdateGameStats(
            msg.sender,
            isTransactionalToken
            ? address(this).balance
            : IERC20(inboundToken).balanceOf(address(this)),
            totalGamePrincipal,
            netTotalGamePrincipal,
            totalGameInterest,
            totalIncentiveAmount,
            rewardTokenAmounts,
            impermanentLossShare
        );
    }

    /**
    @dev Allows players to make deposits for the game segments, after joining the game.
    @param _minAmount Slippage based amount to cover for impermanent loss scenario.
    @param _depositAmount Variable Deposit Amount in case of a variable deposit pool.
    */
    function makeDeposit(uint256 _minAmount, uint256 _depositAmount) external payable whenNotPaused nonReentrant {
        if (players[msg.sender].withdrawn) {
            revert PLAYER_ALREADY_WITHDREW_EARLY();
        }
        // only registered players can deposit
        if (players[msg.sender].addr != msg.sender) {
            revert NOT_PLAYER();
        }
        if (flexibleSegmentPayment) {
            if (_depositAmount != players[msg.sender].depositAmount) {
                revert INVALID_FLEXIBLE_AMOUNT();
            }
        }
        uint256 currentSegment = getCurrentSegment();
        // User can only deposit between segment 1 and segment n-1 (where n is the number of segments for the game) or if the emergencyWithdraw flag has not been enabled.
        // Details:
        // Segment 0 is paid when user joins the game (the first deposit window).
        // Last segment doesn't accept payments, because the payment window for the last
        // segment happens on segment n-1 (penultimate segment).
        // Any segment greater than the last segment means the game is completed, and cannot
        // receive payments
        if (currentSegment == 0 || currentSegment >= depositCount || emergencyWithdraw) {
            revert DEPOSIT_NOT_ALLOWED();
        }

        //check if current segment is currently unpaid
        if (players[msg.sender].mostRecentSegmentPaid == currentSegment) {
            revert PLAYER_ALREADY_PAID_IN_CURRENT_SEGMENT();
        }

        // check if player has made payments up to the previous segment
        if (players[msg.sender].mostRecentSegmentPaid != (currentSegment - 1)) {
            revert PLAYER_DID_NOT_PAID_PREVIOUS_SEGMENT();
        }

        uint256 amount = flexibleSegmentPayment ? _depositAmount : segmentPayment;
        if (isTransactionalToken) {
            if (msg.value != amount) {
                revert INVALID_TRANSACTIONAL_TOKEN_AMOUNT();
            }
        } else {
            if (msg.value != 0) {
                revert INVALID_TRANSACTIONAL_TOKEN_AMOUNT();
            }
        }

        // get net deposit amount from the strategy
        uint256 netAmount = strategy.getNetDepositAmount(amount);
        if (netAmount == 0) {
            revert INVALID_NET_DEPOSIT_AMOUNT();
        }
        emit Deposit(msg.sender, currentSegment, amount, netAmount);
        _transferInboundTokenToContract(_minAmount, amount, netAmount);
    }

    // Fallback Functions for calldata and reciever for handling only ether transfer
    // UPDATE - A7 Audit Report
    receive() external payable {
        if (msg.sender != address(strategy)) {
            revert INVALID_TRANSACTIONAL_TOKEN_SENDER();
        }
        if (!isTransactionalToken) {
            revert INVALID_TRANSACTIONAL_TOKEN_AMOUNT();
        }
    }
}

File 2 of 7 : IStrategy.sol
pragma solidity 0.8.7;

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

interface IStrategy {
    function invest(address _inboundCurrency, uint256 _minAmount) external payable;

    function earlyWithdraw(
        address _inboundCurrency,
        uint256 _amount,
        uint256 _minAmount
    ) external;

    function redeem(
        address _inboundCurrency,
        uint256 _amount,
        uint256 _minAmount,
        bool disableRewardTokenClaim
    ) external;

    function getTotalAmount() external view returns (uint256);

    function getLPTokenAmount(uint256 _amount) external view returns (uint256);
    
    function getFee() external view returns (uint256);

    function getNetDepositAmount(uint256 _amount) external view returns (uint256);

    function getAccumulatedRewardTokenAmounts(bool disableRewardTokenClaim) external returns (uint256[] memory);

    function getRewardTokens() external view returns (IERC20[] memory);

    function getUnderlyingAsset() external view returns (address);

    function strategyOwner() external view returns (address);
}

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

pragma solidity ^0.8.0;

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

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

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

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

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

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

        _;

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

File 6 of 7 : Pausable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)

pragma solidity ^0.8.0;

import "../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 {
    /**
     * @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);

    bool private _paused;

    /**
     * @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 {
        require(!paused(), "Pausable: paused");
    }

    /**
     * @dev Throws if the contract is not paused.
     */
    function _requirePaused() internal view virtual {
        require(paused(), "Pausable: not paused");
    }

    /**
     * @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 7 of 7 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)

pragma solidity ^0.8.0;

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

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

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

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _transferOwnership(_msgSender());
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

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

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

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

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

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

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_inboundCurrency","type":"address"},{"internalType":"uint256","name":"_maxFlexibleSegmentPaymentAmount","type":"uint256"},{"internalType":"uint64","name":"_depositCount","type":"uint64"},{"internalType":"uint64","name":"_segmentLength","type":"uint64"},{"internalType":"uint64","name":"_waitingRoundSegmentLength","type":"uint64"},{"internalType":"uint256","name":"_segmentPayment","type":"uint256"},{"internalType":"uint64","name":"_earlyWithdrawalFee","type":"uint64"},{"internalType":"uint64","name":"_customFee","type":"uint64"},{"internalType":"uint64","name":"_maxPlayersCount","type":"uint64"},{"internalType":"bool","name":"_flexibleSegmentPayment","type":"bool"},{"internalType":"contract IStrategy","name":"_strategy","type":"address"},{"internalType":"bool","name":"_isTransactionalToken","type":"bool"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ADMIN_FEE_WITHDRAWN","type":"error"},{"inputs":[],"name":"DEPOSIT_NOT_ALLOWED","type":"error"},{"inputs":[],"name":"EARLY_EXIT_NOT_POSSIBLE","type":"error"},{"inputs":[],"name":"GAME_ALREADY_INITIALIZED","type":"error"},{"inputs":[],"name":"GAME_ALREADY_STARTED","type":"error"},{"inputs":[],"name":"GAME_COMPLETED","type":"error"},{"inputs":[],"name":"GAME_NOT_COMPLETED","type":"error"},{"inputs":[],"name":"GAME_NOT_INITIALIZED","type":"error"},{"inputs":[],"name":"INVALID_CUSTOM_FEE","type":"error"},{"inputs":[],"name":"INVALID_DEPOSIT_COUNT","type":"error"},{"inputs":[],"name":"INVALID_EARLY_WITHDRAW_FEE","type":"error"},{"inputs":[],"name":"INVALID_FLEXIBLE_AMOUNT","type":"error"},{"inputs":[],"name":"INVALID_INBOUND_TOKEN","type":"error"},{"inputs":[],"name":"INVALID_INCENTIVE_TOKEN","type":"error"},{"inputs":[],"name":"INVALID_MAX_FLEXIBLE_AMOUNT","type":"error"},{"inputs":[],"name":"INVALID_MAX_PLAYER_COUNT","type":"error"},{"inputs":[],"name":"INVALID_NET_DEPOSIT_AMOUNT","type":"error"},{"inputs":[],"name":"INVALID_OWNER","type":"error"},{"inputs":[],"name":"INVALID_SEGMENT_LENGTH","type":"error"},{"inputs":[],"name":"INVALID_SEGMENT_PAYMENT","type":"error"},{"inputs":[],"name":"INVALID_STRATEGY","type":"error"},{"inputs":[],"name":"INVALID_TRANSACTIONAL_TOKEN_AMOUNT","type":"error"},{"inputs":[],"name":"INVALID_TRANSACTIONAL_TOKEN_SENDER","type":"error"},{"inputs":[],"name":"INVALID_WAITING_ROUND_SEGMENT_LENGTH","type":"error"},{"inputs":[],"name":"MAX_PLAYER_COUNT_REACHED","type":"error"},{"inputs":[],"name":"NOT_PLAYER","type":"error"},{"inputs":[],"name":"PLAYER_ALREADY_JOINED","type":"error"},{"inputs":[],"name":"PLAYER_ALREADY_PAID_IN_CURRENT_SEGMENT","type":"error"},{"inputs":[],"name":"PLAYER_ALREADY_WITHDREW","type":"error"},{"inputs":[],"name":"PLAYER_ALREADY_WITHDREW_EARLY","type":"error"},{"inputs":[],"name":"PLAYER_DID_NOT_PAID_PREVIOUS_SEGMENT","type":"error"},{"inputs":[],"name":"PLAYER_DOES_NOT_EXIST","type":"error"},{"inputs":[],"name":"RENOUNCE_OWNERSHIP_NOT_ALLOWED","type":"error"},{"inputs":[],"name":"TOKEN_TRANSFER_FAILURE","type":"error"},{"inputs":[],"name":"TRANSACTIONAL_TOKEN_TRANSFER_FAILURE","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256[]","name":"adminFeeAmounts","type":"uint256[]"}],"name":"AdminFee","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"admin","type":"address"},{"indexed":false,"internalType":"uint256","name":"totalGameInterest","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"adminIncentiveAmount","type":"uint256"},{"indexed":false,"internalType":"uint256[]","name":"adminFeeAmounts","type":"uint256[]"}],"name":"AdminWithdrawal","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint64","name":"currentSegment","type":"uint64"}],"name":"ClaimRewardTokensDisabled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"player","type":"address"},{"indexed":true,"internalType":"uint256","name":"segment","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"netAmount","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"player","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalGamePrincipal","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"netTotalGamePrincipal","type":"uint256"}],"name":"EarlyWithdrawal","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint64","name":"currentSegment","type":"uint64"},{"indexed":false,"internalType":"uint64","name":"oldFee","type":"uint64"},{"indexed":false,"internalType":"uint64","name":"newFee","type":"uint64"}],"name":"EarlyWithdrawalFeeChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint64","name":"currentSegment","type":"uint64"},{"indexed":false,"internalType":"uint64","name":"winnerCount","type":"uint64"},{"indexed":false,"internalType":"uint64","name":"depositRoundInterestSharePercentage","type":"uint64"}],"name":"EmergencyWithdrawalEnabled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"player","type":"address"},{"indexed":false,"internalType":"uint256","name":"totalBalance","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalGamePrincipal","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"netTotalGamePricipal","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalGameInterest","type":"uint256"},{"indexed":false,"internalType":"uint256[]","name":"grossRewardTokenAmount","type":"uint256[]"},{"indexed":false,"internalType":"uint256","name":"totalIncentiveAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"impermanentLossShare","type":"uint256"}],"name":"EndGameStats","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"bytes","name":"reason","type":"bytes"}],"name":"ExternalTokenGetBalanceError","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"bytes","name":"reason","type":"bytes"}],"name":"ExternalTokenTransferError","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","type":"address"}],"name":"IncentiveTokenSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint64","name":"firstSegmentStart","type":"uint64"},{"indexed":false,"internalType":"uint64","name":"waitingRoundSegmentStart","type":"uint64"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"player","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"netAmount","type":"uint256"}],"name":"JoinedGame","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":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"player","type":"address"},{"indexed":false,"internalType":"uint256","name":"totalBalance","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalGamePrincipal","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"netTotalGamePrincipal","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalGameInterest","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalIncentiveAmount","type":"uint256"},{"indexed":false,"internalType":"uint256[]","name":"totalRewardAmounts","type":"uint256[]"},{"indexed":false,"internalType":"uint256","name":"impermanentLossShare","type":"uint256"}],"name":"UpdateGameStats","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"player","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"WithdrawInboundTokens","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"player","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"WithdrawIncentiveToken","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"player","type":"address"},{"indexed":false,"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"name":"WithdrawRewardTokens","type":"event"},{"inputs":[],"name":"MULTIPLIER","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"activePlayersCount","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"adminFee","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"adminFeeAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"adminFeeSet","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_minAmount","type":"uint256"}],"name":"adminFeeWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"adminWithdraw","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"allowRenouncingOwnership","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"cumulativePlayerIndexSum","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"depositCount","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"depositRoundInterestSharePercentage","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"disableClaimingRewardTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"disableRewardTokenClaim","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_minAmount","type":"uint256"}],"name":"earlyWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"earlyWithdrawalFee","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"emergencyWithdraw","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"enableEmergencyWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"firstSegmentStart","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"flexibleSegmentPayment","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCurrentSegment","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getNumberOfPlayers","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"impermanentLossShare","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"inboundToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"incentiveToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"_incentiveToken","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"isGameCompleted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isInitialized","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isTransactionalToken","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_player","type":"address"}],"name":"isWinner","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"iterablePlayers","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_minAmount","type":"uint256"},{"internalType":"uint256","name":"_depositAmount","type":"uint256"}],"name":"joinGame","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint64","name":"_newEarlyWithdrawFee","type":"uint64"}],"name":"lowerEarlyWithdrawFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_minAmount","type":"uint256"},{"internalType":"uint256","name":"_depositAmount","type":"uint256"}],"name":"makeDeposit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"maxFlexibleSegmentPaymentAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxPlayersCount","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"netTotalGamePrincipal","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":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"playerIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"players","outputs":[{"internalType":"bool","name":"withdrawn","type":"bool"},{"internalType":"bool","name":"canRejoin","type":"bool"},{"internalType":"bool","name":"isWinner","type":"bool"},{"internalType":"address","name":"addr","type":"address"},{"internalType":"uint64","name":"withdrawalSegment","type":"uint64"},{"internalType":"uint64","name":"mostRecentSegmentPaid","type":"uint64"},{"internalType":"uint256","name":"amountPaid","type":"uint256"},{"internalType":"uint256","name":"netAmountPaid","type":"uint256"},{"internalType":"uint256","name":"depositAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"rewardTokenAmounts","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"rewardTokens","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"segmentCounter","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"segmentLength","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"segmentPayment","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"_incentiveToken","type":"address"}],"name":"setIncentiveToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"strategy","outputs":[{"internalType":"contract IStrategy","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalGameInterest","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalGamePrincipal","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalIncentiveAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"totalWinnerDepositsPerSegment","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unlockRenounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"waitingRoundSegmentLength","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"waitingRoundSegmentStart","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"winnerCount","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_minAmount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]

Deployed Bytecode

0x60806040526004361061039b5760003560e01c80638456cb59116101dc578063c4d66de811610102578063e2eb41ff116100a0578063f2fde38b1161006f578063f2fde38b14610cc4578063f4ceab1c14610ce4578063f5c9786714610cf9578063fd6673f514610d0e57600080fd5b8063e2eb41ff14610b7b578063e843633614610c5d578063ebca4eeb14610c84578063f18d20be14610ca357600080fd5b8063caa02e08116100dc578063caa02e0814610ad2578063d013666e14610af9578063db2e21bc14610b2d578063dbe3cbe514610b4757600080fd5b8063c4d66de814610a5a578063c68e0a0414610a7a578063ca920b9814610ab257600080fd5b8063a8c62e761161017a578063b6e4ca0811610149578063b6e4ca08146109db578063c00a8662146109fb578063c22b5bbd14610a11578063c39b583c14610a4557600080fd5b8063a8c62e761461095f578063aad739f514610988578063ae545311146109a8578063b60b9fcb146109c857600080fd5b806395224b33116101b657806395224b33146108ce5780639d9ca28d146108e45780639f60d9a114610904578063a0be06f91461092b57600080fd5b80638456cb591461086e578063872a61f2146108835780638da5cb5b146108b057600080fd5b80634281b1fb116102c15780636b5b96961161025f5780637bb7bed11161022e5780637bb7bed1146107cb5780637c80e6da146107eb5780637e5f84761461081f5780638014c1131461084157600080fd5b80636b5b9696146107495780636e8108a1146107695780636fc3f8f614610796578063715018a6146107b657600080fd5b80635c975abb1161029b5780635c975abb146106de5780635faeea37146106fd578063638126f8146107135780636a79328a1461073357600080fd5b80634281b1fb1461065d57806349761947146106a9578063537788fd146106be57600080fd5b8063250a2b0d11610339578063392e53cd11610308578063392e53cd146105e95780633e7433eb146106155780633f0f4076146106355780633f4ba83a1461064857600080fd5b8063250a2b0d1461056d5780632dfdf0b51461058d5780632e1a7d4d146105b457806336301533146105d457600080fd5b80630c423f32116103755780630c423f32146104b05780630c8ac645146104fc5780630f1e37ea1461053057806316330d401461054657600080fd5b8063059f8b161461043257806306c6e5361461045c578063088e0ed11461049057600080fd5b3661042d57600b546501000000000090046001600160a01b031633146103ed576040517f0b94abda00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f000000000000000000000000000000000000000000000000000000000000000061042b5760405163e1f0844960e01b815260040160405180910390fd5b005b600080fd5b34801561043e57600080fd5b50610449620f424081565b6040519081526020015b60405180910390f35b34801561046857600080fd5b506104497f000000000000000000000000000000000000000000000000000000000000000081565b34801561049c57600080fd5b506104496104ab36600461583b565b610d23565b3480156104bc57600080fd5b506104e47f000000000000000000000000000000000000000000000000000000000024ea0081565b6040516001600160401b039091168152602001610453565b34801561050857600080fd5b506104497f000000000000000000000000000000000000000000000001158e460913d0000081565b34801561053c57600080fd5b5061044960095481565b34801561055257600080fd5b506002546104e490600160c01b90046001600160401b031681565b34801561057957600080fd5b506003546104e4906001600160401b031681565b34801561059957600080fd5b506002546104e490600160801b90046001600160401b031681565b3480156105c057600080fd5b5061042b6105cf36600461583b565b610d44565b3480156105e057600080fd5b5061042b6112f6565b3480156105f557600080fd5b506002546001600160401b031615155b6040519015158152602001610453565b34801561062157600080fd5b506002546104e4906001600160401b031681565b61042b61064336600461586d565b6114bd565b34801561065457600080fd5b5061042b6118dc565b34801561066957600080fd5b506106917f0000000000000000000000008f3cf7ad23cd3cadbd9735aff958023239c6a06381565b6040516001600160a01b039091168152602001610453565b3480156106b557600080fd5b5061042b6118f6565b3480156106ca57600080fd5b50600b546106059062010000900460ff1681565b3480156106ea57600080fd5b50600054600160a01b900460ff16610605565b34801561070957600080fd5b5061044960065481565b34801561071f57600080fd5b50600c54610691906001600160a01b031681565b34801561073f57600080fd5b5061044960085481565b34801561075557600080fd5b5061042b61076436600461583b565b61197c565b34801561077557600080fd5b5061044961078436600461583b565b60116020526000908152604090205481565b3480156107a257600080fd5b506104496107b136600461583b565b612041565b3480156107c257600080fd5b5061042b612051565b3480156107d757600080fd5b506106916107e636600461583b565b6120a5565b3480156107f757600080fd5b506104e47f000000000000000000000000000000000000000000000000000000000000138881565b34801561082b57600080fd5b50600b5461060590640100000000900460ff1681565b34801561084d57600080fd5b5061044961085c36600461583b565b60106020526000908152604090205481565b34801561087a57600080fd5b5061042b6120cf565b34801561088f57600080fd5b5061044961089e36600461583b565b60126020526000908152604090205481565b3480156108bc57600080fd5b506000546001600160a01b0316610691565b3480156108da57600080fd5b5061044960045481565b3480156108f057600080fd5b506106056108ff3660046156ef565b6120e7565b34801561091057600080fd5b506003546104e490600160801b90046001600160401b031681565b34801561093757600080fd5b506104e47f000000000000000000000000000000000000000000000000000000000000000581565b34801561096b57600080fd5b50600b54610691906501000000000090046001600160a01b031681565b34801561099457600080fd5b506106916109a336600461583b565b61214a565b3480156109b457600080fd5b5061042b6109c33660046156ef565b61215a565b61042b6109d636600461586d565b612381565b3480156109e757600080fd5b5061042b6109f636600461583b565b612442565b348015610a0757600080fd5b5061044960055481565b348015610a1d57600080fd5b506106057f000000000000000000000000000000000000000000000000000000000000000081565b348015610a5157600080fd5b506106056128a3565b348015610a6657600080fd5b5061042b610a753660046156ef565b6128dd565b348015610a8657600080fd5b50610449610a95366004615729565b600f60209081526000928352604080842090915290825290205481565b348015610abe57600080fd5b5061042b610acd36600461588f565b612aed565b348015610ade57600080fd5b506003546104e490600160401b90046001600160401b031681565b348015610b0557600080fd5b506104e47f000000000000000000000000000000000000000000000000000000000024ea0081565b348015610b3957600080fd5b50600b546106059060ff1681565b348015610b5357600080fd5b506106057f000000000000000000000000000000000000000000000000000000000000000081565b348015610b8757600080fd5b50610c00610b963660046156ef565b600e602052600090815260409020805460018201546002830154600384015460049094015460ff80851695610100860482169562010000810490921694630100000083046001600160a01b031694600160b81b9093046001600160401b0390811694911692919089565b604080519915158a5297151560208a0152951515968801969096526001600160a01b0390931660608701526001600160401b0391821660808701521660a085015260c084015260e083019190915261010082015261012001610453565b348015610c6957600080fd5b506002546104e490600160401b90046001600160401b031681565b348015610c9057600080fd5b50600b5461060590610100900460ff1681565b348015610caf57600080fd5b50600b54610605906301000000900460ff1681565b348015610cd057600080fd5b5061042b610cdf3660046156ef565b612bce565b348015610cf057600080fd5b5061042b612c5e565b348015610d0557600080fd5b506104e4612c7d565b348015610d1a57600080fd5b50601354610449565b600a8181548110610d3357600080fd5b600091825260209091200154905081565b60026001541415610d9c5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064015b60405180910390fd5b60026001819055336000908152600e6020526040902090810154610dd35760405163c5e3efc560e01b815260040160405180910390fd5b805460ff1615610e0f576040517f8de46efc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b805460ff19166001178155610e22612dec565b600254600954600160801b9091046001600160401b0316906000610e4684846132d3565b15610fe25760006001600160401b03841615610e6c57610e67600185615b1b565b610e6f565b60005b90506000806000610e808487613343565b9250925092508094506000610f1a86600b60059054906101000a90046001600160a01b03166001600160a01b03166365ac43416040518163ffffffff1660e01b815260040160206040518083038186803b158015610edd57600080fd5b505afa158015610ef1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f159190615854565b6135f8565b600b546040516365e0d73160e01b81526001600160a01b037f0000000000000000000000008f3cf7ad23cd3cadbd9735aff958023239c6a0638116600483015260248201849052604482018e905262010000830460ff161515606483015292935065010000000000909104909116906365e0d73190608401600060405180830381600087803b158015610fac57600080fd5b505af1158015610fc0573d6000803e3d6000fd5b50505050610fce8385613610565b610fd8838561373c565b50505050506110f2565b610ff0828560030154613aa4565b9050600061104682600b60059054906101000a90046001600160a01b03166001600160a01b03166365ac43416040518163ffffffff1660e01b815260040160206040518083038186803b158015610edd57600080fd5b600b546040516365e0d73160e01b81526001600160a01b037f0000000000000000000000008f3cf7ad23cd3cadbd9735aff958023239c6a0638116600483015260248201849052604482018a905260ff620100008404161515606483015292935065010000000000909104909116906365e0d73190608401600060405180830381600087803b1580156110d857600080fd5b505af11580156110ec573d6000803e3d6000fd5b50505050505b6110fa612c7d565b84546001600160401b0391909116600160b81b027fff0000000000000000ffffffffffffffffffffffffffffffffffffffffffffff90911617845581156111415760006009555b8360030154600554101561115e5760006005819055600655611196565b8360030154600560008282546111749190615b04565b9091555050600284015460068054600090611190908490615b04565b90915550505b60006111a23383613ba9565b60405181815290915033907faa7d2735c626954bee68a4b13fc5d4947d926e5d80e93302cdb6ab18972577cd9060200160405180910390a2337f2a50b398a66bfcb585c9bcdc7098260605df7cb8a35aff4ced17628b9a00d7ba7f00000000000000000000000000000000000000000000000000000000000000006112bd576040516370a0823160e01b81523060048201527f0000000000000000000000008f3cf7ad23cd3cadbd9735aff958023239c6a0636001600160a01b0316906370a082319060240160206040518083038186803b15801561128057600080fd5b505afa158015611294573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112b89190615854565b6112bf565b475b6006546005546004546008546009546040516112e2969594939291600a91615a0c565b60405180910390a250506001805550505050565b6112fe613e77565b6113066128a3565b15611324576040516302066c1160e61b815260040160405180910390fd5b60065461135d576040517ff585c2c100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000611367612c7d565b90506001600160401b038116611395576001600160401b0381166000908152601060205260409020546113e3565b601060006113a4600184615b1b565b6001600160401b031681526020019081526020016000205460106000836001600160401b03168152602001908152602001600020546113e39190615a51565b600380546001600160401b0392909216600160401b026fffffffffffffffff000000000000000019909216919091179055600b805460ff1916600117905561142a81613ed1565b600280546001600160401b03838116600160801b8181027fffffffffffffffff0000000000000000ffffffffffffffffffffffffffffffff9094169390931790935560035460408051948552600160401b82048316602086015292900416908201527fb6b6b40c75a707f2e02161e4c3a0fedc1b52de156954e15ca2c0cd0cc77e721d906060015b60405180910390a150565b6114c56140cf565b600260015414156115185760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610d93565b6002600155336000908152600e602052604090205460ff161561154e5760405163b3db1d7f60e01b815260040160405180910390fd5b336000818152600e6020526040902054630100000090046001600160a01b0316146115a5576040517f3fa546c300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f0000000000000000000000000000000000000000000000000000000000000000156115fd57336000908152600e602052604090206004015481146115fd57604051637292a14360e11b815260040160405180910390fd5b6000611607612c7d565b6001600160401b031690508015806116315750600254600160801b90046001600160401b03168110155b8061163e5750600b5460ff165b15611675576040517fa406d3cf00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b336000908152600e60205260409020600101546001600160401b03168114156116ca576040517fbdf3e4c500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6116d5600182615b04565b336000908152600e60205260409020600101546001600160401b031614611728576040517f78e1742100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60007f0000000000000000000000000000000000000000000000000000000000000000611775577f000000000000000000000000000000000000000000000001158e460913d00000611777565b825b90507f0000000000000000000000000000000000000000000000000000000000000000156117c4578034146117bf5760405163e1f0844960e01b815260040160405180910390fd5b6117e3565b34156117e35760405163e1f0844960e01b815260040160405180910390fd5b600b546040516365237abb60e01b8152600481018390526000916501000000000090046001600160a01b0316906365237abb9060240160206040518083038186803b15801561183157600080fd5b505afa158015611845573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118699190615854565b90508061188957604051630d2eb29360e41b815260040160405180910390fd5b6040805183815260208101839052849133917f36af321ec8d3c75236829c5317affd40ddb308863a1236d2d277a4025cccee1e910160405180910390a36118d1858383614129565b505060018055505050565b6118e4613e77565b6118ec61461d565b6118f4614676565b565b6118fe613e77565b6119066128a3565b15611924576040516302066c1160e61b815260040160405180910390fd5b600b805462ff00001916620100001790557f58ef3e4ef459813e0b4b35635d3f11015f47a47986df341c25242e98073c0c2961195e612c7d565b6040516001600160401b0390911681526020015b60405180910390a1565b6119846140cf565b61198c6128a3565b156119aa576040516302066c1160e61b815260040160405180910390fd5b600260015414156119fd5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610d93565b60026001819055336000908152600e6020526040902090810154611a345760405163c5e3efc560e01b815260040160405180910390fd5b805460ff1615611a575760405163b3db1d7f60e01b815260040160405180910390fd5b805460ff19166001908117825560038054600090611a7f9084906001600160401b0316615b1b565b92506101000a8154816001600160401b0302191690836001600160401b0316021790555060007f0000000000000000000000000000000000000000000000000000000000000000611bf657600b60059054906101000a90046001600160a01b03166001600160a01b03166365ac43416040518163ffffffff1660e01b815260040160206040518083038186803b158015611b1857600080fd5b505afa158015611b2c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b509190615854565b6040516370a0823160e01b81523060048201527f0000000000000000000000008f3cf7ad23cd3cadbd9735aff958023239c6a0636001600160a01b0316906370a082319060240160206040518083038186803b158015611baf57600080fd5b505afa158015611bc3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611be79190615854565b611bf19190615a51565b611c86565b600b60059054906101000a90046001600160a01b03166001600160a01b03166365ac43416040518163ffffffff1660e01b815260040160206040518083038186803b158015611c4457600080fd5b505afa158015611c58573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c7c9190615854565b611c869047615a51565b905060006064600260189054906101000a90046001600160401b03166001600160401b03168460030154611cba9190615ab6565b611cc49190615a94565b8360030154611cd39190615b04565b9050600554821015611d1657600554600090611cf0846064615ab6565b611cfa9190615a94565b90506064611d088284615ab6565b611d129190615a94565b9150505b826002015460066000828254611d2c9190615b04565b9091555050600383015460058054600090611d48908490615b04565b9091555060009050611d58612c7d565b84547fff0000000000000000ffffffffffffffffffffffffffffffffffffffffffffff16600160b81b6001600160401b0383160217855590506000805b60018601546001600160401b03168111611dd857336000908152600f60209081526040808320848452909152902054611dce9083615a51565b9150600101611d95565b506001600160401b038216611e1957845461ff001916610100178555336000908152600f602090815260408083206001600160401b03861684529091528120555b60018501546001600160401b031660009081526011602052604081208054839290611e45908490615b04565b9091555050600385015460018601546001600160401b031660009081526012602052604081208054909190611e7b908490615b04565b9091555050600354600160401b90046001600160401b031615801590611ea85750845462010000900460ff165b15611eef57600380546000196001600160401b03600160401b80840482169290920116026fffffffffffffffff000000000000000019909116179055845462ff0000191685555b6001600160401b03821660009081526010602052604090205415611f2e576001600160401b038216600090815260106020526040902080546000190190555b600b546040517f4bfd65710000000000000000000000000000000000000000000000000000000081526001600160a01b037f0000000000000000000000008f3cf7ad23cd3cadbd9735aff958023239c6a0638116600483015260248201869052604482018990526501000000000090920490911690634bfd657190606401600060405180830381600087803b158015611fc657600080fd5b505af1158015611fda573d6000803e3d6000fd5b505050506000611fea3385613ba9565b60065460055460408051848152602081019390935282015290915033907fff5f5df32598354b364ecd3ce0b4e70e85b237ec68f8193b3faa422c8ddffd219060600160405180910390a25050600180555050505050565b60078181548110610d3357600080fd5b612059613e77565b600b54640100000000900460ff1661209d576040517f90fd464c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6118f46146e1565b600d81815481106120b557600080fd5b6000918252602090912001546001600160a01b0316905081565b6120d7613e77565b6120df6140cf565b6118f46146f3565b6001600160a01b0381166000908152600e602052604081206002015461210f57506000919050565b6001600160a01b0382166000908152600e602052604090206002546121449190600160801b90046001600160401b03166132d3565b92915050565b601381815481106120b557600080fd5b612162613e77565b61216a6128a3565b15612188576040516302066c1160e61b815260040160405180910390fd5b600c546001600160a01b031615158061220557507f0000000000000000000000008f3cf7ad23cd3cadbd9735aff958023239c6a0636001600160a01b0316158015906122055750806001600160a01b03167f0000000000000000000000008f3cf7ad23cd3cadbd9735aff958023239c6a0636001600160a01b0316145b156122235760405163cd2ac49f60e01b815260040160405180910390fd5b6000600d80548060200260200160405190810160405280929190818152602001828054801561227b57602002820191906000526020600020905b81546001600160a01b0316815260019091019060200180831161225d575b505083519394506000925050505b8181101561231d5760006001600160a01b03168382815181106122ae576122ae615b59565b60200260200101516001600160a01b0316141580156122f75750836001600160a01b03168382815181106122e4576122e4615b59565b60200260200101516001600160a01b0316145b156123155760405163cd2ac49f60e01b815260040160405180910390fd5b600101612289565b50600c805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0385169081179091556040519081527fdfb445dece52cc4e5554970d1ff164cd2eaa0babde21897b763c96655125f3909060200160405180910390a1505050565b6002546001600160401b03166123aa5760405163c4a5ed8960e01b815260040160405180910390fd5b6123b26140cf565b6123ba6128a3565b156123d8576040516302066c1160e61b815260040160405180910390fd5b6002600154141561242b5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610d93565b600260015561243a8282614751565b505060018055565b61244a613e77565b6124526128a3565b61246f57604051630418dd1f60e21b815260040160405180910390fd5b600b546301000000900460ff16156124b3576040517ff788b3bd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600b805463ff000000191663010000001790556124ce612dec565b6000600780548060200260200160405190810160405280929190818152602001828054801561251c57602002820191906000526020600020905b815481526020019060010190808311612508575b505050505090506000600d80548060200260200160405190810160405280929190818152602001828054801561257b57602002820191906000526020600020905b81546001600160a01b0316815260019091019060200180831161255d575b50505050509050600061258d83614c6a565b9050826000815181106125a2576125a2615b59565b602002602001015160001415806125b65750805b156127fb576000612629846000815181106125d3576125d3615b59565b6020026020010151600b60059054906101000a90046001600160a01b03166001600160a01b03166365ac43416040518163ffffffff1660e01b815260040160206040518083038186803b158015610edd57600080fd5b600b546040516365e0d73160e01b81526001600160a01b037f0000000000000000000000008f3cf7ad23cd3cadbd9735aff958023239c6a06381166004830152602482018490526044820189905260ff620100008404161515606483015292935065010000000000909104909116906365e0d73190608401600060405180830381600087803b1580156126bb57600080fd5b505af11580156126cf573d6000803e3d6000fd5b505050506127086126e86000546001600160a01b031690565b856000815181106126fb576126fb615b59565b6020026020010151613ba9565b8460008151811061271b5761271b615b59565b60200260200101818152505081156127f957825160005b818110156127f65760006001600160a01b031685828151811061275757612757615b59565b60200260200101516001600160a01b0316146127ee576127c585828151811061278257612782615b59565b602002602001015161279c6000546001600160a01b031690565b886127a8856001615a51565b815181106127b8576127b8615b59565b6020026020010151614cb7565b866127d1836001615a51565b815181106127e1576127e1615b59565b6020026020010181815250505b600101612732565b50505b505b600354600090600160401b90046001600160401b031661284a576008541561284a57600c54612847906001600160a01b031661283f6000546001600160a01b031690565b600854614cb7565b90505b6000546001600160a01b03166001600160a01b03167f390c89b8a52039f3cc9dc1e4fa212f6b6227a4e37b93dd8455bbe3f092a3a95b6004548387604051612894939291906159a3565b60405180910390a25050505050565b600254600090600160801b90046001600160401b03166128c1612c7d565b6001600160401b031611806128d85750600b5460ff165b905090565b6128e5613e77565b6002546001600160401b031615612928576040517f8cb3c0bd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6129306140cf565b600b54604080517fe3daf456000000000000000000000000000000000000000000000000000000008152905130926501000000000090046001600160a01b03169163e3daf456916004808301926020929190829003018186803b15801561299657600080fd5b505afa1580156129aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129ce919061570c565b6001600160a01b031614612a0e576040517f9d2d273100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600280547f000000000000000000000000000000000000000000000000000000000024ea00600160801b6001600160401b0342811667ffffffffffffffff1985168117929092048116929092028101909116600160401b027fffffffffffffffffffffffffffffffff0000000000000000000000000000000090921617179055612a986000613ed1565b612aa18161215a565b600254604080516001600160401b038084168252600160401b90930490921660208301527f0709318331fb59e779a19041b4e090bf8f8481b96601401c9b6887924248fec991016114b2565b612af5613e77565b6002546001600160401b03600160c01b90910481169082168111612b45576040517fda1be99c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6002805477ffffffffffffffffffffffffffffffffffffffffffffffff16600160c01b6001600160401b038516021790557f21020cbcf9f28164b52dd3fbd0e7dd8219bf982577046ed79c1c44c28a5d07f0612b9f612c7d565b604080516001600160401b03928316815282851660208201529185169082015260600160405180910390a15050565b612bd6613e77565b6001600160a01b038116612c525760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610d93565b612c5b81614ed8565b50565b612c66613e77565b600b805464ff000000001916640100000000179055565b6002546000906001600160401b0316612ca95760405163c4a5ed8960e01b815260040160405180910390fd5b6002546000906001600160401b03600160401b9091048116908290612cf0907f000000000000000000000000000000000000000000000000000000000024ea001683615a51565b9050428211158015612d0157508042105b15612d2057600254600160801b90046001600160401b03169250612de4565b804210612d9d576001600160401b037f000000000000000000000000000000000000000000000000000000000024ea0016612d5b8242615b04565b612d659190615a94565b600254612d8390600160801b90046001600160401b03166001615a69565b6001600160401b0316612d969190615a51565b9250612de4565b6002546001600160401b037f000000000000000000000000000000000000000000000000000000000024ea00811691612dd7911642615b04565b612de19190615a94565b92505b509091505090565b612df46128a3565b612e1157604051630418dd1f60e21b815260040160405180910390fd5b60007f0000000000000000000000000000000000000000000000000000000000000000612f6457600b60059054906101000a90046001600160a01b03166001600160a01b03166365ac43416040518163ffffffff1660e01b815260040160206040518083038186803b158015612e8657600080fd5b505afa158015612e9a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ebe9190615854565b6040516370a0823160e01b81523060048201527f0000000000000000000000008f3cf7ad23cd3cadbd9735aff958023239c6a0636001600160a01b0316906370a082319060240160206040518083038186803b158015612f1d57600080fd5b505afa158015612f31573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f559190615854565b612f5f9190615a51565b612ff4565b600b60059054906101000a90046001600160a01b03166001600160a01b03166365ac43416040518163ffffffff1660e01b815260040160206040518083038186803b158015612fb257600080fd5b505afa158015612fc6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612fea9190615854565b612ff49047615a51565b90506000600d80548060200260200160405190810160405280929190818152602001828054801561304e57602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311613030575b505050505090506000600a8054806020026020016040519081016040528092919081815260200182805480156130a357602002820191906000526020600020905b81548152602001906001019080831161308f575b50505050509050600082516001600160401b038111156130c5576130c5615b6f565b6040519080825280602002602001820160405280156130ee578160200160208202803683370190505b50600b546040517fca63279b00000000000000000000000000000000000000000000000000000000815262010000820460ff1615156004820152919250600091650100000000009091046001600160a01b03169063ca63279b90602401600060405180830381600087803b15801561316557600080fd5b505af1158015613179573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526131a19190810190615755565b845190915060005b818110156132a25760006001600160a01b03168682815181106131ce576131ce615b59565b60200260200101516001600160a01b03161415801561323857508581815181106131fa576131fa615b59565b60200260200101516001600160a01b03167f0000000000000000000000008f3cf7ad23cd3cadbd9735aff958023239c6a0636001600160a01b031614155b1561329a5782818151811061324f5761324f615b59565b602002602001015185828151811061326957613269615b59565b602002602001015161327b9190615a51565b84828151811061328d5761328d615b59565b6020026020010181815250505b6001016131a9565b5060006132af8785614f35565b90506132bb81856150e5565b5050600b805461ff0019166101001790555050505050565b815460009062010000900460ff168061333c5750600b5460ff16801561333c57506001600160401b038216156133275761330e600183615b1b565b60018401546001600160401b039182169116101561333c565b60018301546001600160401b03808416911610155b9392505050565b60008080808080805b886001600160401b0316811161338b57336000908152600f602090815260408083208484529091529020546133819083615a51565b915060010161334c565b506001600160401b0388166000908152601160205260409020546133b2620f424083615ab6565b6133bc9190615a94565b955080601160008a6001600160401b0316815260200190815260200160002060008282546133ea9190615b04565b9091555050336000908152600e60209081526040808320600301546001600160401b038c1684526012909252909120549094508411613458576001600160401b038816600090815260126020526040902054613449620f424086615ab6565b6134539190615a94565b61345d565b620f42405b6001600160401b03891660009081526012602052604090205490955084111561349e576001600160401b0388166000908152601260205260408120556134cc565b6001600160401b038816600090815260126020526040812080548692906134c6908490615b04565b90915550505b86156135005760646134de8886615ab6565b6134e89190615a94565b336000908152600e6020526040902060030181905593505b8615801561350f575060045415155b156135ee57600354600454600091620f42409161353c91600160801b90046001600160401b031690615ab6565b6135469190615a94565b6003549091506000906001600160401b03600160801b90910416620f42401461357c57816004546135779190615b04565b61357f565b60005b9050620f424061358f8883615ab6565b6135999190615a94565b9350620f42406135a98984615ab6565b6135b39190615a94565b94506135bf8486615a51565b6135c99087615a51565b95506135d58486615a51565b600460008282546135e69190615b04565b909155505050505b5050509250925092565b600081831115613609575080612144565b5090919050565b600060085460001461370257600354600854600091620f42409161364491600160801b90046001600160401b031690615ab6565b61364e9190615a94565b6003549091506000906001600160401b03600160801b90910416620f424014613684578160085461367f9190615b04565b613687565b60005b90506000620f42406136998685615ab6565b6136a39190615a94565b90506000620f42406136b58885615ab6565b6136bf9190615a94565b90506136cb8183615a51565b945084600860008282546136df9190615b04565b9091555050600c546136fb906001600160a01b03163387614cb7565b9450505050505b60405181815233907f977e26f874eac308da255c037e203c4a501cf2cb08a8abf87e011d750f657ccf9060200160405180910390a2505050565b6000600d80548060200260200160405190810160405280929190818152602001828054801561379457602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311613776575b505050505090506000600a8054806020026020016040519081016040528092919081815260200182805480156137e957602002820191906000526020600020905b8154815260200190600101908083116137d5575b50505050509050600082516001600160401b0381111561380b5761380b615b6f565b604051908082528060200260200182016040528015613834578160200160208202803683370190505b50835190915060005b81811015613a465760006001600160a01b031685828151811061386257613862615b59565b60200260200101516001600160a01b03161415801561389b575083818151811061388e5761388e615b59565b6020026020010151600014155b15613a3e576000620f4240600360109054906101000a90046001600160401b03166001600160401b03168684815181106138d7576138d7615b59565b60200260200101516138e99190615ab6565b6138f39190615a94565b6003549091506000906001600160401b03600160801b90910416620f424014613940578186848151811061392957613929615b59565b602002602001015161393b9190615b04565b613943565b60005b90506000620f42406139558a85615ab6565b61395f9190615a94565b90506000620f42406139718c85615ab6565b61397b9190615a94565b90506139878183615a51565b87868151811061399957613999615b59565b6020026020010181815250508685815181106139b7576139b7615b59565b60200260200101518886815181106139d1576139d1615b59565b602002602001018181516139e59190615b04565b9052508851613a1b908a9087908110613a0057613a00615b59565b6020026020010151338988815181106127b8576127b8615b59565b878681518110613a2d57613a2d615b59565b602002602001018181525050505050505b60010161383d565b508251613a5a90600a90602086019061568f565b50336001600160a01b03167f38a6a91aca8b2590b32c77b7f06e41eafed98470306bce6fe498c5bfd734692683604051613a949190615928565b60405180910390a2505050505050565b60008215613ade576064613ab88484615ab6565b613ac29190615a94565b336000908152600e602052604090206003018190559050613ae1565b50805b600d546000906001600160401b03811115613afe57613afe615b6f565b604051908082528060200260200182016040528015613b27578160200160208202803683370190505b506040516000815290915033907f977e26f874eac308da255c037e203c4a501cf2cb08a8abf87e011d750f657ccf9060200160405180910390a2336001600160a01b03167f38a6a91aca8b2590b32c77b7f06e41eafed98470306bce6fe498c5bfd734692682604051613b9a9190615928565b60405180910390a25092915050565b60007f000000000000000000000000000000000000000000000000000000000000000015613c705747821115613bdd574791505b6000836001600160a01b03168360405160006040518083038185875af1925050503d8060008114613c2a576040519150601f19603f3d011682016040523d82523d6000602084013e613c2f565b606091505b5050905080613c6a576040517f9a98b7a200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50613e71565b6040516370a0823160e01b81523060048201527f0000000000000000000000008f3cf7ad23cd3cadbd9735aff958023239c6a0636001600160a01b0316906370a082319060240160206040518083038186803b158015613ccf57600080fd5b505afa158015613ce3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613d079190615854565b821115613da8576040516370a0823160e01b81523060048201527f0000000000000000000000008f3cf7ad23cd3cadbd9735aff958023239c6a0636001600160a01b0316906370a082319060240160206040518083038186803b158015613d6d57600080fd5b505afa158015613d81573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613da59190615854565b91505b60405163a9059cbb60e01b81526001600160a01b038481166004830152602482018490526000917f0000000000000000000000008f3cf7ad23cd3cadbd9735aff958023239c6a0639091169063a9059cbb90604401602060405180830381600087803b158015613e1757600080fd5b505af1158015613e2b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613e4f9190615819565b905080613e6f57604051638dc18fdb60e01b815260040160405180910390fd5b505b50919050565b6000546001600160a01b031633146118f45760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610d93565b600b5460ff16613fc957600254600090613f1c907f000000000000000000000000000000000000000000000000000000000024ea0090600160401b90046001600160401b0316615a69565b600254909150600090613f38906001600160401b031683615b1b565b6002549091506001600160401b0380831691620f424091613f8191600160801b9004167f000000000000000000000000000000000000000000000000000000000024ea00615ad5565b6001600160401b0316613f949190615ab6565b613f9e9190615a94565b600360106101000a8154816001600160401b0302191690836001600160401b03160217905550505050565b6002546001600160401b03828116600160801b90920416141561408f57600254600090613fff906001600160401b031642615b1b565b6002549091506001600160401b0380831691620f42409161404891600160801b9004167f000000000000000000000000000000000000000000000000000000000024ea00615ad5565b6001600160401b031661405b9190615ab6565b6140659190615a94565b600360106101000a8154816001600160401b0302191690836001600160401b031602179055505050565b50600380547fffffffffffffffff0000000000000000ffffffffffffffffffffffffffffffff16720f424000000000000000000000000000000000179055565b600054600160a01b900460ff16156118f45760405162461bcd60e51b815260206004820152601060248201527f5061757361626c653a20706175736564000000000000000000000000000000006044820152606401610d93565b8181111561414a57604051630d2eb29360e41b815260040160405180910390fd5b6000614154612c7d565b336000908152600e6020526040812060018101805467ffffffffffffffff19166001600160401b03851617905560020180549293508592909190614199908490615a51565b9091555050336000908152600e6020526040812060030180548492906141c0908490615a51565b90915550600090506141f27f000000000000000000000000000000000000000000000000000000000024ea0083615ad5565b60025461420891906001600160401b0316615a69565b6001600160401b0316427f000000000000000000000000000000000000000000000000000000000024ea006001600160401b03166142469190615a51565b6142509190615b04565b61425d620f424085615ab6565b6142679190615a94565b336000908152600f602090815260408083206001600160401b0387168452825280832084905560119091528120549192505b836001600160401b031681116142d857336000908152600f602090815260408083208484529091529020546142ce9083615a51565b9150600101614299565b506001600160401b0383166000818152601160209081526040808320859055338352600e82528083206003015493835260129091528120805490919061431f908490615a51565b909155505060025461434390600190600160801b90046001600160401b0316615b1b565b6001600160401b0316836001600160401b031614156143b057600380546001600160401b03600160401b8083048216600101909116026fffffffffffffffff000000000000000019909116179055336000908152600e60205260409020805462ff00001916620100001790555b6001600160401b038316600081815260106020526040902080546001019055158015906143f857506001600160401b0360001984011660009081526010602052604090205415155b15614422576000198381016001600160401b03166000908152601060205260409020805490910190555b84600660008282546144349190615a51565b92505081905550836005600082825461444d9190615a51565b909155507f0000000000000000000000000000000000000000000000000000000000000000905061456a57600b546040517f23b872dd0000000000000000000000000000000000000000000000000000000081523360048201526001600160a01b036501000000000090920482166024820152604481018790526000917f0000000000000000000000008f3cf7ad23cd3cadbd9735aff958023239c6a06316906323b872dd90606401602060405180830381600087803b15801561451057600080fd5b505af1158015614524573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906145489190615819565b90508061456857604051638dc18fdb60e01b815260040160405180910390fd5b505b600b546040517fb9b8c2460000000000000000000000000000000000000000000000000000000081526001600160a01b037f0000000000000000000000008f3cf7ad23cd3cadbd9735aff958023239c6a0638116600483015260248201899052650100000000009092049091169063b9b8c2469034906044016000604051808303818588803b1580156145fc57600080fd5b505af1158015614610573d6000803e3d6000fd5b5050505050505050505050565b600054600160a01b900460ff166118f45760405162461bcd60e51b815260206004820152601460248201527f5061757361626c653a206e6f74207061757365640000000000000000000000006044820152606401610d93565b61467e61461d565b600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff1690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b039091168152602001611972565b6146e9613e77565b6118f46000614ed8565b6146fb6140cf565b600080547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff16600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586146c93390565b614759612c7d565b6001600160401b031615614799576040517fb3b3b34e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b336000818152600e602052604090205460ff6101008204169163010000009091046001600160a01b03161480156147ce575080155b15614805576040517fa510df3700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60038054600191906000906148249084906001600160401b0316615a69565b82546101009290920a6001600160401b038181021990931691831602179091556003547f000000000000000000000000000000000000000000000000000000000000138882169116111590506148a6576040517fe7b9e0e700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f000000000000000000000000000000000000000000000000000000000000000080156148fa57508115806148fa57507f000000000000000000000000000000000000000000000000000000000000000082115b1561491857604051637292a14360e11b815260040160405180910390fd5b60007f0000000000000000000000000000000000000000000000000000000000000000614965577f000000000000000000000000000000000000000000000001158e460913d00000614967565b825b90507f0000000000000000000000000000000000000000000000000000000000000000156149b4578034146149af5760405163e1f0844960e01b815260040160405180910390fd5b6149d3565b34156149d35760405163e1f0844960e01b815260040160405180910390fd5b600b546040516365237abb60e01b8152600481018390526000916501000000000090046001600160a01b0316906365237abb9060240160206040518083038186803b158015614a2157600080fd5b505afa158015614a35573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614a599190615854565b905080614a7957604051630d2eb29360e41b815260040160405180910390fd5b60408051610120810182526000808252602080830182815283850183815233606086018181526080870186815260a0880187815260c0890188815260e08a01898152610100808c018f8152968b52600e9099529a90982089518154975196519451935161ffff1990981690151561ff00191617951515909702949094177fffffffffffffffffff000000000000000000000000000000000000000000ffff1662010000921515929092027fffffffffffffffffff0000000000000000000000000000000000000000ffffff169190911763010000006001600160a01b0390921691909102177fff0000000000000000ffffffffffffffffffffffffffffffffffffffffffffff16600160b81b6001600160401b0394851602178455905160018401805467ffffffffffffffff1916919093161790915591516002820155925160038401555160049092019190915583614c1c57601380546001810182556000919091527f66de8ffda797e3de9c05e8fc57b3bf0ec28a930d40b0d285d93c06501cf6a09001805473ffffffffffffffffffffffffffffffffffffffff1916331790555b604080518481526020810184905233917f53d337ea1dc431137693f9a003695ac0fde36068f5fc73370015168b9e64cf9e910160405180910390a2614c62868484614129565b505050505050565b805160009060015b81811015614cad57838181518110614c8c57614c8c615b59565b6020026020010151600014614ca5575060019392505050565b600101614c72565b5060009392505050565b6040516370a0823160e01b81523060048201526000906001600160a01b038516906370a082319060240160206040518083038186803b158015614cf957600080fd5b505afa925050508015614d29575060408051601f3d908101601f19168201909252614d2691810190615854565b60015b614da8573d808015614d57576040519150601f19603f3d011682016040523d82523d6000602084013e614d5c565b606091505b5060009250846001600160a01b03167f7a30d31a8bd18ad5251980ab4105d3f180c3cc00767d79b1393c3e4ca392638e82604051614d9a919061594e565b60405180910390a250614db6565b80831115614db4578092505b505b8115614ed15760405163a9059cbb60e01b81526001600160a01b0384811660048301526024820184905285169063a9059cbb90604401602060405180830381600087803b158015614e0657600080fd5b505af1925050508015614e36575060408051601f3d908101601f19168201909252614e3391810190615819565b60015b614eb1573d808015614e64576040519150601f19603f3d011682016040523d82523d6000602084013e614e69565b606091505b50846001600160a01b03167ffdba62ff5ed53473134bad9bdefe10d1bbc01c3cb36e9660032a629b6c926a6182604051614ea3919061594e565b60405180910390a250614ed1565b80614ecf57604051638dc18fdb60e01b815260040160405180910390fd5b505b5092915050565b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60055460009081908410614f5757600554614f509085615b04565b9050614f78565b600554614f65856064615ab6565b614f6f9190615a94565b60095560058490555b600c546001600160a01b03168015615078576040516370a0823160e01b81523060048201526001600160a01b038216906370a082319060240160206040518083038186803b158015614fc957600080fd5b505afa925050508015614ff9575060408051601f3d908101601f19168201909252614ff691810190615854565b60015b615074573d808015615027576040519150601f19603f3d011682016040523d82523d6000602084013e61502c565b606091505b50816001600160a01b03167f7a30d31a8bd18ad5251980ab4105d3f180c3cc00767d79b1393c3e4ca392638e82604051615066919061594e565b60405180910390a250615078565b6008555b600b54610100900460ff166150dd57336001600160a01b03167f5a8920b0ea1c4677685868cec72bce61e9a586ef5f317707ecc34ae9401856758660065460055486896008546009546040516150d497969594939291906159cb565b60405180910390a25b509392505050565b6000600d80548060200260200160405190810160405280929190818152602001828054801561513d57602002820191906000526020600020905b81546001600160a01b0316815260019091019060200180831161511f575b505050505090506000600780548060200260200160405190810160405280929190818152602001828054801561519257602002820191906000526020600020905b81548152602001906001019080831161517e575b505050505090506000600a8054806020026020016040519081016040528092919081815260200182805480156151e757602002820191906000526020600020905b8154815260200190600101908083116151d3575b50505050509050600b60019054906101000a900460ff161561536157600b546301000000900460ff16156152215750600484905582615680565b8160008151811061523457615234615b59565b60200260200101518510615270578160008151811061525557615255615b59565b6020026020010151856152689190615b04565b600455615276565b60006004555b825160005b8181101561535a578361528f826001615a51565b8151811061529f5761529f615b59565b60200260200101518682815181106152b9576152b9615b59565b60200260200101511061533157836152d2826001615a51565b815181106152e2576152e2615b59565b60200260200101518682815181106152fc576152fc615b59565b602002602001015161530e9190615b04565b83828151811061532057615320615b59565b602002602001018181525050615352565b600083828151811061534557615345615b59565b6020026020010181815250505b60010161527b565b5050615680565b8251600354600160401b90046001600160401b031661544657858360008151811061538e5761538e615b59565b6020908102919091010152600486905560005b8181101561542c578581815181106153bb576153bb615b59565b60200260200101518382815181106153d5576153d5615b59565b6020026020010181815250508581815181106153f3576153f3615b59565b6020026020010151848260016154099190615a51565b8151811061541957615419615b59565b60209081029190910101526001016153a1565b50825161544090600790602086019061568f565b50615646565b6001600160401b037f000000000000000000000000000000000000000000000000000000000000000516156155f55760646154aa6001600160401b037f00000000000000000000000000000000000000000000000000000000000000051688615ab6565b6154b49190615a94565b836000815181106154c7576154c7615b59565b602002602001018181525050826000815181106154e6576154e6615b59565b6020026020010151866154f99190615b04565b60045560005b8181101561542c5760647f00000000000000000000000000000000000000000000000000000000000000056001600160401b031687838151811061554557615545615b59565b60200260200101516155579190615ab6565b6155619190615a94565b8461556d836001615a51565b8151811061557d5761557d615b59565b602090810291909101015283615594826001615a51565b815181106155a4576155a4615b59565b60200260200101518682815181106155be576155be615b59565b60200260200101516155d09190615b04565b8382815181106155e2576155e2615b59565b60209081029190910101526001016154ff565b600486905560005b818110156156445785818151811061561757615617615b59565b602002602001015183828151811061563157615631615b59565b60209081029190910101526001016155fd565b505b7f4d58284f2a68a6d9baded7cdff0efbca82dbc7d35a3571c1d8bb6d06eb2528276007604051615676919061593b565b60405180910390a1505b8051614c6290600a9060208401905b8280548282559060005260206000209081019282156156ca579160200282015b828111156156ca5782518255916020019190600101906156af565b506156d69291506156da565b5090565b5b808211156156d657600081556001016156db565b60006020828403121561570157600080fd5b813561333c81615b85565b60006020828403121561571e57600080fd5b815161333c81615b85565b6000806040838503121561573c57600080fd5b823561574781615b85565b946020939093013593505050565b6000602080838503121561576857600080fd5b82516001600160401b038082111561577f57600080fd5b818501915085601f83011261579357600080fd5b8151818111156157a5576157a5615b6f565b8060051b604051601f19603f830116810181811085821117156157ca576157ca615b6f565b604052828152858101935084860182860187018a10156157e957600080fd5b600095505b8386101561580c5780518552600195909501949386019386016157ee565b5098975050505050505050565b60006020828403121561582b57600080fd5b8151801515811461333c57600080fd5b60006020828403121561584d57600080fd5b5035919050565b60006020828403121561586657600080fd5b5051919050565b6000806040838503121561588057600080fd5b50508035926020909101359150565b6000602082840312156158a157600080fd5b81356001600160401b038116811461333c57600080fd5b600081518084526020808501945080840160005b838110156158e8578151875295820195908201906001016158cc565b509495945050505050565b6000815480845260208085019450836000528060002060005b838110156158e85781548752958201956001918201910161590c565b60208152600061333c60208301846158b8565b60208152600061333c60208301846158f3565b600060208083528351808285015260005b8181101561597b5785810183015185820160400152820161595f565b8181111561598d576000604083870101525b50601f01601f1916929092016040019392505050565b8381528260208201526060604082015260006159c260608301846158b8565b95945050505050565b87815286602082015285604082015284606082015260e0608082015260006159f660e08301866158b8565b60a08301949094525060c0015295945050505050565b87815286602082015285604082015284606082015283608082015260e060a08201526000615a3d60e08301856158f3565b90508260c083015298975050505050505050565b60008219821115615a6457615a64615b43565b500190565b60006001600160401b03808316818516808303821115615a8b57615a8b615b43565b01949350505050565b600082615ab157634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615615ad057615ad0615b43565b500290565b60006001600160401b0380831681851681830481118215151615615afb57615afb615b43565b02949350505050565b600082821015615b1657615b16615b43565b500390565b60006001600160401b0383811690831681811015615b3b57615b3b615b43565b039392505050565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b0381168114612c5b57600080fdfea2646970667358221220cd3d586384c9c87bd82a44ebd8208e432d938d9c017c88b087b059d13233d4d364736f6c63430008070033

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  ]

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.