ETH Price: $3,404.59 (+3.32%)

Contract

0xFF551fEDdbeDC0AeE764139cCD9Cb644Bb04A6BD
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Token Holdings

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Withdraw212527512024-11-23 20:12:5941 mins ago1732392779IN
Stargate: Staking
0 ETH0.0017599112.8474183
Claim212502682024-11-23 11:53:359 hrs ago1732362815IN
Stargate: Staking
0 ETH0.000990069.92118935
Withdraw212501812024-11-23 11:36:119 hrs ago1732361771IN
Stargate: Staking
0 ETH0.0013707510.00917065
Claim212477022024-11-23 3:18:4717 hrs ago1732331927IN
Stargate: Staking
0 ETH0.0010208812.34552868
Withdraw212464052024-11-22 22:58:3521 hrs ago1732316315IN
Stargate: Staking
0 ETH0.0020546115
Deposit212457842024-11-22 20:53:5924 hrs ago1732308839IN
Stargate: Staking
0 ETH0.0022088217.36964254
Withdraw212451982024-11-22 18:56:3525 hrs ago1732301795IN
Stargate: Staking
0 ETH0.0020770217.3250069
Claim212441472024-11-22 15:24:1129 hrs ago1732289051IN
Stargate: Staking
0 ETH0.0012634315.27857433
Claim212432512024-11-22 12:24:1132 hrs ago1732278251IN
Stargate: Staking
0 ETH0.0010671812.90539136
Claim212432482024-11-22 12:23:3532 hrs ago1732278215IN
Stargate: Staking
0 ETH0.0011050911.07389416
Deposit212425502024-11-22 10:03:3534 hrs ago1732269815IN
Stargate: Staking
0 ETH0.0012661112.02914777
Claim212423032024-11-22 9:13:4735 hrs ago1732266827IN
Stargate: Staking
0 ETH0.000802719.70722287
Claim212417032024-11-22 7:13:1137 hrs ago1732259591IN
Stargate: Staking
0 ETH0.000799529.66864622
Claim212416942024-11-22 7:11:2337 hrs ago1732259483IN
Stargate: Staking
0 ETH0.000992019.94071308
Claim212411122024-11-22 5:13:5939 hrs ago1732252439IN
Stargate: Staking
0 ETH0.000965749.67751518
Withdraw212409562024-11-22 4:42:4740 hrs ago1732250567IN
Stargate: Staking
0 ETH0.001937614.14576756
Withdraw212400622024-11-22 1:43:1143 hrs ago1732239791IN
Stargate: Staking
0 ETH0.0013781510.06141615
Deposit212355432024-11-21 10:35:112 days ago1732185311IN
Stargate: Staking
0 ETH0.001727914.12631681
Deposit212345812024-11-21 7:21:232 days ago1732173683IN
Stargate: Staking
0 ETH0.001142629.33869323
Deposit212329502024-11-21 1:53:112 days ago1732153991IN
Stargate: Staking
0 ETH0.000968457.93128871
Claim212325612024-11-21 0:35:112 days ago1732149311IN
Stargate: Staking
0 ETH0.0010582110.60412021
Withdraw212300362024-11-20 16:07:233 days ago1732118843IN
Stargate: Staking
0 ETH0.0027834820.3212962
Withdraw212295782024-11-20 14:34:473 days ago1732113287IN
Stargate: Staking
0 ETH0.0020964417.48875518
Claim212295642024-11-20 14:31:593 days ago1732113119IN
Stargate: Staking
0 ETH0.0017649817.68649067
Claim212292932024-11-20 13:37:113 days ago1732109831IN
Stargate: Staking
0 ETH0.001289215.59023263
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:
StargateStaking

Compiler Version
v0.8.22+commit.4fc1097e

Optimization Enabled:
Yes with 5000 runs

Other Settings:
paris EvmVersion, BSL 1.1 license
File 1 of 13 : StargateStaking.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.22;

import { ReentrancyGuard } from "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import { Address } from "@openzeppelin/contracts/utils/Address.sol";
import { EnumerableSet } from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";

import { StakingLib, StakingPool } from "./lib/StakingLib.sol";
import { IStargateStaking, IRewarder, IStakingReceiver, IERC20 } from "./interfaces/IStargateStaking.sol";

