ETH Price: $2,863.37 (-2.65%)

Contract

0xc352940f6CaDD1B38d60C353E44402258fb3E586
Transaction Hash
Block
From
To
Harvest All Divi...4241687562026-01-22 21:50:283 days ago1769118628IN
0xc352940f...58fb3E586
0 ETH0.000005060.02006
Harvest All Divi...4217097392026-01-15 19:03:5310 days ago1768503833IN
0xc352940f...58fb3E586
0 ETH0.000005160.020564
Add Dividends To...4213286782026-01-14 16:37:5211 days ago1768408672IN
0xc352940f...58fb3E586
0 ETH0.000001650.020008
Add Dividends To...4213286582026-01-14 16:37:4711 days ago1768408667IN
0xc352940f...58fb3E586
0 ETH0.000001570.02001
Add Dividends To...4189088542026-01-07 16:37:3018 days ago1767803850IN
0xc352940f...58fb3E586
0 ETH0.000000860.013168
Add Dividends To...4189088342026-01-07 16:37:2518 days ago1767803845IN
0xc352940f...58fb3E586
0 ETH0.000000820.013404
Add Dividends To...4164864372025-12-31 16:32:2325 days ago1767198743IN
0xc352940f...58fb3E586
0 ETH0.000000820.01
Add Dividends To...4164864172025-12-31 16:32:1725 days ago1767198737IN
0xc352940f...58fb3E586
0 ETH0.000000780.01
Add Dividends To...4140662122025-12-24 16:32:0332 days ago1766593923IN
0xc352940f...58fb3E586
0 ETH0.00000470.071719
Add Dividends To...4140661932025-12-24 16:31:5832 days ago1766593918IN
0xc352940f...58fb3E586
0 ETH0.000004330.070538
Add Dividends To...4116443822025-12-17 16:35:4439 days ago1765989344IN
0xc352940f...58fb3E586
0 ETH0.000024980.380623
Add Dividends To...4116443782025-12-17 16:35:4339 days ago1765989343IN
0xc352940f...58fb3E586
0 ETH0.000023450.381985
Add Dividends To...4092213042025-12-10 16:34:1546 days ago1765384455IN
0xc352940f...58fb3E586
0 ETH0.000000820.01
Add Dividends To...4092213012025-12-10 16:34:1446 days ago1765384454IN
0xc352940f...58fb3E586
0 ETH0.000000780.01
Harvest All Divi...4075095382025-12-05 18:00:2451 days ago1764957624IN
0xc352940f...58fb3E586
0 ETH0.000007040.031063
Add Dividends To...4067966562025-12-03 16:35:5853 days ago1764779758IN
0xc352940f...58fb3E586
0 ETH0.000001310.01586
Add Dividends To...4067966532025-12-03 16:35:5753 days ago1764779757IN
0xc352940f...58fb3E586
0 ETH0.000001240.015765
Add Dividends To...4043721752025-11-26 16:32:1860 days ago1764174738IN
0xc352940f...58fb3E586
0 ETH0.000000830.01
Add Dividends To...4043721712025-11-26 16:32:1760 days ago1764174737IN
0xc352940f...58fb3E586
0 ETH0.000000790.01
Harvest All Divi...4039534872025-11-25 11:30:3861 days ago1764070238IN
0xc352940f...58fb3E586
0 ETH0.000002310.010176
Add Dividends To...4019535242025-11-19 16:33:0567 days ago1763569985IN
0xc352940f...58fb3E586
0 ETH0.000005040.058762
Add Dividends To...4019535202025-11-19 16:33:0467 days ago1763569984IN
0xc352940f...58fb3E586
0 ETH0.00000480.058887
Harvest All Divi...4018697602025-11-19 10:44:4667 days ago1763549086IN
0xc352940f...58fb3E586
0 ETH0.000002470.01
Harvest All Divi...4016458092025-11-18 19:11:4568 days ago1763493105IN
0xc352940f...58fb3E586
0 ETH0.000002580.01
Add Dividends To...3995337782025-11-12 16:33:4574 days ago1762965225IN
0xc352940f...58fb3E586
0 ETH0.000006280.079992
View all transactions

Parent Transaction Hash Block From To
View All Internal Transactions

Cross-Chain Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
ProfitShare

Compiler Version
v0.8.17+commit.8df45f5f

Optimization Enabled:
Yes with 999999 runs

Other Settings:
default evmVersion
// SPDX-License-Identifier: MIT
pragma solidity 0.8.17;

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/IDividends.sol";
import "./interfaces/IXZyberTokenUsage.sol";

/*
 * This contract is used to distribute dividends to users that allocated sZYB here
 *
 * Dividends 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 dividends 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 dividends distribution to sZYB allocators during the current cycle
 *
 * This transfer from the pending slot to the distribution slot is based on cycleDividendsPercent and CYCLE_PERIOD_SECONDS
 *
 */
