ETH Price: $3,119.48 (+4.27%)
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To

There are no matching entries

Please try again later

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading
Cross-Chain Transactions

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
AllStarsStaking

Compiler Version
v0.8.20+commit.a1b79de6

Optimization Enabled:
Yes with 200 runs

Other Settings:
paris EvmVersion
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";

import "./interface/IAllStarsStaking.sol";

contract AllStarsStaking is
    Initializable,
    AccessControlUpgradeable,
    PausableUpgradeable,
    ReentrancyGuardUpgradeable,
    IAllStarsStaking
{
    /// @dev Role identifier for administrative functions
    bytes32 public constant ADMIN_ROLE = keccak256("ADMIN_ROLE");

    /// @notice Constant representing the zero address
    address internal constant ZERO_ADDRESS = address(0);

    /// @notice The ERC20 token used for rewards
    IERC20 public starToken;

    /// @notice Counter for the total number of games created
    uint256 public gameIdCounter;

    /// @notice The factor by which the end block is reduced after each stake
    uint256 public countdownReductionFactor;

    /// @notice The factor by which the end block is increased when close to expiration
    uint256 public finalGameFactor;

    /// @notice The factor which indicates the closeness to expiration in which the end time must be increased
    uint256 public finalResetFactor;

    /// @notice List of tokens allowed for staking
    address[] private allowedTokenArray;

    /// @notice Mapping of game IDs to their respective Game data
    mapping(uint256 => Game) private games;

    /**
     * @notice Tracks if a user has claimed rewards for a specific game
     * @dev gameId -> user -> bool
     */
    mapping(uint256 => mapping(address => bool)) public rewardsClaimed;

    /**
     * @notice Mapping to track which tokens a user has staked in a given game
     * @dev gameId -> user -> array of tokens staked
     */
    mapping(uint256 => mapping(address => address[])) public userStakedTokens;

    /**
     * @notice Tracks the total stakes of each token in a specific game
     * @dev gameId -> token -> total stakes
     */
    mapping(uint256 => mapping(address => uint256)) public totalGameStakes;

    /**
     * @notice Tracks individual stakes of users in a specific game and token
     * @dev gameId -> user -> token -> stake amount
     */
    mapping(uint256 => mapping(address => mapping(address => uint256)))
        public stakes;

    /// @notice No of blocks after a game's end, after which users will not get rewards in claim.
    uint256 public rewardClaimDeadlineBlocks;

    /**
     * @notice Initializes the contract with initial parameters
     * @param starToken_ The address of the STAR ERC20 token contract
     * @param adminAddress The address of the admin
     * @param allowedTokens_ The list of allowed tokens for staking
     * @param countdownReductionFactor_ The factor by which the end block is reduced after each stake
     * @param finalGameFactor_ The factor by which the end block is increased when close to expiration
     * @param finalResetFactor_ The factor in which the end block will be increased
     */
    function initialize(
        IERC20 starToken_,
        address adminAddress,
        address[] memory allowedTokens_,
        uint256 countdownReductionFactor_,
        uint256 finalGameFactor_,
        uint256 finalResetFactor_
    ) public initializer {
        require(
            countdownReductionFactor_ > 0,
            "AllStarsStaking: Countdown factor must be greater than zero"
        );
        require(
            finalGameFactor_ > 0,
            "AllStarsStaking: Final game factor must be greater than zero"
        );
        require(
            finalResetFactor_ > 0,
            "AllStarsStaking: Final reset factor must be greater than zero"
        );

        require(
            address(starToken_) != ZERO_ADDRESS && adminAddress != ZERO_ADDRESS,
            "AllStarsStaking: Zero address provided for STAR token or admin"
        );
        uint256 allowedTokensLength = allowedTokens_.length;
        require(
            allowedTokensLength > 0,
            "AllStarsStaking: No allowed tokens provided"
        );

        __AccessControl_init();
        __Pausable_init();
        __ReentrancyGuard_init();

        starToken = starToken_;
        allowedTokenArray = allowedTokens_;
        countdownReductionFactor = countdownReductionFactor_;
        finalGameFactor = finalGameFactor_;
        finalResetFactor = finalResetFactor_;

        _grantRole(DEFAULT_ADMIN_ROLE, adminAddress);
        _grantRole(ADMIN_ROLE, adminAddress);
    }

    // ==================== SEEDING LOGIC START ====================
    /**
     * @notice Function for seeding data of mapping: games
     * @dev Sets gameIdCounter as well.
     * @param _games Array of games data as per Game struct.
     */
    function seedGamesData(
        Game[] calldata _games
    ) external onlyRole(DEFAULT_ADMIN_ROLE) {
        gameIdCounter = _games.length;
        uint256 totalGames = _games.length;
        for (uint256 i = 0; i < totalGames; ++i) {
            Game calldata gameCalldata = _games[i];
            Game storage gameStorage = games[i + 1];
            gameStorage.startBlock = gameCalldata.startBlock;
            gameStorage.endBlock = gameCalldata.endBlock;
            gameStorage.gameBlocks = gameCalldata.gameBlocks;
            gameStorage.rewardAmount = gameCalldata.rewardAmount;
            gameStorage.creator = gameCalldata.creator;
            gameStorage.lastStakedToken = gameCalldata.lastStakedToken;
            gameStorage.stakeTokenSequence = gameCalldata.stakeTokenSequence;
            gameStorage.allowedTokens = gameCalldata.allowedTokens;
            gameStorage.claimed = gameCalldata.claimed;
        }
    }

    /**
     * @notice Function for seeding data of mapping: rewardsClaimed
     * @param _gameIds Array of game ids to seed.
     * @param _users Array of user addresses arrays.
     */
    function seedRewardsClaimedData(
        uint256[] calldata _gameIds,
        address[][] calldata _users
    ) external onlyRole(DEFAULT_ADMIN_ROLE) {
        uint256 totalGames = _gameIds.length;
        require(totalGames == _users.length, "ArrayLengthMismatch");
        for (uint256 i = 0; i < totalGames; ++i) {
            uint256 gameId = _gameIds[i];
            address[] calldata users = _users[i];
            for (uint256 j = 0; j < users.length; ++j) {
                rewardsClaimed[gameId][users[j]] = true;
            }
        }
    }

    /**
     * @notice Function for seeding data of mapping: userStakedTokens
     * @param _gameIds Array of game ids to seed.
     * @param _users Array of user addresses arrays.
     * @param _tokens Array of user's staked tokens array per game.
     */
    function seedUserStakedTokensData(
        uint256[] calldata _gameIds,
        address[][] calldata _users,
        address[][][] calldata _tokens
    ) external onlyRole(DEFAULT_ADMIN_ROLE) {
        uint256 totalGames = _gameIds.length;
        require(
            totalGames == _users.length && totalGames == _tokens.length,
            "ArrayLengthMismatch"
        );
        for (uint256 i = 0; i < totalGames; ++i) {
            uint256 gameId = _gameIds[i];
            uint256 totalGameUsers = _users[i].length;
            require(totalGameUsers == _tokens[i].length, "ArrayLengthMismatch");
            for (uint256 j = 0; j < totalGameUsers; ++j) {
                userStakedTokens[gameId][_users[i][j]] = _tokens[i][j];
            }
        }
    }

    /**
     * @notice Function for seeding data of mapping: totalGameStakes
     * @param _gameIds Array of game ids to seed.
     * @param _tokens Array of token addresses array.
     * @param _amounts Array of token staked amounts array.
     */
    function seedTotalGameStakesData(
        uint256[] calldata _gameIds,
        address[][] calldata _tokens,
        uint256[][] calldata _amounts
    ) external onlyRole(DEFAULT_ADMIN_ROLE) {
        uint256 totalGames = _gameIds.length;
        require(
            totalGames == _tokens.length && totalGames == _amounts.length,
            "ArrayLengthMismatch"
        );
        for (uint256 i = 0; i < totalGames; ++i) {
            uint256 gameId = _gameIds[i];
            require(
                _tokens[i].length == _amounts[i].length,
                "ArrayLengthMismatch"
            );
            uint256 totalTokens = _tokens[i].length;
            for (uint256 j = 0; j < totalTokens; ++j) {
                totalGameStakes[gameId][_tokens[i][j]] = _amounts[i][j];
            }
        }
    }

    /**
     * @notice Function for seeding data of mapping: stakes
     * @param _gameIds Array of game ids to seed.
     * @param _users Array of user addresses arrays.
     * @param _tokens Array of token addresses array arrays for user.
     * @param _amounts Array of token staked amounts array arrays for user.
     */
    function seedStakesData(
        uint256[] calldata _gameIds,
        address[][] calldata _users,
        address[][][] calldata _tokens,
        uint256[][][] calldata _amounts
    ) external onlyRole(DEFAULT_ADMIN_ROLE) {
        require(
            _gameIds.length == _users.length &&
                _gameIds.length == _tokens.length &&
                _gameIds.length == _amounts.length,
            "ArrayLengthMismatch"
        );
        for (uint256 i = 0; i < _gameIds.length; ++i) {
            require(
                _users[i].length == _tokens[i].length &&
                    _users[i].length == _amounts[i].length,
                "ArrayLengthMismatch"
            );
            for (uint256 j = 0; j < _users[i].length; ++j) {
                uint256 totalTokens = _tokens[i][j].length;
                require(
                    totalTokens == _amounts[i][j].length,
                    "ArrayLengthMismatch"
                );
                for (uint256 k = 0; k < totalTokens; ++k) {
                    stakes[_gameIds[i]][_users[i][j]][
                        _tokens[i][j][k]
                    ] = _amounts[i][j][k];
                }
            }
        }
    }
    // ==================== SEEDING LOGIC END ======================

    /**
     * @notice Creates a new lastMemeStanding game
     * @param startBlock The block number when the game starts
     * @param endBlock The block number when the game ends
     * @param rewardPoolAmount The reward pool amount for the game
     */
    function createNewGame(
        uint256 startBlock,
        uint256 endBlock,
        uint256 rewardPoolAmount
    ) external override whenNotPaused onlyRole(ADMIN_ROLE) {
        require(
            endBlock > startBlock,
            "AllStarsStaking: End block must be greater than start block"
        );
        require(
            startBlock > block.number,
            "AllStarsStaking: Start block must be greater than current block"
        );
        require(
            rewardPoolAmount > 0,
            "AllStarsStaking: Reward amount must be greater than zero"
        );

        gameIdCounter++;
        if (gameIdCounter > 1) {
            require(
                block.number > games[gameIdCounter - 1].endBlock,
                "AllStarsStaking: Game already running"
            );
        }
        games[gameIdCounter].startBlock = startBlock;
        games[gameIdCounter].endBlock = endBlock;
        games[gameIdCounter].rewardAmount = rewardPoolAmount;
        games[gameIdCounter].gameBlocks = endBlock - startBlock;
        games[gameIdCounter].allowedTokens = allowedTokenArray;
        games[gameIdCounter].creator = _msgSender();

        bool success = starToken.transferFrom(
            _msgSender(),
            address(this),
            rewardPoolAmount
        );
        require(success, "AllStarsStaking: Token transfer failed");

        emit NewGameCreated(
            gameIdCounter,
            startBlock,
            endBlock,
            rewardPoolAmount
        );
    }

    /**
     * @notice Allows users to stake tokens to a game
     * @param gameId The ID of the game in which to stake
     * @param token The address of the token to stake
     * @param amount The amount of tokens to stake
     */
    function stakeInGame(
        uint256 gameId,
        address token,
        uint256 amount
    ) external override nonReentrant whenNotPaused {
        require(
            gameId <= gameIdCounter,
            "AllStarsStaking: Game Id does not exist"
        );
        require(
            token != ZERO_ADDRESS,
            "AllStarsStaking: Token is zero address"
        );
        require(
            amount > 0,
            "AllStarsStaking: Stake amount must be greater than zero"
        );
        require(
            tokenAllowedForGame(gameId, token),
            "AllStarsStaking: Token is not allowed"
        );

        Game memory game = games[gameId];
        require(
            block.number >= game.startBlock,
            "AllStarsStaking: Game has not started yet"
        );
        require(
            block.number <= game.endBlock,
            "AllStarsStaking: Game has ended"
        );

        if (
            game.lastStakedToken == ZERO_ADDRESS ||
            game.stakeTokenSequence[0] != token
        ) {
            bool isLastStage = (game.endBlock - game.startBlock) <=
                finalResetFactor;
            updateLastTokenSequence(gameId, token, isLastStage);
        }
        if (stakes[gameId][_msgSender()][token] == 0) {
            userStakedTokens[gameId][_msgSender()].push(token);
        }
        stakes[gameId][_msgSender()][token] += amount;
        totalGameStakes[gameId][token] += amount;

        bool success = IERC20(token).transferFrom(
            _msgSender(),
            address(this),
            amount
        );
        require(success, "AllStarsStaking: Token transfer failed");

        emit StakedInGame(gameId, _msgSender(), token, amount);
    }

    /**
     * @notice Internal function to update the last token staked for the game
     * @param gameId The ID of the game to update
     * @param token The address of the token to update
     * @param isLastStage The boolean to confirm whether to reduce or increase game endTime as per time of stake
     */
    function updateLastTokenSequence(
        uint256 gameId,
        address token,
        bool isLastStage
    ) internal {
        uint256 changeValue;
        Game storage game = games[gameId];

        if (isLastStage) {
            changeValue = block.number + finalGameFactor;
        } else {
            changeValue =
                block.number +
                (game.endBlock - game.startBlock - countdownReductionFactor);
        }
        game.lastStakedToken = token;
        game.endBlock = changeValue;
        game.startBlock = block.number;

        bool found = false;
        uint256 index = 0;
        uint256 stakeTokenLength = game.stakeTokenSequence.length;
        for (uint256 i = 0; i < stakeTokenLength; i++) {
            if (game.stakeTokenSequence[i] == token) {
                found = true;
                index = i;
                break;
            }
        }

        if (!found) {
            game.stakeTokenSequence.push(token);
            for (uint256 i = game.stakeTokenSequence.length - 1; i > 0; i--) {
                game.stakeTokenSequence[i] = game.stakeTokenSequence[i - 1];
            }
            game.stakeTokenSequence[0] = token;
        } else {
            for (uint256 i = index; i > 0; i--) {
                game.stakeTokenSequence[i] = game.stakeTokenSequence[i - 1];
            }
            game.stakeTokenSequence[0] = token;
        }
    }

    /**
     * @notice Allows users to claim rewards for staking on the winning token
     * @param gameId The ID of the phase for which the reward is claimed
     */
    function claimAllGameRewards(
        uint256 gameId
    ) external override nonReentrant whenNotPaused {
        require(
            gameId <= gameIdCounter,
            "AllStarsStaking: Game Id does not exist"
        );
        require(
            block.number > games[gameId].endBlock,
            "AllStarsStaking: Game has not ended"
        );
        require(
            !rewardsClaimed[gameId][_msgSender()],
            "AllStarsStaking: Reward already claimed"
        );

        address winningToken = games[gameId].lastStakedToken;
        uint256 rewardAmount = games[gameId].rewardAmount;
        uint256 totalReward = 0;

        address[] memory stakedTokens = userStakedTokens[gameId][_msgSender()];
        uint256 stakedTokensLength = stakedTokens.length;
        require(
            stakedTokensLength > 0,
            "AllStarsStaking: No staked tokens to claim"
        );
        rewardsClaimed[gameId][_msgSender()] = true;

        for (uint256 i = 0; i < stakedTokensLength; i++) {
            address token = stakedTokens[i];
            uint256 userStake = stakes[gameId][_msgSender()][token];
            if (userStake > 0) {
                if (token == winningToken) {
                    uint256 totalStakes = totalGameStakes[gameId][token];
                    totalReward += (rewardAmount * userStake) / totalStakes;
                }
                bool success = IERC20(token).transfer(_msgSender(), userStake);
                require(success, "AllStarsStaking: Token transfer failed");
            }
        }

        delete userStakedTokens[gameId][_msgSender()];
        bool deadlineNotReached = rewardClaimDeadlineBlocks == 0 ||
            (block.number - games[gameId].endBlock) <=
            rewardClaimDeadlineBlocks;
        if (totalReward > 0 && deadlineNotReached) {
            bool transferSuccess = starToken.transfer(
                _msgSender(),
                totalReward
            );
            require(transferSuccess, "AllStarsStaking: Token transfer failed");
            emit GameRewardClaimed(gameId, _msgSender(), totalReward);
        }
    }

    /**
     * @notice Allows admin to end game if no one has staked
     * @param gameId The ID of the game to end
     */
    function endGame(
        uint256 gameId
    ) external override nonReentrant whenNotPaused onlyRole(ADMIN_ROLE) {
        require(
            gameId <= gameIdCounter,
            "AllStarsStaking: Game Id does not exist"
        );
        require(
            block.number > games[gameId].endBlock,
            "AllStarsStaking: Game has not ended"
        );
        require(
            games[gameId].lastStakedToken == ZERO_ADDRESS,
            "AllStarsStaking: User staking exist"
        );
        require(
            !games[gameId].claimed,
            "AllStarsStaking: Reward already claimed"
        );

        games[gameId].claimed = true;
        bool success = starToken.transfer(
            games[gameId].creator,
            games[gameId].rewardAmount
        );
        require(success, "AllStarsStaking: Token transfer failed");
        emit GameEnded(gameId);
    }

    /**
     * @notice Updates the allowed tokens array to be used in the next game
     * @param newAllowedTokens_ The new list of allowed tokens for staking
     */
    function updateAllowedTokens(
        address[] memory newAllowedTokens_
    ) external override onlyRole(ADMIN_ROLE) {
        uint256 allowedTokensLength = newAllowedTokens_.length;
        require(
            allowedTokensLength > 0,
            "AllStarsStaking: No allowed tokens provided"
        );
        allowedTokenArray = newAllowedTokens_;
        emit AllowedTokensUpdated(allowedTokenArray);
    }

    /**
     * @notice Updates the game factors for last stake game mechanics
     * @param newCountdownReductionFactor The new factor by which the end block is reduced after each stake
     * @param newFinalGameFactor The new factor by which the end block is increased when close to expiration
     * @param newFinalResetFactor The new factor in which the end block will be increased
     */
    function updateGameFactors(
        uint256 newCountdownReductionFactor,
        uint256 newFinalGameFactor,
        uint256 newFinalResetFactor
    ) external override whenNotPaused onlyRole(ADMIN_ROLE) {
        require(
            newCountdownReductionFactor > 0,
            "AllStarsStaking: Countdown factor must be greater than zero"
        );
        require(
            newFinalGameFactor > 0,
            "AllStarsStaking: Final game factor must be greater than zero"
        );
        require(
            newFinalResetFactor > 0,
            "AllStarsStaking: Final reset factor must be greater than zero"
        );

        require(
            newCountdownReductionFactor != countdownReductionFactor ||
                newFinalGameFactor != finalGameFactor ||
                newFinalResetFactor != finalResetFactor,
            "AllStarsStaking: No factors changed"
        );

        countdownReductionFactor = newCountdownReductionFactor;
        finalGameFactor = newFinalGameFactor;
        finalResetFactor = newFinalResetFactor;

        emit FactorsUpdated(
            newCountdownReductionFactor,
            newFinalGameFactor,
            newFinalResetFactor
        );
    }

    /**
     * @notice Returns the staking details for the gameId and the user address
     * @param gameId The ID of the game to fetch its details
     * @param user The address of the user to fetch its details
     */
    function getUserDetails(
        uint256 gameId,
        address user
    )
        external
        view
        returns (address[] memory, uint256[] memory, uint256[] memory)
    {
        uint256 allowedTokensLength = games[gameId].allowedTokens.length;
        address[] memory tokens = new address[](allowedTokensLength);
        uint256[] memory totalStake = new uint256[](allowedTokensLength);
        uint256[] memory yourStake = new uint256[](allowedTokensLength);
        for (uint8 index = 0; index < allowedTokensLength; index++) {
            address iteratingToken = games[gameId].allowedTokens[index];
            tokens[index] = (iteratingToken);
            totalStake[index] = (totalGameStakes[gameId][iteratingToken]);
            yourStake[index] = (stakes[gameId][user][iteratingToken]);
        }
        return (tokens, totalStake, yourStake);
    }

    /**
     * @notice Returns the user rewards for the gameId and the user address
     * @param gameId The ID of the game to fetch its details
     * @param user The address of the user to fetch its details
     */
    function getUserRewards(
        uint256 gameId,
        address user
    ) external view returns (uint256 reward) {
        require(
            gameId <= gameIdCounter,
            "AllStarsStaking: Game Id does not exist"
        );
        require(
            block.number > games[gameId].endBlock,
            "AllStarsStaking: Game has not ended"
        );
        address winningToken = games[gameId].lastStakedToken;
        uint256 userStake = stakes[gameId][user][winningToken];
        if (userStake > 0) {
            uint256 totalStakes = totalGameStakes[gameId][winningToken];
            reward = (games[gameId].rewardAmount * userStake) / totalStakes;
        }
    }

    /**
     * @notice Returns the game details for the gameId provided
     * @param gameId The ID of the game to fetch its details
     */
    function getGameDetails(
        uint256 gameId
    ) external view returns (Game memory) {
        return games[gameId];
    }

    /**
     * @notice Returns the tokens allowed for staking
     */
    function allowedTokens() external view returns (address[] memory) {
        return allowedTokenArray;
    }

    /**
     * @notice Returns whether the token is allowed in the game
     */
    function tokenAllowedForGame(
        uint256 gameId,
        address token
    ) internal view returns (bool) {
        uint256 allowedTokenLength = games[gameId].allowedTokens.length;
        for (uint8 index = 0; index < allowedTokenLength; index++) {
            if (games[gameId].allowedTokens[index] == token) return true;
        }
        return false;
    }

    /**
     * @dev Pauses the contract, preventing certain functions from being executed.
     * @dev Only authorized users can call this function.
     */
    function pause() external onlyRole(ADMIN_ROLE) {
        _pause();
    }

    /**
     * @dev Unpauses the contract, allowing the execution of all functions.
     * @dev Only authorized users can call this function.
     */
    function unpause() external onlyRole(ADMIN_ROLE) {
        _unpause();
    }

    /**
     * @notice Function to update rewardClaimDeadlineBlocks no by address with ADMIN_ROLE.
     * @param _deadlineBlocks No of blocks after a game's end, after which rewards will not be given.
     */
    function updateRewardClaimDeadlineBlocks(
        uint256 _deadlineBlocks
    ) external onlyRole(ADMIN_ROLE) {
        uint256 oldDeadline = rewardClaimDeadlineBlocks;
        rewardClaimDeadlineBlocks = _deadlineBlocks;
        emit RewardClaimDeadlineBlocksUpdated(
            msg.sender,
            oldDeadline,
            _deadlineBlocks,
            block.timestamp
        );
    }

    /**
     * @notice Function for admin to withdraw tokens from the contract.
     * @param _token Address of token to withdraw.
     * @param _amount Token amount to withdraw.
     */
    function withdrawTokens(
        address _token,
        uint256 _amount
    ) external onlyRole(ADMIN_ROLE) {
        IERC20 token = IERC20(_token);
        require(
            token.balanceOf(address(this)) >= _amount,
            "Insufficient Balance."
        );
        bool success = token.transfer(msg.sender, _amount);
        require(success, "AllStarsStaking: Token transfer failed");
        emit AdminTokenWithdrawal(msg.sender, _token, _amount, block.timestamp);
    }

    /**
     * @notice Function to update rewardAmount of a game.
     * @dev One-time callable function after upgrade.
     * @param _gameId Id of the game
     * @param _amountToAdd Token amount to add to existing rewardAmount of the game.
     */
    function updateGameRewardAmount(
        uint256 _gameId,
        uint256 _amountToAdd
    ) external onlyRole(ADMIN_ROLE) {
        require(
            _gameId <= gameIdCounter,
            "AllStarsStaking: Game Id does not exist"
        );
        games[_gameId].rewardAmount += _amountToAdd;
        bool success = starToken.transferFrom(
            _msgSender(),
            address(this),
            _amountToAdd
        );
        require(success, "AllStarsStaking: Token transfer failed");
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol)

pragma solidity ^0.8.20;

import {IAccessControl} from "@openzeppelin/contracts/access/IAccessControl.sol";
import {ContextUpgradeable} from "../utils/ContextUpgradeable.sol";
import {ERC165Upgradeable} from "../utils/introspection/ERC165Upgradeable.sol";
import {Initializable} from "../proxy/utils/Initializable.sol";

/**
 * @dev Contract module that allows children to implement role-based access
 * control mechanisms. This is a lightweight version that doesn't allow enumerating role
 * members except through off-chain means by accessing the contract event logs. Some
 * applications may benefit from on-chain enumerability, for those cases see
 * {AccessControlEnumerable}.
 *
 * Roles are referred to by their `bytes32` identifier. These should be exposed
 * in the external API and be unique. The best way to achieve this is by
 * using `public constant` hash digests:
 *
 * ```solidity
 * bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
 * ```
 *
 * Roles can be used to represent a set of permissions. To restrict access to a
 * function call, use {hasRole}:
 *
 * ```solidity
 * function foo() public {
 *     require(hasRole(MY_ROLE, msg.sender));
 *     ...
 * }
 * ```
 *
 * Roles can be granted and revoked dynamically via the {grantRole} and
 * {revokeRole} functions. Each role has an associated admin role, and only
 * accounts that have a role's admin role can call {grantRole} and {revokeRole}.
 *
 * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
 * that only accounts with this role will be able to grant or revoke other
 * roles. More complex role relationships can be created by using
 * {_setRoleAdmin}.
 *
 * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
 * grant and revoke this role. Extra precautions should be taken to secure
 * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}
 * to enforce additional security measures for this role.
 */
abstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControl, ERC165Upgradeable {
    struct RoleData {
        mapping(address account => bool) hasRole;
        bytes32 adminRole;
    }

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;


    /// @custom:storage-location erc7201:openzeppelin.storage.AccessControl
    struct AccessControlStorage {
        mapping(bytes32 role => RoleData) _roles;
    }

    // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.AccessControl")) - 1)) & ~bytes32(uint256(0xff))
    bytes32 private constant AccessControlStorageLocation = 0x02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b626800;

    function _getAccessControlStorage() private pure returns (AccessControlStorage storage $) {
        assembly {
            $.slot := AccessControlStorageLocation
        }
    }

    /**
     * @dev Modifier that checks that an account has a specific role. Reverts
     * with an {AccessControlUnauthorizedAccount} error including the required role.
     */
    modifier onlyRole(bytes32 role) {
        _checkRole(role);
        _;
    }

    function __AccessControl_init() internal onlyInitializing {
    }

    function __AccessControl_init_unchained() internal onlyInitializing {
    }
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);
    }

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) public view virtual returns (bool) {
        AccessControlStorage storage $ = _getAccessControlStorage();
        return $._roles[role].hasRole[account];
    }

    /**
     * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()`
     * is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier.
     */
    function _checkRole(bytes32 role) internal view virtual {
        _checkRole(role, _msgSender());
    }

    /**
     * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account`
     * is missing `role`.
     */
    function _checkRole(bytes32 role, address account) internal view virtual {
        if (!hasRole(role, account)) {
            revert AccessControlUnauthorizedAccount(account, role);
        }
    }

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) public view virtual returns (bytes32) {
        AccessControlStorage storage $ = _getAccessControlStorage();
        return $._roles[role].adminRole;
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     *
     * May emit a {RoleGranted} event.
     */
    function grantRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {
        _grantRole(role, account);
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     *
     * May emit a {RoleRevoked} event.
     */
    function revokeRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) {
        _revokeRole(role, account);
    }

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been revoked `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `callerConfirmation`.
     *
     * May emit a {RoleRevoked} event.
     */
    function renounceRole(bytes32 role, address callerConfirmation) public virtual {
        if (callerConfirmation != _msgSender()) {
            revert AccessControlBadConfirmation();
        }

        _revokeRole(role, callerConfirmation);
    }

    /**
     * @dev Sets `adminRole` as ``role``'s admin role.
     *
     * Emits a {RoleAdminChanged} event.
     */
    function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
        AccessControlStorage storage $ = _getAccessControlStorage();
        bytes32 previousAdminRole = getRoleAdmin(role);
        $._roles[role].adminRole = adminRole;
        emit RoleAdminChanged(role, previousAdminRole, adminRole);
    }

    /**
     * @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted.
     *
     * Internal function without access restriction.
     *
     * May emit a {RoleGranted} event.
     */
    function _grantRole(bytes32 role, address account) internal virtual returns (bool) {
        AccessControlStorage storage $ = _getAccessControlStorage();
        if (!hasRole(role, account)) {
            $._roles[role].hasRole[account] = true;
            emit RoleGranted(role, account, _msgSender());
            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Attempts to revoke `role` to `account` and returns a boolean indicating if `role` was revoked.
     *
     * Internal function without access restriction.
     *
     * May emit a {RoleRevoked} event.
     */
    function _revokeRole(bytes32 role, address account) internal virtual returns (bool) {
        AccessControlStorage storage $ = _getAccessControlStorage();
        if (hasRole(role, account)) {
            $._roles[role].hasRole[account] = false;
            emit RoleRevoked(role, account, _msgSender());
            return true;
        } else {
            return false;
        }
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (proxy/utils/Initializable.sol)

pragma solidity ^0.8.20;

/**
 * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
 * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
 * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
 * case an upgrade adds a module that needs to be initialized.
 *
 * For example:
 *
 * [.hljs-theme-light.nopadding]
 * ```solidity
 * contract MyToken is ERC20Upgradeable {
 *     function initialize() initializer public {
 *         __ERC20_init("MyToken", "MTK");
 *     }
 * }
 *
 * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
 *     function initializeV2() reinitializer(2) public {
 *         __ERC20Permit_init("MyToken");
 *     }
 * }
 * ```
 *
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
 *
 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
 *
 * [CAUTION]
 * ====
 * Avoid leaving a contract uninitialized.
 *
 * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
 * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
 * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * /// @custom:oz-upgrades-unsafe-allow constructor
 * constructor() {
 *     _disableInitializers();
 * }
 * ```
 * ====
 */
