ETH Price: $3,542.53 (+3.34%)

Contract

0xDEb0f082ed3B0eFe9257aea9F2E6e974aa4120c3

Overview

ETH Balance

0 ETH

ETH Value

$0.00

More Info

Private Name Tags

Multichain Info

No addresses found
Age:30D
Amount:Between 1-100k
Reset Filter

Transaction Hash
Method
Block
From
To

There are no matching entries

1 Internal Transaction found.

Latest 1 internal transaction

Parent Transaction Hash Block From To
2660526972024-10-21 7:06:15388 days ago1729494375  Contract Creation0 ETH

Cross-Chain Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Depot

Compiler Version
v0.7.6+commit.7338295f

Optimization Enabled:
Yes with 200 runs

Other Settings:
istanbul EvmVersion
// SPDX-License-Identifier: MIT

pragma solidity ^0.7.6;
pragma experimental ABIEncoderV2;

import "@openzeppelin/contracts/drafts/IERC20Permit.sol";
import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "./facets/DepotFacet.sol";
import "./facets/TokenSupportFacet.sol";
import "./interfaces/IBeanstalk.sol";
import "./interfaces/IERC4494.sol";
import "./libraries/LibFunction.sol";

/**
 * @title Depot
 * @author Publius
 * @notice Depot wraps Pipeline's Pipe functions to facilitate the loading of non-Ether assets in Pipeline
 * in the same transaction that loads Ether, Pipes calls to other protocols and unloads Pipeline.
 * https://evmpipeline.org
**/

contract Depot is DepotFacet, TokenSupportFacet {

    using SafeERC20 for IERC20;

    IBeanstalk private constant beanstalk =
        IBeanstalk(0xD1A0060ba708BC4BCD3DA6C37EFa8deDF015FB70);

    /**
     * @dev So Depot can receive Ether.
     */
    receive() external payable {}

    /**
     * @dev Returns the current version of Depot.
     */
    function version() external pure returns (string memory) {
        return "1.0.1";
    }

    /**
     * 
     * Farm
     * 
    **/

    /**
     * @notice Execute multiple function calls in Depot.
     * @param data list of encoded function calls to be executed
     * @return results list of return data from each function call
     * @dev Implementation from https://github.com/Uniswap/v3-periphery/blob/main/contracts/base/Multicall.sol.
    **/
    function farm(bytes[] calldata data)
        external
        payable
        returns (bytes[] memory results)
    {
        results = new bytes[](data.length);
        for (uint256 i = 0; i < data.length; i++) {
            (bool success, bytes memory result) = address(this).delegatecall(data[i]);
            LibFunction.checkReturn(success, result);
            results[i] = result;
        }
    }

    /**
     *
     * Transfer
     *
    **/

    /**
     * @notice Execute a Beanstalk ERC-20 token transfer.
     * @dev See {TokenFacet-transferToken}.
     * @dev Only supports INTERNAL and EXTERNAL From modes.
    **/
    function transferToken(
        IERC20 token,
        address recipient,
        uint256 amount,
        From fromMode,
        To toMode
    ) external payable {
        if (fromMode == From.EXTERNAL) {
            token.safeTransferFrom(msg.sender, recipient, amount);
        } else if (fromMode == From.INTERNAL) {
            beanstalk.transferInternalTokenFrom(token, msg.sender, recipient, amount, toMode);
        } else {
            revert("Mode not supported");
        }
    }

    /**
     * @notice Execute a single Beanstalk Deposit transfer.
     * @dev See {SiloFacet-transferDeposit}.
    **/
    function transferDeposit(
        address sender,
        address recipient,
        address token,
        int96 stem,
        uint256 amount
    ) external payable returns (uint256 bdv) {
        require(sender == msg.sender, "invalid sender");
        bdv = beanstalk.transferDeposit(msg.sender, recipient, token, stem, amount);
    }

    /**
     * @notice Execute multiple Beanstalk Deposit transfers of a single Whitelisted Tokens.
     * @dev See {SiloFacet-transferDeposits}.
    **/
    function transferDeposits(
        address sender,
        address recipient,
        address token,
        int96[] calldata stems,
        uint256[] calldata amounts
    ) external payable returns (uint256[] memory bdvs) {
        require(sender == msg.sender, "invalid sender");
        bdvs = beanstalk.transferDeposits(msg.sender, recipient, token, stems, amounts);
    }

    /**
     *
     * Permits
     *
    **/

    /**
     * @notice Execute a permit for an ERC-20 Token stored in a Beanstalk Farm balance.
     * @dev See {TokenFacet-permitToken}.
    **/
    function permitToken(
        address owner,
        address spender,
        address token,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external payable {
        beanstalk.permitToken(owner, spender, token, value, deadline, v, r, s);
    }

    /**
     * @notice Execute a permit for Beanstalk Deposits of a single Whitelisted Token.
     * @dev See {SiloFacet-permitDeposit}.
    **/
    function permitDeposit(
        address owner,
        address spender,
        address token,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external payable {
        beanstalk.permitDeposit(owner, spender, token, value, deadline, v, r, s);
    }

    /**
     * @notice Execute a permit for a Beanstalk Deposits of a multiple Whitelisted Tokens.
     * @dev See {SiloFacet-permitDeposits}.
    **/
    function permitDeposits(
        address owner,
        address spender,
        address[] calldata tokens,
        uint256[] calldata values,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external payable {
        beanstalk.permitDeposits(owner, spender, tokens, values, deadline, v, r, s);
    }
}

// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <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.
 */
interface IERC20Permit {
    /**
     * @dev Sets `value` as the allowance of `spender` over `owner`'s tokens,
     * given `owner`'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     */
    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);
}

// SPDX-License-Identifier: MIT

pragma solidity >=0.6.2 <0.8.0;

import "../../introspection/IERC165.sol";

/**
 * @dev Required interface of an ERC1155 compliant contract, as defined in the
 * https://eips.ethereum.org/EIPS/eip-1155[EIP].
 *
 * _Available since v3.1._
 */
interface IERC1155 is IERC165 {
    /**
     * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.
     */
    event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);

    /**
     * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all
     * transfers.
     */
    event TransferBatch(address indexed operator, address indexed from, address indexed to, uint256[] ids, uint256[] values);

    /**
     * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to
     * `approved`.
     */
    event ApprovalForAll(address indexed account, address indexed operator, bool approved);

    /**
     * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.
     *
     * If an {URI} event was emitted for `id`, the standard
     * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value
     * returned by {IERC1155MetadataURI-uri}.
     */
    event URI(string value, uint256 indexed id);

    /**
     * @dev Returns the amount of tokens of token type `id` owned by `account`.
     *
     * Requirements:
     *
     * - `account` cannot be the zero address.
     */
    function balanceOf(address account, uint256 id) external view returns (uint256);

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.
     *
     * Requirements:
     *
     * - `accounts` and `ids` must have the same length.
     */
    function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids) external view returns (uint256[] memory);

    /**
     * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,
     *
     * Emits an {ApprovalForAll} event.
     *
     * Requirements:
     *
     * - `operator` cannot be the caller.
     */
    function setApprovalForAll(address operator, bool approved) external;

    /**
     * @dev Returns true if `operator` is approved to transfer ``account``'s tokens.
     *
     * See {setApprovalForAll}.
     */
    function isApprovedForAll(address account, address operator) external view returns (bool);

    /**
     * @dev Transfers `amount` tokens of token type `id` from `from` to `to`.
     *
     * Emits a {TransferSingle} event.
     *
     * Requirements:
     *
     * - `to` cannot be the zero address.
     * - If the caller is not `from`, it must be have been approved to spend ``from``'s tokens via {setApprovalForAll}.
     * - `from` must have a balance of tokens of type `id` of at least `amount`.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
     * acceptance magic value.
     */
    function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes calldata data) external;

    /**
     * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.
     *
     * Emits a {TransferBatch} event.
     *
     * Requirements:
     *
     * - `ids` and `amounts` must have the same length.
     * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
     * acceptance magic value.
     */
    function safeBatchTransferFrom(address from, address to, uint256[] calldata ids, uint256[] calldata amounts, bytes calldata data) external;
}

// SPDX-License-Identifier: MIT

pragma solidity >=0.6.2 <0.8.0;

