ETH Price: $3,832.95 (+5.57%)

Contract

0xB23F8CC0e77332fE42b426D4AB3c9A893B9798a9
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Token Holdings

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Withdraw And Cla...205597172024-08-19 2:33:11114 days ago1724034791IN
0xB23F8CC0...93B9798a9
0 ETH0.000186821.31666325
Withdraw And Cla...205172232024-08-13 4:09:47120 days ago1723522187IN
0xB23F8CC0...93B9798a9
0 ETH0.000168171
Claim Rewards204888042024-08-09 4:58:47124 days ago1723179527IN
0xB23F8CC0...93B9798a9
0 ETH0.000162231.2
Claim Rewards204827362024-08-08 8:41:23125 days ago1723106483IN
0xB23F8CC0...93B9798a9
0 ETH0.000246042.04314658
Withdraw And Cla...204754142024-08-07 8:10:47126 days ago1723018247IN
0xB23F8CC0...93B9798a9
0 ETH0.000264491.6
Claim Rewards204456662024-08-03 4:36:23130 days ago1722659783IN
0xB23F8CC0...93B9798a9
0 ETH0.000280572.08213426
Claim Rewards204121162024-07-29 12:07:35135 days ago1722254855IN
0xB23F8CC0...93B9798a9
0 ETH0.000403643.05826823
Deposit204120372024-07-29 11:51:35135 days ago1722253895IN
0xB23F8CC0...93B9798a9
0 ETH0.000399143.00094693
Claim Rewards204118462024-07-29 11:13:23135 days ago1722251603IN
0xB23F8CC0...93B9798a9
0 ETH0.000252071.79111423
Withdraw And Cla...203925552024-07-26 18:36:35138 days ago1722018995IN
0xB23F8CC0...93B9798a9
0 ETH0.000466972.68969076
Claim Rewards203925512024-07-26 18:35:47138 days ago1722018947IN
0xB23F8CC0...93B9798a9
0 ETH0.000384562.73254154
Claim Rewards203681092024-07-23 8:43:23141 days ago1721724203IN
0xB23F8CC0...93B9798a9
0 ETH0.001067437.60861911
Claim Rewards203249742024-07-17 8:12:23147 days ago1721203943IN
0xB23F8CC0...93B9798a9
0 ETH0.001322059.61327174
Withdraw And Cla...203028232024-07-14 6:02:35150 days ago1720936955IN
0xB23F8CC0...93B9798a9
0 ETH0.000440032.5
Claim Rewards202739332024-07-10 5:13:35154 days ago1720588415IN
0xB23F8CC0...93B9798a9
0 ETH0.000665194.9363572
Claim Rewards202555212024-07-07 15:26:35157 days ago1720365995IN
0xB23F8CC0...93B9798a9
0 ETH0.000351662.35180327
Claim Rewards202307132024-07-04 4:18:35160 days ago1720066715IN
0xB23F8CC0...93B9798a9
0 ETH0.000411473.05353137
Deposit202013182024-06-30 1:47:59164 days ago1719712079IN
0xB23F8CC0...93B9798a9
0 ETH0.000252672.04049841
Claim Rewards202013092024-06-30 1:46:11164 days ago1719711971IN
0xB23F8CC0...93B9798a9
0 ETH0.00025551.935857
Claim Rewards201745132024-06-26 7:57:11168 days ago1719388631IN
0xB23F8CC0...93B9798a9
0 ETH0.000300862.18072251
Deposit201466042024-06-22 10:19:11172 days ago1719051551IN
0xB23F8CC0...93B9798a9
0 ETH0.00036012.54829162
Claim Rewards201465942024-06-22 10:17:11172 days ago1719051431IN
0xB23F8CC0...93B9798a9
0 ETH0.000368692.6723143
Deposit201406922024-06-21 14:27:47173 days ago1718980067IN
0xB23F8CC0...93B9798a9
0 ETH0.0015752111.92085764
Claim Rewards201406742024-06-21 14:24:11173 days ago1718979851IN
0xB23F8CC0...93B9798a9
0 ETH0.0017931810.27652183
Claim Rewards201105582024-06-17 9:17:23177 days ago1718615843IN
0xB23F8CC0...93B9798a9
0 ETH0.000515363.04235862
View all transactions

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
BoostedLiquidityDistributor

Compiler Version
v0.8.25+commit.b61c2a91

Optimization Enabled:
Yes with 200 runs

Other Settings:
paris EvmVersion
File 1 of 7 : BoostedLiquidityDistributor.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.25;

import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol";
import {Math} from "@openzeppelin/contracts/utils/math/Math.sol";
import {SafeTransferLib} from "@rari-capital/solmate/src/utils/SafeTransferLib.sol";
import {ERC20} from "@rari-capital/solmate/src/tokens/ERC20.sol";

