S Price: $0.067837 (+2.90%)
Gas: 55 Gwei

Contract

0xdfAF688E10e7752c78b65399470b90cb9Aa2d648

Overview

S Balance

Sonic LogoSonic LogoSonic Logo0 S

S Value

$0.00

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Block
From
To

There are no matching entries

> 10 Internal Transactions found.

Latest 25 internal transactions (View All)

Advanced mode:
Parent Transaction Hash Block From To
612212622026-01-26 21:43:4428 mins ago1769463824
0xdfAF688E...b9Aa2d648
0 S
612212622026-01-26 21:43:4428 mins ago1769463824
0xdfAF688E...b9Aa2d648
0 S
612212622026-01-26 21:43:4428 mins ago1769463824
0xdfAF688E...b9Aa2d648
0 S
612203432026-01-26 21:25:4347 mins ago1769462743
0xdfAF688E...b9Aa2d648
0 S
612203432026-01-26 21:25:4347 mins ago1769462743
0xdfAF688E...b9Aa2d648
0 S
612203432026-01-26 21:25:4347 mins ago1769462743
0xdfAF688E...b9Aa2d648
0 S
612182412026-01-26 20:35:431 hr ago1769459743
0xdfAF688E...b9Aa2d648
0 S
612182412026-01-26 20:35:431 hr ago1769459743
0xdfAF688E...b9Aa2d648
0 S
612182412026-01-26 20:35:431 hr ago1769459743
0xdfAF688E...b9Aa2d648
0 S
612179992026-01-26 20:30:251 hr ago1769459425
0xdfAF688E...b9Aa2d648
0 S
612179992026-01-26 20:30:251 hr ago1769459425
0xdfAF688E...b9Aa2d648
0 S
612179992026-01-26 20:30:251 hr ago1769459425
0xdfAF688E...b9Aa2d648
0 S
612179282026-01-26 20:28:161 hr ago1769459296
0xdfAF688E...b9Aa2d648
0 S
612179282026-01-26 20:28:161 hr ago1769459296
0xdfAF688E...b9Aa2d648
0 S
612179282026-01-26 20:28:161 hr ago1769459296
0xdfAF688E...b9Aa2d648
0 S
612153122026-01-26 19:27:472 hrs ago1769455667
0xdfAF688E...b9Aa2d648
0 S
612153122026-01-26 19:27:472 hrs ago1769455667
0xdfAF688E...b9Aa2d648
0 S
612153122026-01-26 19:27:472 hrs ago1769455667
0xdfAF688E...b9Aa2d648
0 S
612151072026-01-26 19:22:432 hrs ago1769455363
0xdfAF688E...b9Aa2d648
0 S
612151072026-01-26 19:22:432 hrs ago1769455363
0xdfAF688E...b9Aa2d648
0 S
612151072026-01-26 19:22:432 hrs ago1769455363
0xdfAF688E...b9Aa2d648
0 S
612149462026-01-26 19:19:152 hrs ago1769455155
0xdfAF688E...b9Aa2d648
0 S
612149462026-01-26 19:19:152 hrs ago1769455155
0xdfAF688E...b9Aa2d648
0 S
612149462026-01-26 19:19:152 hrs ago1769455155
0xdfAF688E...b9Aa2d648
0 S
612120052026-01-26 18:19:473 hrs ago1769451587
0xdfAF688E...b9Aa2d648
0 S
View All Internal Transactions
Cross-Chain Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
ShadowV3GaugeConnector

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 { IShadowGaugeV3 } from
    "contracts/interfaces/external/shadow/IShadowGaugeV3.sol";
import { IShadowNonfungiblePositionManager } from
    "contracts/interfaces/external/shadow/IShadowNonfungiblePositionManager.sol";

import {
    INftFarmConnector,
    NftPosition
} from "contracts/interfaces/INftFarmConnector.sol";
import {
    ShadowV3GaugeClaim,
    ShadowRewardBehavior
} from "contracts/connectors/shadow/ShadowGaugeClaim.sol";

struct ShadowClaimExtraData {
    // claimTokens need to be passed as extraData because xShadow is one of them
    // The default claim behavior in NftFarmStrategy is to transfer the reward
    // tokens to the user at the end, but xShadow is not transferable. This is a
    // workaround.
    address[] claimTokens;
    ShadowRewardBehavior behavior;
}

