ETH Price: $2,501.13 (+4.16%)
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Boost224700932025-05-12 22:14:597 days ago1747088099IN
0x0A36F956...8344a55D8
0 ETH0.000124121.78820058
Deposit224700902025-05-12 22:14:237 days ago1747088063IN
0x0A36F956...8344a55D8
0 ETH0.000232341.96033576
Withdraw223686572025-04-28 16:09:4721 days ago1745856587IN
0x0A36F956...8344a55D8
0 ETH0.000170221.54435689
Withdraw223121002025-04-20 18:47:5929 days ago1745174879IN
0x0A36F956...8344a55D8
0 ETH0.000090170.84273227
Boost222864252025-04-17 4:48:1133 days ago1744865291IN
0x0A36F956...8344a55D8
0 ETH0.000049460.38553084
Withdraw222598942025-04-13 11:56:3537 days ago1744545395IN
0x0A36F956...8344a55D8
0 ETH0.000113640.91563538
Deposit221152142025-03-24 7:17:2357 days ago1742800643IN
0x0A36F956...8344a55D8
0 ETH0.000162040.86674564
Boost219591762025-03-02 12:26:2378 days ago1740918383IN
0x0A36F956...8344a55D8
0 ETH0.000149341.16391222
Boost217186032025-01-27 21:39:35112 days ago1738013975IN
0x0A36F956...8344a55D8
0 ETH0.0008302811.96186713
Deposit217186012025-01-27 21:39:11112 days ago1738013951IN
0x0A36F956...8344a55D8
0 ETH0.0011690811.52250631
Deposit216367122025-01-16 11:21:23124 days ago1737026483IN
0x0A36F956...8344a55D8
0 ETH0.00113986.09645975
Boost215443982025-01-03 13:57:11136 days ago1735912631IN
0x0A36F956...8344a55D8
0 ETH0.0009798712.28395435
Deposit215281882025-01-01 7:41:35139 days ago1735717295IN
0x0A36F956...8344a55D8
0 ETH0.00088836.69909171
Withdraw215281552025-01-01 7:34:59139 days ago1735716899IN
0x0A36F956...8344a55D8
0 ETH0.000676026.03721786
Pay Debt215281512025-01-01 7:34:11139 days ago1735716851IN
0x0A36F956...8344a55D8
0 ETH0.000504175.40464445
Pay Debt215281392025-01-01 7:31:47139 days ago1735716707IN
0x0A36F956...8344a55D8
0 ETH0.000662055.28861597
Withdraw215165112024-12-30 16:33:23140 days ago1735576403IN
0x0A36F956...8344a55D8
0 ETH0.0014536310.80842315
Deposit214828032024-12-25 23:35:47145 days ago1735169747IN
0x0A36F956...8344a55D8
0 ETH0.00047514.68320181
Withdraw214738282024-12-24 17:30:35146 days ago1735061435IN
0x0A36F956...8344a55D8
0 ETH0.001120798.43187406
Withdraw214573662024-12-22 10:13:23149 days ago1734862403IN
0x0A36F956...8344a55D8
0 ETH0.0012638.60338376
Boost214104132024-12-15 20:50:35155 days ago1734295835IN
0x0A36F956...8344a55D8
0 ETH0.0008399811.15677231
Deposit214096232024-12-15 18:11:59155 days ago1734286319IN
0x0A36F956...8344a55D8
0 ETH0.0021469711.1974785
Deposit214020152024-12-14 16:42:23156 days ago1734194543IN
0x0A36F956...8344a55D8
0 ETH0.001820969.73982783
Boost213388522024-12-05 21:02:23165 days ago1733432543IN
0x0A36F956...8344a55D8
0 ETH0.0020062523.19078849
Deposit213388462024-12-05 21:01:11165 days ago1733432471IN
0x0A36F956...8344a55D8
0 ETH0.0032301722.86479026
View all transactions

Latest 1 internal transaction

Advanced mode:
Parent Transaction Hash Method Block
From
To
0x61014060195819602024-04-04 10:58:59411 days ago1712228339  Contract Creation0 ETH
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
RewardTracker

Compiler Version
v0.8.21+commit.d9974bed

Optimization Enabled:
Yes with 1000000 runs

Other Settings:
paris EvmVersion
// SPDX-License-Identifier: AGPL-3.0
pragma solidity ^0.8.13;

import {ERC20} from "solmate/tokens/ERC20.sol";
import {ERC4626} from "solmate/mixins/ERC4626.sol";
import {SafeTransferLib} from "solmate/utils/SafeTransferLib.sol";
import {FixedPointMathLib} from "solmate/utils/FixedPointMathLib.sol";
import {AccessControl} from "openzeppelin-contracts/access/AccessControl.sol";
import {ReentrancyGuard} from "openzeppelin-contracts/security/ReentrancyGuard.sol";
import {BonusTracker} from "./BonusTracker.sol";
import {DebtTracker} from "./DebtTracker.sol";
import {CallerNotAdmin} from "../errors/scErrors.sol";

contract RewardTracker is BonusTracker, DebtTracker, AccessControl {
    using SafeTransferLib for ERC20;
    using FixedPointMathLib for uint256;

    event RewardAdded(uint256 reward);
    event RewardPaid(address indexed user, uint256 reward);
    event VaultAdded(address vault);
    event TreasuryUpdated(address indexed user, address newTreasury);

    error CallerNotDistirbutor();
    error VaultNotWhitelisted();
    error VaultAssetNotSupported();
    error SenderHasToBeReceiver();
    error TreasuryCannotBeZero();

    /// @notice The last Unix timestamp (in seconds) when rewardPerTokenStored was updated
    uint64 public lastUpdateTime;

    /// @notice The Unix timestamp (in seconds) at which the current reward period ends
    uint64 public periodFinish;

    /// @notice The per-second rate at which rewardPerToken increases
    uint256 public rewardRate;

    /// @notice The last stored rewardPerToken value
    uint256 public rewardPerTokenStored;

    /// @notice The last stored balance of reward tokens
    uint256 public rewardBalanceStored;

    /// @notice Role allowed to call notifyReward()
    bytes32 public constant DISTRIBUTOR = keccak256("DISTRIBUTOR");

    /// @notice The rewardPerToken value when an account last staked/withdrew/withdrew rewards
    mapping(address => uint256) public userRewardPerTokenPaid;

    /// @notice The earned() value when an account last staked/withdrew/withdrew rewards
    mapping(address => uint256) public rewards;

    /// @notice A whitelist of vaults staking contract is collecting fees from
    mapping(address => bool) public isVault;

    /// @notice The token being rewarded to stakers
    ERC20 public immutable rewardToken;

    /// @notice The length of each reward period, in seconds
    uint64 public immutable duration;

    constructor(
        address admin,
        address _treasury,
        address _stakeToken,
        string memory _name,
        string memory _symbol,
        address _rewardToken,
        uint64 _duration
    ) BonusTracker(ERC20(_stakeToken), _name, _symbol) {
        _grantRole(DEFAULT_ADMIN_ROLE, admin);

        if (_treasury == address(0)) revert TreasuryCannotBeZero();

        treasury = _treasury;
        rewardToken = ERC20(_rewardToken);
        duration = _duration;
    }

    modifier onlyDistributor() {
        if (!hasRole(DISTRIBUTOR, msg.sender)) revert CallerNotDistirbutor();
        _;
    }

    modifier onlyAdmin() {
        if (!hasRole(DEFAULT_ADMIN_ROLE, msg.sender)) revert CallerNotAdmin();
        _;
    }

    function totalAssets() public view override returns (uint256) {
        return totalSupply;
    }

    function deposit(uint256 _assets, address _receiver) public override returns (uint256 shares) {
        // sender needs to be the receiver
        if (_receiver != msg.sender) revert SenderHasToBeReceiver();

        // if user has debt no new deposits are allowed
        _updateDebt(_receiver);
        if (debtOf[_receiver] > 0) revert UserHasDebt();

        _updateReward(_receiver);
        _updateBonus(_receiver);
        shares = super.deposit(_assets, _receiver);
    }

    function mint(uint256 _shares, address _receiver) public override returns (uint256 assets) {
        // sender needs to be the receiver
        if (_receiver != msg.sender) revert SenderHasToBeReceiver();

        // if user has debt no new deposits are allowed
        _updateDebt(_receiver);
        if (debtOf[_receiver] > 0) revert UserHasDebt();

        _updateReward(_receiver);
        _updateBonus(_receiver);
        assets = super.mint(_shares, _receiver);
    }

    function afterDeposit(uint256 _assets, uint256) internal override {
        // debt starts at 10% the deposited amount, decreases linearly over 30 days
        uint256 debt = _assets.mulWadDown(0.1e18);
        uint64 now_ = uint64(block.timestamp);
        debtOf[msg.sender] = debt;
        debtStartTimeFor[msg.sender] = now_;
        emit DebtAdded(msg.sender, debt, now_);
    }

    function transfer(address _to, uint256 _amount) public override returns (bool) {
        // if user has debt transfers are not allowed
        _updateDebt(msg.sender);
        if (debtOf[msg.sender] > 0) revert UserHasDebt();

        _updateReward(msg.sender);
        _updateReward(_to);
        _updateBonus(msg.sender);
        _updateBonus(_to);
        _burnMultiplierPoints(_amount, msg.sender);

        return super.transfer(_to, _amount);
    }

    function transferFrom(address _from, address _to, uint256 _amount) public override returns (bool) {
        // if user has debt transfers are not allowed
        _updateDebt(_from);
        if (debtOf[_from] > 0) revert UserHasDebt();

        _updateReward(_from);
        _updateReward(_to);
        _updateBonus(_from);
        _updateBonus(_to);
        _burnMultiplierPoints(_amount, _from);

        return super.transferFrom(_from, _to, _amount);
    }

    /// @notice Withdraws all earned rewards
    function claimRewards(address _receiver) external nonReentrant returns (uint256 reward) {
        _updateReward(_receiver);
        reward = rewards[_receiver];

        if (reward > 0) {
            rewards[_receiver] = 0;
            rewardBalanceStored -= reward;
            rewardToken.safeTransfer(_receiver, reward);
            emit RewardPaid(_receiver, reward);
        }
    }

    /// @notice The latest time at which stakers are earning rewards.
    function lastTimeRewardApplicable() public view returns (uint64) {
        return block.timestamp < periodFinish ? uint64(block.timestamp) : periodFinish;
    }

    /// @notice The amount of reward tokens each staked token has earned so far
    function rewardPerToken() external view returns (uint256) {
        return _calcRewardPerToken(lastTimeRewardApplicable(), rewardRate);
    }

    /// @notice The amount of reward tokens an account has accrued so far. Does not
    /// include already withdrawn rewards.
    function earned(address _account) external view returns (uint256) {
        return _earned(_account, _calcRewardPerToken(lastTimeRewardApplicable(), rewardRate));
    }

    /// @notice Starts a new reward distribution period. The reward tokens must have already
    /// been transferred to this contract before calling this function. If it is called
    /// when a reward period is still active, a new reward period will begin from the time
    /// of calling this function, using the leftover rewards from the old reward period plus
    /// the newly sent rewards as the reward.
    function startRewardsDistribution() external {
        _startRewardsDistribution();
    }

    /// @notice Lets a reward distributor fetch performance fees from
    /// a vault and start a new reward period.
    function fetchRewards(ERC4626 _vault) external onlyDistributor {
        if (!isVault[address(_vault)]) revert VaultNotWhitelisted();

        _vault.redeem(_vault.balanceOf(address(this)), address(this), address(this));

        _startRewardsDistribution();
    }

    /// @notice Lets an admin add a vault for collecting fees from.
    function addVault(address _vault) external onlyAdmin {
        if (ERC4626(_vault).asset() != rewardToken) revert VaultAssetNotSupported();

        isVault[_vault] = true;

        emit VaultAdded(_vault);
    }

    /// @notice set the treasury address
    /// @param _newTreasury the new treasury address
    function setTreasury(address _newTreasury) external onlyAdmin {
        if (_newTreasury == address(0)) revert TreasuryCannotBeZero();
        treasury = _newTreasury;
        emit TreasuryUpdated(msg.sender, _newTreasury);
    }

    function _startRewardsDistribution() internal {
        /// -----------------------------------------------------------------------
        /// Validation
        /// -----------------------------------------------------------------------

        uint256 rewardBalanceCurrent = rewardToken.balanceOf(address(this));
        uint256 rewardBalanceStored_ = rewardBalanceStored;

        if (rewardBalanceCurrent == rewardBalanceStored_) {
            return;
        }

        /// -----------------------------------------------------------------------
        /// Storage loads
        /// -----------------------------------------------------------------------

        uint256 rewardRate_ = rewardRate;
        uint64 periodFinish_ = periodFinish;
        uint64 lastTimeRewardApplicable_ = lastTimeRewardApplicable();
        uint64 duration_ = duration;

        /// -----------------------------------------------------------------------
        /// State updates
        /// -----------------------------------------------------------------------

        // accrue rewards
        rewardPerTokenStored = _calcRewardPerToken(lastTimeRewardApplicable_, rewardRate_);

        // record new reward
        uint256 reward = rewardBalanceCurrent - rewardBalanceStored_;
        rewardBalanceStored = rewardBalanceCurrent;
        uint256 newRewardRate;

        if (block.timestamp >= periodFinish_) {
            newRewardRate = reward / duration_;
        } else {
            uint256 remaining = periodFinish_ - block.timestamp;
            uint256 leftover = remaining * rewardRate_;
            newRewardRate = (reward + leftover) / duration_;
        }

        rewardRate = newRewardRate;
        lastUpdateTime = uint64(block.timestamp);
        periodFinish = uint64(block.timestamp + duration_);

        emit RewardAdded(reward);
    }

    function withdraw(uint256 assets, address receiver, address owner) public override returns (uint256 shares) {
        shares = previewWithdraw(assets); // No need to check for rounding error, previewWithdraw rounds up.

        if (msg.sender != owner) {
            uint256 allowed = allowance[owner][msg.sender]; // Saves gas for limited approvals.

            if (allowed != type(uint256).max) allowance[owner][msg.sender] = allowed - shares;
        }

        // if user has debt normal withdrawals are not allowed, instead use payDebt() first
        _updateDebt(owner);
        if (debtOf[owner] > 0) revert UserHasDebt();

        _updateReward(owner);
        _updateBonus(owner);
        _burnMultiplierPoints(assets, owner);

        _burn(owner, shares);

        emit Withdraw(msg.sender, receiver, owner, assets, shares);

        asset.safeTransfer(receiver, assets);
    }

    function redeem(uint256 shares, address receiver, address owner) public override returns (uint256 assets) {
        if (msg.sender != owner) {
            uint256 allowed = allowance[owner][msg.sender]; // Saves gas for limited approvals.

            if (allowed != type(uint256).max) allowance[owner][msg.sender] = allowed - shares;
        }

        // Check for rounding error since we round down in previewRedeem.
        require((assets = previewRedeem(shares)) != 0, "ZERO_ASSETS");

        // if user has debt normal withdrawals are not allowed, instead use payDebt() first
        _updateDebt(owner);
        if (debtOf[owner] > 0) revert UserHasDebt();

        _updateReward(owner);
        _updateBonus(owner);
        _burnMultiplierPoints(assets, owner);

        _burn(owner, shares);

        emit Withdraw(msg.sender, receiver, owner, assets, shares);

        asset.safeTransfer(receiver, assets);
    }

    /// @notice Function for paying all debt for an account at once
    function payDebt() external nonReentrant {
        uint256 debt = _debtFor(msg.sender);
        debtOf[msg.sender] = 0;

        // pay debt by withdrawing sQuartz with treasury as receiver
        withdraw(debt, treasury, msg.sender);
        emit DebtPaid(msg.sender, debt);
    }

    function _earned(address _account, uint256 rewardPerToken_) internal view returns (uint256) {
        uint256 accountBalance = balanceOf[_account] + multiplierPointsOf[_account];

        return
            accountBalance.mulDivDown(rewardPerToken_ - userRewardPerTokenPaid[_account], PRECISION) + rewards[_account];
    }

    function _calcRewardPerToken(uint256 _lastTimeRewardApplicable, uint256 _rewardRate)
        internal
        view
        returns (uint256)
    {
        uint256 totalSupply_ = totalSupply + totalBonus;
        if (totalSupply_ == 0) {
            return rewardPerTokenStored;
        }

        return rewardPerTokenStored
            + _rewardRate.mulDivDown((_lastTimeRewardApplicable - lastUpdateTime) * PRECISION, totalSupply_);
    }

    function _updateReward(address _account) internal override {
        // storage loads
        uint64 lastTimeRewardApplicable_ = lastTimeRewardApplicable();
        uint256 rewardPerToken_ = _calcRewardPerToken(lastTimeRewardApplicable_, rewardRate);

        // accrue rewards
        rewardPerTokenStored = rewardPerToken_;
        lastUpdateTime = lastTimeRewardApplicable_;
        rewards[_account] = _earned(_account, rewardPerToken_);
        userRewardPerTokenPaid[_account] = rewardPerToken_;
    }

    // burn multiplier points
    function _burnMultiplierPoints(uint256 _amount, address _sender) internal {
        uint256 bonus_ = multiplierPointsOf[_sender];

        // return if no bonus points
        if (bonus_ == 0) return;

        // otherwise burn an equivalent percentage
        uint256 balance = balanceOf[_sender];
        bonus_ = bonus_.mulDivDown(_amount, balance);
        multiplierPointsOf[_sender] -= bonus_;
        totalBonus -= bonus_;
        emit BonusBurned(_sender, bonus_);
    }
}

// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.8.0;

/// @notice Modern and gas efficient ERC20 + EIP-2612 implementation.
/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC20.sol)
/// @author Modified from Uniswap (https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/UniswapV2ERC20.sol)
/// @dev Do not manually set balances without updating totalSupply, as the sum of all user balances must not exceed it.
abstract contract ERC20 {
    /*//////////////////////////////////////////////////////////////
                                 EVENTS
    //////////////////////////////////////////////////////////////*/

    event Transfer(address indexed from, address indexed to, uint256 amount);

    event Approval(address indexed owner, address indexed spender, uint256 amount);

    /*//////////////////////////////////////////////////////////////
                            METADATA STORAGE
    //////////////////////////////////////////////////////////////*/

    string public name;

    string public symbol;

    uint8 public immutable decimals;

    /*//////////////////////////////////////////////////////////////
                              ERC20 STORAGE
    //////////////////////////////////////////////////////////////*/

    uint256 public totalSupply;

    mapping(address => uint256) public balanceOf;

    mapping(address => mapping(address => uint256)) public allowance;

    /*//////////////////////////////////////////////////////////////
                            EIP-2612 STORAGE
    //////////////////////////////////////////////////////////////*/

    uint256 internal immutable INITIAL_CHAIN_ID;

    bytes32 internal immutable INITIAL_DOMAIN_SEPARATOR;

    mapping(address => uint256) public nonces;

    /*//////////////////////////////////////////////////////////////
                               CONSTRUCTOR
    //////////////////////////////////////////////////////////////*/

    constructor(
        string memory _name,
        string memory _symbol,
        uint8 _decimals
    ) {
        name = _name;
        symbol = _symbol;
        decimals = _decimals;

        INITIAL_CHAIN_ID = block.chainid;
        INITIAL_DOMAIN_SEPARATOR = computeDomainSeparator();
    }

    /*//////////////////////////////////////////////////////////////
                               ERC20 LOGIC
    //////////////////////////////////////////////////////////////*/

    function approve(address spender, uint256 amount) public virtual returns (bool) {
        allowance[msg.sender][spender] = amount;

        emit Approval(msg.sender, spender, amount);

        return true;
    }

    function transfer(address to, uint256 amount) public virtual returns (bool) {
        balanceOf[msg.sender] -= amount;

        // Cannot overflow because the sum of all user
        // balances can't exceed the max uint256 value.
        unchecked {
            balanceOf[to] += amount;
        }

        emit Transfer(msg.sender, to, amount);

        return true;
    }

    function transferFrom(
        address from,
        address to,
        uint256 amount
    ) public virtual returns (bool) {
        uint256 allowed = allowance[from][msg.sender]; // Saves gas for limited approvals.

        if (allowed != type(uint256).max) allowance[from][msg.sender] = allowed - amount;

        balanceOf[from] -= amount;

        // Cannot overflow because the sum of all user
        // balances can't exceed the max uint256 value.
        unchecked {
            balanceOf[to] += amount;
        }

        emit Transfer(from, to, amount);

        return true;
    }

    /*//////////////////////////////////////////////////////////////
                             EIP-2612 LOGIC
    //////////////////////////////////////////////////////////////*/

    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) public virtual {
        require(deadline >= block.timestamp, "PERMIT_DEADLINE_EXPIRED");

        // Unchecked because the only math done is incrementing
        // the owner's nonce which cannot realistically overflow.
        unchecked {
            address recoveredAddress = ecrecover(
                keccak256(
                    abi.encodePacked(
                        "\x19\x01",
                        DOMAIN_SEPARATOR(),
                        keccak256(
                            abi.encode(
                                keccak256(
                                    "Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"
                                ),
                                owner,
                                spender,
                                value,
                                nonces[owner]++,
                                deadline
                            )
                        )
                    )
                ),
                v,
                r,
                s
            );

            require(recoveredAddress != address(0) && recoveredAddress == owner, "INVALID_SIGNER");

            allowance[recoveredAddress][spender] = value;
        }

        emit Approval(owner, spender, value);
    }

    function DOMAIN_SEPARATOR() public view virtual returns (bytes32) {
        return block.chainid == INITIAL_CHAIN_ID ? INITIAL_DOMAIN_SEPARATOR : computeDomainSeparator();
    }

    function computeDomainSeparator() internal view virtual returns (bytes32) {
        return
            keccak256(
                abi.encode(
                    keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"),
                    keccak256(bytes(name)),
                    keccak256("1"),
                    block.chainid,
                    address(this)
                )
            );
    }

    /*//////////////////////////////////////////////////////////////
                        INTERNAL MINT/BURN LOGIC
    //////////////////////////////////////////////////////////////*/

    function _mint(address to, uint256 amount) internal virtual {
        totalSupply += amount;

        // Cannot overflow because the sum of all user
        // balances can't exceed the max uint256 value.
        unchecked {
            balanceOf[to] += amount;
        }

        emit Transfer(address(0), to, amount);
    }

    function _burn(address from, uint256 amount) internal virtual {
        balanceOf[from] -= amount;

        // Cannot underflow because a user's balance
        // will never be larger than the total supply.
        unchecked {
            totalSupply -= amount;
        }

        emit Transfer(from, address(0), amount);
    }
}

// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.8.0;

import {ERC20} from "../tokens/ERC20.sol";
import {SafeTransferLib} from "../utils/SafeTransferLib.sol";
import {FixedPointMathLib} from "../utils/FixedPointMathLib.sol";

/// @notice Minimal ERC4626 tokenized Vault implementation.
/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/mixins/ERC4626.sol)
abstract contract ERC4626 is ERC20 {
    using SafeTransferLib for ERC20;
    using FixedPointMathLib for uint256;

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

    event Deposit(address indexed caller, address indexed owner, uint256 assets, uint256 shares);

    event Withdraw(
        address indexed caller,
        address indexed receiver,
        address indexed owner,
        uint256 assets,
        uint256 shares
    );

    /*//////////////////////////////////////////////////////////////
                               IMMUTABLES
    //////////////////////////////////////////////////////////////*/

    ERC20 public immutable asset;

    constructor(
        ERC20 _asset,
        string memory _name,
        string memory _symbol
    ) ERC20(_name, _symbol, _asset.decimals()) {
        asset = _asset;
    }

    /*//////////////////////////////////////////////////////////////
                        DEPOSIT/WITHDRAWAL LOGIC
    //////////////////////////////////////////////////////////////*/

    function deposit(uint256 assets, address receiver) public virtual returns (uint256 shares) {
        // Check for rounding error since we round down in previewDeposit.
        require((shares = previewDeposit(assets)) != 0, "ZERO_SHARES");

        // Need to transfer before minting or ERC777s could reenter.
        asset.safeTransferFrom(msg.sender, address(this), assets);

        _mint(receiver, shares);

        emit Deposit(msg.sender, receiver, assets, shares);

        afterDeposit(assets, shares);
    }

    function mint(uint256 shares, address receiver) public virtual returns (uint256 assets) {
        assets = previewMint(shares); // No need to check for rounding error, previewMint rounds up.

        // Need to transfer before minting or ERC777s could reenter.
        asset.safeTransferFrom(msg.sender, address(this), assets);

        _mint(receiver, shares);

        emit Deposit(msg.sender, receiver, assets, shares);

        afterDeposit(assets, shares);
    }

    function withdraw(
        uint256 assets,
        address receiver,
        address owner
    ) public virtual returns (uint256 shares) {
        shares = previewWithdraw(assets); // No need to check for rounding error, previewWithdraw rounds up.

        if (msg.sender != owner) {
            uint256 allowed = allowance[owner][msg.sender]; // Saves gas for limited approvals.

            if (allowed != type(uint256).max) allowance[owner][msg.sender] = allowed - shares;
        }

        beforeWithdraw(assets, shares);

        _burn(owner, shares);

        emit Withdraw(msg.sender, receiver, owner, assets, shares);

        asset.safeTransfer(receiver, assets);
    }

    function redeem(
        uint256 shares,
        address receiver,
        address owner
    ) public virtual returns (uint256 assets) {
        if (msg.sender != owner) {
            uint256 allowed = allowance[owner][msg.sender]; // Saves gas for limited approvals.

            if (allowed != type(uint256).max) allowance[owner][msg.sender] = allowed - shares;
        }

        // Check for rounding error since we round down in previewRedeem.
        require((assets = previewRedeem(shares)) != 0, "ZERO_ASSETS");

        beforeWithdraw(assets, shares);

        _burn(owner, shares);

        emit Withdraw(msg.sender, receiver, owner, assets, shares);

        asset.safeTransfer(receiver, assets);
    }

    /*//////////////////////////////////////////////////////////////
                            ACCOUNTING LOGIC
    //////////////////////////////////////////////////////////////*/

    function totalAssets() public view virtual returns (uint256);

    function convertToShares(uint256 assets) public view virtual returns (uint256) {
        uint256 supply = totalSupply; // Saves an extra SLOAD if totalSupply is non-zero.

        return supply == 0 ? assets : assets.mulDivDown(supply, totalAssets());
    }

    function convertToAssets(uint256 shares) public view virtual returns (uint256) {
        uint256 supply = totalSupply; // Saves an extra SLOAD if totalSupply is non-zero.

        return supply == 0 ? shares : shares.mulDivDown(totalAssets(), supply);
    }

    function previewDeposit(uint256 assets) public view virtual returns (uint256) {
        return convertToShares(assets);
    }

    function previewMint(uint256 shares) public view virtual returns (uint256) {
        uint256 supply = totalSupply; // Saves an extra SLOAD if totalSupply is non-zero.

        return supply == 0 ? shares : shares.mulDivUp(totalAssets(), supply);
    }

    function previewWithdraw(uint256 assets) public view virtual returns (uint256) {
        uint256 supply = totalSupply; // Saves an extra SLOAD if totalSupply is non-zero.

        return supply == 0 ? assets : assets.mulDivUp(supply, totalAssets());
    }

    function previewRedeem(uint256 shares) public view virtual returns (uint256) {
        return convertToAssets(shares);
    }

    /*//////////////////////////////////////////////////////////////
                     DEPOSIT/WITHDRAWAL LIMIT LOGIC
    //////////////////////////////////////////////////////////////*/

    function maxDeposit(address) public view virtual returns (uint256) {
        return type(uint256).max;
    }

    function maxMint(address) public view virtual returns (uint256) {
        return type(uint256).max;
    }

    function maxWithdraw(address owner) public view virtual returns (uint256) {
        return convertToAssets(balanceOf[owner]);
    }

    function maxRedeem(address owner) public view virtual returns (uint256) {
        return balanceOf[owner];
    }

    /*//////////////////////////////////////////////////////////////
                          INTERNAL HOOKS LOGIC
    //////////////////////////////////////////////////////////////*/

    function beforeWithdraw(uint256 assets, uint256 shares) internal virtual {}

    function afterDeposit(uint256 assets, uint256 shares) internal virtual {}
}

// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.8.0;

import {ERC20} from "../tokens/ERC20.sol";