/// @notice Distributes rewards to LP providers.
/// @author Nation3 (https://github.com/nation3/app/blob/main/contracts/src/distributors/BoostedLiquidityDistributor.sol).
/// @dev Inspired by Rari-Capital rewards distributor (https://github.com/Rari-Capital/rari-governance-contracts/blob/master/contracts/RariGovernanceTokenUniswapDistributor.sol).
/// @dev Implemented boosted rewards mechanics from Curve Finance (https://github.com/curvefi/curve-dao-contracts/blob/master/contracts/gauges/LiquidityGauge.vy)
contract BoostedLiquidityDistributor is Initializable, Ownable {
    /*///////////////////////////////////////////////////////////////
                               LIBRARIES
    //////////////////////////////////////////////////////////////*/

    using SafeTransferLib for ERC20;

    /*///////////////////////////////////////////////////////////////
                                 ERRORS
    //////////////////////////////////////////////////////////////*/

    error InvalidStartBlock();
    error InvalidEndBlock();
    error InvalidRewardsAmount();
    error InsufficientDepositBalance();
    error InsufficientRewardsBalance();
    error KickNotAllowed();

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

    event RewardsSet(uint256 amount, uint256 startBlock, uint256 endBlock);
    event Claim(address indexed user, uint256 rewards);
    event Deposit(address indexed user, uint256 amount);
    event Withdraw(address indexed user, uint256 amount);
    event UpdatedBalances(
        address account,
        uint256 balance,
        uint256 totalBalance
    );

    /*///////////////////////////////////////////////////////////////
                        INMUTABLES / CONSTANTS
    //////////////////////////////////////////////////////////////*/

    /// @dev % of the user deposited tokens that counts for working balance without boost
    uint256 internal constant BOOSTLESS_PRODUCTION = 40; // %
    /// @dev Used to correct precision errors on divisions.
    uint256 internal constant PRECISION = 1e30;

    /*///////////////////////////////////////////////////////////////
                                 STORAGE
    //////////////////////////////////////////////////////////////*/

    /// @notice The token rewarded to LP providers.
    ERC20 public rewardsToken;
    /// @notice The LP token accepted to deposit by the contract.
    ERC20 public lpToken;
    /// @notice The token used to boost rewards.
    ERC20 public boostToken;

    /// @notice First block to distribute rewards.
    uint256 public startBlock;
    /// @notice Last block to distribute rewards.
    uint256 public endBlock;
    /// @notice Total LP tokens deposited by users.
    uint256 public totalDeposit;
    /// @notice Total balance of the contract after boosts.
    uint256 public totalBalance;
    /// @notice Total rewards beeing distributed.
    uint256 public totalRewards;
    /// @notice Total rewards already distributed to users.
    uint256 public distributedRewards;

    /// @dev Rewards per block on current rewards period.
    /// @dev Only changes on total rewards update.
    /// @dev Precision correction will be applied.
    uint256 internal _blockRewards;
    /// @dev Rewards per LP deposited token at last distribution.
    uint256 internal _rewardsRate;
    /// @dev Last block in which rewards have been distributed.
    uint256 internal _lastDistributedBlock;

    /// @dev Amount of LP tokens deposited by user.
    mapping(address => uint256) public userDeposit;
    /// @dev Balance of user deposit after boost
    mapping(address => uint256) public userBalance;

    /// @dev Rewards per LP token deposited at last user deposit.
    mapping(address => uint256) internal _userRatedRewards;
    /// @dev Distributed rewards to the user at last distribution.
    mapping(address => uint256) internal _userDistributedRewards;
    /// @dev Rewards claimed by user.
    mapping(address => uint256) internal _userClaimedRewards;

    constructor() Ownable(msg.sender) {}

    /*///////////////////////////////////////////////////////////////
                             INITIALIZATION
    //////////////////////////////////////////////////////////////*/

    /// @dev Sets both rewards, LP & boost token.
    /// @param _rewardsToken The contract of the rewards token.
    /// @param _lpToken The contract of the liquidity pool tokens.
    /// @param _boostToken The contract of boosting power balance.
    function initialize(
        ERC20 _rewardsToken,
        ERC20 _lpToken,
        address _boostToken
    ) external initializer {
        rewardsToken = _rewardsToken;
        lpToken = _lpToken;
        boostToken = ERC20(_boostToken);
    }

    /*///////////////////////////////////////////////////////////////
                              ADMIN ACTIONS
    //////////////////////////////////////////////////////////////*/

    /// @notice Set rewards amount & rewards period duration, can be used to update rewards destribution anytime in the future.
    /// @param amount The amount of reward tokens to set as rewards, it expects this amount to be already transferred to the contract.
    /// @param _startBlock Initial block of the rewards distribution.
    /// @param _endBlock Final block of the rewards distribution.
    /// @dev If the rewardsToken contract has not been verified before this could lead to a reentrancy attack
    function setRewards(
        uint256 amount,
        uint256 _startBlock,
        uint256 _endBlock
    ) external virtual onlyOwner {
        if (_startBlock < block.number) revert InvalidStartBlock();
        if (_endBlock <= _startBlock) revert InvalidEndBlock();

        // Distribute possible pending rewards
        _updateRewardsdistribution();

        uint256 _distributedRewards = distributedRewards; // Gas savings
        if (amount <= _distributedRewards) revert InvalidRewardsAmount();
        if (amount - distributedRewards > rewardsToken.balanceOf(address(this)))
            revert InsufficientRewardsBalance();

        // Set / reset variables
        totalRewards = amount;
        startBlock = _startBlock;
        endBlock = _endBlock;
        // Compute rewards that must be distributed each block, precision correction applied.
        _blockRewards =
            ((amount - _distributedRewards) * PRECISION) /
            (_endBlock - _startBlock);

        emit RewardsSet(amount, _startBlock, _endBlock);
    }

    /// @notice Allow the owner to withdraw any ERC20 sent to the contract.
    /// @param token Token to withdraw.
    /// @param to Recipient address of the tokens.
    function recoverTokens(
        ERC20 token,
        address to
    ) external virtual onlyOwner returns (uint256 amount) {
        amount = token.balanceOf(address(this));
        if (token == lpToken) {
            amount = amount - totalDeposit;
        } else if (token == rewardsToken) {
            amount = amount - totalRewards;
        }

        token.safeTransfer(to, amount);
    }

    /*///////////////////////////////////////////////////////////////
                                USER ACTIONS
    //////////////////////////////////////////////////////////////*/

    /// @notice Returns the quantity of unclaimed rewards earned by `account`.
    /// @param account The account of deposited LP tokens.
    /// @return The quantity of unclaimed rewards tokens.
    function getUnclaimedRewards(
        address account
    ) external view virtual returns (uint256) {
        return _userDistributedRewards[account] - _userClaimedRewards[account];
    }

    /// @notice Kick an account for abusing the boost.
    /// @param account The account to update balances.
    /// @dev Only if their boost power expired.
    function kick(address account) external virtual {
        uint256 _userDeposit = userDeposit[account];
        if (userBalance[account] <= (_userDeposit * BOOSTLESS_PRODUCTION) / 100)
            revert KickNotAllowed();
        if (boostToken.balanceOf(account) > 0) revert KickNotAllowed();

        _distributeRewards(account);
        _updateBalances(account, _userDeposit, totalDeposit);
    }

    /// @notice Deposits `amount` of LP tokens from sender to this contract.
    /// @param amount The amount ot LP tokens to deposit.
    function deposit(uint256 amount) external virtual {
        // Transfer LP token from sender
        lpToken.safeTransferFrom(msg.sender, address(this), amount);
        uint256 _userDeposit = userDeposit[msg.sender];

        if (block.number > startBlock) {
            if (_userDeposit > 0) {
                // Distribute rewards until this point and update snapshot of rewards per LP Token
                _distributeRewards(msg.sender);
            } else {
                // On first deposit update distribution and set initial user snapshot of rewards per LP Token
                _updateRewardsdistribution();
                _userRatedRewards[msg.sender] = _rewardsRate;
            }
        }

        // Add to staking balance
        _userDeposit = _userDeposit + amount;
        userDeposit[msg.sender] = _userDeposit;
        totalDeposit = totalDeposit + amount;

        _updateBalances(msg.sender, _userDeposit, totalDeposit);

        emit Deposit(msg.sender, amount);
    }

    /// @notice Withdraws `amount` of LP tokens from this contract to sender.
    /// @param amount The amount of LP tokens to withdraw.
    function withdraw(uint256 amount) external virtual {
        uint256 _userDeposit = userDeposit[msg.sender];

        if (amount > _userDeposit) revert InsufficientDepositBalance();
        if (block.number > startBlock) _distributeRewards(msg.sender);

        // Substract from staking balance
        _userDeposit = _userDeposit - amount;
        userDeposit[msg.sender] = _userDeposit;
        totalDeposit = totalDeposit - amount;

        _updateBalances(msg.sender, _userDeposit, totalDeposit);

        // Transfer out to sender
        lpToken.safeTransfer(msg.sender, amount);

        emit Withdraw(msg.sender, amount);
    }

    /// @notice Claims all of `msg.sender` unclaimed rewards.
    /// @return The quantity of rewards tokens claimed.
    function claimRewards() external virtual returns (uint256) {
        // Distribute rewards to account
        if (block.number > startBlock) _distributeRewards(msg.sender);

        // Get unclaimed rewards
        uint256 unclaimedRewards = _userDistributedRewards[msg.sender] -
            _userClaimedRewards[msg.sender];
        if (unclaimedRewards <= 0) revert InsufficientRewardsBalance();

        // Register claimed rewards and transfer out
        _userClaimedRewards[msg.sender] =
            _userClaimedRewards[msg.sender] +
            unclaimedRewards;

        _updateBalances(msg.sender, userDeposit[msg.sender], totalDeposit);

        rewardsToken.safeTransfer(msg.sender, unclaimedRewards);

        emit Claim(msg.sender, unclaimedRewards);

        return unclaimedRewards;
    }

    /// @notice Withdraw all LP tokens and unclaimed rewards to sender.
    /// @return withdrawAmount The staking amount drained.
    /// @return unclaimedRewards The quantity of rewards tokens claimed.
    function withdrawAndClaim()
        external
        virtual
        returns (uint256 withdrawAmount, uint256 unclaimedRewards)
    {
        // Distribute rewards to account
        if (block.number > startBlock) _distributeRewards(msg.sender);

        withdrawAmount = userDeposit[msg.sender];
        unclaimedRewards =
            _userDistributedRewards[msg.sender] -
            _userClaimedRewards[msg.sender];

        // Drain account staking and update claimed rewards
        userDeposit[msg.sender] = 0;
        totalDeposit = totalDeposit - withdrawAmount;
        _userClaimedRewards[msg.sender] =
            _userClaimedRewards[msg.sender] +
            unclaimedRewards;

        _updateBalances(msg.sender, 0, totalDeposit);

        // Transfer out LP tokens & rewards
        lpToken.safeTransfer(msg.sender, withdrawAmount);
        rewardsToken.safeTransfer(msg.sender, unclaimedRewards);

        emit Withdraw(msg.sender, withdrawAmount);
        emit Claim(msg.sender, unclaimedRewards);
    }

    /*///////////////////////////////////////////////////////////////
                       INTERNAL DISTRIBUTION LOGIC
    //////////////////////////////////////////////////////////////*/

    /// @dev Update user balance & total balance after boosts.
    /// @param account The LP token depositor whose balance is being updated.
    /// @param _userDeposit LP tokens deposited by the user to use as base balance.
    /// @param _totalDeposit Total LP tokens deposited in the contract.
    /// @dev If the boostToken contract hasn't been verified before this could lead to a reentrancy attack.
    function _updateBalances(
        address account,
        uint256 _userDeposit,
        uint256 _totalDeposit
    ) internal virtual {
        uint256 userPower = boostToken.balanceOf(account);
        uint256 totalPower = boostToken.totalSupply();

        // Calculate user balance after boost
        // min((userDeposit * 0.4) + (totalDeposit * userVotingPower / totalVotingPower * 0.6), (userDeposit * 0.4))
        uint256 workingBalance = (_userDeposit * BOOSTLESS_PRODUCTION) / 100;
        if (totalPower > 0) {
            workingBalance +=
                (_totalDeposit * userPower * (100 - BOOSTLESS_PRODUCTION)) /
                (totalPower * 100);
        }
        workingBalance = Math.min(_userDeposit, workingBalance);

        // Update boosted balances
        uint256 lastUserBalance = userBalance[account];
        userBalance[account] = workingBalance;
        totalBalance = totalBalance + workingBalance - lastUserBalance;

        emit UpdatedBalances(account, workingBalance, totalBalance);
    }

    /// @dev Distributes all undistributed rewards earned by `account`.
    /// @dev Do not reverts if there is no rewards to distribute.
    /// @param account The LP Token depositor whose rewards are to be distributed.
    /// @return The quantity of rewards distributed.
    function _distributeRewards(
        address account
    ) internal virtual returns (uint256) {
        uint256 _userBalance = userBalance[account];
        if (_userBalance <= 0) return 0;

        _updateRewardsdistribution();

        // Compute undistributed rewards from the delta in rewardsRate since the user deposited
        uint256 undistributedRewards = (_userBalance *
            (_rewardsRate - _userRatedRewards[account])) / PRECISION;
        if (undistributedRewards <= 0) return 0;

        _userRatedRewards[account] = _rewardsRate;
        _userDistributedRewards[account] =
            _userDistributedRewards[account] +
            undistributedRewards;

        return undistributedRewards;
    }

    /// @dev Updates rewards distribution values.
    /// Distributes rewards in all blocks, including empty staking ones.
    function _updateRewardsdistribution() internal virtual {
        if (totalRewards <= 0) return;
        if (endBlock <= _lastDistributedBlock) return;
        if (_lastDistributedBlock < startBlock)
            _lastDistributedBlock = startBlock;

        uint256 blocksToDistribute;
        if (block.number <= endBlock) {
            blocksToDistribute = block.number - _lastDistributedBlock;
        } else {
            blocksToDistribute = endBlock - _lastDistributedBlock;
        }

        uint256 rewardsToDistribute = _blockRewards * blocksToDistribute;

        if (rewardsToDistribute <= 0) return;

        _lastDistributedBlock = block.number;

        // Update rewards per LP token only if there are deposited tokens
        if (totalBalance > 0) {
            distributedRewards =
                distributedRewards +
                rewardsToDistribute /
                PRECISION;
            _rewardsRate = _rewardsRate + rewardsToDistribute / totalBalance;
        }
    }
}