import "../../introspection/IERC165.sol";

/**
 * @dev Required interface of an ERC721 compliant contract.
 */
interface IERC721 is IERC165 {
    /**
     * @dev Emitted when `tokenId` token is transferred from `from` to `to`.
     */
    event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
     */
    event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);

    /**
     * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
     */
    event ApprovalForAll(address indexed owner, address indexed operator, bool approved);

    /**
     * @dev Returns the number of tokens in ``owner``'s account.
     */
    function balanceOf(address owner) external view returns (uint256 balance);

    /**
     * @dev Returns the owner of the `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function ownerOf(uint256 tokenId) external view returns (address owner);

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
     * are aware of the ERC721 protocol to prevent tokens from being forever locked.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(address from, address to, uint256 tokenId) external;

    /**
     * @dev Transfers `tokenId` token from `from` to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address from, address to, uint256 tokenId) external;

    /**
     * @dev Gives permission to `to` to transfer `tokenId` token to another account.
     * The approval is cleared when the token is transferred.
     *
     * Only a single account can be approved at a time, so approving the zero address clears previous approvals.
     *
     * Requirements:
     *
     * - The caller must own the token or be an approved operator.
     * - `tokenId` must exist.
     *
     * Emits an {Approval} event.
     */
    function approve(address to, uint256 tokenId) external;

    /**
     * @dev Returns the account approved for `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function getApproved(uint256 tokenId) external view returns (address operator);

    /**
     * @dev Approve or remove `operator` as an operator for the caller.
     * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
     *
     * Requirements:
     *
     * - The `operator` cannot be the caller.
     *
     * Emits an {ApprovalForAll} event.
     */
    function setApprovalForAll(address operator, bool _approved) external;

    /**
     * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
     *
     * See {setApprovalForAll}
     */
    function isApprovedForAll(address owner, address operator) external view returns (bool);

    /**
      * @dev Safely transfers `tokenId` token from `from` to `to`.
      *
      * Requirements:
      *
      * - `from` cannot be the zero address.
      * - `to` cannot be the zero address.
      * - `tokenId` token must exist and be owned by `from`.
      * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
      * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
      *
      * Emits a {Transfer} event.
      */
    function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;
}

// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

import "./IERC20.sol";
import "../../math/SafeMath.sol";
import "../../utils/Address.sol";

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

    function safeTransfer(IERC20 token, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
    }

    /**
     * @dev Deprecated. This function has issues similar to the ones found in
     * {IERC20-approve}, and its usage is discouraged.
     *
     * Whenever possible, use {safeIncreaseAllowance} and
     * {safeDecreaseAllowance} instead.
     */
    function safeApprove(IERC20 token, address spender, uint256 value) internal {
        // safeApprove should only be called when setting an initial allowance,
        // or when resetting it to zero. To increase and decrease it, use
        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
        // solhint-disable-next-line max-line-length
        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));
    }

    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 newAllowance = token.allowance(address(this), spender).add(value);
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

    function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero");
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
    }

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

        bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
        if (returndata.length > 0) { // Return data is optional
            // solhint-disable-next-line max-line-length
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}

/**
 * SPDX-License-Identifier: MIT
 **/

pragma solidity ^0.7.6;
pragma experimental ABIEncoderV2;

import "../interfaces/IPipeline.sol";
import "../libraries/LibFunction.sol";
// import "../libraries/Token/LibEth.sol";

/**
 * @title Depot Facet
 * @author Publius
 * @notice DepotFacet wraps Pipeline's Pipe functions to facilitate the loading of non-Ether assets in Pipeline
 * in the same transaction that loads Ether, Pipes calls to other protocols and unloads Pipeline.
 **/

contract DepotFacet {

    // Pipeline V1.0.1
    address private constant PIPELINE =
        0xb1bE000644bD25996b0d9C2F7a6D6BA3954c91B0;

    /**
     * @notice Pipe a PipeCall through Pipeline.
     * @param p PipeCall to pipe through Pipeline
     * @return result PipeCall return value
    **/
    function pipe(PipeCall calldata p)
        external
        payable
        returns (bytes memory result)
    {
        result = IPipeline(PIPELINE).pipe(p);
    }

    /**
     * @notice Pipe multiple PipeCalls through Pipeline.
     * Does not support sending Ether in the call
     * @param pipes list of PipeCalls to pipe through Pipeline
     * @return results list of return values from each PipeCall
    **/
    function multiPipe(PipeCall[] calldata pipes)
        external
        payable
        returns (bytes[] memory results)
    {
        results = IPipeline(PIPELINE).multiPipe(pipes);
    }

    /**
     * @notice Pipe multiple AdvancedPipeCalls through Pipeline.
     * @param pipes list of AdvancedPipeCalls to pipe through Pipeline
     * @return results list of return values from each AdvancedPipeCall
    **/
    function advancedPipe(AdvancedPipeCall[] calldata pipes, uint256 value)
        external
        payable
        returns (bytes[] memory results)
    {
        results = IPipeline(PIPELINE).advancedPipe{value: value}(pipes);
        // LibEth.refundEth();
    }

    /**
     * @notice Pipe a PipeCall through Pipeline with an Ether value.
     * @param p PipeCall to pipe through Pipeline
     * @param value Ether value to send in Pipecall
     * @return result PipeCall return value
    **/
    function etherPipe(PipeCall calldata p, uint256 value)
        external
        payable
        returns (bytes memory result)
    {
        result = IPipeline(PIPELINE).pipe{value: value}(p);
        // LibEth.refundEth();
    }

    /**
     * @notice Return the return value of a PipeCall without executing it.
     * @param p PipeCall to execute with a staticcall
     * @return result PipeCall return value
    **/
    function readPipe(PipeCall calldata p)
        external
        view
        returns (bytes memory result)
    {
        bool success;
        // Use a static call to ensure no state modification
        (success, result) = p.target.staticcall(p.data);
        LibFunction.checkReturn(success, result);
    }
}

/**
 * SPDX-License-Identifier: MIT
 **/

pragma solidity =0.7.6;
pragma experimental ABIEncoderV2;

import "@openzeppelin/contracts/drafts/IERC20Permit.sol";
import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "../interfaces/IERC4494.sol";

/**
 * @author Publius
 * @title TokenSupportFacet 
 * @notice Permit ERC-20 and ERC-721 tokens and transfer ERC-721 and ERC-1155 tokens.
 * @dev To transfer ERC-20 tokens, use {TokenFacet.transferToken}.
 **/

contract TokenSupportFacet {

    /**
     * 
     * ERC-20
     * 
     */

    /// @notice permitERC20 is wrapper function for permit of ERC20Permit token
    /// @dev See {IERC20Permit-permit}.
    function permitERC20(
        IERC20Permit token,
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) public payable {
        token.permit(owner, spender, value, deadline, v, r, s);
    }

    /**
     * 
     * ERC-721
     * 
    **/

    /**
     * @notice Execute an ERC-721 token transfer
     * @dev Wraps {IERC721-safeBatchTransferFrom}.
    **/
    function transferERC721(
        IERC721 token,
        address to,
        uint256 id
    ) external payable {
        token.safeTransferFrom(msg.sender, to, id);
    }

    /**
     * @notice Execute a permit for an ERC-721 token.
     * @dev See {IERC4494-permit}.
    **/
    function permitERC721(
        IERC4494 token,
        address spender,
        uint256 tokenId,
        uint256 deadline,
        bytes memory sig
    ) external payable {
        token.permit(spender, tokenId, deadline, sig);
    }

    /**
     * 
     * ERC-1155
     * 
    **/

    /**
     * @notice Execute an ERC-1155 token transfer of a single Id.
     * @dev Wraps {IERC1155-safeTransferFrom}.
    **/
    function transferERC1155(
        IERC1155 token,
        address to,
        uint256 id,
        uint256 value
    ) external payable {
        token.safeTransferFrom(msg.sender, to, id, value, new bytes(0));
    }

    /**
     * @notice Execute an ERC-1155 token transfer of multiple Ids.
     * @dev Wraps {IERC1155-safeBatchTransferFrom}.
    **/
    function batchTransferERC1155(
        IERC1155 token,
        address to,
        uint256[] calldata ids,
        uint256[] calldata values
    ) external payable {
        token.safeBatchTransferFrom(msg.sender, to, ids, values, new bytes(0));
    }
}