/// @notice Safe ETH and ERC20 transfer library that gracefully handles missing return values.
/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/SafeTransferLib.sol)
/// @dev Use with caution! Some functions in this library knowingly create dirty bits at the destination of the free memory pointer.
/// @dev Note that none of the functions in this library check that a token has code at all! That responsibility is delegated to the caller.
library SafeTransferLib {
    /*//////////////////////////////////////////////////////////////
                             ETH OPERATIONS
    //////////////////////////////////////////////////////////////*/

    function safeTransferETH(address to, uint256 amount) internal {
        bool success;

        /// @solidity memory-safe-assembly
        assembly {
            // Transfer the ETH and store if it succeeded or not.
            success := call(gas(), to, amount, 0, 0, 0, 0)
        }

        require(success, "ETH_TRANSFER_FAILED");
    }

    /*//////////////////////////////////////////////////////////////
                            ERC20 OPERATIONS
    //////////////////////////////////////////////////////////////*/

    function safeTransferFrom(
        ERC20 token,
        address from,
        address to,
        uint256 amount
    ) internal {
        bool success;

        /// @solidity memory-safe-assembly
        assembly {
            // Get a pointer to some free memory.
            let freeMemoryPointer := mload(0x40)

            // Write the abi-encoded calldata into memory, beginning with the function selector.
            mstore(freeMemoryPointer, 0x23b872dd00000000000000000000000000000000000000000000000000000000)
            mstore(add(freeMemoryPointer, 4), from) // Append the "from" argument.
            mstore(add(freeMemoryPointer, 36), to) // Append the "to" argument.
            mstore(add(freeMemoryPointer, 68), amount) // Append the "amount" argument.

            success := and(
                // Set success to whether the call reverted, if not we check it either
                // returned exactly 1 (can't just be non-zero data), or had no return data.
                or(and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize())),
                // We use 100 because the length of our calldata totals up like so: 4 + 32 * 3.
                // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space.
                // Counterintuitively, this call must be positioned second to the or() call in the
                // surrounding and() call or else returndatasize() will be zero during the computation.
                call(gas(), token, 0, freeMemoryPointer, 100, 0, 32)
            )
        }

        require(success, "TRANSFER_FROM_FAILED");
    }

    function safeTransfer(
        ERC20 token,
        address to,
        uint256 amount
    ) internal {
        bool success;

        /// @solidity memory-safe-assembly
        assembly {
            // Get a pointer to some free memory.
            let freeMemoryPointer := mload(0x40)

            // Write the abi-encoded calldata into memory, beginning with the function selector.
            mstore(freeMemoryPointer, 0xa9059cbb00000000000000000000000000000000000000000000000000000000)
            mstore(add(freeMemoryPointer, 4), to) // Append the "to" argument.
            mstore(add(freeMemoryPointer, 36), amount) // Append the "amount" argument.

            success := and(
                // Set success to whether the call reverted, if not we check it either
                // returned exactly 1 (can't just be non-zero data), or had no return data.
                or(and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize())),
                // We use 68 because the length of our calldata totals up like so: 4 + 32 * 2.
                // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space.
                // Counterintuitively, this call must be positioned second to the or() call in the
                // surrounding and() call or else returndatasize() will be zero during the computation.
                call(gas(), token, 0, freeMemoryPointer, 68, 0, 32)
            )
        }

        require(success, "TRANSFER_FAILED");
    }

    function safeApprove(
        ERC20 token,
        address to,
        uint256 amount
    ) internal {
        bool success;

        /// @solidity memory-safe-assembly
        assembly {
            // Get a pointer to some free memory.
            let freeMemoryPointer := mload(0x40)

            // Write the abi-encoded calldata into memory, beginning with the function selector.
            mstore(freeMemoryPointer, 0x095ea7b300000000000000000000000000000000000000000000000000000000)
            mstore(add(freeMemoryPointer, 4), to) // Append the "to" argument.
            mstore(add(freeMemoryPointer, 36), amount) // Append the "amount" argument.

            success := and(
                // Set success to whether the call reverted, if not we check it either
                // returned exactly 1 (can't just be non-zero data), or had no return data.
                or(and(eq(mload(0), 1), gt(returndatasize(), 31)), iszero(returndatasize())),
                // We use 68 because the length of our calldata totals up like so: 4 + 32 * 2.
                // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space.
                // Counterintuitively, this call must be positioned second to the or() call in the
                // surrounding and() call or else returndatasize() will be zero during the computation.
                call(gas(), token, 0, freeMemoryPointer, 68, 0, 32)
            )
        }

        require(success, "APPROVE_FAILED");
    }
}

// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.8.0;

/// @notice Arithmetic library with operations for fixed-point numbers.
/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/FixedPointMathLib.sol)
/// @author Inspired by USM (https://github.com/usmfum/USM/blob/master/contracts/WadMath.sol)
library FixedPointMathLib {
    /*//////////////////////////////////////////////////////////////
                    SIMPLIFIED FIXED POINT OPERATIONS
    //////////////////////////////////////////////////////////////*/

    uint256 internal constant MAX_UINT256 = 2**256 - 1;

    uint256 internal constant WAD = 1e18; // The scalar of ETH and most ERC20s.

    function mulWadDown(uint256 x, uint256 y) internal pure returns (uint256) {
        return mulDivDown(x, y, WAD); // Equivalent to (x * y) / WAD rounded down.
    }

    function mulWadUp(uint256 x, uint256 y) internal pure returns (uint256) {
        return mulDivUp(x, y, WAD); // Equivalent to (x * y) / WAD rounded up.
    }

    function divWadDown(uint256 x, uint256 y) internal pure returns (uint256) {
        return mulDivDown(x, WAD, y); // Equivalent to (x * WAD) / y rounded down.
    }

    function divWadUp(uint256 x, uint256 y) internal pure returns (uint256) {
        return mulDivUp(x, WAD, y); // Equivalent to (x * WAD) / y rounded up.
    }

    /*//////////////////////////////////////////////////////////////
                    LOW LEVEL FIXED POINT OPERATIONS
    //////////////////////////////////////////////////////////////*/

    function mulDivDown(
        uint256 x,
        uint256 y,
        uint256 denominator
    ) internal pure returns (uint256 z) {
        /// @solidity memory-safe-assembly
        assembly {
            // Equivalent to require(denominator != 0 && (y == 0 || x <= type(uint256).max / y))
            if iszero(mul(denominator, iszero(mul(y, gt(x, div(MAX_UINT256, y)))))) {
                revert(0, 0)
            }

            // Divide x * y by the denominator.
            z := div(mul(x, y), denominator)
        }
    }

    function mulDivUp(
        uint256 x,
        uint256 y,
        uint256 denominator
    ) internal pure returns (uint256 z) {
        /// @solidity memory-safe-assembly
        assembly {
            // Equivalent to require(denominator != 0 && (y == 0 || x <= type(uint256).max / y))
            if iszero(mul(denominator, iszero(mul(y, gt(x, div(MAX_UINT256, y)))))) {
                revert(0, 0)
            }

            // If x * y modulo the denominator is strictly greater than 0,
            // 1 is added to round up the division of x * y by the denominator.
            z := add(gt(mod(mul(x, y), denominator), 0), div(mul(x, y), denominator))
        }
    }

    function rpow(
        uint256 x,
        uint256 n,
        uint256 scalar
    ) internal pure returns (uint256 z) {
        /// @solidity memory-safe-assembly
        assembly {
            switch x
            case 0 {
                switch n
                case 0 {
                    // 0 ** 0 = 1
                    z := scalar
                }
                default {
                    // 0 ** n = 0
                    z := 0
                }
            }
            default {
                switch mod(n, 2)
                case 0 {
                    // If n is even, store scalar in z for now.
                    z := scalar
                }
                default {
                    // If n is odd, store x in z for now.
                    z := x
                }

                // Shifting right by 1 is like dividing by 2.
                let half := shr(1, scalar)

                for {
                    // Shift n right by 1 before looping to halve it.
                    n := shr(1, n)
                } n {
                    // Shift n right by 1 each iteration to halve it.
                    n := shr(1, n)
                } {
                    // Revert immediately if x ** 2 would overflow.
                    // Equivalent to iszero(eq(div(xx, x), x)) here.
                    if shr(128, x) {
                        revert(0, 0)
                    }

                    // Store x squared.
                    let xx := mul(x, x)

                    // Round to the nearest number.
                    let xxRound := add(xx, half)

                    // Revert if xx + half overflowed.
                    if lt(xxRound, xx) {
                        revert(0, 0)
                    }

                    // Set x to scaled xxRound.
                    x := div(xxRound, scalar)

                    // If n is even:
                    if mod(n, 2) {
                        // Compute z * x.
                        let zx := mul(z, x)

                        // If z * x overflowed:
                        if iszero(eq(div(zx, x), z)) {
                            // Revert if x is non-zero.
                            if iszero(iszero(x)) {
                                revert(0, 0)
                            }
                        }

                        // Round to the nearest number.
                        let zxRound := add(zx, half)

                        // Revert if zx + half overflowed.
                        if lt(zxRound, zx) {
                            revert(0, 0)
                        }

                        // Return properly scaled zxRound.
                        z := div(zxRound, scalar)
                    }
                }
            }
        }
    }

    /*//////////////////////////////////////////////////////////////
                        GENERAL NUMBER UTILITIES
    //////////////////////////////////////////////////////////////*/

    function sqrt(uint256 x) internal pure returns (uint256 z) {
        /// @solidity memory-safe-assembly
        assembly {
            let y := x // We start y at x, which will help us make our initial estimate.

            z := 181 // The "correct" value is 1, but this saves a multiplication later.

            // This segment is to get a reasonable initial estimate for the Babylonian method. With a bad
            // start, the correct # of bits increases ~linearly each iteration instead of ~quadratically.

            // We check y >= 2^(k + 8) but shift right by k bits
            // each branch to ensure that if x >= 256, then y >= 256.
            if iszero(lt(y, 0x10000000000000000000000000000000000)) {
                y := shr(128, y)
                z := shl(64, z)
            }
            if iszero(lt(y, 0x1000000000000000000)) {
                y := shr(64, y)
                z := shl(32, z)
            }
            if iszero(lt(y, 0x10000000000)) {
                y := shr(32, y)
                z := shl(16, z)
            }
            if iszero(lt(y, 0x1000000)) {
                y := shr(16, y)
                z := shl(8, z)
            }

            // Goal was to get z*z*y within a small factor of x. More iterations could
            // get y in a tighter range. Currently, we will have y in [256, 256*2^16).
            // We ensured y >= 256 so that the relative difference between y and y+1 is small.
            // That's not possible if x < 256 but we can just verify those cases exhaustively.

            // Now, z*z*y <= x < z*z*(y+1), and y <= 2^(16+8), and either y >= 256, or x < 256.
            // Correctness can be checked exhaustively for x < 256, so we assume y >= 256.
            // Then z*sqrt(y) is within sqrt(257)/sqrt(256) of sqrt(x), or about 20bps.

            // For s in the range [1/256, 256], the estimate f(s) = (181/1024) * (s+1) is in the range
            // (1/2.84 * sqrt(s), 2.84 * sqrt(s)), with largest error when s = 1 and when s = 256 or 1/256.

            // Since y is in [256, 256*2^16), let a = y/65536, so that a is in [1/256, 256). Then we can estimate
            // sqrt(y) using sqrt(65536) * 181/1024 * (a + 1) = 181/4 * (y + 65536)/65536 = 181 * (y + 65536)/2^18.

            // There is no overflow risk here since y < 2^136 after the first branch above.
            z := shr(18, mul(z, add(y, 65536))) // A mul() is saved from starting z at 181.

            // Given the worst case multiplicative error of 2.84 above, 7 iterations should be enough.
            z := shr(1, add(z, div(x, z)))
            z := shr(1, add(z, div(x, z)))
            z := shr(1, add(z, div(x, z)))
            z := shr(1, add(z, div(x, z)))
            z := shr(1, add(z, div(x, z)))
            z := shr(1, add(z, div(x, z)))
            z := shr(1, add(z, div(x, z)))

            // If x+1 is a perfect square, the Babylonian method cycles between
            // floor(sqrt(x)) and ceil(sqrt(x)). This statement ensures we return floor.
            // See: https://en.wikipedia.org/wiki/Integer_square_root#Using_only_integer_division
            // Since the ceil is rare, we save gas on the assignment and repeat division in the rare case.
            // If you don't care whether the floor or ceil square root is returned, you can remove this statement.
            z := sub(z, lt(div(x, z), z))
        }
    }

    function unsafeMod(uint256 x, uint256 y) internal pure returns (uint256 z) {
        /// @solidity memory-safe-assembly
        assembly {
            // Mod x by y. Note this will return
            // 0 instead of reverting if y is zero.
            z := mod(x, y)
        }
    }

    function unsafeDiv(uint256 x, uint256 y) internal pure returns (uint256 r) {
        /// @solidity memory-safe-assembly
        assembly {
            // Divide x by y. Note this will return
            // 0 instead of reverting if y is zero.
            r := div(x, y)
        }
    }

    function unsafeDivUp(uint256 x, uint256 y) internal pure returns (uint256 z) {
        /// @solidity memory-safe-assembly
        assembly {
            // Add 1 to x * y if x % y > 0. Note this will
            // return 0 instead of reverting if y is zero.
            z := add(gt(mod(x, y), 0), div(x, y))
        }
    }
}

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

pragma solidity ^0.8.0;