/// @notice See `IStargateStaking` for documentation.
contract StargateStaking is Ownable, ReentrancyGuard, IStargateStaking {
    using EnumerableSet for EnumerableSet.AddressSet;
    using StakingLib for StakingPool;

    EnumerableSet.AddressSet private _tokens;
    mapping(IERC20 lpToken => StakingPool) private _pools;

    modifier validPool(IERC20 token) {
        _validatePool(token);
        _;
    }

    function _validatePool(IERC20 token) internal view {
        if (!_pools[token].exists) revert NonExistentPool(token);
    }

    //** ADMIN FUNCTIONS **/

    function setPool(IERC20 token, IRewarder newRewarder) external override onlyOwner {
        bool exists = _pools[token].exists;
        if (!exists) {
            _pools[token].exists = true;
            _tokens.add(address(token));
        }
        // Prevents re-adding of an old rewarder to a pool, which could lead to excessive reward distribution.
        newRewarder.connect(token);
        _pools[token].rewarder = newRewarder;

        emit PoolSet(token, newRewarder, exists);
    }

    function renounceOwnership() public view override onlyOwner {
        revert StargateStakingRenounceOwnershipDisabled();
    }

    //** USER FUNCTIONS **/

    function deposit(IERC20 token, uint256 amount) external override nonReentrant validPool(token) {
        _pools[token].deposit(token, msg.sender, msg.sender, amount);
    }

    function depositTo(IERC20 token, address to, uint256 amount) external override nonReentrant validPool(token) {
        if (!Address.isContract(msg.sender)) revert InvalidCaller();
        _pools[token].deposit(token, msg.sender, to, amount);
    }

    function withdraw(IERC20 token, uint256 amount) external override nonReentrant validPool(token) {
        _pools[token].withdraw(token, msg.sender, msg.sender, amount, true);
    }

    function withdrawToAndCall(
        IERC20 token,
        IStakingReceiver to,
        uint256 amount,
        bytes calldata data
    ) external override nonReentrant validPool(token) {
        if (!Address.isContract(address(to))) {
            revert InvalidReceiver(address(to));
        }
        _pools[token].withdraw(token, msg.sender, address(to), amount, true);
        /**
         * @dev This line reverts ambiguously if the `to` does not return a response, but is a contract. This could be
         *      solved similar to [OpenZeppelin's approach](https://github.com/OpenZeppelin/openzeppelin-contracts/blob
         *      /141c947921cc5d23ee1d247c691a8b85cabbbd5d/contracts/token/ERC1155/utils/ERC1155Utils.sol#L22), but we've
         *      opted against this for now as to avoid all inline assembly within this project.
         */
        if (to.onWithdrawReceived(token, msg.sender, amount, data) != IStakingReceiver.onWithdrawReceived.selector) {
            revert InvalidReceiver(address(to));
        }
    }

    function emergencyWithdraw(IERC20 token) external override nonReentrant validPool(token) {
        uint256 amount = _pools[token].balanceOf[msg.sender];
        _pools[token].withdraw(token, msg.sender, msg.sender, amount, false);
    }

    function claim(IERC20[] calldata lpTokens) external override nonReentrant {
        for (uint256 i = 0; i < lpTokens.length; i++) {
            IERC20 token = lpTokens[i];
            _validatePool(token);
            _pools[token].claim(token, msg.sender);
        }
    }

    //** VIEW FUNCTIONS **//

    function isPool(IERC20 token) external view override returns (bool) {
        return _pools[token].exists;
    }

    function tokensLength() external view override returns (uint256) {
        return _tokens.length();
    }

    function tokens() external view override returns (IERC20[] memory) {
        return tokens(0, _tokens.length());
    }

    function tokens(uint256 start, uint256 end) public view override returns (IERC20[] memory) {
        IERC20[] memory result = new IERC20[](end - start);
        for (uint256 i = start; i < end; i++) {
            result[i - start] = IERC20(_tokens.at(i));
        }
        return result;
    }

    function balanceOf(IERC20 token, address user) external view override returns (uint256) {
        return _pools[token].balanceOf[user];
    }

    function totalSupply(IERC20 token) external view override returns (uint256) {
        return _pools[token].totalSupply;
    }

    function rewarder(IERC20 token) external view override returns (IRewarder) {
        return _pools[token].rewarder;
    }
}

File 2 of 13 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)

pragma solidity ^0.8.0;

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

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

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

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

    /**
     * @dev 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 {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
    }

    /**
     * @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 {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _transferOwnership(newOwner);
    }

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

File 3 of 13 : ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)

pragma solidity ^0.8.0;

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

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

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        _nonReentrantBefore();
        _;
        _nonReentrantAfter();
    }

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

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

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

    /**
     * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
     * `nonReentrant` function in the call stack.
     */
    function _reentrancyGuardEntered() internal view returns (bool) {
        return _status == _ENTERED;
    }
}

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

pragma solidity ^0.8.0;

/**
 * @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 amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

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

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

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

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

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

File 5 of 13 : IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.4) (token/ERC20/extensions/IERC20Permit.sol)

pragma solidity ^0.8.0;

/**
 * @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 6 of 13 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

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

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

    /**
     * @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.encodeWithSelector(token.transfer.selector, 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.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

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

    /**
     * @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);
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));
    }

    /**
     * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        unchecked {
            uint256 oldAllowance = token.allowance(address(this), spender);
            require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));
        }
    }

    /**
     * @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.encodeWithSelector(token.approve.selector, spender, value);

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

    /**
     * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.
     * Revert on invalid signature.
     */
    function safePermit(
        IERC20Permit token,
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) internal {
        uint256 nonceBefore = token.nonces(owner);
        token.permit(owner, spender, value, deadline, v, r, s);
        uint256 nonceAfter = token.nonces(owner);
        require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
    }

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

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

    /**
     * @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.isContract(address(token));
    }
}

File 7 of 13 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)

pragma solidity ^0.8.1;

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

        return account.code.length > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://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.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

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

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

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

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

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

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

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

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

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

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
     * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
     *
     * _Available since v4.8._
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        if (success) {
            if (returndata.length == 0) {
                // only check isContract if the call was successful and the return data is empty
                // otherwise we already know that it was a contract
                require(isContract(target), "Address: call to non-contract");
            }
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason or using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    function _revert(bytes memory returndata, string memory errorMessage) 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(errorMessage);
        }
    }
}

File 8 of 13 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.4) (utils/Context.sol)

pragma solidity ^0.8.0;

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

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

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

File 9 of 13 : EnumerableSet.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/structs/EnumerableSet.sol)
// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.

pragma solidity ^0.8.0;

/**
 * @dev Library for managing
 * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
 * types.
 *
 * Sets have the following properties:
 *
 * - Elements are added, removed, and checked for existence in constant time
 * (O(1)).
 * - Elements are enumerated in O(n). No guarantees are made on the ordering.
 *
 * ```solidity
 * contract Example {
 *     // Add the library methods
 *     using EnumerableSet for EnumerableSet.AddressSet;
 *
 *     // Declare a set state variable
 *     EnumerableSet.AddressSet private mySet;
 * }
 * ```
 *
 * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
 * and `uint256` (`UintSet`) are supported.
 *
 * [WARNING]
 * ====
 * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure
 * unusable.
 * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.
 *
 * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an
 * array of EnumerableSet.
 * ====
 */