// SPDX-License-Identifier: MIT
pragma experimental ABIEncoderV2;
pragma solidity =0.7.6;

import "@openzeppelin/contracts/drafts/IERC20Permit.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";

enum From {
    EXTERNAL,
    INTERNAL,
    EXTERNAL_INTERNAL,
    INTERNAL_TOLERANT
}
enum To {
    EXTERNAL,
    INTERNAL
}

interface IBeanstalk {
    function transferInternalTokenFrom(
        IERC20 token,
        address sender,
        address recipient,
        uint256 amount,
        To toMode
    ) external payable;

    function permitToken(
        address owner,
        address spender,
        address token,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external payable;

    function transferDeposit(
        address sender,
        address recipient,
        address token,
        int96 stem,
        uint256 amount
    ) external payable returns (uint256 bdv);

    function transferDeposits(
        address sender,
        address recipient,
        address token,
        int96[] calldata stems,
        uint256[] calldata amounts
    ) external payable returns (uint256[] memory bdvs);

    function permitDeposits(
        address owner,
        address spender,
        address[] calldata tokens,
        uint256[] calldata values,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external payable;

    function permitDeposit(
        address owner,
        address spender,
        address token,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external payable;
}

// SPDX-License-Identifier: MIT

pragma solidity ^0.7.6;
pragma experimental ABIEncoderV2;

import "@openzeppelin/contracts/introspection/IERC165.sol";

/// Implementation from https://eips.ethereum.org/EIPS/eip-4494
/// @dev Interface for token permits for ERC-721
///
interface IERC4494 is IERC165{
  /// ERC165 bytes to add to interface array - set in parent contract
  ///
  /// _INTERFACE_ID_ERC4494 = 0x5604e225

  /// @notice Function to approve by way of owner signature
  /// @param spender the address to approve
  /// @param tokenId the index of the NFT to approve the spender on
  /// @param deadline a timestamp expiry for the permit
  /// @param sig a traditional or EIP-2098 signature
  function permit(address spender, uint256 tokenId, uint256 deadline, bytes memory sig) external;
  /// @notice Returns the nonce of an NFT - useful for creating permits
  /// @param tokenId the index of the NFT to get the nonce of
  /// @return the uint256 representation of the nonce
  function nonces(uint256 tokenId) external view returns(uint256);
  /// @notice Returns the domain separator used in the encoding of the signature for permits, as defined by EIP-712
  /// @return the bytes32 domain separator
  function DOMAIN_SEPARATOR() external view returns(bytes32);
}

/*
 SPDX-License-Identifier: MIT
*/

pragma solidity =0.7.6;
pragma experimental ABIEncoderV2;

/**
 * @title Lib Function
 * @author Publius
 **/

library LibFunction {
    /**
     * @notice Checks The return value of a any function call for success, if not returns the error returned in `results`
     * @param success Whether the corresponding function call succeeded
     * @param result The return data of the corresponding function call
    **/
    function checkReturn(bool success, bytes memory result) internal pure {
        if (!success) {
            // Next 5 lines from https://ethereum.stackexchange.com/a/83577
            // Also, used in Uniswap V3 https://github.com/Uniswap/v3-periphery/blob/main/contracts/base/Multicall.sol#L17
            if (result.length < 68) revert();
            assembly {
                result := add(result, 0x04)
            }
            revert(abi.decode(result, (string)));
        }
    }

    /** @notice Use a Clipboard on callData to copy return values stored as returnData from any Advanced Calls
     * that have already been executed and paste them into the callData of the next Advanced Call, in a customizable manner
     * @param callData The callData bytes of next Advanced Call to paste onto
     * @param clipboard 0, 1 or n encoded paste operations and encoded ether value if using Pipeline
     * -------------------------------------------------------------------------------------
     * Clipboard stores the bytes:
     * [ Type   | Use Ether Flag*  | Type data      | Ether Value (only if flag == 1)*]
     * [ 1 byte | 1 byte           | n bytes        | 0 or 32 bytes                   ]
     * * Use Ether Flag and Ether Value are processed in Pipeline.sol (Not used in Farm). See Pipeline.getEthValue for ussage.
     * Type: 0x00, 0x01 or 0x002
     *  - 0x00: 0 Paste Operations (Logic in Pipeline.sol and FarmFacet.sol)
     *  - 0x01: 1 Paste Operation
     *  - 0x02: n Paste Operations
     * Type Data: There are two types with type data: 0x01, 0x02
     *  Type 1 (0x01): Copy 1 bytes32 from a previous function return value
     *       [ pasteParams ]
     *       [ 32 bytes ]
     *      Note: Should be encoded with ['bytes2', 'uint80', 'uint80', 'uint80']  where the first two bytes are Type and Send Ether Flag if using Pipeline
     *  Type 2 (0x02): Copy n bytes32 from a previous function return value
     *       [ Padding      | pasteParams[] ]
     *       [ 32 bytes     | 32 + 32 * n   ]
     *        * The first 32 bytes are the length of the array.
     * -------------------------------------------------------------------------------------
     * @param returnData A list of return values from previously executed Advanced Calls
     @return data The function call return datas
    **/
    function useClipboard(
        bytes calldata callData,
        bytes calldata clipboard,
        bytes[] memory returnData
    ) internal pure returns (bytes memory data) {
        bytes1 typeId = clipboard[0];
        if (typeId == 0x01) {
            bytes32 pasteParams = abi.decode(clipboard, (bytes32));
            data = LibFunction.pasteAdvancedBytes(callData, returnData, pasteParams);
        } else if (typeId == 0x02) {
            (, bytes32[] memory pasteParams) = abi.decode(
                clipboard,
                (uint256, bytes32[])
            );
            data = callData;
            for (uint256 i; i < pasteParams.length; i++)
                data = LibFunction.pasteAdvancedBytes(data, returnData, pasteParams[i]);
        } else {
            revert("Function: Advanced Type not supported");
        }
    }

    /**
     * @notice Copies 32 bytes from returnData into callData determined by pasteParams
     * @param callData The callData bytes of the next function call
     * @param returnData A list of bytes corresponding to return data from previous function calls in the transaction
     * @param pasteParams Denotes which data should be copied and where it should be pasted
     * Should be in the following format
     * [2 bytes | 10 bytes         | 10 bytes  | 10 bytes   ]
     * [ N/A    | returnDataIndex  | copyIndex | pasteIndex ]
     * @return pastedData the calldata for the next function call with bytes pasted from returnData
     **/
    function pasteAdvancedBytes(
        bytes memory callData,
        bytes[] memory returnData,
        bytes32 pasteParams
    ) internal pure returns (bytes memory pastedData) {
        // Shift `pasteParams` right 22 bytes to insolated reduceDataIndex
        bytes memory copyData = returnData[uint256((pasteParams << 16) >> 176)];
        pastedData = paste32Bytes(
            copyData,
            callData,
            uint256((pasteParams << 96) >> 176), // Isolate copyIndex
            uint256((pasteParams << 176) >> 176) // Isolate pasteIndex
        );
    }

    /**
     * @notice Copy 32 Bytes from copyData at copyIndex and paste into pasteData at pasteIndex
     * @param copyData The data bytes to copy from
     * @param pasteData The data bytes to paste into
     * @param copyIndex The index in copyData to copying from
     * @param pasteIndex The index in pasteData to paste into
     * @return pastedData The data with the copied with 32 bytes
    **/
    function paste32Bytes(
        bytes memory copyData,
        bytes memory pasteData,
        uint256 copyIndex,
        uint256 pasteIndex
    ) internal pure returns (bytes memory pastedData) {
        assembly {
            mstore(add(pasteData, pasteIndex), mload(add(copyData, copyIndex)))
        }
        pastedData = pasteData;
    }
}

// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

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

// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @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 `recipient`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address recipient, 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 `sender` to `recipient` 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 sender, address recipient, uint256 amount) external returns (bool);

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

// SPDX-License-Identifier: MIT

pragma solidity >=0.6.0 <0.8.0;

/**
 * @dev Wrappers over Solidity's arithmetic operations with added overflow
 * checks.
 *
 * Arithmetic operations in Solidity wrap on overflow. This can easily result
 * in bugs, because programmers usually assume that an overflow raises an
 * error, which is the standard behavior in high level programming languages.
 * `SafeMath` restores this intuition by reverting the transaction when an
 * operation overflows.
 *
 * Using this library instead of the unchecked operations eliminates an entire
 * class of bugs, so it's recommended to use it always.
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     *
     * _Available since v3.4._
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        uint256 c = a + b;
        if (c < a) return (false, 0);
        return (true, c);
    }

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

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

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

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

    /**
     * @dev Returns the addition of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `+` operator.
     *
     * Requirements:
     *
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 c = a + b;
        require(c >= a, "SafeMath: addition overflow");
        return c;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting on
     * overflow (when the result is negative).
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        require(b <= a, "SafeMath: subtraction overflow");
        return a - b;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on
     * overflow.
     *
     * Counterpart to Solidity's `*` operator.
     *
     * Requirements:
     *
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        if (a == 0) return 0;
        uint256 c = a * b;
        require(c / a == b, "SafeMath: multiplication overflow");
        return c;
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting on
     * division by zero. The result is rounded towards zero.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        require(b > 0, "SafeMath: division by zero");
        return a / b;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting when dividing by zero.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b) internal pure returns (uint256) {
        require(b > 0, "SafeMath: modulo by zero");
        return a % b;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {trySub}.
     *
     * Counterpart to Solidity's `-` operator.
     *
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b <= a, errorMessage);
        return a - b;
    }

    /**
     * @dev Returns the integer division of two unsigned integers, reverting with custom message on
     * division by zero. The result is rounded towards zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryDiv}.
     *
     * Counterpart to Solidity's `/` operator. Note: this function uses a
     * `revert` opcode (which leaves remaining gas untouched) while Solidity
     * uses an invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b > 0, errorMessage);
        return a / b;
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
     * reverting with custom message when dividing by zero.
     *
     * CAUTION: This function is deprecated because it requires allocating memory for the error
     * message unnecessarily. For custom revert reasons use {tryMod}.
     *
     * Counterpart to Solidity's `%` operator. This function uses a `revert`
     * opcode (which leaves remaining gas untouched) while Solidity uses an
     * invalid opcode to revert (consuming all remaining gas).
     *
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b > 0, errorMessage);
        return a % b;
    }
}

// SPDX-License-Identifier: MIT

pragma solidity >=0.6.2 <0.8.0;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        // solhint-disable-next-line no-inline-assembly
        assembly { size := extcodesize(account) }
        return size > 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://diligence.consensys.net/posts/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.5.11/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");

        // solhint-disable-next-line avoid-low-level-calls, avoid-call-value
        (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 functionCall(target, data, "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");
        require(isContract(target), "Address: call to non-contract");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.call{ value: value }(data);
        return _verifyCallResult(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) {
        require(isContract(target), "Address: static call to non-contract");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.staticcall(data);
        return _verifyCallResult(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) {
        require(isContract(target), "Address: delegate call to non-contract");

        // solhint-disable-next-line avoid-low-level-calls
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return _verifyCallResult(success, returndata, errorMessage);
    }

    function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) {
        if (success) {
            return returndata;
        } else {
            // 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

                // solhint-disable-next-line no-inline-assembly
                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

//SPDX-License-Identifier: MIT
pragma solidity =0.7.6;
pragma experimental ABIEncoderV2;

/**
 * @title IPipeline
 * @author Publius
 * @notice Pipeline Interface – Pipeline creates a sandbox to execute any series of function calls on any series of protocols through \term{Pipe} functions. 
 * Any assets left in Pipeline between transactions can be transferred out by any account. 
 * Users Pipe a series of PipeCalls that each execute a function call to another protocol through Pipeline. 
 **/

// PipeCalls specify a function call to be executed by Pipeline. 
// Pipeline supports 2 types of PipeCalls: PipeCall and AdvancedPipeCall.

// PipeCall makes a function call with a static target address and callData.
struct PipeCall {
    address target;
    bytes data;
}

// AdvancedPipeCall makes a function call with a static target address and both static and dynamic callData.
// AdvancedPipeCalls support sending Ether in calls.
// [ PipeCall Type | Send Ether Flag | PipeCall Type data | Ether Value (only if flag == 1)]
// [ 1 byte        | 1 byte          | n bytes        | 0 or 32 bytes                      ]
// See LibFunction.useClipboard for more details.
struct AdvancedPipeCall {
    address target;
    bytes callData;
    bytes clipboard;
}

interface IPipeline {

    function pipe(PipeCall calldata p)
        external
        payable
        returns (bytes memory result);

    function multiPipe(PipeCall[] calldata pipes)
        external
        payable
        returns (bytes[] memory results);

    function advancedPipe(AdvancedPipeCall[] calldata pipes)
        external
        payable
        returns (bytes[] memory results);

}

Settings
{
  "remappings": [
    "@openzeppelin/=node_modules/@openzeppelin/",
    "eth-gas-reporter/=node_modules/eth-gas-reporter/",
    "forge-std/=lib/forge-std/src/",
    "hardhat/=node_modules/hardhat/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "metadata": {
    "useLiteralContent": false,
    "bytecodeHash": "ipfs"
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "istanbul",
  "viaIR": false,
  "libraries": {}
}

Contract Security Audit

Contract ABI

API
[{"inputs":[{"components":[{"internalType":"address","name":"target","type":"address"},{"internalType":"bytes","name":"callData","type":"bytes"},{"internalType":"bytes","name":"clipboard","type":"bytes"}],"internalType":"struct AdvancedPipeCall[]","name":"pipes","type":"tuple[]"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"advancedPipe","outputs":[{"internalType":"bytes[]","name":"results","type":"bytes[]"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"contract IERC1155","name":"token","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"uint256[]","name":"values","type":"uint256[]"}],"name":"batchTransferERC1155","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"target","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct PipeCall","name":"p","type":"tuple"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"etherPipe","outputs":[{"internalType":"bytes","name":"result","type":"bytes"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes[]","name":"data","type":"bytes[]"}],"name":"farm","outputs":[{"internalType":"bytes[]","name":"results","type":"bytes[]"}],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"target","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct PipeCall[]","name":"pipes","type":"tuple[]"}],"name":"multiPipe","outputs":[{"internalType":"bytes[]","name":"results","type":"bytes[]"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"permitDeposit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"},{"internalType":"address[]","name":"tokens","type":"address[]"},{"internalType":"uint256[]","name":"values","type":"uint256[]"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"permitDeposits","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"contract IERC20Permit","name":"token","type":"address"},{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"permitERC20","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"contract IERC4494","name":"token","type":"address"},{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"bytes","name":"sig","type":"bytes"}],"name":"permitERC721","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"permitToken","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"target","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct PipeCall","name":"p","type":"tuple"}],"name":"pipe","outputs":[{"internalType":"bytes","name":"result","type":"bytes"}],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"target","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"internalType":"struct PipeCall","name":"p","type":"tuple"}],"name":"readPipe","outputs":[{"internalType":"bytes","name":"result","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"address","name":"token","type":"address"},{"internalType":"int96","name":"stem","type":"int96"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferDeposit","outputs":[{"internalType":"uint256","name":"bdv","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"address","name":"token","type":"address"},{"internalType":"int96[]","name":"stems","type":"int96[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"name":"transferDeposits","outputs":[{"internalType":"uint256[]","name":"bdvs","type":"uint256[]"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"contract IERC1155","name":"token","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"transferERC1155","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"contract IERC721","name":"token","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"}],"name":"transferERC721","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"enum From","name":"fromMode","type":"uint8"},{"internalType":"enum To","name":"toMode","type":"uint8"}],"name":"transferToken","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"version","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"},{"stateMutability":"payable","type":"receive"}]

608060405234801561001057600080fd5b50611fac806100206000396000f3fe60806040526004361061010d5760003560e01c80636e47d07b11610095578063b452c7ae11610064578063b452c7ae14610244578063c56411f614610257578063cabec62b14610277578063d5770dc71461028a578063dd756c4f1461029d57610114565b80636e47d07b146101f85780637c516e941461020b578063a9412a591461021e578063b442b3981461023157610114565b80631aca6376116100dc5780631aca63761461018a578063300dd6cf1461019d5780634935ed43146101bd57806354fd4d50146101d05780636204aa43146101e557610114565b8063081d77ba1461011957806308e1a0ab146101425780630a7e880c14610162578063120b57021461017757610114565b3661011457005b600080fd5b61012c61012736600461116b565b6102bd565b6040516101399190611e16565b60405180910390f35b610155610150366004611750565b61038b565b6040516101399190611d5b565b61017561017036600461156c565b610421565b005b6101756101853660046111cc565b61049a565b6101756101983660046116cb565b61051b565b6101b06101ab36600461130a565b610582565b6040516101399190611b96565b6101756101cb36600461161e565b610684565b3480156101dc57600080fd5b506101556106ef565b6101756101f33660046115b1565b61070e565b610155610206366004611782565b6107e5565b6101756102193660046111cc565b61087e565b61017561022c3660046114db565b6108c3565b61017561023f3660046111cc565b610961565b6101b06102523660046113d1565b610999565b61026a6102653660046110c7565b610a35565b6040516101399190611d17565b6101b061028536600461130a565b610b04565b61017561029836600461124c565b610b96565b3480156102a957600080fd5b506101556102b8366004611750565b610c1d565b60006001600160a01b03861633146102f05760405162461bcd60e51b81526004016102e790611daf565b60405180910390fd5b60405163040ebbdd60e11b815273d1a0060ba708bc4bcd3da6c37efa8dedf015fb709063081d77ba9061032f9033908990899089908990600401611945565b602060405180830381600087803b15801561034957600080fd5b505af115801561035d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061038191906117c4565b9695505050505050565b6040516308e1a0ab60e01b815260609073b1be000644bd25996b0d9c2f7a6d6ba3954c91b0906308e1a0ab906103c5908590600401611e03565b600060405180830381600087803b1580156103df57600080fd5b505af11580156103f3573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261041b91908101906114a9565b92915050565b60408051600081526020810191829052637921219560e11b9091526001600160a01b0385169063f242432a9061046290339087908790879060248101611a02565b600060405180830381600087803b15801561047c57600080fd5b505af1158015610490573d6000803e3d6000fd5b5050505050505050565b604051630905ab8160e11b815273d1a0060ba708bc4bcd3da6c37efa8dedf015fb709063120b5702906104df908b908b908b908b908b908b908b908b90600401611a3c565b600060405180830381600087803b1580156104f957600080fd5b505af115801561050d573d6000803e3d6000fd5b505050505050505050505050565b604051632142170760e11b81526001600160a01b038416906342842e0e9061054b903390869086906004016119de565b600060405180830381600087803b15801561056557600080fd5b505af1158015610579573d6000803e3d6000fd5b50505050505050565b6060816001600160401b038111801561059a57600080fd5b506040519080825280602002602001820160405280156105ce57816020015b60608152602001906001900390816105b95790505b50905060005b8281101561067d57600080308686858181106105ec57fe5b90506020028101906105fe9190611e1f565b60405161060c9291906118b0565b600060405180830381855af49150503d8060008114610647576040519150601f19603f3d011682016040523d82523d6000602084013e61064c565b606091505b509150915061065b8282610ca7565b8084848151811061066857fe5b602090810291909101015250506001016105d4565b5092915050565b604051631d16906f60e21b81526001600160a01b0386169063745a41bc906106b6908790879087908790600401611b69565b600060405180830381600087803b1580156106d057600080fd5b505af11580156106e4573d6000803e3d6000fd5b505050505050505050565b604080518082019091526005815264312e302e3160d81b602082015290565b600082600381111561071c57fe5b141561073c576107376001600160a01b038616338686610cf2565b6107de565b600182600381111561074a57fe5b14156107c65760405163d3f4ec6f60e01b815273d1a0060ba708bc4bcd3da6c37efa8dedf015fb709063d3f4ec6f9061078f9088903390899089908890600401611d6e565b600060405180830381600087803b1580156107a957600080fd5b505af11580156107bd573d6000803e3d6000fd5b505050506107de565b60405162461bcd60e51b81526004016102e790611dd7565b5050505050565b6040516308e1a0ab60e01b815260609073b1be000644bd25996b0d9c2f7a6d6ba3954c91b0906308e1a0ab908490610821908790600401611e03565b6000604051808303818588803b15801561083a57600080fd5b505af115801561084e573d6000803e3d6000fd5b50505050506040513d6000823e601f3d908101601f1916820160405261087791908101906114a9565b9392505050565b604051631f145ba560e21b815273d1a0060ba708bc4bcd3da6c37efa8dedf015fb7090637c516e94906104df908b908b908b908b908b908b908b908b90600401611a3c565b6001600160a01b038616632eb2c2d633878787878760006040519080825280601f01601f191660200182016040528015610904576020820181803683370190505b506040518863ffffffff1660e01b8152600401610927979695949392919061197c565b600060405180830381600087803b15801561094157600080fd5b505af1158015610955573d6000803e3d6000fd5b50505050505050505050565b60405163d505accf60e01b81526001600160a01b0389169063d505accf906104df908a908a908a908a908a908a908a90600401611b28565b604051630e0506af60e11b815260609073b1be000644bd25996b0d9c2f7a6d6ba3954c91b090631c0a0d5e9084906109d79088908890600401611bf6565b6000604051808303818588803b1580156109f057600080fd5b505af1158015610a04573d6000803e3d6000fd5b50505050506040513d6000823e601f3d908101601f19168201604052610a2d9190810190611349565b949350505050565b60606001600160a01b0388163314610a5f5760405162461bcd60e51b81526004016102e790611daf565b6040516362b208fb60e11b815273d1a0060ba708bc4bcd3da6c37efa8dedf015fb709063c56411f690610aa29033908b908b908b908b908b908b906004016118c0565b600060405180830381600087803b158015610abc57600080fd5b505af1158015610ad0573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610af8919081019061141a565b98975050505050505050565b60405163cabec62b60e01b815260609073b1be000644bd25996b0d9c2f7a6d6ba3954c91b09063cabec62b90610b409086908690600401611ca9565b600060405180830381600087803b158015610b5a57600080fd5b505af1158015610b6e573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526108779190810190611349565b60405163d5770dc760e01b815273d1a0060ba708bc4bcd3da6c37efa8dedf015fb709063d5770dc790610bdf908d908d908d908d908d908d908d908d908d908d90600401611a86565b600060405180830381600087803b158015610bf957600080fd5b505af1158015610c0d573d6000803e3d6000fd5b5050505050505050505050505050565b60606000610c2e60208401846110ab565b6001600160a01b0316610c446020850185611e1f565b604051610c529291906118b0565b600060405180830381855afa9150503d8060008114610c8d576040519150601f19603f3d011682016040523d82523d6000602084013e610c92565b606091505b5092509050610ca18183610ca7565b50919050565b81610cee57604481511015610cbb57600080fd5b60048101905080806020019051810190610cd5919061170b565b60405162461bcd60e51b81526004016102e79190611d5b565b5050565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052610d4c908590610d52565b50505050565b6000610da7826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610e089092919063ffffffff16565b805190915015610e0357808060200190516020811015610dc657600080fd5b5051610e035760405162461bcd60e51b815260040180806020018281038252602a815260200180611f4d602a913960400191505060405180910390fd5b505050565b6060610a2d848460008585610e1c85610f2d565b610e6d576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b600080866001600160a01b031685876040518082805190602001908083835b60208310610eab5780518252601f199092019160209182019101610e8c565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114610f0d576040519150601f19603f3d011682016040523d82523d6000602084013e610f12565b606091505b5091509150610f22828286610f37565b979650505050505050565b803b15155b919050565b60608315610f46575081610877565b825115610f565782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610fa0578181015183820152602001610f88565b50505050905090810190601f168015610fcd5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b6000610fee610fe984611ea3565b611e63565b905082815283838301111561100257600080fd5b610877836020830184611f08565b60008083601f840112611021578182fd5b5081356001600160401b03811115611037578182fd5b602083019150836020808302850101111561105157600080fd5b9250929050565b600082601f830112611068578081fd5b61087783835160208501610fdb565b8035600b81900b8114610f3257600080fd5b600060408284031215610ca1578081fd5b803560ff81168114610f3257600080fd5b6000602082840312156110bc578081fd5b813561087781611f34565b600080600080600080600060a0888a0312156110e1578283fd5b87356110ec81611f34565b965060208801356110fc81611f34565b9550604088013561110c81611f34565b945060608801356001600160401b0380821115611127578485fd5b6111338b838c01611010565b909650945060808a013591508082111561114b578384fd5b506111588a828b01611010565b989b979a50959850939692959293505050565b600080600080600060a08688031215611182578283fd5b853561118d81611f34565b9450602086013561119d81611f34565b935060408601356111ad81611f34565b92506111bb60608701611077565b949793965091946080013592915050565b600080600080600080600080610100898b0312156111e8578182fd5b88356111f381611f34565b9750602089013561120381611f34565b9650604089013561121381611f34565b9550606089013594506080890135935061122f60a08a0161109a565b925060c0890135915060e089013590509295985092959890939650565b6000806000806000806000806000806101008b8d03121561126b578384fd5b8a3561127681611f34565b995060208b013561128681611f34565b985060408b01356001600160401b03808211156112a1578586fd5b6112ad8e838f01611010565b909a50985060608d01359150808211156112c5578586fd5b506112d28d828e01611010565b90975095505060808b013593506112eb60a08c0161109a565b925060c08b0135915060e08b013590509295989b9194979a5092959850565b6000806020838503121561131c578182fd5b82356001600160401b03811115611331578283fd5b61133d85828601611010565b90969095509350505050565b6000602080838503121561135b578182fd5b82516001600160401b03811115611370578283fd5b8301601f81018513611380578283fd5b805161138e610fe982611e86565b81815283810190838501865b848110156113c3576113b18a888451890101611058565b8452928601929086019060010161139a565b509098975050505050505050565b6000806000604084860312156113e5578081fd5b83356001600160401b038111156113fa578182fd5b61140686828701611010565b909790965060209590950135949350505050565b6000602080838503121561142c578182fd5b82516001600160401b03811115611441578283fd5b8301601f81018513611451578283fd5b805161145f610fe982611e86565b818152838101908385018584028501860189101561147b578687fd5b8694505b8385101561149d57805183526001949094019391850191850161147f565b50979650505050505050565b6000602082840312156114ba578081fd5b81516001600160401b038111156114cf578182fd5b610a2d84828501611058565b600080600080600080608087890312156114f3578384fd5b86356114fe81611f34565b9550602087013561150e81611f34565b945060408701356001600160401b0380821115611529578586fd5b6115358a838b01611010565b9096509450606089013591508082111561154d578384fd5b5061155a89828a01611010565b979a9699509497509295939492505050565b60008060008060808587031215611581578182fd5b843561158c81611f34565b9350602085013561159c81611f34565b93969395505050506040820135916060013590565b600080600080600060a086880312156115c8578283fd5b85356115d381611f34565b945060208601356115e381611f34565b9350604086013592506060860135600481106115fd578182fd5b9150608086013560028110611610578182fd5b809150509295509295909350565b600080600080600060a08688031215611635578283fd5b853561164081611f34565b9450602086013561165081611f34565b9350604086013592506060860135915060808601356001600160401b03811115611678578182fd5b8601601f81018813611688578182fd5b8035611696610fe982611ea3565b8181528960208385010111156116aa578384fd5b81602084016020830137908101602001929092525093969295509093509190565b6000806000606084860312156116df578081fd5b83356116ea81611f34565b925060208401356116fa81611f34565b929592945050506040919091013590565b60006020828403121561171c578081fd5b81516001600160401b03811115611731578182fd5b8201601f81018413611741578182fd5b610a2d84825160208401610fdb565b600060208284031215611761578081fd5b81356001600160401b03811115611776578182fd5b610a2d84828501611089565b60008060408385031215611794578182fd5b82356001600160401b038111156117a9578283fd5b6117b585828601611089565b95602094909401359450505050565b6000602082840312156117d5578081fd5b5051919050565b81835260006001600160fb1b038311156117f4578081fd5b6020830280836020870137939093016020019283525090919050565b60008284528282602086013780602084860101526020601f19601f85011685010190509392505050565b60008151808452611852816020860160208601611f08565b601f01601f19169290920160200192915050565b6000813561187381611f34565b6001600160a01b0316835261188b6020830183611ec4565b604060208601526118a0604086018284611810565b95945050505050565b60ff169052565b6000828483379101908152919050565b6001600160a01b038881168252878116602080840191909152908716604083015260a0606083018190528201859052600090869060c0840190835b888110156119215761190c84611077565b600b0b835292810192918101916001016118fb565b505083810360808501526119368186886117dc565b9b9a5050505050505050505050565b6001600160a01b0395861681529385166020850152919093166040830152600b9290920b6060820152608081019190915260a00190565b6001600160a01b0388811682528716602082015260a0604082018190526000906119a990830187896117dc565b82810360608401526119bc8186886117dc565b905082810360808401526119d0818561183a565b9a9950505050505050505050565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03868116825285166020820152604081018490526060810183905260a060808201819052600090610f229083018461183a565b6001600160a01b03988916815296881660208801529490961660408601526060850192909252608084015260ff1660a083015260c082019290925260e08101919091526101000190565b6001600160a01b038b811682528a81166020808401919091526101006040840181905283018a90526000916101208401918c9190845b8d811015611ae3578335611acf81611f34565b831685529381019392810192600101611abc565b505050508281036060840152611afa81898b6117dc565b915050856080830152611b1060a08301866118a9565b60c082019390935260e0015298975050505050505050565b6001600160a01b0397881681529590961660208601526040850193909352606084019190915260ff16608083015260a082015260c081019190915260e00190565b600060018060a01b038616825284602083015283604083015260806060830152610381608083018461183a565b6000602080830181845280855180835260408601915060408482028701019250838701855b82811015611be957603f19888603018452611bd785835161183a565b94509285019290850190600101611bbb565b5092979650505050505050565b602080825281810183905260009060408084018583028501820187855b888110156113c357878303603f190184528135368b9003605e19018112611c38578788fd5b8a0160608135611c4781611f34565b6001600160a01b03168552611c5e82890183611ec4565b828a880152611c708388018284611810565b92505050611c8087830183611ec4565b925085820388870152611c94828483611810565b96890196955050509186019150600101611c13565b602080825281810183905260009060408482028401810190840186845b87811015611d0a57868403603f190183528135368a9003603e19018112611ceb578687fd5b611cf7858b8301611866565b9450509184019190840190600101611cc6565b5091979650505050505050565b6020808252825182820181905260009190848201906040850190845b81811015611d4f57835183529284019291840191600101611d33565b50909695505050505050565b600060208252610877602083018461183a565b6001600160a01b0386811682528581166020830152841660408201526060810183905260a0810160028310611d9f57fe5b8260808301529695505050505050565b6020808252600e908201526d34b73b30b634b21039b2b73232b960911b604082015260600190565b602080825260129082015271135bd919481b9bdd081cdd5c1c1bdc9d195960721b604082015260600190565b6000602082526108776020830184611866565b90815260200190565b6000808335601e19843603018112611e35578283fd5b8301803591506001600160401b03821115611e4e578283fd5b60200191503681900382131561105157600080fd5b6040518181016001600160401b0381118282101715611e7e57fe5b604052919050565b60006001600160401b03821115611e9957fe5b5060209081020190565b60006001600160401b03821115611eb657fe5b50601f01601f191660200190565b6000808335601e19843603018112611eda578283fd5b83016020810192503590506001600160401b03811115611ef957600080fd5b80360383131561105157600080fd5b60005b83811015611f23578181015183820152602001611f0b565b83811115610d4c5750506000910152565b6001600160a01b0381168114611f4957600080fd5b5056fe5361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a2646970667358221220abb6052217893d50a91262165af94da312dfe82702ab6e3e931df13173f44df864736f6c63430007060033

Deployed Bytecode

0x60806040526004361061010d5760003560e01c80636e47d07b11610095578063b452c7ae11610064578063b452c7ae14610244578063c56411f614610257578063cabec62b14610277578063d5770dc71461028a578063dd756c4f1461029d57610114565b80636e47d07b146101f85780637c516e941461020b578063a9412a591461021e578063b442b3981461023157610114565b80631aca6376116100dc5780631aca63761461018a578063300dd6cf1461019d5780634935ed43146101bd57806354fd4d50146101d05780636204aa43146101e557610114565b8063081d77ba1461011957806308e1a0ab146101425780630a7e880c14610162578063120b57021461017757610114565b3661011457005b600080fd5b61012c61012736600461116b565b6102bd565b6040516101399190611e16565b60405180910390f35b610155610150366004611750565b61038b565b6040516101399190611d5b565b61017561017036600461156c565b610421565b005b6101756101853660046111cc565b61049a565b6101756101983660046116cb565b61051b565b6101b06101ab36600461130a565b610582565b6040516101399190611b96565b6101756101cb36600461161e565b610684565b3480156101dc57600080fd5b506101556106ef565b6101756101f33660046115b1565b61070e565b610155610206366004611782565b6107e5565b6101756102193660046111cc565b61087e565b61017561022c3660046114db565b6108c3565b61017561023f3660046111cc565b610961565b6101b06102523660046113d1565b610999565b61026a6102653660046110c7565b610a35565b6040516101399190611d17565b6101b061028536600461130a565b610b04565b61017561029836600461124c565b610b96565b3480156102a957600080fd5b506101556102b8366004611750565b610c1d565b60006001600160a01b03861633146102f05760405162461bcd60e51b81526004016102e790611daf565b60405180910390fd5b60405163040ebbdd60e11b815273d1a0060ba708bc4bcd3da6c37efa8dedf015fb709063081d77ba9061032f9033908990899089908990600401611945565b602060405180830381600087803b15801561034957600080fd5b505af115801561035d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061038191906117c4565b9695505050505050565b6040516308e1a0ab60e01b815260609073b1be000644bd25996b0d9c2f7a6d6ba3954c91b0906308e1a0ab906103c5908590600401611e03565b600060405180830381600087803b1580156103df57600080fd5b505af11580156103f3573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261041b91908101906114a9565b92915050565b60408051600081526020810191829052637921219560e11b9091526001600160a01b0385169063f242432a9061046290339087908790879060248101611a02565b600060405180830381600087803b15801561047c57600080fd5b505af1158015610490573d6000803e3d6000fd5b5050505050505050565b604051630905ab8160e11b815273d1a0060ba708bc4bcd3da6c37efa8dedf015fb709063120b5702906104df908b908b908b908b908b908b908b908b90600401611a3c565b600060405180830381600087803b1580156104f957600080fd5b505af115801561050d573d6000803e3d6000fd5b505050505050505050505050565b604051632142170760e11b81526001600160a01b038416906342842e0e9061054b903390869086906004016119de565b600060405180830381600087803b15801561056557600080fd5b505af1158015610579573d6000803e3d6000fd5b50505050505050565b6060816001600160401b038111801561059a57600080fd5b506040519080825280602002602001820160405280156105ce57816020015b60608152602001906001900390816105b95790505b50905060005b8281101561067d57600080308686858181106105ec57fe5b90506020028101906105fe9190611e1f565b60405161060c9291906118b0565b600060405180830381855af49150503d8060008114610647576040519150601f19603f3d011682016040523d82523d6000602084013e61064c565b606091505b509150915061065b8282610ca7565b8084848151811061066857fe5b602090810291909101015250506001016105d4565b5092915050565b604051631d16906f60e21b81526001600160a01b0386169063745a41bc906106b6908790879087908790600401611b69565b600060405180830381600087803b1580156106d057600080fd5b505af11580156106e4573d6000803e3d6000fd5b505050505050505050565b604080518082019091526005815264312e302e3160d81b602082015290565b600082600381111561071c57fe5b141561073c576107376001600160a01b038616338686610cf2565b6107de565b600182600381111561074a57fe5b14156107c65760405163d3f4ec6f60e01b815273d1a0060ba708bc4bcd3da6c37efa8dedf015fb709063d3f4ec6f9061078f9088903390899089908890600401611d6e565b600060405180830381600087803b1580156107a957600080fd5b505af11580156107bd573d6000803e3d6000fd5b505050506107de565b60405162461bcd60e51b81526004016102e790611dd7565b5050505050565b6040516308e1a0ab60e01b815260609073b1be000644bd25996b0d9c2f7a6d6ba3954c91b0906308e1a0ab908490610821908790600401611e03565b6000604051808303818588803b15801561083a57600080fd5b505af115801561084e573d6000803e3d6000fd5b50505050506040513d6000823e601f3d908101601f1916820160405261087791908101906114a9565b9392505050565b604051631f145ba560e21b815273d1a0060ba708bc4bcd3da6c37efa8dedf015fb7090637c516e94906104df908b908b908b908b908b908b908b908b90600401611a3c565b6001600160a01b038616632eb2c2d633878787878760006040519080825280601f01601f191660200182016040528015610904576020820181803683370190505b506040518863ffffffff1660e01b8152600401610927979695949392919061197c565b600060405180830381600087803b15801561094157600080fd5b505af1158015610955573d6000803e3d6000fd5b50505050505050505050565b60405163d505accf60e01b81526001600160a01b0389169063d505accf906104df908a908a908a908a908a908a908a90600401611b28565b604051630e0506af60e11b815260609073b1be000644bd25996b0d9c2f7a6d6ba3954c91b090631c0a0d5e9084906109d79088908890600401611bf6565b6000604051808303818588803b1580156109f057600080fd5b505af1158015610a04573d6000803e3d6000fd5b50505050506040513d6000823e601f3d908101601f19168201604052610a2d9190810190611349565b949350505050565b60606001600160a01b0388163314610a5f5760405162461bcd60e51b81526004016102e790611daf565b6040516362b208fb60e11b815273d1a0060ba708bc4bcd3da6c37efa8dedf015fb709063c56411f690610aa29033908b908b908b908b908b908b906004016118c0565b600060405180830381600087803b158015610abc57600080fd5b505af1158015610ad0573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610af8919081019061141a565b98975050505050505050565b60405163cabec62b60e01b815260609073b1be000644bd25996b0d9c2f7a6d6ba3954c91b09063cabec62b90610b409086908690600401611ca9565b600060405180830381600087803b158015610b5a57600080fd5b505af1158015610b6e573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526108779190810190611349565b60405163d5770dc760e01b815273d1a0060ba708bc4bcd3da6c37efa8dedf015fb709063d5770dc790610bdf908d908d908d908d908d908d908d908d908d908d90600401611a86565b600060405180830381600087803b158015610bf957600080fd5b505af1158015610c0d573d6000803e3d6000fd5b5050505050505050505050505050565b60606000610c2e60208401846110ab565b6001600160a01b0316610c446020850185611e1f565b604051610c529291906118b0565b600060405180830381855afa9150503d8060008114610c8d576040519150601f19603f3d011682016040523d82523d6000602084013e610c92565b606091505b5092509050610ca18183610ca7565b50919050565b81610cee57604481511015610cbb57600080fd5b60048101905080806020019051810190610cd5919061170b565b60405162461bcd60e51b81526004016102e79190611d5b565b5050565b604080516001600160a01b0380861660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052610d4c908590610d52565b50505050565b6000610da7826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316610e089092919063ffffffff16565b805190915015610e0357808060200190516020811015610dc657600080fd5b5051610e035760405162461bcd60e51b815260040180806020018281038252602a815260200180611f4d602a913960400191505060405180910390fd5b505050565b6060610a2d848460008585610e1c85610f2d565b610e6d576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b600080866001600160a01b031685876040518082805190602001908083835b60208310610eab5780518252601f199092019160209182019101610e8c565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114610f0d576040519150601f19603f3d011682016040523d82523d6000602084013e610f12565b606091505b5091509150610f22828286610f37565b979650505050505050565b803b15155b919050565b60608315610f46575081610877565b825115610f565782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610fa0578181015183820152602001610f88565b50505050905090810190601f168015610fcd5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b6000610fee610fe984611ea3565b611e63565b905082815283838301111561100257600080fd5b610877836020830184611f08565b60008083601f840112611021578182fd5b5081356001600160401b03811115611037578182fd5b602083019150836020808302850101111561105157600080fd5b9250929050565b600082601f830112611068578081fd5b61087783835160208501610fdb565b8035600b81900b8114610f3257600080fd5b600060408284031215610ca1578081fd5b803560ff81168114610f3257600080fd5b6000602082840312156110bc578081fd5b813561087781611f34565b600080600080600080600060a0888a0312156110e1578283fd5b87356110ec81611f34565b965060208801356110fc81611f34565b9550604088013561110c81611f34565b945060608801356001600160401b0380821115611127578485fd5b6111338b838c01611010565b909650945060808a013591508082111561114b578384fd5b506111588a828b01611010565b989b979a50959850939692959293505050565b600080600080600060a08688031215611182578283fd5b853561118d81611f34565b9450602086013561119d81611f34565b935060408601356111ad81611f34565b92506111bb60608701611077565b949793965091946080013592915050565b600080600080600080600080610100898b0312156111e8578182fd5b88356111f381611f34565b9750602089013561120381611f34565b9650604089013561121381611f34565b9550606089013594506080890135935061122f60a08a0161109a565b925060c0890135915060e089013590509295985092959890939650565b6000806000806000806000806000806101008b8d03121561126b578384fd5b8a3561127681611f34565b995060208b013561128681611f34565b985060408b01356001600160401b03808211156112a1578586fd5b6112ad8e838f01611010565b909a50985060608d01359150808211156112c5578586fd5b506112d28d828e01611010565b90975095505060808b013593506112eb60a08c0161109a565b925060c08b0135915060e08b013590509295989b9194979a5092959850565b6000806020838503121561131c578182fd5b82356001600160401b03811115611331578283fd5b61133d85828601611010565b90969095509350505050565b6000602080838503121561135b578182fd5b82516001600160401b03811115611370578283fd5b8301601f81018513611380578283fd5b805161138e610fe982611e86565b81815283810190838501865b848110156113c3576113b18a888451890101611058565b8452928601929086019060010161139a565b509098975050505050505050565b6000806000604084860312156113e5578081fd5b83356001600160401b038111156113fa578182fd5b61140686828701611010565b909790965060209590950135949350505050565b6000602080838503121561142c578182fd5b82516001600160401b03811115611441578283fd5b8301601f81018513611451578283fd5b805161145f610fe982611e86565b818152838101908385018584028501860189101561147b578687fd5b8694505b8385101561149d57805183526001949094019391850191850161147f565b50979650505050505050565b6000602082840312156114ba578081fd5b81516001600160401b038111156114cf578182fd5b610a2d84828501611058565b600080600080600080608087890312156114f3578384fd5b86356114fe81611f34565b9550602087013561150e81611f34565b945060408701356001600160401b0380821115611529578586fd5b6115358a838b01611010565b9096509450606089013591508082111561154d578384fd5b5061155a89828a01611010565b979a9699509497509295939492505050565b60008060008060808587031215611581578182fd5b843561158c81611f34565b9350602085013561159c81611f34565b93969395505050506040820135916060013590565b600080600080600060a086880312156115c8578283fd5b85356115d381611f34565b945060208601356115e381611f34565b9350604086013592506060860135600481106115fd578182fd5b9150608086013560028110611610578182fd5b809150509295509295909350565b600080600080600060a08688031215611635578283fd5b853561164081611f34565b9450602086013561165081611f34565b9350604086013592506060860135915060808601356001600160401b03811115611678578182fd5b8601601f81018813611688578182fd5b8035611696610fe982611ea3565b8181528960208385010111156116aa578384fd5b81602084016020830137908101602001929092525093969295509093509190565b6000806000606084860312156116df578081fd5b83356116ea81611f34565b925060208401356116fa81611f34565b929592945050506040919091013590565b60006020828403121561171c578081fd5b81516001600160401b03811115611731578182fd5b8201601f81018413611741578182fd5b610a2d84825160208401610fdb565b600060208284031215611761578081fd5b81356001600160401b03811115611776578182fd5b610a2d84828501611089565b60008060408385031215611794578182fd5b82356001600160401b038111156117a9578283fd5b6117b585828601611089565b95602094909401359450505050565b6000602082840312156117d5578081fd5b5051919050565b81835260006001600160fb1b038311156117f4578081fd5b6020830280836020870137939093016020019283525090919050565b60008284528282602086013780602084860101526020601f19601f85011685010190509392505050565b60008151808452611852816020860160208601611f08565b601f01601f19169290920160200192915050565b6000813561187381611f34565b6001600160a01b0316835261188b6020830183611ec4565b604060208601526118a0604086018284611810565b95945050505050565b60ff169052565b6000828483379101908152919050565b6001600160a01b038881168252878116602080840191909152908716604083015260a0606083018190528201859052600090869060c0840190835b888110156119215761190c84611077565b600b0b835292810192918101916001016118fb565b505083810360808501526119368186886117dc565b9b9a5050505050505050505050565b6001600160a01b0395861681529385166020850152919093166040830152600b9290920b6060820152608081019190915260a00190565b6001600160a01b0388811682528716602082015260a0604082018190526000906119a990830187896117dc565b82810360608401526119bc8186886117dc565b905082810360808401526119d0818561183a565b9a9950505050505050505050565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03868116825285166020820152604081018490526060810183905260a060808201819052600090610f229083018461183a565b6001600160a01b03988916815296881660208801529490961660408601526060850192909252608084015260ff1660a083015260c082019290925260e08101919091526101000190565b6001600160a01b038b811682528a81166020808401919091526101006040840181905283018a90526000916101208401918c9190845b8d811015611ae3578335611acf81611f34565b831685529381019392810192600101611abc565b505050508281036060840152611afa81898b6117dc565b915050856080830152611b1060a08301866118a9565b60c082019390935260e0015298975050505050505050565b6001600160a01b0397881681529590961660208601526040850193909352606084019190915260ff16608083015260a082015260c081019190915260e00190565b600060018060a01b038616825284602083015283604083015260806060830152610381608083018461183a565b6000602080830181845280855180835260408601915060408482028701019250838701855b82811015611be957603f19888603018452611bd785835161183a565b94509285019290850190600101611bbb565b5092979650505050505050565b602080825281810183905260009060408084018583028501820187855b888110156113c357878303603f190184528135368b9003605e19018112611c38578788fd5b8a0160608135611c4781611f34565b6001600160a01b03168552611c5e82890183611ec4565b828a880152611c708388018284611810565b92505050611c8087830183611ec4565b925085820388870152611c94828483611810565b96890196955050509186019150600101611c13565b602080825281810183905260009060408482028401810190840186845b87811015611d0a57868403603f190183528135368a9003603e19018112611ceb578687fd5b611cf7858b8301611866565b9450509184019190840190600101611cc6565b5091979650505050505050565b6020808252825182820181905260009190848201906040850190845b81811015611d4f57835183529284019291840191600101611d33565b50909695505050505050565b600060208252610877602083018461183a565b6001600160a01b0386811682528581166020830152841660408201526060810183905260a0810160028310611d9f57fe5b8260808301529695505050505050565b6020808252600e908201526d34b73b30b634b21039b2b73232b960911b604082015260600190565b602080825260129082015271135bd919481b9bdd081cdd5c1c1bdc9d195960721b604082015260600190565b6000602082526108776020830184611866565b90815260200190565b6000808335601e19843603018112611e35578283fd5b8301803591506001600160401b03821115611e4e578283fd5b60200191503681900382131561105157600080fd5b6040518181016001600160401b0381118282101715611e7e57fe5b604052919050565b60006001600160401b03821115611e9957fe5b5060209081020190565b60006001600160401b03821115611eb657fe5b50601f01601f191660200190565b6000808335601e19843603018112611eda578283fd5b83016020810192503590506001600160401b03811115611ef957600080fd5b80360383131561105157600080fd5b60005b83811015611f23578181015183820152602001611f0b565b83811115610d4c5750506000910152565b6001600160a01b0381168114611f4957600080fd5b5056fe5361666545524332303a204552433230206f7065726174696f6e20646964206e6f742073756363656564a2646970667358221220abb6052217893d50a91262165af94da312dfe82702ab6e3e931df13173f44df864736f6c63430007060033

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

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

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