import "./IAccessControl.sol";
import "../utils/Context.sol";
import "../utils/Strings.sol";
import "../utils/introspection/ERC165.sol";

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

    mapping(bytes32 => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

    /**
     * @dev Modifier that checks that an account has a specific role. Reverts
     * with a standardized message including the required role.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     *
     * _Available since v4.1._
     */
    modifier onlyRole(bytes32 role) {
        _checkRole(role);
        _;
    }

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

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

    /**
     * @dev Revert with a standard message if `_msgSender()` is missing `role`.
     * Overriding this function changes the behavior of the {onlyRole} modifier.
     *
     * Format of the revert message is described in {_checkRole}.
     *
     * _Available since v4.6._
     */
    function _checkRole(bytes32 role) internal view virtual {
        _checkRole(role, _msgSender());
    }

    /**
     * @dev Revert with a standard message if `account` is missing `role`.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     */
    function _checkRole(bytes32 role, address account) internal view virtual {
        if (!hasRole(role, account)) {
            revert(
                string(
                    abi.encodePacked(
                        "AccessControl: account ",
                        Strings.toHexString(account),
                        " is missing role ",
                        Strings.toHexString(uint256(role), 32)
                    )
                )
            );
        }
    }

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

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

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

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

        _revokeRole(role, account);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event. Note that unlike {grantRole}, this function doesn't perform any
     * checks on the calling account.
     *
     * May emit a {RoleGranted} event.
     *
     * [WARNING]
     * ====
     * This function should only be called from the constructor when setting
     * up the initial roles for the system.
     *
     * Using this function in any other way is effectively circumventing the admin
     * system imposed by {AccessControl}.
     * ====
     *
     * NOTE: This function is deprecated in favor of {_grantRole}.
     */
    function _setupRole(bytes32 role, address account) internal virtual {
        _grantRole(role, account);
    }

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

    /**
     * @dev Grants `role` to `account`.
     *
     * Internal function without access restriction.
     *
     * May emit a {RoleGranted} event.
     */
    function _grantRole(bytes32 role, address account) internal virtual {
        if (!hasRole(role, account)) {
            _roles[role].members[account] = true;
            emit RoleGranted(role, account, _msgSender());
        }
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * Internal function without access restriction.
     *
     * May emit a {RoleRevoked} event.
     */
    function _revokeRole(bytes32 role, address account) internal virtual {
        if (hasRole(role, account)) {
            _roles[role].members[account] = false;
            emit RoleRevoked(role, account, _msgSender());
        }
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (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() {
        _nonReentrantBefore();
        _;
        _nonReentrantAfter();
    }

    function _nonReentrantBefore() private {
        // On the first call to nonReentrant, _status will be _NOT_ENTERED
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");

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

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

// SPDX-License-Identifier: AGPL-3.0
pragma solidity ^0.8.10;

import {ERC20} from "solmate/tokens/ERC20.sol";
import {ERC4626} from "solmate/mixins/ERC4626.sol";
import {FixedPointMathLib} from "solmate/utils/FixedPointMathLib.sol";
import {ReentrancyGuard} from "openzeppelin-contracts/security/ReentrancyGuard.sol";

abstract contract BonusTracker is ERC4626, ReentrancyGuard {
    using FixedPointMathLib for uint256;

    event BonusPaid(address indexed user, uint256 bonus);
    event BonusBurned(address indexed user, uint256 bonus);

    uint256 internal constant PRECISION = 1e30;

    /// @notice The last Unix timestamp (in seconds) when bonusPerTokenStored was updated
    uint64 public lastBonusUpdateTime;

    /// @notice The last stored bonusPerToken value
    uint256 public bonusPerTokenStored;

    /// @notice The total bonus amount currently held by users
    uint256 public totalBonus;

    /// @notice The bonusPerToken value when an account last compounded/withdrew bonus
    mapping(address => uint256) public userBonusPerTokenPaid;

    /// @notice The number of multiplier points compounded for an account
    mapping(address => uint256) public multiplierPointsOf;

    /// @notice The bonusOf() value when an account last staked/withdrew bonus
    mapping(address => uint256) public bonus;

    constructor(ERC20 _asset, string memory _name, string memory _symbol) ERC4626(_asset, _name, _symbol) {
        lastBonusUpdateTime = uint64(block.timestamp);
    }

    /// @notice Claim bonus
    function boost() external nonReentrant returns (uint256 _bonus) {
        _updateReward(msg.sender);
        _updateBonus(msg.sender);
        _bonus = bonus[msg.sender];

        if (_bonus > 0) {
            bonus[msg.sender] = 0;
            multiplierPointsOf[msg.sender] += _bonus;
            totalBonus += _bonus;
            emit BonusPaid(msg.sender, _bonus);
        }
    }

    /// @notice The latest time at which stakers are earning bonus.
    function lastTimeBonusApplicable() public view returns (uint64) {
        return uint64(block.timestamp);
    }

    /// @notice The amount of bonus tokens each staked token has earned so far
    function bonusPerToken() external view returns (uint256) {
        return _bonusPerToken(lastTimeBonusApplicable());
    }

    /// @notice The amount of bonus tokens an account has accrued so far.
    function bonusOf(address _account) external view returns (uint256) {
        return _earnedBonus(_account, _bonusPerToken(lastTimeBonusApplicable()));
    }

    function _earnedBonus(address _account, uint256 _bonusPerToken_) internal view returns (uint256) {
        return balanceOf[_account].mulDivDown(_bonusPerToken_ - userBonusPerTokenPaid[_account], PRECISION)
            + bonus[_account];
    }

    function _bonusPerToken(uint256 _lastTimeBonusApplicable_) internal view returns (uint256) {
        return bonusPerTokenStored + (_lastTimeBonusApplicable_ - lastBonusUpdateTime).mulDivDown(PRECISION, 365 days);
    }

    function _updateBonus(address _account) internal {
        // storage loads
        uint64 lastTimeBonusApplicable_ = lastTimeBonusApplicable();
        uint256 bonusPerToken_ = _bonusPerToken(lastTimeBonusApplicable_);

        // accrue bonus
        bonusPerTokenStored = bonusPerToken_;
        lastBonusUpdateTime = lastTimeBonusApplicable_;
        bonus[_account] = _earnedBonus(_account, bonusPerToken_);
        userBonusPerTokenPaid[_account] = bonusPerToken_;
    }

    function _updateReward(address) internal virtual {}
}

// SPDX-License-Identifier: AGPL-3.0
pragma solidity ^0.8.10;

import {FixedPointMathLib} from "solmate/utils/FixedPointMathLib.sol";

abstract contract DebtTracker {
    using FixedPointMathLib for uint256;

    event DebtAdded(address indexed user, uint256 debt, uint64 timestamp);
    event DebtPaid(address indexed user, uint256 debt);

    error UserHasDebt();

    /// @notice The initial debt for an account
    mapping(address => uint256) public debtOf;

    /// @notice The debt start time for a user
    mapping(address => uint64) public debtStartTimeFor;

    /// @notice The treasury address that recieves any paid debt
    address public treasury;

    /// @notice The amount of current debt left for an account
    function debtFor(address _account) external view returns (uint256) {
        return _debtFor(_account);
    }

    function _updateDebt(address _account) internal {
        // storage loads
        uint64 now_ = uint64(block.timestamp);
        uint256 startTime_ = debtStartTimeFor[_account];

        // if 30 days has passed: eliminate debt
        if (now_ - startTime_ >= 30 days) {
            debtOf[_account] = 0;
        }
    }

    function _debtFor(address _account) internal view returns (uint256) {
        // storage loads
        uint64 now_ = uint64(block.timestamp);
        uint256 startTime = debtStartTimeFor[_account];
        uint256 delta = now_ - startTime;
        uint256 debt = debtOf[_account];

        // if 30 days passed: no debt
        if (delta >= 30 days) return 0;

        // otherwise debt decreases linearly to 0 over 30 days
        return (debt - debt.mulDivDown(delta, 30 days));
    }
}

File 10 of 16 : scErrors.sol
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity ^0.8.10;

error InvalidTargetLtv();
error InvalidMaxLtv();
error InvalidFlashLoanCaller();
error InvalidSlippageTolerance();
error InvalidFloatPercentage();
error ZeroAddress();
error PleaseUseRedeemMethod();
error FeesTooHigh();
error TreasuryCannotBeZero();
error VaultNotUnderwater();
error CallerNotAdmin();
error CallerNotKeeper();
error NoProfitsToSell();
error EndUsdcBalanceTooLow();
error InsufficientDepositBalance();
error AmountReceivedBelowMin();
error FlashLoanAmountZero();
error ProtocolNotSupported(uint256 adapterId);
error ProtocolInUse(uint256 adapterId);
error FloatBalanceTooLow(uint256 actual, uint256 required);
error TokenOutNotAllowed(address token);

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)

pragma solidity ^0.8.0;

/**
 * @dev External interface of AccessControl declared to support ERC165 detection.
 */
interface IAccessControl {
    /**
     * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
     *
     * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
     * {RoleAdminChanged} not being emitted signaling this.
     *
     * _Available since v3.1._
     */
    event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);

    /**
     * @dev Emitted when `account` is granted `role`.
     *
     * `sender` is the account that originated the contract call, an admin role
     * bearer except when using {AccessControl-_setupRole}.
     */
    event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);

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

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

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

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

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

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

// 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 (last updated v4.8.0) (utils/Strings.sol)

pragma solidity ^0.8.0;

import "./math/Math.sol";

/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant _SYMBOLS = "0123456789abcdef";
    uint8 private constant _ADDRESS_LENGTH = 20;

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        unchecked {
            uint256 length = Math.log10(value) + 1;
            string memory buffer = new string(length);
            uint256 ptr;
            /// @solidity memory-safe-assembly
            assembly {
                ptr := add(buffer, add(32, length))
            }
            while (true) {
                ptr--;
                /// @solidity memory-safe-assembly
                assembly {
                    mstore8(ptr, byte(mod(value, 10), _SYMBOLS))
                }
                value /= 10;
                if (value == 0) break;
            }
            return buffer;
        }
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        unchecked {
            return toHexString(value, Math.log256(value) + 1);
        }
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
     */
    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
        bytes memory buffer = new bytes(2 * length + 2);
        buffer[0] = "0";
        buffer[1] = "x";
        for (uint256 i = 2 * length + 1; i > 1; --i) {
            buffer[i] = _SYMBOLS[value & 0xf];
            value >>= 4;
        }
        require(value == 0, "Strings: hex length insufficient");
        return string(buffer);
    }

    /**
     * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
     */
    function toHexString(address addr) internal pure returns (string memory) {
        return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
    }
}

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

pragma solidity ^0.8.0;

import "./IERC165.sol";

/**
 * @dev Implementation of the {IERC165} interface.
 *
 * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
 * for the additional interface id that will be supported. For example:
 *
 * ```solidity
 * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
 *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
 * }
 * ```
 *
 * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
 */
abstract contract ERC165 is IERC165 {
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IERC165).interfaceId;
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol)

pragma solidity ^0.8.0;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    enum Rounding {
        Down, // Toward negative infinity
        Up, // Toward infinity
        Zero // Toward zero
    }

    /**
     * @dev Returns the largest of two numbers.
     */
    function max(uint256 a, uint256 b) internal pure returns (uint256) {
        return a > b ? a : b;
    }

    /**
     * @dev Returns the smallest of two numbers.
     */
    function min(uint256 a, uint256 b) internal pure returns (uint256) {
        return a < b ? a : b;
    }

    /**
     * @dev Returns the average of two numbers. The result is rounded towards
     * zero.
     */
    function average(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b) / 2 can overflow.
        return (a & b) + (a ^ b) / 2;
    }

    /**
     * @dev Returns the ceiling of the division of two numbers.
     *
     * This differs from standard division with `/` in that it rounds up instead
     * of rounding down.
     */
    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b - 1) / b can overflow on addition, so we distribute.
        return a == 0 ? 0 : (a - 1) / b + 1;
    }

    /**
     * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
     * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
     * with further edits by Uniswap Labs also under MIT license.
     */
    function mulDiv(
        uint256 x,
        uint256 y,
        uint256 denominator
    ) internal pure returns (uint256 result) {
        unchecked {
            // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
            // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
            // variables such that product = prod1 * 2^256 + prod0.
            uint256 prod0; // Least significant 256 bits of the product
            uint256 prod1; // Most significant 256 bits of the product
            assembly {
                let mm := mulmod(x, y, not(0))
                prod0 := mul(x, y)
                prod1 := sub(sub(mm, prod0), lt(mm, prod0))
            }

            // Handle non-overflow cases, 256 by 256 division.
            if (prod1 == 0) {
                return prod0 / denominator;
            }

            // Make sure the result is less than 2^256. Also prevents denominator == 0.
            require(denominator > prod1);

            ///////////////////////////////////////////////
            // 512 by 256 division.
            ///////////////////////////////////////////////

            // Make division exact by subtracting the remainder from [prod1 prod0].
            uint256 remainder;
            assembly {
                // Compute remainder using mulmod.
                remainder := mulmod(x, y, denominator)

                // Subtract 256 bit number from 512 bit number.
                prod1 := sub(prod1, gt(remainder, prod0))
                prod0 := sub(prod0, remainder)
            }

            // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
            // See https://cs.stackexchange.com/q/138556/92363.

            // Does not overflow because the denominator cannot be zero at this stage in the function.
            uint256 twos = denominator & (~denominator + 1);
            assembly {
                // Divide denominator by twos.
                denominator := div(denominator, twos)

                // Divide [prod1 prod0] by twos.
                prod0 := div(prod0, twos)

                // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
                twos := add(div(sub(0, twos), twos), 1)
            }

            // Shift in bits from prod1 into prod0.
            prod0 |= prod1 * twos;

            // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
            // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
            // four bits. That is, denominator * inv = 1 mod 2^4.
            uint256 inverse = (3 * denominator) ^ 2;

            // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
            // in modular arithmetic, doubling the correct bits in each step.
            inverse *= 2 - denominator * inverse; // inverse mod 2^8
            inverse *= 2 - denominator * inverse; // inverse mod 2^16
            inverse *= 2 - denominator * inverse; // inverse mod 2^32
            inverse *= 2 - denominator * inverse; // inverse mod 2^64
            inverse *= 2 - denominator * inverse; // inverse mod 2^128
            inverse *= 2 - denominator * inverse; // inverse mod 2^256

            // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
            // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
            // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
            // is no longer required.
            result = prod0 * inverse;
            return result;
        }
    }

    /**
     * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
     */
    function mulDiv(
        uint256 x,
        uint256 y,
        uint256 denominator,
        Rounding rounding
    ) internal pure returns (uint256) {
        uint256 result = mulDiv(x, y, denominator);
        if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
            result += 1;
        }
        return result;
    }

    /**
     * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.
     *
     * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
     */
    function sqrt(uint256 a) internal pure returns (uint256) {
        if (a == 0) {
            return 0;
        }

        // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
        //
        // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
        // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
        //
        // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
        // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
        // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
        //
        // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
        uint256 result = 1 << (log2(a) >> 1);

        // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
        // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
        // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
        // into the expected uint128 result.
        unchecked {
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            return min(result, a / result);
        }
    }

    /**
     * @notice Calculates sqrt(a), following the selected rounding direction.
     */
    function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = sqrt(a);
            return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 2, rounded down, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 128;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 64;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 32;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 16;
            }
            if (value >> 8 > 0) {
                value >>= 8;
                result += 8;
            }
            if (value >> 4 > 0) {
                value >>= 4;
                result += 4;
            }
            if (value >> 2 > 0) {
                value >>= 2;
                result += 2;
            }
            if (value >> 1 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 2, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log2(value);
            return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 10, rounded down, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >= 10**64) {
                value /= 10**64;
                result += 64;
            }
            if (value >= 10**32) {
                value /= 10**32;
                result += 32;
            }
            if (value >= 10**16) {
                value /= 10**16;
                result += 16;
            }
            if (value >= 10**8) {
                value /= 10**8;
                result += 8;
            }
            if (value >= 10**4) {
                value /= 10**4;
                result += 4;
            }
            if (value >= 10**2) {
                value /= 10**2;
                result += 2;
            }
            if (value >= 10**1) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log10(value);
            return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 256, rounded down, of a positive value.
     * Returns 0 if given 0.
     *
     * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
     */
    function log256(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 16;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 8;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 4;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 2;
            }
            if (value >> 8 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log256(value);
            return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0);
        }
    }
}

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

pragma solidity ^0.8.0;

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