File 2 of 7 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)

pragma solidity ^0.8.20;

import {Context} from "../utils/Context.sol";

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

    /**
     * @dev The caller account is not authorized to perform an operation.
     */
    error OwnableUnauthorizedAccount(address account);

    /**
     * @dev The owner is not a valid owner account. (eg. `address(0)`)
     */
    error OwnableInvalidOwner(address owner);

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

    /**
     * @dev Initializes the contract setting the address provided by the deployer as the initial owner.
     */
    constructor(address initialOwner) {
        if (initialOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(initialOwner);
    }

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

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

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        if (owner() != _msgSender()) {
            revert OwnableUnauthorizedAccount(_msgSender());
        }
    }

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

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        if (newOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(newOwner);
    }

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

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

pragma solidity ^0.8.20;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

pragma solidity ^0.8.20;

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

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

File 5 of 7 : Math.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/Math.sol)

pragma solidity ^0.8.20;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    /**
     * @dev Muldiv operation overflow.
     */
    error MathOverflowedMulDiv();

    enum Rounding {
        Floor, // Toward negative infinity
        Ceil, // Toward positive infinity
        Trunc, // Toward zero
        Expand // Away from zero
    }

    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            uint256 c = a + b;
            if (c < a) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, with an overflow flag.
     */
    function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b > a) return (false, 0);
            return (true, a - b);
        }
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.
     */
    function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
            // benefit is lost if 'b' is also tested.
            // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
            if (a == 0) return (true, 0);
            uint256 c = a * b;
            if (c / a != b) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the division of two unsigned integers, with a division by zero flag.
     */
    function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a / b);
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
     */
    function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a % b);
        }
    }

    /**
     * @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 towards infinity instead
     * of rounding towards zero.
     */
    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
        if (b == 0) {
            // Guarantee the same behavior as in a regular Solidity division.
            return a / b;
        }

        // (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 = x * y; // Least significant 256 bits of the product
            uint256 prod1; // Most significant 256 bits of the product
            assembly {
                let mm := mulmod(x, y, not(0))
                prod1 := sub(sub(mm, prod0), lt(mm, prod0))
            }

            // Handle non-overflow cases, 256 by 256 division.
            if (prod1 == 0) {
                // Solidity will revert if denominator == 0, unlike the div opcode on its own.
                // The surrounding unchecked block does not change this fact.
                // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
                return prod0 / denominator;
            }

            // Make sure the result is less than 2^256. Also prevents denominator == 0.
            if (denominator <= prod1) {
                revert MathOverflowedMulDiv();
            }

            ///////////////////////////////////////////////
            // 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.

            uint256 twos = denominator & (0 - denominator);
            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 (unsignedRoundsUp(rounding) && 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
     * towards zero.
     *
     * 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 + (unsignedRoundsUp(rounding) && result * result < a ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 2 of a positive value rounded towards zero.
     * 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 + (unsignedRoundsUp(rounding) && 1 << result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 10 of a positive value rounded towards zero.
     * 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 + (unsignedRoundsUp(rounding) && 10 ** result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 256 of a positive value rounded towards zero.
     * 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 256, 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 + (unsignedRoundsUp(rounding) && 1 << (result << 3) < value ? 1 : 0);
        }
    }

    /**
     * @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers.
     */
    function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) {
        return uint8(rounding) % 2 == 1;
    }
}