contract ProfitShare is Ownable, ReentrancyGuard, IXZyberTokenUsage, IDividends {
    using SafeERC20 for IERC20;
    using EnumerableSet for EnumerableSet.AddressSet;

    struct UserInfo {
        uint256 pendingDividends;
        uint256 rewardDebt;
    }

    struct DividendsInfo {
        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 accDividendsPerShare; // accumulated dividends per share (times 1e18)
        uint256 lastUpdateTime; // last time the dividends distribution occurred
        uint256 cycleDividendsPercent; // fixed part of the pending dividends to assign to currentDistributionAmount on every cycle
        bool distributionDisabled; // deactivate a token distribution (for temporary dividends)
    }

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

    // dividends info for every dividends token
    mapping(address => DividendsInfo) public dividendsInfo;
    mapping(address => mapping(address => UserInfo)) public users;

    address public immutable sZybToken; // sZybToken contract

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

    uint256 public constant MIN_CYCLE_DIVIDENDS_PERCENT = 1; // 0.01%
    uint256 public constant DEFAULT_CYCLE_DIVIDENDS_PERCENT = 100; // 1%
    uint256 public constant MAX_CYCLE_DIVIDENDS_PERCENT = 10000; // 100%
    // dividends will be added to the currentDistributionAmount on each new cycle
    uint256 internal _cycleDurationSeconds = 7 days;
    uint256 public currentCycleStartTime;

    constructor(address _sZybToken, uint256 startTime_) {
        require(_sZybToken != address(0), "zero address");
        sZybToken = _sZybToken;
        currentCycleStartTime = startTime_;
    }

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

    event UserUpdated(
        address indexed user,
        uint256 previousBalance,
        uint256 newBalance
    );
    event DividendsCollected(
        address indexed user,
        address indexed token,
        uint256 amount
    );
    event CycleDividendsPercentUpdated(
        address indexed token,
        uint256 previousValue,
        uint256 newValue
    );
    event DividendsAddedToPending(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 sZybToken contract
     */
    modifier sZybTokenOnly() {
        require(
            msg.sender == sZybToken,
            "sZybTokenOnly: caller should be sZybToken"
        );
        _;
    }

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

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

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

    /**
     * @dev Returns dividends 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 dividends 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 dividends pending amount for a given token
     */
    function pendingDividendsAmount(
        address token,
        address userAddress
    ) external view returns (uint256) {
        if (totalAllocation == 0) {
            return 0;
        }

        DividendsInfo storage dividendsInfo_ = dividendsInfo[token];

        uint256 accDividendsPerShare = dividendsInfo_.accDividendsPerShare;
        uint256 lastUpdateTime = dividendsInfo_.lastUpdateTime;
        uint256 dividendAmountPerSecond_ = _dividendsAmountPerSecond(token);

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

            lastUpdateTime = nextCycleStartTime();
            dividendAmountPerSecond_ =
                (dividendsInfo_.pendingAmount *
                    dividendsInfo_.cycleDividendsPercent) /
                (100 * _cycleDurationSeconds);
        }

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

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

    /**************************************************/
    /****************** 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 dividends info for a given token
     */
    function updateDividendsInfo(
        address token
    ) external validateDistributedToken(token) {
        _updateDividendsInfo(token);
    }

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

    /**
     * @dev Updates all dividendsInfo
     */
    function massUpdateDividendsInfo() external {
        uint256 length = _distributedTokens.length();
        for (uint256 index = 0; index < length; ++index) {
            _updateDividendsInfo(_distributedTokens.at(index));
        }
    }

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

        _harvestDividends(token);
    }

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

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

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

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

        emit DividendsAddedToPending(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 dividend tokens' balances on the contract
     */
    function emergencyWithdrawAll() external nonReentrant onlyOwner {
        for (uint256 index = 0; index < _distributedTokens.length(); ++index) {
            emergencyWithdraw(IERC20(_distributedTokens.at(index)));
        }
    }

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

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

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

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

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

    /**
     * @dev Updates the percentage of pending dividends that will be distributed during the next cycle
     *
     * Must be a value between MIN_CYCLE_DIVIDENDS_PERCENT and MAX_CYCLE_DIVIDENDS_PERCENT
     */
    function updateCycleDividendsPercent(
        address token,
        uint256 percent
    ) external onlyOwner {
        require(
            percent <= MAX_CYCLE_DIVIDENDS_PERCENT,
            "updateCycleDividendsPercent: percent mustn't exceed maximum"
        );
        require(
            percent >= MIN_CYCLE_DIVIDENDS_PERCENT,
            "updateCycleDividendsPercent: percent mustn't exceed minimum"
        );
        DividendsInfo storage dividendsInfo_ = dividendsInfo[token];
        uint256 previousPercent = dividendsInfo_.cycleDividendsPercent;
        dividendsInfo_.cycleDividendsPercent = percent;
        emit CycleDividendsPercentUpdated(
            token,
            previousPercent,
            dividendsInfo_.cycleDividendsPercent
        );
    }

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

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

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

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

    /**
     * @dev Updates every user's rewards allocation for each distributed token
     */
    function _updateDividendsInfo(address token) internal {
        uint256 currentBlockTimestamp = _currentBlockTimestamp();
        DividendsInfo storage dividendsInfo_ = dividendsInfo[token];

        updateCurrentCycleStartTime();

        uint256 lastUpdateTime = dividendsInfo_.lastUpdateTime;
        uint256 accDividendsPerShare = dividendsInfo_.accDividendsPerShare;
        if (currentBlockTimestamp <= lastUpdateTime) {
            return;
        }

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

        uint256 currentDistributionAmount = dividendsInfo_
            .currentDistributionAmount; // gas saving
        uint256 currentCycleDistributedAmount = dividendsInfo_
            .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
            accDividendsPerShare =
                accDividendsPerShare +
                (((currentDistributionAmount * 1e2) -
                    currentCycleDistributedAmount) * 1e16) /
                totalAllocation;

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

                uint256 pendingAmount = dividendsInfo_.pendingAmount;
                currentDistributionAmount =
                    (pendingAmount * dividendsInfo_.cycleDividendsPercent) /
                    10000;

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

            currentCycleDistributedAmount = 0;
            lastUpdateTime = currentCycleStartTime;
        }
        uint256 toDistribute = (currentBlockTimestamp - lastUpdateTime) *
            _dividendsAmountPerSecond(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;
        }

        dividendsInfo_.currentCycleDistributedAmount =
            currentCycleDistributedAmount +
            toDistribute;

        dividendsInfo_.accDividendsPerShare =
            accDividendsPerShare +
            ((toDistribute * 1e16) / totalAllocation);

        dividendsInfo_.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; ++index) {
            address token = _distributedTokens.at(index);
            _updateDividendsInfo(token);

            UserInfo storage user = users[token][userAddress];
            uint256 accDividendsPerShare = dividendsInfo[token]
                .accDividendsPerShare;

            uint256 pending = ((previousUserAllocation * accDividendsPerShare) /
                1e18) - user.rewardDebt;
            user.pendingDividends = user.pendingDividends + pending;
            user.rewardDebt = (newUserAllocation * accDividendsPerShare) / 1e18;
        }

        usersAllocation[userAddress] = newUserAllocation;
        totalAllocation = newTotalAllocation;

        emit UserUpdated(
            userAddress,
            previousUserAllocation,
            newUserAllocation
        );
    }

    /**
     * @dev Harvests msg.sender's pending dividends of a given token
     */
    function _harvestDividends(address token) internal {
        _updateDividendsInfo(token);

        UserInfo storage user = users[token][msg.sender];
        uint256 accDividendsPerShare = dividendsInfo[token]
            .accDividendsPerShare;

        uint256 usersZybAllocation = usersAllocation[msg.sender];
        uint256 pending = user.pendingDividends +
            (
                (((usersZybAllocation * accDividendsPerShare) / 1e18) -
                    user.rewardDebt)
            );

        user.pendingDividends = 0;
        user.rewardDebt = (usersZybAllocation * accDividendsPerShare) / 1e18;

        _safeTokenTransfer(IERC20(token), msg.sender, pending);
        emit DividendsCollected(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;
    }
}

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

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

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

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

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