Settings
{
  "remappings": [
    "create3-factory/=lib/create3-factory/src/",
    "ds-test/=lib/forge-std/lib/ds-test/src/",
    "forge-std/=lib/forge-std/src/",
    "solmate/=lib/solmate/src/",
    "openzeppelin-contracts/=lib/openzeppelin-contracts/contracts/",
    "aave-v3/=lib/aave-v3-core/contracts/",
    "surl/=lib/surl/src/",
    "aave-v3-core/=lib/aave-v3-core/",
    "euler-interfaces/=lib/euler-interfaces/contracts/",
    "solidity-stringutils/=lib/surl/lib/solidity-stringutils/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 1000000
  },
  "metadata": {
    "useLiteralContent": false,
    "bytecodeHash": "ipfs",
    "appendCBOR": true
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "paris",
  "libraries": {}
}

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"address","name":"admin","type":"address"},{"internalType":"address","name":"_treasury","type":"address"},{"internalType":"address","name":"_stakeToken","type":"address"},{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"},{"internalType":"address","name":"_rewardToken","type":"address"},{"internalType":"uint64","name":"_duration","type":"uint64"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"CallerNotAdmin","type":"error"},{"inputs":[],"name":"CallerNotDistirbutor","type":"error"},{"inputs":[],"name":"SenderHasToBeReceiver","type":"error"},{"inputs":[],"name":"TreasuryCannotBeZero","type":"error"},{"inputs":[],"name":"UserHasDebt","type":"error"},{"inputs":[],"name":"VaultAssetNotSupported","type":"error"},{"inputs":[],"name":"VaultNotWhitelisted","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"bonus","type":"uint256"}],"name":"BonusBurned","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"bonus","type":"uint256"}],"name":"BonusPaid","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"debt","type":"uint256"},{"indexed":false,"internalType":"uint64","name":"timestamp","type":"uint64"}],"name":"DebtAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"debt","type":"uint256"}],"name":"DebtPaid","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"assets","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"reward","type":"uint256"}],"name":"RewardAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"reward","type":"uint256"}],"name":"RewardPaid","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"address","name":"newTreasury","type":"address"}],"name":"TreasuryUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"vault","type":"address"}],"name":"VaultAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"caller","type":"address"},{"indexed":true,"internalType":"address","name":"receiver","type":"address"},{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"assets","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"}],"name":"Withdraw","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DISTRIBUTOR","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DOMAIN_SEPARATOR","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_vault","type":"address"}],"name":"addVault","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"asset","outputs":[{"internalType":"contract ERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"bonus","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"bonusOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"bonusPerToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"bonusPerTokenStored","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"boost","outputs":[{"internalType":"uint256","name":"_bonus","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_receiver","type":"address"}],"name":"claimRewards","outputs":[{"internalType":"uint256","name":"reward","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"name":"convertToAssets","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"assets","type":"uint256"}],"name":"convertToShares","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"debtFor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"debtOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"debtStartTimeFor","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_assets","type":"uint256"},{"internalType":"address","name":"_receiver","type":"address"}],"name":"deposit","outputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"duration","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"earned","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract ERC4626","name":"_vault","type":"address"}],"name":"fetchRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isVault","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastBonusUpdateTime","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastTimeBonusApplicable","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastTimeRewardApplicable","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastUpdateTime","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"maxDeposit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"maxMint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"maxRedeem","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"maxWithdraw","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_shares","type":"uint256"},{"internalType":"address","name":"_receiver","type":"address"}],"name":"mint","outputs":[{"internalType":"uint256","name":"assets","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"multiplierPointsOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"nonces","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"payDebt","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"periodFinish","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"permit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"assets","type":"uint256"}],"name":"previewDeposit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"name":"previewMint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"name":"previewRedeem","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"assets","type":"uint256"}],"name":"previewWithdraw","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"shares","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"address","name":"owner","type":"address"}],"name":"redeem","outputs":[{"internalType":"uint256","name":"assets","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rewardBalanceStored","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardPerToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardPerTokenStored","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardToken","outputs":[{"internalType":"contract ERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"rewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_newTreasury","type":"address"}],"name":"setTreasury","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"startRewardsDistribution","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalAssets","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalBonus","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"treasury","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"userBonusPerTokenPaid","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"userRewardPerTokenPaid","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"assets","type":"uint256"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"address","name":"owner","type":"address"}],"name":"withdraw","outputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"stateMutability":"nonpayable","type":"function"}]

