ETH Price: $3,426.94 (+3.21%)

Contract

0x67eCe41Ff3bB2942D90840Ae20f2B34404C3Fee6
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Token Holdings

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Exit Pool209740572024-10-15 22:50:3538 days ago1729032635IN
0x67eCe41F...404C3Fee6
0 ETH0.001355139.24251526
Exit Pool203625492024-07-22 14:04:47124 days ago1721657087IN
0x67eCe41F...404C3Fee6
0 ETH0.0014875610.48912855
Exit Pool195778572024-04-03 21:13:59234 days ago1712178839IN
0x67eCe41F...404C3Fee6
0 ETH0.0043547630.70626387
Exit Pool194040142024-03-10 10:11:35258 days ago1710065495IN
0x67eCe41F...404C3Fee6
0 ETH0.0078484155.3406471
Exit Pool193186972024-02-27 11:49:59270 days ago1709034599IN
0x67eCe41F...404C3Fee6
0 ETH0.0050408840.41762957
Exit Pool192548252024-02-18 12:55:59279 days ago1708260959IN
0x67eCe41F...404C3Fee6
0 ETH0.0028778820.29249009
Add Reward192319172024-02-15 7:43:47282 days ago1707983027IN
0x67eCe41F...404C3Fee6
0 ETH0.0024949819.87309089
Stake191220662024-01-30 21:40:35298 days ago1706650835IN
0x67eCe41F...404C3Fee6
0 ETH0.0034048424.35022312
Stake190832842024-01-25 11:19:23303 days ago1706181563IN
0x67eCe41F...404C3Fee6
0 ETH0.0041159130.52896031
Stake190791332024-01-24 21:19:59304 days ago1706131199IN
0x67eCe41F...404C3Fee6
0 ETH0.0014536811.17943648
Stake190661532024-01-23 1:37:11305 days ago1705973831IN
0x67eCe41F...404C3Fee6
0 ETH0.001202829.25024805
Stake190580282024-01-21 22:05:11306 days ago1705874711IN
0x67eCe41F...404C3Fee6
0 ETH0.0006164912.59882806
Stake190580262024-01-21 22:04:47306 days ago1705874687IN
0x67eCe41F...404C3Fee6
0 ETH0.0015608712.00374882
Stake190418242024-01-19 15:32:11309 days ago1705678331IN
0x67eCe41F...404C3Fee6
0 ETH0.004833150.43314341
Stake190412092024-01-19 13:28:47309 days ago1705670927IN
0x67eCe41F...404C3Fee6
0 ETH0.0042754132.87972858
Stake190338762024-01-18 12:54:11310 days ago1705582451IN
0x67eCe41F...404C3Fee6
0 ETH0.0043510331.16874196
Stake190303082024-01-18 0:55:35310 days ago1705539335IN
0x67eCe41F...404C3Fee6
0 ETH0.0047450235.2015614
Stake190275182024-01-17 15:32:11311 days ago1705505531IN
0x67eCe41F...404C3Fee6
0 ETH0.0070363752.19087509
Stake190206812024-01-16 16:35:23312 days ago1705422923IN
0x67eCe41F...404C3Fee6
0 ETH0.005641343.3919493
Stake190187492024-01-16 10:07:23312 days ago1705399643IN
0x67eCe41F...404C3Fee6
0 ETH0.0040834430.29081942
Stake190177342024-01-16 6:43:23312 days ago1705387403IN
0x67eCe41F...404C3Fee6
0 ETH0.0027862120.66801445
Stake190152002024-01-15 22:14:59312 days ago1705356899IN
0x67eCe41F...404C3Fee6
0 ETH0.003970530.53483421
Stake190151122024-01-15 21:57:23312 days ago1705355843IN
0x67eCe41F...404C3Fee6
0 ETH0.0029435321.83499244
Stake190146972024-01-15 20:33:47313 days ago1705350827IN
0x67eCe41F...404C3Fee6
0 ETH0.0038028229.24533588
Stake190144242024-01-15 19:39:11313 days ago1705347551IN
0x67eCe41F...404C3Fee6
0 ETH0.0034049626.19040026
View all transactions

Latest 1 internal transaction

Advanced mode:
Parent Transaction Hash Block From To
190085432024-01-14 23:55:47313 days ago1705276547  Contract Creation0 ETH
Loading...
Loading

Similar Match Source Code
This contract matches the deployed Bytecode of the Source Code for Contract 0x2259c8B7...9AdE60a9E
The constructor portion of the code might be different and could alter the actual behaviour of the contract

Contract Name:
StakePool

Compiler Version
v0.8.20+commit.a1b79de6

Optimization Enabled:
No with 200 runs

Other Settings:
paris EvmVersion
File 1 of 12 : StakePool.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import "./StakePoolRewardable.sol";
import "./StakePoolOptimized.sol";

import "@openzeppelin/contracts/interfaces/IERC20.sol";
import "./interfaces/IStakePoolFactory.sol";