pragma solidity ^0.8.0;

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

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

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts 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;
    }
}

// SPDX-License-Identifier: MIT
pragma solidity =0.8.17;

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

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

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

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

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

interface IXZyberTokenUsage {
    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": 999999
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "libraries": {}
}

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"address","name":"_sZybToken","type":"address"},{"internalType":"uint256","name":"startTime_","type":"uint256"}],"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":"CycleDividendsPercentUpdated","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":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"DividendsAddedToPending","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":"DividendsCollected","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":"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_DIVIDENDS_PERCENT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_CYCLE_DIVIDENDS_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_DIVIDENDS_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":"addDividendsToPending","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":"address","name":"","type":"address"}],"name":"dividendsInfo","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":"accDividendsPerShare","type":"uint256"},{"internalType":"uint256","name":"lastUpdateTime","type":"uint256"},{"internalType":"uint256","name":"cycleDividendsPercent","type":"uint256"},{"internalType":"bool","name":"distributionDisabled","type":"bool"}],"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":"harvestAllDividends","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"harvestDividends","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":"massUpdateDividendsInfo","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":"pendingDividendsAmount","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":"sZybToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","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":"updateCycleDividendsPercent","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"updateDividendsInfo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"users","outputs":[{"internalType":"uint256","name":"pendingDividends","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"}]