contract ShadowV3GaugeConnector is INftFarmConnector, ShadowV3GaugeClaim {
    function depositExistingNft(
        NftPosition calldata,
        bytes calldata // extraData
    ) external { }

    function withdrawNft(
        NftPosition calldata,
        bytes calldata // extraData
    ) external { }
    // Payable in case an NFT is withdrawn to be increased with ETH

    function claim(
        NftPosition calldata position,
        address[] memory, // rewardTokens not used here
        uint128 amount0Max,
        uint128 amount1Max,
        bytes calldata extraData
    ) external {
        ShadowClaimExtraData memory extra =
            abi.decode(extraData, (ShadowClaimExtraData));
        try IShadowNonfungiblePositionManager(address(position.nft)).getReward(
            position.tokenId, extra.claimTokens
        ) {
            // Claim from old gauge for any old rewards, can throw if the old
            // gauge is empty
        } catch { }

        _claimGaugeRewards( // Claim from current gauge
            position.farm.stakingContract,
            position.tokenId,
            extra.claimTokens,
            extra.behavior
        );

        if (amount0Max > 0 || amount1Max > 0) {
            // Claim fees if applicable
            IShadowNonfungiblePositionManager(address(position.nft)).collect(
                IShadowNonfungiblePositionManager.CollectParams({
                    tokenId: position.tokenId,
                    recipient: address(this),
                    amount0Max: amount0Max,
                    amount1Max: amount1Max
                })
            );
        }
    }

    function isStaked(
        address,
        NftPosition calldata
    ) external view virtual override returns (bool) {
        return false; // Shadow positions stay in the Gauge while earning
            // rewards
    }

    function earned(
        address, // user
        NftPosition calldata position,
        address[] memory rewardTokens
    ) external view virtual override returns (uint256[] memory) {
        IShadowGaugeV3 gauge = IShadowGaugeV3(position.farm.stakingContract);
        uint256[] memory rewards = new uint256[](rewardTokens.length);
        for (uint256 i = 0; i < rewardTokens.length; i++) {
            rewards[i] = gauge.earned(rewardTokens[i], position.tokenId);
        }
        return rewards;
    }
}

// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8;

interface IShadowGaugeV3 {
    error NOT_AUTHORIZED();
    error NOT_VOTER();
    error NOT_GT_ZERO(uint256 amt);
    error CANT_CLAIM_FUTURE();
    error RETRO();

    /// @notice Emitted when a reward notification is made.
    /// @param from The address from which the reward is notified.
    /// @param reward The address of the reward token.
    /// @param amount The amount of rewards notified.
    /// @param period The period for which the rewards are notified.
    event NotifyReward(
        address indexed from,
        address indexed reward,
        uint256 amount,
        uint256 period
    );

    /// @notice Emitted when a bribe is made.
    /// @param from The address from which the bribe is made.
    /// @param reward The address of the reward token.
    /// @param amount The amount of tokens bribed.
    /// @param period The period for which the bribe is made.
    event Bribe(
        address indexed from,
        address indexed reward,
        uint256 amount,
        uint256 period
    );

    /// @notice Emitted when rewards are claimed.
    /// @param period The period for which the rewards are claimed.
    /// @param _positionHash The identifier of the NFP for which rewards are
    /// claimed.
    /// @param receiver The address of the receiver of the claimed rewards.
    /// @param reward The address of the reward token.
    /// @param amount The amount of rewards claimed.
    event ClaimRewards(
        uint256 period,
        bytes32 _positionHash,
        address receiver,
        address reward,
        uint256 amount
    );

    /// @notice Emitted when a new reward token was pushed to the rewards array
    event RewardAdded(address reward);

    /// @notice Emitted when a reward token was removed from the rewards array
    event RewardRemoved(address reward);

    /// @notice Retrieves the value of the firstPeriod variable.
    /// @return The value of the firstPeriod variable.
    function firstPeriod() external returns (uint256);

    /// @notice Retrieves the total supply of a specific token for a given
    /// period.
    /// @param period The period for which to retrieve the total supply.
    /// @param token The address of the token for which to retrieve the total
    /// supply.
    /// @return The total supply of the specified token for the given period.
    function tokenTotalSupplyByPeriod(
        uint256 period,
        address token
    ) external view returns (uint256);

    /// @notice Retrieves the getTokenTotalSupplyByPeriod of the current period.
    /// @dev included to support voter's left() check during distribute().
    /// @param token The address of the token for which to retrieve the
    /// remaining amount.
    /// @return The amount of tokens left to distribute in this period.
    function left(
        address token
    ) external view returns (uint256);

    /// @notice Retrieves the reward rate for a specific reward address.
    /// @dev this method returns the base rate without boost
    /// @param token The address of the reward for which to retrieve the reward
    /// rate.
    /// @return The reward rate for the specified reward address.
    function rewardRate(
        address token
    ) external view returns (uint256);

    /// @notice Retrieves the claimed amount for a specific period, position
    /// hash, and user address.
    /// @param period The period for which to retrieve the claimed amount.
    /// @param _positionHash The identifier of the NFP for which to retrieve the
    /// claimed amount.
    /// @param reward The address of the token for the claimed amount.
    /// @return The claimed amount for the specified period, token ID, and user
    /// address.
    function periodClaimedAmount(
        uint256 period,
        bytes32 _positionHash,
        address reward
    ) external view returns (uint256);

    /// @notice Retrieves the last claimed period for a specific token, token ID
    /// combination.
    /// @param token The address of the reward token for which to retrieve the
    /// last claimed period.
    /// @param _positionHash The identifier of the NFP for which to retrieve the
    /// last claimed period.
    /// @return The last claimed period for the specified token and token ID.
    function lastClaimByToken(
        address token,
        bytes32 _positionHash
    ) external view returns (uint256);