abstract contract Initializable {
    /**
     * @dev Storage of the initializable contract.
     *
     * It's implemented on a custom ERC-7201 namespace to reduce the risk of storage collisions
     * when using with upgradeable contracts.
     *
     * @custom:storage-location erc7201:openzeppelin.storage.Initializable
     */
    struct InitializableStorage {
        /**
         * @dev Indicates that the contract has been initialized.
         */
        uint64 _initialized;
        /**
         * @dev Indicates that the contract is in the process of being initialized.
         */
        bool _initializing;
    }

    // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Initializable")) - 1)) & ~bytes32(uint256(0xff))
    bytes32 private constant INITIALIZABLE_STORAGE = 0xf0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00;

    /**
     * @dev The contract is already initialized.
     */
    error InvalidInitialization();

    /**
     * @dev The contract is not initializing.
     */
    error NotInitializing();

    /**
     * @dev Triggered when the contract has been initialized or reinitialized.
     */
    event Initialized(uint64 version);

    /**
     * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
     * `onlyInitializing` functions can be used to initialize parent contracts.
     *
     * Similar to `reinitializer(1)`, except that in the context of a constructor an `initializer` may be invoked any
     * number of times. This behavior in the constructor can be useful during testing and is not expected to be used in
     * production.
     *
     * Emits an {Initialized} event.
     */
    modifier initializer() {
        // solhint-disable-next-line var-name-mixedcase
        InitializableStorage storage $ = _getInitializableStorage();

        // Cache values to avoid duplicated sloads
        bool isTopLevelCall = !$._initializing;
        uint64 initialized = $._initialized;

        // Allowed calls:
        // - initialSetup: the contract is not in the initializing state and no previous version was
        //                 initialized
        // - construction: the contract is initialized at version 1 (no reininitialization) and the
        //                 current contract is just being deployed
        bool initialSetup = initialized == 0 && isTopLevelCall;
        bool construction = initialized == 1 && address(this).code.length == 0;

        if (!initialSetup && !construction) {
            revert InvalidInitialization();
        }
        $._initialized = 1;
        if (isTopLevelCall) {
            $._initializing = true;
        }
        _;
        if (isTopLevelCall) {
            $._initializing = false;
            emit Initialized(1);
        }
    }

    /**
     * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
     * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
     * used to initialize parent contracts.
     *
     * A reinitializer may be used after the original initialization step. This is essential to configure modules that
     * are added through upgrades and that require initialization.
     *
     * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
     * cannot be nested. If one is invoked in the context of another, execution will revert.
     *
     * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
     * a contract, executing them in the right order is up to the developer or operator.
     *
     * WARNING: Setting the version to 2**64 - 1 will prevent any future reinitialization.
     *
     * Emits an {Initialized} event.
     */
    modifier reinitializer(uint64 version) {
        // solhint-disable-next-line var-name-mixedcase
        InitializableStorage storage $ = _getInitializableStorage();

        if ($._initializing || $._initialized >= version) {
            revert InvalidInitialization();
        }
        $._initialized = version;
        $._initializing = true;
        _;
        $._initializing = false;
        emit Initialized(version);
    }

    /**
     * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
     * {initializer} and {reinitializer} modifiers, directly or indirectly.
     */
    modifier onlyInitializing() {
        _checkInitializing();
        _;
    }

    /**
     * @dev Reverts if the contract is not in an initializing state. See {onlyInitializing}.
     */
    function _checkInitializing() internal view virtual {
        if (!_isInitializing()) {
            revert NotInitializing();
        }
    }

    /**
     * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
     * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
     * to any version. It is recommended to use this to lock implementation contracts that are designed to be called
     * through proxies.
     *
     * Emits an {Initialized} event the first time it is successfully executed.
     */
    function _disableInitializers() internal virtual {
        // solhint-disable-next-line var-name-mixedcase
        InitializableStorage storage $ = _getInitializableStorage();

        if ($._initializing) {
            revert InvalidInitialization();
        }
        if ($._initialized != type(uint64).max) {
            $._initialized = type(uint64).max;
            emit Initialized(type(uint64).max);
        }
    }

    /**
     * @dev Returns the highest version that has been initialized. See {reinitializer}.
     */
    function _getInitializedVersion() internal view returns (uint64) {
        return _getInitializableStorage()._initialized;
    }

    /**
     * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.
     */
    function _isInitializing() internal view returns (bool) {
        return _getInitializableStorage()._initializing;
    }

    /**
     * @dev Returns a pointer to the storage namespace.
     */
    // solhint-disable-next-line var-name-mixedcase
    function _getInitializableStorage() private pure returns (InitializableStorage storage $) {
        assembly {
            $.slot := INITIALIZABLE_STORAGE
        }
    }
}

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