60a060405262093a806008553480156200001857600080fd5b5060405162002df838038062002df88339810160408190526200003b91620000fb565b6200004633620000ab565b600180556001600160a01b038216620000945760405162461bcd60e51b815260206004820152600c60248201526b7a65726f206164647265737360a01b604482015260640160405180910390fd5b6001600160a01b0390911660805260095562000137565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600080604083850312156200010f57600080fd5b82516001600160a01b03811681146200012757600080fd5b6020939093015192949293505050565b608051612c97620001616000396000818161023d015281816105b50152610cca0152612c976000f3fe608060405234801561001057600080fd5b506004361061020b5760003560e01c806379203dc41161012a578063d2af0b94116100bd578063de9d477e1161008c578063eb141dcf11610071578063eb141dcf146104e6578063f2fde38b146104ee578063f494ec5a1461050157600080fd5b8063de9d477e146104c0578063e895cca3146104d357600080fd5b8063d2af0b94146104a0578063d637ff83146104a8578063dd191719146104b0578063ddd48f47146104b857600080fd5b806393c563af116100f957806393c563af14610452578063b989185a14610465578063bd394a8d14610478578063c4d3e0831461048057600080fd5b806379203dc41461041a578063799fb965146104235780638da5cb5b1461042c578063911c935c1461044a57600080fd5b8063549230c9116101a25780635e80536a116101715780635e80536a146103af5780636e34b818146103f65780636ff1c9bc146103ff578063715018a61461041257600080fd5b8063549230c9146102f05780635726d26e146103035780635b2acf171461030b5780635d9b436a1461039c57600080fd5b806335d2506d116101de57806335d2506d146102ba5780633999a4e5146102cd57806339f7df5f146102e057806347b32f28146102e857600080fd5b8063034d7fcb146102105780631265f645146102385780631c75e369146102845780632d9c97a414610299575b600080fd5b61022361021e366004612934565b610514565b60405190151581526020015b60405180910390f35b61025f7f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200161022f565b610297610292366004612951565b610527565b005b6102ac6102a73660046129da565b6106be565b60405190815260200161022f565b6102976102c8366004612934565b610868565b6102976102db366004612a13565b61090d565b610297610b4d565b610297610c05565b6102976102fe366004612951565b610c41565b610297610dba565b61035f610319366004612934565b6004602081905260009182526040909120805460018201546002830154600384015494840154600585015460068601546007909601549496939592949192909160ff1688565b604080519889526020890197909752958701949094526060860192909252608085015260a084015260c0830152151560e08201526101000161022f565b61025f6103aa366004612a3f565b610dd6565b6103e16103bd3660046129da565b60056020908152600092835260408084209091529082529020805460019091015482565b6040805192835260208301919091520161022f565b6102ac61271081565b61029761040d366004612934565b610e83565b6102976110a3565b6102ac60075481565b6102ac60095481565b60005473ffffffffffffffffffffffffffffffffffffffff1661025f565b6102ac606481565b610297610460366004612934565b611130565b610297610473366004612934565b6113b3565b6102ac6114d3565b6102ac61048e366004612934565b60066020526000908152604090205481565b6102ac600a81565b6102ac6114e4565b6102976114f6565b6008546102ac565b6102976104ce366004612934565b61161a565b6102976104e1366004612934565b6117b0565b6102ac600181565b6102976104fc366004612934565b61196c565b61029761050f366004612a13565b611a99565b6000610521600283611cb9565b92915050565b600260015403610598576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064015b60405180910390fd5b60026001553373ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001614610662576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f735a7962546f6b656e4f6e6c793a2063616c6c65722073686f756c642062652060448201527f735a7962546f6b656e0000000000000000000000000000000000000000000000606482015260840161058f565b73ffffffffffffffffffffffffffffffffffffffff8416600090815260066020526040812054610693908590612a87565b90506000846007546106a59190612a87565b90506106b2868383611ce8565b50506001805550505050565b60006007546000036106d257506000610521565b73ffffffffffffffffffffffffffffffffffffffff831660009081526004602081905260408220908101546005820154919290919061071087611e6d565b905061071a6114e4565b4211156107a357600754818361072e6114e4565b6107389190612a9a565b6107429190612aad565b61075390662386f26fc10000612aad565b61075d9190612ac4565b6107679084612a87565b92506107716114e4565b915060085460646107829190612aad565b846006015485600201546107969190612aad565b6107a09190612ac4565b90505b6007546107b782662386f26fc10000612aad565b6107c18442612a9a565b6107cb9190612aad565b6107d59190612ac4565b6107df9084612a87565b73ffffffffffffffffffffffffffffffffffffffff8881166000908152600560209081526040808320938b1683529281528282208054600190910154600690925292909120549295509091670de0b6b3a76400009061083f908790612aad565b6108499190612ac4565b6108539190612a9a565b61085d9190612a87565b979650505050505050565b80610874600282611cb9565b610900576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603060248201527f76616c69646174654469737472696275746564546f6b656e733a20746f6b656e60448201527f20646f6573206e6f742065786973747300000000000000000000000000000000606482015260840161058f565b61090982611ec4565b5050565b600260015403610979576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161058f565b60026001556040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8416906370a0823190602401602060405180830381865afa1580156109eb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a0f9190612aff565b73ffffffffffffffffffffffffffffffffffffffff84166000818152600460205260409020919250610a43903330866120a0565b6040517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152600090839073ffffffffffffffffffffffffffffffffffffffff8716906370a0823190602401602060405180830381865afa158015610ab2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ad69190612aff565b610ae09190612a9a565b9050808260020154610af29190612a87565b600283015560405181815273ffffffffffffffffffffffffffffffffffffffff8616907f28fd761b1b374f526d6eba05c1081e7547a7a6b978161fac6bded2f1dc7a99529060200160405180910390a2505060018055505050565b600260015403610bb9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161058f565b60026001819055506000610bcd6002612182565b905060005b81811015610bfd57610bed610be860028361218c565b612198565b610bf681612b18565b9050610bd2565b505060018055565b6000610c116002612182565b905060005b8181101561090957610c31610c2c60028361218c565b611ec4565b610c3a81612b18565b9050610c16565b600260015403610cad576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161058f565b60026001553373ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001614610d77576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f735a7962546f6b656e4f6e6c793a2063616c6c65722073686f756c642062652060448201527f735a7962546f6b656e0000000000000000000000000000000000000000000000606482015260840161058f565b73ffffffffffffffffffffffffffffffffffffffff8416600090815260066020526040812054610da8908590612a9a565b90506000846007546106a59190612a9a565b6000610dc46114e4565b9050804210610dd35760098190555b50565b600081610de36002612182565b8110610e71576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f76616c69646174654469737472696275746564546f6b656e73496e6465783a2060448201527f696e646578206578697374733f00000000000000000000000000000000000000606482015260840161058f565b610e7c60028461218c565b9392505050565b600260015403610eef576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161058f565b600260015560005473ffffffffffffffffffffffffffffffffffffffff163314610f75576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161058f565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8316906370a0823190602401602060405180830381865afa158015610fe2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110069190612aff565b905060008111611098576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602860248201527f656d657267656e637957697468647261773a20746f6b656e2062616c616e636560448201527f206973206e756c6c000000000000000000000000000000000000000000000000606482015260840161058f565b610bfd8233836122ae565b60005473ffffffffffffffffffffffffffffffffffffffff163314611124576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161058f565b61112e600061239b565b565b60005473ffffffffffffffffffffffffffffffffffffffff1633146111b1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161058f565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600460205260409020600581015415806111eb5750600781015460ff165b611277576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603760248201527f656e61626c654469737472696275746564546f6b656e3a20416c72656164792060448201527f656e61626c6564206469766964656e647320746f6b656e000000000000000000606482015260840161058f565b600a6112836002612182565b1115611311576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603260248201527f656e61626c654469737472696275746564546f6b656e3a20746f6f206d616e7960448201527f206469737472696275746564546f6b656e730000000000000000000000000000606482015260840161058f565b8060050154600003611324574260058201555b806006015460000361133857606460068201555b6007810180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905561136d600283612410565b5060405173ffffffffffffffffffffffffffffffffffffffff8316907fefa645a0ab6703d2f2e7f177f50d16c90ce1c71e317bb91cbbdab430e0a3968290600090a25050565b60026001540361141f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161058f565b600260018190556114309082611cb9565b6114c35773ffffffffffffffffffffffffffffffffffffffff81166000908152600460205260409020600301546114c3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f686172766573744469766964656e64733a20696e76616c696420746f6b656e00604482015260640161058f565b6114cc81612198565b5060018055565b60006114df6002612182565b905090565b60006008546009546114df9190612a87565b600260015403611562576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161058f565b600260015560005473ffffffffffffffffffffffffffffffffffffffff1633146115e8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161058f565b60005b6115f56002612182565b8110156114cc5761160a61040d60028361218c565b61161381612b18565b90506115eb565b60005473ffffffffffffffffffffffffffffffffffffffff16331461169b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161058f565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600460205260409020600781015460ff1680156116d357508054155b61175f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603360248201527f72656d6f7665546f6b656e46726f6d4469737472696275746564546f6b656e7360448201527f3a2063616e6e6f742062652072656d6f76656400000000000000000000000000606482015260840161058f565b61176a600283612432565b5060405173ffffffffffffffffffffffffffffffffffffffff8316907f17cd3cc84c669de8c5c4218fd1d9814e647b547d1e7f59287ea6989aa4e032c290600090a25050565b60005473ffffffffffffffffffffffffffffffffffffffff163314611831576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161058f565b73ffffffffffffffffffffffffffffffffffffffff8116600090815260046020526040902060058101541580159061186e5750600781015460ff16155b6118fa576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603960248201527f64697361626c654469737472696275746564546f6b656e3a20416c726561647960448201527f2064697361626c6564206469766964656e647320746f6b656e00000000000000606482015260840161058f565b6007810180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905560405173ffffffffffffffffffffffffffffffffffffffff8316907f961f10509197d967c55f8720c2b6a80d48433ef36db1b12cf3bf6bcf66da434690600090a25050565b60005473ffffffffffffffffffffffffffffffffffffffff1633146119ed576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161058f565b73ffffffffffffffffffffffffffffffffffffffff8116611a90576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161058f565b610dd38161239b565b60005473ffffffffffffffffffffffffffffffffffffffff163314611b1a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161058f565b612710811115611bac576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603b60248201527f7570646174654379636c654469766964656e647350657263656e743a2070657260448201527f63656e74206d7573746e277420657863656564206d6178696d756d0000000000606482015260840161058f565b6001811015611c3d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603b60248201527f7570646174654379636c654469766964656e647350657263656e743a2070657260448201527f63656e74206d7573746e277420657863656564206d696e696d756d0000000000606482015260840161058f565b73ffffffffffffffffffffffffffffffffffffffff8216600081815260046020526040908190206006810180549085905591519092907f82ebda75a31dc518c1b711aab73005a4dddecaf297cee2cf545e72b6a799eb5190611cab9084908790918252602082015260400190565b60405180910390a250505050565b73ffffffffffffffffffffffffffffffffffffffff811660009081526001830160205260408120541515610e7c565b73ffffffffffffffffffffffffffffffffffffffff831660009081526006602052604081205490611d196002612182565b905060005b81811015611dfe576000611d3360028361218c565b9050611d3e81611ec4565b73ffffffffffffffffffffffffffffffffffffffff8082166000818152600560209081526040808320948c16835293815283822092825260049081905292812090920154600182015491929091670de0b6b3a7640000611d9e848a612aad565b611da89190612ac4565b611db29190612a9a565b8354909150611dc2908290612a87565b8355670de0b6b3a7640000611dd7838b612aad565b611de19190612ac4565b83600101819055505050505080611df790612b18565b9050611d1e565b5073ffffffffffffffffffffffffffffffffffffffff8516600081815260066020908152604091829020879055600786905581518581529081018790527f97ce9d7086176d6da45e4e7999788176e2629a7591ffe505b0c1b13fe8052cc6910160405180910390a25050505050565b6000611e7a600283611cb9565b611e8657506000919050565b60085473ffffffffffffffffffffffffffffffffffffffff8316600090815260046020526040902054611eba906064612aad565b6105219190612ac4565b73ffffffffffffffffffffffffffffffffffffffff811660009081526004602052604090204290611ef3610dba565b60058101546004820154818411611f0b575050505050565b6007541580611f1b575060095484105b15611f295750506005015550565b82546001840154600954841015611ffe5760075481611f49846064612aad565b611f539190612a9a565b611f6490662386f26fc10000612aad565b611f6e9190612ac4565b611f789084612a87565b600786015490935060ff16611fd857818560030154611f979190612a87565b60038601556002850154600686015461271090611fb49083612aad565b611fbe9190612ac4565b8087559250611fcd8382612a9a565b600287015550611ff5565b818560030154611fe89190612a87565b6003860155600080865591505b50600954925060005b600061200988611e6d565b6120138689612a9a565b61201d9190612aad565b905061202a836064612aad565b6120348284612a87565b11156120535781612046846064612aad565b6120509190612a9a565b90505b61205d8183612a87565b600187015560075461207682662386f26fc10000612aad565b6120809190612ac4565b61208a9085612a87565b6004870155505050506005909101919091555050565b60405173ffffffffffffffffffffffffffffffffffffffff8085166024830152831660448201526064810182905261217c9085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152612454565b50505050565b6000610521825490565b6000610e7c8383612560565b6121a181611ec4565b73ffffffffffffffffffffffffffffffffffffffff8116600081815260056020908152604080832033808552908352818420948452600480845282852001549084526006909252822054600184015491929091670de0b6b3a76400006122078585612aad565b6122119190612ac4565b61221b9190612a9a565b84546122279190612a87565b600085559050670de0b6b3a76400006122408484612aad565b61224a9190612ac4565b600185015561225a8533836122ae565b60405181815273ffffffffffffffffffffffffffffffffffffffff86169033907f45a4759e6c135135eaba72e35bf196d59fd6fe17e1772d731f05dc25ec5a96a29060200160405180910390a35050505050565b8015612396576040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8516906370a0823190602401602060405180830381865afa158015612321573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123459190612aff565b9050808211156123755761237073ffffffffffffffffffffffffffffffffffffffff8516848361258a565b61217c565b61217c73ffffffffffffffffffffffffffffffffffffffff8516848461258a565b505050565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000610e7c8373ffffffffffffffffffffffffffffffffffffffff84166125e0565b6000610e7c8373ffffffffffffffffffffffffffffffffffffffff841661262f565b60006124b6826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166127229092919063ffffffff16565b80519091501561239657808060200190518101906124d49190612b50565b612396576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f74207375636365656400000000000000000000000000000000000000000000606482015260840161058f565b600082600001828154811061257757612577612b72565b9060005260206000200154905092915050565b60405173ffffffffffffffffffffffffffffffffffffffff83166024820152604481018290526123969084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064016120fa565b600081815260018301602052604081205461262757508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610521565b506000610521565b60008181526001830160205260408120548015612718576000612653600183612a9a565b855490915060009061266790600190612a9a565b90508181146126cc57600086600001828154811061268757612687612b72565b90600052602060002001549050808760000184815481106126aa576126aa612b72565b6000918252602080832090910192909255918252600188019052604090208390555b85548690806126dd576126dd612ba1565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610521565b6000915050610521565b60606127318484600085612739565b949350505050565b6060824710156127cb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c0000000000000000000000000000000000000000000000000000606482015260840161058f565b73ffffffffffffffffffffffffffffffffffffffff85163b612849576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161058f565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516128729190612bf4565b60006040518083038185875af1925050503d80600081146128af576040519150601f19603f3d011682016040523d82523d6000602084013e6128b4565b606091505b509150915061085d828286606083156128ce575081610e7c565b8251156128de5782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161058f9190612c10565b73ffffffffffffffffffffffffffffffffffffffff81168114610dd357600080fd5b60006020828403121561294657600080fd5b8135610e7c81612912565b6000806000806060858703121561296757600080fd5b843561297281612912565b935060208501359250604085013567ffffffffffffffff8082111561299657600080fd5b818701915087601f8301126129aa57600080fd5b8135818111156129b957600080fd5b8860208285010111156129cb57600080fd5b95989497505060200194505050565b600080604083850312156129ed57600080fd5b82356129f881612912565b91506020830135612a0881612912565b809150509250929050565b60008060408385031215612a2657600080fd5b8235612a3181612912565b946020939093013593505050565b600060208284031215612a5157600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b8082018082111561052157610521612a58565b8181038181111561052157610521612a58565b808202811582820484141761052157610521612a58565b600082612afa577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b600060208284031215612b1157600080fd5b5051919050565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203612b4957612b49612a58565b5060010190565b600060208284031215612b6257600080fd5b81518015158114610e7c57600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b60005b83811015612beb578181015183820152602001612bd3565b50506000910152565b60008251612c06818460208701612bd0565b9190910192915050565b6020815260008251806020840152612c2f816040850160208701612bd0565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fea2646970667358221220e0c5fd9b0d762654fabf4e5f3b6a6cbf23ca517011929d8502d026bfaf5c1d7164736f6c634300081100330000000000000000000000003b71729510cbea2f23a1b9fd6b9db002271e119f00000000000000000000000000000000000000000000000000000000646748a0