    /// @notice Retrieves the reward address at the specified index in the
    /// rewards array.
    /// @param index The index of the reward address to retrieve.
    /// @return The reward address at the specified index.
    function rewards(
        uint256 index
    ) external view returns (address);

    /// @notice Checks if a given address is a valid reward.
    /// @param reward The address to check.
    /// @return A boolean indicating whether the address is a valid reward.
    function isReward(
        address reward
    ) external view returns (bool);

    /// @notice Returns an array of reward token addresses.
    /// @return An array of reward token addresses.
    function getRewardTokens() external view returns (address[] memory);

    /// @notice Returns the hash used to store positions in a mapping
    /// @param owner The address of the position owner
    /// @param index The index of the position
    /// @param tickLower The lower tick boundary of the position
    /// @param tickUpper The upper tick boundary of the position
    /// @return _hash The hash used to store positions in a mapping
    function positionHash(
        address owner,
        uint256 index,
        int24 tickLower,
        int24 tickUpper
    ) external pure returns (bytes32);

    /*
    /// @notice Retrieves the liquidity and boosted liquidity for a specific
    NFP.
    /// @param tokenId The identifier of the NFP.
    /// @return liquidity The liquidity of the position token.
    function positionInfo(
        uint256 tokenId
    ) external view returns (uint128 liquidity);
    */

    /// @notice Returns the amount of rewards earned for an NFP.
    /// @param token The address of the token for which to retrieve the earned
    /// rewards.
    /// @param tokenId The identifier of the specific NFP for which to retrieve
    /// the earned rewards.
    /// @return reward The amount of rewards earned for the specified NFP and
    /// tokens.
    function earned(
        address token,
        uint256 tokenId
    ) external view returns (uint256 reward);

    /// @notice Returns the amount of rewards earned during a period for an NFP.
    /// @param period The period for which to retrieve the earned rewards.
    /// @param token The address of the token for which to retrieve the earned
    /// rewards.
    /// @param tokenId The identifier of the specific NFP for which to retrieve
    /// the earned rewards.
    /// @return reward The amount of rewards earned for the specified NFP and
    /// tokens.
    function periodEarned(
        uint256 period,
        address token,
        uint256 tokenId
    ) external view returns (uint256);

    /// @notice Retrieves the earned rewards for a specific period, token,
    /// owner, index, tickLower, and tickUpper.
    /// @param period The period for which to retrieve the earned rewards.
    /// @param token The address of the token for which to retrieve the earned
    /// rewards.
    /// @param owner The address of the owner for which to retrieve the earned
    /// rewards.
    /// @param index The index for which to retrieve the earned rewards.
    /// @param tickLower The tick lower bound for which to retrieve the earned
    /// rewards.
    /// @param tickUpper The tick upper bound for which to retrieve the earned
    /// rewards.
    /// @return The earned rewards for the specified period, token, owner,
    /// index, tickLower, and tickUpper.
    function periodEarned(
        uint256 period,
        address token,
        address owner,
        uint256 index,
        int24 tickLower,
        int24 tickUpper
    ) external view returns (uint256);

    /// @notice Retrieves the earned rewards for a specific period, token,
    /// owner, index, tickLower, and tickUpper.
    /// @dev used by getReward() and saves gas by saving states
    /// @param period The period for which to retrieve the earned rewards.
    /// @param token The address of the token for which to retrieve the earned
    /// rewards.
    /// @param owner The address of the owner for which to retrieve the earned
    /// rewards.
    /// @param index The index for which to retrieve the earned rewards.
    /// @param tickLower The tick lower bound for which to retrieve the earned
    /// rewards.
    /// @param tickUpper The tick upper bound for which to retrieve the earned
    /// rewards.
    /// @param caching Whether to cache the results or not.
    /// @return The earned rewards for the specified period, token, owner,
    /// index, tickLower, and tickUpper.
    function cachePeriodEarned(
        uint256 period,
        address token,
        address owner,
        uint256 index,
        int24 tickLower,
        int24 tickUpper,
        bool caching
    ) external returns (uint256);

    /// @notice Notifies the contract about the amount of rewards to be
    /// distributed for a specific token.
    /// @param token The address of the token for which to notify the reward
    /// amount.
    /// @param amount The amount of rewards to be distributed.
    function notifyRewardAmount(address token, uint256 amount) external;

    /// @notice Retrieves the reward amount for a specific period, NFP, and
    /// token addresses.
    /// @param period The period for which to retrieve the reward amount.
    /// @param tokens The addresses of the tokens for which to retrieve the
    /// reward amount.
    /// @param tokenId The identifier of the specific NFP for which to retrieve
    /// the reward amount.
    /// @param receiver The address of the receiver of the reward amount.
    function getPeriodReward(
        uint256 period,
        address[] calldata tokens,
        uint256 tokenId,
        address receiver
    ) external;