6101406040523480156200001257600080fd5b50604051620042da380380620042da8339810160408190526200003591620003a0565b8484848282828181846001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa1580156200007c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620000a2919062000471565b6000620000b084826200052c565b506001620000bf83826200052c565b5060ff81166080524660a052620000d56200017d565b60c052505050506001600160a01b039190911660e052505060016006555050600780546001600160401b031916426001600160401b03161790556200011c60008862000219565b6001600160a01b03861662000144576040516391f7acdb60e01b815260040160405180910390fd5b600f80546001600160a01b0319166001600160a01b039788161790559416610100525050506001600160401b0316610120525062000676565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6000604051620001b19190620005f8565b6040805191829003822060208301939093528101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260c00160405160208183030381529060405280519060200120905090565b60008281526010602090815260408083206001600160a01b038516845290915290205460ff16620002ba5760008281526010602090815260408083206001600160a01b03851684529091529020805460ff19166001179055620002793390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b80516001600160a01b0381168114620002d657600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b600082601f8301126200030357600080fd5b81516001600160401b0380821115620003205762000320620002db565b604051601f8301601f19908116603f011681019082821181831017156200034b576200034b620002db565b816040528381526020925086838588010111156200036857600080fd5b600091505b838210156200038c57858201830151818301840152908201906200036d565b600093810190920192909252949350505050565b600080600080600080600060e0888a031215620003bc57600080fd5b620003c788620002be565b9650620003d760208901620002be565b9550620003e760408901620002be565b60608901519095506001600160401b03808211156200040557600080fd5b620004138b838c01620002f1565b955060808a01519150808211156200042a57600080fd5b620004388b838c01620002f1565b94506200044860a08b01620002be565b935060c08a0151915080821682146200046057600080fd5b508091505092959891949750929550565b6000602082840312156200048457600080fd5b815160ff811681146200049657600080fd5b9392505050565b600181811c90821680620004b257607f821691505b602082108103620004d357634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200052757600081815260208120601f850160051c81016020861015620005025750805b601f850160051c820191505b8181101562000523578281556001016200050e565b5050505b505050565b81516001600160401b03811115620005485762000548620002db565b62000560816200055984546200049d565b84620004d9565b602080601f8311600181146200059857600084156200057f5750858301515b600019600386901b1c1916600185901b17855562000523565b600085815260208120601f198616915b82811015620005c957888601518255948401946001909101908401620005a8565b5085821015620005e85787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b600080835462000608816200049d565b6001828116801562000623576001811462000639576200066a565b60ff19841687528215158302870194506200066a565b8760005260208060002060005b85811015620006615781548a82015290840190820162000646565b50505082870194505b50929695505050505050565b60805160a05160c05160e0516101005161012051613bdc620006fe6000396000818161053a0152612560015260008181610aa501528181610eb501528181611f4901526124a501526000818161065f0152818161189801528181611ae701528181612dd70152612e8d0152600061108e015260006110590152600061060b0152613bdc6000f3fe608060405234801561001057600080fd5b50600436106104565760003560e01c80638706827d11610250578063c7e5c8c811610150578063dd62ed3e116100c8578063ef5cfb8c11610097578063f0f442601161007c578063f0f4426014610a8d578063f7c618c114610aa0578063fc95243c14610ac757600080fd5b8063ef5cfb8c14610a67578063ef8b30f714610a7a57600080fd5b8063dd62ed3e146109e9578063df136d6514610a14578063e34ddc3914610a1d578063ebe2b12b14610a4757600080fd5b8063d283e75f1161011f578063d547741f11610104578063d547741f14610980578063d8cb4aa314610993578063d905777e146109b357600080fd5b8063d283e75f1461094d578063d505accf1461096d57600080fd5b8063c7e5c8c8146108fe578063c8f33c911461091e578063cd3daf9d14610932578063ce96cb771461093a57600080fd5b8063a66f42c0116101e3578063b3d7f6b9116101b2578063ba08765211610197578063ba087652146108d8578063c63d75b6146106a6578063c6e6f592146108eb57600080fd5b8063b3d7f6b9146108b2578063b460af94146108c557600080fd5b8063a66f42c014610886578063a8dd07dc1461088e578063a9059cbb14610897578063abb8cd16146108aa57600080fd5b806394bf804d1161021f57806394bf804d1461083c57806395d89b411461084f5780639c26149f14610857578063a217fddf1461087e57600080fd5b80638706827d146107af5780638a46699a146107c25780638b876347146107d657806391d14854146107f657600080fd5b8063256b5a021161035b5780634cdad506116102ee5780636e553f65116102bd5780637b0a47ee116102a25780637b0a47ee1461077e5780637ecebe001461078757806380faa57d146107a757600080fd5b80636e553f651461074b57806370a082311461075e57600080fd5b80634cdad506146106e25780634e064e25146106f557806361d027b314610708578063652b9b411461072857600080fd5b806336568abe1161032a57806336568abe1461064757806338d52e0f1461065a578063402d267d146106a6578063468e8365146106d957600080fd5b8063256b5a02146105e05780632f2ff15d146105f3578063313ce567146106065780633644e5151461063f57600080fd5b80630e40dc8d116103ee57806318160ddd116103bd5780632392f692116103a25780632392f692146105a257806323b872dd146105aa578063248a9ca3146105bd57600080fd5b806318160ddd1461057957806322957c8e1461058257600080fd5b80630e40dc8d1461051a5780630fb5a6b4146105355780631283e3281461055c57806312ee50571461056f57600080fd5b80630700037d1161042a5780630700037d146104c157806307a2d13a146104e1578063095ea7b3146104f45780630a28a4771461050757600080fd5b80628cc2621461045b57806301e1d1141461048157806301ffc9a71461048957806306fdde03146104ac575b600080fd5b61046e61046936600461361b565b610ad0565b6040519081526020015b60405180910390f35b60025461046e565b61049c610497366004613638565b610afe565b6040519015158152602001610478565b6104b4610b95565b604051610478919061369e565b61046e6104cf36600461361b565b60166020526000908152604090205481565b61046e6104ef3660046136ef565b610c23565b61049c610502366004613708565b610c51565b61046e6105153660046136ef565b610cca565b425b60405167ffffffffffffffff9091168152602001610478565b61051c7f000000000000000000000000000000000000000000000000000000000000000081565b61046e61056a36600461361b565b610ceb565b610577610d0a565b005b61046e60025481565b61046e61059036600461361b565b600b6020526000908152604090205481565b610577610d9a565b61049c6105b8366004613734565b610da2565b61046e6105cb3660046136ef565b60009081526010602052604090206001015490565b6105776105ee36600461361b565b610e4b565b610577610601366004613775565b61102b565b61062d7f000000000000000000000000000000000000000000000000000000000000000081565b60405160ff9091168152602001610478565b61046e611055565b610577610655366004613775565b6110b0565b6106817f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610478565b61046e6106b436600461361b565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90565b61046e60145481565b61046e6106f03660046136ef565b611168565b61057761070336600461361b565b611173565b600f546106819073ffffffffffffffffffffffffffffffffffffffff1681565b61049c61073636600461361b565b60176020526000908152604090205460ff1681565b61046e610759366004613775565b611363565b61046e61076c36600461361b565b60036020526000908152604090205481565b61046e60125481565b61046e61079536600461361b565b60056020526000908152604090205481565b61051c611436565b61046e6107bd36600461361b565b61147a565b60075461051c9067ffffffffffffffff1681565b61046e6107e436600461361b565b60156020526000908152604090205481565b61049c610804366004613775565b600091825260106020908152604080842073ffffffffffffffffffffffffffffffffffffffff93909316845291905290205460ff1690565b61046e61084a366004613775565b611485565b6104b4611558565b61046e7f85faced7bde13e1a7dad704b895f006e704f207617d68166b31ba2d79624862d81565b61046e600081565b61046e611565565b61046e60095481565b61049c6108a5366004613708565b611625565b61046e6116af565b61046e6108c03660046136ef565b6116ba565b61046e6108d33660046137a5565b6116da565b61046e6108e63660046137a5565b6118bf565b61046e6108f93660046136ef565b611b0e565b61046e61090c36600461361b565b600a6020526000908152604090205481565b60115461051c9067ffffffffffffffff1681565b61046e611b2f565b61046e61094836600461361b565b611b3c565b61046e61095b36600461361b565b600d6020526000908152604090205481565b61057761097b3660046137e7565b611b6b565b61057761098e366004613775565b611e8a565b61046e6109a136600461361b565b600c6020526000908152604090205481565b61046e6109c136600461361b565b73ffffffffffffffffffffffffffffffffffffffff1660009081526003602052604090205490565b61046e6109f736600461385e565b600460209081526000928352604080842090915290825290205481565b61046e60135481565b61051c610a2b36600461361b565b600e6020526000908152604090205467ffffffffffffffff1681565b60115461051c9068010000000000000000900467ffffffffffffffff1681565b61046e610a7536600461361b565b611eaf565b61046e610a883660046136ef565b611fd0565b610577610a9b36600461361b565b611fdb565b6106817f000000000000000000000000000000000000000000000000000000000000000081565b61046e60085481565b6000610af882610af3610ae1611436565b67ffffffffffffffff1660125461210b565b612173565b92915050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b000000000000000000000000000000000000000000000000000000001480610af857507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000831614610af8565b60008054610ba29061388c565b80601f0160208091040260200160405190810160405280929190818152602001828054610bce9061388c565b8015610c1b5780601f10610bf057610100808354040283529160200191610c1b565b820191906000526020600020905b815481529060010190602001808311610bfe57829003601f168201915b505050505081565b6002546000908015610c4857610c43610c3b60025490565b849083612212565b610c4a565b825b9392505050565b33600081815260046020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716808552925280832085905551919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92590610cb99086815260200190565b60405180910390a350600192915050565b6002546000908015610c4857610c4381610ce360025490565b85919061224e565b6000610af882610d05425b67ffffffffffffffff16612292565b6122d9565b610d1261235c565b6000610d1d336123cf565b336000818152600d6020526040812055600f54919250610d5791839173ffffffffffffffffffffffffffffffffffffffff909116906116da565b5060405181815233907fc75e95ca1d8e8b97e6452ce2acc93a4f8f9f5779fbced06e43809b0d4e4e3ce49060200160405180910390a250610d986001600655565b565b610d98612474565b6000610dad846126f0565b73ffffffffffffffffffffffffffffffffffffffff84166000908152600d602052604090205415610e0a576040517fd4750cf000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610e1384612765565b610e1c83612765565b610e258461280a565b610e2e8361280a565b610e3882856128a1565b610e438484846129af565b949350505050565b3360009081527f6e0956cda88cad152e89927e53611735b61a5c762d1428573c6931b0a5efcb01602052604090205460ff16610eb3576040517f06d919f200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff166338d52e0f6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610f35573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f5991906138df565b73ffffffffffffffffffffffffffffffffffffffff1614610fa6576040517fca3fa38a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff811660008181526017602090815260409182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905590519182527f7b7ef7a864d96a85497a1ed846adb39940dd6ccef678ff6ac8d55505e09b8cc4910160405180910390a150565b60008281526010602052604090206001015461104681612af3565b6110508383612afd565b505050565b60007f0000000000000000000000000000000000000000000000000000000000000000461461108b57611086612bf1565b905090565b507f000000000000000000000000000000000000000000000000000000000000000090565b73ffffffffffffffffffffffffffffffffffffffff8116331461115a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c66000000000000000000000000000000000060648201526084015b60405180910390fd5b6111648282612c8b565b5050565b6000610af882610c23565b3360009081527f239c3fe8b58e4fe4cc63523894dcf08f1899f5df270fd0d6ded76c5e120f355e602052604090205460ff166111db576040517f4a34727000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff811660009081526017602052604090205460ff1661123a576040517f35ba7b3700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff82169063ba0876529082906370a0823190602401602060405180830381865afa1580156112ac573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112d091906138fc565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e084901b1681526004810191909152306024820181905260448201526064016020604051808303816000875af1158015611333573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061135791906138fc565b50611360612474565b50565b600073ffffffffffffffffffffffffffffffffffffffff821633146113b4576040517fe4001d8f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6113bd826126f0565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600d60205260409020541561141a576040517fd4750cf000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61142382612765565b61142c8261280a565b610c4a8383612d46565b60115460009068010000000000000000900467ffffffffffffffff164210611475575060115468010000000000000000900467ffffffffffffffff1690565b504290565b6000610af8826123cf565b600073ffffffffffffffffffffffffffffffffffffffff821633146114d6576040517fe4001d8f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6114df826126f0565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600d60205260409020541561153c576040517fd4750cf000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61154582612765565b61154e8261280a565b610c4a8383612e66565b60018054610ba29061388c565b600061156f61235c565b61157833612765565b6115813361280a565b50336000908152600c6020526040902054801561161857336000908152600c60209081526040808320839055600b909152812080548392906115c4908490613944565b9250508190555080600960008282546115dd9190613944565b909155505060405181815233907f5201cdd751de1a2551f5d316ffc7159afee8b5775ba451a133a1d8c02b3f10679060200160405180910390a25b6116226001600655565b90565b6000611630336126f0565b336000908152600d602052604090205415611677576040517fd4750cf000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61168033612765565b61168983612765565b6116923361280a565b61169b8361280a565b6116a582336128a1565b610c4a8383612f1c565b600061108642610cf6565b6002546000908015610c4857610c436116d260025490565b84908361224e565b60006116e584610cca565b90503373ffffffffffffffffffffffffffffffffffffffff83161461179a5773ffffffffffffffffffffffffffffffffffffffff821660009081526004602090815260408083203384529091529020547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8114611798576117668282613957565b73ffffffffffffffffffffffffffffffffffffffff841660009081526004602090815260408083203384529091529020555b505b6117a3826126f0565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600d602052604090205415611800576040517fd4750cf000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61180982612765565b6118128261280a565b61181c84836128a1565b6118268282612fa1565b604080518581526020810183905273ffffffffffffffffffffffffffffffffffffffff808516929086169133917ffbde797d201c681b91056529119e0b02407c7bb96a4a2c75c01fc9667232c8db910160405180910390a4610c4a73ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168486613037565b60003373ffffffffffffffffffffffffffffffffffffffff8316146119745773ffffffffffffffffffffffffffffffffffffffff821660009081526004602090815260408083203384529091529020547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8114611972576119408582613957565b73ffffffffffffffffffffffffffffffffffffffff841660009081526004602090815260408083203384529091529020555b505b61197d84611168565b9050806000036119e9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600b60248201527f5a45524f5f4153534554530000000000000000000000000000000000000000006044820152606401611151565b6119f2826126f0565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600d602052604090205415611a4f576040517fd4750cf000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611a5882612765565b611a618261280a565b611a6b81836128a1565b611a758285612fa1565b604080518281526020810186905273ffffffffffffffffffffffffffffffffffffffff808516929086169133917ffbde797d201c681b91056529119e0b02407c7bb96a4a2c75c01fc9667232c8db910160405180910390a4610c4a73ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168483613037565b6002546000908015610c4857610c4381611b2760025490565b859190612212565b6000611086610ae1611436565b73ffffffffffffffffffffffffffffffffffffffff8116600090815260036020526040812054610af890610c23565b42841015611bd5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f5045524d49545f444541444c494e455f455850495245440000000000000000006044820152606401611151565b60006001611be1611055565b73ffffffffffffffffffffffffffffffffffffffff8a811660008181526005602090815260409182902080546001810190915582517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98184015280840194909452938d166060840152608083018c905260a083019390935260c08083018b90528151808403909101815260e0830190915280519201919091207f190100000000000000000000000000000000000000000000000000000000000061010083015261010282019290925261012281019190915261014201604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181528282528051602091820120600084529083018083525260ff871690820152606081018590526080810184905260a0016020604051602081039080840390855afa158015611d33573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff811615801590611dae57508773ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b611e14576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f494e56414c49445f5349474e45520000000000000000000000000000000000006044820152606401611151565b73ffffffffffffffffffffffffffffffffffffffff90811660009081526004602090815260408083208a8516808552908352928190208990555188815291928a16917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a350505050505050565b600082815260106020526040902060010154611ea581612af3565b6110508383612c8b565b6000611eb961235c565b611ec282612765565b5073ffffffffffffffffffffffffffffffffffffffff81166000908152601660205260409020548015611fc15773ffffffffffffffffffffffffffffffffffffffff8216600090815260166020526040812081905560148054839290611f29908490613957565b90915550611f70905073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000168383613037565b8173ffffffffffffffffffffffffffffffffffffffff167fe2403640ba68fed3a2f88b7557551d1993f84b99bb10ff833f0cf8db0c5e048682604051611fb891815260200190565b60405180910390a25b611fcb6001600655565b919050565b6000610af882611b0e565b3360009081527f6e0956cda88cad152e89927e53611735b61a5c762d1428573c6931b0a5efcb01602052604090205460ff16612043576040517f06d919f200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8116612090576040517f91f7acdb00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600f80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff831690811790915560405190815233907f4ab5be82436d353e61ca18726e984e561f5c1cc7c6d38b29d2553c790434705a9060200160405180910390a250565b60008060095460025461211e9190613944565b905080600003612132575050601354610af8565b601154612166906c0c9f2c9cd04674edea400000009061215c9067ffffffffffffffff1687613957565b610c3b919061396a565b601354610e439190613944565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600b6020908152604080832054600390925282205482916121af91613944565b73ffffffffffffffffffffffffffffffffffffffff851660009081526016602090815260408083205460159092529091205491925090612208906121f39086613957565b83906c0c9f2c9cd04674edea40000000612212565b610e439190613944565b6000827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048411830215820261224757600080fd5b5091020490565b6000827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048411830215820261228357600080fd5b50910281810615159190040190565b6007546000906122cc906c0c9f2c9cd04674edea40000000906301e13380906122c59067ffffffffffffffff1686613957565b9190612212565b600854610af89190613944565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600c6020908152604080832054600a909252822054612352906123189085613957565b73ffffffffffffffffffffffffffffffffffffffff8616600090815260036020526040902054906c0c9f2c9cd04674edea40000000612212565b610c4a9190613944565b6002600654036123c8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401611151565b6002600655565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600e6020526040812054429067ffffffffffffffff9081169083906124139083908516613957565b73ffffffffffffffffffffffffffffffffffffffff86166000908152600d602052604090205490915062278d0082106124525750600095945050505050565b612460818362278d00612212565b61246a9082613957565b9695505050505050565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526000907f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16906370a0823190602401602060405180830381865afa158015612501573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061252591906138fc565b601454909150808203612536575050565b60125460115468010000000000000000900467ffffffffffffffff16600061255c611436565b90507f000000000000000000000000000000000000000000000000000000000000000061259367ffffffffffffffff83168561210b565b60135560006125a28688613957565b60148890559050600067ffffffffffffffff851642106125d7576125d067ffffffffffffffff841683613981565b9050612621565b60006125ed4267ffffffffffffffff8816613957565b905060006125fb888361396a565b905067ffffffffffffffff85166126128286613944565b61261c9190613981565b925050505b6012819055601180547fffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000164267ffffffffffffffff8181169290921790925561266d9190851690613944565b6011805467ffffffffffffffff9290921668010000000000000000027fffffffffffffffffffffffffffffffff0000000000000000ffffffffffffffff9092169190911790556040518281527fde88a922e0d3b88b24e9623efeb464919c6bf9f66857a65e2bfcf2ce87a9433d9060200160405180910390a15050505050505050565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600e6020526040902054429067ffffffffffffffff9081169062278d00906127379083908516613957565b1061105057505073ffffffffffffffffffffffffffffffffffffffff166000908152600d6020526040812055565b600061276f611436565b905060006127898267ffffffffffffffff1660125461210b565b6013819055601180547fffffffffffffffffffffffffffffffffffffffffffffffff00000000000000001667ffffffffffffffff851617905590506127ce8382612173565b73ffffffffffffffffffffffffffffffffffffffff90931660009081526016602090815260408083209590955560159052929092209190915550565b42600061282067ffffffffffffffff8316612292565b6008819055600780547fffffffffffffffffffffffffffffffffffffffffffffffff00000000000000001667ffffffffffffffff8516179055905061286583826122d9565b73ffffffffffffffffffffffffffffffffffffffff9093166000908152600c6020908152604080832095909555600a9052929092209190915550565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600b6020526040812054908190036128d457505050565b73ffffffffffffffffffffffffffffffffffffffff8216600090815260036020526040902054612905828583612212565b73ffffffffffffffffffffffffffffffffffffffff84166000908152600b602052604081208054929450849290919061293f908490613957565b9250508190555081600960008282546129589190613957565b909155505060405182815273ffffffffffffffffffffffffffffffffffffffff8416907fc60aa211d0832f71c303dea82dc68c935d6a5a9592ba032fe3c0e997dbcfa306906020015b60405180910390a250505050565b73ffffffffffffffffffffffffffffffffffffffff831660009081526004602090815260408083203384529091528120547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8114612a4357612a118382613957565b73ffffffffffffffffffffffffffffffffffffffff861660009081526004602090815260408083203384529091529020555b73ffffffffffffffffffffffffffffffffffffffff851660009081526003602052604081208054859290612a78908490613957565b909155505073ffffffffffffffffffffffffffffffffffffffff808516600081815260036020526040908190208054870190555190918716907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90612ae09087815260200190565b60405180910390a3506001949350505050565b61136081336130f6565b600082815260106020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff1661116457600082815260106020908152604080832073ffffffffffffffffffffffffffffffffffffffff85168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055612b933390565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6000604051612c2391906139bc565b6040805191829003822060208301939093528101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260c00160405160208183030381529060405280519060200120905090565b600082815260106020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff161561116457600082815260106020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6000612d5183611fd0565b905080600003612dbd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600b60248201527f5a45524f5f5348415245530000000000000000000000000000000000000000006044820152606401611151565b612dff73ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000163330866131b0565b612e098282613276565b604080518481526020810183905273ffffffffffffffffffffffffffffffffffffffff84169133917fdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d7910160405180910390a3610af883826132e7565b6000612e71836116ba565b9050612eb573ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000163330846131b0565b612ebf8284613276565b604080518281526020810185905273ffffffffffffffffffffffffffffffffffffffff84169133917fdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d7910160405180910390a3610af881846132e7565b33600090815260036020526040812080548391908390612f3d908490613957565b909155505073ffffffffffffffffffffffffffffffffffffffff8316600081815260036020526040908190208054850190555133907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90610cb99086815260200190565b73ffffffffffffffffffffffffffffffffffffffff821660009081526003602052604081208054839290612fd6908490613957565b909155505060028054829003905560405181815260009073ffffffffffffffffffffffffffffffffffffffff8416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906020015b60405180910390a35050565b60006040517fa9059cbb000000000000000000000000000000000000000000000000000000008152836004820152826024820152602060006044836000895af13d15601f3d11600160005114161716915050806130f0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f5452414e534645525f4641494c454400000000000000000000000000000000006044820152606401611151565b50505050565b600082815260106020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff166111645761313681613382565b6131418360206133a1565b604051602001613152929190613a92565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152908290527f08c379a00000000000000000000000000000000000000000000000000000000082526111519160040161369e565b60006040517f23b872dd0000000000000000000000000000000000000000000000000000000081528460048201528360248201528260448201526020600060648360008a5af13d15601f3d116001600051141617169150508061326f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f5452414e534645525f46524f4d5f4641494c45440000000000000000000000006044820152606401611151565b5050505050565b80600260008282546132889190613944565b909155505073ffffffffffffffffffffffffffffffffffffffff82166000818152600360209081526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910161302b565b60006132fb8367016345785d8a00006135e4565b336000818152600d60209081526040808320859055600e82529182902080547fffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000164267ffffffffffffffff81169182179092558351868152928301529394507fd8a6c6dd0e19decdc18562548eef77e02983d82f6ce7adea3e43f440033d445b91016129a1565b6060610af873ffffffffffffffffffffffffffffffffffffffff831660145b606060006133b083600261396a565b6133bb906002613944565b67ffffffffffffffff8111156133d3576133d3613b13565b6040519080825280601f01601f1916602001820160405280156133fd576020820181803683370190505b5090507f30000000000000000000000000000000000000000000000000000000000000008160008151811061343457613434613b42565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f78000000000000000000000000000000000000000000000000000000000000008160018151811061349757613497613b42565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060006134d384600261396a565b6134de906001613944565b90505b600181111561357b577f303132333435363738396162636465660000000000000000000000000000000085600f166010811061351f5761351f613b42565b1a60f81b82828151811061353557613535613b42565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060049490941c9361357481613b71565b90506134e1565b508315610c4a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401611151565b6000610c4a8383670de0b6b3a7640000612212565b73ffffffffffffffffffffffffffffffffffffffff8116811461136057600080fd5b60006020828403121561362d57600080fd5b8135610c4a816135f9565b60006020828403121561364a57600080fd5b81357fffffffff0000000000000000000000000000000000000000000000000000000081168114610c4a57600080fd5b60005b8381101561369557818101518382015260200161367d565b50506000910152565b60208152600082518060208401526136bd81604085016020870161367a565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b60006020828403121561370157600080fd5b5035919050565b6000806040838503121561371b57600080fd5b8235613726816135f9565b946020939093013593505050565b60008060006060848603121561374957600080fd5b8335613754816135f9565b92506020840135613764816135f9565b929592945050506040919091013590565b6000806040838503121561378857600080fd5b82359150602083013561379a816135f9565b809150509250929050565b6000806000606084860312156137ba57600080fd5b8335925060208401356137cc816135f9565b915060408401356137dc816135f9565b809150509250925092565b600080600080600080600060e0888a03121561380257600080fd5b873561380d816135f9565b9650602088013561381d816135f9565b95506040880135945060608801359350608088013560ff8116811461384157600080fd5b9699959850939692959460a0840135945060c09093013592915050565b6000806040838503121561387157600080fd5b823561387c816135f9565b9150602083013561379a816135f9565b600181811c908216806138a057607f821691505b6020821081036138d9577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b6000602082840312156138f157600080fd5b8151610c4a816135f9565b60006020828403121561390e57600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b80820180821115610af857610af8613915565b81810381811115610af857610af8613915565b8082028115828204841417610af857610af8613915565b6000826139b7577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b600080835481600182811c9150808316806139d857607f831692505b60208084108203613a10577f4e487b710000000000000000000000000000000000000000000000000000000086526022600452602486fd5b818015613a245760018114613a5757613a84565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0086168952841515850289019650613a84565b60008a81526020902060005b86811015613a7c5781548b820152908501908301613a63565b505084890196505b509498975050505050505050565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351613aca81601785016020880161367a565b7f206973206d697373696e6720726f6c65200000000000000000000000000000006017918401918201528351613b0781602884016020880161367a565b01602801949350505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600081613b8057613b80613915565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff019056fea26469706673582212207180a0ef52584d5d928282a8c9454c6fd1d1fd14be620bb47b91ecbb63bb82ab64736f6c6343000815003300000000000000000000000084f67f75daf6d57aef500e0c85c77b7b3bbc92a90000000000000000000000006cf38285fdfaf8d67205ca444a899025b5b18e83000000000000000000000000ba8a621b4a54e61c442f5ec623687e2a942225ef00000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000120000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000000000000000000000000000000000000000278d00000000000000000000000000000000000000000000000000000000000000000d5374616b65642051756172747a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000077351756172747a00000000000000000000000000000000000000000000000000

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106104565760003560e01c80638706827d11610250578063c7e5c8c811610150578063dd62ed3e116100c8578063ef5cfb8c11610097578063f0f442601161007c578063f0f4426014610a8d578063f7c618c114610aa0578063fc95243c14610ac757600080fd5b8063ef5cfb8c14610a67578063ef8b30f714610a7a57600080fd5b8063dd62ed3e146109e9578063df136d6514610a14578063e34ddc3914610a1d578063ebe2b12b14610a4757600080fd5b8063d283e75f1161011f578063d547741f11610104578063d547741f14610980578063d8cb4aa314610993578063d905777e146109b357600080fd5b8063d283e75f1461094d578063d505accf1461096d57600080fd5b8063c7e5c8c8146108fe578063c8f33c911461091e578063cd3daf9d14610932578063ce96cb771461093a57600080fd5b8063a66f42c0116101e3578063b3d7f6b9116101b2578063ba08765211610197578063ba087652146108d8578063c63d75b6146106a6578063c6e6f592146108eb57600080fd5b8063b3d7f6b9146108b2578063b460af94146108c557600080fd5b8063a66f42c014610886578063a8dd07dc1461088e578063a9059cbb14610897578063abb8cd16146108aa57600080fd5b806394bf804d1161021f57806394bf804d1461083c57806395d89b411461084f5780639c26149f14610857578063a217fddf1461087e57600080fd5b80638706827d146107af5780638a46699a146107c25780638b876347146107d657806391d14854146107f657600080fd5b8063256b5a021161035b5780634cdad506116102ee5780636e553f65116102bd5780637b0a47ee116102a25780637b0a47ee1461077e5780637ecebe001461078757806380faa57d146107a757600080fd5b80636e553f651461074b57806370a082311461075e57600080fd5b80634cdad506146106e25780634e064e25146106f557806361d027b314610708578063652b9b411461072857600080fd5b806336568abe1161032a57806336568abe1461064757806338d52e0f1461065a578063402d267d146106a6578063468e8365146106d957600080fd5b8063256b5a02146105e05780632f2ff15d146105f3578063313ce567146106065780633644e5151461063f57600080fd5b80630e40dc8d116103ee57806318160ddd116103bd5780632392f692116103a25780632392f692146105a257806323b872dd146105aa578063248a9ca3146105bd57600080fd5b806318160ddd1461057957806322957c8e1461058257600080fd5b80630e40dc8d1461051a5780630fb5a6b4146105355780631283e3281461055c57806312ee50571461056f57600080fd5b80630700037d1161042a5780630700037d146104c157806307a2d13a146104e1578063095ea7b3146104f45780630a28a4771461050757600080fd5b80628cc2621461045b57806301e1d1141461048157806301ffc9a71461048957806306fdde03146104ac575b600080fd5b61046e61046936600461361b565b610ad0565b6040519081526020015b60405180910390f35b60025461046e565b61049c610497366004613638565b610afe565b6040519015158152602001610478565b6104b4610b95565b604051610478919061369e565b61046e6104cf36600461361b565b60166020526000908152604090205481565b61046e6104ef3660046136ef565b610c23565b61049c610502366004613708565b610c51565b61046e6105153660046136ef565b610cca565b425b60405167ffffffffffffffff9091168152602001610478565b61051c7f0000000000000000000000000000000000000000000000000000000000278d0081565b61046e61056a36600461361b565b610ceb565b610577610d0a565b005b61046e60025481565b61046e61059036600461361b565b600b6020526000908152604090205481565b610577610d9a565b61049c6105b8366004613734565b610da2565b61046e6105cb3660046136ef565b60009081526010602052604090206001015490565b6105776105ee36600461361b565b610e4b565b610577610601366004613775565b61102b565b61062d7f000000000000000000000000000000000000000000000000000000000000001281565b60405160ff9091168152602001610478565b61046e611055565b610577610655366004613775565b6110b0565b6106817f000000000000000000000000ba8a621b4a54e61c442f5ec623687e2a942225ef81565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610478565b61046e6106b436600461361b565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90565b61046e60145481565b61046e6106f03660046136ef565b611168565b61057761070336600461361b565b611173565b600f546106819073ffffffffffffffffffffffffffffffffffffffff1681565b61049c61073636600461361b565b60176020526000908152604090205460ff1681565b61046e610759366004613775565b611363565b61046e61076c36600461361b565b60036020526000908152604090205481565b61046e60125481565b61046e61079536600461361b565b60056020526000908152604090205481565b61051c611436565b61046e6107bd36600461361b565b61147a565b60075461051c9067ffffffffffffffff1681565b61046e6107e436600461361b565b60156020526000908152604090205481565b61049c610804366004613775565b600091825260106020908152604080842073ffffffffffffffffffffffffffffffffffffffff93909316845291905290205460ff1690565b61046e61084a366004613775565b611485565b6104b4611558565b61046e7f85faced7bde13e1a7dad704b895f006e704f207617d68166b31ba2d79624862d81565b61046e600081565b61046e611565565b61046e60095481565b61049c6108a5366004613708565b611625565b61046e6116af565b61046e6108c03660046136ef565b6116ba565b61046e6108d33660046137a5565b6116da565b61046e6108e63660046137a5565b6118bf565b61046e6108f93660046136ef565b611b0e565b61046e61090c36600461361b565b600a6020526000908152604090205481565b60115461051c9067ffffffffffffffff1681565b61046e611b2f565b61046e61094836600461361b565b611b3c565b61046e61095b36600461361b565b600d6020526000908152604090205481565b61057761097b3660046137e7565b611b6b565b61057761098e366004613775565b611e8a565b61046e6109a136600461361b565b600c6020526000908152604090205481565b61046e6109c136600461361b565b73ffffffffffffffffffffffffffffffffffffffff1660009081526003602052604090205490565b61046e6109f736600461385e565b600460209081526000928352604080842090915290825290205481565b61046e60135481565b61051c610a2b36600461361b565b600e6020526000908152604090205467ffffffffffffffff1681565b60115461051c9068010000000000000000900467ffffffffffffffff1681565b61046e610a7536600461361b565b611eaf565b61046e610a883660046136ef565b611fd0565b610577610a9b36600461361b565b611fdb565b6106817f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281565b61046e60085481565b6000610af882610af3610ae1611436565b67ffffffffffffffff1660125461210b565b612173565b92915050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b000000000000000000000000000000000000000000000000000000001480610af857507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff00000000000000000000000000000000000000000000000000000000831614610af8565b60008054610ba29061388c565b80601f0160208091040260200160405190810160405280929190818152602001828054610bce9061388c565b8015610c1b5780601f10610bf057610100808354040283529160200191610c1b565b820191906000526020600020905b815481529060010190602001808311610bfe57829003601f168201915b505050505081565b6002546000908015610c4857610c43610c3b60025490565b849083612212565b610c4a565b825b9392505050565b33600081815260046020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716808552925280832085905551919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92590610cb99086815260200190565b60405180910390a350600192915050565b6002546000908015610c4857610c4381610ce360025490565b85919061224e565b6000610af882610d05425b67ffffffffffffffff16612292565b6122d9565b610d1261235c565b6000610d1d336123cf565b336000818152600d6020526040812055600f54919250610d5791839173ffffffffffffffffffffffffffffffffffffffff909116906116da565b5060405181815233907fc75e95ca1d8e8b97e6452ce2acc93a4f8f9f5779fbced06e43809b0d4e4e3ce49060200160405180910390a250610d986001600655565b565b610d98612474565b6000610dad846126f0565b73ffffffffffffffffffffffffffffffffffffffff84166000908152600d602052604090205415610e0a576040517fd4750cf000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610e1384612765565b610e1c83612765565b610e258461280a565b610e2e8361280a565b610e3882856128a1565b610e438484846129af565b949350505050565b3360009081527f6e0956cda88cad152e89927e53611735b61a5c762d1428573c6931b0a5efcb01602052604090205460ff16610eb3576040517f06d919f200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc273ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff166338d52e0f6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610f35573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f5991906138df565b73ffffffffffffffffffffffffffffffffffffffff1614610fa6576040517fca3fa38a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff811660008181526017602090815260409182902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905590519182527f7b7ef7a864d96a85497a1ed846adb39940dd6ccef678ff6ac8d55505e09b8cc4910160405180910390a150565b60008281526010602052604090206001015461104681612af3565b6110508383612afd565b505050565b60007f0000000000000000000000000000000000000000000000000000000000000001461461108b57611086612bf1565b905090565b507f7c2e765b523a73f41f6931773f1f46d3ddd98043b655f90a9df8ee48fe8aec2190565b73ffffffffffffffffffffffffffffffffffffffff8116331461115a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c66000000000000000000000000000000000060648201526084015b60405180910390fd5b6111648282612c8b565b5050565b6000610af882610c23565b3360009081527f239c3fe8b58e4fe4cc63523894dcf08f1899f5df270fd0d6ded76c5e120f355e602052604090205460ff166111db576040517f4a34727000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff811660009081526017602052604090205460ff1661123a576040517f35ba7b3700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff82169063ba0876529082906370a0823190602401602060405180830381865afa1580156112ac573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112d091906138fc565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e084901b1681526004810191909152306024820181905260448201526064016020604051808303816000875af1158015611333573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061135791906138fc565b50611360612474565b50565b600073ffffffffffffffffffffffffffffffffffffffff821633146113b4576040517fe4001d8f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6113bd826126f0565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600d60205260409020541561141a576040517fd4750cf000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61142382612765565b61142c8261280a565b610c4a8383612d46565b60115460009068010000000000000000900467ffffffffffffffff164210611475575060115468010000000000000000900467ffffffffffffffff1690565b504290565b6000610af8826123cf565b600073ffffffffffffffffffffffffffffffffffffffff821633146114d6576040517fe4001d8f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6114df826126f0565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600d60205260409020541561153c576040517fd4750cf000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61154582612765565b61154e8261280a565b610c4a8383612e66565b60018054610ba29061388c565b600061156f61235c565b61157833612765565b6115813361280a565b50336000908152600c6020526040902054801561161857336000908152600c60209081526040808320839055600b909152812080548392906115c4908490613944565b9250508190555080600960008282546115dd9190613944565b909155505060405181815233907f5201cdd751de1a2551f5d316ffc7159afee8b5775ba451a133a1d8c02b3f10679060200160405180910390a25b6116226001600655565b90565b6000611630336126f0565b336000908152600d602052604090205415611677576040517fd4750cf000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61168033612765565b61168983612765565b6116923361280a565b61169b8361280a565b6116a582336128a1565b610c4a8383612f1c565b600061108642610cf6565b6002546000908015610c4857610c436116d260025490565b84908361224e565b60006116e584610cca565b90503373ffffffffffffffffffffffffffffffffffffffff83161461179a5773ffffffffffffffffffffffffffffffffffffffff821660009081526004602090815260408083203384529091529020547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8114611798576117668282613957565b73ffffffffffffffffffffffffffffffffffffffff841660009081526004602090815260408083203384529091529020555b505b6117a3826126f0565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600d602052604090205415611800576040517fd4750cf000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61180982612765565b6118128261280a565b61181c84836128a1565b6118268282612fa1565b604080518581526020810183905273ffffffffffffffffffffffffffffffffffffffff808516929086169133917ffbde797d201c681b91056529119e0b02407c7bb96a4a2c75c01fc9667232c8db910160405180910390a4610c4a73ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000ba8a621b4a54e61c442f5ec623687e2a942225ef168486613037565b60003373ffffffffffffffffffffffffffffffffffffffff8316146119745773ffffffffffffffffffffffffffffffffffffffff821660009081526004602090815260408083203384529091529020547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8114611972576119408582613957565b73ffffffffffffffffffffffffffffffffffffffff841660009081526004602090815260408083203384529091529020555b505b61197d84611168565b9050806000036119e9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600b60248201527f5a45524f5f4153534554530000000000000000000000000000000000000000006044820152606401611151565b6119f2826126f0565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600d602052604090205415611a4f576040517fd4750cf000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611a5882612765565b611a618261280a565b611a6b81836128a1565b611a758285612fa1565b604080518281526020810186905273ffffffffffffffffffffffffffffffffffffffff808516929086169133917ffbde797d201c681b91056529119e0b02407c7bb96a4a2c75c01fc9667232c8db910160405180910390a4610c4a73ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000ba8a621b4a54e61c442f5ec623687e2a942225ef168483613037565b6002546000908015610c4857610c4381611b2760025490565b859190612212565b6000611086610ae1611436565b73ffffffffffffffffffffffffffffffffffffffff8116600090815260036020526040812054610af890610c23565b42841015611bd5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f5045524d49545f444541444c494e455f455850495245440000000000000000006044820152606401611151565b60006001611be1611055565b73ffffffffffffffffffffffffffffffffffffffff8a811660008181526005602090815260409182902080546001810190915582517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98184015280840194909452938d166060840152608083018c905260a083019390935260c08083018b90528151808403909101815260e0830190915280519201919091207f190100000000000000000000000000000000000000000000000000000000000061010083015261010282019290925261012281019190915261014201604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181528282528051602091820120600084529083018083525260ff871690820152606081018590526080810184905260a0016020604051602081039080840390855afa158015611d33573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff811615801590611dae57508773ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16145b611e14576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f494e56414c49445f5349474e45520000000000000000000000000000000000006044820152606401611151565b73ffffffffffffffffffffffffffffffffffffffff90811660009081526004602090815260408083208a8516808552908352928190208990555188815291928a16917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a350505050505050565b600082815260106020526040902060010154611ea581612af3565b6110508383612c8b565b6000611eb961235c565b611ec282612765565b5073ffffffffffffffffffffffffffffffffffffffff81166000908152601660205260409020548015611fc15773ffffffffffffffffffffffffffffffffffffffff8216600090815260166020526040812081905560148054839290611f29908490613957565b90915550611f70905073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2168383613037565b8173ffffffffffffffffffffffffffffffffffffffff167fe2403640ba68fed3a2f88b7557551d1993f84b99bb10ff833f0cf8db0c5e048682604051611fb891815260200190565b60405180910390a25b611fcb6001600655565b919050565b6000610af882611b0e565b3360009081527f6e0956cda88cad152e89927e53611735b61a5c762d1428573c6931b0a5efcb01602052604090205460ff16612043576040517f06d919f200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8116612090576040517f91f7acdb00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600f80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff831690811790915560405190815233907f4ab5be82436d353e61ca18726e984e561f5c1cc7c6d38b29d2553c790434705a9060200160405180910390a250565b60008060095460025461211e9190613944565b905080600003612132575050601354610af8565b601154612166906c0c9f2c9cd04674edea400000009061215c9067ffffffffffffffff1687613957565b610c3b919061396a565b601354610e439190613944565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600b6020908152604080832054600390925282205482916121af91613944565b73ffffffffffffffffffffffffffffffffffffffff851660009081526016602090815260408083205460159092529091205491925090612208906121f39086613957565b83906c0c9f2c9cd04674edea40000000612212565b610e439190613944565b6000827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048411830215820261224757600080fd5b5091020490565b6000827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048411830215820261228357600080fd5b50910281810615159190040190565b6007546000906122cc906c0c9f2c9cd04674edea40000000906301e13380906122c59067ffffffffffffffff1686613957565b9190612212565b600854610af89190613944565b73ffffffffffffffffffffffffffffffffffffffff82166000908152600c6020908152604080832054600a909252822054612352906123189085613957565b73ffffffffffffffffffffffffffffffffffffffff8616600090815260036020526040902054906c0c9f2c9cd04674edea40000000612212565b610c4a9190613944565b6002600654036123c8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401611151565b6002600655565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600e6020526040812054429067ffffffffffffffff9081169083906124139083908516613957565b73ffffffffffffffffffffffffffffffffffffffff86166000908152600d602052604090205490915062278d0082106124525750600095945050505050565b612460818362278d00612212565b61246a9082613957565b9695505050505050565b6040517f70a082310000000000000000000000000000000000000000000000000000000081523060048201526000907f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc273ffffffffffffffffffffffffffffffffffffffff16906370a0823190602401602060405180830381865afa158015612501573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061252591906138fc565b601454909150808203612536575050565b60125460115468010000000000000000900467ffffffffffffffff16600061255c611436565b90507f0000000000000000000000000000000000000000000000000000000000278d0061259367ffffffffffffffff83168561210b565b60135560006125a28688613957565b60148890559050600067ffffffffffffffff851642106125d7576125d067ffffffffffffffff841683613981565b9050612621565b60006125ed4267ffffffffffffffff8816613957565b905060006125fb888361396a565b905067ffffffffffffffff85166126128286613944565b61261c9190613981565b925050505b6012819055601180547fffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000164267ffffffffffffffff8181169290921790925561266d9190851690613944565b6011805467ffffffffffffffff9290921668010000000000000000027fffffffffffffffffffffffffffffffff0000000000000000ffffffffffffffff9092169190911790556040518281527fde88a922e0d3b88b24e9623efeb464919c6bf9f66857a65e2bfcf2ce87a9433d9060200160405180910390a15050505050505050565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600e6020526040902054429067ffffffffffffffff9081169062278d00906127379083908516613957565b1061105057505073ffffffffffffffffffffffffffffffffffffffff166000908152600d6020526040812055565b600061276f611436565b905060006127898267ffffffffffffffff1660125461210b565b6013819055601180547fffffffffffffffffffffffffffffffffffffffffffffffff00000000000000001667ffffffffffffffff851617905590506127ce8382612173565b73ffffffffffffffffffffffffffffffffffffffff90931660009081526016602090815260408083209590955560159052929092209190915550565b42600061282067ffffffffffffffff8316612292565b6008819055600780547fffffffffffffffffffffffffffffffffffffffffffffffff00000000000000001667ffffffffffffffff8516179055905061286583826122d9565b73ffffffffffffffffffffffffffffffffffffffff9093166000908152600c6020908152604080832095909555600a9052929092209190915550565b73ffffffffffffffffffffffffffffffffffffffff81166000908152600b6020526040812054908190036128d457505050565b73ffffffffffffffffffffffffffffffffffffffff8216600090815260036020526040902054612905828583612212565b73ffffffffffffffffffffffffffffffffffffffff84166000908152600b602052604081208054929450849290919061293f908490613957565b9250508190555081600960008282546129589190613957565b909155505060405182815273ffffffffffffffffffffffffffffffffffffffff8416907fc60aa211d0832f71c303dea82dc68c935d6a5a9592ba032fe3c0e997dbcfa306906020015b60405180910390a250505050565b73ffffffffffffffffffffffffffffffffffffffff831660009081526004602090815260408083203384529091528120547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8114612a4357612a118382613957565b73ffffffffffffffffffffffffffffffffffffffff861660009081526004602090815260408083203384529091529020555b73ffffffffffffffffffffffffffffffffffffffff851660009081526003602052604081208054859290612a78908490613957565b909155505073ffffffffffffffffffffffffffffffffffffffff808516600081815260036020526040908190208054870190555190918716907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90612ae09087815260200190565b60405180910390a3506001949350505050565b61136081336130f6565b600082815260106020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff1661116457600082815260106020908152604080832073ffffffffffffffffffffffffffffffffffffffff85168452909152902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055612b933390565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6000604051612c2391906139bc565b6040805191829003822060208301939093528101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260c00160405160208183030381529060405280519060200120905090565b600082815260106020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff161561116457600082815260106020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516808552925280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6000612d5183611fd0565b905080600003612dbd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600b60248201527f5a45524f5f5348415245530000000000000000000000000000000000000000006044820152606401611151565b612dff73ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000ba8a621b4a54e61c442f5ec623687e2a942225ef163330866131b0565b612e098282613276565b604080518481526020810183905273ffffffffffffffffffffffffffffffffffffffff84169133917fdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d7910160405180910390a3610af883826132e7565b6000612e71836116ba565b9050612eb573ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000ba8a621b4a54e61c442f5ec623687e2a942225ef163330846131b0565b612ebf8284613276565b604080518281526020810185905273ffffffffffffffffffffffffffffffffffffffff84169133917fdcbc1c05240f31ff3ad067ef1ee35ce4997762752e3a095284754544f4c709d7910160405180910390a3610af881846132e7565b33600090815260036020526040812080548391908390612f3d908490613957565b909155505073ffffffffffffffffffffffffffffffffffffffff8316600081815260036020526040908190208054850190555133907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90610cb99086815260200190565b73ffffffffffffffffffffffffffffffffffffffff821660009081526003602052604081208054839290612fd6908490613957565b909155505060028054829003905560405181815260009073ffffffffffffffffffffffffffffffffffffffff8416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906020015b60405180910390a35050565b60006040517fa9059cbb000000000000000000000000000000000000000000000000000000008152836004820152826024820152602060006044836000895af13d15601f3d11600160005114161716915050806130f0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f5452414e534645525f4641494c454400000000000000000000000000000000006044820152606401611151565b50505050565b600082815260106020908152604080832073ffffffffffffffffffffffffffffffffffffffff8516845290915290205460ff166111645761313681613382565b6131418360206133a1565b604051602001613152929190613a92565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152908290527f08c379a00000000000000000000000000000000000000000000000000000000082526111519160040161369e565b60006040517f23b872dd0000000000000000000000000000000000000000000000000000000081528460048201528360248201528260448201526020600060648360008a5af13d15601f3d116001600051141617169150508061326f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f5452414e534645525f46524f4d5f4641494c45440000000000000000000000006044820152606401611151565b5050505050565b80600260008282546132889190613944565b909155505073ffffffffffffffffffffffffffffffffffffffff82166000818152600360209081526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910161302b565b60006132fb8367016345785d8a00006135e4565b336000818152600d60209081526040808320859055600e82529182902080547fffffffffffffffffffffffffffffffffffffffffffffffff0000000000000000164267ffffffffffffffff81169182179092558351868152928301529394507fd8a6c6dd0e19decdc18562548eef77e02983d82f6ce7adea3e43f440033d445b91016129a1565b6060610af873ffffffffffffffffffffffffffffffffffffffff831660145b606060006133b083600261396a565b6133bb906002613944565b67ffffffffffffffff8111156133d3576133d3613b13565b6040519080825280601f01601f1916602001820160405280156133fd576020820181803683370190505b5090507f30000000000000000000000000000000000000000000000000000000000000008160008151811061343457613434613b42565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a9053507f78000000000000000000000000000000000000000000000000000000000000008160018151811061349757613497613b42565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060006134d384600261396a565b6134de906001613944565b90505b600181111561357b577f303132333435363738396162636465660000000000000000000000000000000085600f166010811061351f5761351f613b42565b1a60f81b82828151811061353557613535613b42565b60200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535060049490941c9361357481613b71565b90506134e1565b508315610c4a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401611151565b6000610c4a8383670de0b6b3a7640000612212565b73ffffffffffffffffffffffffffffffffffffffff8116811461136057600080fd5b60006020828403121561362d57600080fd5b8135610c4a816135f9565b60006020828403121561364a57600080fd5b81357fffffffff0000000000000000000000000000000000000000000000000000000081168114610c4a57600080fd5b60005b8381101561369557818101518382015260200161367d565b50506000910152565b60208152600082518060208401526136bd81604085016020870161367a565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169190910160400192915050565b60006020828403121561370157600080fd5b5035919050565b6000806040838503121561371b57600080fd5b8235613726816135f9565b946020939093013593505050565b60008060006060848603121561374957600080fd5b8335613754816135f9565b92506020840135613764816135f9565b929592945050506040919091013590565b6000806040838503121561378857600080fd5b82359150602083013561379a816135f9565b809150509250929050565b6000806000606084860312156137ba57600080fd5b8335925060208401356137cc816135f9565b915060408401356137dc816135f9565b809150509250925092565b600080600080600080600060e0888a03121561380257600080fd5b873561380d816135f9565b9650602088013561381d816135f9565b95506040880135945060608801359350608088013560ff8116811461384157600080fd5b9699959850939692959460a0840135945060c09093013592915050565b6000806040838503121561387157600080fd5b823561387c816135f9565b9150602083013561379a816135f9565b600181811c908216806138a057607f821691505b6020821081036138d9577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b6000602082840312156138f157600080fd5b8151610c4a816135f9565b60006020828403121561390e57600080fd5b5051919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b80820180821115610af857610af8613915565b81810381811115610af857610af8613915565b8082028115828204841417610af857610af8613915565b6000826139b7577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b600080835481600182811c9150808316806139d857607f831692505b60208084108203613a10577f4e487b710000000000000000000000000000000000000000000000000000000086526022600452602486fd5b818015613a245760018114613a5757613a84565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0086168952841515850289019650613a84565b60008a81526020902060005b86811015613a7c5781548b820152908501908301613a63565b505084890196505b509498975050505050505050565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351613aca81601785016020880161367a565b7f206973206d697373696e6720726f6c65200000000000000000000000000000006017918401918201528351613b0781602884016020880161367a565b01602801949350505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600081613b8057613b80613915565b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff019056fea26469706673582212207180a0ef52584d5d928282a8c9454c6fd1d1fd14be620bb47b91ecbb63bb82ab64736f6c63430008150033

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