library EnumerableSet {
    // To implement this library for multiple types with as little code
    // repetition as possible, we write it in terms of a generic Set type with
    // bytes32 values.
    // The Set implementation uses private functions, and user-facing
    // implementations (such as AddressSet) are just wrappers around the
    // underlying Set.
    // This means that we can only create new EnumerableSets for types that fit
    // in bytes32.

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

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

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

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

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

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

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

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

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

            return true;
        } else {
            return false;
        }
    }

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

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

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

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

    // Bytes32Set

    struct Bytes32Set {
        Set _inner;
    }

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

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

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

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

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

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

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }

    // AddressSet

    struct AddressSet {
        Set _inner;
    }

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

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

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

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

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

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

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }

    // UintSet

    struct UintSet {
        Set _inner;
    }

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

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

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

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

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

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

        /// @solidity memory-safe-assembly
        assembly {
            result := store
        }

        return result;
    }
}

File 10 of 13 : IRewarder.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.22;

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

/**
 *  @notice A rewarder is connected to the staking contract and distributes rewards whenever the staking contract
 *          updates the rewarder.
 */
interface IRewarder {
    /**
     *  @notice This function is only callable by the staking contract.
     */
    error MultiRewarderUnauthorizedCaller(address caller);
    /**
     *  @notice The rewarder cannot be reconnected to the same staking token as it would cause wrongful reward
     *          attribution through reconfiguration.
     */
    error RewarderAlreadyConnected(IERC20 stakingToken);

    /**
     *  @notice Emitted when the rewarder is connected to a staking token.
     */
    event RewarderConnected(IERC20 indexed stakingToken);

    /**
     *  @notice Informs the rewarder of an update in the staking contract, such as a deposit, withdraw or claim.
     *  @dev Emergency withdrawals draw the balance of a user to 0, and DO NOT call `onUpdate`.
     *       The rewarder logic must keep this in mind!
     */
    function onUpdate(IERC20 token, address user, uint256 oldStake, uint256 oldSupply, uint256 newStake) external;

    /**
     *  @notice Called by the staking contract whenever this rewarder is connected to a staking token in the staking
     *          contract. Should only be callable once per staking token to avoid wrongful reward attribution through
     *          reconfiguration.
     */
    function connect(IERC20 stakingToken) external;
}

File 11 of 13 : IStakingReceiver.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.22;

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

interface IStakingReceiver {
    function onWithdrawReceived(
        IERC20 token,
        address from,
        uint256 value,
        bytes calldata data
    ) external returns (bytes4);
}

File 12 of 13 : IStargateStaking.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.22;

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

import { IStakingReceiver } from "./IStakingReceiver.sol";
import { IRewarder } from "./IRewarder.sol";

// @notice The interface to the staking contract for Stargate V2 LPs.
interface IStargateStaking {
    /// @notice StargateStaking renounce ownership is disabled.
    error StargateStakingRenounceOwnershipDisabled();

    /**
     * @notice Thrown on `depositTo` if the caller does not have bytecode, used as an anti-phishing measure to prevent
     *         users from calling `depositTo` as it's for zappers.
     */
    error InvalidCaller();

    /**
     * @notice Thrown on `withdrawToAndCall` if the `to` contract does not return the magic bytes.
     */
    error InvalidReceiver(address receiver);

    error NonExistentPool(IERC20 token);

    event Deposit(IERC20 indexed token, address indexed from, address indexed to, uint256 amount);
    event Withdraw(IERC20 indexed token, address indexed from, address indexed to, uint256 amount, bool withUpdate);
    event PoolSet(IERC20 indexed token, IRewarder rewarder, bool exists);

    /**
     * ADMIN *
     */

    /**
     * @notice Configures the rewarder for a pool. This will initialize the pool if it does not exist yet,
     *         whitelisting it for deposits.
     */
    function setPool(IERC20 token, IRewarder rewarder) external;

    /**
     * USER *
     */

    /**
     * @notice Deposits `amount` of `token` into the pool. Informs the rewarder of the deposit, triggering a harvest.
     */
    function deposit(IERC20 token, uint256 amount) external;

    /**
     * @notice Deposits `amount` of `token` into the pool for `to`. Informs the rewarder of the deposit, triggering a
     *         harvest. This function can only be called by a contract, as to prevent phishing by a malicious contract.
     * @dev This function is useful for zappers, as it allows to do multiple steps ending with a deposit,
     *      without the need to do multiple transactions.
     */
    function depositTo(IERC20 token, address to, uint256 amount) external;