    /// @notice Retrieves the rewards for a specific period, set of tokens,
    /// owner, index, tickLower, tickUpper, and receiver.
    /// @param period The period for which to retrieve the rewards.
    /// @param tokens An array of token addresses for which to retrieve the
    /// rewards.
    /// @param owner The address of the owner for which to retrieve the rewards.
    /// @param index The index for which to retrieve the rewards.
    /// @param tickLower The tick lower bound for which to retrieve the rewards.
    /// @param tickUpper The tick upper bound for which to retrieve the rewards.
    /// @param receiver The address of the receiver of the rewards.
    function getPeriodReward(
        uint256 period,
        address[] calldata tokens,
        address owner,
        uint256 index,
        int24 tickLower,
        int24 tickUpper,
        address receiver
    ) external;

    /// @notice retrieves rewards based on an NFP id and an array of tokens
    function getReward(uint256 tokenId, address[] memory tokens) external;
    /// @notice retrieves rewards based on an array of NFP ids and an array of
    /// tokens
    function getReward(
        uint256[] calldata tokenIds,
        address[] memory tokens
    ) external;
    /// @notice get reward for an owner of an NFP
    function getRewardForOwner(
        uint256 tokenId,
        address[] memory tokens
    ) external;

    function addRewards(
        address reward
    ) external;

    function removeRewards(
        address reward
    ) external;

    /// @notice Notifies rewards for periods greater than current period
    /// @dev does not push fees
    /// @dev requires reward token to be whitelisted
    function notifyRewardAmountForPeriod(
        address token,
        uint256 amount,
        uint256 period
    ) external;

    /// @notice Notifies rewards for the next period
    /// @dev does not push fees
    /// @dev requires reward token to be whitelisted
    function notifyRewardAmountNextPeriod(
        address token,
        uint256 amount
    ) external;
}

// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.7.5;
pragma abicoder v2;

/// @title Non-fungible token for positions
/// @notice Wraps Uniswap V3 positions in a non-fungible token interface which
/// allows for them to be transferred
/// and authorized.
interface IShadowNonfungiblePositionManager {
    /// @notice Emitted when liquidity is increased for a position NFT
    /// @dev Also emitted when a token is minted
    /// @param tokenId The ID of the token for which liquidity was increased
    /// @param liquidity The amount by which liquidity for the NFT position was
    /// increased
    /// @param amount0 The amount of token0 that was paid for the increase in
    /// liquidity
    /// @param amount1 The amount of token1 that was paid for the increase in
    /// liquidity
    event IncreaseLiquidity(
        uint256 indexed tokenId,
        uint128 liquidity,
        uint256 amount0,
        uint256 amount1
    );
    /// @notice Emitted when liquidity is decreased for a position NFT
    /// @param tokenId The ID of the token for which liquidity was decreased
    /// @param liquidity The amount by which liquidity for the NFT position was
    /// decreased
    /// @param amount0 The amount of token0 that was accounted for the decrease
    /// in liquidity
    /// @param amount1 The amount of token1 that was accounted for the decrease
    /// in liquidity
    event DecreaseLiquidity(
        uint256 indexed tokenId,
        uint128 liquidity,
        uint256 amount0,
        uint256 amount1
    );
    /// @notice Emitted when tokens are collected for a position NFT
    /// @dev The amounts reported may not be exactly equivalent to the amounts
    /// transferred, due to rounding behavior
    /// @param tokenId The ID of the token for which underlying tokens were
    /// collected
    /// @param recipient The address of the account that received the collected
    /// tokens
    /// @param amount0 The amount of token0 owed to the position that was
    /// collected
    /// @param amount1 The amount of token1 owed to the position that was
    /// collected
    event Collect(
        uint256 indexed tokenId,
        address recipient,
        uint256 amount0,
        uint256 amount1
    );

    /// @notice Returns the position information associated with a given token
    /// ID.
    /// @dev Throws if the token ID is not valid.
    /// @param tokenId The ID of the token that represents the position
    /// @return token0 The address of the token0 for a specific pool
    /// @return token1 The address of the token1 for a specific pool
    /// @return tickSpacing The tickSpacing the pool
    /// @return tickLower The lower end of the tick range for the position
    /// @return tickUpper The higher end of the tick range for the position
    /// @return liquidity The liquidity of the position
    /// @return feeGrowthInside0LastX128 The fee growth of token0 as of the last
    /// action on the individual position
    /// @return feeGrowthInside1LastX128 The fee growth of token1 as of the last
    /// action on the individual position
    /// @return tokensOwed0 The uncollected amount of token0 owed to the
    /// position as of the last computation
    /// @return tokensOwed1 The uncollected amount of token1 owed to the
    /// position as of the last computation
    function positions(
        uint256 tokenId
    )
        external
        view
        returns (
            address token0,
            address token1,
            int24 tickSpacing,
            int24 tickLower,
            int24 tickUpper,
            uint128 liquidity,
            uint256 feeGrowthInside0LastX128,
            uint256 feeGrowthInside1LastX128,
            uint128 tokensOwed0,
            uint128 tokensOwed1
        );

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