contract StakePool is StakePoolOptimized, StakePoolRewardable {
    address public factory;

    constructor(
        string memory name_,
        address tokenAddress_,
        address rewardTokenAddress_,
        uint stakingStarts_,
        uint stakingEnds_,
        uint withdrawStarts_,
        uint withdrawEnds_,
        uint256 stakingCap_
    )
        StakePoolOptimized(
            name_,
            tokenAddress_,
            stakingStarts_,
            stakingEnds_,
            withdrawStarts_,
            withdrawEnds_,
            stakingCap_
        )
    {
        require(
            rewardTokenAddress_ != address(0),
            "StakingPool: 0 reward address"
        );
        rewardTokenAddress = rewardTokenAddress_;
        factory = msg.sender;
    }

    modifier onlyOwner() {
        require(
            msg.sender == IStakePoolFactory(factory).owner(),
            "StakePool: caller is not the owner"
        );
        _;
    }

    function rewardOf(address account) external view returns (uint256) {
        return
            StakeLibrary.calculateReward(
                account,
                stakeState._stakes[account],
                withdrawEnds,
                stakingEnds,
                stakeState,
                rewardState
            );
    }

    function _annualize(
        uint256 reward,
        uint256 year,
        uint256 dt
    ) internal pure returns (uint256) {
        return (reward * year) / dt;
    }

    function minimumRewardMaturity() external view returns (uint256) {
        uint256 dt = withdrawEnds - stakingEnds;
        uint256 amount = 1e18;
        if (stakingCap > 0) {
            amount = stakingCap;
        } else {
            amount = stakeState.stakedTotal;
        }

        if (amount == 0) {
            return 0;
        }

        uint256 reward = StakeLibrary.calculateReward(
            address(0),
            amount,
            withdrawEnds,
            stakingEnds,
            stakeState,
            rewardState
        );

        return _annualize(reward, 365 days, dt);
    }

    function calculatedReward() external view returns (uint256) {
        if (rewardState.rewardsTotal == 0) {
            return 0;
        }
        if (stakingCap > 0) {
            return
                StakeLibrary.calculateReward(
                    address(0),
                    stakingCap,
                    withdrawEnds,
                    stakingEnds,
                    stakeState,
                    rewardState
                );
        } else {
            return
                StakeLibrary.calculateReward(
                    address(0),
                    stakeState.stakedTotal,
                    withdrawEnds,
                    stakingEnds,
                    stakeState,
                    rewardState
                );
        }
    }

    function addReward(
        uint256 rewardAmount,
        uint256 withdrawableAmount
    ) external onlyOwner returns (bool) {
        return
            StakeLibrary.addReward(
                rewardAmount,
                withdrawableAmount,
                rewardTokenAddress,
                rewardState
            );
    }

    function addMarginalReward(
        uint256 withdrawableAmount
    ) external onlyOwner returns (bool) {
        return
            StakeLibrary.addMarginalReward(
                rewardTokenAddress,
                tokenAddress,
                address(this),
                stakedBalance(),
                withdrawableAmount,
                rewardState
            );
    }

    function stakeFor(
        address staker,
        uint256 amount
    ) external override returns (bool) {
        uint256 amountStaked = _stake(msg.sender, staker, amount);
        IStakePoolFactory(factory).addTokensTo(staker, amountStaked);
        return amountStaked > 0;
    }

    function stake(uint256 amount) external override returns (bool) {
        uint256 amountStaked = _stake(msg.sender, msg.sender, amount);
        IStakePoolFactory(factory).addTokensTo(msg.sender, amountStaked);
        return amountStaked > 0;
    }

    function exitPool() external returns (bool) {
        IStakePoolFactory(factory).removeTokensFrom(
            msg.sender,
            stakeState._stakes[msg.sender]
        );
        return
            StakeLibrary.withdraw(
                msg.sender,
                tokenAddress,
                rewardTokenAddress,
                stakeState._stakes[msg.sender],
                withdrawStarts,
                withdrawEnds,
                stakingEnds,
                stakeState,
                rewardState
            );
    }

    function claimReward() public returns (bool) {
        return
            StakeLibrary.claimReward(
                msg.sender,
                rewardTokenAddress,
                withdrawStarts,
                withdrawEnds,
                stakingEnds,
                stakeState,
                rewardState
            );
    }

    function emergencyWithdraw(address _token) public onlyOwner {
        if (_token == address(0)) {
            payable(msg.sender).transfer(address(this).balance);
        } else {
            uint256 balance = IERC20(_token).balanceOf(address(this));
            IERC20(_token).transfer(msg.sender, balance);
        }
    }
}

File 2 of 12 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC20.sol)

pragma solidity ^0.8.20;

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

File 3 of 12 : IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 *
 * ==== Security Considerations
 *
 * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature
 * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be
 * considered as an intention to spend the allowance in any specific way. The second is that because permits have
 * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should
 * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be
 * generally recommended is:
 *
 * ```solidity
 * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {
 *     try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}
 *     doThing(..., value);
 * }
 *
 * function doThing(..., uint256 value) public {
 *     token.safeTransferFrom(msg.sender, address(this), value);
 *     ...
 * }
 * ```
 *
 * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of
 * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also
 * {SafeERC20-safeTransferFrom}).
 *
 * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so
 * contracts should have entry points that don't rely on permit.
 */
interface IERC20Permit {
    /**
     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
     * given ``owner``'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     *
     * CAUTION: See Security Considerations above.
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    /**
     * @dev Returns the current nonce for `owner`. This value must be
     * included whenever a signature is generated for {permit}.
     *
     * Every successful call to {permit} increases ``owner``'s nonce by one. This
     * prevents a signature from being used multiple times.
     */
    function nonces(address owner) external view returns (uint256);

    /**
     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view returns (bytes32);
}

File 4 of 12 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.20;

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

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

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

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

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

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

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

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

File 5 of 12 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.20;

import {IERC20} from "../IERC20.sol";
import {IERC20Permit} from "../extensions/IERC20Permit.sol";
import {Address} from "../../../utils/Address.sol";

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

    /**
     * @dev An operation with an ERC20 token failed.
     */
    error SafeERC20FailedOperation(address token);