    /// @notice Withdraws `amount` of `token` from the pool. Informs the rewarder of the withdrawal, triggers a harvest.
    function withdraw(IERC20 token, uint256 amount) external;

    /**
     * @notice Withdraws `amount` of `token` from the pool for `to`, and subsequently calls the receipt function on the
     *         `to` contract. Informs the rewarder of the withdrawal, triggering a harvest.
     * @dev This function is useful for zappers, as it allows to do multiple steps ending with a deposit,
     *      without the need to do multiple transactions.
     */
    function withdrawToAndCall(IERC20 token, IStakingReceiver to, uint256 amount, bytes calldata data) external;

    /// @notice Withdraws `amount` of `token` from the pool in an always-working fashion. The rewarder is not informed.
    function emergencyWithdraw(IERC20 token) external;

    /// @notice Claims the rewards from the rewarder, and sends them to the caller.
    function claim(IERC20[] calldata lpTokens) external;

    /**
     * VIEW *
     */

    /// @notice Returns the deposited balance of `user` in the pool of `token`.
    function balanceOf(IERC20 token, address user) external view returns (uint256);

    /// @notice Returns the total supply of the pool of `token`.
    function totalSupply(IERC20 token) external view returns (uint256);

    /// @notice Returns whether `token` is a pool.
    function isPool(IERC20 token) external view returns (bool);

    /// @notice Returns the number of pools.
    function tokensLength() external view returns (uint256);

    /// @notice Returns the list of pools, by their staking tokens.
    function tokens() external view returns (IERC20[] memory);

    /// @notice Returns a slice of the list of pools, by their staking tokens.
    function tokens(uint256 start, uint256 end) external view returns (IERC20[] memory);

    // @notice Returns the rewarder of the pool of `token`, responsible for distribution reward tokens.
    function rewarder(IERC20 token) external view returns (IRewarder);
}

File 13 of 13 : StakingLib.sol
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.22;

import { IStargateStaking, IERC20, IRewarder } from "../interfaces/IStargateStaking.sol";
import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";

/// @dev Internal representation for a staking pool.
struct StakingPool {
    uint256 totalSupply;
    bool exists;
    IRewarder rewarder;
    mapping(address => uint256) balanceOf;
}

/// @dev Library for staking pool logic.
library StakingLib {
    using SafeERC20 for IERC20;

    /// @dev Emitted when `user` attempts to withdraw an amount which exceeds their balance.
    error WithdrawalAmountExceedsBalance();

    /**
     * @dev Deposit `amount` of `token` from `from` to `to`, increments the `to` balance and totalSupply while
     *      transferring in `token` from `from`, into the contract. Calls the `rewarder` to update the reward state.
     */
    function deposit(StakingPool storage self, IERC20 token, address from, address to, uint256 amount) internal {
        uint256 oldBal = self.balanceOf[to];
        uint256 oldSupply = self.totalSupply;

        uint256 newBal = oldBal + amount;

        self.balanceOf[to] = newBal;
        self.totalSupply = oldSupply + amount;

        emit IStargateStaking.Deposit(token, from, to, amount);

        self.rewarder.onUpdate(token, to, oldBal, oldSupply, newBal);
        token.safeTransferFrom(from, address(this), amount);
    }

    /**
     * @dev Withdraw `amount` of `token` from `from` to `to`, decrements the `from` balance and totalSupply while
     *      transferring out `token` to `to`. Calls the `rewarder` to update the reward state.
     */
    function withdraw(
        StakingPool storage self,
        IERC20 token,
        address from,
        address to,
        uint256 amount,
        bool withUpdate
    ) internal {
        uint256 oldBal = self.balanceOf[from];
        uint256 oldSupply = self.totalSupply;

        if (oldBal < amount) revert WithdrawalAmountExceedsBalance();

        uint256 newBal = oldBal - amount;

        self.balanceOf[from] = newBal;
        self.totalSupply = oldSupply - amount;

        emit IStargateStaking.Withdraw(token, from, to, amount, withUpdate);

        if (withUpdate) {
            self.rewarder.onUpdate(token, from, oldBal, oldSupply, newBal);
        }
        token.safeTransfer(to, amount);
    }

    /**
     *  @dev Claims the `user` rewards from the `rewarder`, and sends them to the `user`. This is done automatically on
     *       deposits and withdrawals as well.
     */
    function claim(StakingPool storage self, IERC20 token, address user) internal {
        self.rewarder.onUpdate(token, user, self.balanceOf[user], self.totalSupply, 0);
    }
}

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

Contract Security Audit

Contract ABI

