S Price: $0.608905 (+0.43%)

Contract

0x464Ae715981e11e408128f8E90A7A8D42a9De45C

Overview

S Balance

Sonic LogoSonic LogoSonic Logo0 S

S Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To

There are no matching entries

Please try again later

Parent Transaction Hash Block From To
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
BeefyRegistry

Compiler Version
v0.8.23+commit.f704f362

Optimization Enabled:
Yes with 200 runs

Other Settings:
paris EvmVersion
File 1 of 12 : BeefyRegistry.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.4;

import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/utils/structs/EnumerableSetUpgradeable.sol";

import "./ManageableUpgradeable.sol";

import "../interfaces/IBeefyVault.sol";
import "../interfaces/IBeefyStrategy.sol";
import "../interfaces/IBeefyRegistry.sol";

contract BeefyRegistry is ManageableUpgradeable, IBeefyRegistry {
    using SafeERC20Upgradeable for IERC20Upgradeable;
    using EnumerableSetUpgradeable for EnumerableSetUpgradeable.AddressSet;

    struct VaultInfo {
        address[] tokens;
        bool retired;
        uint256 blockNumber;
        uint256 index;
    }

    EnumerableSetUpgradeable.AddressSet private _vaultSet;
    mapping(address => VaultInfo) private _vaultInfoMap;
    mapping(address => EnumerableSetUpgradeable.AddressSet) private _tokenToVaultsMap;
    mapping(address => uint256) private _harvestFunctionGasOverhead;

    event VaultsRegistered(address[] vaults_);
    event VaultsRetireStatusUpdated(address[] vaults_, bool status_);
    event VaultHarvestFunctionGasOverheadUpdated(address indexed vaultAddress_, uint256 gasOverhead_);

    function getVaultCount() external view override returns (uint256 count) {
        return _vaultSet.length();
    }

    function initialize() public initializer {
        __Manageable_init();
    }

    function addVaults(address[] memory _vaultAddresses) external onlyManager {
        for (uint256 i; i < _vaultAddresses.length; i++) {
            _addVault(_vaultAddresses[i]);
        }
        emit VaultsRegistered(_vaultAddresses);
    }

    function _addVault(address _vaultAddress) internal {
        require(!_isVaultInRegistry(_vaultAddress), "Vault Exists");

        IBeefyVault vault = IBeefyVault(_vaultAddress);
        IBeefyStrategy strat = _validateVault(vault);

        address[] memory tokens = _collectTokenData(strat);

        _vaultSet.add(_vaultAddress);

        for (uint8 tokenId = 0; tokenId < tokens.length; tokenId++) {
            _tokenToVaultsMap[tokens[tokenId]].add(_vaultAddress);
        }

        _vaultInfoMap[_vaultAddress].tokens = tokens;
        _vaultInfoMap[_vaultAddress].blockNumber = block.number;
        _vaultInfoMap[_vaultAddress].index = _vaultSet.length() - 1;
    }

    function _validateVault(IBeefyVault _vault) internal view returns (IBeefyStrategy strategy) {
        address vaultAddress = address(_vault);

        try _vault.strategy() returns (IBeefyStrategy _strategy) {
            require(IBeefyStrategy(_strategy).vault() == vaultAddress, "Vault/Strat Mismatch");
            return IBeefyStrategy(_strategy);
        } catch {
            require(false, "Address not a Vault");
        }
    }

    function _collectTokenData(IBeefyStrategy _strategy) internal view returns (address[] memory tokens) {
        try _strategy.lpToken0() returns (address lpToken0) {
            tokens = new address[](3);

            tokens[0] = address(_strategy.want());
            tokens[1] = address(lpToken0);
            tokens[2] = address(_strategy.lpToken1());
        } catch (bytes memory) {
            tokens = new address[](1);

            tokens[0] = address(_strategy.want());
        }
    }

    function _isVaultInRegistry(address _address) internal view returns (bool isVault) {
        if (_vaultSet.length() == 0) return false;
        return (_vaultSet.contains(_address));
    }

    function getVaultInfo(address _vaultAddress)
        external
        view
        returns (
            string memory name_,
            IBeefyStrategy strategy_,
            bool isPaused_,
            address[] memory tokens_,
            uint256 blockNumber_,
            bool retired_,
            uint256 gasOverhead_
        )
    {
        require(_isVaultInRegistry(_vaultAddress), "Invalid Vault Address");

        IBeefyVault vault = IBeefyVault(_vaultAddress);
        VaultInfo memory vaultInfo = _vaultInfoMap[_vaultAddress];

        name_ = vault.name();
        strategy_ = IBeefyStrategy(vault.strategy());
        isPaused_ = strategy_.paused();
        tokens_ = vaultInfo.tokens;
        blockNumber_ = vaultInfo.blockNumber;
        retired_ = vaultInfo.retired;
        gasOverhead_ = _harvestFunctionGasOverhead[_vaultAddress];
    }

    function allVaultAddresses() external view override returns (address[] memory) {
        return _vaultSet.values();
    }

    function getVaultsForToken(address _token) external view returns (VaultInfo[] memory vaultResults) {
        vaultResults = new VaultInfo[](_tokenToVaultsMap[_token].length());
        for (uint256 i; i < _tokenToVaultsMap[_token].length(); i++) {
            VaultInfo memory _vault = _vaultInfoMap[_tokenToVaultsMap[_token].at(i)];
            vaultResults[i] = _vault;
        }
    }

    function getStakedVaultsForAddress(address _address) external view returns (VaultInfo[] memory stakedVaults) {
        uint256 curResults;
        uint256 numResults;

        for (uint256 vid; vid < _vaultSet.length(); vid++) {
            if (IBeefyVault(_vaultSet.at(vid)).balanceOf(_address) > 0) {
                numResults++;
            }
        }

        stakedVaults = new VaultInfo[](numResults);
        for (uint256 vid; vid < _vaultSet.length(); vid++) {
            if (IBeefyVault(_vaultSet.at(vid)).balanceOf(_address) > 0) {
                stakedVaults[curResults++] = _vaultInfoMap[_vaultSet.at(vid)];
            }
        }
    }

    function getVaultsAfterBlock(uint256 _block) external view returns (VaultInfo[] memory vaultResults) {
        uint256 curResults;
        uint256 numResults;

        for (uint256 vaultIndex; vaultIndex < _vaultSet.length(); vaultIndex++) {
            if (_vaultInfoMap[_vaultSet.at(vaultIndex)].blockNumber >= _block) {
                numResults++;
            }
        }

        vaultResults = new VaultInfo[](numResults);
        for (uint256 vaultIndex; vaultIndex < _vaultSet.length(); vaultIndex++) {
            VaultInfo memory vaultInfo = _vaultInfoMap[_vaultSet.at(vaultIndex)];
            if (vaultInfo.blockNumber >= _block) {
                vaultResults[curResults++] = vaultInfo;
            }
        }
    }

    function setVaultTokens(address _vault, address[] memory _tokens) external onlyManager {
        address[] memory currentTokens = _vaultInfoMap[_vault].tokens;

        // remove all old mapping of token to vault
        for (uint256 tokenIndex; tokenIndex < currentTokens.length; tokenIndex++) {
            _tokenToVaultsMap[_tokens[tokenIndex]].remove(_vault);
        }

        // update struct tokens
        _vaultInfoMap[_vault].tokens = _tokens;

        // update token to vault mapping with new tokens
        for (uint256 tokenIndex; tokenIndex < _tokens.length; tokenIndex++) {
            _tokenToVaultsMap[_tokens[tokenIndex]].add(_vault);
        }
    }

    function setRetireStatuses(address[] memory _vaultAddresses, bool _status) external onlyManager {
        for (uint256 vaultIndex = 0; vaultIndex < _vaultAddresses.length; vaultIndex++) {
            _setRetireStatus(_vaultAddresses[vaultIndex], _status);
        }
        emit VaultsRetireStatusUpdated(_vaultAddresses, _status);
    }

    function _setRetireStatus(address _address, bool _status) internal {
        require(_isVaultInRegistry(_address), "Vault not found in registry.");
        _vaultInfoMap[_address].retired = _status;
    }

    function setHarvestFunctionGasOverhead(address vaultAddress_, uint256 gasOverhead_) external override onlyManager {
        require(_isVaultInRegistry(vaultAddress_), "Vault not found in registry.");
        _harvestFunctionGasOverhead[vaultAddress_] = gasOverhead_;

        emit VaultHarvestFunctionGasOverheadUpdated(vaultAddress_, gasOverhead_);
    }

    /**
     * @dev Rescues random funds stuck.
     * @param token_ address of the token to rescue.
     */
    function inCaseTokensGetStuck(address token_) external onlyManager {
        IERC20Upgradeable token = IERC20Upgradeable(token_);

        uint256 amount = token.balanceOf(address(this));
        token.safeTransfer(msg.sender, amount);
    }
}