    /**
     * @dev Indicates a failed `decreaseAllowance` request.
     */
    error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);

    /**
     * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeTransfer(IERC20 token, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));
    }

    /**
     * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
     * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
     */
    function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));
    }

    /**
     * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 oldAllowance = token.allowance(address(this), spender);
        forceApprove(token, spender, oldAllowance + value);
    }

    /**
     * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no
     * value, non-reverting calls are assumed to be successful.
     */
    function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {
        unchecked {
            uint256 currentAllowance = token.allowance(address(this), spender);
            if (currentAllowance < requestedDecrease) {
                revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);
            }
            forceApprove(token, spender, currentAllowance - requestedDecrease);
        }
    }

    /**
     * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
     * to be set to zero before setting it to a non-zero value, such as USDT.
     */
    function forceApprove(IERC20 token, address spender, uint256 value) internal {
        bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));

        if (!_callOptionalReturnBool(token, approvalCall)) {
            _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));
            _callOptionalReturn(token, approvalCall);
        }
    }

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

        bytes memory returndata = address(token).functionCall(data);
        if (returndata.length != 0 && !abi.decode(returndata, (bool))) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     *
     * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
     */
    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false
        // and not revert is the subcall reverts.

        (bool success, bytes memory returndata) = address(token).call(data);
        return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && address(token).code.length > 0;
    }
}

File 6 of 12 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)