File 6 of 7 : ERC20.sol
// 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/Rari-Capital/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);
    }
}

File 7 of 7 : SafeTransferLib.sol
// 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/Rari-Capital/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;

        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;

        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;

        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;

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

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

Contract Security Audit

Contract ABI

[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"InsufficientDepositBalance","type":"error"},{"inputs":[],"name":"InsufficientRewardsBalance","type":"error"},{"inputs":[],"name":"InvalidEndBlock","type":"error"},{"inputs":[],"name":"InvalidInitialization","type":"error"},{"inputs":[],"name":"InvalidRewardsAmount","type":"error"},{"inputs":[],"name":"InvalidStartBlock","type":"error"},{"inputs":[],"name":"KickNotAllowed","type":"error"},{"inputs":[],"name":"NotInitializing","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"rewards","type":"uint256"}],"name":"Claim","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint64","name":"version","type":"uint64"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"startBlock","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"endBlock","type":"uint256"}],"name":"RewardsSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"balance","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalBalance","type":"uint256"}],"name":"UpdatedBalances","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Withdraw","type":"event"},{"inputs":[],"name":"boostToken","outputs":[{"internalType":"contract ERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"claimRewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"distributedRewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"endBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"getUnclaimedRewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract ERC20","name":"_rewardsToken","type":"address"},{"internalType":"contract ERC20","name":"_lpToken","type":"address"},{"internalType":"address","name":"_boostToken","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"kick","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"lpToken","outputs":[{"internalType":"contract ERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract ERC20","name":"token","type":"address"},{"internalType":"address","name":"to","type":"address"}],"name":"recoverTokens","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rewardsToken","outputs":[{"internalType":"contract ERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"_startBlock","type":"uint256"},{"internalType":"uint256","name":"_endBlock","type":"uint256"}],"name":"setRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"startBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalDeposit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalRewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"userBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"userDeposit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawAndClaim","outputs":[{"internalType":"uint256","name":"withdrawAmount","type":"uint256"},{"internalType":"uint256","name":"unclaimedRewards","type":"uint256"}],"stateMutability":"nonpayable","type":"function"}]