    /// @notice Creates a new position wrapped in a NFT
    /// @dev Call this when the pool does exist and is initialized. Note that if
    /// the pool is created but not initialized
    /// a method does not exist, i.e. the pool is assumed to be initialized.
    /// @param params The params necessary to mint a position, encoded as
    /// `MintParams` in calldata
    /// @return tokenId The ID of the token that represents the minted position
    /// @return liquidity The amount of liquidity for this position
    /// @return amount0 The amount of token0
    /// @return amount1 The amount of token1
    function mint(
        MintParams calldata params
    )
        external
        payable
        returns (
            uint256 tokenId,
            uint128 liquidity,
            uint256 amount0,
            uint256 amount1
        );

    struct IncreaseLiquidityParams {
        uint256 tokenId;
        uint256 amount0Desired;
        uint256 amount1Desired;
        uint256 amount0Min;
        uint256 amount1Min;
        uint256 deadline;
    }

    /// @notice Increases the amount of liquidity in a position, with tokens
    /// paid by the `msg.sender`
    /// @param params tokenId The ID of the token for which liquidity is being
    /// increased,
    /// amount0Desired The desired amount of token0 to be spent,
    /// amount1Desired The desired amount of token1 to be spent,
    /// amount0Min The minimum amount of token0 to spend, which serves as a
    /// slippage check,
    /// amount1Min The minimum amount of token1 to spend, which serves as a
    /// slippage check,
    /// 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 to acheive resulting liquidity
    /// @return amount1 The amount of token1 to acheive resulting liquidity
    function increaseLiquidity(
        IncreaseLiquidityParams calldata params
    )
        external
        payable
        returns (uint128 liquidity, uint256 amount0, uint256 amount1);

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

    /// @notice Decreases the amount of liquidity in a position and accounts it
    /// to the position
    /// @param params tokenId The ID of the token for which liquidity is being
    /// decreased,
    /// amount The amount by which liquidity will be decreased,
    /// amount0Min The minimum amount of token0 that should be accounted for the
    /// burned liquidity,
    /// amount1Min The minimum amount of token1 that should be accounted for the
    /// burned liquidity,
    /// deadline The time by which the transaction must be included to effect
    /// the change
    /// @return amount0 The amount of token0 accounted to the position's tokens
    /// owed
    /// @return amount1 The amount of token1 accounted to the position's tokens
    /// owed
    function decreaseLiquidity(
        DecreaseLiquidityParams calldata params
    ) external payable returns (uint256 amount0, uint256 amount1);

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

    /// @notice Collects up to a maximum amount of fees owed to a specific
    /// position to the recipient
    /// @param params tokenId The ID of the NFT for which tokens are being
    /// collected,
    /// recipient The account that should receive the tokens,
    /// amount0Max The maximum amount of token0 to collect,
    /// amount1Max The maximum amount of token1 to collect
    /// @return amount0 The amount of fees collected in token0
    /// @return amount1 The amount of fees collected in token1
    function collect(
        CollectParams calldata params
    ) external payable returns (uint256 amount0, uint256 amount1);

    /// @notice Burns a token ID, which deletes it from the NFT contract. The
    /// token must have 0 liquidity and all tokens
    /// must be collected first.
    /// @param tokenId The ID of the token that is being burned
    function burn(
        uint256 tokenId
    ) external payable;

    /// @notice Claims gauge rewards from liquidity incentives for a specific
    /// tokenId
    /// @param tokenId The ID of the token to claim rewards from
    /// @param tokens an array of reward tokens to claim
    function getReward(uint256 tokenId, address[] calldata tokens) external;
}

// 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;

import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import { IShadowGaugeV3 } from
    "contracts/interfaces/external/shadow/IShadowGaugeV3.sol";
import { INuriGauge } from "contracts/interfaces/external/nuri/INuriGauge.sol";

interface IXShadow {
    function exit(
        uint256 amount
    ) external returns (uint256 exitedAmount);
}

interface IX33 {
    function deposit(
        uint256 assets,
        address receiver
    ) external returns (uint256 shares);
}

enum ShadowRewardBehavior {
    Exit, // Exit to Shadow (50% penalty)
    X33, // Deposit into X33
    Keep // Keep in xShadow on Sickle

}

contract ShadowAddresses {
    address constant X_SHADOW = 0x5050bc082FF4A74Fb6B0B04385dEfdDB114b2424;
    address constant X33_ADAPTER = 0x9710E10A8f6FbA8C391606fee18614885684548d;
}

