FRAX Price: $0.84 (-0.61%)

Contract

0x5C2866B225D6E247C500b2907408E26A4b7E6407

Overview

FRAX Balance | FXTL Balance

0 FRAX | 95 FXTL

FRAX Value

$0.00

Token Holdings

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Block
From
To

There are no matching entries

1 Token Transfer found.

View more zero value Internal Transactions in Advanced View mode

Advanced mode:

Cross-Chain Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
SlipstreamGaugeConnector

Compiler Version
v0.8.19+commit.7dd6d404

Optimization Enabled:
Yes with 200 runs

Other Settings:
paris EvmVersion
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import {
    INftFarmConnector,
    NftPosition
} from "contracts/interfaces/INftFarmConnector.sol";
import { ICLGauge } from "contracts/interfaces/external/aerodrome/ICLGauge.sol";
import { IERC721 } from "@openzeppelin/contracts/token/ERC721/IERC721.sol";

contract SlipstreamGaugeConnector is INftFarmConnector {
    function depositExistingNft(
        NftPosition calldata position,
        bytes calldata // extraData
    ) external {
        IERC721(address(position.nft)).approve(
            position.farm.stakingContract, position.tokenId
        );
        ICLGauge(position.farm.stakingContract).deposit(position.tokenId);
    }

    function withdrawNft(
        NftPosition calldata position,
        bytes calldata // extraData
    ) external {
        ICLGauge(position.farm.stakingContract).withdraw(position.tokenId);
    }

    function claim(
        NftPosition calldata position,
        address[] memory, // rewardTokens
        uint128, // maxAmount0,
        uint128, // maxAmount1,
        bytes calldata // extraData
    ) external {
        ICLGauge(position.farm.stakingContract).getReward(position.tokenId);
    }

    function isStaked(
        address user,
        NftPosition calldata position
    ) external view virtual override returns (bool) {
        return ICLGauge(position.farm.stakingContract).stakedContains(
            user, position.tokenId
        );
    }

    function earned(
        address user,
        NftPosition calldata position,
        address[] memory // rewardTokens
    ) external view virtual override returns (uint256[] memory) {
        uint256[] memory rewardAmounts = new uint256[](1);

        rewardAmounts[0] = ICLGauge(position.farm.stakingContract).earned(
            user, position.tokenId
        ) + ICLGauge(position.farm.stakingContract).rewards(position.tokenId);

        return rewardAmounts;
    }
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import { NftPosition } from "contracts/structs/NftFarmStrategyStructs.sol";

interface INftFarmConnector {
    function depositExistingNft(
        NftPosition calldata position,
        bytes calldata extraData
    ) external;

    function withdrawNft(
        NftPosition calldata position,
        bytes calldata extraData
    ) external;

    function claim(
        NftPosition calldata position,
        address[] memory rewardTokens,
        uint128 maxAmount0, // For collecting
        uint128 maxAmount1,
        bytes calldata extraData
    ) external;

    function earned(
        address user,
        NftPosition calldata position,
        address[] memory rewardTokens
    ) external view returns (uint256[] memory);

    function isStaked(
        address user,
        NftPosition calldata position
    ) external view returns (bool);
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface ICLGauge {
    event NotifyReward(address indexed from, uint256 amount);
    event Deposit(
        address indexed user,
        uint256 indexed tokenId,
        uint128 indexed liquidityToStake
    );
    event Withdraw(
        address indexed user,
        uint256 indexed tokenId,
        uint128 indexed liquidityToStake
    );
    event ClaimFees(address indexed from, uint256 claimed0, uint256 claimed1);
    event ClaimRewards(address indexed from, uint256 amount);

    /// @notice NonfungiblePositionManager used to create nfts this gauge
    /// accepts
    function nft() external view returns (address);

    /// @notice Voter contract gauge receives emissions from
    function voter() external view returns (address);

    /// @notice Address of the CL pool linked to the gauge
    function pool() external view returns (address);

    /// @notice Address of the factory that created this gauge
    function gaugeFactory() external view returns (address);

    /// @notice Address of the FeesVotingReward contract linked to the gauge
    function feesVotingReward() external view returns (address);

    /// @notice Timestamp end of current rewards period
    function periodFinish() external view returns (uint256);

    /// @notice Current reward rate of rewardToken to distribute per second
    function rewardRate() external view returns (uint256);

    /// @notice Claimable rewards by tokenId
    function rewards(
        uint256 tokenId
    ) external view returns (uint256);

    /// @notice Most recent timestamp tokenId called updateRewards
    function lastUpdateTime(
        uint256 tokenId
    ) external view returns (uint256);

    /// @notice View to see the rewardRate given the timestamp of the start of
    /// the epoch
    function rewardRateByEpoch(
        uint256
    ) external view returns (uint256);

    /// @notice Cached amount of fees generated from the Pool linked to the
    /// Gauge of token0
    function fees0() external view returns (uint256);

    /// @notice Cached amount of fees generated from the Pool linked to the
    /// Gauge of token1
    function fees1() external view returns (uint256);

    /// @notice Cached address of token0, corresponding to token0 of the pool
    function token0() external view returns (address);

    /// @notice Cached address of token1, corresponding to token1 of the pool
    function token1() external view returns (address);

    /// @notice Cached tick spacing of the pool.
    function tickSpacing() external view returns (int24);

    /// @notice Total amount of rewardToken to distribute for the current
    /// rewards period
    function left() external view returns (uint256 _left);

    /// @notice Address of the emissions token
    function rewardToken() external view returns (address);

    /// @notice To provide compatibility support with the old voter
    function isPool() external view returns (bool);

    /// @notice Returns the rewardGrowthInside of the position at the last user
    /// action (deposit, withdraw, getReward)
    /// @param tokenId The tokenId of the position
    /// @return The rewardGrowthInside for the position
    function rewardGrowthInside(
        uint256 tokenId
    ) external view returns (uint256);

    /// @notice Called on gauge creation by CLGaugeFactory
    /// @param _pool The address of the pool
    /// @param _feesVotingReward The address of the feesVotingReward contract
    /// @param _rewardToken The address of the reward token
    /// @param _voter The address of the voter contract
    /// @param _nft The address of the nft position manager contract
    /// @param _token0 The address of token0 of the pool
    /// @param _token1 The address of token1 of the pool
    /// @param _tickSpacing The tick spacing of the pool
    /// @param _isPool Whether the attached pool is a real pool or not
    function initialize(
        address _pool,
        address _feesVotingReward,
        address _rewardToken,
        address _voter,
        address _nft,
        address _token0,
        address _token1,
        int24 _tickSpacing,
        bool _isPool
    ) external;

    /// @notice Returns the claimable rewards for a given account and tokenId
    /// @dev Throws if account is not the position owner
    /// @dev pool.updateRewardsGrowthGlobal() needs to be called first, to
    /// return the correct claimable rewards
    /// @param account The address of the user
    /// @param tokenId The tokenId of the position
    /// @return The amount of claimable reward
    function earned(
        address account,
        uint256 tokenId
    ) external view returns (uint256);

    /// @notice Retrieve rewards for all tokens owned by an account
    /// @dev Throws if not called by the voter
    /// @param account The account of the user
    function getReward(
        address account
    ) external;

    /// @notice Retrieve rewards for a tokenId
    /// @dev Throws if not called by the position owner
    /// @param tokenId The tokenId of the position
    function getReward(
        uint256 tokenId
    ) external;

    /// @notice Notifies gauge of gauge rewards.
    /// @param amount Amount of gauge rewards (emissions) to notify. Must be
    /// greater than 604_800.
    function notifyRewardAmount(
        uint256 amount
    ) external;

    /// @dev Notifies gauge of gauge rewards without distributing its fees.
    ///      Assumes gauge reward tokens is 18 decimals.
    ///      If not 18 decimals, rewardRate may have rounding issues.
    /// @param amount Amount of gauge rewards (emissions) to notify. Must be
    /// greater than 604_800.
    function notifyRewardWithoutClaim(
        uint256 amount
    ) external;

    /// @notice Used to deposit a CL position into the gauge
    /// @notice Allows the user to receive emissions instead of fees
    /// @param tokenId The tokenId of the position
    function deposit(
        uint256 tokenId
    ) external;

    /// @notice Used to withdraw a CL position from the gauge
    /// @notice Allows the user to receive fees instead of emissions
    /// @notice Outstanding emissions will be collected on withdrawal
    /// @param tokenId The tokenId of the position
    function withdraw(
        uint256 tokenId
    ) external;

    /// @notice Used to increase liquidity of a staked position
    /// @param tokenId The tokenId of the position
    /// @param amount0Desired The desired amount of token0 to be staked,
    /// @param amount1Desired The desired amount of token1 to be staked,
    /// @param amount0Min The minimum amount of token0 to spend, which serves as
    /// a slippage check,
    /// @param amount1Min The minimum amount of token1 to spend, which serves as
    /// a slippage check,
    /// @param deadline The time by which the transaction must be included to
    /// effect the change
    /// @return liquidity The new liquidity amount as a result of the increase
    /// @return amount0 The amount of token0 required to obtain new liquidity
    /// amount
    /// @return amount1 The amount of token1 required to obtain new liquidity
    /// amount
    function increaseStakedLiquidity(
        uint256 tokenId,
        uint256 amount0Desired,
        uint256 amount1Desired,
        uint256 amount0Min,
        uint256 amount1Min,
        uint256 deadline
    ) external returns (uint128 liquidity, uint256 amount0, uint256 amount1);

    /// @notice Used to decrease liquidity of a staked position
    /// @param tokenId The tokenId of the position
    /// @param liquidity The amount of liquidity to be unstaked from the gauge
    /// @param amount0Min The minimum amount of token0 that should be accounted
    /// for the burned liquidity,
    /// @param amount1Min The minimum amount of token1 that should be accounted
    /// for the burned liquidity,
    /// @param deadline The time by which the transaction must be included to
    /// effect the change
    /// @return amount0 The amount of token0 decreased from position
    /// @return amount1 The amount of token1 decreased from position
    function decreaseStakedLiquidity(
        uint256 tokenId,
        uint128 liquidity,
        uint256 amount0Min,
        uint256 amount1Min,
        uint256 deadline
    ) external returns (uint256 amount0, uint256 amount1);

    /// @notice Fetch all tokenIds staked by a given account
    /// @param depositor The address of the user
    /// @return The tokenIds of the staked positions
    function stakedValues(
        address depositor
    ) external view returns (uint256[] memory);

    /// @notice Fetch a staked tokenId by index
    /// @param depositor The address of the user
    /// @param index The index of the staked tokenId
    /// @return The tokenId of the staked position
    function stakedByIndex(
        address depositor,
        uint256 index
    ) external view returns (uint256);

    /// @notice Check whether a position is staked in the gauge by a certain
    /// user
    /// @param depositor The address of the user
    /// @param tokenId The tokenId of the position
    /// @return Whether the position is staked in the gauge
    function stakedContains(
        address depositor,
        uint256 tokenId
    ) external view returns (bool);

    /// @notice The amount of positions staked in the gauge by a certain user
    /// @param depositor The address of the user
    /// @return The amount of positions staked in the gauge
    function stakedLength(
        address depositor
    ) external view returns (uint256);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/IERC721.sol)

pragma solidity ^0.8.0;

import "../../utils/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`.
     *
     * 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;

    /**
     * @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 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: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721
     * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must
     * understand this adds an external call which potentially creates a reentrancy vulnerability.
     *
     * 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 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 the account approved for `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function getApproved(uint256 tokenId) external view returns (address operator);

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

File 5 of 16 : NftFarmStrategyStructs.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

import { IUniswapV3Pool } from
    "contracts/interfaces/external/uniswap/IUniswapV3Pool.sol";
import { INonfungiblePositionManager } from
    "contracts/interfaces/external/uniswap/INonfungiblePositionManager.sol";
import { NftZapIn, NftZapOut } from "contracts/structs/NftZapStructs.sol";
import { SwapParams } from "contracts/structs/SwapStructs.sol";
import { Farm } from "contracts/structs/FarmStrategyStructs.sol";

struct NftPosition {
    Farm farm;
    INonfungiblePositionManager nft;
    uint256 tokenId;
}

struct NftIncrease {
    address[] tokensIn;
    uint256[] amountsIn;
    NftZapIn zap;
    bytes extraData;
}

struct NftDeposit {
    Farm farm;
    INonfungiblePositionManager nft;
    NftIncrease increase;
}

struct NftWithdraw {
    NftZapOut zap;
    address[] tokensOut;
    bytes extraData;
}

struct SimpleNftHarvest {
    address[] rewardTokens;
    uint128 amount0Max;
    uint128 amount1Max;
    bytes extraData;
}

struct NftHarvest {
    SimpleNftHarvest harvest;
    SwapParams[] swaps;
    address[] outputTokens;
    address[] sweepTokens;
}

struct NftCompound {
    SimpleNftHarvest harvest;
    NftZapIn zap;
}

struct NftRebalance {
    IUniswapV3Pool pool;
    NftPosition position;
    NftHarvest harvest;
    NftWithdraw withdraw;
    NftIncrease increase;
}

struct NftMove {
    IUniswapV3Pool pool;
    NftPosition position;
    NftHarvest harvest;
    NftWithdraw withdraw;
    NftDeposit deposit;
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)

pragma solidity ^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: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title Pool state that never changes
/// @notice These parameters are fixed for a pool forever, i.e., the methods
/// will always return the same values
interface IUniswapV3PoolImmutables {
    /// @notice The contract that deployed the pool, which must adhere to the
    /// IUniswapV3Factory interface
    /// @return The contract address
    function factory() external view returns (address);

    /// @notice The first of the two tokens of the pool, sorted by address
    /// @return The token contract address
    function token0() external view returns (address);

    /// @notice The second of the two tokens of the pool, sorted by address
    /// @return The token contract address
    function token1() external view returns (address);

    /// @notice The pool's fee in hundredths of a bip, i.e. 1e-6
    /// @return The fee
    function fee() external view returns (uint24);

    /// @notice The pool tick spacing
    /// @dev Ticks can only be used at multiples of this value, minimum of 1 and
    /// always positive
    /// e.g.: a tickSpacing of 3 means ticks can be initialized every 3rd tick,
    /// i.e., ..., -6, -3, 0, 3, 6, ...
    /// This value is an int24 to avoid casting even though it is always
    /// positive.
    /// @return The tick spacing
    function tickSpacing() external view returns (int24);

    /// @notice The maximum amount of position liquidity that can use any tick
    /// in the range
    /// @dev This parameter is enforced per tick to prevent liquidity from
    /// overflowing a uint128 at any point, and
    /// also prevents out-of-range liquidity from being used to prevent adding
    /// in-range liquidity to a pool
    /// @return The max amount of liquidity per tick
    function maxLiquidityPerTick() external view returns (uint128);
}

/// @title Pool state that can change
/// @notice These methods compose the pool's state, and can change with any
/// frequency including multiple times
/// per transaction
interface IUniswapV3PoolState {
    /// @notice The 0th storage slot in the pool stores many values, and is
    /// exposed as a single method to save gas
    /// when accessed externally.
    /// @return sqrtPriceX96 The current price of the pool as a
    /// sqrt(token1/token0) Q64.96 value
    /// @return tick The current tick of the pool, i.e. according to the last
    /// tick transition that was run.
    /// This value may not always be equal to
    /// SqrtTickMath.getTickAtSqrtRatio(sqrtPriceX96) if the price is on a tick
    /// boundary.
    /// @return observationIndex The index of the last oracle observation that
    /// was written,
    /// @return observationCardinality The current maximum number of
    /// observations stored in the pool,
    /// @return observationCardinalityNext The next maximum number of
    /// observations, to be updated when the observation.
    /// @return feeProtocol The protocol fee for both tokens of the pool.
    /// Encoded as two 4 bit values, where the protocol fee of token1 is shifted
    /// 4 bits and the protocol fee of token0
    /// is the lower 4 bits. Used as the denominator of a fraction of the swap
    /// fee, e.g. 4 means 1/4th of the swap fee.
    /// unlocked Whether the pool is currently locked to reentrancy
    function slot0()
        external
        view
        returns (
            uint160 sqrtPriceX96,
            int24 tick,
            uint16 observationIndex,
            uint16 observationCardinality,
            uint16 observationCardinalityNext,
            uint8 feeProtocol,
            bool unlocked
        );

    /// @notice The fee growth as a Q128.128 fees of token0 collected per unit
    /// of liquidity for the entire life of the pool
    /// @dev This value can overflow the uint256
    function feeGrowthGlobal0X128() external view returns (uint256);

    /// @notice The fee growth as a Q128.128 fees of token1 collected per unit
    /// of liquidity for the entire life of the pool
    /// @dev This value can overflow the uint256
    function feeGrowthGlobal1X128() external view returns (uint256);

    /// @notice The amounts of token0 and token1 that are owed to the protocol
    /// @dev Protocol fees will never exceed uint128 max in either token
    function protocolFees()
        external
        view
        returns (uint128 token0, uint128 token1);

    /// @notice The currently in range liquidity available to the pool
    /// @dev This value has no relationship to the total liquidity across all
    /// ticks
    /// @return The liquidity at the current price of the pool
    function liquidity() external view returns (uint128);

    /// @notice Look up information about a specific tick in the pool
    /// @param tick The tick to look up
    /// @return liquidityGross the total amount of position liquidity that uses
    /// the pool either as tick lower or
    /// tick upper
    /// @return liquidityNet how much liquidity changes when the pool price
    /// crosses the tick,
    /// @return feeGrowthOutside0X128 the fee growth on the other side of the
    /// tick from the current tick in token0,
    /// @return feeGrowthOutside1X128 the fee growth on the other side of the
    /// tick from the current tick in token1,
    /// @return tickCumulativeOutside the cumulative tick value on the other
    /// side of the tick from the current tick
    /// @return secondsPerLiquidityOutsideX128 the seconds spent per liquidity
    /// on the other side of the tick from the current tick,
    /// @return secondsOutside the seconds spent on the other side of the tick
    /// from the current tick,
    /// @return initialized Set to true if the tick is initialized, i.e.
    /// liquidityGross is greater than 0, otherwise equal to false.
    /// Outside values can only be used if the tick is initialized, i.e. if
    /// liquidityGross is greater than 0.
    /// In addition, these values are only relative and must be used only in
    /// comparison to previous snapshots for
    /// a specific position.
    function ticks(
        int24 tick
    )
        external
        view
        returns (
            uint128 liquidityGross,
            int128 liquidityNet,
            uint256 feeGrowthOutside0X128,
            uint256 feeGrowthOutside1X128,
            int56 tickCumulativeOutside,
            uint160 secondsPerLiquidityOutsideX128,
            uint32 secondsOutside,
            bool initialized
        );

    /// @notice Returns 256 packed tick initialized boolean values. See
    /// TickBitmap for more information
    function tickBitmap(
        int16 wordPosition
    ) external view returns (uint256);

    /// @notice Returns the information about a position by the position's key
    /// @param key The position's key is a hash of a preimage composed by the
    /// owner, tickLower and tickUpper
    /// @return liquidity The amount of liquidity in the position,
    /// @return feeGrowthInside0LastX128 fee growth of token0 inside the tick
    /// range as of the last mint/burn/poke,
    /// @return feeGrowthInside1LastX128 fee growth of token1 inside the tick
    /// range as of the last mint/burn/poke,
    /// @return tokensOwed0 the computed amount of token0 owed to the position
    /// as of the last mint/burn/poke,
    /// @return tokensOwed1 the computed amount of token1 owed to the position
    /// as of the last mint/burn/poke
    function positions(
        bytes32 key
    )
        external
        view
        returns (
            uint128 liquidity,
            uint256 feeGrowthInside0LastX128,
            uint256 feeGrowthInside1LastX128,
            uint128 tokensOwed0,
            uint128 tokensOwed1
        );

    /// @notice Returns data about a specific observation index
    /// @param index The element of the observations array to fetch
    /// @dev You most likely want to use #observe() instead of this method to
    /// get an observation as of some amount of time
    /// ago, rather than at a specific index in the array.
    /// @return blockTimestamp The timestamp of the observation,
    /// @return tickCumulative the tick multiplied by seconds elapsed for the
    /// life of the pool as of the observation timestamp,
    /// @return secondsPerLiquidityCumulativeX128 the seconds per in range
    /// liquidity for the life of the pool as of the observation timestamp,
    /// @return initialized whether the observation has been initialized and the
    /// values are safe to use
    function observations(
        uint256 index
    )
        external
        view
        returns (
            uint32 blockTimestamp,
            int56 tickCumulative,
            uint160 secondsPerLiquidityCumulativeX128,
            bool initialized
        );
}

interface IUniswapV3Pool is IUniswapV3PoolImmutables, IUniswapV3PoolState {
    function flash(
        address recipient,
        uint256 amount0,
        uint256 amount1,
        bytes calldata data
    ) external;
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import { IERC721Enumerable } from
    "openzeppelin-contracts/contracts/interfaces/IERC721Enumerable.sol";

interface INonfungiblePositionManager is IERC721Enumerable {
    struct IncreaseLiquidityParams {
        uint256 tokenId;
        uint256 amount0Desired;
        uint256 amount1Desired;
        uint256 amount0Min;
        uint256 amount1Min;
        uint256 deadline;
    }

    struct MintParams {
        address token0;
        address token1;
        uint24 fee;
        int24 tickLower;
        int24 tickUpper;
        uint256 amount0Desired;
        uint256 amount1Desired;
        uint256 amount0Min;
        uint256 amount1Min;
        address recipient;
        uint256 deadline;
    }

    struct DecreaseLiquidityParams {
        uint256 tokenId;
        uint128 liquidity;
        uint256 amount0Min;
        uint256 amount1Min;
        uint256 deadline;
    }

    struct CollectParams {
        uint256 tokenId;
        address recipient;
        uint128 amount0Max;
        uint128 amount1Max;
    }

    function increaseLiquidity(
        IncreaseLiquidityParams memory params
    )
        external
        payable
        returns (uint256 amount0, uint256 amount1, uint256 liquidity);

    function decreaseLiquidity(
        DecreaseLiquidityParams calldata params
    ) external payable returns (uint256 amount0, uint256 amount1);

    function mint(
        MintParams memory params
    )
        external
        payable
        returns (uint256 tokenId, uint256 amount0, uint256 amount1);

    function collect(
        CollectParams calldata params
    ) external payable returns (uint256 amount0, uint256 amount1);

    function burn(
        uint256 tokenId
    ) external payable;

    function positions(
        uint256 tokenId
    )
        external
        view
        returns (
            uint96 nonce,
            address operator,
            address token0,
            address token1,
            uint24 fee,
            int24 tickLower,
            int24 tickUpper,
            uint128 liquidity,
            uint256 feeGrowthInside0LastX128,
            uint256 feeGrowthInside1LastX128,
            uint128 tokensOwed0,
            uint128 tokensOwed1
        );

    function factory() external view returns (address);
}

File 9 of 16 : NftZapStructs.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

import { SwapParams } from "contracts/structs/SwapStructs.sol";
import {
    NftAddLiquidity,
    NftRemoveLiquidity
} from "contracts/structs/NftLiquidityStructs.sol";

struct NftZapIn {
    SwapParams[] swaps;
    NftAddLiquidity addLiquidityParams;
}

struct NftZapOut {
    NftRemoveLiquidity removeLiquidityParams;
    SwapParams[] swaps;
}

File 10 of 16 : SwapStructs.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

struct SwapParams {
    address tokenApproval;
    address router;
    uint256 amountIn;
    uint256 desiredAmountOut;
    uint256 minAmountOut;
    address tokenIn;
    address tokenOut;
    bytes extraData;
}

File 11 of 16 : FarmStrategyStructs.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

import { ZapIn, ZapOut } from "contracts/structs/ZapStructs.sol";
import { SwapParams } from "contracts/structs/SwapStructs.sol";

struct Farm {
    address stakingContract;
    uint256 poolIndex;
}

struct DepositParams {
    Farm farm;
    address[] tokensIn;
    uint256[] amountsIn;
    ZapIn zap;
    bytes extraData;
}

struct WithdrawParams {
    bytes extraData;
    ZapOut zap;
    address[] tokensOut;
}

struct HarvestParams {
    SwapParams[] swaps;
    bytes extraData;
    address[] tokensOut;
}

struct CompoundParams {
    Farm claimFarm;
    bytes claimExtraData;
    address[] rewardTokens;
    ZapIn zap;
    Farm depositFarm;
    bytes depositExtraData;
}

struct SimpleDepositParams {
    Farm farm;
    address lpToken;
    uint256 amountIn;
    bytes extraData;
}

struct SimpleHarvestParams {
    address[] rewardTokens;
    bytes extraData;
}

struct SimpleWithdrawParams {
    address lpToken;
    uint256 amountOut;
    bytes extraData;
}

File 12 of 16 : IERC721Enumerable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (interfaces/IERC721Enumerable.sol)

pragma solidity ^0.8.0;

import "../token/ERC721/extensions/IERC721Enumerable.sol";

File 13 of 16 : NftLiquidityStructs.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import { INonfungiblePositionManager } from
    "contracts/interfaces/external/uniswap/INonfungiblePositionManager.sol";

struct Pool {
    address token0;
    address token1;
    uint24 fee;
}

struct NftPoolKey {
    address poolAddress;
    bytes32 poolId;
}

struct NftPoolInfo {
    address token0;
    address token1;
    uint24 fee;
    uint24 tickSpacing;
    uint160 sqrtPriceX96;
    int24 tick;
    uint128 liquidity;
    uint256 feeGrowthGlobal0X128;
    uint256 feeGrowthGlobal1X128;
}

// Maintained for backwards compatibility with NftSettingsRegistry
struct NftPositionInfo {
    uint128 liquidity;
    int24 tickLower;
    int24 tickUpper;
}

struct NftAddLiquidity {
    INonfungiblePositionManager nft;
    uint256 tokenId;
    Pool pool;
    int24 tickLower;
    int24 tickUpper;
    uint256 amount0Desired;
    uint256 amount1Desired;
    uint256 amount0Min;
    uint256 amount1Min;
    bytes extraData;
}

struct NftRemoveLiquidity {
    INonfungiblePositionManager nft;
    uint256 tokenId;
    uint128 liquidity;
    uint256 amount0Min; // For decreasing
    uint256 amount1Min;
    uint128 amount0Max; // For collecting
    uint128 amount1Max;
    bytes extraData;
}

File 14 of 16 : ZapStructs.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import { SwapParams } from "contracts/structs/SwapStructs.sol";

import {
    AddLiquidityParams,
    RemoveLiquidityParams
} from "contracts/structs/LiquidityStructs.sol";

struct ZapIn {
    SwapParams[] swaps;
    AddLiquidityParams addLiquidityParams;
}

struct ZapOut {
    RemoveLiquidityParams removeLiquidityParams;
    SwapParams[] swaps;
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/extensions/IERC721Enumerable.sol)

pragma solidity ^0.8.0;

import "../IERC721.sol";

/**
 * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
 * @dev See https://eips.ethereum.org/EIPS/eip-721
 */
interface IERC721Enumerable is IERC721 {
    /**
     * @dev Returns the total amount of tokens stored by the contract.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns a token ID owned by `owner` at a given `index` of its token list.
     * Use along with {balanceOf} to enumerate all of ``owner``'s tokens.
     */
    function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256);

    /**
     * @dev Returns a token ID at a given `index` of all the tokens stored by the contract.
     * Use along with {totalSupply} to enumerate all tokens.
     */
    function tokenByIndex(uint256 index) external view returns (uint256);
}

File 16 of 16 : LiquidityStructs.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

struct AddLiquidityParams {
    address router;
    address lpToken;
    address[] tokens;
    uint256[] desiredAmounts;
    uint256[] minAmounts;
    bytes extraData;
}

struct RemoveLiquidityParams {
    address router;
    address lpToken;
    address[] tokens;
    uint256 lpAmountIn;
    uint256[] minAmountsOut;
    bytes extraData;
}

Settings
{
  "remappings": [
    "solmate/=lib/solmate/src/",
    "@openzeppelin/=lib/openzeppelin-contracts/",
    "@morpho-blue/=lib/morpho-blue/src/",
    "ds-test/=lib/solmate/lib/ds-test/src/",
    "forge-std/=lib/forge-std/src/",
    "morpho-blue/=lib/morpho-blue/",
    "openzeppelin-contracts/=lib/openzeppelin-contracts/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "metadata": {
    "useLiteralContent": false,
    "bytecodeHash": "ipfs",
    "appendCBOR": true
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "paris",
  "viaIR": false
}

Contract Security Audit

Contract ABI

API
[{"inputs":[{"components":[{"components":[{"internalType":"address","name":"stakingContract","type":"address"},{"internalType":"uint256","name":"poolIndex","type":"uint256"}],"internalType":"struct Farm","name":"farm","type":"tuple"},{"internalType":"contract INonfungiblePositionManager","name":"nft","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"internalType":"struct NftPosition","name":"position","type":"tuple"},{"internalType":"address[]","name":"","type":"address[]"},{"internalType":"uint128","name":"","type":"uint128"},{"internalType":"uint128","name":"","type":"uint128"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"components":[{"internalType":"address","name":"stakingContract","type":"address"},{"internalType":"uint256","name":"poolIndex","type":"uint256"}],"internalType":"struct Farm","name":"farm","type":"tuple"},{"internalType":"contract INonfungiblePositionManager","name":"nft","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"internalType":"struct NftPosition","name":"position","type":"tuple"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"depositExistingNft","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"components":[{"components":[{"internalType":"address","name":"stakingContract","type":"address"},{"internalType":"uint256","name":"poolIndex","type":"uint256"}],"internalType":"struct Farm","name":"farm","type":"tuple"},{"internalType":"contract INonfungiblePositionManager","name":"nft","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"internalType":"struct NftPosition","name":"position","type":"tuple"},{"internalType":"address[]","name":"","type":"address[]"}],"name":"earned","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"components":[{"components":[{"internalType":"address","name":"stakingContract","type":"address"},{"internalType":"uint256","name":"poolIndex","type":"uint256"}],"internalType":"struct Farm","name":"farm","type":"tuple"},{"internalType":"contract INonfungiblePositionManager","name":"nft","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"internalType":"struct NftPosition","name":"position","type":"tuple"}],"name":"isStaked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"components":[{"internalType":"address","name":"stakingContract","type":"address"},{"internalType":"uint256","name":"poolIndex","type":"uint256"}],"internalType":"struct Farm","name":"farm","type":"tuple"},{"internalType":"contract INonfungiblePositionManager","name":"nft","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"internalType":"struct NftPosition","name":"position","type":"tuple"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"withdrawNft","outputs":[],"stateMutability":"nonpayable","type":"function"}]

608060405234801561001057600080fd5b5061086f806100206000396000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c80631ae755621461005c5780632847ccf2146100845780633f40c7fa146100995780636f4621e3146100b9578063ff7b9266146100cc575b600080fd5b61006f61006a3660046104b5565b6100df565b60405190151581526020015b60405180910390f35b610097610092366004610534565b61016d565b005b6100ac6100a7366004610640565b6101df565b60405161007b91906106a1565b6100976100c7366004610705565b610333565b6100976100da366004610534565b6103a7565b60006100ee60208301836107a3565b60405163c69deec560e01b81526001600160a01b03858116600483015260608501356024830152919091169063c69deec590604401602060405180830381865afa158015610140573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061016491906107c7565b90505b92915050565b61017a60208401846107a3565b604051632e1a7d4d60e01b8152606085013560048201526001600160a01b039190911690632e1a7d4d906024015b600060405180830381600087803b1580156101c257600080fd5b505af11580156101d6573d6000803e3d6000fd5b50505050505050565b604080516001808252818301909252606091600091906020808301908036833701905050905061021260208501856107a3565b604051637980d7a160e11b8152606086013560048201526001600160a01b03919091169063f301af4290602401602060405180830381865afa15801561025c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061028091906107e9565b61028d60208601866107a3565b604051633e491d4760e01b81526001600160a01b038881166004830152606088013560248301529190911690633e491d4790604401602060405180830381865afa1580156102df573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061030391906107e9565b61030d9190610802565b8160008151811061032057610320610823565b6020908102919091010152949350505050565b61034060208701876107a3565b604051631c4b774b60e01b8152606088013560048201526001600160a01b039190911690631c4b774b90602401600060405180830381600087803b15801561038757600080fd5b505af115801561039b573d6000803e3d6000fd5b50505050505050505050565b6103b760608401604085016107a3565b6001600160a01b031663095ea7b36103d260208601866107a3565b6040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260608601356024820152604401600060405180830381600087803b15801561041d57600080fd5b505af1158015610431573d6000803e3d6000fd5b506104439250505060208401846107a3565b60405163b6b55f2560e01b8152606085013560048201526001600160a01b03919091169063b6b55f25906024016101a8565b6001600160a01b038116811461048a57600080fd5b50565b803561049881610475565b919050565b6000608082840312156104af57600080fd5b50919050565b60008060a083850312156104c857600080fd5b82356104d381610475565b91506104e2846020850161049d565b90509250929050565b60008083601f8401126104fd57600080fd5b50813567ffffffffffffffff81111561051557600080fd5b60208301915083602082850101111561052d57600080fd5b9250929050565b600080600060a0848603121561054957600080fd5b610553858561049d565b9250608084013567ffffffffffffffff81111561056f57600080fd5b61057b868287016104eb565b9497909650939450505050565b634e487b7160e01b600052604160045260246000fd5b600082601f8301126105af57600080fd5b8135602067ffffffffffffffff808311156105cc576105cc610588565b8260051b604051601f19603f830116810181811084821117156105f1576105f1610588565b60405293845285810183019383810192508785111561060f57600080fd5b83870191505b84821015610635576106268261048d565b83529183019190830190610615565b979650505050505050565b600080600060c0848603121561065557600080fd5b833561066081610475565b925061066f856020860161049d565b915060a084013567ffffffffffffffff81111561068b57600080fd5b6106978682870161059e565b9150509250925092565b6020808252825182820181905260009190848201906040850190845b818110156106d9578351835292840192918401916001016106bd565b50909695505050505050565b80356fffffffffffffffffffffffffffffffff8116811461049857600080fd5b600080600080600080610100878903121561071f57600080fd5b610729888861049d565b9550608087013567ffffffffffffffff8082111561074657600080fd5b6107528a838b0161059e565b965061076060a08a016106e5565b955061076e60c08a016106e5565b945060e089013591508082111561078457600080fd5b5061079189828a016104eb565b979a9699509497509295939492505050565b6000602082840312156107b557600080fd5b81356107c081610475565b9392505050565b6000602082840312156107d957600080fd5b815180151581146107c057600080fd5b6000602082840312156107fb57600080fd5b5051919050565b8082018082111561016757634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fdfea264697066735822122099774f38cc338913061e40af93d945661e85dc716f24222fcfb4f6bdde87b87664736f6c63430008130033

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106100575760003560e01c80631ae755621461005c5780632847ccf2146100845780633f40c7fa146100995780636f4621e3146100b9578063ff7b9266146100cc575b600080fd5b61006f61006a3660046104b5565b6100df565b60405190151581526020015b60405180910390f35b610097610092366004610534565b61016d565b005b6100ac6100a7366004610640565b6101df565b60405161007b91906106a1565b6100976100c7366004610705565b610333565b6100976100da366004610534565b6103a7565b60006100ee60208301836107a3565b60405163c69deec560e01b81526001600160a01b03858116600483015260608501356024830152919091169063c69deec590604401602060405180830381865afa158015610140573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061016491906107c7565b90505b92915050565b61017a60208401846107a3565b604051632e1a7d4d60e01b8152606085013560048201526001600160a01b039190911690632e1a7d4d906024015b600060405180830381600087803b1580156101c257600080fd5b505af11580156101d6573d6000803e3d6000fd5b50505050505050565b604080516001808252818301909252606091600091906020808301908036833701905050905061021260208501856107a3565b604051637980d7a160e11b8152606086013560048201526001600160a01b03919091169063f301af4290602401602060405180830381865afa15801561025c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061028091906107e9565b61028d60208601866107a3565b604051633e491d4760e01b81526001600160a01b038881166004830152606088013560248301529190911690633e491d4790604401602060405180830381865afa1580156102df573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061030391906107e9565b61030d9190610802565b8160008151811061032057610320610823565b6020908102919091010152949350505050565b61034060208701876107a3565b604051631c4b774b60e01b8152606088013560048201526001600160a01b039190911690631c4b774b90602401600060405180830381600087803b15801561038757600080fd5b505af115801561039b573d6000803e3d6000fd5b50505050505050505050565b6103b760608401604085016107a3565b6001600160a01b031663095ea7b36103d260208601866107a3565b6040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260608601356024820152604401600060405180830381600087803b15801561041d57600080fd5b505af1158015610431573d6000803e3d6000fd5b506104439250505060208401846107a3565b60405163b6b55f2560e01b8152606085013560048201526001600160a01b03919091169063b6b55f25906024016101a8565b6001600160a01b038116811461048a57600080fd5b50565b803561049881610475565b919050565b6000608082840312156104af57600080fd5b50919050565b60008060a083850312156104c857600080fd5b82356104d381610475565b91506104e2846020850161049d565b90509250929050565b60008083601f8401126104fd57600080fd5b50813567ffffffffffffffff81111561051557600080fd5b60208301915083602082850101111561052d57600080fd5b9250929050565b600080600060a0848603121561054957600080fd5b610553858561049d565b9250608084013567ffffffffffffffff81111561056f57600080fd5b61057b868287016104eb565b9497909650939450505050565b634e487b7160e01b600052604160045260246000fd5b600082601f8301126105af57600080fd5b8135602067ffffffffffffffff808311156105cc576105cc610588565b8260051b604051601f19603f830116810181811084821117156105f1576105f1610588565b60405293845285810183019383810192508785111561060f57600080fd5b83870191505b84821015610635576106268261048d565b83529183019190830190610615565b979650505050505050565b600080600060c0848603121561065557600080fd5b833561066081610475565b925061066f856020860161049d565b915060a084013567ffffffffffffffff81111561068b57600080fd5b6106978682870161059e565b9150509250925092565b6020808252825182820181905260009190848201906040850190845b818110156106d9578351835292840192918401916001016106bd565b50909695505050505050565b80356fffffffffffffffffffffffffffffffff8116811461049857600080fd5b600080600080600080610100878903121561071f57600080fd5b610729888861049d565b9550608087013567ffffffffffffffff8082111561074657600080fd5b6107528a838b0161059e565b965061076060a08a016106e5565b955061076e60c08a016106e5565b945060e089013591508082111561078457600080fd5b5061079189828a016104eb565b979a9699509497509295939492505050565b6000602082840312156107b557600080fd5b81356107c081610475565b9392505050565b6000602082840312156107d957600080fd5b815180151581146107c057600080fd5b6000602082840312156107fb57600080fd5b5051919050565b8082018082111561016757634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fdfea264697066735822122099774f38cc338913061e40af93d945661e85dc716f24222fcfb4f6bdde87b87664736f6c63430008130033

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

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.