[{"inputs":[],"name":"InvalidCaller","type":"error"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"}],"name":"InvalidReceiver","type":"error"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"}],"name":"NonExistentPool","type":"error"},{"inputs":[],"name":"StargateStakingRenounceOwnershipDisabled","type":"error"},{"inputs":[],"name":"WithdrawalAmountExceedsBalance","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract IERC20","name":"token","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract IERC20","name":"token","type":"address"},{"indexed":false,"internalType":"contract IRewarder","name":"rewarder","type":"address"},{"indexed":false,"internalType":"bool","name":"exists","type":"bool"}],"name":"PoolSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract IERC20","name":"token","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"bool","name":"withUpdate","type":"bool"}],"name":"Withdraw","type":"event"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"},{"internalType":"address","name":"user","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20[]","name":"lpTokens","type":"address[]"}],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"deposit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"depositTo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"}],"name":"emergencyWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"}],"name":"isPool","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"}],"name":"rewarder","outputs":[{"internalType":"contract IRewarder","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"},{"internalType":"contract IRewarder","name":"newRewarder","type":"address"}],"name":"setPool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"start","type":"uint256"},{"internalType":"uint256","name":"end","type":"uint256"}],"name":"tokens","outputs":[{"internalType":"contract IERC20[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokens","outputs":[{"internalType":"contract IERC20[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokensLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"}],"name":"totalSupply","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":"contract IERC20","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"},{"internalType":"contract IStakingReceiver","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"withdrawToAndCall","outputs":[],"stateMutability":"nonpayable","type":"function"}]

608060405234801561001057600080fd5b5061001a33610023565b60018055610073565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b611745806100826000396000f3fe608060405234801561001057600080fd5b506004361061011b5760003560e01c80638da5cb5b116100b2578063ed21fed011610081578063f2fde38b11610066578063f2fde38b146102a0578063f3fef3a3146102b3578063f7888aec146102c657600080fd5b8063ed21fed014610259578063f213159c1461028d57600080fd5b80638da5cb5b146101ed5780639d63848a14610212578063d92fc67b1461021a578063e4dc2aa41461023057600080fd5b80636880d4d6116100ee5780636880d4d61461019f5780636ff1c9bc146101b2578063715018a6146101c55780638b4864d6146101cd57600080fd5b8063318d9e5d1461012057806347e7ef24146101355780634e847fc7146101485780635b16ebb71461015b575b600080fd5b61013361012e3660046112d6565b610303565b005b610133610143366004611360565b610384565b61013361015636600461138c565b6103bb565b61018a6101693660046113c5565b6001600160a01b031660009081526004602052604090206001015460ff1690565b60405190151581526020015b60405180910390f35b6101336101ad3660046113e2565b61053c565b6101336101c03660046113c5565b6106cd565b61013361072d565b6101e06101db366004611481565b610767565b60405161019691906114a3565b6000546001600160a01b03165b6040516001600160a01b039091168152602001610196565b6101e0610813565b610222610829565b604051908152602001610196565b61022261023e3660046113c5565b6001600160a01b031660009081526004602052604090205490565b6101fa6102673660046113c5565b6001600160a01b0390811660009081526004602052604090206001015461010090041690565b61013361029b3660046114f0565b610835565b6101336102ae3660046113c5565b6108b3565b6101336102c1366004611360565b610940565b6102226102d436600461138c565b6001600160a01b0391821660009081526004602090815260408083209390941682526002909201909152205490565b61030b610979565b60005b8181101561037657600083838381811061032a5761032a611531565b905060200201602081019061033f91906113c5565b905061034a816109d2565b6001600160a01b038116600090815260046020526040902061036d908233610a32565b5060010161030e565b5061038060018055565b5050565b61038c610979565b81610396816109d2565b6001600160a01b03831660009081526004602052604090206103769084338086610ae2565b6103c3610c39565b6001600160a01b03821660009081526004602052604090206001015460ff168061043a576001600160a01b0383166000908152600460205260409020600190810180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169091179055610438600284610c95565b505b6040517fee8f931b0000000000000000000000000000000000000000000000000000000081526001600160a01b03848116600483015283169063ee8f931b90602401600060405180830381600087803b15801561049657600080fd5b505af11580156104aa573d6000803e3d6000fd5b505050506001600160a01b0383811660008181526004602090815260409182902060010180547fffffffffffffffffffffff0000000000000000000000000000000000000000ff1661010095881695860217905581519384528415159084015290917f2563c168fd69ef80f00260284837ea144310fa81558e4265a735e74e6c327064910160405180910390a2505050565b610544610979565b8461054e816109d2565b6001600160a01b0385163b61059f576040517f9cfea5830000000000000000000000000000000000000000000000000000000081526001600160a01b03861660048201526024015b60405180910390fd5b6001600160a01b03861660009081526004602052604090206105c690873388886001610cb1565b6040517f022173c000000000000000000000000000000000000000000000000000000000808252906001600160a01b0387169063022173c090610615908a9033908a908a908a90600401611560565b6020604051808303816000875af1158015610634573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061065891906115b4565b7fffffffff0000000000000000000000000000000000000000000000000000000016146106bc576040517f9cfea5830000000000000000000000000000000000000000000000000000000081526001600160a01b0386166004820152602401610596565b506106c660018055565b5050505050565b6106d5610979565b806106df816109d2565b6001600160a01b038216600081815260046020818152604080842033808652600282018452918520549585529290915261071f9286919081908690610cb1565b505061072a60018055565b50565b610735610c39565b6040517ff7298a7f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606060006107758484611625565b67ffffffffffffffff81111561078d5761078d611638565b6040519080825280602002602001820160405280156107b6578160200160208202803683370190505b509050835b83811015610809576107ce600282610e50565b826107d98784611625565b815181106107e9576107e9611531565b6001600160a01b03909216602092830291909101909101526001016107bb565b5090505b92915050565b606061082460006101db6002610e5c565b905090565b60006108246002610e5c565b61083d610979565b82610847816109d2565b333b61087f576040517f48f5c3ed00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b03841660009081526004602052604090206108a49085338686610ae2565b506108ae60018055565b505050565b6108bb610c39565b6001600160a01b0381166109375760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610596565b61072a81610e66565b610948610979565b81610952816109d2565b6001600160a01b038316600090815260046020526040902061037690843380866001610cb1565b6002600154036109cb5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610596565b6002600155565b6001600160a01b03811660009081526004602052604090206001015460ff1661072a576040517f5f7065630000000000000000000000000000000000000000000000000000000081526001600160a01b0382166004820152602401610596565b60018301546001600160a01b03828116600081815260028701602052604080822054885491517faeefd1fc00000000000000000000000000000000000000000000000000000000815288861660048201526024810194909452604484015260648301526084820152610100909204169063aeefd1fc9060a401600060405180830381600087803b158015610ac557600080fd5b505af1158015610ad9573d6000803e3d6000fd5b50505050505050565b6001600160a01b038216600090815260028601602052604081205486549091610b0b8484611667565b6001600160a01b038616600090815260028a01602052604090208190559050610b348483611667565b88556040518481526001600160a01b0386811691888216918a16907f7cfff908a4b583f36430b25d75964c458d8ede8a99bd61be750e97ee1b2f3a969060200160405180910390a460018801546040517faeefd1fc0000000000000000000000000000000000000000000000000000000081526001600160a01b03898116600483015287811660248301526044820186905260648201859052608482018490526101009092049091169063aeefd1fc9060a401600060405180830381600087803b158015610c0157600080fd5b505af1158015610c15573d6000803e3d6000fd5b50610c2f925050506001600160a01b038816873087610ece565b5050505050505050565b6000546001600160a01b03163314610c935760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610596565b565b6000610caa836001600160a01b038416610f85565b9392505050565b6001600160a01b0384166000908152600287016020526040902054865483821015610d08576040517f21768b3600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000610d148584611625565b6001600160a01b038816600090815260028b01602052604090208190559050610d3d8583611625565b89556040805186815285151560208201526001600160a01b03888116928a821692918c16917f3b5f15635b488fe265654176726b3222080f3d6500a562f4664233b3ea2f0283910160405180910390a48315610e315760018901546040517faeefd1fc0000000000000000000000000000000000000000000000000000000081526001600160a01b038a8116600483015289811660248301526044820186905260648201859052608482018490526101009092049091169063aeefd1fc9060a401600060405180830381600087803b158015610e1857600080fd5b505af1158015610e2c573d6000803e3d6000fd5b505050505b610e456001600160a01b0389168787610fd4565b505050505050505050565b6000610caa838361101d565b600061080d825490565b600080546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6040516001600160a01b0380851660248301528316604482015260648101829052610f7f9085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152611047565b50505050565b6000818152600183016020526040812054610fcc5750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915561080d565b50600061080d565b6040516001600160a01b0383166024820152604481018290526108ae9084907fa9059cbb0000000000000000000000000000000000000000000000000000000090606401610f1b565b600082600001828154811061103457611034611531565b9060005260206000200154905092915050565b600061109c826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661112f9092919063ffffffff16565b90508051600014806110bd5750808060200190518101906110bd919061167a565b6108ae5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610596565b606061113e8484600085611146565b949350505050565b6060824710156111be5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610596565b600080866001600160a01b031685876040516111da91906116c0565b60006040518083038185875af1925050503d8060008114611217576040519150601f19603f3d011682016040523d82523d6000602084013e61121c565b606091505b509150915061122d87838387611238565b979650505050505050565b606083156112a75782516000036112a0576001600160a01b0385163b6112a05760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610596565b508161113e565b61113e83838151156112bc5781518083602001fd5b8060405162461bcd60e51b815260040161059691906116dc565b600080602083850312156112e957600080fd5b823567ffffffffffffffff8082111561130157600080fd5b818501915085601f83011261131557600080fd5b81358181111561132457600080fd5b8660208260051b850101111561133957600080fd5b60209290920196919550909350505050565b6001600160a01b038116811461072a57600080fd5b6000806040838503121561137357600080fd5b823561137e8161134b565b946020939093013593505050565b6000806040838503121561139f57600080fd5b82356113aa8161134b565b915060208301356113ba8161134b565b809150509250929050565b6000602082840312156113d757600080fd5b8135610caa8161134b565b6000806000806000608086880312156113fa57600080fd5b85356114058161134b565b945060208601356114158161134b565b935060408601359250606086013567ffffffffffffffff8082111561143957600080fd5b818801915088601f83011261144d57600080fd5b81358181111561145c57600080fd5b89602082850101111561146e57600080fd5b9699959850939650602001949392505050565b6000806040838503121561149457600080fd5b50508035926020909101359150565b6020808252825182820181905260009190848201906040850190845b818110156114e45783516001600160a01b0316835292840192918401916001016114bf565b50909695505050505050565b60008060006060848603121561150557600080fd5b83356115108161134b565b925060208401356115208161134b565b929592945050506040919091013590565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60006001600160a01b03808816835280871660208401525084604083015260806060830152826080830152828460a0840137600060a0848401015260a0601f19601f85011683010190509695505050505050565b6000602082840312156115c657600080fd5b81517fffffffff0000000000000000000000000000000000000000000000000000000081168114610caa57600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b8181038181111561080d5761080d6115f6565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b8082018082111561080d5761080d6115f6565b60006020828403121561168c57600080fd5b81518015158114610caa57600080fd5b60005b838110156116b757818101518382015260200161169f565b50506000910152565b600082516116d281846020870161169c565b9190910192915050565b60208152600082518060208401526116fb81604085016020870161169c565b601f01601f1916919091016040019291505056fea26469706673582212201bea365e629ea4e3ce7c30d395fa8ca3a0ce9972f676b2431c5f2e59210d471e64736f6c63430008160033

Deployed Bytecode

0x608060405234801561001057600080fd5b506004361061011b5760003560e01c80638da5cb5b116100b2578063ed21fed011610081578063f2fde38b11610066578063f2fde38b146102a0578063f3fef3a3146102b3578063f7888aec146102c657600080fd5b8063ed21fed014610259578063f213159c1461028d57600080fd5b80638da5cb5b146101ed5780639d63848a14610212578063d92fc67b1461021a578063e4dc2aa41461023057600080fd5b80636880d4d6116100ee5780636880d4d61461019f5780636ff1c9bc146101b2578063715018a6146101c55780638b4864d6146101cd57600080fd5b8063318d9e5d1461012057806347e7ef24146101355780634e847fc7146101485780635b16ebb71461015b575b600080fd5b61013361012e3660046112d6565b610303565b005b610133610143366004611360565b610384565b61013361015636600461138c565b6103bb565b61018a6101693660046113c5565b6001600160a01b031660009081526004602052604090206001015460ff1690565b60405190151581526020015b60405180910390f35b6101336101ad3660046113e2565b61053c565b6101336101c03660046113c5565b6106cd565b61013361072d565b6101e06101db366004611481565b610767565b60405161019691906114a3565b6000546001600160a01b03165b6040516001600160a01b039091168152602001610196565b6101e0610813565b610222610829565b604051908152602001610196565b61022261023e3660046113c5565b6001600160a01b031660009081526004602052604090205490565b6101fa6102673660046113c5565b6001600160a01b0390811660009081526004602052604090206001015461010090041690565b61013361029b3660046114f0565b610835565b6101336102ae3660046113c5565b6108b3565b6101336102c1366004611360565b610940565b6102226102d436600461138c565b6001600160a01b0391821660009081526004602090815260408083209390941682526002909201909152205490565b61030b610979565b60005b8181101561037657600083838381811061032a5761032a611531565b905060200201602081019061033f91906113c5565b905061034a816109d2565b6001600160a01b038116600090815260046020526040902061036d908233610a32565b5060010161030e565b5061038060018055565b5050565b61038c610979565b81610396816109d2565b6001600160a01b03831660009081526004602052604090206103769084338086610ae2565b6103c3610c39565b6001600160a01b03821660009081526004602052604090206001015460ff168061043a576001600160a01b0383166000908152600460205260409020600190810180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00169091179055610438600284610c95565b505b6040517fee8f931b0000000000000000000000000000000000000000000000000000000081526001600160a01b03848116600483015283169063ee8f931b90602401600060405180830381600087803b15801561049657600080fd5b505af11580156104aa573d6000803e3d6000fd5b505050506001600160a01b0383811660008181526004602090815260409182902060010180547fffffffffffffffffffffff0000000000000000000000000000000000000000ff1661010095881695860217905581519384528415159084015290917f2563c168fd69ef80f00260284837ea144310fa81558e4265a735e74e6c327064910160405180910390a2505050565b610544610979565b8461054e816109d2565b6001600160a01b0385163b61059f576040517f9cfea5830000000000000000000000000000000000000000000000000000000081526001600160a01b03861660048201526024015b60405180910390fd5b6001600160a01b03861660009081526004602052604090206105c690873388886001610cb1565b6040517f022173c000000000000000000000000000000000000000000000000000000000808252906001600160a01b0387169063022173c090610615908a9033908a908a908a90600401611560565b6020604051808303816000875af1158015610634573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061065891906115b4565b7fffffffff0000000000000000000000000000000000000000000000000000000016146106bc576040517f9cfea5830000000000000000000000000000000000000000000000000000000081526001600160a01b0386166004820152602401610596565b506106c660018055565b5050505050565b6106d5610979565b806106df816109d2565b6001600160a01b038216600081815260046020818152604080842033808652600282018452918520549585529290915261071f9286919081908690610cb1565b505061072a60018055565b50565b610735610c39565b6040517ff7298a7f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606060006107758484611625565b67ffffffffffffffff81111561078d5761078d611638565b6040519080825280602002602001820160405280156107b6578160200160208202803683370190505b509050835b83811015610809576107ce600282610e50565b826107d98784611625565b815181106107e9576107e9611531565b6001600160a01b03909216602092830291909101909101526001016107bb565b5090505b92915050565b606061082460006101db6002610e5c565b905090565b60006108246002610e5c565b61083d610979565b82610847816109d2565b333b61087f576040517f48f5c3ed00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b03841660009081526004602052604090206108a49085338686610ae2565b506108ae60018055565b505050565b6108bb610c39565b6001600160a01b0381166109375760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610596565b61072a81610e66565b610948610979565b81610952816109d2565b6001600160a01b038316600090815260046020526040902061037690843380866001610cb1565b6002600154036109cb5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610596565b6002600155565b6001600160a01b03811660009081526004602052604090206001015460ff1661072a576040517f5f7065630000000000000000000000000000000000000000000000000000000081526001600160a01b0382166004820152602401610596565b60018301546001600160a01b03828116600081815260028701602052604080822054885491517faeefd1fc00000000000000000000000000000000000000000000000000000000815288861660048201526024810194909452604484015260648301526084820152610100909204169063aeefd1fc9060a401600060405180830381600087803b158015610ac557600080fd5b505af1158015610ad9573d6000803e3d6000fd5b50505050505050565b6001600160a01b038216600090815260028601602052604081205486549091610b0b8484611667565b6001600160a01b038616600090815260028a01602052604090208190559050610b348483611667565b88556040518481526001600160a01b0386811691888216918a16907f7cfff908a4b583f36430b25d75964c458d8ede8a99bd61be750e97ee1b2f3a969060200160405180910390a460018801546040517faeefd1fc0000000000000000000000000000000000000000000000000000000081526001600160a01b03898116600483015287811660248301526044820186905260648201859052608482018490526101009092049091169063aeefd1fc9060a401600060405180830381600087803b158015610c0157600080fd5b505af1158015610c15573d6000803e3d6000fd5b50610c2f925050506001600160a01b038816873087610ece565b5050505050505050565b6000546001600160a01b03163314610c935760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610596565b565b6000610caa836001600160a01b038416610f85565b9392505050565b6001600160a01b0384166000908152600287016020526040902054865483821015610d08576040517f21768b3600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000610d148584611625565b6001600160a01b038816600090815260028b01602052604090208190559050610d3d8583611625565b89556040805186815285151560208201526001600160a01b03888116928a821692918c16917f3b5f15635b488fe265654176726b3222080f3d6500a562f4664233b3ea2f0283910160405180910390a48315610e315760018901546040517faeefd1fc0000000000000000000000000000000000000000000000000000000081526001600160a01b038a8116600483015289811660248301526044820186905260648201859052608482018490526101009092049091169063aeefd1fc9060a401600060405180830381600087803b158015610e1857600080fd5b505af1158015610e2c573d6000803e3d6000fd5b505050505b610e456001600160a01b0389168787610fd4565b505050505050505050565b6000610caa838361101d565b600061080d825490565b600080546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6040516001600160a01b0380851660248301528316604482015260648101829052610f7f9085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152611047565b50505050565b6000818152600183016020526040812054610fcc5750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915561080d565b50600061080d565b6040516001600160a01b0383166024820152604481018290526108ae9084907fa9059cbb0000000000000000000000000000000000000000000000000000000090606401610f1b565b600082600001828154811061103457611034611531565b9060005260206000200154905092915050565b600061109c826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661112f9092919063ffffffff16565b90508051600014806110bd5750808060200190518101906110bd919061167a565b6108ae5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610596565b606061113e8484600085611146565b949350505050565b6060824710156111be5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610596565b600080866001600160a01b031685876040516111da91906116c0565b60006040518083038185875af1925050503d8060008114611217576040519150601f19603f3d011682016040523d82523d6000602084013e61121c565b606091505b509150915061122d87838387611238565b979650505050505050565b606083156112a75782516000036112a0576001600160a01b0385163b6112a05760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610596565b508161113e565b61113e83838151156112bc5781518083602001fd5b8060405162461bcd60e51b815260040161059691906116dc565b600080602083850312156112e957600080fd5b823567ffffffffffffffff8082111561130157600080fd5b818501915085601f83011261131557600080fd5b81358181111561132457600080fd5b8660208260051b850101111561133957600080fd5b60209290920196919550909350505050565b6001600160a01b038116811461072a57600080fd5b6000806040838503121561137357600080fd5b823561137e8161134b565b946020939093013593505050565b6000806040838503121561139f57600080fd5b82356113aa8161134b565b915060208301356113ba8161134b565b809150509250929050565b6000602082840312156113d757600080fd5b8135610caa8161134b565b6000806000806000608086880312156113fa57600080fd5b85356114058161134b565b945060208601356114158161134b565b935060408601359250606086013567ffffffffffffffff8082111561143957600080fd5b818801915088601f83011261144d57600080fd5b81358181111561145c57600080fd5b89602082850101111561146e57600080fd5b9699959850939650602001949392505050565b6000806040838503121561149457600080fd5b50508035926020909101359150565b6020808252825182820181905260009190848201906040850190845b818110156114e45783516001600160a01b0316835292840192918401916001016114bf565b50909695505050505050565b60008060006060848603121561150557600080fd5b83356115108161134b565b925060208401356115208161134b565b929592945050506040919091013590565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60006001600160a01b03808816835280871660208401525084604083015260806060830152826080830152828460a0840137600060a0848401015260a0601f19601f85011683010190509695505050505050565b6000602082840312156115c657600080fd5b81517fffffffff0000000000000000000000000000000000000000000000000000000081168114610caa57600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b8181038181111561080d5761080d6115f6565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b8082018082111561080d5761080d6115f6565b60006020828403121561168c57600080fd5b81518015158114610caa57600080fd5b60005b838110156116b757818101518382015260200161169f565b50506000910152565b600082516116d281846020870161169c565b9190910192915050565b60208152600082518060208401526116fb81604085016020870161169c565b601f01601f1916919091016040019291505056fea26469706673582212201bea365e629ea4e3ce7c30d395fa8ca3a0ce9972f676b2431c5f2e59210d471e64736f6c63430008160033

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.