pragma solidity ^0.8.20;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev The ETH balance of the account is not enough to perform the operation.
     */
    error AddressInsufficientBalance(address account);

    /**
     * @dev There's no code at `target` (it is not a contract).
     */
    error AddressEmptyCode(address target);

    /**
     * @dev A call to an address target failed. The target may have reverted.
     */
    error FailedInnerCall();

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

        (bool success, ) = recipient.call{value: amount}("");
        if (!success) {
            revert FailedInnerCall();
        }
    }

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

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
        if (address(this).balance < value) {
            revert AddressInsufficientBalance(address(this));
        }
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target
     * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an
     * unsuccessful call.
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata
    ) internal view returns (bytes memory) {
        if (!success) {
            _revert(returndata);
        } else {
            // only check if target is a contract if the call was successful and the return data is empty
            // otherwise we already know that it was a contract
            if (returndata.length == 0 && target.code.length == 0) {
                revert AddressEmptyCode(target);
            }
            return returndata;
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the
     * revert reason or with a default {FailedInnerCall} error.
     */
    function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {
        if (!success) {
            _revert(returndata);
        } else {
            return returndata;
        }
    }

    /**
     * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.
     */
    function _revert(bytes memory returndata) private pure {
        // Look for revert reason and bubble it up if present
        if (returndata.length > 0) {
            // The easiest way to bubble the revert reason is using memory via assembly
            /// @solidity memory-safe-assembly
            assembly {
                let returndata_size := mload(returndata)
                revert(add(32, returndata), returndata_size)
            }
        } else {
            revert FailedInnerCall();
        }
    }
}

File 7 of 12 : SafeAmount.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";

library SafeAmount {
    using SafeERC20 for IERC20;

    function safeTransferFrom(
        address token,
        address from,
        address to,
        uint256 amount
    ) internal returns (uint256) {
        uint256 preBalance = IERC20(token).balanceOf(to);
        IERC20(token).transferFrom(from, to, amount);
        uint256 postBalance = IERC20(token).balanceOf(to);
        return postBalance - preBalance;
    }
}

File 8 of 12 : IStakePool.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

/**
 * @dev StakingPool interface
 */
interface IStakePool {
    event Staked(
        address indexed token,
        address indexed staker_,
        uint256 requestedAmount_,
        uint256 stakedAmount_
    );
    event PaidOut(
        address indexed token,
        address indexed rewardToken,
        address indexed staker_,
        uint256 amount_,
        uint256 reward_
    );

    function stake(uint256 amount) external returns (bool);

    function stakeFor(address staker, uint256 amount) external returns (bool);

    function stakeOf(address account) external view returns (uint256);

    function tokenAddress() external view returns (address);

    function stakedTotal() external view returns (uint256);

    function stakedBalance() external view returns (uint256);

    function stakingStarts() external view returns (uint256);

    function stakingEnds() external view returns (uint256);
}

File 9 of 12 : IStakePoolFactory.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

interface IStakePoolFactory {
    function owner() external view returns (address);

    function addTokensTo(address to, uint256 amount) external returns (uint256);

    function removeTokensFrom(
        address from,
        uint256 amount
    ) external returns (uint256);
}

File 10 of 12 : StakeLibrary.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import "../common/SafeAmount.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";

library StakeLibrary {
    using SafeERC20 for IERC20;
    event Staked(
        address indexed token,
        address indexed staker_,
        uint256 requestedAmount_,
        uint256 stakedAmount_
    );
    event PaidOut(
        address indexed token,
        address indexed rewardToken,
        address indexed staker_,
        uint256 amount_,
        uint256 reward_
    );

    struct StakeState {
        uint256 stakedTotal;
        uint256 stakedBalance;
        uint256 withdrawnEarly;
        mapping(address => uint256) _stakes;
    }

    struct StakeRewardState {
        uint256 rewardBalance;
        uint256 rewardsTotal;
        uint256 earlyWithdrawReward;
        mapping(address => uint256) _claimed;
    }

    function VERSION() external pure returns (uint) {
        return 2001;
    }

    function tryStake(
        address payer,
        address staker,
        uint256 amount,
        uint256 stakingStarts,
        uint256 stakingEnds,
        uint256 stakingCap,
        address tokenAddress,
        StakeState storage state
    )
        public
        _after(stakingStarts)
        _before(stakingEnds)
        _positive(amount)
        returns (uint256)
    {
        // check the remaining amount to be staked
        // For pay per transfer tokens we limit the cap on incoming tokens for simplicity. This might
        // mean that cap may not necessary fill completely which is ok.
        uint256 remaining = amount;
        // uint256 stakedTotal = state.stakedTotal;
        {
            uint256 stakedBalance = state.stakedBalance;
            if (stakingCap > 0 && remaining > (stakingCap - stakedBalance)) {
                remaining = stakingCap - stakedBalance;
            }
        }
        // These requires are not necessary, because it will never happen, but won't hurt to double check
        // this is because stakedTotal and stakedBalance are only modified in this method during the staking period
        require(remaining > 0, "StakeLibrary: Staking cap is filled");
        // require((remaining + stakedTotal) <= stakingCap, "StakeLibrary: this will increase staking amount pass the cap");
        // Update remaining in case actual amount paid was different.
        remaining = _payMe(payer, remaining, tokenAddress);
        emit Staked(tokenAddress, staker, amount, remaining);

        // Transfer is completed
        return remaining;
    }

    function stake(
        address payer,
        address staker,
        uint256 amount,
        uint256 stakingStarts,
        uint256 stakingEnds,
        uint256 stakingCap,
        address tokenAddress,
        StakeState storage state
    ) external returns (uint256) {
        uint256 remaining = tryStake(
            payer,
            staker,
            amount,
            stakingStarts,
            stakingEnds,
            stakingCap,
            tokenAddress,
            state
        );

        // Transfer is completed
        state.stakedBalance = state.stakedBalance + remaining;
        state.stakedTotal = state.stakedTotal + remaining;
        state._stakes[staker] = state._stakes[staker] + remaining;

        // return the amount staked
        return remaining;
    }

    function addReward(
        uint256 rewardAmount,
        uint256 withdrawableAmount,
        address rewardTokenAddress,
        StakeRewardState storage state
    ) external returns (bool) {
        require(rewardAmount > 0, "StakeLibrary: reward must be positive");
        require(
            withdrawableAmount >= 0,
            "StakeLibrary: withdrawable amount cannot be negative"
        );
        require(
            withdrawableAmount <= rewardAmount,
            "StakeLibrary: withdrawable amount must be less than or equal to the reward amount"
        );
        address from = msg.sender;
        rewardAmount = _payMe(from, rewardAmount, rewardTokenAddress);

        state.rewardsTotal += rewardAmount;
        state.rewardBalance += rewardAmount;
        state.earlyWithdrawReward += withdrawableAmount;

        return true;
    }

    function addMarginalReward(
        address rewardTokenAddress,
        address tokenAddress,
        address me,
        uint256 stakedBalance,
        uint256 earlyWithdrawReward,
        StakeRewardState storage state
    ) external returns (bool) {
        uint256 amount = IERC20(rewardTokenAddress).balanceOf(me) -
            state.rewardsTotal;

        // if the reward token is the same as the staking token, then we need to subtract the staked balance
        if (rewardTokenAddress == tokenAddress) {
            amount = amount - stakedBalance;
        }

        // just in case but should never happen
        require(amount >= 0, "StakeLibrary: negative reward");
        if (amount == 0) {
            return true; // No reward to add. Its ok. No need to fail callers.
        }

        // if the early reward is bigger then revert
        require(
            amount >= earlyWithdrawReward,
            "StakeLibrary: reward must be greater than or equal to the early withdraw reward"
        );

        state.rewardsTotal += amount;
        state.rewardBalance += amount;
        state.earlyWithdrawReward += earlyWithdrawReward;

        return true;
    }

    function tryClaimReward(
        address from,
        address rewardTokenAddress,
        uint256 withdrawStarts,
        uint256 withdrawEnds,
        uint256 stakingEnds,
        StakeState storage state,
        StakeRewardState storage rewardState
    ) public _after(withdrawStarts) _realAddress(msg.sender) returns (uint256) {
        uint256 staked = state._stakes[from];
        require(staked > 0, "StakeLibrary: no staked balance");
        return
            _claimReward(
                rewardTokenAddress,
                from,
                withdrawEnds,
                stakingEnds,
                state,
                rewardState
            );
    }

    function claimReward(
        address from,
        address rewardTokenAddress,
        uint256 withdrawStarts,
        uint256 withdrawEnds,
        uint256 stakingEnds,
        StakeState storage state,
        StakeRewardState storage rewardState
    ) public returns (bool) {
        tryClaimReward(
            from,
            rewardTokenAddress,
            withdrawStarts,
            withdrawEnds,
            stakingEnds,
            state,
            rewardState
        );
        return true;
    }

    function tryWithdraw(
        address from,
        address tokenAddress,
        address rewardTokenAddress,
        uint256 amount,
        uint256 withdrawStarts,
        uint256 withdrawEnds,
        uint256 stakingEnds,
        StakeState storage state,
        StakeRewardState storage rewardState
    )
        public
        _after(withdrawStarts)
        _positive(amount)
        _realAddress(msg.sender)
        returns (uint256)
    {
        require(
            amount <= state._stakes[from],
            "StakeLibrary: not enough balance"
        );

        return
            _withdraw(
                tokenAddress,
                rewardTokenAddress,
                from,
                amount,
                withdrawEnds,
                stakingEnds,
                state,
                rewardState
            );
    }

    function withdraw(
        address from,
        address tokenAddress,
        address rewardTokenAddress,
        uint256 amount,
        uint256 withdrawStarts,
        uint256 withdrawEnds,
        uint256 stakingEnds,
        StakeState storage state,
        StakeRewardState storage rewardState
    ) public returns (bool) {
        uint256 wdAmount = tryWithdraw(
            from,
            tokenAddress,
            rewardTokenAddress,
            amount,
            withdrawStarts,
            withdrawEnds,
            stakingEnds,
            state,
            rewardState
        );
        state.stakedBalance = state.stakedBalance - wdAmount;
        state._stakes[from] = state._stakes[from] - wdAmount;
        return true;
    }

    function calculateReward(
        address from,
        uint256 amount,
        uint256 withdrawEnds,
        uint256 stakingEnds,
        StakeState storage state,
        StakeRewardState storage rewardState
    ) public view returns (uint256) {
        if (amount == 0) {
            return 0;
        }

        uint256 claimed = rewardState._claimed[from];
        uint256 reward = 0;

        if (block.timestamp < withdrawEnds) {
            reward = _calculateRewardEarly(
                amount,
                withdrawEnds,
                stakingEnds,
                state,
                rewardState
            );
        } else {
            reward = _calculateRewardAfterClose(amount, state, rewardState);
        }

        return reward - claimed;
    }

    function _calculateRewardEarly(
        uint256 amount,
        uint256 withdrawEnds,
        uint256 stakingEnds,
        StakeState storage state,
        StakeRewardState storage rewardState
    ) private view returns (uint256) {
        // if the pool is not over, then no reward yet
        if (stakingEnds >= block.timestamp) {
            return 0;
        }

        uint256 denom = (withdrawEnds - stakingEnds) * state.stakedTotal;
        uint256 reward = ((block.timestamp - stakingEnds) *
            rewardState.earlyWithdrawReward *
            amount) / denom;
        return reward;
    }

    function _calculateRewardAfterClose(
        uint256 amount,
        StakeState storage state,
        StakeRewardState storage rewardState
    ) private view returns (uint256) {
        uint256 rewBal = rewardState.rewardBalance;
        uint256 reward = (rewBal * amount) / state.stakedBalance;
        return reward;
    }

    function _claimReward(
        address rewardTokenAddress,
        address from,
        uint256 withdrawEnds,
        uint256 stakingEnds,
        StakeState storage state,
        StakeRewardState storage rewardState
    ) private _realAddress(from) returns (uint256) {
        uint256 amount = state._stakes[from];
        uint256 reward = calculateReward(
            from,
            amount,
            withdrawEnds,
            stakingEnds,
            state,
            rewardState
        );
        rewardState.rewardBalance -= reward;
        rewardState._claimed[from] += reward;
        bool paid = _payDirect(from, reward, rewardTokenAddress);
        require(paid, "StakeLibrary: error paying");
        emit PaidOut(
            rewardTokenAddress,
            rewardTokenAddress,
            from,
            amount,
            reward
        );
        return reward;
    }

    function _withdraw(
        address tokenAddress,
        address rewardTokenAddress,
        address from,
        uint256 amount,
        uint256 withdrawEnds,
        uint256 stakingEnds,
        StakeState storage state,
        StakeRewardState storage rewardState
    ) private _realAddress(from) returns (uint256) {
        uint256 reward = calculateReward(
            from,
            amount,
            withdrawEnds,
            stakingEnds,
            state,
            rewardState
        );
        rewardState.rewardBalance -= reward;
        rewardState._claimed[from] += reward;
        bool principalPaid = _payDirect(from, amount, tokenAddress);
        bool rewardPaid = _payDirect(from, reward, rewardTokenAddress);
        require(principalPaid && rewardPaid, "StakeLibrary: error paying");
        emit PaidOut(tokenAddress, rewardTokenAddress, from, amount, reward);
        return amount;
    }

    function _payMe(
        address payer,
        uint256 amount,
        address token
    ) internal returns (uint256) {
        return _payTo(payer, address(this), amount, token);
    }

    function _payTo(
        address allower,
        address receiver,
        uint256 amount,
        address token
    ) internal returns (uint256) {
        // Request to transfer amount from the contract to receiver.
        // contract does not own the funds, so the allower must have added allowance to the contract
        // Allower is the original owner.
        return SafeAmount.safeTransferFrom(token, allower, receiver, amount);
    }

    function _payDirect(
        address to,
        uint256 amount,
        address token
    ) internal returns (bool) {
        if (amount == 0) {
            return true;
        }
        IERC20(token).safeTransfer(to, amount);
        return true;
    }

    modifier _realAddress(address addr) {
        require(addr != address(0), "StakeLibrary: zero address");
        _;
    }

    modifier _positive(uint256 amount) {
        require(amount != 0, "StakeLibrary: negative amount");
        _;
    }

    modifier _after(uint eventTime) {
        require(
            block.timestamp >= eventTime,
            "StakeLibrary: bad after timing for the request"
        );
        _;
    }

    modifier _before(uint eventTime) {
        require(
            block.timestamp < eventTime,
            "StakeLibrary: bad before timing for the request"
        );
        _;
    }
}

File 11 of 12 : StakePoolOptimized.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import "./interfaces/IStakePool.sol";
import "./libraries/StakeLibrary.sol";

abstract contract StakePoolOptimized is IStakePool {
    string private _name;
    address public override tokenAddress;
    uint public override stakingStarts;
    uint public override stakingEnds;
    uint public withdrawStarts;
    uint public withdrawEnds;
    uint public stakingCap;
    StakeLibrary.StakeState public stakeState;
    uint constant LIB_VERSION = 2001;

    constructor(
        string memory name_,
        address tokenAddress_,
        uint stakingStarts_,
        uint stakingEnds_,
        uint withdrawStarts_,
        uint withdrawEnds_,
        uint256 stakingCap_
    ) {
        require(
            StakeLibrary.VERSION() == LIB_VERSION,
            "Bad linked library version"
        );

        _name = name_;

        require(tokenAddress_ != address(0), "StakingPool: 0 address");
        tokenAddress = tokenAddress_;

        if (stakingStarts_ < block.timestamp) {
            stakingStarts = block.timestamp;
        } else {
            stakingStarts = stakingStarts_;
        }

        require(
            stakingEnds_ >= stakingStarts,
            "StakingPool: staking end must be after staking starts"
        );
        stakingEnds = stakingEnds_;

        require(
            withdrawStarts_ >= stakingEnds,
            "StakingPool: withdrawStarts must be after staking ends"
        );
        withdrawStarts = withdrawStarts_;

        require(
            withdrawEnds_ >= withdrawStarts,
            "StakingPool: withdrawEnds must be after withdraw starts"
        );
        withdrawEnds = withdrawEnds_;

        require(stakingCap_ >= 0, "StakingPool: stakingCap cannot be negative");
        stakingCap = stakingCap_;
    }

    function name() external view returns (string memory) {
        return _name;
    }

    function stakedTotal() external view override returns (uint256) {
        return stakeState.stakedTotal;
    }

    function stakedBalance() public view override returns (uint256) {
        return stakeState.stakedBalance;
    }

    function stakeOf(address account) external view override returns (uint256) {
        return stakeState._stakes[account];
    }

    function _stake(
        address payer,
        address staker,
        uint256 amount
    ) internal virtual returns (uint256) {
        return
            StakeLibrary.stake(
                payer,
                staker,
                amount,
                stakingStarts,
                stakingEnds,
                stakingCap,
                tokenAddress,
                stakeState
            );
    }
}

File 12 of 12 : StakePoolRewardable.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import "./interfaces/IStakePool.sol";
import "./libraries/StakeLibrary.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";

abstract contract StakePoolRewardable is IStakePool {
    using SafeERC20 for IERC20;
    address public rewardTokenAddress;
    StakeLibrary.StakeRewardState public rewardState;

    function earlyWithdrawReward() external view returns (uint256) {
        return rewardState.earlyWithdrawReward;
    }

    function rewardBalance() external view returns (uint256) {
        return rewardState.rewardBalance;
    }

    function rewardsTotal() external view returns (uint256) {
        return rewardState.rewardsTotal;
    }
}

Settings
{
  "evmVersion": "paris",
  "optimizer": {
    "enabled": false,
    "runs": 200
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "libraries": {
    "contracts/libraries/StakeLibrary.sol": {
      "StakeLibrary": "0x611fbdead231cce1481565d6dd9ec9c8f4c052f9"
    }
  }
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"string","name":"name_","type":"string"},{"internalType":"address","name":"tokenAddress_","type":"address"},{"internalType":"address","name":"rewardTokenAddress_","type":"address"},{"internalType":"uint256","name":"stakingStarts_","type":"uint256"},{"internalType":"uint256","name":"stakingEnds_","type":"uint256"},{"internalType":"uint256","name":"withdrawStarts_","type":"uint256"},{"internalType":"uint256","name":"withdrawEnds_","type":"uint256"},{"internalType":"uint256","name":"stakingCap_","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":true,"internalType":"address","name":"rewardToken","type":"address"},{"indexed":true,"internalType":"address","name":"staker_","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount_","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"reward_","type":"uint256"}],"name":"PaidOut","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":true,"internalType":"address","name":"staker_","type":"address"},{"indexed":false,"internalType":"uint256","name":"requestedAmount_","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"stakedAmount_","type":"uint256"}],"name":"Staked","type":"event"},{"inputs":[{"internalType":"uint256","name":"withdrawableAmount","type":"uint256"}],"name":"addMarginalReward","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"rewardAmount","type":"uint256"},{"internalType":"uint256","name":"withdrawableAmount","type":"uint256"}],"name":"addReward","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"calculatedReward","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"claimReward","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"earlyWithdrawReward","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"emergencyWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"exitPool","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"factory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"minimumRewardMaturity","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"rewardOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardState","outputs":[{"internalType":"uint256","name":"rewardBalance","type":"uint256"},{"internalType":"uint256","name":"rewardsTotal","type":"uint256"},{"internalType":"uint256","name":"earlyWithdrawReward","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardTokenAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardsTotal","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"stake","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"staker","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"stakeFor","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"stakeOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"stakeState","outputs":[{"internalType":"uint256","name":"stakedTotal","type":"uint256"},{"internalType":"uint256","name":"stakedBalance","type":"uint256"},{"internalType":"uint256","name":"withdrawnEarly","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"stakedBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"stakedTotal","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"stakingCap","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"stakingEnds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"stakingStarts","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokenAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdrawEnds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdrawStarts","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106101a95760003560e01c80636ff1c9bc116100f9578063b410e2a111610097578063bf8dde4d11610071578063bf8dde4d146104ce578063c45a0155146104ec578063d66692a71461050a578063eacebf6114610528576101a9565b8063b410e2a114610474578063b88a802f14610492578063bb2d7f3a146104b0576101a9565b80639d76ea58116100d35780639d76ea58146103ea578063a694fc3a14610408578063a941c2ad14610438578063aa5c3ab414610456576101a9565b80636ff1c9bc1461037e57806375c93bb91461039a5780638c09a2f9146103ca576101a9565b80632ee409081161016657806344c370d31161014057806344c370d314610304578063582c7928146103225780635b9f0016146103425780636d68c7d414610360576101a9565b80632ee40908146102865780633f7fd60a146102b657806342623360146102d4576101a9565b806306fdde03146101ae578063125f9e33146101cc5780631d62ebd9146101ea57806321b13cdf1461021a5780632853c542146102385780632991795414610268575b600080fd5b6101b6610546565b6040516101c391906115d2565b60405180910390f35b6101d46105d8565b6040516101e19190611635565b60405180910390f35b61020460048036038101906101ff9190611681565b6105fe565b60405161021191906116c7565b60405180910390f35b6102226106d1565b60405161022f91906116c7565b60405180910390f35b610252600480360381019061024d919061170e565b6106d7565b60405161025f9190611756565b60405180910390f35b6102706108ac565b60405161027d9190611756565b60405180910390f35b6102a0600480360381019061029b9190611771565b610aac565b6040516102ad9190611756565b60405180910390f35b6102be610b6a565b6040516102cb91906116c7565b60405180910390f35b6102ee60048036038101906102e99190611681565b610b77565b6040516102fb91906116c7565b60405180910390f35b61030c610bc3565b60405161031991906116c7565b60405180910390f35b61032a610bc9565b604051610339939291906117b1565b60405180910390f35b61034a610be1565b60405161035791906116c7565b60405180910390f35b610368610bee565b60405161037591906116c7565b60405180910390f35b61039860048036038101906103939190611681565b610bf4565b005b6103b460048036038101906103af91906117e8565b610e74565b6040516103c19190611756565b60405180910390f35b6103d261101d565b6040516103e1939291906117b1565b60405180910390f35b6103f2611035565b6040516103ff9190611635565b60405180910390f35b610422600480360381019061041d919061170e565b61105b565b60405161042f9190611756565b60405180910390f35b610440611118565b60405161044d91906116c7565b60405180910390f35b61045e611210565b60405161046b91906116c7565b60405180910390f35b61047c61121d565b60405161048991906116c7565b60405180910390f35b61049a611223565b6040516104a79190611756565b60405180910390f35b6104b86112d8565b6040516104c591906116c7565b60405180910390f35b6104d66112e5565b6040516104e391906116c7565b60405180910390f35b6104f461142d565b6040516105019190611635565b60405180910390f35b610512611453565b60405161051f91906116c7565b60405180910390f35b610530611460565b60405161053d91906116c7565b60405180910390f35b60606000805461055590611857565b80601f016020809104026020016040519081016040528092919081815260200182805461058190611857565b80156105ce5780601f106105a3576101008083540402835291602001916105ce565b820191906000526020600020905b8154815290600101906020018083116105b157829003601f168201915b5050505050905090565b600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600073611fbdead231cce1481565d6dd9ec9c8f4c052f9630eedc00083600760030160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546005546003546007600c6040518763ffffffff1660e01b8152600401610689969594939291906118b4565b602060405180830381865af41580156106a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106ca919061192a565b9050919050565b60045481565b6000601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610746573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061076a919061196c565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146107d7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107ce90611a0b565b60405180910390fd5b73611fbdead231cce1481565d6dd9ec9c8f4c052f96328a0a21c600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1630610840610be1565b87600c6040518763ffffffff1660e01b815260040161086496959493929190611a2b565b602060405180830381865af4158015610881573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108a59190611ab8565b9050919050565b6000601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f8d3686b33600760030160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546040518363ffffffff1660e01b815260040161094d929190611ae5565b6020604051808303816000875af115801561096c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610990919061192a565b5073611fbdead231cce1481565d6dd9ec9c8f4c052f9633e408a5e33600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600760030160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546004546005546003546007600c6040518a63ffffffff1660e01b8152600401610a6699989796959493929190611b0e565b602060405180830381865af4158015610a83573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aa79190611ab8565b905090565b600080610aba338585611466565b9050601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635e91e0ec85836040518363ffffffff1660e01b8152600401610b19929190611ae5565b6020604051808303816000875af1158015610b38573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b5c919061192a565b506000811191505092915050565b6000600c60020154905090565b6000600760030160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60065481565b600c8060000154908060010154908060020154905083565b6000600760010154905090565b60025481565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610c61573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c85919061196c565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610cf2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ce990611a0b565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610d72573373ffffffffffffffffffffffffffffffffffffffff166108fc479081150290604051600060405180830381858888f19350505050158015610d6c573d6000803e3d6000fd5b50610e71565b60008173ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401610dad9190611635565b602060405180830381865afa158015610dca573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dee919061192a565b90508173ffffffffffffffffffffffffffffffffffffffff1663a9059cbb33836040518363ffffffff1660e01b8152600401610e2b929190611ae5565b6020604051808303816000875af1158015610e4a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e6e9190611ab8565b50505b50565b6000601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610ee3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f07919061196c565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614610f74576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f6b90611a0b565b60405180910390fd5b73611fbdead231cce1481565d6dd9ec9c8f4c052f963ebe57f0d8484600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600c6040518563ffffffff1660e01b8152600401610fd49493929190611b9b565b602060405180830381865af4158015610ff1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110159190611ab8565b905092915050565b60078060000154908060010154908060020154905083565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600080611069333385611466565b9050601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16635e91e0ec33836040518363ffffffff1660e01b81526004016110c8929190611ae5565b6020604051808303816000875af11580156110e7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061110b919061192a565b5060008111915050919050565b60008060035460055461112b9190611c0f565b90506000670de0b6b3a764000090506000600654111561114f576006549050611158565b60076000015490505b6000810361116b5760009250505061120d565b600073611fbdead231cce1481565d6dd9ec9c8f4c052f9630eedc0006000846005546003546007600c6040518763ffffffff1660e01b81526004016111b5969594939291906118b4565b602060405180830381865af41580156111d2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111f6919061192a565b9050611207816301e1338085611520565b93505050505b90565b6000600c60000154905090565b60035481565b600073611fbdead231cce1481565d6dd9ec9c8f4c052f963f6d3fdf033600b60009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166004546005546003546007600c6040518863ffffffff1660e01b81526004016112929796959493929190611c43565b602060405180830381865af41580156112af573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112d39190611ab8565b905090565b6000600c60010154905090565b600080600c60010154036112fc576000905061142a565b600060065411156113995773611fbdead231cce1481565d6dd9ec9c8f4c052f9630eedc00060006006546005546003546007600c6040518763ffffffff1660e01b8152600401611351969594939291906118b4565b602060405180830381865af415801561136e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611392919061192a565b905061142a565b73611fbdead231cce1481565d6dd9ec9c8f4c052f9630eedc00060006007600001546005546003546007600c6040518763ffffffff1660e01b81526004016113e6969594939291906118b4565b602060405180830381865af4158015611403573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611427919061192a565b90505b90565b601060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600760000154905090565b60055481565b600073611fbdead231cce1481565d6dd9ec9c8f4c052f9635e4ef591858585600254600354600654600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1660076040518963ffffffff1660e01b81526004016114d6989796959493929190611cb2565b602060405180830381865af41580156114f3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611517919061192a565b90509392505050565b600081838561152f9190611d30565b6115399190611da1565b90509392505050565b600081519050919050565b600082825260208201905092915050565b60005b8381101561157c578082015181840152602081019050611561565b60008484015250505050565b6000601f19601f8301169050919050565b60006115a482611542565b6115ae818561154d565b93506115be81856020860161155e565b6115c781611588565b840191505092915050565b600060208201905081810360008301526115ec8184611599565b905092915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061161f826115f4565b9050919050565b61162f81611614565b82525050565b600060208201905061164a6000830184611626565b92915050565b600080fd5b61165e81611614565b811461166957600080fd5b50565b60008135905061167b81611655565b92915050565b60006020828403121561169757611696611650565b5b60006116a58482850161166c565b91505092915050565b6000819050919050565b6116c1816116ae565b82525050565b60006020820190506116dc60008301846116b8565b92915050565b6116eb816116ae565b81146116f657600080fd5b50565b600081359050611708816116e2565b92915050565b60006020828403121561172457611723611650565b5b6000611732848285016116f9565b91505092915050565b60008115159050919050565b6117508161173b565b82525050565b600060208201905061176b6000830184611747565b92915050565b6000806040838503121561178857611787611650565b5b60006117968582860161166c565b92505060206117a7858286016116f9565b9150509250929050565b60006060820190506117c660008301866116b8565b6117d360208301856116b8565b6117e060408301846116b8565b949350505050565b600080604083850312156117ff576117fe611650565b5b600061180d858286016116f9565b925050602061181e858286016116f9565b9150509250929050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000600282049050600182168061186f57607f821691505b60208210810361188257611881611828565b5b50919050565b61189181611614565b82525050565b6118a0816116ae565b82525050565b8082525050565b8082525050565b600060c0820190506118c96000830189611888565b6118d66020830188611897565b6118e36040830187611897565b6118f06060830186611897565b6118fd60808301856118a6565b61190a60a08301846118ad565b979650505050505050565b600081519050611924816116e2565b92915050565b6000602082840312156119405761193f611650565b5b600061194e84828501611915565b91505092915050565b60008151905061196681611655565b92915050565b60006020828403121561198257611981611650565b5b600061199084828501611957565b91505092915050565b7f5374616b65506f6f6c3a2063616c6c6572206973206e6f7420746865206f776e60008201527f6572000000000000000000000000000000000000000000000000000000000000602082015250565b60006119f560228361154d565b9150611a0082611999565b604082019050919050565b60006020820190508181036000830152611a24816119e8565b9050919050565b600060c082019050611a406000830189611888565b611a4d6020830188611888565b611a5a6040830187611888565b611a676060830186611897565b611a746080830185611897565b611a8160a08301846118ad565b979650505050505050565b611a958161173b565b8114611aa057600080fd5b50565b600081519050611ab281611a8c565b92915050565b600060208284031215611ace57611acd611650565b5b6000611adc84828501611aa3565b91505092915050565b6000604082019050611afa6000830185611626565b611b0760208301846116b8565b9392505050565b600061012082019050611b24600083018c611888565b611b31602083018b611888565b611b3e604083018a611888565b611b4b6060830189611897565b611b586080830188611897565b611b6560a0830187611897565b611b7260c0830186611897565b611b7f60e08301856118a6565b611b8d6101008301846118ad565b9a9950505050505050505050565b6000608082019050611bb06000830187611897565b611bbd6020830186611897565b611bca6040830185611888565b611bd760608301846118ad565b95945050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000611c1a826116ae565b9150611c25836116ae565b9250828203905081811115611c3d57611c3c611be0565b5b92915050565b600060e082019050611c58600083018a611888565b611c656020830189611888565b611c726040830188611897565b611c7f6060830187611897565b611c8c6080830186611897565b611c9960a08301856118a6565b611ca660c08301846118ad565b98975050505050505050565b600061010082019050611cc8600083018b611888565b611cd5602083018a611888565b611ce26040830189611897565b611cef6060830188611897565b611cfc6080830187611897565b611d0960a0830186611897565b611d1660c0830185611888565b611d2360e08301846118a6565b9998505050505050505050565b6000611d3b826116ae565b9150611d46836116ae565b9250828202611d54816116ae565b91508282048414831517611d6b57611d6a611be0565b5b5092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000611dac826116ae565b9150611db7836116ae565b925082611dc757611dc6611d72565b5b82820490509291505056fea2646970667358221220b332a1736095c25594ffb63d259cd22e8a09b4dcd3deb81708d28d8c08dca77364736f6c63430008140033

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.