File 2 of 12 : Initializable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)

pragma solidity ^0.8.2;

import "../../utils/AddressUpgradeable.sol";

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

    /**
     * @dev Indicates that the contract is in the process of being initialized.
     */
    bool private _initializing;

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

    /**
     * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
     * `onlyInitializing` functions can be used to initialize parent contracts.
     *
     * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a
     * constructor.
     *
     * Emits an {Initialized} event.
     */
    modifier initializer() {
        bool isTopLevelCall = !_initializing;
        require(
            (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),
            "Initializable: contract is already initialized"
        );
        _initialized = 1;
        if (isTopLevelCall) {
            _initializing = true;
        }
        _;
        if (isTopLevelCall) {
            _initializing = false;
            emit Initialized(1);
        }
    }

    /**
     * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
     * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
     * used to initialize parent contracts.
     *
     * A reinitializer may be used after the original initialization step. This is essential to configure modules that
     * are added through upgrades and that require initialization.
     *
     * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
     * cannot be nested. If one is invoked in the context of another, execution will revert.
     *
     * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
     * a contract, executing them in the right order is up to the developer or operator.
     *
     * WARNING: setting the version to 255 will prevent any future reinitialization.
     *
     * Emits an {Initialized} event.
     */
    modifier reinitializer(uint8 version) {
        require(!_initializing && _initialized < version, "Initializable: contract is already initialized");
        _initialized = version;
        _initializing = true;
        _;
        _initializing = false;
        emit Initialized(version);
    }

    /**
     * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
     * {initializer} and {reinitializer} modifiers, directly or indirectly.
     */
    modifier onlyInitializing() {
        require(_initializing, "Initializable: contract is not initializing");
        _;
    }

    /**
     * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
     * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
     * to any version. It is recommended to use this to lock implementation contracts that are designed to be called
     * through proxies.
     *
     * Emits an {Initialized} event the first time it is successfully executed.
     */
    function _disableInitializers() internal virtual {
        require(!_initializing, "Initializable: contract is initializing");
        if (_initialized != type(uint8).max) {
            _initialized = type(uint8).max;
            emit Initialized(type(uint8).max);
        }
    }

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

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

File 3 of 12 : IERC20PermitUpgradeable.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 IERC20PermitUpgradeable {
    /**
     * @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 : IERC20Upgradeable.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 IERC20Upgradeable {
    /**
     * @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 12 : SafeERC20Upgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20Upgradeable.sol";
import "../extensions/IERC20PermitUpgradeable.sol";
import "../../../utils/AddressUpgradeable.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 SafeERC20Upgradeable {
    using AddressUpgradeable 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(IERC20Upgradeable 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(IERC20Upgradeable 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(IERC20Upgradeable 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(IERC20Upgradeable 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(IERC20Upgradeable 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(IERC20Upgradeable 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(
        IERC20PermitUpgradeable 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(IERC20Upgradeable 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(IERC20Upgradeable 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))) && AddressUpgradeable.isContract(address(token));
    }
}

File 6 of 12 : AddressUpgradeable.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 AddressUpgradeable {
    /**
     * @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 7 of 12 : ContextUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.4) (utils/Context.sol)

pragma solidity ^0.8.0;
import {Initializable} from "../proxy/utils/Initializable.sol";

/**
 * @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 ContextUpgradeable is Initializable {
    function __Context_init() internal onlyInitializing {
    }

    function __Context_init_unchained() internal onlyInitializing {
    }
    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;
    }

    /**
     * @dev This empty reserved space is put in place to allow future versions to add new
     * variables without shifting down storage in the inheritance chain.
     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
     */
    uint256[50] private __gap;
}