contract ShadowV3GaugeClaim is ShadowAddresses {
    // Shadow rewards are in xShadow, which is not transferable.
    // When claiming, there are three options:
    // 1. Exit to Shadow (50% penalty)
    // 2. Deposit into X33 (no penalty)
    // 3. Keep in xShadow on Sickle
    // This function supports all three options.
    function _claimGaugeRewards(
        address gauge,
        uint256 tokenId,
        address[] memory rewardTokens,
        ShadowRewardBehavior behavior
    ) internal {
        IShadowGaugeV3(gauge).getReward(tokenId, rewardTokens);
        uint256 rewards = IERC20(X_SHADOW).balanceOf(address(this));
        if (rewards > 0) {
            if (behavior == ShadowRewardBehavior.X33) {
                IERC20(X_SHADOW).approve(X33_ADAPTER, rewards);
                IX33(X33_ADAPTER).deposit(rewards, address(this));
            } else if (behavior == ShadowRewardBehavior.Exit) {
                IXShadow(X_SHADOW).exit(rewards);
            } // else keep in xShadow on Sickle
        }
    }
}

contract ShadowV2GaugeClaim is ShadowAddresses {
    function _claimGaugeRewards(
        address gauge,
        address[] memory rewardTokens,
        ShadowRewardBehavior behavior
    ) internal {
        INuriGauge(gauge).getReward(address(this), rewardTokens);
        uint256 rewards = IERC20(X_SHADOW).balanceOf(address(this));
        if (rewards > 0) {
            if (behavior == ShadowRewardBehavior.X33) {
                IERC20(X_SHADOW).approve(X33_ADAPTER, rewards);
                IX33(X33_ADAPTER).deposit(rewards, address(this));
            } else if (behavior == ShadowRewardBehavior.Exit) {
                IXShadow(X_SHADOW).exit(rewards);
            } // else keep in xShadow on Sickle
        }
    }
}

File 6 of 20 : 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 (last updated v4.6.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

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

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

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

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

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

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

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

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

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

interface INuriGauge {
    function initialize(
        address _stake,
        address _feeDist,
        address _voter,
        bool _forPair
    ) external;

    function getReward(address account, address[] calldata tokens) external;

    function claimFees()
        external
        returns (uint256 claimed0, uint256 claimed1);

    function left(
        address token
    ) external view returns (uint256);

    function rewardsListLength() external view returns (uint256);

    function rewardsList() external view returns (address[] memory);

    function earned(
        address token,
        address account
    ) external view returns (uint256);

    function balanceOf(
        address
    ) external view returns (uint256);

    function notifyRewardAmount(address token, uint256 amount) external;

    struct Reward {
        uint256 rewardRate;
        uint256 periodFinish;
        uint256 lastUpdateTime;
        uint256 rewardPerTokenStored;
    }

    function rewardData(
        address token
    ) external view returns (Reward memory);

    function deposit(
        uint256 amount
    ) external;

    function withdraw(
        uint256 amount
    ) external;
}

// 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 11 of 20 : 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 12 of 20 : 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 13 of 20 : 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 14 of 20 : 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 15 of 20 : 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 16 of 20 : 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 18 of 20 : 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;
}

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

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

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":"amount0Max","type":"uint128"},{"internalType":"uint128","name":"amount1Max","type":"uint128"},{"internalType":"bytes","name":"extraData","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":"","type":"tuple"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"depositExistingNft","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","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":"rewardTokens","type":"address[]"}],"name":"earned","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","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":"","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":"","type":"tuple"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"withdrawNft","outputs":[],"stateMutability":"nonpayable","type":"function"}]