pragma solidity ^0.8.20;

import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import {ContextUpgradeable} from "../../utils/ContextUpgradeable.sol";
import {IERC20Errors} from "@openzeppelin/contracts/interfaces/draft-IERC6093.sol";
import {Initializable} from "../../proxy/utils/Initializable.sol";

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

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

        uint256 _totalSupply;

        string _name;
        string _symbol;
    }

    // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.ERC20")) - 1)) & ~bytes32(uint256(0xff))
    bytes32 private constant ERC20StorageLocation = 0x52c63247e1f47db19d5ce0460030c497f067ca4cebf71ba98eeadabe20bace00;

    function _getERC20Storage() private pure returns (ERC20Storage storage $) {
        assembly {
            $.slot := ERC20StorageLocation
        }
    }

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

    function __ERC20_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {
        ERC20Storage storage $ = _getERC20Storage();
        $._name = name_;
        $._symbol = symbol_;
    }

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

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

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

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

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

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

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

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

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

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

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

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

        emit Transfer(from, to, value);
    }

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

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

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

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

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

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

pragma solidity ^0.8.20;
import {Initializable} from "../proxy/utils/Initializable.sol";

/**
 * @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 ContextUpgradeable is Initializable {
    function __Context_init() internal onlyInitializing {
    }

    function __Context_init_unchained() internal onlyInitializing {
    }
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

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

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/introspection/ERC165.sol)

pragma solidity ^0.8.20;

import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
import {Initializable} from "../../proxy/utils/Initializable.sol";

/**
 * @dev Implementation of the {IERC165} interface.
 *
 * Contracts that want to implement ERC-165 should inherit from this contract and override {supportsInterface} to check
 * for the additional interface id that will be supported. For example:
 *
 * ```solidity
 * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
 *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
 * }
 * ```
 */
abstract contract ERC165Upgradeable is Initializable, IERC165 {
    function __ERC165_init() internal onlyInitializing {
    }

    function __ERC165_init_unchained() internal onlyInitializing {
    }
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) {
        return interfaceId == type(IERC165).interfaceId;
    }
}

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

pragma solidity ^0.8.20;

import {ContextUpgradeable} from "../utils/ContextUpgradeable.sol";
import {Initializable} from "../proxy/utils/Initializable.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 PausableUpgradeable is Initializable, ContextUpgradeable {
    /// @custom:storage-location erc7201:openzeppelin.storage.Pausable
    struct PausableStorage {
        bool _paused;
    }

    // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Pausable")) - 1)) & ~bytes32(uint256(0xff))
    bytes32 private constant PausableStorageLocation = 0xcd5ed15c6e187e77e9aee88184c21f4f2182ab5827cb3b7e07fbedcd63f03300;

    function _getPausableStorage() private pure returns (PausableStorage storage $) {
        assembly {
            $.slot := PausableStorageLocation
        }
    }

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

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

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

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

    /**
     * @dev Initializes the contract in unpaused state.
     */
    function __Pausable_init() internal onlyInitializing {
        __Pausable_init_unchained();
    }

    function __Pausable_init_unchained() internal onlyInitializing {
        PausableStorage storage $ = _getPausableStorage();
        $._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) {
        PausableStorage storage $ = _getPausableStorage();
        return $._paused;
    }

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

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

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

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

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

pragma solidity ^0.8.20;
import {Initializable} from "../proxy/utils/Initializable.sol";

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 *
 * TIP: If EIP-1153 (transient storage) is available on the chain you're deploying at,
 * consider using {ReentrancyGuardTransient} instead.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