6080604052348015600f57600080fd5b503380603557604051631e4fbdf760e01b81526000600482015260240160405180910390fd5b603c816041565b506091565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b611339806100a06000396000f3fe608060405234801561001057600080fd5b506004361061014d5760003560e01c80638da5cb5b116100c3578063d1af0c7d1161007c578063d1af0c7d1461029c578063d4437724146102af578063f2fde38b146102cc578063f36d1e4e146102df578063f3e14f1e146102f2578063f6153ccd146102fb57600080fd5b80638da5cb5b1461022957806396c551751461023a578063ad7a672f1461024d578063b6b55f2514610256578063c0c53b8b14610269578063d1260edd1461027c57600080fd5b8063372500ab11610115578063372500ab146101bf5780633a589b97146101c757806348cd4cb1146101f25780635fcbd285146101fb57806369a69e291461020e578063715018a61461022157600080fd5b80630103c92b14610152578063056097ac14610185578063083c6323146101985780630e15561a146101a15780632e1a7d4d146101aa575b600080fd5b61017261016036600461118f565b600e6020526000908152604090205481565b6040519081526020015b60405180910390f35b6101726101933660046111ac565b610304565b61017260055481565b61017260085481565b6101bd6101b83660046111e5565b6103e3565b005b6101726104ba565b6003546101da906001600160a01b031681565b6040516001600160a01b03909116815260200161017c565b61017260045481565b6002546101da906001600160a01b031681565b61017261021c36600461118f565b6105b2565b6101bd6105e0565b6000546001600160a01b03166101da565b6101bd61024836600461118f565b6105f4565b61017260075481565b6101bd6102643660046111e5565b610704565b6101bd6102773660046111fe565b6107d9565b61017261028a36600461118f565b600d6020526000908152604090205481565b6001546101da906001600160a01b031681565b6102b761091f565b6040805192835260208301919091520161017c565b6101bd6102da36600461118f565b610a61565b6101bd6102ed366004611249565b610aa4565b61017260095481565b61017260065481565b600061030e610c3f565b6040516370a0823160e01b81523060048201526001600160a01b038416906370a0823190602401602060405180830381865afa158015610352573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103769190611275565b6002549091506001600160a01b03908116908416036103a35760065461039c90826112a4565b90506103c9565b6001546001600160a01b03908116908416036103c9576008546103c690826112a4565b90505b6103dd6001600160a01b0384168383610c6c565b92915050565b336000908152600d60205260409020548082111561041457604051631650c97f60e11b815260040160405180910390fd5b6004544311156104295761042733610cea565b505b61043382826112a4565b336000908152600d602052604090208190556006549091506104569083906112a4565b6006819055506104693382600654610dcc565b600254610480906001600160a01b03163384610c6c565b60405182815233907f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364906020015b60405180910390a25050565b60006004544311156104d1576104cf33610cea565b505b3360009081526011602090815260408083205460109092528220546104f691906112a4565b90506000811161051957604051635772cb5960e11b815260040160405180910390fd5b336000908152601160205260409020546105349082906112b7565b33600081815260116020908152604080832094909455600d90529190912054600654610561929190610dcc565b600154610578906001600160a01b03163383610c6c565b60405181815233907f47cee97cb7acd717b3c0aa1435d004cd5b3c8c57d70dbceb4e4458bbd60e39d49060200160405180910390a2919050565b6001600160a01b03811660009081526011602090815260408083205460109092528220546103dd91906112a4565b6105e8610c3f565b6105f26000610fb8565b565b6001600160a01b0381166000908152600d6020526040902054606461061a6028836112ca565b61062491906112e1565b6001600160a01b0383166000908152600e60205260409020541161065b576040516365c7416b60e11b815260040160405180910390fd5b6003546040516370a0823160e01b81526001600160a01b03848116600483015260009216906370a0823190602401602060405180830381865afa1580156106a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106ca9190611275565b11156106e9576040516365c7416b60e11b815260040160405180910390fd5b6106f282610cea565b506107008282600654610dcc565b5050565b60025461071c906001600160a01b0316333084611008565b336000908152600d602052604090205460045443111561076757801561074b5761074533610cea565b50610767565b610753611092565b600b54336000908152600f60205260409020555b61077182826112b7565b336000908152600d602052604090208190556006549091506107949083906112b7565b6006819055506107a73382600654610dcc565b60405182815233907fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c906020016104ae565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a008054600160401b810460ff16159067ffffffffffffffff1660008115801561081f5750825b905060008267ffffffffffffffff16600114801561083c5750303b155b90508115801561084a575080155b156108685760405163f92ee8a960e01b815260040160405180910390fd5b845467ffffffffffffffff19166001178555831561089257845460ff60401b1916600160401b1785555b600180546001600160a01b03808b166001600160a01b031992831617909255600280548a84169083161790556003805492891692909116919091179055831561091557845460ff60401b19168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b5050505050505050565b6000806004544311156109375761093533610cea565b505b336000908152600d602090815260408083205460118352818420546010909352922054919350610966916112a4565b336000908152600d60205260408120556006549091506109879083906112a4565b600655336000908152601160205260409020546109a59082906112b7565b336000818152601160205260408120929092556006546109c59290610dcc565b6002546109dc906001600160a01b03163384610c6c565b6001546109f3906001600160a01b03163383610c6c565b60405182815233907f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a94243649060200160405180910390a260405181815233907f47cee97cb7acd717b3c0aa1435d004cd5b3c8c57d70dbceb4e4458bbd60e39d49060200160405180910390a29091565b610a69610c3f565b6001600160a01b038116610a9857604051631e4fbdf760e01b8152600060048201526024015b60405180910390fd5b610aa181610fb8565b50565b610aac610c3f565b43821015610acd5760405163ec2caa0d60e01b815260040160405180910390fd5b818111610aed57604051633dea3a3b60e11b815260040160405180910390fd5b610af5611092565b600954808411610b1857604051636989984d60e01b815260040160405180910390fd5b6001546040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa158015610b60573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b849190611275565b600954610b9190866112a4565b1115610bb057604051635772cb5960e11b815260040160405180910390fd5b600884905560048390556005829055610bc983836112a4565b6c0c9f2c9cd04674edea40000000610be183876112a4565b610beb91906112ca565b610bf591906112e1565b600a5560408051858152602081018590529081018390527ff0f7bde9cfd224702fe707f27ad7d6b35c7d7f63fd91bb24a760cfd6a99f85e79060600160405180910390a150505050565b6000546001600160a01b031633146105f25760405163118cdaa760e01b8152336004820152602401610a8f565b600060405163a9059cbb60e01b8152836004820152826024820152602060006044836000895af13d15601f3d1160016000511416171691505080610ce45760405162461bcd60e51b815260206004820152600f60248201526e1514905394d1915497d19052531151608a1b6044820152606401610a8f565b50505050565b6001600160a01b0381166000908152600e602052604081205480610d115750600092915050565b610d19611092565b6001600160a01b0383166000908152600f6020526040812054600b546c0c9f2c9cd04674edea4000000091610d4d916112a4565b610d5790846112ca565b610d6191906112e1565b905060008111610d75575060009392505050565b600b546001600160a01b0385166000908152600f6020908152604080832093909355601090522054610da89082906112b7565b6001600160a01b039094166000908152601060205260409020939093555090919050565b6003546040516370a0823160e01b81526001600160a01b03858116600483015260009216906370a0823190602401602060405180830381865afa158015610e17573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e3b9190611275565b90506000600360009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e92573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610eb69190611275565b905060006064610ec76028876112ca565b610ed191906112e1565b90508115610f1b57610ee48260646112ca565b610ef0602860646112a4565b610efa85876112ca565b610f0491906112ca565b610f0e91906112e1565b610f1890826112b7565b90505b610f258582611162565b6001600160a01b0387166000908152600e60205260409020805490829055600754919250908190610f579084906112b7565b610f6191906112a4565b6007819055604080516001600160a01b038a1681526020810185905280820192909252517fe48db16f43f9bc819014afd4918faf23f1854cf365b8b99746a953980173f8779181900360600190a150505050505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60006040516323b872dd60e01b81528460048201528360248201528260448201526020600060648360008a5af13d15601f3d116001600051141617169150508061108b5760405162461bcd60e51b81526020600482015260146024820152731514905394d1915497d19493d357d1905253115160621b6044820152606401610a8f565b5050505050565b60006008541161109e57565b600c54600554116110ab57565b600454600c5410156110be57600454600c555b600060055443116110dd57600c546110d690436112a4565b90506110f0565b600c546005546110ed91906112a4565b90505b600081600a5461110091906112ca565b90506000811161110e575050565b43600c5560075415610700576111316c0c9f2c9cd04674edea40000000826112e1565b60095461113e91906112b7565b60095560075461114e90826112e1565b600b5461115b91906112b7565b600b555050565b60008183106111715781611173565b825b9392505050565b6001600160a01b0381168114610aa157600080fd5b6000602082840312156111a157600080fd5b81356111738161117a565b600080604083850312156111bf57600080fd5b82356111ca8161117a565b915060208301356111da8161117a565b809150509250929050565b6000602082840312156111f757600080fd5b5035919050565b60008060006060848603121561121357600080fd5b833561121e8161117a565b9250602084013561122e8161117a565b9150604084013561123e8161117a565b809150509250925092565b60008060006060848603121561125e57600080fd5b505081359360208301359350604090920135919050565b60006020828403121561128757600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b818103818111156103dd576103dd61128e565b808201808211156103dd576103dd61128e565b80820281158282048414176103dd576103dd61128e565b6000826112fe57634e487b7160e01b600052601260045260246000fd5b50049056fea264697066735822122047f7a06be2cd27cce006b77e96dfa6abe7c35dda6021ff2930e0c62119012f7164736f6c63430008190033