00000000000000000000000084f67f75daf6d57aef500e0c85c77b7b3bbc92a90000000000000000000000006cf38285fdfaf8d67205ca444a899025b5b18e83000000000000000000000000ba8a621b4a54e61c442f5ec623687e2a942225ef00000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000120000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000000000000000000000000000000000000000278d00000000000000000000000000000000000000000000000000000000000000000d5374616b65642051756172747a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000077351756172747a00000000000000000000000000000000000000000000000000

-----Decoded View---------------
Arg [0] : admin (address): 0x84f67f75DAf6D57Aef500E0c85C77B7b3bBc92A9
Arg [1] : _treasury (address): 0x6cF38285FdFAf8D67205ca444A899025b5B18e83
Arg [2] : _stakeToken (address): 0xbA8A621b4a54e61C442F5Ec623687e2a942225ef
Arg [3] : _name (string): Staked Quartz
Arg [4] : _symbol (string): sQuartz
Arg [5] : _rewardToken (address): 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2
Arg [6] : _duration (uint64): 2592000

-----Encoded View---------------
11 Constructor Arguments found :
Arg [0] : 00000000000000000000000084f67f75daf6d57aef500e0c85c77b7b3bbc92a9
Arg [1] : 0000000000000000000000006cf38285fdfaf8d67205ca444a899025b5b18e83
Arg [2] : 000000000000000000000000ba8a621b4a54e61c442f5ec623687e2a942225ef
Arg [3] : 00000000000000000000000000000000000000000000000000000000000000e0
Arg [4] : 0000000000000000000000000000000000000000000000000000000000000120
Arg [5] : 000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2
Arg [6] : 0000000000000000000000000000000000000000000000000000000000278d00
Arg [7] : 000000000000000000000000000000000000000000000000000000000000000d
Arg [8] : 5374616b65642051756172747a00000000000000000000000000000000000000
Arg [9] : 0000000000000000000000000000000000000000000000000000000000000007
Arg [10] : 7351756172747a00000000000000000000000000000000000000000000000000


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

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

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