GLMR Price: $0.214508 (-14.64%)
Gas: 125 GWei

Contract

0x54825778d33140fE9011DcfbBbD50b924e368fa9

Overview

GLMR Balance

Moonbeam Chain LogoMoonbeam Chain LogoMoonbeam Chain Logo0 GLMR

GLMR Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Value
Harvest All Stak...63989292024-06-18 1:41:244 hrs ago1718674884IN
Beamswap: Staking V1
0 GLMR0.0216945125
Harvest All Stak...63979672024-06-17 22:21:547 hrs ago1718662914IN
Beamswap: Staking V1
0 GLMR0.020057125
Harvest All Stak...63976632024-06-17 21:20:068 hrs ago1718659206IN
Beamswap: Staking V1
0 GLMR0.023832125
Harvest All Stak...63970972024-06-17 19:23:5410 hrs ago1718652234IN
Beamswap: Staking V1
0 GLMR0.01692472125.0367762
Harvest All Stak...63969342024-06-17 18:50:3011 hrs ago1718650230IN
Beamswap: Staking V1
0 GLMR0.0216945125
Harvest All Stak...63958492024-06-17 15:10:4214 hrs ago1718637042IN
Beamswap: Staking V1
0 GLMR0.01716975125
Harvest All Stak...63953032024-06-17 13:19:0016 hrs ago1718630340IN
Beamswap: Staking V1
0 GLMR0.02475668129.85
Harvest All Stak...63949072024-06-17 11:58:3617 hrs ago1718625516IN
Beamswap: Staking V1
0 GLMR0.0216945125
Add Rewards To P...63944682024-06-17 10:26:2419 hrs ago1718619984IN
Beamswap: Staking V1
0 GLMR0.0181755250
Harvest All Stak...63942642024-06-17 9:43:0620 hrs ago1718617386IN
Beamswap: Staking V1
0 GLMR0.01905725125
Harvest All Stak...63941682024-06-17 9:22:4820 hrs ago1718616168IN
Beamswap: Staking V1
0 GLMR0.02501375125
Harvest All Stak...63935002024-06-17 7:06:5422 hrs ago1718608014IN
Beamswap: Staking V1
0 GLMR0.020057125
Harvest All Stak...63934332024-06-17 6:53:1223 hrs ago1718607192IN
Beamswap: Staking V1
0 GLMR0.0213445125
Harvest All Stak...63931982024-06-17 6:05:2423 hrs ago1718604324IN
Beamswap: Staking V1
0 GLMR0.02246083126.5
Harvest All Stak...63926602024-06-17 4:16:1225 hrs ago1718597772IN
Beamswap: Staking V1
0 GLMR0.0221945125
Harvest All Stak...63925042024-06-17 3:44:3026 hrs ago1718595870IN
Beamswap: Staking V1
0 GLMR0.020057125
Harvest All Stak...63897042024-06-16 18:15:3035 hrs ago1718561730IN
Beamswap: Staking V1
0 GLMR0.02172325125.1656647
Harvest All Stak...63893962024-06-16 17:12:5436 hrs ago1718557974IN
Beamswap: Staking V1
0 GLMR0.02006334125.0395269
Harvest All Stak...63891322024-06-16 16:19:3037 hrs ago1718554770IN
Beamswap: Staking V1
0 GLMR0.02222011125.14425968
Harvest All Stak...63886102024-06-16 14:32:0039 hrs ago1718548320IN
Beamswap: Staking V1
0 GLMR0.023132125
Harvest All Stak...63883382024-06-16 13:36:5440 hrs ago1718545014IN
Beamswap: Staking V1
0 GLMR0.020057125
Harvest All Stak...63881072024-06-16 12:49:3641 hrs ago1718542176IN
Beamswap: Staking V1
0 GLMR0.02462398126.5
Harvest All Stak...63872352024-06-16 9:46:1244 hrs ago1718531172IN
Beamswap: Staking V1
0 GLMR0.11911106634.05512769
Harvest All Stak...63857982024-06-16 4:55:002 days ago1718513700IN
Beamswap: Staking V1
0 GLMR0.024332125
Harvest All Stak...63851582024-06-16 2:45:482 days ago1718505948IN
Beamswap: Staking V1
0 GLMR0.024332125
View all transactions

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Staking

Compiler Version
v0.8.19+commit.7dd6d404

Optimization Enabled:
Yes with 1000 runs

Other Settings:
default evmVersion
File 1 of 10 : Staking.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";

import "./interfaces/IStaking.sol";
import "./interfaces/IstGlintUsage.sol";

/*
 * This contract is used to distribute staking to users that allocated stGlint here
 *
 * Staking can be distributed in the form of one or more tokens
 * They are mainly managed to be received from the FeeManager contract, but other sources can be added (dev wallet for instance)
 *
 * The freshly received staking are stored in a pending slot
 *
 * The content of this pending slot will be progressively transferred over time into a distribution slot
 * This distribution slot is the source of the staking distribution to stGlint allocators during the current cycle
 *
 * This transfer from the pending slot to the distribution slot is based on cycleStakingPercent and CYCLE_PERIOD_SECONDS
 *
 */