Deployed Bytecode

0x608060405234801561001057600080fd5b506004361061020b5760003560e01c806379203dc41161012a578063d2af0b94116100bd578063de9d477e1161008c578063eb141dcf11610071578063eb141dcf146104e6578063f2fde38b146104ee578063f494ec5a1461050157600080fd5b8063de9d477e146104c0578063e895cca3146104d357600080fd5b8063d2af0b94146104a0578063d637ff83146104a8578063dd191719146104b0578063ddd48f47146104b857600080fd5b806393c563af116100f957806393c563af14610452578063b989185a14610465578063bd394a8d14610478578063c4d3e0831461048057600080fd5b806379203dc41461041a578063799fb965146104235780638da5cb5b1461042c578063911c935c1461044a57600080fd5b8063549230c9116101a25780635e80536a116101715780635e80536a146103af5780636e34b818146103f65780636ff1c9bc146103ff578063715018a61461041257600080fd5b8063549230c9146102f05780635726d26e146103035780635b2acf171461030b5780635d9b436a1461039c57600080fd5b806335d2506d116101de57806335d2506d146102ba5780633999a4e5146102cd57806339f7df5f146102e057806347b32f28146102e857600080fd5b8063034d7fcb146102105780631265f645146102385780631c75e369146102845780632d9c97a414610299575b600080fd5b61022361021e366004612934565b610514565b60405190151581526020015b60405180910390f35b61025f7f0000000000000000000000003b71729510cbea2f23a1b9fd6b9db002271e119f81565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200161022f565b610297610292366004612951565b610527565b005b6102ac6102a73660046129da565b6106be565b60405190815260200161022f565b6102976102c8366004612934565b610868565b6102976102db366004612a13565b61090d565b610297610b4d565b610297610c05565b6102976102fe366004612951565b610c41565b610297610dba565b61035f610319366004612934565b6004602081905260009182526040909120805460018201546002830154600384015494840154600585015460068601546007909601549496939592949192909160ff1688565b604080519889526020890197909752958701949094526060860192909252608085015260a084015260c0830152151560e08201526101000161022f565b61025f6103aa366004612a3f565b610dd6565b6103e16103bd3660046129da565b60056020908152600092835260408084209091529082529020805460019091015482565b6040805192835260208301919091520161022f565b6102ac61271081565b61029761040d366004612934565b610e83565b6102976110a3565b6102ac60075481565b6102ac60095481565b60005473ffffffffffffffffffffffffffffffffffffffff1661025f565b6102ac606481565b610297610460366004612934565b611130565b610297610473366004612934565b6113b3565b6102ac6114d3565b6102ac61048e366004612934565b60066020526000908152604090205481565b6102ac600a81565b6102ac6114e4565b6102976114f6565b6008546102ac565b6102976104ce366004612934565b61161a565b6102976104e1366004612934565b6117b0565b6102ac600181565b6102976104fc366004612934565b61196c565b61029761050f366004612a13565b611a99565b6000610521600283611cb9565b92915050565b600260015403610598576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064015b60405180910390fd5b60026001553373ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000003b71729510cbea2f23a1b9fd6b9db002271e119f1614610662576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f735a7962546f6b656e4f6e6c793a2063616c6c65722073686f756c642062652060448201527f735a7962546f6b656e0000000000000000000000000000000000000000000000606482015260840161058f565b73ffffffffffffffffffffffffffffffffffffffff8416600090815260066020526040812054610693908590612a87565b90506000846007546106a59190612a87565b90506106b2868383611ce8565b50506001805550505050565b60006007546000036106d257506000610521565b73ffffffffffffffffffffffffffffffffffffffff831660009081526004602081905260408220908101546005820154919290919061071087611e6d565b905061071a6114e4565b4211156107a357600754818361072e6114e4565b6107389190612a9a565b6107429190612aad565b61075390662386f26fc10000612aad565b61075d9190612ac4565b6107679084612a87565b92506107716114e4565b915060085460646107829190612aad565b846006015485600201546107969190612aad565b6107a09190612ac4565b90505b6007546107b782662386f26fc10000612aad565b6107c18442612a9a565b6107cb9190612aad565b6107d59190612ac4565b6107df9084612a87565b73ffffffffffffffffffffffffffffffffffffffff8881166000908152600560209081526040808320938b1683529281528282208054600190910154600690925292909120549295509091670de0b6b3a76400009061083f908790612aad565b6108499190612ac4565b6108539190612a9a565b61085d9190612a87565b979650505050505050565b80610874600282611cb9565b610900576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603060248201527f76616c69646174654469737472696275746564546f6b656e733a20746f6b656e60448201527f20646f6573206e6f742065786973747300000000000000000000000000000000606482015260840161058f565b61090982611ec4565b5050565b600260015403610979576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161058f565b60026001556040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8416906370a0823190602401602060405180830381865afa1580156109eb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a0f9190612aff565b73ffffffffffffffffffffffffffffffffffffffff84166000818152600460205260409020919250610a43903330866120a0565b6040517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152600090839073ffffffffffffffffffffffffffffffffffffffff8716906370a0823190602401602060405180830381865afa158015610ab2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ad69190612aff565b610ae09190612a9a565b9050808260020154610af29190612a87565b600283015560405181815273ffffffffffffffffffffffffffffffffffffffff8616907f28fd761b1b374f526d6eba05c1081e7547a7a6b978161fac6bded2f1dc7a99529060200160405180910390a2505060018055505050565b600260015403610bb9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161058f565b60026001819055506000610bcd6002612182565b905060005b81811015610bfd57610bed610be860028361218c565b612198565b610bf681612b18565b9050610bd2565b505060018055565b6000610c116002612182565b905060005b8181101561090957610c31610c2c60028361218c565b611ec4565b610c3a81612b18565b9050610c16565b600260015403610cad576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161058f565b60026001553373ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000003b71729510cbea2f23a1b9fd6b9db002271e119f1614610d77576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f735a7962546f6b656e4f6e6c793a2063616c6c65722073686f756c642062652060448201527f735a7962546f6b656e0000000000000000000000000000000000000000000000606482015260840161058f565b73ffffffffffffffffffffffffffffffffffffffff8416600090815260066020526040812054610da8908590612a9a565b90506000846007546106a59190612a9a565b6000610dc46114e4565b9050804210610dd35760098190555b50565b600081610de36002612182565b8110610e71576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f76616c69646174654469737472696275746564546f6b656e73496e6465783a2060448201527f696e646578206578697374733f00000000000000000000000000000000000000606482015260840161058f565b610e7c60028461218c565b9392505050565b600260015403610eef576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161058f565b600260015560005473ffffffffffffffffffffffffffffffffffffffff163314610f75576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161058f565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8316906370a0823190602401602060405180830381865afa158015610fe2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110069190612aff565b905060008111611098576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602860248201527f656d657267656e637957697468647261773a20746f6b656e2062616c616e636560448201527f206973206e756c6c000000000000000000000000000000000000000000000000606482015260840161058f565b610bfd8233836122ae565b60005473ffffffffffffffffffffffffffffffffffffffff163314611124576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161058f565b61112e600061239b565b565b60005473ffffffffffffffffffffffffffffffffffffffff1633146111b1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161058f565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600460205260409020600581015415806111eb5750600781015460ff165b611277576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603760248201527f656e61626c654469737472696275746564546f6b656e3a20416c72656164792060448201527f656e61626c6564206469766964656e647320746f6b656e000000000000000000606482015260840161058f565b600a6112836002612182565b1115611311576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603260248201527f656e61626c654469737472696275746564546f6b656e3a20746f6f206d616e7960448201527f206469737472696275746564546f6b656e730000000000000000000000000000606482015260840161058f565b8060050154600003611324574260058201555b806006015460000361133857606460068201555b6007810180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905561136d600283612410565b5060405173ffffffffffffffffffffffffffffffffffffffff8316907fefa645a0ab6703d2f2e7f177f50d16c90ce1c71e317bb91cbbdab430e0a3968290600090a25050565b60026001540361141f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161058f565b600260018190556114309082611cb9565b6114c35773ffffffffffffffffffffffffffffffffffffffff81166000908152600460205260409020600301546114c3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f686172766573744469766964656e64733a20696e76616c696420746f6b656e00604482015260640161058f565b6114cc81612198565b5060018055565b60006114df6002612182565b905090565b60006008546009546114df9190612a87565b600260015403611562576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161058f565b600260015560005473ffffffffffffffffffffffffffffffffffffffff1633146115e8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161058f565b60005b6115f56002612182565b8110156114cc5761160a61040d60028361218c565b61161381612b18565b90506115eb565b60005473ffffffffffffffffffffffffffffffffffffffff16331461169b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161058f565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600460205260409020600781015460ff1680156116d357508054155b61175f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603360248201527f72656d6f7665546f6b656e46726f6d4469737472696275746564546f6b656e7360448201527f3a2063616e6e6f742062652072656d6f76656400000000000000000000000000606482015260840161058f565b61176a600283612432565b5060405173ffffffffffffffffffffffffffffffffffffffff8316907f17cd3cc84c669de8c5c4218fd1d9814e647b547d1e7f59287ea6989aa4e032c290600090a25050565b60005473ffffffffffffffffffffffffffffffffffffffff163314611831576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161058f565b73ffffffffffffffffffffffffffffffffffffffff8116600090815260046020526040902060058101541580159061186e5750600781015460ff16155b6118fa576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603960248201527f64697361626c654469737472696275746564546f6b656e3a20416c726561647960448201527f2064697361626c6564206469766964656e647320746f6b656e00000000000000606482015260840161058f565b6007810180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905560405173ffffffffffffffffffffffffffffffffffffffff8316907f961f10509197d967c55f8720c2b6a80d48433ef36db1b12cf3bf6bcf66da434690600090a25050565b60005473ffffffffffffffffffffffffffffffffffffffff1633146119ed576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161058f565b73ffffffffffffffffffffffffffffffffffffffff8116611a90576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f6464726573730000000000000000000000000000000000000000000000000000606482015260840161058f565b610dd38161239b565b60005473ffffffffffffffffffffffffffffffffffffffff163314611b1a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161058f565b612710811115611bac576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603b60248201527f7570646174654379636c654469766964656e647350657263656e743a2070657260448201527f63656e74206d7573746e277420657863656564206d6178696d756d0000000000606482015260840161058f565b6001811015611c3d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152603b60248201527f7570646174654379636c654469766964656e647350657263656e743a2070657260448201527f63656e74206d7573746e277420657863656564206d696e696d756d0000000000606482015260840161058f565b73ffffffffffffffffffffffffffffffffffffffff8216600081815260046020526040908190206006810180549085905591519092907f82ebda75a31dc518c1b711aab73005a4dddecaf297cee2cf545e72b6a799eb5190611cab9084908790918252602082015260400190565b60405180910390a250505050565b73ffffffffffffffffffffffffffffffffffffffff811660009081526001830160205260408120541515610e7c565b73ffffffffffffffffffffffffffffffffffffffff831660009081526006602052604081205490611d196002612182565b905060005b81811015611dfe576000611d3360028361218c565b9050611d3e81611ec4565b73ffffffffffffffffffffffffffffffffffffffff8082166000818152600560209081526040808320948c16835293815283822092825260049081905292812090920154600182015491929091670de0b6b3a7640000611d9e848a612aad565b611da89190612ac4565b611db29190612a9a565b8354909150611dc2908290612a87565b8355670de0b6b3a7640000611dd7838b612aad565b611de19190612ac4565b83600101819055505050505080611df790612b18565b9050611d1e565b5073ffffffffffffffffffffffffffffffffffffffff8516600081815260066020908152604091829020879055600786905581518581529081018790527f97ce9d7086176d6da45e4e7999788176e2629a7591ffe505b0c1b13fe8052cc6910160405180910390a25050505050565b6000611e7a600283611cb9565b611e8657506000919050565b60085473ffffffffffffffffffffffffffffffffffffffff8316600090815260046020526040902054611eba906064612aad565b6105219190612ac4565b73ffffffffffffffffffffffffffffffffffffffff811660009081526004602052604090204290611ef3610dba565b60058101546004820154818411611f0b575050505050565b6007541580611f1b575060095484105b15611f295750506005015550565b82546001840154600954841015611ffe5760075481611f49846064612aad565b611f539190612a9a565b611f6490662386f26fc10000612aad565b611f6e9190612ac4565b611f789084612a87565b600786015490935060ff16611fd857818560030154611f979190612a87565b60038601556002850154600686015461271090611fb49083612aad565b611fbe9190612ac4565b8087559250611fcd8382612a9a565b600287015550611ff5565b818560030154611fe89190612a87565b6003860155600080865591505b50600954925060005b600061200988611e6d565b6120138689612a9a565b61201d9190612aad565b905061202a836064612aad565b6120348284612a87565b11156120535781612046846064612aad565b6120509190612a9a565b90505b61205d8183612a87565b600187015560075461207682662386f26fc10000612aad565b6120809190612ac4565b61208a9085612a87565b6004870155505050506005909101919091555050565b60405173ffffffffffffffffffffffffffffffffffffffff8085166024830152831660448201526064810182905261217c9085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152612454565b50505050565b6000610521825490565b6000610e7c8383612560565b6121a181611ec4565b73ffffffffffffffffffffffffffffffffffffffff8116600081815260056020908152604080832033808552908352818420948452600480845282852001549084526006909252822054600184015491929091670de0b6b3a76400006122078585612aad565b6122119190612ac4565b61221b9190612a9a565b84546122279190612a87565b600085559050670de0b6b3a76400006122408484612aad565b61224a9190612ac4565b600185015561225a8533836122ae565b60405181815273ffffffffffffffffffffffffffffffffffffffff86169033907f45a4759e6c135135eaba72e35bf196d59fd6fe17e1772d731f05dc25ec5a96a29060200160405180910390a35050505050565b8015612396576040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8516906370a0823190602401602060405180830381865afa158015612321573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123459190612aff565b9050808211156123755761237073ffffffffffffffffffffffffffffffffffffffff8516848361258a565b61217c565b61217c73ffffffffffffffffffffffffffffffffffffffff8516848461258a565b505050565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000610e7c8373ffffffffffffffffffffffffffffffffffffffff84166125e0565b6000610e7c8373ffffffffffffffffffffffffffffffffffffffff841661262f565b60006124b6826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166127229092919063ffffffff16565b80519091501561239657808060200190518101906124d49190612b50565b612396576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f74207375636365656400000000000000000000000000000000000000000000606482015260840161058f565b600082600001828154811061257757612577612b72565b9060005260206000200154905092915050565b60405173ffffffffffffffffffffffffffffffffffffffff83166024820152604481018290526123969084907fa9059cbb00000000000000000000000000000000000000000000000000000000906064016120fa565b600081815260018301602052604081205461262757508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610521565b506000610521565b60008181526001830160205260408120548015612718576000612653600183612a9a565b855490915060009061266790600190612a9a565b90508181146126cc57600086600001828154811061268757612687612b72565b90600052602060002001549050808760000184815481106126aa576126aa612b72565b6000918252602080832090910192909255918252600188019052604090208390555b85548690806126dd576126dd612ba1565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610521565b6000915050610521565b60606127318484600085612739565b949350505050565b6060824710156127cb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c0000000000000000000000000000000000000000000000000000606482015260840161058f565b73ffffffffffffffffffffffffffffffffffffffff85163b612849576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161058f565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516128729190612bf4565b60006040518083038185875af1925050503d80600081146128af576040519150601f19603f3d011682016040523d82523d6000602084013e6128b4565b606091505b509150915061085d828286606083156128ce575081610e7c565b8251156128de5782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161058f9190612c10565b73ffffffffffffffffffffffffffffffffffffffff81168114610dd357600080fd5b60006020828403121561294657600080fd5b8135610e7c81612912565b6000806000806060858703121561296757600080fd5b843561297281612912565b935060208501359250604085013567ffffffffffffffff8082111561299657600080fd5b818701915087601f8301126129aa57600080fd5b8135818111156129b957600080fd5b8860208285010111156129cb57600080fd5b95989497505060200194505050565b600080604083850312156129ed57600080fd5b82356129f881612912565b91506020830135612a0881612912565b809150509250929050565b60008060408385031215612a2657600080fd5b8235612a3181612912565b946020939093013593505050565b600060208284031215612a5157600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b8082018082111561052157610521612a58565b8181038181111561052157610521612a58565b808202811582820484141761052157610521612a58565b600082612afa577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b600060208284031215612b1157600080fd5b5051919050565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203612b4957612b49612a58565b5060010190565b600060208284031215612b6257600080fd5b81518015158114610e7c57600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b60005b83811015612beb578181015183820152602001612bd3565b50506000910152565b60008251612c06818460208701612bd0565b9190910192915050565b6020815260008251806020840152612c2f816040850160208701612bd0565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fea2646970667358221220e0c5fd9b0d762654fabf4e5f3b6a6cbf23ca517011929d8502d026bfaf5c1d7164736f6c63430008110033

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

0000000000000000000000003b71729510cbea2f23a1b9fd6b9db002271e119f00000000000000000000000000000000000000000000000000000000646748a0

-----Decoded View---------------
Arg [0] : _sZybToken (address): 0x3B71729510CbEA2f23A1B9fd6B9DB002271e119f
Arg [1] : startTime_ (uint256): 1684490400

-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 0000000000000000000000003b71729510cbea2f23a1b9fd6b9db002271e119f
Arg [1] : 00000000000000000000000000000000000000000000000000000000646748a0


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

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

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.