608060405234801561001057600080fd5b50610b6d806100206000396000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c80631ae755621461005c5780632847ccf2146100875780633f40c7fa1461009c5780636f4621e3146100bc578063ff7b926614610087575b600080fd5b61007261006a366004610680565b600092915050565b60405190151581526020015b60405180910390f35b61009a6100953660046106ff565b505050565b005b6100af6100aa36600461080d565b6100cf565b60405161007e919061086e565b61009a6100ca3660046108ce565b61020f565b606060006100e0602085018561096c565b90506000835167ffffffffffffffff8111156100fe576100fe610753565b604051908082528060200260200182016040528015610127578160200160208202803683370190505b50905060005b845181101561020557826001600160a01b0316633e491d4786838151811061015757610157610990565b602002602001015188606001356040518363ffffffff1660e01b81526004016101959291906001600160a01b03929092168252602082015260400190565b602060405180830381865afa1580156101b2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101d691906109a6565b8282815181106101e8576101e8610990565b6020908102919091010152806101fd816109bf565b91505061012d565b5095945050505050565b600061021d828401846109e6565b905061022f606088016040890161096c565b815160405163f5f8d36560e01b81526001600160a01b03929092169163f5f8d365916102649160608c01359190600401610a84565b600060405180830381600087803b15801561027e57600080fd5b505af192505050801561028f575060015b506102b46102a0602089018961096c565b8860600135836000015184602001516103ae565b6000856001600160801b031611806102d557506000846001600160801b0316115b156103a5576102ea606088016040890161096c565b6040805160808101825260608a810135825230602083019081526001600160801b038a81168486019081528a8216938501938452945163fc6f786560e01b81529351600485015290516001600160a01b039081166024850152935181166044840152905116606482015291169063fc6f78659060840160408051808303816000875af115801561037e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103a29190610adb565b50505b50505050505050565b60405163f5f8d36560e01b81526001600160a01b0385169063f5f8d365906103dc9086908690600401610a84565b600060405180830381600087803b1580156103f657600080fd5b505af115801561040a573d6000803e3d6000fd5b50506040516370a0823160e01b815230600482015260009250735050bc082ff4a74fb6b0b04385defddb114b242491506370a0823190602401602060405180830381865afa158015610460573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061048491906109a6565b905080156106495760018260028111156104a0576104a0610aff565b036105b85760405163095ea7b360e01b8152739710e10a8f6fba8c391606fee18614885684548d600482015260248101829052735050bc082ff4a74fb6b0b04385defddb114b24249063095ea7b3906044016020604051808303816000875af1158015610511573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105359190610b15565b50604051636e553f6560e01b815260048101829052306024820152739710e10a8f6fba8c391606fee18614885684548d90636e553f65906044016020604051808303816000875af115801561058e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105b291906109a6565b50610649565b60008260028111156105cc576105cc610aff565b0361064957604051637f8661a160e01b815260048101829052735050bc082ff4a74fb6b0b04385defddb114b242490637f8661a1906024016020604051808303816000875af1158015610623573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061064791906109a6565b505b5050505050565b6001600160a01b038116811461066557600080fd5b50565b60006080828403121561067a57600080fd5b50919050565b60008060a0838503121561069357600080fd5b823561069e81610650565b91506106ad8460208501610668565b90509250929050565b60008083601f8401126106c857600080fd5b50813567ffffffffffffffff8111156106e057600080fd5b6020830191508360208285010111156106f857600080fd5b9250929050565b600080600060a0848603121561071457600080fd5b61071e8585610668565b9250608084013567ffffffffffffffff81111561073a57600080fd5b610746868287016106b6565b9497909650939450505050565b634e487b7160e01b600052604160045260246000fd5b600082601f83011261077a57600080fd5b8135602067ffffffffffffffff8083111561079757610797610753565b8260051b604051601f19603f830116810181811084821117156107bc576107bc610753565b6040529384528581018301938381019250878511156107da57600080fd5b83870191505b848210156108025781356107f381610650565b835291830191908301906107e0565b979650505050505050565b600080600060c0848603121561082257600080fd5b833561082d81610650565b925061083c8560208601610668565b915060a084013567ffffffffffffffff81111561085857600080fd5b61086486828701610769565b9150509250925092565b6020808252825182820181905260009190848201906040850190845b818110156108a65783518352928401929184019160010161088a565b50909695505050505050565b80356001600160801b03811681146108c957600080fd5b919050565b60008060008060008061010087890312156108e857600080fd5b6108f28888610668565b9550608087013567ffffffffffffffff8082111561090f57600080fd5b61091b8a838b01610769565b965061092960a08a016108b2565b955061093760c08a016108b2565b945060e089013591508082111561094d57600080fd5b5061095a89828a016106b6565b979a9699509497509295939492505050565b60006020828403121561097e57600080fd5b813561098981610650565b9392505050565b634e487b7160e01b600052603260045260246000fd5b6000602082840312156109b857600080fd5b5051919050565b6000600182016109df57634e487b7160e01b600052601160045260246000fd5b5060010190565b6000602082840312156109f857600080fd5b813567ffffffffffffffff80821115610a1057600080fd5b9083019060408286031215610a2457600080fd5b604051604081018181108382111715610a3f57610a3f610753565b604052823582811115610a5157600080fd5b610a5d87828601610769565b8252506020830135925060038310610a7457600080fd5b6020810192909252509392505050565b6000604082018483526020604081850152818551808452606086019150828701935060005b81811015610ace5784516001600160a01b031683529383019391830191600101610aa9565b5090979650505050505050565b60008060408385031215610aee57600080fd5b505080516020909101519092909150565b634e487b7160e01b600052602160045260246000fd5b600060208284031215610b2757600080fd5b8151801515811461098957600080fdfea2646970667358221220ef1d45ca3b877314db45b31fc73c42bca959012d62ecf39e1fc2f74ff5d2136f64736f6c63430008130033

Deployed Bytecode