contract Staking is Ownable, ReentrancyGuard, IstGlintUsage, IStaking {
    using SafeERC20 for IERC20;
    using EnumerableSet for EnumerableSet.AddressSet;

    struct UserInfo {
        uint256 pendingStaking;
        uint256 rewardDebt;
    }

    struct StakingInfo {
        uint256 currentDistributionAmount; // total amount to distribute during the current cycle
        uint256 currentCycleDistributedAmount; // amount already distributed for the current cycle (times 1e2)
        uint256 pendingAmount; // total amount in the pending slot, not distributed yet
        uint256 distributedAmount; // total amount that has been distributed since initialization
        uint256 accStakingPerShare; // accumulated staking per share (times 1e18)
        uint256 lastUpdateTime; // last time the staking distribution occurred
        uint256 cycleStakingPercent; // fixed part of the pending staking to assign to currentDistributionAmount on every cycle
        bool distributionDisabled; // deactivate a token distribution (for temporary staking)
    }

    // actively distributed tokens
    EnumerableSet.AddressSet private _distributedTokens;
    uint256 public constant MAX_DISTRIBUTED_TOKENS = 10;

    // staking info for every staking token
    mapping(address => StakingInfo) public stakingInfo;
    mapping(address => mapping(address => UserInfo)) public users;

    address public immutable stGlint; // stGlint contract

    mapping(address => uint256) public usersAllocation; // User's stGlint allocation
    uint256 public totalAllocation; // Contract's total stGlint allocation

    uint256 public constant MIN_CYCLE_STAKING_PERCENT = 1; // 0.01%
    uint256 public constant DEFAULT_CYCLE_STAKING_PERCENT = 100; // 1%
    uint256 public constant MAX_CYCLE_STAKING_PERCENT = 10000; // 100%
    // staking will be added to the currentDistributionAmount on each new cycle
    uint256 internal _cycleDurationSeconds = 7 days;
    uint256 public currentCycleStartTime;

    constructor(address _stGlint) {
        require(_stGlint != address(0), "zero address");
        currentCycleStartTime = block.timestamp + (60 * 60 * 24 * 365);
        stGlint = _stGlint;
    }

    /********************************************/
    /****************** EVENTS ******************/
    /********************************************/

    event UserUpdated(
        address indexed user,
        uint256 previousBalance,
        uint256 newBalance
    );
    event StakingCollected(
        address indexed user,
        address indexed token,
        uint256 amount
    );
    event CycleStakingPercentUpdated(
        address indexed token,
        uint256 previousValue,
        uint256 newValue
    );
    event RewardAddedToPending(address indexed token, uint256 amount);
    event DistributedTokenDisabled(address indexed token);
    event DistributedTokenRemoved(address indexed token);
    event DistributedTokenEnabled(address indexed token);

    /***********************************************/
    /****************** MODIFIERS ******************/
    /***********************************************/

    /**
     * @dev Checks if an index exists
     */
    modifier validateDistributedTokensIndex(uint256 index) {
        require(
            index < _distributedTokens.length(),
            "validateDistributedTokensIndex: index exists?"
        );
        _;
    }

    /**
     * @dev Checks if token exists
     */
    modifier validateDistributedToken(address token) {
        require(
            _distributedTokens.contains(token),
            "validateDistributedTokens: token does not exists"
        );
        _;
    }

    /**
     * @dev Checks if caller is the stGlint contract
     */
    modifier stGlintTokenOnly() {
        require(
            msg.sender == stGlint,
            "stGlintTokenOnly: caller should be stGlint"
        );
        _;
    }

    /*******************************************/
    /****************** VIEWS ******************/
    /*******************************************/

    function cycleDurationSeconds() external view returns (uint256) {
        return _cycleDurationSeconds;
    }

    /**
     * @dev Returns the number of staking tokens
     */
    function distributedTokensLength()
        external
        view
        override
        returns (uint256)
    {
        return _distributedTokens.length();
    }

    /**
     * @dev Returns staking token address from given index
     */
    function distributedToken(
        uint256 index
    )
        external
        view
        override
        validateDistributedTokensIndex(index)
        returns (address)
    {
        return address(_distributedTokens.at(index));
    }

    /**
     * @dev Returns true if given token is a staking token
     */
    function isDistributedToken(
        address token
    ) external view override returns (bool) {
        return _distributedTokens.contains(token);
    }

    /**
     * @dev Returns time at which the next cycle will start
     */
    function nextCycleStartTime() public view returns (uint256) {
        return currentCycleStartTime + _cycleDurationSeconds;
    }

    /**
     * @dev Returns user's staking pending amount for a given token
     */
    function pendingStakingAmount(
        address token,
        address userAddress
    ) external view returns (uint256) {
        if (totalAllocation == 0) {
            return 0;
        }

        StakingInfo storage stakingInfo_ = stakingInfo[token];

        uint256 accStakingPerShare = stakingInfo_.accStakingPerShare;
        uint256 lastUpdateTime = stakingInfo_.lastUpdateTime;
        uint256 dividendAmountPerSecond_ = _stakingAmountPerSecond(token);

        // check if the current cycle has changed since last update
        if (_currentBlockTimestamp() > nextCycleStartTime()) {
            // get remaining rewards from last cycle
            accStakingPerShare +=
                ((nextCycleStartTime() - lastUpdateTime) *
                    dividendAmountPerSecond_ *
                    1e16) /
                totalAllocation;

            lastUpdateTime = nextCycleStartTime();
            dividendAmountPerSecond_ =
                (stakingInfo_.pendingAmount *
                    stakingInfo_.cycleStakingPercent) /
                (100 * _cycleDurationSeconds);
        }

        // get pending rewards from current cycle
        accStakingPerShare +=
            ((_currentBlockTimestamp() - lastUpdateTime) *
                (dividendAmountPerSecond_ * 1e16)) /
            totalAllocation;

        return
            ((usersAllocation[userAddress] * accStakingPerShare) / 1e18) -
            users[token][userAddress].rewardDebt +
            users[token][userAddress].pendingStaking;
    }

    /**************************************************/
    /****************** PUBLIC FUNCTIONS **************/
    /**************************************************/

    /**
     * @dev Updates the current cycle start time if previous cycle has ended
     */
    function updateCurrentCycleStartTime() public {
        uint256 nextCycleStartTime_ = nextCycleStartTime();

        if (_currentBlockTimestamp() >= nextCycleStartTime_) {
            currentCycleStartTime = nextCycleStartTime_;
        }
    }

    /**
     * @dev Updates staking info for a given token
     */
    function updateStakingInfo(
        address token
    ) external validateDistributedToken(token) {
        _updateStakingInfo(token);
    }

    /****************************************************************/
    /****************** EXTERNAL PUBLIC FUNCTIONS  ******************/
    /****************************************************************/

    /**
     * @dev starts staking
     */
    function startStaking() external onlyOwner {
        require(
            block.timestamp < currentCycleStartTime,
            "distribution already started"
        );
        currentCycleStartTime = block.timestamp;
    }

    /**
     * @dev Updates all stakingInfo
     */
    function massUpdateStakingInfo() external {
        uint256 length = _distributedTokens.length();
        for (uint256 index = 0; index < length; ) {
            _updateStakingInfo(_distributedTokens.at(index));
            unchecked {
                ++index;
            }
        }
    }

    /**
     * @dev Harvests caller's pending staking of a given token
     */
    function harvestStaking(address token) external nonReentrant {
        if (!_distributedTokens.contains(token)) {
            require(
                stakingInfo[token].distributedAmount > 0,
                "harvestStaking: invalid token"
            );
        }

        _harvestStaking(token);
    }

    /**
     * @dev Harvests all caller's pending staking
     */
    function harvestAllStaking() external nonReentrant {
        uint256 length = _distributedTokens.length();
        for (uint256 index = 0; index < length; ) {
            _harvestStaking(_distributedTokens.at(index));
            unchecked {
                ++index;
            }
        }
    }

    /**
     * @dev Transfers the given amount of token from caller to pendingAmount
     *
     * Must only be called by a trustable address
     */
    function addRewardsToPending(
        address token,
        uint256 amount
    ) external override nonReentrant {
        uint256 prevTokenBalance = IERC20(token).balanceOf(address(this));
        StakingInfo storage stakingInfo_ = stakingInfo[token];

        IERC20(token).safeTransferFrom(msg.sender, address(this), amount);

        // handle tokens with transfer tax
        uint256 receivedAmount = IERC20(token).balanceOf(address(this)) -
            prevTokenBalance;
        stakingInfo_.pendingAmount =
            stakingInfo_.pendingAmount +
            receivedAmount;

        emit RewardAddedToPending(token, receivedAmount);
    }

    /**
     * @dev Emergency withdraw token's balance on the contract
     */
    function emergencyWithdraw(IERC20 token) public nonReentrant onlyOwner {
        uint256 balance = token.balanceOf(address(this));
        require(balance > 0, "emergencyWithdraw: token balance is null");
        _safeTokenTransfer(token, msg.sender, balance);
    }

    /**
     * @dev Emergency withdraw all reward tokens' balances on the contract
     */
    function emergencyWithdrawAll() external nonReentrant onlyOwner {
        uint256 length = _distributedTokens.length();
        for (uint256 index = 0; index < length; ) {
            emergencyWithdraw(IERC20(_distributedTokens.at(index)));
            unchecked {
                ++index;
            }
        }
    }

    /*****************************************************************/
    /****************** OWNABLE FUNCTIONS  ******************/
    /*****************************************************************/

    /**
     * Allocates "userAddress" user's "amount" of stGlint to this staking contract
     *
     * Can only be called by stGlint contract, which is trusted to verify amounts
     * "data" is only here for compatibility reasons (IstGlintUsage)
     */
    function allocate(
        address userAddress,
        uint256 amount,
        bytes calldata /*data*/
    ) external override nonReentrant stGlintTokenOnly {
        uint256 newUserAllocation = usersAllocation[userAddress] + amount;
        uint256 newTotalAllocation = totalAllocation + amount;
        _updateUser(userAddress, newUserAllocation, newTotalAllocation);
    }

    /**
     * Deallocates "userAddress" user's "amount" of stGlint allocation from this staking contract
     *
     * Can only be called by stGlint contract, which is trusted to verify amounts
     * "data" is only here for compatibility reasons (IstGlintUsage)
     */
    function deallocate(
        address userAddress,
        uint256 amount,
        bytes calldata /*data*/
    ) external override nonReentrant stGlintTokenOnly {
        uint256 newUserAllocation = usersAllocation[userAddress] - amount;
        uint256 newTotalAllocation = totalAllocation - amount;
        _updateUser(userAddress, newUserAllocation, newTotalAllocation);
    }

    /**
     * @dev Enables a given token to be distributed as staking
     *
     * Effective from the next cycle
     */
    function enableDistributedToken(address token) external onlyOwner {
        StakingInfo storage stakingInfo_ = stakingInfo[token];
        require(
            stakingInfo_.lastUpdateTime == 0 ||
                stakingInfo_.distributionDisabled,
            "enableDistributedToken: Already enabled staking token"
        );
        require(
            _distributedTokens.length() < MAX_DISTRIBUTED_TOKENS,
            "enableDistributedToken: too many distributedTokens"
        );
        // initialize lastUpdateTime if never set before
        if (stakingInfo_.lastUpdateTime == 0) {
            stakingInfo_.lastUpdateTime = _currentBlockTimestamp();
        }
        // initialize cycleStakingPercent to the minimum if never set before
        if (stakingInfo_.cycleStakingPercent == 0) {
            stakingInfo_.cycleStakingPercent = DEFAULT_CYCLE_STAKING_PERCENT;
        }
        stakingInfo_.distributionDisabled = false;
        _distributedTokens.add(token);
        emit DistributedTokenEnabled(token);
    }

    /**
     * @dev Disables distribution of a given token as staking
     *
     * Effective from the next cycle
     */
    function disableDistributedToken(address token) external onlyOwner {
        StakingInfo storage stakingInfo_ = stakingInfo[token];
        require(
            stakingInfo_.lastUpdateTime > 0 &&
                !stakingInfo_.distributionDisabled,
            "disableDistributedToken: Already disabled staking token"
        );
        stakingInfo_.distributionDisabled = true;
        emit DistributedTokenDisabled(token);
    }

    /**
     * @dev Updates the percentage of pending staking that will be distributed during the next cycle
     *
     * Must be a value between MIN_CYCLE_STAKING_PERCENT and MAX_CYCLE_STAKING_PERCENT
     */
    function updateCycleStakingPercent(
        address token,
        uint256 percent
    ) external onlyOwner {
        require(
            percent <= MAX_CYCLE_STAKING_PERCENT,
            "updateCycleStakingPercent: percent mustn't exceed maximum"
        );
        require(
            percent >= MIN_CYCLE_STAKING_PERCENT,
            "updateCycleStakingPercent: percent mustn't exceed minimum"
        );
        StakingInfo storage stakingInfo_ = stakingInfo[token];
        uint256 previousPercent = stakingInfo_.cycleStakingPercent;
        stakingInfo_.cycleStakingPercent = percent;
        emit CycleStakingPercentUpdated(
            token,
            previousPercent,
            stakingInfo_.cycleStakingPercent
        );
    }

    /**
     * @dev remove an address from _distributedTokens
     *
     * Can only be valid for a disabled staking token and if the distribution has ended
     */
    function removeTokenFromDistributedTokens(
        address tokenToRemove
    ) external onlyOwner {
        StakingInfo storage _stakingInfo = stakingInfo[tokenToRemove];
        require(
            _stakingInfo.distributionDisabled &&
                _stakingInfo.currentDistributionAmount == 0,
            "removeTokenFromDistributedTokens: cannot be removed"
        );
        _distributedTokens.remove(tokenToRemove);
        emit DistributedTokenRemoved(tokenToRemove);
    }

    /********************************************************/
    /****************** INTERNAL FUNCTIONS ******************/
    /********************************************************/

    /**
     * @dev Returns the amount of staking token distributed every second (times 1e2)
     */
    function _stakingAmountPerSecond(
        address token
    ) internal view returns (uint256) {
        if (!_distributedTokens.contains(token)) return 0;

        return
            (stakingInfo[token].currentDistributionAmount * 1e2) /
            _cycleDurationSeconds;
    }

    /**
     * @dev Updates every user's rewards allocation for each distributed token
     */
    function _updateStakingInfo(address token) internal {
        uint256 currentBlockTimestamp = _currentBlockTimestamp();
        StakingInfo storage stakingInfo_ = stakingInfo[token];

        updateCurrentCycleStartTime();

        uint256 lastUpdateTime = stakingInfo_.lastUpdateTime;
        uint256 accStakingPerShare = stakingInfo_.accStakingPerShare;
        if (currentBlockTimestamp <= lastUpdateTime) {
            return;
        }

        // if no stGlint is allocated or initial distribution has not started yet
        if (
            totalAllocation == 0 ||
            currentBlockTimestamp < currentCycleStartTime
        ) {
            stakingInfo_.lastUpdateTime = currentBlockTimestamp;
            return;
        }

        uint256 currentDistributionAmount = stakingInfo_
            .currentDistributionAmount; // gas saving
        uint256 currentCycleDistributedAmount = stakingInfo_
            .currentCycleDistributedAmount; // gas saving

        // check if the current cycle has changed since last update
        if (lastUpdateTime < currentCycleStartTime) {
            // update accDividendPerShare for the end of the previous cycle
            accStakingPerShare =
                accStakingPerShare +
                (((currentDistributionAmount * 1e2) -
                    currentCycleDistributedAmount) * 1e16) /
                totalAllocation;

            // check if distribution is enabled
            if (!stakingInfo_.distributionDisabled) {
                // transfer the token's cycleStakingPercent part from the pending slot to the distribution slot
                stakingInfo_.distributedAmount =
                    stakingInfo_.distributedAmount +
                    currentDistributionAmount;

                uint256 pendingAmount = stakingInfo_.pendingAmount;
                currentDistributionAmount =
                    (pendingAmount * stakingInfo_.cycleStakingPercent) /
                    10000;

                stakingInfo_
                    .currentDistributionAmount = currentDistributionAmount;
                stakingInfo_.pendingAmount =
                    pendingAmount -
                    currentDistributionAmount;
            } else {
                // stop the token's distribution on next cycle
                stakingInfo_.distributedAmount =
                    stakingInfo_.distributedAmount +
                    currentDistributionAmount;
                currentDistributionAmount = 0;
                stakingInfo_.currentDistributionAmount = 0;
            }

            currentCycleDistributedAmount = 0;
            lastUpdateTime = currentCycleStartTime;
        }
        uint256 toDistribute = (currentBlockTimestamp - lastUpdateTime) *
            _stakingAmountPerSecond(token);

        // ensure that we can't distribute more than currentDistributionAmount (for instance w/ a > 24h service interruption)
        if (
            currentCycleDistributedAmount + toDistribute >
            currentDistributionAmount * 1e2
        ) {
            toDistribute =
                (currentDistributionAmount * 1e2) -
                currentCycleDistributedAmount;
        }

        stakingInfo_.currentCycleDistributedAmount =
            currentCycleDistributedAmount +
            toDistribute;

        stakingInfo_.accStakingPerShare =
            accStakingPerShare +
            ((toDistribute * 1e16) / totalAllocation);

        stakingInfo_.lastUpdateTime = currentBlockTimestamp;
    }

    /**
     * Updates "userAddress" user's and total allocations for each distributed token
     */
    function _updateUser(
        address userAddress,
        uint256 newUserAllocation,
        uint256 newTotalAllocation
    ) internal {
        uint256 previousUserAllocation = usersAllocation[userAddress];

        // for each distributedToken
        uint256 length = _distributedTokens.length();
        for (uint256 index = 0; index < length; ) {
            address token = _distributedTokens.at(index);
            _updateStakingInfo(token);

            UserInfo storage user = users[token][userAddress];
            uint256 accStakingPerShare = stakingInfo[token].accStakingPerShare;

            uint256 pending = ((previousUserAllocation * accStakingPerShare) /
                1e18) - user.rewardDebt;
            unchecked {
                user.pendingStaking = user.pendingStaking + pending;
            }

            user.rewardDebt = (newUserAllocation * accStakingPerShare) / 1e18;
            unchecked {
                ++index;
            }
        }

        usersAllocation[userAddress] = newUserAllocation;
        totalAllocation = newTotalAllocation;

        emit UserUpdated(
            userAddress,
            previousUserAllocation,
            newUserAllocation
        );
    }

    /**
     * @dev Harvests msg.sender's pending staking of a given token
     */
    function _harvestStaking(address token) internal {
        _updateStakingInfo(token);

        UserInfo storage user = users[token][msg.sender];
        uint256 accStakingPerShare = stakingInfo[token].accStakingPerShare;

        uint256 userstGlintAllocation = usersAllocation[msg.sender];
        uint256 pending = user.pendingStaking +
            (
                (((userstGlintAllocation * accStakingPerShare) / 1e18) -
                    user.rewardDebt)
            );

        user.pendingStaking = 0;
        user.rewardDebt = (userstGlintAllocation * accStakingPerShare) / 1e18;

        _safeTokenTransfer(IERC20(token), msg.sender, pending);
        emit StakingCollected(msg.sender, token, pending);
    }

    /**
     * @dev Safe token transfer function, in case rounding error causes pool to not have enough tokens
     */
    function _safeTokenTransfer(
        IERC20 token,
        address to,
        uint256 amount
    ) internal {
        if (amount > 0) {
            uint256 tokenBal = token.balanceOf(address(this));
            if (amount > tokenBal) {
                token.safeTransfer(to, tokenBal);
            } else {
                token.safeTransfer(to, amount);
            }
        }
    }

    /**
     * @dev Utility function to get the current block timestamp
     */
    function _currentBlockTimestamp() internal view virtual returns (uint256) {
        /* solhint-disable not-rely-on-time */
        return block.timestamp;
    }
}