File 8 of 12 : EnumerableSetUpgradeable.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 EnumerableSetUpgradeable {
    // 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 9 of 12 : ManageableUpgradeable.sol
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.4;

import "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/utils/structs/EnumerableSetUpgradeable.sol";

abstract contract ManageableUpgradeable is Initializable, ContextUpgradeable {
    using EnumerableSetUpgradeable for EnumerableSetUpgradeable.AddressSet;

    EnumerableSetUpgradeable.AddressSet private _managers;

    event ManagersUpdated(address[] users_, address status_);

    /* solhint-disable func-name-mixedcase */
    /**
     * @dev Initializes the contract setting the deployer as the only manager.
     */
    function __Manageable_init() internal onlyInitializing {
        /* solhint-enable func-name-mixedcase */
        __Context_init_unchained();
        __Manageable_init_unchained();
    }

    /* solhint-disable func-name-mixedcase */
    function __Manageable_init_unchained() internal onlyInitializing {
        /* solhint-enable func-name-mixedcase */
        _setManager(_msgSender(), true);
    }

    /**
     * @dev Throws if called by any account other than the manager.
     */
    modifier onlyManager() {
        require(_managers.contains(msg.sender), "!manager");
        _;
    }

    function setManagers(address[] memory managers_, bool status_) external onlyManager {
        for (uint256 managerIndex = 0; managerIndex < managers_.length; managerIndex++) {
            _setManager(managers_[managerIndex], status_);
        }
    }

    function _setManager(address manager_, bool status_) internal {
        if (status_) {
            _managers.add(manager_);
        } else {
            // Must be at least 1 manager.
            require(_managers.length() > 1, "!(managers > 1)");
            _managers.remove(manager_);
        }
    }

    uint256[49] private __gap;
}

File 10 of 12 : IBeefyRegistry.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.9.0;

interface IBeefyRegistry {
    function allVaultAddresses() external view returns (address[] memory);

    function getVaultCount() external view returns (uint256 count);

    function setHarvestFunctionGasOverhead(address vaultAddress_, uint256 gasOverhead_) external;
}

File 11 of 12 : IBeefyStrategy.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.9.0;
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";

interface IBeefyStrategy {
    function vault() external view returns (address);

    function want() external view returns (IERC20Upgradeable);

    function beforeDeposit() external;

    function deposit() external;

    function withdraw(uint256) external;

    function balanceOf() external view returns (uint256);

    function balanceOfWant() external view returns (uint256);

    function balanceOfPool() external view returns (uint256);

    function harvest(address callFeeRecipient) external;

    function retireStrat() external;

    function panic() external;

    function pause() external;

    function unpause() external;

    function paused() external view returns (bool);

    function unirouter() external view returns (address);

    function lpToken0() external view returns (address);

    function lpToken1() external view returns (address);

    function lastHarvest() external view returns (uint256);

    function callReward() external view returns (uint256);

    function harvestWithCallFeeRecipient(address callFeeRecipient) external; // back compat call
}

File 12 of 12 : IBeefyVault.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.6.0 <0.9.0;
import "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol";
import "./IBeefyStrategy.sol";

interface IBeefyVault is IERC20Upgradeable {
    function name() external view returns (string memory);

    function deposit(uint256) external;

    function depositAll() external;

    function withdraw(uint256) external;

    function withdrawAll() external;

    function getPricePerFullShare() external view returns (uint256);

    function upgradeStrat() external;

    function balance() external view returns (uint256);

    function want() external view returns (IERC20Upgradeable);

    function strategy() external view returns (IBeefyStrategy);
}

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

Contract Security Audit

Contract ABI

API
[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address[]","name":"users_","type":"address[]"},{"indexed":false,"internalType":"address","name":"status_","type":"address"}],"name":"ManagersUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"vaultAddress_","type":"address"},{"indexed":false,"internalType":"uint256","name":"gasOverhead_","type":"uint256"}],"name":"VaultHarvestFunctionGasOverheadUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address[]","name":"vaults_","type":"address[]"}],"name":"VaultsRegistered","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address[]","name":"vaults_","type":"address[]"},{"indexed":false,"internalType":"bool","name":"status_","type":"bool"}],"name":"VaultsRetireStatusUpdated","type":"event"},{"inputs":[{"internalType":"address[]","name":"_vaultAddresses","type":"address[]"}],"name":"addVaults","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"allVaultAddresses","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"getStakedVaultsForAddress","outputs":[{"components":[{"internalType":"address[]","name":"tokens","type":"address[]"},{"internalType":"bool","name":"retired","type":"bool"},{"internalType":"uint256","name":"blockNumber","type":"uint256"},{"internalType":"uint256","name":"index","type":"uint256"}],"internalType":"struct BeefyRegistry.VaultInfo[]","name":"stakedVaults","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getVaultCount","outputs":[{"internalType":"uint256","name":"count","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_vaultAddress","type":"address"}],"name":"getVaultInfo","outputs":[{"internalType":"string","name":"name_","type":"string"},{"internalType":"contract IBeefyStrategy","name":"strategy_","type":"address"},{"internalType":"bool","name":"isPaused_","type":"bool"},{"internalType":"address[]","name":"tokens_","type":"address[]"},{"internalType":"uint256","name":"blockNumber_","type":"uint256"},{"internalType":"bool","name":"retired_","type":"bool"},{"internalType":"uint256","name":"gasOverhead_","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_block","type":"uint256"}],"name":"getVaultsAfterBlock","outputs":[{"components":[{"internalType":"address[]","name":"tokens","type":"address[]"},{"internalType":"bool","name":"retired","type":"bool"},{"internalType":"uint256","name":"blockNumber","type":"uint256"},{"internalType":"uint256","name":"index","type":"uint256"}],"internalType":"struct BeefyRegistry.VaultInfo[]","name":"vaultResults","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"getVaultsForToken","outputs":[{"components":[{"internalType":"address[]","name":"tokens","type":"address[]"},{"internalType":"bool","name":"retired","type":"bool"},{"internalType":"uint256","name":"blockNumber","type":"uint256"},{"internalType":"uint256","name":"index","type":"uint256"}],"internalType":"struct BeefyRegistry.VaultInfo[]","name":"vaultResults","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token_","type":"address"}],"name":"inCaseTokensGetStuck","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"vaultAddress_","type":"address"},{"internalType":"uint256","name":"gasOverhead_","type":"uint256"}],"name":"setHarvestFunctionGasOverhead","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"managers_","type":"address[]"},{"internalType":"bool","name":"status_","type":"bool"}],"name":"setManagers","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_vaultAddresses","type":"address[]"},{"internalType":"bool","name":"_status","type":"bool"}],"name":"setRetireStatuses","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_vault","type":"address"},{"internalType":"address[]","name":"_tokens","type":"address[]"}],"name":"setVaultTokens","outputs":[],"stateMutability":"nonpayable","type":"function"}]

608060405234801561001057600080fd5b5061232d806100206000396000f3fe608060405234801561001057600080fd5b50600436106100cf5760003560e01c806390229af71161008c578063a791b51a11610066578063a791b51a146101a4578063c54deca3146101b7578063def68a9c146101ca578063e7ddc9df146101dd57600080fd5b806390229af71461015857806396e5bb4f1461017e578063a57b8b141461019157600080fd5b806319e80b8d146100d457806337c0898c146100e957806362ebc82814610107578063700731511461012757806374d4e4911461013a5780638129fc1c14610150575b600080fd5b6100e76100e2366004611db9565b6101f0565b005b6100f1610291565b6040516100fe9190611e33565b60405180910390f35b61011a610115366004611e46565b6102a2565b6040516100fe9190611e63565b6100e7610135366004611f30565b610548565b6101426105e4565b6040519081526020016100fe565b6100e76105f0565b61016b610166366004611e46565b6106fd565b6040516100fe9796959493929190611fd2565b61011a61018c36600461202e565b61096f565b6100e761019f366004611f30565b610b5b565b6100e76101b2366004612047565b610bbe565b61011a6101c5366004611e46565b610c93565b6100e76101d8366004611e46565b610e57565b6100e76101eb366004612073565b610f01565b6101fb603333611094565b6102205760405162461bcd60e51b8152600401610217906120c3565b60405180910390fd5b60005b81518110156102565761024e828281518110610241576102416120e5565b60200260200101516110bb565b600101610223565b507fe2520439aaecc0a223ec751bfe094774d6bc409d92da7560c00237209b58f2eb816040516102869190611e33565b60405180910390a150565b606061029d60666111eb565b905090565b606060008060005b6102b460666111ff565b8110156103505760006102c8606683611209565b6040516370a0823160e01b81526001600160a01b03888116600483015291909116906370a0823190602401602060405180830381865afa158015610310573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061033491906120fb565b111561034857816103448161212a565b9250505b6001016102aa565b508067ffffffffffffffff81111561036a5761036a611cdf565b6040519080825280602002602001820160405280156103c857816020015b6103b560405180608001604052806060815260200160001515815260200160008152602001600081525090565b8152602001906001900390816103885790505b50925060005b6103d860666111ff565b8110156105405760006103ec606683611209565b6040516370a0823160e01b81526001600160a01b03888116600483015291909116906370a0823190602401602060405180830381865afa158015610434573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061045891906120fb565b1115610538576068600061046d606684611209565b6001600160a01b0316815260208082019290925260409081016000208151815460a094810282018501909352608081018381529093919284928491908401828280156104e257602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116104c4575b5050509183525050600182015460ff161515602082015260028201546040820152600390910154606090910152848461051a8161212a565b95508151811061052c5761052c6120e5565b60200260200101819052505b6001016103ce565b505050919050565b610553603333611094565b61056f5760405162461bcd60e51b8152600401610217906120c3565b60005b82518110156105a65761059e838281518110610590576105906120e5565b602002602001015183611215565b600101610572565b507f207a353f62927794026d0d6e50f580af1bd000b8ad4ee6f3f4c876ca573eff5182826040516105d8929190612143565b60405180910390a15050565b600061029d60666111ff565b600054610100900460ff16158080156106105750600054600160ff909116105b8061062a5750303b15801561062a575060005460ff166001145b61068d5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610217565b6000805460ff1916600117905580156106b0576000805461ff0019166101001790555b6106b8611298565b80156106fa576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb384740249890602001610286565b50565b606060008060606000806000610712886112d1565b6107565760405162461bcd60e51b8152602060048201526015602482015274496e76616c6964205661756c74204164647265737360581b6044820152606401610217565b6001600160a01b03881660009081526068602090815260408083208151815460a094810282018501909352608081018381528d9594919384928491908401828280156107cb57602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116107ad575b505050505081526020016001820160009054906101000a900460ff16151515158152602001600282015481526020016003820154815250509050816001600160a01b03166306fdde036040518163ffffffff1660e01b8152600401600060405180830381865afa158015610843573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261086b9190810190612167565b9850816001600160a01b031663a8c62e766040518163ffffffff1660e01b8152600401602060405180830381865afa1580156108ab573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108cf91906121fb565b9750876001600160a01b0316635c975abb6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561090f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109339190612218565b81516040808401516020948501516001600160a01b03909e166000908152606a9095529320549a9c999b919a9099929850909650945092505050565b606060008060005b61098160666111ff565b8110156109d7578460686000610998606685611209565b6001600160a01b03166001600160a01b0316815260200190815260200160002060020154106109cf57816109cb8161212a565b9250505b600101610977565b508067ffffffffffffffff8111156109f1576109f1611cdf565b604051908082528060200260200182016040528015610a4f57816020015b610a3c60405180608001604052806060815260200160001515815260200160008152602001600081525090565b815260200190600190039081610a0f5790505b50925060005b610a5f60666111ff565b811015610540576000606881610a76606685611209565b6001600160a01b0316815260208082019290925260409081016000208151815460a09481028201850190935260808101838152909391928492849190840182828015610aeb57602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610acd575b5050509183525050600182015460ff161515602082015260028201546040808301919091526003909201546060909101528101519091508611610b5257808585610b348161212a565b965081518110610b4657610b466120e5565b60200260200101819052505b50600101610a55565b610b66603333611094565b610b825760405162461bcd60e51b8152600401610217906120c3565b60005b8251811015610bb957610bb1838281518110610ba357610ba36120e5565b6020026020010151836112f7565b600101610b85565b505050565b610bc9603333611094565b610be55760405162461bcd60e51b8152600401610217906120c3565b610bee826112d1565b610c3a5760405162461bcd60e51b815260206004820152601c60248201527f5661756c74206e6f7420666f756e6420696e2072656769737472792e000000006044820152606401610217565b6001600160a01b0382166000818152606a602052604090819020839055517f20f63c211ddc8421b87c81e1d29de92aacc342858938e4f39fb9aacee4794b5790610c879084815260200190565b60405180910390a25050565b6001600160a01b0381166000908152606960205260409020606090610cb7906111ff565b67ffffffffffffffff811115610ccf57610ccf611cdf565b604051908082528060200260200182016040528015610d2d57816020015b610d1a60405180608001604052806060815260200160001515815260200160008152602001600081525090565b815260200190600190039081610ced5790505b50905060005b6001600160a01b0383166000908152606960205260409020610d54906111ff565b811015610e51576001600160a01b03831660009081526069602052604081206068908290610d829085611209565b6001600160a01b0316815260208082019290925260409081016000208151815460a09481028201850190935260808101838152909391928492849190840182828015610df757602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610dd9575b5050509183525050600182015460ff16151560208201526002820154604082015260039091015460609091015283519091508190849084908110610e3d57610e3d6120e5565b602090810291909101015250600101610d33565b50919050565b610e62603333611094565b610e7e5760405162461bcd60e51b8152600401610217906120c3565b6040516370a0823160e01b815230600482015281906000906001600160a01b038316906370a0823190602401602060405180830381865afa158015610ec7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610eeb91906120fb565b9050610bb96001600160a01b038316338361135e565b610f0c603333611094565b610f285760405162461bcd60e51b8152600401610217906120c3565b6001600160a01b038216600090815260686020908152604080832080548251818502810185019093528083529192909190830182828015610f9257602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610f74575b5050505050905060005b8151811015610ffe57610ff58460696000868581518110610fbf57610fbf6120e5565b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000206113b090919063ffffffff16565b50600101610f9c565b506001600160a01b0383166000908152606860209081526040909120835161102892850190611c65565b5060005b825181101561108e57611085846069600086858151811061104f5761104f6120e5565b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000206113c590919063ffffffff16565b5060010161102c565b50505050565b6001600160a01b038116600090815260018301602052604081205415155b90505b92915050565b6110c4816112d1565b156111005760405162461bcd60e51b815260206004820152600c60248201526b5661756c742045786973747360a01b6044820152606401610217565b80600061110c826113da565b9050600061111982611535565b90506111266066856113c5565b5060005b81518160ff161015611166576111538560696000858560ff168151811061104f5761104f6120e5565b508061115e81612235565b91505061112a565b506001600160a01b0384166000908152606860209081526040909120825161119092840190611c65565b506001600160a01b03841660009081526068602052604090204360029091015560016111bc60666111ff565b6111c69190612254565b6001600160a01b03909416600090815260686020526040902060030193909355505050565b606060006111f8836117df565b9392505050565b60006110b5825490565b60006110b2838361183b565b61121e826112d1565b61126a5760405162461bcd60e51b815260206004820152601c60248201527f5661756c74206e6f7420666f756e6420696e2072656769737472792e000000006044820152606401610217565b6001600160a01b03919091166000908152606860205260409020600101805460ff1916911515919091179055565b600054610100900460ff166112bf5760405162461bcd60e51b815260040161021790612267565b6112c7611865565b6112cf61188c565b565b60006112dd60666111ff565b6000036112ec57506000919050565b6110b5606683611094565b801561130857610bb96033836113c5565b600161131460336111ff565b116113535760405162461bcd60e51b815260206004820152600f60248201526e21286d616e6167657273203e20312960881b6044820152606401610217565b610bb96033836113b0565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052610bb99084906118be565b60006110b2836001600160a01b038416611993565b60006110b2836001600160a01b038416611a86565b600080829050826001600160a01b031663a8c62e766040518163ffffffff1660e01b8152600401602060405180830381865afa92505050801561143a575060408051601f3d908101601f19168201909252611437918101906121fb565b60015b61147c5760405162461bcd60e51b81526020600482015260136024820152721059191c995cdcc81b9bdd08184815985d5b1d606a1b6044820152606401610217565b816001600160a01b0316816001600160a01b031663fbfa77cf6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156114c4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114e891906121fb565b6001600160a01b0316146111f85760405162461bcd60e51b81526020600482015260146024820152730acc2ead8e85ea6e8e4c2e8409ad2e6dac2e8c6d60631b6044820152606401610217565b6060816001600160a01b0316635ee167c06040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015611591575060408051601f3d908101601f1916820190925261158e918101906121fb565b60015b611680573d8080156115bf576040519150601f19603f3d011682016040523d82523d6000602084013e6115c4565b606091505b506040805160018082528183019092529060208083019080368337019050509150826001600160a01b0316631f1fcd516040518163ffffffff1660e01b8152600401602060405180830381865afa158015611623573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061164791906121fb565b8260008151811061165a5761165a6120e5565b60200260200101906001600160a01b031690816001600160a01b03168152505050919050565b604080516003808252608082019092529060208201606080368337019050509150826001600160a01b0316631f1fcd516040518163ffffffff1660e01b8152600401602060405180830381865afa1580156116df573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061170391906121fb565b82600081518110611716576117166120e5565b60200260200101906001600160a01b031690816001600160a01b031681525050808260018151811061174a5761174a6120e5565b60200260200101906001600160a01b031690816001600160a01b031681525050826001600160a01b031663877562b66040518163ffffffff1660e01b8152600401602060405180830381865afa1580156117a8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117cc91906121fb565b8260028151811061165a5761165a6120e5565b60608160000180548060200260200160405190810160405280929190818152602001828054801561182f57602002820191906000526020600020905b81548152602001906001019080831161181b575b50505050509050919050565b6000826000018281548110611852576118526120e5565b9060005260206000200154905092915050565b600054610100900460ff166112cf5760405162461bcd60e51b815260040161021790612267565b600054610100900460ff166118b35760405162461bcd60e51b815260040161021790612267565b6112cf3360016112f7565b6000611913826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611ad59092919063ffffffff16565b90508051600014806119345750808060200190518101906119349190612218565b610bb95760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610217565b60008181526001830160205260408120548015611a7c5760006119b7600183612254565b85549091506000906119cb90600190612254565b9050818114611a305760008660000182815481106119eb576119eb6120e5565b9060005260206000200154905080876000018481548110611a0e57611a0e6120e5565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080611a4157611a416122b2565b6001900381819060005260206000200160009055905585600101600086815260200190815260200160002060009055600193505050506110b5565b60009150506110b5565b6000818152600183016020526040812054611acd575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556110b5565b5060006110b5565b6060611ae48484600085611aec565b949350505050565b606082471015611b4d5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610217565b600080866001600160a01b03168587604051611b6991906122c8565b60006040518083038185875af1925050503d8060008114611ba6576040519150601f19603f3d011682016040523d82523d6000602084013e611bab565b606091505b5091509150611bbc87838387611bc7565b979650505050505050565b60608315611c36578251600003611c2f576001600160a01b0385163b611c2f5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610217565b5081611ae4565b611ae48383815115611c4b5781518083602001fd5b8060405162461bcd60e51b815260040161021791906122e4565b828054828255906000526020600020908101928215611cba579160200282015b82811115611cba57825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190611c85565b50611cc6929150611cca565b5090565b5b80821115611cc65760008155600101611ccb565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715611d1e57611d1e611cdf565b604052919050565b6001600160a01b03811681146106fa57600080fd5b600082601f830112611d4c57600080fd5b8135602067ffffffffffffffff821115611d6857611d68611cdf565b8160051b611d77828201611cf5565b9283528481018201928281019087851115611d9157600080fd5b83870192505b84831015611bbc578235611daa81611d26565b82529183019190830190611d97565b600060208284031215611dcb57600080fd5b813567ffffffffffffffff811115611de257600080fd5b611ae484828501611d3b565b60008151808452602080850194506020840160005b83811015611e285781516001600160a01b031687529582019590820190600101611e03565b509495945050505050565b6020815260006110b26020830184611dee565b600060208284031215611e5857600080fd5b81356111f881611d26565b600060208083018184528085518083526040925060408601915060408160051b8701018488016000805b84811015611f1357898403603f19018652825180516080808752815190870181905260a08701918b019085905b80821015611ee35782516001600160a01b03168452928c0192918c019160019190910190611eba565b505050898201511515868b0152888201518987015260609182015191909501529487019491870191600101611e8d565b50919998505050505050505050565b80151581146106fa57600080fd5b60008060408385031215611f4357600080fd5b823567ffffffffffffffff811115611f5a57600080fd5b611f6685828601611d3b565b9250506020830135611f7781611f22565b809150509250929050565b60005b83811015611f9d578181015183820152602001611f85565b50506000910152565b60008151808452611fbe816020860160208601611f82565b601f01601f19169290920160200192915050565b60e081526000611fe560e083018a611fa6565b6001600160a01b03891660208401528715156040840152828103606084015261200e8188611dee565b6080840196909652505091151560a083015260c090910152949350505050565b60006020828403121561204057600080fd5b5035919050565b6000806040838503121561205a57600080fd5b823561206581611d26565b946020939093013593505050565b6000806040838503121561208657600080fd5b823561209181611d26565b9150602083013567ffffffffffffffff8111156120ad57600080fd5b6120b985828601611d3b565b9150509250929050565b60208082526008908201526710b6b0b730b3b2b960c11b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b60006020828403121561210d57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b60006001820161213c5761213c612114565b5060010190565b6040815260006121566040830185611dee565b905082151560208301529392505050565b60006020828403121561217957600080fd5b815167ffffffffffffffff8082111561219157600080fd5b818401915084601f8301126121a557600080fd5b8151818111156121b7576121b7611cdf565b6121ca601f8201601f1916602001611cf5565b91508082528560208285010111156121e157600080fd5b6121f2816020840160208601611f82565b50949350505050565b60006020828403121561220d57600080fd5b81516111f881611d26565b60006020828403121561222a57600080fd5b81516111f881611f22565b600060ff821660ff810361224b5761224b612114565b60010192915050565b818103818111156110b5576110b5612114565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b634e487b7160e01b600052603160045260246000fd5b600082516122da818460208701611f82565b9190910192915050565b6020815260006110b26020830184611fa656fea26469706673582212206a52d74a9ba32e9d7c049fa28c465d1af24a6b09a0cc4d3c12eae17b02b34ebb64736f6c63430008170033

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106100cf5760003560e01c806390229af71161008c578063a791b51a11610066578063a791b51a146101a4578063c54deca3146101b7578063def68a9c146101ca578063e7ddc9df146101dd57600080fd5b806390229af71461015857806396e5bb4f1461017e578063a57b8b141461019157600080fd5b806319e80b8d146100d457806337c0898c146100e957806362ebc82814610107578063700731511461012757806374d4e4911461013a5780638129fc1c14610150575b600080fd5b6100e76100e2366004611db9565b6101f0565b005b6100f1610291565b6040516100fe9190611e33565b60405180910390f35b61011a610115366004611e46565b6102a2565b6040516100fe9190611e63565b6100e7610135366004611f30565b610548565b6101426105e4565b6040519081526020016100fe565b6100e76105f0565b61016b610166366004611e46565b6106fd565b6040516100fe9796959493929190611fd2565b61011a61018c36600461202e565b61096f565b6100e761019f366004611f30565b610b5b565b6100e76101b2366004612047565b610bbe565b61011a6101c5366004611e46565b610c93565b6100e76101d8366004611e46565b610e57565b6100e76101eb366004612073565b610f01565b6101fb603333611094565b6102205760405162461bcd60e51b8152600401610217906120c3565b60405180910390fd5b60005b81518110156102565761024e828281518110610241576102416120e5565b60200260200101516110bb565b600101610223565b507fe2520439aaecc0a223ec751bfe094774d6bc409d92da7560c00237209b58f2eb816040516102869190611e33565b60405180910390a150565b606061029d60666111eb565b905090565b606060008060005b6102b460666111ff565b8110156103505760006102c8606683611209565b6040516370a0823160e01b81526001600160a01b03888116600483015291909116906370a0823190602401602060405180830381865afa158015610310573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061033491906120fb565b111561034857816103448161212a565b9250505b6001016102aa565b508067ffffffffffffffff81111561036a5761036a611cdf565b6040519080825280602002602001820160405280156103c857816020015b6103b560405180608001604052806060815260200160001515815260200160008152602001600081525090565b8152602001906001900390816103885790505b50925060005b6103d860666111ff565b8110156105405760006103ec606683611209565b6040516370a0823160e01b81526001600160a01b03888116600483015291909116906370a0823190602401602060405180830381865afa158015610434573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061045891906120fb565b1115610538576068600061046d606684611209565b6001600160a01b0316815260208082019290925260409081016000208151815460a094810282018501909352608081018381529093919284928491908401828280156104e257602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116104c4575b5050509183525050600182015460ff161515602082015260028201546040820152600390910154606090910152848461051a8161212a565b95508151811061052c5761052c6120e5565b60200260200101819052505b6001016103ce565b505050919050565b610553603333611094565b61056f5760405162461bcd60e51b8152600401610217906120c3565b60005b82518110156105a65761059e838281518110610590576105906120e5565b602002602001015183611215565b600101610572565b507f207a353f62927794026d0d6e50f580af1bd000b8ad4ee6f3f4c876ca573eff5182826040516105d8929190612143565b60405180910390a15050565b600061029d60666111ff565b600054610100900460ff16158080156106105750600054600160ff909116105b8061062a5750303b15801561062a575060005460ff166001145b61068d5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610217565b6000805460ff1916600117905580156106b0576000805461ff0019166101001790555b6106b8611298565b80156106fa576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb384740249890602001610286565b50565b606060008060606000806000610712886112d1565b6107565760405162461bcd60e51b8152602060048201526015602482015274496e76616c6964205661756c74204164647265737360581b6044820152606401610217565b6001600160a01b03881660009081526068602090815260408083208151815460a094810282018501909352608081018381528d9594919384928491908401828280156107cb57602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116107ad575b505050505081526020016001820160009054906101000a900460ff16151515158152602001600282015481526020016003820154815250509050816001600160a01b03166306fdde036040518163ffffffff1660e01b8152600401600060405180830381865afa158015610843573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261086b9190810190612167565b9850816001600160a01b031663a8c62e766040518163ffffffff1660e01b8152600401602060405180830381865afa1580156108ab573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108cf91906121fb565b9750876001600160a01b0316635c975abb6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561090f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109339190612218565b81516040808401516020948501516001600160a01b03909e166000908152606a9095529320549a9c999b919a9099929850909650945092505050565b606060008060005b61098160666111ff565b8110156109d7578460686000610998606685611209565b6001600160a01b03166001600160a01b0316815260200190815260200160002060020154106109cf57816109cb8161212a565b9250505b600101610977565b508067ffffffffffffffff8111156109f1576109f1611cdf565b604051908082528060200260200182016040528015610a4f57816020015b610a3c60405180608001604052806060815260200160001515815260200160008152602001600081525090565b815260200190600190039081610a0f5790505b50925060005b610a5f60666111ff565b811015610540576000606881610a76606685611209565b6001600160a01b0316815260208082019290925260409081016000208151815460a09481028201850190935260808101838152909391928492849190840182828015610aeb57602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610acd575b5050509183525050600182015460ff161515602082015260028201546040808301919091526003909201546060909101528101519091508611610b5257808585610b348161212a565b965081518110610b4657610b466120e5565b60200260200101819052505b50600101610a55565b610b66603333611094565b610b825760405162461bcd60e51b8152600401610217906120c3565b60005b8251811015610bb957610bb1838281518110610ba357610ba36120e5565b6020026020010151836112f7565b600101610b85565b505050565b610bc9603333611094565b610be55760405162461bcd60e51b8152600401610217906120c3565b610bee826112d1565b610c3a5760405162461bcd60e51b815260206004820152601c60248201527f5661756c74206e6f7420666f756e6420696e2072656769737472792e000000006044820152606401610217565b6001600160a01b0382166000818152606a602052604090819020839055517f20f63c211ddc8421b87c81e1d29de92aacc342858938e4f39fb9aacee4794b5790610c879084815260200190565b60405180910390a25050565b6001600160a01b0381166000908152606960205260409020606090610cb7906111ff565b67ffffffffffffffff811115610ccf57610ccf611cdf565b604051908082528060200260200182016040528015610d2d57816020015b610d1a60405180608001604052806060815260200160001515815260200160008152602001600081525090565b815260200190600190039081610ced5790505b50905060005b6001600160a01b0383166000908152606960205260409020610d54906111ff565b811015610e51576001600160a01b03831660009081526069602052604081206068908290610d829085611209565b6001600160a01b0316815260208082019290925260409081016000208151815460a09481028201850190935260808101838152909391928492849190840182828015610df757602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610dd9575b5050509183525050600182015460ff16151560208201526002820154604082015260039091015460609091015283519091508190849084908110610e3d57610e3d6120e5565b602090810291909101015250600101610d33565b50919050565b610e62603333611094565b610e7e5760405162461bcd60e51b8152600401610217906120c3565b6040516370a0823160e01b815230600482015281906000906001600160a01b038316906370a0823190602401602060405180830381865afa158015610ec7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610eeb91906120fb565b9050610bb96001600160a01b038316338361135e565b610f0c603333611094565b610f285760405162461bcd60e51b8152600401610217906120c3565b6001600160a01b038216600090815260686020908152604080832080548251818502810185019093528083529192909190830182828015610f9257602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610f74575b5050505050905060005b8151811015610ffe57610ff58460696000868581518110610fbf57610fbf6120e5565b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000206113b090919063ffffffff16565b50600101610f9c565b506001600160a01b0383166000908152606860209081526040909120835161102892850190611c65565b5060005b825181101561108e57611085846069600086858151811061104f5761104f6120e5565b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000206113c590919063ffffffff16565b5060010161102c565b50505050565b6001600160a01b038116600090815260018301602052604081205415155b90505b92915050565b6110c4816112d1565b156111005760405162461bcd60e51b815260206004820152600c60248201526b5661756c742045786973747360a01b6044820152606401610217565b80600061110c826113da565b9050600061111982611535565b90506111266066856113c5565b5060005b81518160ff161015611166576111538560696000858560ff168151811061104f5761104f6120e5565b508061115e81612235565b91505061112a565b506001600160a01b0384166000908152606860209081526040909120825161119092840190611c65565b506001600160a01b03841660009081526068602052604090204360029091015560016111bc60666111ff565b6111c69190612254565b6001600160a01b03909416600090815260686020526040902060030193909355505050565b606060006111f8836117df565b9392505050565b60006110b5825490565b60006110b2838361183b565b61121e826112d1565b61126a5760405162461bcd60e51b815260206004820152601c60248201527f5661756c74206e6f7420666f756e6420696e2072656769737472792e000000006044820152606401610217565b6001600160a01b03919091166000908152606860205260409020600101805460ff1916911515919091179055565b600054610100900460ff166112bf5760405162461bcd60e51b815260040161021790612267565b6112c7611865565b6112cf61188c565b565b60006112dd60666111ff565b6000036112ec57506000919050565b6110b5606683611094565b801561130857610bb96033836113c5565b600161131460336111ff565b116113535760405162461bcd60e51b815260206004820152600f60248201526e21286d616e6167657273203e20312960881b6044820152606401610217565b610bb96033836113b0565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052610bb99084906118be565b60006110b2836001600160a01b038416611993565b60006110b2836001600160a01b038416611a86565b600080829050826001600160a01b031663a8c62e766040518163ffffffff1660e01b8152600401602060405180830381865afa92505050801561143a575060408051601f3d908101601f19168201909252611437918101906121fb565b60015b61147c5760405162461bcd60e51b81526020600482015260136024820152721059191c995cdcc81b9bdd08184815985d5b1d606a1b6044820152606401610217565b816001600160a01b0316816001600160a01b031663fbfa77cf6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156114c4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114e891906121fb565b6001600160a01b0316146111f85760405162461bcd60e51b81526020600482015260146024820152730acc2ead8e85ea6e8e4c2e8409ad2e6dac2e8c6d60631b6044820152606401610217565b6060816001600160a01b0316635ee167c06040518163ffffffff1660e01b8152600401602060405180830381865afa925050508015611591575060408051601f3d908101601f1916820190925261158e918101906121fb565b60015b611680573d8080156115bf576040519150601f19603f3d011682016040523d82523d6000602084013e6115c4565b606091505b506040805160018082528183019092529060208083019080368337019050509150826001600160a01b0316631f1fcd516040518163ffffffff1660e01b8152600401602060405180830381865afa158015611623573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061164791906121fb565b8260008151811061165a5761165a6120e5565b60200260200101906001600160a01b031690816001600160a01b03168152505050919050565b604080516003808252608082019092529060208201606080368337019050509150826001600160a01b0316631f1fcd516040518163ffffffff1660e01b8152600401602060405180830381865afa1580156116df573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061170391906121fb565b82600081518110611716576117166120e5565b60200260200101906001600160a01b031690816001600160a01b031681525050808260018151811061174a5761174a6120e5565b60200260200101906001600160a01b031690816001600160a01b031681525050826001600160a01b031663877562b66040518163ffffffff1660e01b8152600401602060405180830381865afa1580156117a8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117cc91906121fb565b8260028151811061165a5761165a6120e5565b60608160000180548060200260200160405190810160405280929190818152602001828054801561182f57602002820191906000526020600020905b81548152602001906001019080831161181b575b50505050509050919050565b6000826000018281548110611852576118526120e5565b9060005260206000200154905092915050565b600054610100900460ff166112cf5760405162461bcd60e51b815260040161021790612267565b600054610100900460ff166118b35760405162461bcd60e51b815260040161021790612267565b6112cf3360016112f7565b6000611913826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316611ad59092919063ffffffff16565b90508051600014806119345750808060200190518101906119349190612218565b610bb95760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610217565b60008181526001830160205260408120548015611a7c5760006119b7600183612254565b85549091506000906119cb90600190612254565b9050818114611a305760008660000182815481106119eb576119eb6120e5565b9060005260206000200154905080876000018481548110611a0e57611a0e6120e5565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080611a4157611a416122b2565b6001900381819060005260206000200160009055905585600101600086815260200190815260200160002060009055600193505050506110b5565b60009150506110b5565b6000818152600183016020526040812054611acd575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556110b5565b5060006110b5565b6060611ae48484600085611aec565b949350505050565b606082471015611b4d5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610217565b600080866001600160a01b03168587604051611b6991906122c8565b60006040518083038185875af1925050503d8060008114611ba6576040519150601f19603f3d011682016040523d82523d6000602084013e611bab565b606091505b5091509150611bbc87838387611bc7565b979650505050505050565b60608315611c36578251600003611c2f576001600160a01b0385163b611c2f5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610217565b5081611ae4565b611ae48383815115611c4b5781518083602001fd5b8060405162461bcd60e51b815260040161021791906122e4565b828054828255906000526020600020908101928215611cba579160200282015b82811115611cba57825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190611c85565b50611cc6929150611cca565b5090565b5b80821115611cc65760008155600101611ccb565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715611d1e57611d1e611cdf565b604052919050565b6001600160a01b03811681146106fa57600080fd5b600082601f830112611d4c57600080fd5b8135602067ffffffffffffffff821115611d6857611d68611cdf565b8160051b611d77828201611cf5565b9283528481018201928281019087851115611d9157600080fd5b83870192505b84831015611bbc578235611daa81611d26565b82529183019190830190611d97565b600060208284031215611dcb57600080fd5b813567ffffffffffffffff811115611de257600080fd5b611ae484828501611d3b565b60008151808452602080850194506020840160005b83811015611e285781516001600160a01b031687529582019590820190600101611e03565b509495945050505050565b6020815260006110b26020830184611dee565b600060208284031215611e5857600080fd5b81356111f881611d26565b600060208083018184528085518083526040925060408601915060408160051b8701018488016000805b84811015611f1357898403603f19018652825180516080808752815190870181905260a08701918b019085905b80821015611ee35782516001600160a01b03168452928c0192918c019160019190910190611eba565b505050898201511515868b0152888201518987015260609182015191909501529487019491870191600101611e8d565b50919998505050505050505050565b80151581146106fa57600080fd5b60008060408385031215611f4357600080fd5b823567ffffffffffffffff811115611f5a57600080fd5b611f6685828601611d3b565b9250506020830135611f7781611f22565b809150509250929050565b60005b83811015611f9d578181015183820152602001611f85565b50506000910152565b60008151808452611fbe816020860160208601611f82565b601f01601f19169290920160200192915050565b60e081526000611fe560e083018a611fa6565b6001600160a01b03891660208401528715156040840152828103606084015261200e8188611dee565b6080840196909652505091151560a083015260c090910152949350505050565b60006020828403121561204057600080fd5b5035919050565b6000806040838503121561205a57600080fd5b823561206581611d26565b946020939093013593505050565b6000806040838503121561208657600080fd5b823561209181611d26565b9150602083013567ffffffffffffffff8111156120ad57600080fd5b6120b985828601611d3b565b9150509250929050565b60208082526008908201526710b6b0b730b3b2b960c11b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b60006020828403121561210d57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b60006001820161213c5761213c612114565b5060010190565b6040815260006121566040830185611dee565b905082151560208301529392505050565b60006020828403121561217957600080fd5b815167ffffffffffffffff8082111561219157600080fd5b818401915084601f8301126121a557600080fd5b8151818111156121b7576121b7611cdf565b6121ca601f8201601f1916602001611cf5565b91508082528560208285010111156121e157600080fd5b6121f2816020840160208601611f82565b50949350505050565b60006020828403121561220d57600080fd5b81516111f881611d26565b60006020828403121561222a57600080fd5b81516111f881611f22565b600060ff821660ff810361224b5761224b612114565b60010192915050565b818103818111156110b5576110b5612114565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b634e487b7160e01b600052603160045260246000fd5b600082516122da818460208701611f82565b9190910192915050565b6020815260006110b26020830184611fa656fea26469706673582212206a52d74a9ba32e9d7c049fa28c465d1af24a6b09a0cc4d3c12eae17b02b34ebb64736f6c63430008170033

Block Transaction 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

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.