0x608060405234801561001057600080fd5b50600436106100575760003560e01c80631ae755621461005c5780632847ccf2146100875780633f40c7fa1461009c5780636f4621e3146100bc578063ff7b926614610087575b600080fd5b61007261006a366004610680565b600092915050565b60405190151581526020015b60405180910390f35b61009a6100953660046106ff565b505050565b005b6100af6100aa36600461080d565b6100cf565b60405161007e919061086e565b61009a6100ca3660046108ce565b61020f565b606060006100e0602085018561096c565b90506000835167ffffffffffffffff8111156100fe576100fe610753565b604051908082528060200260200182016040528015610127578160200160208202803683370190505b50905060005b845181101561020557826001600160a01b0316633e491d4786838151811061015757610157610990565b602002602001015188606001356040518363ffffffff1660e01b81526004016101959291906001600160a01b03929092168252602082015260400190565b602060405180830381865afa1580156101b2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101d691906109a6565b8282815181106101e8576101e8610990565b6020908102919091010152806101fd816109bf565b91505061012d565b5095945050505050565b600061021d828401846109e6565b905061022f606088016040890161096c565b815160405163f5f8d36560e01b81526001600160a01b03929092169163f5f8d365916102649160608c01359190600401610a84565b600060405180830381600087803b15801561027e57600080fd5b505af192505050801561028f575060015b506102b46102a0602089018961096c565b8860600135836000015184602001516103ae565b6000856001600160801b031611806102d557506000846001600160801b0316115b156103a5576102ea606088016040890161096c565b6040805160808101825260608a810135825230602083019081526001600160801b038a81168486019081528a8216938501938452945163fc6f786560e01b81529351600485015290516001600160a01b039081166024850152935181166044840152905116606482015291169063fc6f78659060840160408051808303816000875af115801561037e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103a29190610adb565b50505b50505050505050565b60405163f5f8d36560e01b81526001600160a01b0385169063f5f8d365906103dc9086908690600401610a84565b600060405180830381600087803b1580156103f657600080fd5b505af115801561040a573d6000803e3d6000fd5b50506040516370a0823160e01b815230600482015260009250735050bc082ff4a74fb6b0b04385defddb114b242491506370a0823190602401602060405180830381865afa158015610460573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061048491906109a6565b905080156106495760018260028111156104a0576104a0610aff565b036105b85760405163095ea7b360e01b8152739710e10a8f6fba8c391606fee18614885684548d600482015260248101829052735050bc082ff4a74fb6b0b04385defddb114b24249063095ea7b3906044016020604051808303816000875af1158015610511573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105359190610b15565b50604051636e553f6560e01b815260048101829052306024820152739710e10a8f6fba8c391606fee18614885684548d90636e553f65906044016020604051808303816000875af115801561058e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105b291906109a6565b50610649565b60008260028111156105cc576105cc610aff565b0361064957604051637f8661a160e01b815260048101829052735050bc082ff4a74fb6b0b04385defddb114b242490637f8661a1906024016020604051808303816000875af1158015610623573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061064791906109a6565b505b5050505050565b6001600160a01b038116811461066557600080fd5b50565b60006080828403121561067a57600080fd5b50919050565b60008060a0838503121561069357600080fd5b823561069e81610650565b91506106ad8460208501610668565b90509250929050565b60008083601f8401126106c857600080fd5b50813567ffffffffffffffff8111156106e057600080fd5b6020830191508360208285010111156106f857600080fd5b9250929050565b600080600060a0848603121561071457600080fd5b61071e8585610668565b9250608084013567ffffffffffffffff81111561073a57600080fd5b610746868287016106b6565b9497909650939450505050565b634e487b7160e01b600052604160045260246000fd5b600082601f83011261077a57600080fd5b8135602067ffffffffffffffff8083111561079757610797610753565b8260051b604051601f19603f830116810181811084821117156107bc576107bc610753565b6040529384528581018301938381019250878511156107da57600080fd5b83870191505b848210156108025781356107f381610650565b835291830191908301906107e0565b979650505050505050565b600080600060c0848603121561082257600080fd5b833561082d81610650565b925061083c8560208601610668565b915060a084013567ffffffffffffffff81111561085857600080fd5b61086486828701610769565b9150509250925092565b6020808252825182820181905260009190848201906040850190845b818110156108a65783518352928401929184019160010161088a565b50909695505050505050565b80356001600160801b03811681146108c957600080fd5b919050565b60008060008060008061010087890312156108e857600080fd5b6108f28888610668565b9550608087013567ffffffffffffffff8082111561090f57600080fd5b61091b8a838b01610769565b965061092960a08a016108b2565b955061093760c08a016108b2565b945060e089013591508082111561094d57600080fd5b5061095a89828a016106b6565b979a9699509497509295939492505050565b60006020828403121561097e57600080fd5b813561098981610650565b9392505050565b634e487b7160e01b600052603260045260246000fd5b6000602082840312156109b857600080fd5b5051919050565b6000600182016109df57634e487b7160e01b600052601160045260246000fd5b5060010190565b6000602082840312156109f857600080fd5b813567ffffffffffffffff80821115610a1057600080fd5b9083019060408286031215610a2457600080fd5b604051604081018181108382111715610a3f57610a3f610753565b604052823582811115610a5157600080fd5b610a5d87828601610769565b8252506020830135925060038310610a7457600080fd5b6020810192909252509392505050565b6000604082018483526020604081850152818551808452606086019150828701935060005b81811015610ace5784516001600160a01b031683529383019391830191600101610aa9565b5090979650505050505050565b60008060408385031215610aee57600080fd5b505080516020909101519092909150565b634e487b7160e01b600052602160045260246000fd5b600060208284031215610b2757600080fd5b8151801515811461098957600080fdfea2646970667358221220ef1d45ca3b877314db45b31fc73c42bca959012d62ecf39e1fc2f74ff5d2136f64736f6c63430008130033

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