File 2 of 10 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
        _;
    }

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

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

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

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

pragma solidity ^0.8.0;

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

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

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

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

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

        _;

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

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

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

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

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

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

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

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

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

File 5 of 10 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20.sol";
import "../../../utils/Address.sol";

/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    using Address for address;

    function safeTransfer(
        IERC20 token,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    function safeTransferFrom(
        IERC20 token,
        address from,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

    /**
     * @dev Deprecated. This function has issues similar to the ones found in
     * {IERC20-approve}, and its usage is discouraged.
     *
     * Whenever possible, use {safeIncreaseAllowance} and
     * {safeDecreaseAllowance} instead.
     */
    function safeApprove(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        // safeApprove should only be called when setting an initial allowance,
        // or when resetting it to zero. To increase and decrease it, use
        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
        require(
            (value == 0) || (token.allowance(address(this), spender) == 0),
            "SafeERC20: approve from non-zero to non-zero allowance"
        );
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
    }

    function safeIncreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        uint256 newAllowance = token.allowance(address(this), spender) + value;
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    function safeDecreaseAllowance(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            uint256 newAllowance = oldAllowance - value;
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
        }
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

        bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
        if (returndata.length > 0) {
            // Return data is optional
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}

File 6 of 10 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        (bool success, ) = recipient.call{value: amount}("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain `call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCall(target, data, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        require(isContract(target), "Address: call to non-contract");

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        require(isContract(target), "Address: static call to non-contract");

        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionDelegateCall(target, data, "Address: low-level delegate call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(isContract(target), "Address: delegate call to non-contract");

        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

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

pragma solidity ^0.8.0;

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

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

File 8 of 10 : EnumerableSet.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/structs/EnumerableSet.sol)

pragma solidity ^0.8.0;

/**
 * @dev Library for managing
 * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
 * types.
 *
 * Sets have the following properties:
 *
 * - Elements are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Elements are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```
 * contract Example {
 *     // Add the library methods
 *     using EnumerableSet for EnumerableSet.AddressSet;
 *
 *     // Declare a set state variable
 *     EnumerableSet.AddressSet private mySet;
 * }
 * ```
 *
 * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
 * and `uint256` (`UintSet`) are supported.
 */
library EnumerableSet {
    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Set type with
    // bytes32 values.
    // The Set implementation uses private functions, and user-facing
    // implementations (such as AddressSet) are just wrappers around the
    // underlying Set.
    // This means that we can only create new EnumerableSets for types that fit
    // in bytes32.

    struct Set {
        // Storage of set values
        bytes32[] _values;
        // Position of the value in the `values` array, plus 1 because index 0
        // means a value is not in the set.
        mapping(bytes32 => uint256) _indexes;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function _add(Set storage set, bytes32 value) private returns (bool) {
        if (!_contains(set, value)) {
            set._values.push(value);
            // The value is stored at length-1, but we add 1 to all indexes
            // and use 0 as a sentinel value
            set._indexes[value] = set._values.length;
            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function _remove(Set storage set, bytes32 value) private returns (bool) {
        // We read and store the value's index to prevent multiple reads from the same storage slot
        uint256 valueIndex = set._indexes[value];

        if (valueIndex != 0) {
            // Equivalent to contains(set, value)
            // To delete an element from the _values array in O(1), we swap the element to delete with the last one in
            // the array, and then remove the last element (sometimes called as 'swap and pop').
            // This modifies the order of the array, as noted in {at}.

            uint256 toDeleteIndex = valueIndex - 1;
            uint256 lastIndex = set._values.length - 1;

            if (lastIndex != toDeleteIndex) {
                bytes32 lastvalue = set._values[lastIndex];

                // Move the last value to the index where the value to delete is
                set._values[toDeleteIndex] = lastvalue;
                // Update the index for the moved value
                set._indexes[lastvalue] = valueIndex; // Replace lastvalue's index to valueIndex
            }

            // Delete the slot where the moved value was stored
            set._values.pop();

            // Delete the index for the deleted slot
            delete set._indexes[value];

            return true;
        } else {
            return false;
        }
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function _contains(Set storage set, bytes32 value) private view returns (bool) {
        return set._indexes[value] != 0;
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function _length(Set storage set) private view returns (uint256) {
        return set._values.length;
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function _at(Set storage set, uint256 index) private view returns (bytes32) {
        return set._values[index];
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function _values(Set storage set) private view returns (bytes32[] memory) {
        return set._values;
    }

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _add(set._inner, value);
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
        return _remove(set._inner, value);
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
        return _contains(set._inner, value);
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(Bytes32Set storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
        return _at(set._inner, index);
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {
        return _values(set._inner);
    }

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(AddressSet storage set, address value) internal returns (bool) {
        return _add(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(AddressSet storage set, address value) internal returns (bool) {
        return _remove(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(AddressSet storage set, address value) internal view returns (bool) {
        return _contains(set._inner, bytes32(uint256(uint160(value))));
    }

    /**
     * @dev Returns the number of values in the set. O(1).
     */
    function length(AddressSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(AddressSet storage set, uint256 index) internal view returns (address) {
        return address(uint160(uint256(_at(set._inner, index))));
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(AddressSet storage set) internal view returns (address[] memory) {
        bytes32[] memory store = _values(set._inner);
        address[] memory result;

        assembly {
            result := store
        }

        return result;
    }

    // UintSet

    struct UintSet {
        Set _inner;
    }

    /**
     * @dev Add a value to a set. O(1).
     *
     * Returns true if the value was added to the set, that is if it was not
     * already present.
     */
    function add(UintSet storage set, uint256 value) internal returns (bool) {
        return _add(set._inner, bytes32(value));
    }

    /**
     * @dev Removes a value from a set. O(1).
     *
     * Returns true if the value was removed from the set, that is if it was
     * present.
     */
    function remove(UintSet storage set, uint256 value) internal returns (bool) {
        return _remove(set._inner, bytes32(value));
    }

    /**
     * @dev Returns true if the value is in the set. O(1).
     */
    function contains(UintSet storage set, uint256 value) internal view returns (bool) {
        return _contains(set._inner, bytes32(value));
    }

    /**
     * @dev Returns the number of values on the set. O(1).
     */
    function length(UintSet storage set) internal view returns (uint256) {
        return _length(set._inner);
    }

    /**
     * @dev Returns the value stored at position `index` in the set. O(1).
     *
     * Note that there are no guarantees on the ordering of values inside the
     * array, and it may change when more values are added or removed.
     *
     * Requirements:
     *
     * - `index` must be strictly less than {length}.
     */
    function at(UintSet storage set, uint256 index) internal view returns (uint256) {
        return uint256(_at(set._inner, index));
    }

    /**
     * @dev Return the entire set in an array
     *
     * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
     * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
     * this function has an unbounded cost, and using it as part of a state-changing function may render the function
     * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
     */
    function values(UintSet storage set) internal view returns (uint256[] memory) {
        bytes32[] memory store = _values(set._inner);
        uint256[] memory result;

        assembly {
            result := store
        }

        return result;
    }
}

File 9 of 10 : IStaking.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;

interface IStaking {
    function distributedTokensLength() external view returns (uint256);

    function distributedToken(uint256 index) external view returns (address);

    function isDistributedToken(address token) external view returns (bool);

    function addRewardsToPending(address token, uint256 amount) external;
}

File 10 of 10 : IstGlintUsage.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;

interface IstGlintUsage {
    function allocate(address userAddress, uint256 amount, bytes calldata data) external;
    function deallocate(address userAddress, uint256 amount, bytes calldata data) external;
}

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

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_stGlint","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"previousValue","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newValue","type":"uint256"}],"name":"CycleStakingPercentUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"}],"name":"DistributedTokenDisabled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"}],"name":"DistributedTokenEnabled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"}],"name":"DistributedTokenRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"RewardAddedToPending","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"StakingCollected","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"previousBalance","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newBalance","type":"uint256"}],"name":"UserUpdated","type":"event"},{"inputs":[],"name":"DEFAULT_CYCLE_STAKING_PERCENT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_CYCLE_STAKING_PERCENT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_DISTRIBUTED_TOKENS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MIN_CYCLE_STAKING_PERCENT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"addRewardsToPending","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"userAddress","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"allocate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"currentCycleStartTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"cycleDurationSeconds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"userAddress","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"deallocate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"disableDistributedToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"distributedToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"distributedTokensLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"}],"name":"emergencyWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"emergencyWithdrawAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"enableDistributedToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"harvestAllStaking","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"harvestStaking","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"isDistributedToken","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"massUpdateStakingInfo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"nextCycleStartTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"address","name":"userAddress","type":"address"}],"name":"pendingStakingAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"tokenToRemove","type":"address"}],"name":"removeTokenFromDistributedTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"stGlint","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"stakingInfo","outputs":[{"internalType":"uint256","name":"currentDistributionAmount","type":"uint256"},{"internalType":"uint256","name":"currentCycleDistributedAmount","type":"uint256"},{"internalType":"uint256","name":"pendingAmount","type":"uint256"},{"internalType":"uint256","name":"distributedAmount","type":"uint256"},{"internalType":"uint256","name":"accStakingPerShare","type":"uint256"},{"internalType":"uint256","name":"lastUpdateTime","type":"uint256"},{"internalType":"uint256","name":"cycleStakingPercent","type":"uint256"},{"internalType":"bool","name":"distributionDisabled","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"startStaking","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"totalAllocation","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"updateCurrentCycleStartTime","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"percent","type":"uint256"}],"name":"updateCycleStakingPercent","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"updateStakingInfo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"users","outputs":[{"internalType":"uint256","name":"pendingStaking","type":"uint256"},{"internalType":"uint256","name":"rewardDebt","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"usersAllocation","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]

60a060405262093a806008553480156200001857600080fd5b5060405162002764380380620027648339810160408190526200003b9162000109565b6200004633620000b9565b600180556001600160a01b038116620000945760405162461bcd60e51b815260206004820152600c60248201526b7a65726f206164647265737360a01b604482015260640160405180910390fd5b620000a4426301e133806200013b565b6009556001600160a01b031660805262000163565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000602082840312156200011c57600080fd5b81516001600160a01b03811681146200013457600080fd5b9392505050565b808201808211156200015d57634e487b7160e01b600052601160045260246000fd5b92915050565b6080516125d76200018d600039600081816102a60152818161070101526109ea01526125d76000f3fe608060405234801561001057600080fd5b50600436106102265760003560e01c806394eecb501161012a578063d5cf3193116100bd578063de9d477e1161008c578063f2fde38b11610071578063f2fde38b146104fa578063f329c5071461050d578063f6f2e1de1461051557600080fd5b8063de9d477e146104d4578063e895cca3146104e757600080fd5b8063d5cf3193146104b3578063d637ff83146104bc578063dd191719146104c4578063ddd48f47146104cc57600080fd5b8063c4d3e083116100f9578063c4d3e08314610470578063cc2dae8314610490578063d2af0b94146104a3578063d2c5a2ea146104ab57600080fd5b806394eecb50146103bc5780639c70629a1461044d578063a125e09814610460578063bd394a8d1461046857600080fd5b80635d9b436a116101bd57806371b0cbfa1161018c578063799fb96511610171578063799fb9651461038f5780638da5cb5b1461039857806393c563af146103a957600080fd5b806371b0cbfa1461037057806379203dc41461037857600080fd5b80635d9b436a146102fb5780635e80536a1461030e5780636ff1c9bc14610355578063715018a61461036857600080fd5b80632710fbc2116101f95780632710fbc21461028e57806335034c85146102a1578063549230c9146102e05780635726d26e146102f357600080fd5b8063034d7fcb1461022b57806307412910146102535780631039850a146102685780631c75e3691461027b575b600080fd5b61023e61023936600461232e565b61051d565b60405190151581526020015b60405180910390f35b61026661026136600461232e565b610530565b005b61026661027636600461232e565b610614565b61026661028936600461234b565b61069f565b61026661029c3660046123d4565b6107d0565b6102c87f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200161024a565b6102666102ee36600461234b565b610988565b610266610aa0565b6102c8610309366004612400565b610abc565b61034061031c366004612419565b60056020908152600092835260408084209091529082529020805460019091015482565b6040805192835260208301919091520161024a565b61026661036336600461232e565b610b4f565b610266610cf6565b610266610d5c565b61038160075481565b60405190815260200161024a565b61038160095481565b6000546001600160a01b03166102c8565b6102666103b736600461232e565b610e0d565b6104106103ca36600461232e565b6004602081905260009182526040909120805460018201546002830154600384015494840154600585015460068601546007909601549496939592949192909160ff1688565b604080519889526020890197909752958701949094526060860192909252608085015260a084015260c0830152151560e08201526101000161024a565b61038161045b366004612419565b610ffc565b61026661118c565b6103816111c0565b61038161047e36600461232e565b60066020526000908152604090205481565b61026661049e3660046123d4565b6111d1565b610381600a81565b610266611391565b61038161271081565b61038161141f565b610266611431565b600854610381565b6102666104e236600461232e565b611511565b6102666104f536600461232e565b61164c565b61026661050836600461232e565b61178f565b610381600181565b610381606481565b600061052a60028361186e565b92915050565b6002600154036105875760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064015b60405180910390fd5b60026001819055610598908261186e565b610604576001600160a01b0381166000908152600460205260409020600301546106045760405162461bcd60e51b815260206004820152601d60248201527f686172766573745374616b696e673a20696e76616c696420746f6b656e000000604482015260640161057e565b61060d81611890565b5060018055565b8061062060028261186e565b6106925760405162461bcd60e51b815260206004820152603060248201527f76616c69646174654469737472696275746564546f6b656e733a20746f6b656e60448201527f20646f6573206e6f742065786973747300000000000000000000000000000000606482015260840161057e565b61069b8261198c565b5050565b6002600154036106f15760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161057e565b6002600155336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146107815760405162461bcd60e51b815260206004820152602a60248201527f7374476c696e74546f6b656e4f6e6c793a2063616c6c65722073686f756c64206044820152691899481cdd11db1a5b9d60b21b606482015260840161057e565b6001600160a01b0384166000908152600660205260408120546107a5908590612468565b90506000846007546107b79190612468565b90506107c4868383611b5b565b50506001805550505050565b6000546001600160a01b0316331461082a5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161057e565b6127108111156108a25760405162461bcd60e51b815260206004820152603960248201527f7570646174654379636c655374616b696e6750657263656e743a20706572636560448201527f6e74206d7573746e277420657863656564206d6178696d756d00000000000000606482015260840161057e565b60018110156109195760405162461bcd60e51b815260206004820152603960248201527f7570646174654379636c655374616b696e6750657263656e743a20706572636560448201527f6e74206d7573746e277420657863656564206d696e696d756d00000000000000606482015260840161057e565b6001600160a01b038216600081815260046020526040908190206006810180549085905591519092907fe3964874d2245da8d2f4166079ded7c86f2c4d7e4f86d2ac2a7927bfb3b36ba49061097a9084908790918252602082015260400190565b60405180910390a250505050565b6002600154036109da5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161057e565b6002600155336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614610a6a5760405162461bcd60e51b815260206004820152602a60248201527f7374476c696e74546f6b656e4f6e6c793a2063616c6c65722073686f756c64206044820152691899481cdd11db1a5b9d60b21b606482015260840161057e565b6001600160a01b038416600090815260066020526040812054610a8e90859061247b565b90506000846007546107b7919061247b565b6000610aaa61141f565b9050804210610ab95760098190555b50565b600081610ac96002611ca5565b8110610b3d5760405162461bcd60e51b815260206004820152602d60248201527f76616c69646174654469737472696275746564546f6b656e73496e6465783a2060448201527f696e646578206578697374733f00000000000000000000000000000000000000606482015260840161057e565b610b48600284611caf565b9392505050565b600260015403610ba15760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161057e565b60026001556000546001600160a01b03163314610c005760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161057e565b6040516370a0823160e01b81523060048201526000906001600160a01b038316906370a0823190602401602060405180830381865afa158015610c47573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c6b919061248e565b905060008111610ce35760405162461bcd60e51b815260206004820152602860248201527f656d657267656e637957697468647261773a20746f6b656e2062616c616e636560448201527f206973206e756c6c000000000000000000000000000000000000000000000000606482015260840161057e565b610cee823383611cbb565b505060018055565b6000546001600160a01b03163314610d505760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161057e565b610d5a6000611d6a565b565b6000546001600160a01b03163314610db65760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161057e565b6009544210610e075760405162461bcd60e51b815260206004820152601c60248201527f646973747269627574696f6e20616c7265616479207374617274656400000000604482015260640161057e565b42600955565b6000546001600160a01b03163314610e675760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161057e565b6001600160a01b038116600090815260046020526040902060058101541580610e945750600781015460ff165b610f065760405162461bcd60e51b815260206004820152603560248201527f656e61626c654469737472696275746564546f6b656e3a20416c72656164792060448201527f656e61626c6564207374616b696e6720746f6b656e0000000000000000000000606482015260840161057e565b600a610f126002611ca5565b10610f855760405162461bcd60e51b815260206004820152603260248201527f656e61626c654469737472696275746564546f6b656e3a20746f6f206d616e7960448201527f206469737472696275746564546f6b656e730000000000000000000000000000606482015260840161057e565b8060050154600003610f98574260058201555b8060060154600003610fac57606460068201555b60078101805460ff19169055610fc3600283611dd2565b506040516001600160a01b038316907fefa645a0ab6703d2f2e7f177f50d16c90ce1c71e317bb91cbbdab430e0a3968290600090a25050565b60006007546000036110105750600061052a565b6001600160a01b03831660009081526004602081905260408220908101546005820154919290919061104187611de7565b905061104b61141f565b4211156110d457600754818361105f61141f565b611069919061247b565b61107391906124a7565b61108490662386f26fc100006124a7565b61108e91906124be565b6110989084612468565b92506110a261141f565b915060085460646110b391906124a7565b846006015485600201546110c791906124a7565b6110d191906124be565b90505b6007546110e882662386f26fc100006124a7565b6110f2844261247b565b6110fc91906124a7565b61110691906124be565b6111109084612468565b6001600160a01b038881166000908152600560209081526040808320938b1683529281528282208054600190910154600690925292909120549295509091670de0b6b3a7640000906111639087906124a7565b61116d91906124be565b611177919061247b565b6111819190612468565b979650505050505050565b60006111986002611ca5565b905060005b8181101561069b576111b86111b3600283611caf565b61198c565b60010161119d565b60006111cc6002611ca5565b905090565b6002600154036112235760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161057e565b60026001556040516370a0823160e01b81523060048201526000906001600160a01b038416906370a0823190602401602060405180830381865afa15801561126f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611293919061248e565b6001600160a01b03841660008181526004602052604090209192506112ba90333086611e31565b6040516370a0823160e01b815230600482015260009083906001600160a01b038716906370a0823190602401602060405180830381865afa158015611303573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611327919061248e565b611331919061247b565b90508082600201546113439190612468565b60028301556040518181526001600160a01b038616907f4a383e8494aeace25927172bd6bccd1fe10777e0c92ed9fa226518589c0d21ec9060200160405180910390a2505060018055505050565b6002600154036113e35760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161057e565b600260018190555060006113f76002611ca5565b905060005b81811015610cee57611417611412600283611caf565b611890565b6001016113fc565b60006008546009546111cc9190612468565b6002600154036114835760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161057e565b60026001556000546001600160a01b031633146114e25760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161057e565b60006114ee6002611ca5565b905060005b81811015610cee57611509610363600283611caf565b6001016114f3565b6000546001600160a01b0316331461156b5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161057e565b6001600160a01b0381166000908152600460205260409020600781015460ff16801561159657508054155b6116085760405162461bcd60e51b815260206004820152603360248201527f72656d6f7665546f6b656e46726f6d4469737472696275746564546f6b656e7360448201527f3a2063616e6e6f742062652072656d6f76656400000000000000000000000000606482015260840161057e565b611613600283611ee2565b506040516001600160a01b038316907f17cd3cc84c669de8c5c4218fd1d9814e647b547d1e7f59287ea6989aa4e032c290600090a25050565b6000546001600160a01b031633146116a65760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161057e565b6001600160a01b03811660009081526004602052604090206005810154158015906116d65750600781015460ff16155b6117485760405162461bcd60e51b815260206004820152603760248201527f64697361626c654469737472696275746564546f6b656e3a20416c726561647960448201527f2064697361626c6564207374616b696e6720746f6b656e000000000000000000606482015260840161057e565b60078101805460ff191660011790556040516001600160a01b038316907f961f10509197d967c55f8720c2b6a80d48433ef36db1b12cf3bf6bcf66da434690600090a25050565b6000546001600160a01b031633146117e95760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161057e565b6001600160a01b0381166118655760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161057e565b610ab981611d6a565b6001600160a01b03811660009081526001830160205260408120541515610b48565b6118998161198c565b6001600160a01b038116600081815260056020908152604080832033808552908352818420948452600480845282852001549084526006909252822054600184015491929091670de0b6b3a76400006118f285856124a7565b6118fc91906124be565b611906919061247b565b84546119129190612468565b600085559050670de0b6b3a764000061192b84846124a7565b61193591906124be565b6001850155611945853383611cbb565b6040518181526001600160a01b0386169033907f26fe2fa4c54c8e64d14287e80be68c56cdd4b183cc3ad6d6e0f5045f1d0f57459060200160405180910390a35050505050565b6001600160a01b038116600090815260046020526040902042906119ae610aa0565b600581015460048201548184116119c6575050505050565b60075415806119d6575060095484105b156119e45750506005015550565b82546001840154600954841015611ab95760075481611a048460646124a7565b611a0e919061247b565b611a1f90662386f26fc100006124a7565b611a2991906124be565b611a339084612468565b600786015490935060ff16611a9357818560030154611a529190612468565b60038601556002850154600686015461271090611a6f90836124a7565b611a7991906124be565b8087559250611a88838261247b565b600287015550611ab0565b818560030154611aa39190612468565b6003860155600080865591505b50600954925060005b6000611ac488611de7565b611ace868961247b565b611ad891906124a7565b9050611ae58360646124a7565b611aef8284612468565b1115611b0e5781611b018460646124a7565b611b0b919061247b565b90505b611b188183612468565b6001870155600754611b3182662386f26fc100006124a7565b611b3b91906124be565b611b459085612468565b6004870155505050506005909101919091555050565b6001600160a01b03831660009081526006602052604081205490611b7f6002611ca5565b905060005b81811015611c43576000611b99600283611caf565b9050611ba48161198c565b6001600160a01b038082166000818152600560209081526040808320948c16835293815283822092825260049081905292812090920154600182015491929091670de0b6b3a7640000611bf7848a6124a7565b611c0191906124be565b611c0b919061247b565b8354810184559050670de0b6b3a7640000611c26838b6124a7565b611c3091906124be565b6001938401555050919091019050611b84565b506001600160a01b038516600081815260066020908152604091829020879055600786905581518581529081018790527f97ce9d7086176d6da45e4e7999788176e2629a7591ffe505b0c1b13fe8052cc6910160405180910390a25050505050565b600061052a825490565b6000610b488383611ef7565b8015611d65576040516370a0823160e01b81523060048201526000906001600160a01b038516906370a0823190602401602060405180830381865afa158015611d08573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d2c919061248e565b905080821115611d4f57611d4a6001600160a01b0385168483611f21565b611d63565b611d636001600160a01b0385168484611f21565b505b505050565b600080546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000610b48836001600160a01b038416611f6a565b6000611df460028361186e565b611e0057506000919050565b6008546001600160a01b038316600090815260046020526040902054611e279060646124a7565b61052a91906124be565b6040516001600160a01b0380851660248301528316604482015260648101829052611d639085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152611fb9565b6000610b48836001600160a01b03841661209e565b6000826000018281548110611f0e57611f0e6124e0565b9060005260206000200154905092915050565b6040516001600160a01b038316602482015260448101829052611d659084907fa9059cbb0000000000000000000000000000000000000000000000000000000090606401611e7e565b6000818152600183016020526040812054611fb15750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915561052a565b50600061052a565b600061200e826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166121919092919063ffffffff16565b805190915015611d65578080602001905181019061202c91906124f6565b611d655760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f74207375636365656400000000000000000000000000000000000000000000606482015260840161057e565b600081815260018301602052604081205480156121875760006120c260018361247b565b85549091506000906120d69060019061247b565b905081811461213b5760008660000182815481106120f6576120f66124e0565b9060005260206000200154905080876000018481548110612119576121196124e0565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061214c5761214c612518565b60019003818190600052602060002001600090559055856001016000868152602001908152602001600020600090556001935050505061052a565b600091505061052a565b60606121a084846000856121a8565b949350505050565b6060824710156122205760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c0000000000000000000000000000000000000000000000000000606482015260840161057e565b6001600160a01b0385163b6122775760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161057e565b600080866001600160a01b031685876040516122939190612552565b60006040518083038185875af1925050503d80600081146122d0576040519150601f19603f3d011682016040523d82523d6000602084013e6122d5565b606091505b5091509150611181828286606083156122ef575081610b48565b8251156122ff5782518084602001fd5b8160405162461bcd60e51b815260040161057e919061256e565b6001600160a01b0381168114610ab957600080fd5b60006020828403121561234057600080fd5b8135610b4881612319565b6000806000806060858703121561236157600080fd5b843561236c81612319565b935060208501359250604085013567ffffffffffffffff8082111561239057600080fd5b818701915087601f8301126123a457600080fd5b8135818111156123b357600080fd5b8860208285010111156123c557600080fd5b95989497505060200194505050565b600080604083850312156123e757600080fd5b82356123f281612319565b946020939093013593505050565b60006020828403121561241257600080fd5b5035919050565b6000806040838503121561242c57600080fd5b823561243781612319565b9150602083013561244781612319565b809150509250929050565b634e487b7160e01b600052601160045260246000fd5b8082018082111561052a5761052a612452565b8181038181111561052a5761052a612452565b6000602082840312156124a057600080fd5b5051919050565b808202811582820484141761052a5761052a612452565b6000826124db57634e487b7160e01b600052601260045260246000fd5b500490565b634e487b7160e01b600052603260045260246000fd5b60006020828403121561250857600080fd5b81518015158114610b4857600080fd5b634e487b7160e01b600052603160045260246000fd5b60005b83811015612549578181015183820152602001612531565b50506000910152565b6000825161256481846020870161252e565b9190910192915050565b602081526000825180602084015261258d81604085016020870161252e565b601f01601f1916919091016040019291505056fea2646970667358221220c6662430e4c9e51d50e939bb77a89a60a7f3bdb534e357561f40f4eae31eb21c64736f6c6343000813003300000000000000000000000063d43d0edda7de4b5ed9b2f2aa855f81fbd71697

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106102265760003560e01c806394eecb501161012a578063d5cf3193116100bd578063de9d477e1161008c578063f2fde38b11610071578063f2fde38b146104fa578063f329c5071461050d578063f6f2e1de1461051557600080fd5b8063de9d477e146104d4578063e895cca3146104e757600080fd5b8063d5cf3193146104b3578063d637ff83146104bc578063dd191719146104c4578063ddd48f47146104cc57600080fd5b8063c4d3e083116100f9578063c4d3e08314610470578063cc2dae8314610490578063d2af0b94146104a3578063d2c5a2ea146104ab57600080fd5b806394eecb50146103bc5780639c70629a1461044d578063a125e09814610460578063bd394a8d1461046857600080fd5b80635d9b436a116101bd57806371b0cbfa1161018c578063799fb96511610171578063799fb9651461038f5780638da5cb5b1461039857806393c563af146103a957600080fd5b806371b0cbfa1461037057806379203dc41461037857600080fd5b80635d9b436a146102fb5780635e80536a1461030e5780636ff1c9bc14610355578063715018a61461036857600080fd5b80632710fbc2116101f95780632710fbc21461028e57806335034c85146102a1578063549230c9146102e05780635726d26e146102f357600080fd5b8063034d7fcb1461022b57806307412910146102535780631039850a146102685780631c75e3691461027b575b600080fd5b61023e61023936600461232e565b61051d565b60405190151581526020015b60405180910390f35b61026661026136600461232e565b610530565b005b61026661027636600461232e565b610614565b61026661028936600461234b565b61069f565b61026661029c3660046123d4565b6107d0565b6102c87f00000000000000000000000063d43d0edda7de4b5ed9b2f2aa855f81fbd7169781565b6040516001600160a01b03909116815260200161024a565b6102666102ee36600461234b565b610988565b610266610aa0565b6102c8610309366004612400565b610abc565b61034061031c366004612419565b60056020908152600092835260408084209091529082529020805460019091015482565b6040805192835260208301919091520161024a565b61026661036336600461232e565b610b4f565b610266610cf6565b610266610d5c565b61038160075481565b60405190815260200161024a565b61038160095481565b6000546001600160a01b03166102c8565b6102666103b736600461232e565b610e0d565b6104106103ca36600461232e565b6004602081905260009182526040909120805460018201546002830154600384015494840154600585015460068601546007909601549496939592949192909160ff1688565b604080519889526020890197909752958701949094526060860192909252608085015260a084015260c0830152151560e08201526101000161024a565b61038161045b366004612419565b610ffc565b61026661118c565b6103816111c0565b61038161047e36600461232e565b60066020526000908152604090205481565b61026661049e3660046123d4565b6111d1565b610381600a81565b610266611391565b61038161271081565b61038161141f565b610266611431565b600854610381565b6102666104e236600461232e565b611511565b6102666104f536600461232e565b61164c565b61026661050836600461232e565b61178f565b610381600181565b610381606481565b600061052a60028361186e565b92915050565b6002600154036105875760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064015b60405180910390fd5b60026001819055610598908261186e565b610604576001600160a01b0381166000908152600460205260409020600301546106045760405162461bcd60e51b815260206004820152601d60248201527f686172766573745374616b696e673a20696e76616c696420746f6b656e000000604482015260640161057e565b61060d81611890565b5060018055565b8061062060028261186e565b6106925760405162461bcd60e51b815260206004820152603060248201527f76616c69646174654469737472696275746564546f6b656e733a20746f6b656e60448201527f20646f6573206e6f742065786973747300000000000000000000000000000000606482015260840161057e565b61069b8261198c565b5050565b6002600154036106f15760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161057e565b6002600155336001600160a01b037f00000000000000000000000063d43d0edda7de4b5ed9b2f2aa855f81fbd7169716146107815760405162461bcd60e51b815260206004820152602a60248201527f7374476c696e74546f6b656e4f6e6c793a2063616c6c65722073686f756c64206044820152691899481cdd11db1a5b9d60b21b606482015260840161057e565b6001600160a01b0384166000908152600660205260408120546107a5908590612468565b90506000846007546107b79190612468565b90506107c4868383611b5b565b50506001805550505050565b6000546001600160a01b0316331461082a5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161057e565b6127108111156108a25760405162461bcd60e51b815260206004820152603960248201527f7570646174654379636c655374616b696e6750657263656e743a20706572636560448201527f6e74206d7573746e277420657863656564206d6178696d756d00000000000000606482015260840161057e565b60018110156109195760405162461bcd60e51b815260206004820152603960248201527f7570646174654379636c655374616b696e6750657263656e743a20706572636560448201527f6e74206d7573746e277420657863656564206d696e696d756d00000000000000606482015260840161057e565b6001600160a01b038216600081815260046020526040908190206006810180549085905591519092907fe3964874d2245da8d2f4166079ded7c86f2c4d7e4f86d2ac2a7927bfb3b36ba49061097a9084908790918252602082015260400190565b60405180910390a250505050565b6002600154036109da5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161057e565b6002600155336001600160a01b037f00000000000000000000000063d43d0edda7de4b5ed9b2f2aa855f81fbd716971614610a6a5760405162461bcd60e51b815260206004820152602a60248201527f7374476c696e74546f6b656e4f6e6c793a2063616c6c65722073686f756c64206044820152691899481cdd11db1a5b9d60b21b606482015260840161057e565b6001600160a01b038416600090815260066020526040812054610a8e90859061247b565b90506000846007546107b7919061247b565b6000610aaa61141f565b9050804210610ab95760098190555b50565b600081610ac96002611ca5565b8110610b3d5760405162461bcd60e51b815260206004820152602d60248201527f76616c69646174654469737472696275746564546f6b656e73496e6465783a2060448201527f696e646578206578697374733f00000000000000000000000000000000000000606482015260840161057e565b610b48600284611caf565b9392505050565b600260015403610ba15760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161057e565b60026001556000546001600160a01b03163314610c005760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161057e565b6040516370a0823160e01b81523060048201526000906001600160a01b038316906370a0823190602401602060405180830381865afa158015610c47573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c6b919061248e565b905060008111610ce35760405162461bcd60e51b815260206004820152602860248201527f656d657267656e637957697468647261773a20746f6b656e2062616c616e636560448201527f206973206e756c6c000000000000000000000000000000000000000000000000606482015260840161057e565b610cee823383611cbb565b505060018055565b6000546001600160a01b03163314610d505760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161057e565b610d5a6000611d6a565b565b6000546001600160a01b03163314610db65760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161057e565b6009544210610e075760405162461bcd60e51b815260206004820152601c60248201527f646973747269627574696f6e20616c7265616479207374617274656400000000604482015260640161057e565b42600955565b6000546001600160a01b03163314610e675760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161057e565b6001600160a01b038116600090815260046020526040902060058101541580610e945750600781015460ff165b610f065760405162461bcd60e51b815260206004820152603560248201527f656e61626c654469737472696275746564546f6b656e3a20416c72656164792060448201527f656e61626c6564207374616b696e6720746f6b656e0000000000000000000000606482015260840161057e565b600a610f126002611ca5565b10610f855760405162461bcd60e51b815260206004820152603260248201527f656e61626c654469737472696275746564546f6b656e3a20746f6f206d616e7960448201527f206469737472696275746564546f6b656e730000000000000000000000000000606482015260840161057e565b8060050154600003610f98574260058201555b8060060154600003610fac57606460068201555b60078101805460ff19169055610fc3600283611dd2565b506040516001600160a01b038316907fefa645a0ab6703d2f2e7f177f50d16c90ce1c71e317bb91cbbdab430e0a3968290600090a25050565b60006007546000036110105750600061052a565b6001600160a01b03831660009081526004602081905260408220908101546005820154919290919061104187611de7565b905061104b61141f565b4211156110d457600754818361105f61141f565b611069919061247b565b61107391906124a7565b61108490662386f26fc100006124a7565b61108e91906124be565b6110989084612468565b92506110a261141f565b915060085460646110b391906124a7565b846006015485600201546110c791906124a7565b6110d191906124be565b90505b6007546110e882662386f26fc100006124a7565b6110f2844261247b565b6110fc91906124a7565b61110691906124be565b6111109084612468565b6001600160a01b038881166000908152600560209081526040808320938b1683529281528282208054600190910154600690925292909120549295509091670de0b6b3a7640000906111639087906124a7565b61116d91906124be565b611177919061247b565b6111819190612468565b979650505050505050565b60006111986002611ca5565b905060005b8181101561069b576111b86111b3600283611caf565b61198c565b60010161119d565b60006111cc6002611ca5565b905090565b6002600154036112235760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161057e565b60026001556040516370a0823160e01b81523060048201526000906001600160a01b038416906370a0823190602401602060405180830381865afa15801561126f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611293919061248e565b6001600160a01b03841660008181526004602052604090209192506112ba90333086611e31565b6040516370a0823160e01b815230600482015260009083906001600160a01b038716906370a0823190602401602060405180830381865afa158015611303573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611327919061248e565b611331919061247b565b90508082600201546113439190612468565b60028301556040518181526001600160a01b038616907f4a383e8494aeace25927172bd6bccd1fe10777e0c92ed9fa226518589c0d21ec9060200160405180910390a2505060018055505050565b6002600154036113e35760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161057e565b600260018190555060006113f76002611ca5565b905060005b81811015610cee57611417611412600283611caf565b611890565b6001016113fc565b60006008546009546111cc9190612468565b6002600154036114835760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161057e565b60026001556000546001600160a01b031633146114e25760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161057e565b60006114ee6002611ca5565b905060005b81811015610cee57611509610363600283611caf565b6001016114f3565b6000546001600160a01b0316331461156b5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161057e565b6001600160a01b0381166000908152600460205260409020600781015460ff16801561159657508054155b6116085760405162461bcd60e51b815260206004820152603360248201527f72656d6f7665546f6b656e46726f6d4469737472696275746564546f6b656e7360448201527f3a2063616e6e6f742062652072656d6f76656400000000000000000000000000606482015260840161057e565b611613600283611ee2565b506040516001600160a01b038316907f17cd3cc84c669de8c5c4218fd1d9814e647b547d1e7f59287ea6989aa4e032c290600090a25050565b6000546001600160a01b031633146116a65760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161057e565b6001600160a01b03811660009081526004602052604090206005810154158015906116d65750600781015460ff16155b6117485760405162461bcd60e51b815260206004820152603760248201527f64697361626c654469737472696275746564546f6b656e3a20416c726561647960448201527f2064697361626c6564207374616b696e6720746f6b656e000000000000000000606482015260840161057e565b60078101805460ff191660011790556040516001600160a01b038316907f961f10509197d967c55f8720c2b6a80d48433ef36db1b12cf3bf6bcf66da434690600090a25050565b6000546001600160a01b031633146117e95760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161057e565b6001600160a01b0381166118655760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161057e565b610ab981611d6a565b6001600160a01b03811660009081526001830160205260408120541515610b48565b6118998161198c565b6001600160a01b038116600081815260056020908152604080832033808552908352818420948452600480845282852001549084526006909252822054600184015491929091670de0b6b3a76400006118f285856124a7565b6118fc91906124be565b611906919061247b565b84546119129190612468565b600085559050670de0b6b3a764000061192b84846124a7565b61193591906124be565b6001850155611945853383611cbb565b6040518181526001600160a01b0386169033907f26fe2fa4c54c8e64d14287e80be68c56cdd4b183cc3ad6d6e0f5045f1d0f57459060200160405180910390a35050505050565b6001600160a01b038116600090815260046020526040902042906119ae610aa0565b600581015460048201548184116119c6575050505050565b60075415806119d6575060095484105b156119e45750506005015550565b82546001840154600954841015611ab95760075481611a048460646124a7565b611a0e919061247b565b611a1f90662386f26fc100006124a7565b611a2991906124be565b611a339084612468565b600786015490935060ff16611a9357818560030154611a529190612468565b60038601556002850154600686015461271090611a6f90836124a7565b611a7991906124be565b8087559250611a88838261247b565b600287015550611ab0565b818560030154611aa39190612468565b6003860155600080865591505b50600954925060005b6000611ac488611de7565b611ace868961247b565b611ad891906124a7565b9050611ae58360646124a7565b611aef8284612468565b1115611b0e5781611b018460646124a7565b611b0b919061247b565b90505b611b188183612468565b6001870155600754611b3182662386f26fc100006124a7565b611b3b91906124be565b611b459085612468565b6004870155505050506005909101919091555050565b6001600160a01b03831660009081526006602052604081205490611b7f6002611ca5565b905060005b81811015611c43576000611b99600283611caf565b9050611ba48161198c565b6001600160a01b038082166000818152600560209081526040808320948c16835293815283822092825260049081905292812090920154600182015491929091670de0b6b3a7640000611bf7848a6124a7565b611c0191906124be565b611c0b919061247b565b8354810184559050670de0b6b3a7640000611c26838b6124a7565b611c3091906124be565b6001938401555050919091019050611b84565b506001600160a01b038516600081815260066020908152604091829020879055600786905581518581529081018790527f97ce9d7086176d6da45e4e7999788176e2629a7591ffe505b0c1b13fe8052cc6910160405180910390a25050505050565b600061052a825490565b6000610b488383611ef7565b8015611d65576040516370a0823160e01b81523060048201526000906001600160a01b038516906370a0823190602401602060405180830381865afa158015611d08573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d2c919061248e565b905080821115611d4f57611d4a6001600160a01b0385168483611f21565b611d63565b611d636001600160a01b0385168484611f21565b505b505050565b600080546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000610b48836001600160a01b038416611f6a565b6000611df460028361186e565b611e0057506000919050565b6008546001600160a01b038316600090815260046020526040902054611e279060646124a7565b61052a91906124be565b6040516001600160a01b0380851660248301528316604482015260648101829052611d639085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152611fb9565b6000610b48836001600160a01b03841661209e565b6000826000018281548110611f0e57611f0e6124e0565b9060005260206000200154905092915050565b6040516001600160a01b038316602482015260448101829052611d659084907fa9059cbb0000000000000000000000000000000000000000000000000000000090606401611e7e565b6000818152600183016020526040812054611fb15750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915561052a565b50600061052a565b600061200e826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166121919092919063ffffffff16565b805190915015611d65578080602001905181019061202c91906124f6565b611d655760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f74207375636365656400000000000000000000000000000000000000000000606482015260840161057e565b600081815260018301602052604081205480156121875760006120c260018361247b565b85549091506000906120d69060019061247b565b905081811461213b5760008660000182815481106120f6576120f66124e0565b9060005260206000200154905080876000018481548110612119576121196124e0565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061214c5761214c612518565b60019003818190600052602060002001600090559055856001016000868152602001908152602001600020600090556001935050505061052a565b600091505061052a565b60606121a084846000856121a8565b949350505050565b6060824710156122205760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c0000000000000000000000000000000000000000000000000000606482015260840161057e565b6001600160a01b0385163b6122775760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161057e565b600080866001600160a01b031685876040516122939190612552565b60006040518083038185875af1925050503d80600081146122d0576040519150601f19603f3d011682016040523d82523d6000602084013e6122d5565b606091505b5091509150611181828286606083156122ef575081610b48565b8251156122ff5782518084602001fd5b8160405162461bcd60e51b815260040161057e919061256e565b6001600160a01b0381168114610ab957600080fd5b60006020828403121561234057600080fd5b8135610b4881612319565b6000806000806060858703121561236157600080fd5b843561236c81612319565b935060208501359250604085013567ffffffffffffffff8082111561239057600080fd5b818701915087601f8301126123a457600080fd5b8135818111156123b357600080fd5b8860208285010111156123c557600080fd5b95989497505060200194505050565b600080604083850312156123e757600080fd5b82356123f281612319565b946020939093013593505050565b60006020828403121561241257600080fd5b5035919050565b6000806040838503121561242c57600080fd5b823561243781612319565b9150602083013561244781612319565b809150509250929050565b634e487b7160e01b600052601160045260246000fd5b8082018082111561052a5761052a612452565b8181038181111561052a5761052a612452565b6000602082840312156124a057600080fd5b5051919050565b808202811582820484141761052a5761052a612452565b6000826124db57634e487b7160e01b600052601260045260246000fd5b500490565b634e487b7160e01b600052603260045260246000fd5b60006020828403121561250857600080fd5b81518015158114610b4857600080fd5b634e487b7160e01b600052603160045260246000fd5b60005b83811015612549578181015183820152602001612531565b50506000910152565b6000825161256481846020870161252e565b9190910192915050565b602081526000825180602084015261258d81604085016020870161252e565b601f01601f1916919091016040019291505056fea2646970667358221220c6662430e4c9e51d50e939bb77a89a60a7f3bdb534e357561f40f4eae31eb21c64736f6c63430008130033

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

00000000000000000000000063d43d0edda7de4b5ed9b2f2aa855f81fbd71697

-----Decoded View---------------
Arg [0] : _stGlint (address): 0x63d43D0EDda7DE4B5ed9B2F2AA855f81FBd71697

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


Block Transaction Gas Used Reward
view all blocks collator

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

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.