abstract contract ReentrancyGuardUpgradeable is Initializable {
    // 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;

    /// @custom:storage-location erc7201:openzeppelin.storage.ReentrancyGuard
    struct ReentrancyGuardStorage {
        uint256 _status;
    }

    // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.ReentrancyGuard")) - 1)) & ~bytes32(uint256(0xff))
    bytes32 private constant ReentrancyGuardStorageLocation = 0x9b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00;

    function _getReentrancyGuardStorage() private pure returns (ReentrancyGuardStorage storage $) {
        assembly {
            $.slot := ReentrancyGuardStorageLocation
        }
    }

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

    function __ReentrancyGuard_init() internal onlyInitializing {
        __ReentrancyGuard_init_unchained();
    }

    function __ReentrancyGuard_init_unchained() internal onlyInitializing {
        ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage();
        $._status = NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        _nonReentrantBefore();
        _;
        _nonReentrantAfter();
    }

    function _nonReentrantBefore() private {
        ReentrancyGuardStorage storage $ = _getReentrancyGuardStorage();
        // On the first call to nonReentrant, _status will be NOT_ENTERED
        if ($._status == ENTERED) {
            revert ReentrancyGuardReentrantCall();
        }

        // Any calls to nonReentrant after this point will fail
        $._status = ENTERED;
    }

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

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (access/IAccessControl.sol)

pragma solidity ^0.8.20;

/**
 * @dev External interface of AccessControl declared to support ERC-165 detection.
 */
interface IAccessControl {
    /**
     * @dev The `account` is missing a role.
     */
    error AccessControlUnauthorizedAccount(address account, bytes32 neededRole);

    /**
     * @dev The caller of a function is not the expected one.
     *
     * NOTE: Don't confuse with {AccessControlUnauthorizedAccount}.
     */
    error AccessControlBadConfirmation();

    /**
     * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
     *
     * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
     * {RoleAdminChanged} not being emitted signaling this.
     */
    event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);

    /**
     * @dev Emitted when `account` is granted `role`.
     *
     * `sender` is the account that originated the contract call. This account bears the admin role (for the granted role).
     * Expected in cases where the role was granted using the internal {AccessControl-_grantRole}.
     */
    event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Emitted when `account` is revoked `role`.
     *
     * `sender` is the account that originated the contract call:
     *   - if using `revokeRole`, it is the admin role bearer
     *   - if using `renounceRole`, it is the role bearer (i.e. `account`)
     */
    event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) external view returns (bool);

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {AccessControl-_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) external view returns (bytes32);

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function grantRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function revokeRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been granted `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `callerConfirmation`.
     */
    function renounceRole(bytes32 role, address callerConfirmation) external;
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.20;

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

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

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

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

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

pragma solidity ^0.8.20;

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

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

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

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

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

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

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

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/introspection/IERC165.sol)

pragma solidity ^0.8.20;

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

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

interface IAllStarsStaking {
    
    /**
     * @notice Represents a staking game
     * @param startBlock The block number when the game starts
     * @param endBlock The block number when the game ends
     * @param gameBlocks The block number for the game at the start
     * @param rewardAmount The amount of reward assigned for the game 
     * @param lastStakedToken The address of the token most recently staked in the game
     * @param stakeTokenSequence The sequence of staked token in sorted order
     * @param allowedTokens The addresses of allowed tokens for the game
     */
    struct Game {
        uint256 startBlock;
        uint256 endBlock;
        uint256 gameBlocks;
        uint256 rewardAmount;
        address creator;
        address lastStakedToken;
        address[] stakeTokenSequence;
        address[] allowedTokens;
        bool claimed;
    }

    /**
     * @notice Emitted when a new game is created
     * @param gameId The ID of the newly created game
     * @param startBlock The starting block of the game
     * @param endBlock The ending block of the game
     * @param rewardAmount The amount of reward in STAR tokens
     */
    event NewGameCreated(uint256 gameId, uint256 startBlock, uint256 endBlock, uint256 rewardAmount);

    /**
     * @notice Emitted when a user stakes tokens in a game
     * @param gameId The ID of the game
     * @param user The address of the user who staked
     * @param token The address of the token staked
     * @param amount The amount of tokens staked
     */
    event StakedInGame(uint256 gameId, address user, address token, uint256 amount);

    /**
     * @notice Emitted when a reward is claimed by a user
     * @param gameId The ID of the game
     * @param user The address of the user claiming the reward
     * @param rewardAmount The amount of reward in STAR tokens
     */
    event GameRewardClaimed(uint256 gameId, address user, uint256 rewardAmount);

    /**
     * @notice Emitted when a factor for the games are updated
     * @param newReductionFactor The new reduction factor for the end block
     * @param newIncreaseFactor The new increase factor for the end block
     * @param newDifferenceFactor The new difference factor for the end block
     */
    event FactorsUpdated(uint256 newReductionFactor, uint256 newIncreaseFactor, uint256 newDifferenceFactor);

    /**
     * @notice Emitted when a game is ended by admin
     * @param gameId The ID of the game
     */
    event GameEnded(uint256 gameId);

    /**
     * @notice Emitted when the allowed tokens list is updated
     * @param newAllowedTokens The new list of allowed tokens
     */
    event AllowedTokensUpdated(address[] newAllowedTokens);

    /**
     * @notice Emitted when reward claim deadline block no is updated.
     * @param by Admin address who updated the value
     * @param oldDeadline The previous deadline block no
     * @param newDeadline The new deadline block no
     * @param timestamp Time at which the value was updated. 
     */
    event RewardClaimDeadlineBlocksUpdated(address indexed by, uint256 oldDeadline, uint256 newDeadline, uint256 timestamp);
    
    /**
     * @notice Emitted when admin withdraws tokens from the contract.
     * @param by Address of the admin who did the withdrawal.
     * @param token Address of token withdrawn.
     * @param amount Amount of token withdrawn
     * @param timestamp Time at which withdrawal was done.
     */
    event AdminTokenWithdrawal(address indexed by, address indexed token, uint256 amount, uint256 timestamp);
    
    /**
     * @notice Creates a new lastMemeStanding game
     * @param startBlock The block number when the game starts
     * @param endBlock The block number when the game ends
     * @param rewardPoolAmount The reward amount for the game in star tokens
     */
    function createNewGame(uint256 startBlock, uint256 endBlock, uint256 rewardPoolAmount) external;

    /**
     * @notice Allows users to stake tokens to a game
     * @param gameId The ID of the game in which to stake
     * @param token The address of the token to stake
     * @param amount The amount of tokens to stake
     */
    function stakeInGame(uint256 gameId, address token, uint256 amount) external;
    
    /**
     * @notice Allows users to claim rewards for staking on the winning token
     * @param gameId The ID of the phase for which the reward is claimed
     */
    function claimAllGameRewards(uint256 gameId) external;

    /**
     * @notice Updates the reduction and increase factors for staking mechanics
     * @param newCountdownReductionFactor The new reduction factor for the end block
     * @param newFinalGameFactor The new increase factor for the end block
     * @param newFinalResetFactor The new difference factor for the end block
     */
    function updateGameFactors(uint256 newCountdownReductionFactor, uint256 newFinalGameFactor, uint256 newFinalResetFactor) external;    
    
    /**
     * @notice Allows admin to end game if no one has staked
     * @param gameId The ID of the game to end
     */
    function endGame(uint256 gameId) external;

    /**
     * @notice Updates the allowed tokens array to be used in the next game
     * @param newAllowedTokens_ The new list of allowed tokens for staking
     */
    function updateAllowedTokens(address[] memory newAllowedTokens_) external;

    /**
     * @notice Function to update rewardClaimDeadlineBlocks no.
     * @param _deadlineBlocks No of blocks after a game's end, after which rewards will not be given.
     */
    function updateRewardClaimDeadlineBlocks(uint256 _deadlineBlocks) external;

    /**
     * @notice Function for admin to withdraw tokens from the contract.
     * @param _token Address of token to withdraw.
     * @param _amount Token amount to withdraw.
     */
    function withdrawTokens(address _token, uint256 _amount) external;
}

Settings
{
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "metadata": {
    "bytecodeHash": "none"
  },
  "evmVersion": "paris",
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  }
}

Contract Security Audit

Contract ABI

API
[{"inputs":[],"name":"AccessControlBadConfirmation","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bytes32","name":"neededRole","type":"bytes32"}],"name":"AccessControlUnauthorizedAccount","type":"error"},{"inputs":[],"name":"EnforcedPause","type":"error"},{"inputs":[],"name":"ExpectedPause","type":"error"},{"inputs":[],"name":"InvalidInitialization","type":"error"},{"inputs":[],"name":"NotInitializing","type":"error"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"by","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"AdminTokenWithdrawal","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address[]","name":"newAllowedTokens","type":"address[]"}],"name":"AllowedTokensUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newReductionFactor","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newIncreaseFactor","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newDifferenceFactor","type":"uint256"}],"name":"FactorsUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"gameId","type":"uint256"}],"name":"GameEnded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"gameId","type":"uint256"},{"indexed":false,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"rewardAmount","type":"uint256"}],"name":"GameRewardClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint64","name":"version","type":"uint64"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"gameId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"startBlock","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"endBlock","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"rewardAmount","type":"uint256"}],"name":"NewGameCreated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"by","type":"address"},{"indexed":false,"internalType":"uint256","name":"oldDeadline","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newDeadline","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"RewardClaimDeadlineBlocksUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"gameId","type":"uint256"},{"indexed":false,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"StakedInGame","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"allowedTokens","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"gameId","type":"uint256"}],"name":"claimAllGameRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"countdownReductionFactor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"startBlock","type":"uint256"},{"internalType":"uint256","name":"endBlock","type":"uint256"},{"internalType":"uint256","name":"rewardPoolAmount","type":"uint256"}],"name":"createNewGame","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"gameId","type":"uint256"}],"name":"endGame","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"finalGameFactor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"finalResetFactor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"gameIdCounter","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"gameId","type":"uint256"}],"name":"getGameDetails","outputs":[{"components":[{"internalType":"uint256","name":"startBlock","type":"uint256"},{"internalType":"uint256","name":"endBlock","type":"uint256"},{"internalType":"uint256","name":"gameBlocks","type":"uint256"},{"internalType":"uint256","name":"rewardAmount","type":"uint256"},{"internalType":"address","name":"creator","type":"address"},{"internalType":"address","name":"lastStakedToken","type":"address"},{"internalType":"address[]","name":"stakeTokenSequence","type":"address[]"},{"internalType":"address[]","name":"allowedTokens","type":"address[]"},{"internalType":"bool","name":"claimed","type":"bool"}],"internalType":"struct IAllStarsStaking.Game","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"gameId","type":"uint256"},{"internalType":"address","name":"user","type":"address"}],"name":"getUserDetails","outputs":[{"internalType":"address[]","name":"","type":"address[]"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"gameId","type":"uint256"},{"internalType":"address","name":"user","type":"address"}],"name":"getUserRewards","outputs":[{"internalType":"uint256","name":"reward","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"starToken_","type":"address"},{"internalType":"address","name":"adminAddress","type":"address"},{"internalType":"address[]","name":"allowedTokens_","type":"address[]"},{"internalType":"uint256","name":"countdownReductionFactor_","type":"uint256"},{"internalType":"uint256","name":"finalGameFactor_","type":"uint256"},{"internalType":"uint256","name":"finalResetFactor_","type":"uint256"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","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":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"callerConfirmation","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rewardClaimDeadlineBlocks","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"name":"rewardsClaimed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"startBlock","type":"uint256"},{"internalType":"uint256","name":"endBlock","type":"uint256"},{"internalType":"uint256","name":"gameBlocks","type":"uint256"},{"internalType":"uint256","name":"rewardAmount","type":"uint256"},{"internalType":"address","name":"creator","type":"address"},{"internalType":"address","name":"lastStakedToken","type":"address"},{"internalType":"address[]","name":"stakeTokenSequence","type":"address[]"},{"internalType":"address[]","name":"allowedTokens","type":"address[]"},{"internalType":"bool","name":"claimed","type":"bool"}],"internalType":"struct IAllStarsStaking.Game[]","name":"_games","type":"tuple[]"}],"name":"seedGamesData","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_gameIds","type":"uint256[]"},{"internalType":"address[][]","name":"_users","type":"address[][]"}],"name":"seedRewardsClaimedData","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_gameIds","type":"uint256[]"},{"internalType":"address[][]","name":"_users","type":"address[][]"},{"internalType":"address[][][]","name":"_tokens","type":"address[][][]"},{"internalType":"uint256[][][]","name":"_amounts","type":"uint256[][][]"}],"name":"seedStakesData","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_gameIds","type":"uint256[]"},{"internalType":"address[][]","name":"_tokens","type":"address[][]"},{"internalType":"uint256[][]","name":"_amounts","type":"uint256[][]"}],"name":"seedTotalGameStakesData","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_gameIds","type":"uint256[]"},{"internalType":"address[][]","name":"_users","type":"address[][]"},{"internalType":"address[][][]","name":"_tokens","type":"address[][][]"}],"name":"seedUserStakedTokensData","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"gameId","type":"uint256"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"stakeInGame","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"stakes","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"starToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"}],"name":"totalGameStakes","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"newAllowedTokens_","type":"address[]"}],"name":"updateAllowedTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newCountdownReductionFactor","type":"uint256"},{"internalType":"uint256","name":"newFinalGameFactor","type":"uint256"},{"internalType":"uint256","name":"newFinalResetFactor","type":"uint256"}],"name":"updateGameFactors","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_gameId","type":"uint256"},{"internalType":"uint256","name":"_amountToAdd","type":"uint256"}],"name":"updateGameRewardAmount","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_deadlineBlocks","type":"uint256"}],"name":"updateRewardClaimDeadlineBlocks","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"userStakedTokens","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdrawTokens","outputs":[],"stateMutability":"nonpayable","type":"function"}]

608060405234801561001057600080fd5b506141d3806100206000396000f3fe608060405234801561001057600080fd5b50600436106102485760003560e01c806391d148541161013b578063d0399bb8116100b8578063ee22aecb1161007c578063ee22aecb14610546578063f45961fa14610559578063f73541691461056c578063fb6990391461057f578063fdeef4251461059257600080fd5b8063d0399bb8146104cf578063d53f1c02146104e2578063d547741f146104f5578063e7bfc3f714610508578063eb3ea7621461053357600080fd5b8063b7ca51e8116100ff578063b7ca51e814610443578063bebb720114610456578063c6e20ac014610487578063c79c213d1461049a578063c90902cb146104ad57600080fd5b806391d14854146103de5780639a835e91146103f15780639a8891061461041f578063a217fddf14610432578063b41140fd1461043a57600080fd5b80633f4ba83a116101c957806360bd38051161018d57806360bd38051461037057806371c57f551461039b57806375b238fc146103ae5780638456cb59146103c35780638a8b6001146103cb57600080fd5b80633f4ba83a1461031f57806345abba05146103275780635284d6d01461033a5780635c975abb1461034f5780635e3689841461036757600080fd5b80631be819ac116102105780631be819ac146102ca578063248a9ca3146102dd5780632a6c1325146102f05780632f2ff15d146102f957806336568abe1461030c57600080fd5b806301ffc9a71461024d57806303a2c10e1461027557806306b091f91461028c5780631b31abda146102a15780631bb412d6146102c1575b600080fd5b61026061025b3660046135c6565b6105a5565b60405190151581526020015b60405180910390f35b61027e600b5481565b60405190815260200161026c565b61029f61029a36600461361c565b6105dc565b005b6102b46102af366004613648565b61078a565b60405161026c91906136a5565b61027e60015481565b61029f6102d8366004613798565b610920565b61027e6102eb366004613648565b610a82565b61027e60025481565b61029f6103073660046137d9565b610aa4565b61029f61031a3660046137d9565b610ac6565b61029f610afe565b61029f610335366004613809565b610b21565b610342610ed1565b60405161026c91906138cc565b6000805160206141678339815191525460ff16610260565b61027e60035481565b61038361037e3660046138df565b610f33565b6040516001600160a01b03909116815260200161026c565b61029f6103a9366004613917565b610f78565b61027e6000805160206141a783398151915281565b61029f611156565b61029f6103d93660046139b0565b611176565b6102606103ec3660046137d9565b6112c4565b6102606103ff3660046137d9565b600760209081526000928352604080842090915290825290205460ff1681565b61029f61042d366004613a93565b6112fc565b61027e600081565b61027e60045481565b600054610383906001600160a01b031681565b61027e610464366004613acf565b600a60209081526000938452604080852082529284528284209052825290205481565b61029f610495366004613b11565b611384565b61029f6104a8366004613648565b61149b565b6104c06104bb3660046137d9565b611948565b60405161026c93929190613bac565b61029f6104dd366004613648565b611b64565b61029f6104f0366004613bef565b611d8f565b61029f6105033660046137d9565b611e98565b61027e6105163660046137d9565b600960209081526000928352604080842090915290825290205481565b61029f610541366004613917565b611eb4565b61029f610554366004613648565b612072565b61029f6105673660046139b0565b6120d9565b61029f61057a366004613c11565b612482565b61029f61058d3660046138df565b612719565b61027e6105a03660046137d9565b612cde565b60006001600160e01b03198216637965db0b60e01b14806105d657506301ffc9a760e01b6001600160e01b03198316145b92915050565b6000805160206141a78339815191526105f481612dc7565b6040516370a0823160e01b8152306004820152839083906001600160a01b038316906370a0823190602401602060405180830381865afa15801561063c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106609190613c8e565b10156106ab5760405162461bcd60e51b815260206004820152601560248201527424b739bab33334b1b4b2b73a102130b630b731b29760591b60448201526064015b60405180910390fd5b60405163a9059cbb60e01b8152336004820152602481018490526000906001600160a01b0383169063a9059cbb906044016020604051808303816000875af11580156106fb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061071f9190613cb5565b90508061073e5760405162461bcd60e51b81526004016106a290613cd2565b604080518581524260208201526001600160a01b0387169133917f378e13210ce3efd180440b5d05b47d60b421a8e0e8076762aabd0ce93a5e15fd910160405180910390a35050505050565b6107ed6040518061012001604052806000815260200160008152602001600081526020016000815260200160006001600160a01b0316815260200160006001600160a01b0316815260200160608152602001606081526020016000151581525090565b600082815260066020818152604092839020835161012081018552815481526001820154818401526002820154818601526003820154606082015260048201546001600160a01b03908116608083015260058301541660a082015292810180548551818502810185019096528086529394919360c086019383018282801561089e57602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610880575b505050505081526020016007820180548060200260200160405190810160405280929190818152602001828054801561090057602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116108e2575b50505091835250506008919091015460ff16151560209091015292915050565b600061092b81612dc7565b60018290558160005b81811015610a7b573685858381811061094f5761094f613d18565b90506020028101906109619190613d2e565b90506000600681610973856001613d65565b815260208082019290925260409081016000208435815591840135600183015583013560028201556060830135600382015590506109b760a0830160808401613d78565b6004820180546001600160a01b0319166001600160a01b03929092169190911790556109e960c0830160a08401613d78565b6005820180546001600160a01b0319166001600160a01b0392909216919091179055610a1860c0830183613d95565b610a2691600684019161349b565b50610a3460e0830183613d95565b610a4291600784019161349b565b50610a5561012083016101008401613dde565b600891909101805460ff191691151591909117905550610a7481613dfb565b9050610934565b5050505050565b6000908152600080516020614147833981519152602052604090206001015490565b610aad82610a82565b610ab681612dc7565b610ac08383612dd1565b50505050565b6001600160a01b0381163314610aef5760405163334bd91960e11b815260040160405180910390fd5b610af98282612e76565b505050565b6000805160206141a7833981519152610b1681612dc7565b610b1e612ef2565b50565b6000610b2c81612dc7565b8786148015610b3a57508784145b8015610b4557508782145b610b615760405162461bcd60e51b81526004016106a290613e14565b60005b88811015610ec557858582818110610b7e57610b7e613d18565b9050602002810190610b909190613d95565b9050888883818110610ba457610ba4613d18565b9050602002810190610bb69190613d95565b9050148015610c0e5750838382818110610bd257610bd2613d18565b9050602002810190610be49190613d95565b9050888883818110610bf857610bf8613d18565b9050602002810190610c0a9190613d95565b9050145b610c2a5760405162461bcd60e51b81526004016106a290613e14565b60005b888883818110610c3f57610c3f613d18565b9050602002810190610c519190613d95565b9050811015610eb4576000878784818110610c6e57610c6e613d18565b9050602002810190610c809190613d95565b83818110610c9057610c90613d18565b9050602002810190610ca29190613d95565b90509050858584818110610cb857610cb8613d18565b9050602002810190610cca9190613d95565b83818110610cda57610cda613d18565b9050602002810190610cec9190613d95565b90508114610d0c5760405162461bcd60e51b81526004016106a290613e14565b60005b81811015610ea157868685818110610d2957610d29613d18565b9050602002810190610d3b9190613d95565b84818110610d4b57610d4b613d18565b9050602002810190610d5d9190613d95565b82818110610d6d57610d6d613d18565b90506020020135600a60008f8f88818110610d8a57610d8a613d18565b90506020020135815260200190815260200160002060008d8d88818110610db357610db3613d18565b9050602002810190610dc59190613d95565b87818110610dd557610dd5613d18565b9050602002016020810190610dea9190613d78565b6001600160a01b03166001600160a01b0316815260200190815260200160002060008b8b88818110610e1e57610e1e613d18565b9050602002810190610e309190613d95565b87818110610e4057610e40613d18565b9050602002810190610e529190613d95565b85818110610e6257610e62613d18565b9050602002016020810190610e779190613d78565b6001600160a01b03168152602081019190915260400160002055610e9a81613dfb565b9050610d0f565b505080610ead90613dfb565b9050610c2d565b50610ebe81613dfb565b9050610b64565b50505050505050505050565b60606005805480602002602001604051908101604052809291908181526020018280548015610f2957602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610f0b575b5050505050905090565b60086020528260005260406000206020528160005260406000208181548110610f5b57600080fd5b6000918252602090912001546001600160a01b0316925083915050565b6000610f8381612dc7565b858481148015610f9257508083145b610fae5760405162461bcd60e51b81526004016106a290613e14565b60005b8181101561114b576000898983818110610fcd57610fcd613d18565b905060200201359050858583818110610fe857610fe8613d18565b9050602002810190610ffa9190613d95565b905088888481811061100e5761100e613d18565b90506020028101906110209190613d95565b90501461103f5760405162461bcd60e51b81526004016106a290613e14565b600088888481811061105357611053613d18565b90506020028101906110659190613d95565b9050905060005b818110156111375787878581811061108657611086613d18565b90506020028101906110989190613d95565b828181106110a8576110a8613d18565b905060200201356009600085815260200190815260200160002060008c8c888181106110d6576110d6613d18565b90506020028101906110e89190613d95565b858181106110f8576110f8613d18565b905060200201602081019061110d9190613d78565b6001600160a01b0316815260208101919091526040016000205561113081613dfb565b905061106c565b5050508061114490613dfb565b9050610fb1565b505050505050505050565b6000805160206141a783398151915261116e81612dc7565b610b1e612f52565b61117e612f9b565b6000805160206141a783398151915261119681612dc7565b600084116111b65760405162461bcd60e51b81526004016106a290613e41565b600083116111d65760405162461bcd60e51b81526004016106a290613e9e565b600082116111f65760405162461bcd60e51b81526004016106a290613efb565b6002548414158061120957506003548314155b8061121657506004548214155b61126e5760405162461bcd60e51b815260206004820152602360248201527f416c6c53746172735374616b696e673a204e6f20666163746f7273206368616e60448201526219d95960ea1b60648201526084016106a2565b60028490556003839055600482905560408051858152602081018590529081018390527f6bf041f5e85f1e30b186a46afad10d1097cffac11d670c0bc688ce01e67039119060600160405180910390a150505050565b6000918252600080516020614147833981519152602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6000805160206141a783398151915261131481612dc7565b8151806113335760405162461bcd60e51b81526004016106a290613f58565b82516113469060059060208601906134fe565b507f80cf834692f79dc85e731aea9ee1788c7c7cca8fd087d25a7b0b885beff51c4160056040516113779190613fa3565b60405180910390a1505050565b600061138f81612dc7565b838281146113af5760405162461bcd60e51b81526004016106a290613e14565b60005b818110156114925760008787838181106113ce576113ce613d18565b9050602002013590503660008787858181106113ec576113ec613d18565b90506020028101906113fe9190613d95565b9150915060005b8181101561147d57600084815260076020526040812060019185858581811061143057611430613d18565b90506020020160208101906114459190613d78565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905561147681613dfb565b9050611405565b505050508061148b90613dfb565b90506113b2565b50505050505050565b6114a3612fce565b6114ab612f9b565b6001548111156114cd5760405162461bcd60e51b81526004016106a290613ff3565b60008181526006602052604090206001015443116114fd5760405162461bcd60e51b81526004016106a29061403a565b600081815260076020908152604080832033845290915290205460ff16156115375760405162461bcd60e51b81526004016106a29061407d565b6000818152600660209081526040808320600581015460039091015460088452828520338652845282852080548451818702810187019095528085526001600160a01b039093169591949193849390928301828280156115c057602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116115a2575b505083519394505050811515905061162d5760405162461bcd60e51b815260206004820152602a60248201527f416c6c53746172735374616b696e673a204e6f207374616b656420746f6b656e6044820152697320746f20636c61696d60b01b60648201526084016106a2565b60008681526007602090815260408083203384529091528120805460ff191660011790555b818110156117e057600083828151811061166e5761166e613d18565b602002602001015190506000600a60008a815260200190815260200160002060006116963390565b6001600160a01b0390811682526020808301939093526040918201600090812091861681529252902054905080156117cb57876001600160a01b0316826001600160a01b0316036117275760008981526009602090815260408083206001600160a01b03861684529091529020548061170f838a6140c4565b61171991906140db565b6117239088613d65565b9650505b60006001600160a01b03831663a9059cbb336040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602481018590526044016020604051808303816000875af1158015611786573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117aa9190613cb5565b9050806117c95760405162461bcd60e51b81526004016106a290613cd2565b505b505080806117d890613dfb565b915050611652565b506000868152600860209081526040808320338452909152812061180391613553565b6000600b54600014806118335750600b5460008881526006602052604090206001015461183090436140fd565b11155b90506000841180156118425750805b1561192b57600080546001600160a01b031663a9059cbb336040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602481018890526044016020604051808303816000875af11580156118a7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118cb9190613cb5565b9050806118ea5760405162461bcd60e51b81526004016106a290613cd2565b6040805189815233602082015280820187905290517f88758f5bf10e78eb94f15a42685e01984f79397c9c30c4dda0a916e028bc6ca69181900360600190a1505b505050505050610b1e600160008051602061418783398151915255565b60008281526006602052604081206007015460609182918291816001600160401b03811115611979576119796139dc565b6040519080825280602002602001820160405280156119a2578160200160208202803683370190505b5090506000826001600160401b038111156119bf576119bf6139dc565b6040519080825280602002602001820160405280156119e8578160200160208202803683370190505b5090506000836001600160401b03811115611a0557611a056139dc565b604051908082528060200260200182016040528015611a2e578160200160208202803683370190505b50905060005b848160ff161015611b545760008a8152600660205260408120600701805460ff8416908110611a6557611a65613d18565b9060005260206000200160009054906101000a90046001600160a01b0316905080858360ff1681518110611a9b57611a9b613d18565b6001600160a01b0392831660209182029290920181019190915260008d815260098252604080822093851682529290915220548451859060ff8516908110611ae557611ae5613d18565b60209081029190910181019190915260008c8152600a825260408082206001600160a01b03808f168452908452818320908516835290925220548351849060ff8516908110611b3657611b36613d18565b60209081029190910101525080611b4c81614110565b915050611a34565b5091955093509150509250925092565b611b6c612fce565b611b74612f9b565b6000805160206141a7833981519152611b8c81612dc7565b600154821115611bae5760405162461bcd60e51b81526004016106a290613ff3565b6000828152600660205260409020600101544311611bde5760405162461bcd60e51b81526004016106a29061403a565b6000828152600660205260409020600501546001600160a01b031615611c525760405162461bcd60e51b815260206004820152602360248201527f416c6c53746172735374616b696e673a2055736572207374616b696e672065786044820152621a5cdd60ea1b60648201526084016106a2565b60008281526006602052604090206008015460ff1615611c845760405162461bcd60e51b81526004016106a29061407d565b60008281526006602052604080822060088101805460ff191660011790558254600480830154600390930154935163a9059cbb60e01b81526001600160a01b03938416918101919091526024810193909352169063a9059cbb906044016020604051808303816000875af1158015611d00573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d249190613cb5565b905080611d435760405162461bcd60e51b81526004016106a290613cd2565b6040518381527fce24807f7e4b60b4e641462f13029fa5e5f79075bbc3f8e5cd43ecd19661d7609060200160405180910390a15050610b1e600160008051602061418783398151915255565b6000805160206141a7833981519152611da781612dc7565b600154831115611dc95760405162461bcd60e51b81526004016106a290613ff3565b60008381526006602052604081206003018054849290611dea908490613d65565b9091555050600080546001600160a01b03166323b872dd336040516001600160e01b031960e084901b1681526001600160a01b039091166004820152306024820152604481018690526064016020604051808303816000875af1158015611e55573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e799190613cb5565b905080610ac05760405162461bcd60e51b81526004016106a290613cd2565b611ea182610a82565b611eaa81612dc7565b610ac08383612e76565b6000611ebf81612dc7565b858481148015611ece57508083145b611eea5760405162461bcd60e51b81526004016106a290613e14565b60005b8181101561114b576000898983818110611f0957611f09613d18565b9050602002013590506000888884818110611f2657611f26613d18565b9050602002810190611f389190613d95565b90509050868684818110611f4e57611f4e613d18565b9050602002810190611f609190613d95565b90508114611f805760405162461bcd60e51b81526004016106a290613e14565b60005b8181101561205e57878785818110611f9d57611f9d613d18565b9050602002810190611faf9190613d95565b82818110611fbf57611fbf613d18565b9050602002810190611fd19190613d95565b6000858152600860205260408120908d8d89818110611ff257611ff2613d18565b90506020028101906120049190613d95565b8681811061201457612014613d18565b90506020020160208101906120299190613d78565b6001600160a01b03168152602081019190915260400160002061204d92909161349b565b5061205781613dfb565b9050611f83565b5050508061206b90613dfb565b9050611eed565b6000805160206141a783398151915261208a81612dc7565b600b80549083905560408051828152602081018590524281830152905133917fc7a194484723d46abbca95fca9194ecfd3ab2b695107e69e6ec3556518c2d068919081900360600190a2505050565b6120e1612f9b565b6000805160206141a78339815191526120f981612dc7565b83831161216e5760405162461bcd60e51b815260206004820152603b60248201527f416c6c53746172735374616b696e673a20456e6420626c6f636b206d7573742060448201527f62652067726561746572207468616e20737461727420626c6f636b000000000060648201526084016106a2565b4384116121e35760405162461bcd60e51b815260206004820152603f60248201527f416c6c53746172735374616b696e673a20537461727420626c6f636b206d757360448201527f742062652067726561746572207468616e2063757272656e7420626c6f636b0060648201526084016106a2565b600082116122595760405162461bcd60e51b815260206004820152603860248201527f416c6c53746172735374616b696e673a2052657761726420616d6f756e74206d60448201527f7573742062652067726561746572207468616e207a65726f000000000000000060648201526084016106a2565b6001805490600061226983613dfb565b91905055506001805411156122f857600660006001805461228a91906140fd565b81526020019081526020016000206001015443116122f85760405162461bcd60e51b815260206004820152602560248201527f416c6c53746172735374616b696e673a2047616d6520616c72656164792072756044820152646e6e696e6760d81b60648201526084016106a2565b60018054600090815260066020526040808220879055825482528082208301869055915481522060030182905561232f84846140fd565b6001805460009081526006602052604080822060020193909355905481522060058054612360926007019190613571565b5033600154600090815260066020526040812060040180546001600160a01b0319166001600160a01b0393841617905580549091166323b872dd336040516001600160e01b031960e084901b1681526001600160a01b039091166004820152306024820152604481018690526064016020604051808303816000875af11580156123ee573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124129190613cb5565b9050806124315760405162461bcd60e51b81526004016106a290613cd2565b60015460408051918252602082018790528101859052606081018490527fa04fad86c120eb1a6f69e15fd3adfcfbed0b2f9128a2edb7c324bfcd7502d4a29060800160405180910390a15050505050565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a008054600160401b810460ff1615906001600160401b03166000811580156124c75750825b90506000826001600160401b031660011480156124e35750303b155b9050811580156124f1575080155b1561250f5760405163f92ee8a960e01b815260040160405180910390fd5b845467ffffffffffffffff19166001178555831561253957845460ff60401b1916600160401b1785555b600088116125595760405162461bcd60e51b81526004016106a290613e41565b600087116125795760405162461bcd60e51b81526004016106a290613e9e565b600086116125995760405162461bcd60e51b81526004016106a290613efb565b6001600160a01b038b16158015906125b957506001600160a01b038a1615155b61262b5760405162461bcd60e51b815260206004820152603e60248201527f416c6c53746172735374616b696e673a205a65726f206164647265737320707260448201527f6f766964656420666f72205354415220746f6b656e206f722061646d696e000060648201526084016106a2565b88518061264a5760405162461bcd60e51b81526004016106a290613f58565b61265261301a565b61265a613022565b612662613032565b600080546001600160a01b0319166001600160a01b038e1617905589516126909060059060208d01906134fe565b506002899055600388905560048790556126ab60008c612dd1565b506126c46000805160206141a78339815191528c612dd1565b5050831561270c57845460ff60401b19168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b5050505050505050505050565b612721612fce565b612729612f9b565b60015483111561274b5760405162461bcd60e51b81526004016106a290613ff3565b6001600160a01b0382166127b05760405162461bcd60e51b815260206004820152602660248201527f416c6c53746172735374616b696e673a20546f6b656e206973207a65726f206160448201526564647265737360d01b60648201526084016106a2565b600081116128265760405162461bcd60e51b815260206004820152603760248201527f416c6c53746172735374616b696e673a205374616b6520616d6f756e74206d7560448201527f73742062652067726561746572207468616e207a65726f00000000000000000060648201526084016106a2565b6128308383613042565b61288a5760405162461bcd60e51b815260206004820152602560248201527f416c6c53746172735374616b696e673a20546f6b656e206973206e6f7420616c6044820152641b1bddd95960da1b60648201526084016106a2565b6000838152600660208181526040808420815161012081018352815481526001820154818501526002820154818401526003820154606082015260048201546001600160a01b03908116608083015260058301541660a08201529381018054835181860281018601909452808452919360c0860193929083018282801561293a57602002820191906000526020600020905b81546001600160a01b0316815260019091019060200180831161291c575b505050505081526020016007820180548060200260200160405190810160405280929190818152602001828054801561299c57602002820191906000526020600020905b81546001600160a01b0316815260019091019060200180831161297e575b50505091835250506008919091015460ff1615156020909101528051909150431015612a1c5760405162461bcd60e51b815260206004820152602960248201527f416c6c53746172735374616b696e673a2047616d6520686173206e6f74207374604482015268185c9d1959081e595d60ba1b60648201526084016106a2565b8060200151431115612a705760405162461bcd60e51b815260206004820152601f60248201527f416c6c53746172735374616b696e673a2047616d652068617320656e6465640060448201526064016106a2565b60a08101516001600160a01b03161580612aba5750826001600160a01b03168160c00151600081518110612aa657612aa6613d18565b60200260200101516001600160a01b031614155b15612ae7576004548151602083015160009291612ad6916140fd565b11159050612ae58585836130d5565b505b6000848152600a6020908152604080832033845282528083206001600160a01b03871684529091528120549003612b5857600084815260086020908152604080832033845282528220805460018101825590835291200180546001600160a01b0319166001600160a01b0385161790555b6000848152600a6020908152604080832033845282528083206001600160a01b038716845290915281208054849290612b92908490613d65565b909155505060008481526009602090815260408083206001600160a01b038716845290915281208054849290612bc9908490613d65565b90915550600090506001600160a01b0384166323b872dd336040516001600160e01b031960e084901b1681526001600160a01b039091166004820152306024820152604481018690526064016020604051808303816000875af1158015612c34573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c589190613cb5565b905080612c775760405162461bcd60e51b81526004016106a290613cd2565b604080518681523360208201526001600160a01b038616818301526060810185905290517f434a63ea912bd33d203a14946f16bca79601eaa5c0974c4756ca6a036641084e9181900360800190a15050610af9600160008051602061418783398151915255565b6000600154831115612d025760405162461bcd60e51b81526004016106a290613ff3565b6000838152600660205260409020600101544311612d325760405162461bcd60e51b81526004016106a29061403a565b600083815260066020908152604080832060050154600a83528184206001600160a01b03878116865290845282852091168085529252909120548015612dbf5760008581526009602090815260408083206001600160a01b03861684528252808320548884526006909252909120600301548190612db19084906140c4565b612dbb91906140db565b9350505b505092915050565b610b1e81336133bc565b6000600080516020614147833981519152612dec84846112c4565b612e6c576000848152602082815260408083206001600160a01b03871684529091529020805460ff19166001179055612e223390565b6001600160a01b0316836001600160a01b0316857f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a460019150506105d6565b60009150506105d6565b6000600080516020614147833981519152612e9184846112c4565b15612e6c576000848152602082815260408083206001600160a01b0387168085529252808320805460ff1916905551339287917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a460019150506105d6565b612efa6133f9565b600080516020614167833981519152805460ff191681557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a150565b612f5a612f9b565b600080516020614167833981519152805460ff191660011781557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25833612f34565b6000805160206141678339815191525460ff1615612fcc5760405163d93c066560e01b815260040160405180910390fd5b565b60008051602061418783398151915280546001190161300057604051633ee5aeb560e01b815260040160405180910390fd5b60029055565b600160008051602061418783398151915255565b612fcc613429565b61302a613429565b612fcc613472565b61303a613429565b612fcc613493565b600082815260066020526040812060070154815b818160ff1610156130ca57600085815260066020526040902060070180546001600160a01b038616919060ff841690811061309357613093613d18565b6000918252602090912001546001600160a01b0316036130b8576001925050506105d6565b806130c281614110565b915050613056565b506000949350505050565b600083815260066020526040812082156130fd576003546130f69043613d65565b9150613128565b6002548154600183015461311191906140fd565b61311b91906140fd565b6131259043613d65565b91505b6005810180546001600160a01b0319166001600160a01b0386161790556001810182905543815560068101546000908190815b818110156131ba57876001600160a01b031685600601828154811061318257613182613d18565b6000918252602090912001546001600160a01b0316036131a857600193508092506131ba565b806131b281613dfb565b91505061315b565b50826132db576006840180546001808201835560008381526020812090920180546001600160a01b0319166001600160a01b038c16179055915490916131ff916140fd565b90505b801561329057600685016132176001836140fd565b8154811061322757613227613d18565b6000918252602090912001546006860180546001600160a01b03909216918390811061325557613255613d18565b600091825260209091200180546001600160a01b0319166001600160a01b0392909216919091179055806132888161412f565b915050613202565b5086846006016000815481106132a8576132a8613d18565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055506133b2565b815b801561336b57600685016132f26001836140fd565b8154811061330257613302613d18565b6000918252602090912001546006860180546001600160a01b03909216918390811061333057613330613d18565b600091825260209091200180546001600160a01b0319166001600160a01b0392909216919091179055806133638161412f565b9150506132dd565b50868460060160008154811061338357613383613d18565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055505b5050505050505050565b6133c682826112c4565b6133f55760405163e2517d3f60e01b81526001600160a01b0382166004820152602481018390526044016106a2565b5050565b6000805160206141678339815191525460ff16612fcc57604051638dfc202b60e01b815260040160405180910390fd5b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0054600160401b900460ff16612fcc57604051631afcd79f60e31b815260040160405180910390fd5b61347a613429565b600080516020614167833981519152805460ff19169055565b613006613429565b8280548282559060005260206000209081019282156134ee579160200282015b828111156134ee5781546001600160a01b0319166001600160a01b038435161782556020909201916001909101906134bb565b506134fa9291506135b1565b5090565b8280548282559060005260206000209081019282156134ee579160200282015b828111156134ee57825182546001600160a01b0319166001600160a01b0390911617825560209092019160019091019061351e565b5080546000825590600052602060002090810190610b1e91906135b1565b8280548282559060005260206000209081019282156134ee5760005260206000209182015b828111156134ee578254825591600101919060010190613596565b5b808211156134fa57600081556001016135b2565b6000602082840312156135d857600080fd5b81356001600160e01b0319811681146135f057600080fd5b9392505050565b6001600160a01b0381168114610b1e57600080fd5b8035613617816135f7565b919050565b6000806040838503121561362f57600080fd5b823561363a816135f7565b946020939093013593505050565b60006020828403121561365a57600080fd5b5035919050565b600081518084526020808501945080840160005b8381101561369a5781516001600160a01b031687529582019590820190600101613675565b509495945050505050565b6020815281516020820152602082015160408201526040820151606082015260608201516080820152600060808301516136ea60a08401826001600160a01b03169052565b5060a08301516001600160a01b03811660c08401525060c08301516101208060e085015261371c610140850183613661565b915060e0850151610100601f19868503018187015261373b8483613661565b96015115159190940152509192915050565b60008083601f84011261375f57600080fd5b5081356001600160401b0381111561377657600080fd5b6020830191508360208260051b850101111561379157600080fd5b9250929050565b600080602083850312156137ab57600080fd5b82356001600160401b038111156137c157600080fd5b6137cd8582860161374d565b90969095509350505050565b600080604083850312156137ec57600080fd5b8235915060208301356137fe816135f7565b809150509250929050565b6000806000806000806000806080898b03121561382557600080fd5b88356001600160401b038082111561383c57600080fd5b6138488c838d0161374d565b909a50985060208b013591508082111561386157600080fd5b61386d8c838d0161374d565b909850965060408b013591508082111561388657600080fd5b6138928c838d0161374d565b909650945060608b01359150808211156138ab57600080fd5b506138b88b828c0161374d565b999c989b5096995094979396929594505050565b6020815260006135f06020830184613661565b6000806000606084860312156138f457600080fd5b833592506020840135613906816135f7565b929592945050506040919091013590565b6000806000806000806060878903121561393057600080fd5b86356001600160401b038082111561394757600080fd5b6139538a838b0161374d565b9098509650602089013591508082111561396c57600080fd5b6139788a838b0161374d565b9096509450604089013591508082111561399157600080fd5b5061399e89828a0161374d565b979a9699509497509295939492505050565b6000806000606084860312156139c557600080fd5b505081359360208301359350604090920135919050565b634e487b7160e01b600052604160045260246000fd5b600082601f830112613a0357600080fd5b813560206001600160401b0380831115613a1f57613a1f6139dc565b8260051b604051601f19603f83011681018181108482111715613a4457613a446139dc565b604052938452858101830193838101925087851115613a6257600080fd5b83870191505b84821015613a8857613a798261360c565b83529183019190830190613a68565b979650505050505050565b600060208284031215613aa557600080fd5b81356001600160401b03811115613abb57600080fd5b613ac7848285016139f2565b949350505050565b600080600060608486031215613ae457600080fd5b833592506020840135613af6816135f7565b91506040840135613b06816135f7565b809150509250925092565b60008060008060408587031215613b2757600080fd5b84356001600160401b0380821115613b3e57600080fd5b613b4a8883890161374d565b90965094506020870135915080821115613b6357600080fd5b50613b708782880161374d565b95989497509550505050565b600081518084526020808501945080840160005b8381101561369a57815187529582019590820190600101613b90565b606081526000613bbf6060830186613661565b8281036020840152613bd18186613b7c565b90508281036040840152613be58185613b7c565b9695505050505050565b60008060408385031215613c0257600080fd5b50508035926020909101359150565b60008060008060008060c08789031215613c2a57600080fd5b8635613c35816135f7565b95506020870135613c45816135f7565b945060408701356001600160401b03811115613c6057600080fd5b613c6c89828a016139f2565b945050606087013592506080870135915060a087013590509295509295509295565b600060208284031215613ca057600080fd5b5051919050565b8015158114610b1e57600080fd5b600060208284031215613cc757600080fd5b81516135f081613ca7565b60208082526026908201527f416c6c53746172735374616b696e673a20546f6b656e207472616e736665722060408201526519985a5b195960d21b606082015260800190565b634e487b7160e01b600052603260045260246000fd5b6000823561011e19833603018112613d4557600080fd5b9190910192915050565b634e487b7160e01b600052601160045260246000fd5b808201808211156105d6576105d6613d4f565b600060208284031215613d8a57600080fd5b81356135f0816135f7565b6000808335601e19843603018112613dac57600080fd5b8301803591506001600160401b03821115613dc657600080fd5b6020019150600581901b360382131561379157600080fd5b600060208284031215613df057600080fd5b81356135f081613ca7565b600060018201613e0d57613e0d613d4f565b5060010190565b602080825260139082015272082e4e4c2f298cadccee8d09ad2e6dac2e8c6d606b1b604082015260600190565b6020808252603b908201527f416c6c53746172735374616b696e673a20436f756e74646f776e20666163746f60408201527f72206d7573742062652067726561746572207468616e207a65726f0000000000606082015260800190565b6020808252603c908201527f416c6c53746172735374616b696e673a2046696e616c2067616d65206661637460408201527f6f72206d7573742062652067726561746572207468616e207a65726f00000000606082015260800190565b6020808252603d908201527f416c6c53746172735374616b696e673a2046696e616c2072657365742066616360408201527f746f72206d7573742062652067726561746572207468616e207a65726f000000606082015260800190565b6020808252602b908201527f416c6c53746172735374616b696e673a204e6f20616c6c6f77656420746f6b6560408201526a1b9cc81c1c9bdd9a59195960aa1b606082015260800190565b6020808252825482820181905260008481528281209092916040850190845b81811015613fe75783546001600160a01b031683526001938401939285019201613fc2565b50909695505050505050565b60208082526027908201527f416c6c53746172735374616b696e673a2047616d6520496420646f6573206e6f6040820152661d08195e1a5cdd60ca1b606082015260800190565b60208082526023908201527f416c6c53746172735374616b696e673a2047616d6520686173206e6f7420656e60408201526219195960ea1b606082015260800190565b60208082526027908201527f416c6c53746172735374616b696e673a2052657761726420616c72656164792060408201526618db185a5b595960ca1b606082015260800190565b80820281158282048414176105d6576105d6613d4f565b6000826140f857634e487b7160e01b600052601260045260246000fd5b500490565b818103818111156105d6576105d6613d4f565b600060ff821660ff810361412657614126613d4f565b60010192915050565b60008161413e5761413e613d4f565b50600019019056fe02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b626800cd5ed15c6e187e77e9aee88184c21f4f2182ab5827cb3b7e07fbedcd63f033009b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00a49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c21775a164736f6c6343000814000a

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106102485760003560e01c806391d148541161013b578063d0399bb8116100b8578063ee22aecb1161007c578063ee22aecb14610546578063f45961fa14610559578063f73541691461056c578063fb6990391461057f578063fdeef4251461059257600080fd5b8063d0399bb8146104cf578063d53f1c02146104e2578063d547741f146104f5578063e7bfc3f714610508578063eb3ea7621461053357600080fd5b8063b7ca51e8116100ff578063b7ca51e814610443578063bebb720114610456578063c6e20ac014610487578063c79c213d1461049a578063c90902cb146104ad57600080fd5b806391d14854146103de5780639a835e91146103f15780639a8891061461041f578063a217fddf14610432578063b41140fd1461043a57600080fd5b80633f4ba83a116101c957806360bd38051161018d57806360bd38051461037057806371c57f551461039b57806375b238fc146103ae5780638456cb59146103c35780638a8b6001146103cb57600080fd5b80633f4ba83a1461031f57806345abba05146103275780635284d6d01461033a5780635c975abb1461034f5780635e3689841461036757600080fd5b80631be819ac116102105780631be819ac146102ca578063248a9ca3146102dd5780632a6c1325146102f05780632f2ff15d146102f957806336568abe1461030c57600080fd5b806301ffc9a71461024d57806303a2c10e1461027557806306b091f91461028c5780631b31abda146102a15780631bb412d6146102c1575b600080fd5b61026061025b3660046135c6565b6105a5565b60405190151581526020015b60405180910390f35b61027e600b5481565b60405190815260200161026c565b61029f61029a36600461361c565b6105dc565b005b6102b46102af366004613648565b61078a565b60405161026c91906136a5565b61027e60015481565b61029f6102d8366004613798565b610920565b61027e6102eb366004613648565b610a82565b61027e60025481565b61029f6103073660046137d9565b610aa4565b61029f61031a3660046137d9565b610ac6565b61029f610afe565b61029f610335366004613809565b610b21565b610342610ed1565b60405161026c91906138cc565b6000805160206141678339815191525460ff16610260565b61027e60035481565b61038361037e3660046138df565b610f33565b6040516001600160a01b03909116815260200161026c565b61029f6103a9366004613917565b610f78565b61027e6000805160206141a783398151915281565b61029f611156565b61029f6103d93660046139b0565b611176565b6102606103ec3660046137d9565b6112c4565b6102606103ff3660046137d9565b600760209081526000928352604080842090915290825290205460ff1681565b61029f61042d366004613a93565b6112fc565b61027e600081565b61027e60045481565b600054610383906001600160a01b031681565b61027e610464366004613acf565b600a60209081526000938452604080852082529284528284209052825290205481565b61029f610495366004613b11565b611384565b61029f6104a8366004613648565b61149b565b6104c06104bb3660046137d9565b611948565b60405161026c93929190613bac565b61029f6104dd366004613648565b611b64565b61029f6104f0366004613bef565b611d8f565b61029f6105033660046137d9565b611e98565b61027e6105163660046137d9565b600960209081526000928352604080842090915290825290205481565b61029f610541366004613917565b611eb4565b61029f610554366004613648565b612072565b61029f6105673660046139b0565b6120d9565b61029f61057a366004613c11565b612482565b61029f61058d3660046138df565b612719565b61027e6105a03660046137d9565b612cde565b60006001600160e01b03198216637965db0b60e01b14806105d657506301ffc9a760e01b6001600160e01b03198316145b92915050565b6000805160206141a78339815191526105f481612dc7565b6040516370a0823160e01b8152306004820152839083906001600160a01b038316906370a0823190602401602060405180830381865afa15801561063c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106609190613c8e565b10156106ab5760405162461bcd60e51b815260206004820152601560248201527424b739bab33334b1b4b2b73a102130b630b731b29760591b60448201526064015b60405180910390fd5b60405163a9059cbb60e01b8152336004820152602481018490526000906001600160a01b0383169063a9059cbb906044016020604051808303816000875af11580156106fb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061071f9190613cb5565b90508061073e5760405162461bcd60e51b81526004016106a290613cd2565b604080518581524260208201526001600160a01b0387169133917f378e13210ce3efd180440b5d05b47d60b421a8e0e8076762aabd0ce93a5e15fd910160405180910390a35050505050565b6107ed6040518061012001604052806000815260200160008152602001600081526020016000815260200160006001600160a01b0316815260200160006001600160a01b0316815260200160608152602001606081526020016000151581525090565b600082815260066020818152604092839020835161012081018552815481526001820154818401526002820154818601526003820154606082015260048201546001600160a01b03908116608083015260058301541660a082015292810180548551818502810185019096528086529394919360c086019383018282801561089e57602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610880575b505050505081526020016007820180548060200260200160405190810160405280929190818152602001828054801561090057602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116108e2575b50505091835250506008919091015460ff16151560209091015292915050565b600061092b81612dc7565b60018290558160005b81811015610a7b573685858381811061094f5761094f613d18565b90506020028101906109619190613d2e565b90506000600681610973856001613d65565b815260208082019290925260409081016000208435815591840135600183015583013560028201556060830135600382015590506109b760a0830160808401613d78565b6004820180546001600160a01b0319166001600160a01b03929092169190911790556109e960c0830160a08401613d78565b6005820180546001600160a01b0319166001600160a01b0392909216919091179055610a1860c0830183613d95565b610a2691600684019161349b565b50610a3460e0830183613d95565b610a4291600784019161349b565b50610a5561012083016101008401613dde565b600891909101805460ff191691151591909117905550610a7481613dfb565b9050610934565b5050505050565b6000908152600080516020614147833981519152602052604090206001015490565b610aad82610a82565b610ab681612dc7565b610ac08383612dd1565b50505050565b6001600160a01b0381163314610aef5760405163334bd91960e11b815260040160405180910390fd5b610af98282612e76565b505050565b6000805160206141a7833981519152610b1681612dc7565b610b1e612ef2565b50565b6000610b2c81612dc7565b8786148015610b3a57508784145b8015610b4557508782145b610b615760405162461bcd60e51b81526004016106a290613e14565b60005b88811015610ec557858582818110610b7e57610b7e613d18565b9050602002810190610b909190613d95565b9050888883818110610ba457610ba4613d18565b9050602002810190610bb69190613d95565b9050148015610c0e5750838382818110610bd257610bd2613d18565b9050602002810190610be49190613d95565b9050888883818110610bf857610bf8613d18565b9050602002810190610c0a9190613d95565b9050145b610c2a5760405162461bcd60e51b81526004016106a290613e14565b60005b888883818110610c3f57610c3f613d18565b9050602002810190610c519190613d95565b9050811015610eb4576000878784818110610c6e57610c6e613d18565b9050602002810190610c809190613d95565b83818110610c9057610c90613d18565b9050602002810190610ca29190613d95565b90509050858584818110610cb857610cb8613d18565b9050602002810190610cca9190613d95565b83818110610cda57610cda613d18565b9050602002810190610cec9190613d95565b90508114610d0c5760405162461bcd60e51b81526004016106a290613e14565b60005b81811015610ea157868685818110610d2957610d29613d18565b9050602002810190610d3b9190613d95565b84818110610d4b57610d4b613d18565b9050602002810190610d5d9190613d95565b82818110610d6d57610d6d613d18565b90506020020135600a60008f8f88818110610d8a57610d8a613d18565b90506020020135815260200190815260200160002060008d8d88818110610db357610db3613d18565b9050602002810190610dc59190613d95565b87818110610dd557610dd5613d18565b9050602002016020810190610dea9190613d78565b6001600160a01b03166001600160a01b0316815260200190815260200160002060008b8b88818110610e1e57610e1e613d18565b9050602002810190610e309190613d95565b87818110610e4057610e40613d18565b9050602002810190610e529190613d95565b85818110610e6257610e62613d18565b9050602002016020810190610e779190613d78565b6001600160a01b03168152602081019190915260400160002055610e9a81613dfb565b9050610d0f565b505080610ead90613dfb565b9050610c2d565b50610ebe81613dfb565b9050610b64565b50505050505050505050565b60606005805480602002602001604051908101604052809291908181526020018280548015610f2957602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610f0b575b5050505050905090565b60086020528260005260406000206020528160005260406000208181548110610f5b57600080fd5b6000918252602090912001546001600160a01b0316925083915050565b6000610f8381612dc7565b858481148015610f9257508083145b610fae5760405162461bcd60e51b81526004016106a290613e14565b60005b8181101561114b576000898983818110610fcd57610fcd613d18565b905060200201359050858583818110610fe857610fe8613d18565b9050602002810190610ffa9190613d95565b905088888481811061100e5761100e613d18565b90506020028101906110209190613d95565b90501461103f5760405162461bcd60e51b81526004016106a290613e14565b600088888481811061105357611053613d18565b90506020028101906110659190613d95565b9050905060005b818110156111375787878581811061108657611086613d18565b90506020028101906110989190613d95565b828181106110a8576110a8613d18565b905060200201356009600085815260200190815260200160002060008c8c888181106110d6576110d6613d18565b90506020028101906110e89190613d95565b858181106110f8576110f8613d18565b905060200201602081019061110d9190613d78565b6001600160a01b0316815260208101919091526040016000205561113081613dfb565b905061106c565b5050508061114490613dfb565b9050610fb1565b505050505050505050565b6000805160206141a783398151915261116e81612dc7565b610b1e612f52565b61117e612f9b565b6000805160206141a783398151915261119681612dc7565b600084116111b65760405162461bcd60e51b81526004016106a290613e41565b600083116111d65760405162461bcd60e51b81526004016106a290613e9e565b600082116111f65760405162461bcd60e51b81526004016106a290613efb565b6002548414158061120957506003548314155b8061121657506004548214155b61126e5760405162461bcd60e51b815260206004820152602360248201527f416c6c53746172735374616b696e673a204e6f20666163746f7273206368616e60448201526219d95960ea1b60648201526084016106a2565b60028490556003839055600482905560408051858152602081018590529081018390527f6bf041f5e85f1e30b186a46afad10d1097cffac11d670c0bc688ce01e67039119060600160405180910390a150505050565b6000918252600080516020614147833981519152602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6000805160206141a783398151915261131481612dc7565b8151806113335760405162461bcd60e51b81526004016106a290613f58565b82516113469060059060208601906134fe565b507f80cf834692f79dc85e731aea9ee1788c7c7cca8fd087d25a7b0b885beff51c4160056040516113779190613fa3565b60405180910390a1505050565b600061138f81612dc7565b838281146113af5760405162461bcd60e51b81526004016106a290613e14565b60005b818110156114925760008787838181106113ce576113ce613d18565b9050602002013590503660008787858181106113ec576113ec613d18565b90506020028101906113fe9190613d95565b9150915060005b8181101561147d57600084815260076020526040812060019185858581811061143057611430613d18565b90506020020160208101906114459190613d78565b6001600160a01b031681526020810191909152604001600020805460ff191691151591909117905561147681613dfb565b9050611405565b505050508061148b90613dfb565b90506113b2565b50505050505050565b6114a3612fce565b6114ab612f9b565b6001548111156114cd5760405162461bcd60e51b81526004016106a290613ff3565b60008181526006602052604090206001015443116114fd5760405162461bcd60e51b81526004016106a29061403a565b600081815260076020908152604080832033845290915290205460ff16156115375760405162461bcd60e51b81526004016106a29061407d565b6000818152600660209081526040808320600581015460039091015460088452828520338652845282852080548451818702810187019095528085526001600160a01b039093169591949193849390928301828280156115c057602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116115a2575b505083519394505050811515905061162d5760405162461bcd60e51b815260206004820152602a60248201527f416c6c53746172735374616b696e673a204e6f207374616b656420746f6b656e6044820152697320746f20636c61696d60b01b60648201526084016106a2565b60008681526007602090815260408083203384529091528120805460ff191660011790555b818110156117e057600083828151811061166e5761166e613d18565b602002602001015190506000600a60008a815260200190815260200160002060006116963390565b6001600160a01b0390811682526020808301939093526040918201600090812091861681529252902054905080156117cb57876001600160a01b0316826001600160a01b0316036117275760008981526009602090815260408083206001600160a01b03861684529091529020548061170f838a6140c4565b61171991906140db565b6117239088613d65565b9650505b60006001600160a01b03831663a9059cbb336040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602481018590526044016020604051808303816000875af1158015611786573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117aa9190613cb5565b9050806117c95760405162461bcd60e51b81526004016106a290613cd2565b505b505080806117d890613dfb565b915050611652565b506000868152600860209081526040808320338452909152812061180391613553565b6000600b54600014806118335750600b5460008881526006602052604090206001015461183090436140fd565b11155b90506000841180156118425750805b1561192b57600080546001600160a01b031663a9059cbb336040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602481018890526044016020604051808303816000875af11580156118a7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118cb9190613cb5565b9050806118ea5760405162461bcd60e51b81526004016106a290613cd2565b6040805189815233602082015280820187905290517f88758f5bf10e78eb94f15a42685e01984f79397c9c30c4dda0a916e028bc6ca69181900360600190a1505b505050505050610b1e600160008051602061418783398151915255565b60008281526006602052604081206007015460609182918291816001600160401b03811115611979576119796139dc565b6040519080825280602002602001820160405280156119a2578160200160208202803683370190505b5090506000826001600160401b038111156119bf576119bf6139dc565b6040519080825280602002602001820160405280156119e8578160200160208202803683370190505b5090506000836001600160401b03811115611a0557611a056139dc565b604051908082528060200260200182016040528015611a2e578160200160208202803683370190505b50905060005b848160ff161015611b545760008a8152600660205260408120600701805460ff8416908110611a6557611a65613d18565b9060005260206000200160009054906101000a90046001600160a01b0316905080858360ff1681518110611a9b57611a9b613d18565b6001600160a01b0392831660209182029290920181019190915260008d815260098252604080822093851682529290915220548451859060ff8516908110611ae557611ae5613d18565b60209081029190910181019190915260008c8152600a825260408082206001600160a01b03808f168452908452818320908516835290925220548351849060ff8516908110611b3657611b36613d18565b60209081029190910101525080611b4c81614110565b915050611a34565b5091955093509150509250925092565b611b6c612fce565b611b74612f9b565b6000805160206141a7833981519152611b8c81612dc7565b600154821115611bae5760405162461bcd60e51b81526004016106a290613ff3565b6000828152600660205260409020600101544311611bde5760405162461bcd60e51b81526004016106a29061403a565b6000828152600660205260409020600501546001600160a01b031615611c525760405162461bcd60e51b815260206004820152602360248201527f416c6c53746172735374616b696e673a2055736572207374616b696e672065786044820152621a5cdd60ea1b60648201526084016106a2565b60008281526006602052604090206008015460ff1615611c845760405162461bcd60e51b81526004016106a29061407d565b60008281526006602052604080822060088101805460ff191660011790558254600480830154600390930154935163a9059cbb60e01b81526001600160a01b03938416918101919091526024810193909352169063a9059cbb906044016020604051808303816000875af1158015611d00573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d249190613cb5565b905080611d435760405162461bcd60e51b81526004016106a290613cd2565b6040518381527fce24807f7e4b60b4e641462f13029fa5e5f79075bbc3f8e5cd43ecd19661d7609060200160405180910390a15050610b1e600160008051602061418783398151915255565b6000805160206141a7833981519152611da781612dc7565b600154831115611dc95760405162461bcd60e51b81526004016106a290613ff3565b60008381526006602052604081206003018054849290611dea908490613d65565b9091555050600080546001600160a01b03166323b872dd336040516001600160e01b031960e084901b1681526001600160a01b039091166004820152306024820152604481018690526064016020604051808303816000875af1158015611e55573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e799190613cb5565b905080610ac05760405162461bcd60e51b81526004016106a290613cd2565b611ea182610a82565b611eaa81612dc7565b610ac08383612e76565b6000611ebf81612dc7565b858481148015611ece57508083145b611eea5760405162461bcd60e51b81526004016106a290613e14565b60005b8181101561114b576000898983818110611f0957611f09613d18565b9050602002013590506000888884818110611f2657611f26613d18565b9050602002810190611f389190613d95565b90509050868684818110611f4e57611f4e613d18565b9050602002810190611f609190613d95565b90508114611f805760405162461bcd60e51b81526004016106a290613e14565b60005b8181101561205e57878785818110611f9d57611f9d613d18565b9050602002810190611faf9190613d95565b82818110611fbf57611fbf613d18565b9050602002810190611fd19190613d95565b6000858152600860205260408120908d8d89818110611ff257611ff2613d18565b90506020028101906120049190613d95565b8681811061201457612014613d18565b90506020020160208101906120299190613d78565b6001600160a01b03168152602081019190915260400160002061204d92909161349b565b5061205781613dfb565b9050611f83565b5050508061206b90613dfb565b9050611eed565b6000805160206141a783398151915261208a81612dc7565b600b80549083905560408051828152602081018590524281830152905133917fc7a194484723d46abbca95fca9194ecfd3ab2b695107e69e6ec3556518c2d068919081900360600190a2505050565b6120e1612f9b565b6000805160206141a78339815191526120f981612dc7565b83831161216e5760405162461bcd60e51b815260206004820152603b60248201527f416c6c53746172735374616b696e673a20456e6420626c6f636b206d7573742060448201527f62652067726561746572207468616e20737461727420626c6f636b000000000060648201526084016106a2565b4384116121e35760405162461bcd60e51b815260206004820152603f60248201527f416c6c53746172735374616b696e673a20537461727420626c6f636b206d757360448201527f742062652067726561746572207468616e2063757272656e7420626c6f636b0060648201526084016106a2565b600082116122595760405162461bcd60e51b815260206004820152603860248201527f416c6c53746172735374616b696e673a2052657761726420616d6f756e74206d60448201527f7573742062652067726561746572207468616e207a65726f000000000000000060648201526084016106a2565b6001805490600061226983613dfb565b91905055506001805411156122f857600660006001805461228a91906140fd565b81526020019081526020016000206001015443116122f85760405162461bcd60e51b815260206004820152602560248201527f416c6c53746172735374616b696e673a2047616d6520616c72656164792072756044820152646e6e696e6760d81b60648201526084016106a2565b60018054600090815260066020526040808220879055825482528082208301869055915481522060030182905561232f84846140fd565b6001805460009081526006602052604080822060020193909355905481522060058054612360926007019190613571565b5033600154600090815260066020526040812060040180546001600160a01b0319166001600160a01b0393841617905580549091166323b872dd336040516001600160e01b031960e084901b1681526001600160a01b039091166004820152306024820152604481018690526064016020604051808303816000875af11580156123ee573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124129190613cb5565b9050806124315760405162461bcd60e51b81526004016106a290613cd2565b60015460408051918252602082018790528101859052606081018490527fa04fad86c120eb1a6f69e15fd3adfcfbed0b2f9128a2edb7c324bfcd7502d4a29060800160405180910390a15050505050565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a008054600160401b810460ff1615906001600160401b03166000811580156124c75750825b90506000826001600160401b031660011480156124e35750303b155b9050811580156124f1575080155b1561250f5760405163f92ee8a960e01b815260040160405180910390fd5b845467ffffffffffffffff19166001178555831561253957845460ff60401b1916600160401b1785555b600088116125595760405162461bcd60e51b81526004016106a290613e41565b600087116125795760405162461bcd60e51b81526004016106a290613e9e565b600086116125995760405162461bcd60e51b81526004016106a290613efb565b6001600160a01b038b16158015906125b957506001600160a01b038a1615155b61262b5760405162461bcd60e51b815260206004820152603e60248201527f416c6c53746172735374616b696e673a205a65726f206164647265737320707260448201527f6f766964656420666f72205354415220746f6b656e206f722061646d696e000060648201526084016106a2565b88518061264a5760405162461bcd60e51b81526004016106a290613f58565b61265261301a565b61265a613022565b612662613032565b600080546001600160a01b0319166001600160a01b038e1617905589516126909060059060208d01906134fe565b506002899055600388905560048790556126ab60008c612dd1565b506126c46000805160206141a78339815191528c612dd1565b5050831561270c57845460ff60401b19168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b5050505050505050505050565b612721612fce565b612729612f9b565b60015483111561274b5760405162461bcd60e51b81526004016106a290613ff3565b6001600160a01b0382166127b05760405162461bcd60e51b815260206004820152602660248201527f416c6c53746172735374616b696e673a20546f6b656e206973207a65726f206160448201526564647265737360d01b60648201526084016106a2565b600081116128265760405162461bcd60e51b815260206004820152603760248201527f416c6c53746172735374616b696e673a205374616b6520616d6f756e74206d7560448201527f73742062652067726561746572207468616e207a65726f00000000000000000060648201526084016106a2565b6128308383613042565b61288a5760405162461bcd60e51b815260206004820152602560248201527f416c6c53746172735374616b696e673a20546f6b656e206973206e6f7420616c6044820152641b1bddd95960da1b60648201526084016106a2565b6000838152600660208181526040808420815161012081018352815481526001820154818501526002820154818401526003820154606082015260048201546001600160a01b03908116608083015260058301541660a08201529381018054835181860281018601909452808452919360c0860193929083018282801561293a57602002820191906000526020600020905b81546001600160a01b0316815260019091019060200180831161291c575b505050505081526020016007820180548060200260200160405190810160405280929190818152602001828054801561299c57602002820191906000526020600020905b81546001600160a01b0316815260019091019060200180831161297e575b50505091835250506008919091015460ff1615156020909101528051909150431015612a1c5760405162461bcd60e51b815260206004820152602960248201527f416c6c53746172735374616b696e673a2047616d6520686173206e6f74207374604482015268185c9d1959081e595d60ba1b60648201526084016106a2565b8060200151431115612a705760405162461bcd60e51b815260206004820152601f60248201527f416c6c53746172735374616b696e673a2047616d652068617320656e6465640060448201526064016106a2565b60a08101516001600160a01b03161580612aba5750826001600160a01b03168160c00151600081518110612aa657612aa6613d18565b60200260200101516001600160a01b031614155b15612ae7576004548151602083015160009291612ad6916140fd565b11159050612ae58585836130d5565b505b6000848152600a6020908152604080832033845282528083206001600160a01b03871684529091528120549003612b5857600084815260086020908152604080832033845282528220805460018101825590835291200180546001600160a01b0319166001600160a01b0385161790555b6000848152600a6020908152604080832033845282528083206001600160a01b038716845290915281208054849290612b92908490613d65565b909155505060008481526009602090815260408083206001600160a01b038716845290915281208054849290612bc9908490613d65565b90915550600090506001600160a01b0384166323b872dd336040516001600160e01b031960e084901b1681526001600160a01b039091166004820152306024820152604481018690526064016020604051808303816000875af1158015612c34573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c589190613cb5565b905080612c775760405162461bcd60e51b81526004016106a290613cd2565b604080518681523360208201526001600160a01b038616818301526060810185905290517f434a63ea912bd33d203a14946f16bca79601eaa5c0974c4756ca6a036641084e9181900360800190a15050610af9600160008051602061418783398151915255565b6000600154831115612d025760405162461bcd60e51b81526004016106a290613ff3565b6000838152600660205260409020600101544311612d325760405162461bcd60e51b81526004016106a29061403a565b600083815260066020908152604080832060050154600a83528184206001600160a01b03878116865290845282852091168085529252909120548015612dbf5760008581526009602090815260408083206001600160a01b03861684528252808320548884526006909252909120600301548190612db19084906140c4565b612dbb91906140db565b9350505b505092915050565b610b1e81336133bc565b6000600080516020614147833981519152612dec84846112c4565b612e6c576000848152602082815260408083206001600160a01b03871684529091529020805460ff19166001179055612e223390565b6001600160a01b0316836001600160a01b0316857f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a460019150506105d6565b60009150506105d6565b6000600080516020614147833981519152612e9184846112c4565b15612e6c576000848152602082815260408083206001600160a01b0387168085529252808320805460ff1916905551339287917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a460019150506105d6565b612efa6133f9565b600080516020614167833981519152805460ff191681557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a150565b612f5a612f9b565b600080516020614167833981519152805460ff191660011781557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25833612f34565b6000805160206141678339815191525460ff1615612fcc5760405163d93c066560e01b815260040160405180910390fd5b565b60008051602061418783398151915280546001190161300057604051633ee5aeb560e01b815260040160405180910390fd5b60029055565b600160008051602061418783398151915255565b612fcc613429565b61302a613429565b612fcc613472565b61303a613429565b612fcc613493565b600082815260066020526040812060070154815b818160ff1610156130ca57600085815260066020526040902060070180546001600160a01b038616919060ff841690811061309357613093613d18565b6000918252602090912001546001600160a01b0316036130b8576001925050506105d6565b806130c281614110565b915050613056565b506000949350505050565b600083815260066020526040812082156130fd576003546130f69043613d65565b9150613128565b6002548154600183015461311191906140fd565b61311b91906140fd565b6131259043613d65565b91505b6005810180546001600160a01b0319166001600160a01b0386161790556001810182905543815560068101546000908190815b818110156131ba57876001600160a01b031685600601828154811061318257613182613d18565b6000918252602090912001546001600160a01b0316036131a857600193508092506131ba565b806131b281613dfb565b91505061315b565b50826132db576006840180546001808201835560008381526020812090920180546001600160a01b0319166001600160a01b038c16179055915490916131ff916140fd565b90505b801561329057600685016132176001836140fd565b8154811061322757613227613d18565b6000918252602090912001546006860180546001600160a01b03909216918390811061325557613255613d18565b600091825260209091200180546001600160a01b0319166001600160a01b0392909216919091179055806132888161412f565b915050613202565b5086846006016000815481106132a8576132a8613d18565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055506133b2565b815b801561336b57600685016132f26001836140fd565b8154811061330257613302613d18565b6000918252602090912001546006860180546001600160a01b03909216918390811061333057613330613d18565b600091825260209091200180546001600160a01b0319166001600160a01b0392909216919091179055806133638161412f565b9150506132dd565b50868460060160008154811061338357613383613d18565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055505b5050505050505050565b6133c682826112c4565b6133f55760405163e2517d3f60e01b81526001600160a01b0382166004820152602481018390526044016106a2565b5050565b6000805160206141678339815191525460ff16612fcc57604051638dfc202b60e01b815260040160405180910390fd5b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0054600160401b900460ff16612fcc57604051631afcd79f60e31b815260040160405180910390fd5b61347a613429565b600080516020614167833981519152805460ff19169055565b613006613429565b8280548282559060005260206000209081019282156134ee579160200282015b828111156134ee5781546001600160a01b0319166001600160a01b038435161782556020909201916001909101906134bb565b506134fa9291506135b1565b5090565b8280548282559060005260206000209081019282156134ee579160200282015b828111156134ee57825182546001600160a01b0319166001600160a01b0390911617825560209092019160019091019061351e565b5080546000825590600052602060002090810190610b1e91906135b1565b8280548282559060005260206000209081019282156134ee5760005260206000209182015b828111156134ee578254825591600101919060010190613596565b5b808211156134fa57600081556001016135b2565b6000602082840312156135d857600080fd5b81356001600160e01b0319811681146135f057600080fd5b9392505050565b6001600160a01b0381168114610b1e57600080fd5b8035613617816135f7565b919050565b6000806040838503121561362f57600080fd5b823561363a816135f7565b946020939093013593505050565b60006020828403121561365a57600080fd5b5035919050565b600081518084526020808501945080840160005b8381101561369a5781516001600160a01b031687529582019590820190600101613675565b509495945050505050565b6020815281516020820152602082015160408201526040820151606082015260608201516080820152600060808301516136ea60a08401826001600160a01b03169052565b5060a08301516001600160a01b03811660c08401525060c08301516101208060e085015261371c610140850183613661565b915060e0850151610100601f19868503018187015261373b8483613661565b96015115159190940152509192915050565b60008083601f84011261375f57600080fd5b5081356001600160401b0381111561377657600080fd5b6020830191508360208260051b850101111561379157600080fd5b9250929050565b600080602083850312156137ab57600080fd5b82356001600160401b038111156137c157600080fd5b6137cd8582860161374d565b90969095509350505050565b600080604083850312156137ec57600080fd5b8235915060208301356137fe816135f7565b809150509250929050565b6000806000806000806000806080898b03121561382557600080fd5b88356001600160401b038082111561383c57600080fd5b6138488c838d0161374d565b909a50985060208b013591508082111561386157600080fd5b61386d8c838d0161374d565b909850965060408b013591508082111561388657600080fd5b6138928c838d0161374d565b909650945060608b01359150808211156138ab57600080fd5b506138b88b828c0161374d565b999c989b5096995094979396929594505050565b6020815260006135f06020830184613661565b6000806000606084860312156138f457600080fd5b833592506020840135613906816135f7565b929592945050506040919091013590565b6000806000806000806060878903121561393057600080fd5b86356001600160401b038082111561394757600080fd5b6139538a838b0161374d565b9098509650602089013591508082111561396c57600080fd5b6139788a838b0161374d565b9096509450604089013591508082111561399157600080fd5b5061399e89828a0161374d565b979a9699509497509295939492505050565b6000806000606084860312156139c557600080fd5b505081359360208301359350604090920135919050565b634e487b7160e01b600052604160045260246000fd5b600082601f830112613a0357600080fd5b813560206001600160401b0380831115613a1f57613a1f6139dc565b8260051b604051601f19603f83011681018181108482111715613a4457613a446139dc565b604052938452858101830193838101925087851115613a6257600080fd5b83870191505b84821015613a8857613a798261360c565b83529183019190830190613a68565b979650505050505050565b600060208284031215613aa557600080fd5b81356001600160401b03811115613abb57600080fd5b613ac7848285016139f2565b949350505050565b600080600060608486031215613ae457600080fd5b833592506020840135613af6816135f7565b91506040840135613b06816135f7565b809150509250925092565b60008060008060408587031215613b2757600080fd5b84356001600160401b0380821115613b3e57600080fd5b613b4a8883890161374d565b90965094506020870135915080821115613b6357600080fd5b50613b708782880161374d565b95989497509550505050565b600081518084526020808501945080840160005b8381101561369a57815187529582019590820190600101613b90565b606081526000613bbf6060830186613661565b8281036020840152613bd18186613b7c565b90508281036040840152613be58185613b7c565b9695505050505050565b60008060408385031215613c0257600080fd5b50508035926020909101359150565b60008060008060008060c08789031215613c2a57600080fd5b8635613c35816135f7565b95506020870135613c45816135f7565b945060408701356001600160401b03811115613c6057600080fd5b613c6c89828a016139f2565b945050606087013592506080870135915060a087013590509295509295509295565b600060208284031215613ca057600080fd5b5051919050565b8015158114610b1e57600080fd5b600060208284031215613cc757600080fd5b81516135f081613ca7565b60208082526026908201527f416c6c53746172735374616b696e673a20546f6b656e207472616e736665722060408201526519985a5b195960d21b606082015260800190565b634e487b7160e01b600052603260045260246000fd5b6000823561011e19833603018112613d4557600080fd5b9190910192915050565b634e487b7160e01b600052601160045260246000fd5b808201808211156105d6576105d6613d4f565b600060208284031215613d8a57600080fd5b81356135f0816135f7565b6000808335601e19843603018112613dac57600080fd5b8301803591506001600160401b03821115613dc657600080fd5b6020019150600581901b360382131561379157600080fd5b600060208284031215613df057600080fd5b81356135f081613ca7565b600060018201613e0d57613e0d613d4f565b5060010190565b602080825260139082015272082e4e4c2f298cadccee8d09ad2e6dac2e8c6d606b1b604082015260600190565b6020808252603b908201527f416c6c53746172735374616b696e673a20436f756e74646f776e20666163746f60408201527f72206d7573742062652067726561746572207468616e207a65726f0000000000606082015260800190565b6020808252603c908201527f416c6c53746172735374616b696e673a2046696e616c2067616d65206661637460408201527f6f72206d7573742062652067726561746572207468616e207a65726f00000000606082015260800190565b6020808252603d908201527f416c6c53746172735374616b696e673a2046696e616c2072657365742066616360408201527f746f72206d7573742062652067726561746572207468616e207a65726f000000606082015260800190565b6020808252602b908201527f416c6c53746172735374616b696e673a204e6f20616c6c6f77656420746f6b6560408201526a1b9cc81c1c9bdd9a59195960aa1b606082015260800190565b6020808252825482820181905260008481528281209092916040850190845b81811015613fe75783546001600160a01b031683526001938401939285019201613fc2565b50909695505050505050565b60208082526027908201527f416c6c53746172735374616b696e673a2047616d6520496420646f6573206e6f6040820152661d08195e1a5cdd60ca1b606082015260800190565b60208082526023908201527f416c6c53746172735374616b696e673a2047616d6520686173206e6f7420656e60408201526219195960ea1b606082015260800190565b60208082526027908201527f416c6c53746172735374616b696e673a2052657761726420616c72656164792060408201526618db185a5b595960ca1b606082015260800190565b80820281158282048414176105d6576105d6613d4f565b6000826140f857634e487b7160e01b600052601260045260246000fd5b500490565b818103818111156105d6576105d6613d4f565b600060ff821660ff810361412657614126613d4f565b60010192915050565b60008161413e5761413e613d4f565b50600019019056fe02dd7bc7dec4dceedda775e58dd541e08a116c6c53815c0bd028192f7b626800cd5ed15c6e187e77e9aee88184c21f4f2182ab5827cb3b7e07fbedcd63f033009b779b17422d0df92223018b32b4d1fa46e071723d6817e2486d003becc55f00a49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c21775a164736f6c6343000814000a

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading
Loading...
Loading

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.