Deployed Bytecode

0x608060405234801561001057600080fd5b506004361061014d5760003560e01c80638da5cb5b116100c3578063d1af0c7d1161007c578063d1af0c7d1461029c578063d4437724146102af578063f2fde38b146102cc578063f36d1e4e146102df578063f3e14f1e146102f2578063f6153ccd146102fb57600080fd5b80638da5cb5b1461022957806396c551751461023a578063ad7a672f1461024d578063b6b55f2514610256578063c0c53b8b14610269578063d1260edd1461027c57600080fd5b8063372500ab11610115578063372500ab146101bf5780633a589b97146101c757806348cd4cb1146101f25780635fcbd285146101fb57806369a69e291461020e578063715018a61461022157600080fd5b80630103c92b14610152578063056097ac14610185578063083c6323146101985780630e15561a146101a15780632e1a7d4d146101aa575b600080fd5b61017261016036600461118f565b600e6020526000908152604090205481565b6040519081526020015b60405180910390f35b6101726101933660046111ac565b610304565b61017260055481565b61017260085481565b6101bd6101b83660046111e5565b6103e3565b005b6101726104ba565b6003546101da906001600160a01b031681565b6040516001600160a01b03909116815260200161017c565b61017260045481565b6002546101da906001600160a01b031681565b61017261021c36600461118f565b6105b2565b6101bd6105e0565b6000546001600160a01b03166101da565b6101bd61024836600461118f565b6105f4565b61017260075481565b6101bd6102643660046111e5565b610704565b6101bd6102773660046111fe565b6107d9565b61017261028a36600461118f565b600d6020526000908152604090205481565b6001546101da906001600160a01b031681565b6102b761091f565b6040805192835260208301919091520161017c565b6101bd6102da36600461118f565b610a61565b6101bd6102ed366004611249565b610aa4565b61017260095481565b61017260065481565b600061030e610c3f565b6040516370a0823160e01b81523060048201526001600160a01b038416906370a0823190602401602060405180830381865afa158015610352573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103769190611275565b6002549091506001600160a01b03908116908416036103a35760065461039c90826112a4565b90506103c9565b6001546001600160a01b03908116908416036103c9576008546103c690826112a4565b90505b6103dd6001600160a01b0384168383610c6c565b92915050565b336000908152600d60205260409020548082111561041457604051631650c97f60e11b815260040160405180910390fd5b6004544311156104295761042733610cea565b505b61043382826112a4565b336000908152600d602052604090208190556006549091506104569083906112a4565b6006819055506104693382600654610dcc565b600254610480906001600160a01b03163384610c6c565b60405182815233907f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a9424364906020015b60405180910390a25050565b60006004544311156104d1576104cf33610cea565b505b3360009081526011602090815260408083205460109092528220546104f691906112a4565b90506000811161051957604051635772cb5960e11b815260040160405180910390fd5b336000908152601160205260409020546105349082906112b7565b33600081815260116020908152604080832094909455600d90529190912054600654610561929190610dcc565b600154610578906001600160a01b03163383610c6c565b60405181815233907f47cee97cb7acd717b3c0aa1435d004cd5b3c8c57d70dbceb4e4458bbd60e39d49060200160405180910390a2919050565b6001600160a01b03811660009081526011602090815260408083205460109092528220546103dd91906112a4565b6105e8610c3f565b6105f26000610fb8565b565b6001600160a01b0381166000908152600d6020526040902054606461061a6028836112ca565b61062491906112e1565b6001600160a01b0383166000908152600e60205260409020541161065b576040516365c7416b60e11b815260040160405180910390fd5b6003546040516370a0823160e01b81526001600160a01b03848116600483015260009216906370a0823190602401602060405180830381865afa1580156106a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106ca9190611275565b11156106e9576040516365c7416b60e11b815260040160405180910390fd5b6106f282610cea565b506107008282600654610dcc565b5050565b60025461071c906001600160a01b0316333084611008565b336000908152600d602052604090205460045443111561076757801561074b5761074533610cea565b50610767565b610753611092565b600b54336000908152600f60205260409020555b61077182826112b7565b336000908152600d602052604090208190556006549091506107949083906112b7565b6006819055506107a73382600654610dcc565b60405182815233907fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c906020016104ae565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a008054600160401b810460ff16159067ffffffffffffffff1660008115801561081f5750825b905060008267ffffffffffffffff16600114801561083c5750303b155b90508115801561084a575080155b156108685760405163f92ee8a960e01b815260040160405180910390fd5b845467ffffffffffffffff19166001178555831561089257845460ff60401b1916600160401b1785555b600180546001600160a01b03808b166001600160a01b031992831617909255600280548a84169083161790556003805492891692909116919091179055831561091557845460ff60401b19168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b5050505050505050565b6000806004544311156109375761093533610cea565b505b336000908152600d602090815260408083205460118352818420546010909352922054919350610966916112a4565b336000908152600d60205260408120556006549091506109879083906112a4565b600655336000908152601160205260409020546109a59082906112b7565b336000818152601160205260408120929092556006546109c59290610dcc565b6002546109dc906001600160a01b03163384610c6c565b6001546109f3906001600160a01b03163383610c6c565b60405182815233907f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a94243649060200160405180910390a260405181815233907f47cee97cb7acd717b3c0aa1435d004cd5b3c8c57d70dbceb4e4458bbd60e39d49060200160405180910390a29091565b610a69610c3f565b6001600160a01b038116610a9857604051631e4fbdf760e01b8152600060048201526024015b60405180910390fd5b610aa181610fb8565b50565b610aac610c3f565b43821015610acd5760405163ec2caa0d60e01b815260040160405180910390fd5b818111610aed57604051633dea3a3b60e11b815260040160405180910390fd5b610af5611092565b600954808411610b1857604051636989984d60e01b815260040160405180910390fd5b6001546040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa158015610b60573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b849190611275565b600954610b9190866112a4565b1115610bb057604051635772cb5960e11b815260040160405180910390fd5b600884905560048390556005829055610bc983836112a4565b6c0c9f2c9cd04674edea40000000610be183876112a4565b610beb91906112ca565b610bf591906112e1565b600a5560408051858152602081018590529081018390527ff0f7bde9cfd224702fe707f27ad7d6b35c7d7f63fd91bb24a760cfd6a99f85e79060600160405180910390a150505050565b6000546001600160a01b031633146105f25760405163118cdaa760e01b8152336004820152602401610a8f565b600060405163a9059cbb60e01b8152836004820152826024820152602060006044836000895af13d15601f3d1160016000511416171691505080610ce45760405162461bcd60e51b815260206004820152600f60248201526e1514905394d1915497d19052531151608a1b6044820152606401610a8f565b50505050565b6001600160a01b0381166000908152600e602052604081205480610d115750600092915050565b610d19611092565b6001600160a01b0383166000908152600f6020526040812054600b546c0c9f2c9cd04674edea4000000091610d4d916112a4565b610d5790846112ca565b610d6191906112e1565b905060008111610d75575060009392505050565b600b546001600160a01b0385166000908152600f6020908152604080832093909355601090522054610da89082906112b7565b6001600160a01b039094166000908152601060205260409020939093555090919050565b6003546040516370a0823160e01b81526001600160a01b03858116600483015260009216906370a0823190602401602060405180830381865afa158015610e17573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e3b9190611275565b90506000600360009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e92573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610eb69190611275565b905060006064610ec76028876112ca565b610ed191906112e1565b90508115610f1b57610ee48260646112ca565b610ef0602860646112a4565b610efa85876112ca565b610f0491906112ca565b610f0e91906112e1565b610f1890826112b7565b90505b610f258582611162565b6001600160a01b0387166000908152600e60205260409020805490829055600754919250908190610f579084906112b7565b610f6191906112a4565b6007819055604080516001600160a01b038a1681526020810185905280820192909252517fe48db16f43f9bc819014afd4918faf23f1854cf365b8b99746a953980173f8779181900360600190a150505050505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60006040516323b872dd60e01b81528460048201528360248201528260448201526020600060648360008a5af13d15601f3d116001600051141617169150508061108b5760405162461bcd60e51b81526020600482015260146024820152731514905394d1915497d19493d357d1905253115160621b6044820152606401610a8f565b5050505050565b60006008541161109e57565b600c54600554116110ab57565b600454600c5410156110be57600454600c555b600060055443116110dd57600c546110d690436112a4565b90506110f0565b600c546005546110ed91906112a4565b90505b600081600a5461110091906112ca565b90506000811161110e575050565b43600c5560075415610700576111316c0c9f2c9cd04674edea40000000826112e1565b60095461113e91906112b7565b60095560075461114e90826112e1565b600b5461115b91906112b7565b600b555050565b60008183106111715781611173565b825b9392505050565b6001600160a01b0381168114610aa157600080fd5b6000602082840312156111a157600080fd5b81356111738161117a565b600080604083850312156111bf57600080fd5b82356111ca8161117a565b915060208301356111da8161117a565b809150509250929050565b6000602082840312156111f757600080fd5b5035919050565b60008060006060848603121561121357600080fd5b833561121e8161117a565b9250602084013561122e8161117a565b9150604084013561123e8161117a565b809150509250925092565b60008060006060848603121561125e57600080fd5b505081359360208301359350604090920135919050565b60006020828403121561128757600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b818103818111156103dd576103dd61128e565b808201808211156103dd576103dd61128e565b80820281158282048414176103dd576103dd61128e565b6000826112fe57634e487b7160e01b600052601260045260246000fd5b50049056fea264697066735822122047f7a06be2cd27cce006b77e96dfa6abe7c35dda6021ff2930e0c62119012f7164736f6c63430008190033

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  ]

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.