Source Code
Overview
ETH Balance
0 ETH
ETH Value
$0.00Multichain Info
N/A
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Name:
MerklConnector
Compiler Version
v0.8.19+commit.7dd6d404
Optimization Enabled:
Yes with 200 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import { ConnectorRegistry } from "contracts/ConnectorRegistry.sol"; import { INftFarmConnector } from "contracts/interfaces/INftFarmConnector.sol"; import { NftPosition } from "contracts/structs/NftFarmStrategyStructs.sol"; import { DelegateModule } from "contracts/modules/DelegateModule.sol"; interface IDistribution { function claim( address[] calldata users, address[] calldata tokens, uint256[] calldata amounts, bytes32[][] calldata proofs ) external; } struct MerklClaimExtraData { address[] claimTokens; uint256[] amounts; bytes32[][] proofs; bytes feeClaimExtraData; } contract MerklConnector is INftFarmConnector, DelegateModule { ConnectorRegistry public immutable connectorRegistry; constructor( ConnectorRegistry _connectorRegistry ) { connectorRegistry = _connectorRegistry; } function claim( NftPosition calldata position, address[] memory rewardTokens, uint128 maxAmount0, uint128 maxAmount1, bytes calldata extraData ) external override { MerklClaimExtraData memory claimExtraData = abi.decode(extraData, (MerklClaimExtraData)); address[] memory users = new address[](claimExtraData.claimTokens.length); for (uint256 i; i < claimExtraData.claimTokens.length;) { users[i] = address(this); unchecked { i++; } } IDistribution(position.farm.stakingContract).claim( users, claimExtraData.claimTokens, claimExtraData.amounts, claimExtraData.proofs ); INftFarmConnector connector = INftFarmConnector( connectorRegistry.connectorOf(address(position.nft)) ); _delegateTo( address(connector), abi.encodeCall( INftFarmConnector.claim, ( position, rewardTokens, maxAmount0, maxAmount1, claimExtraData.feeClaimExtraData ) ) ); } function depositExistingNft( NftPosition calldata position, bytes calldata extraData ) external override { } function withdrawNft( NftPosition calldata position, bytes calldata extraData ) external override { } function earned( address, // user NftPosition calldata, address[] memory rewardTokens ) external pure override returns (uint256[] memory) { return new uint256[](rewardTokens.length); } function isStaked( address, // user NftPosition calldata ) external pure override returns (bool) { // Merkl V3 - V4 NFTs are not staked return false; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.17; import { Admin } from "contracts/base/Admin.sol"; import { TimelockAdmin } from "contracts/base/TimelockAdmin.sol"; error ConnectorNotRegistered(address target); error CustomRegistryAlreadyRegistered(); interface ICustomConnectorRegistry { function connectorOf( address target ) external view returns (address); } contract ConnectorRegistry is Admin, TimelockAdmin { event ConnectorChanged(address target, address connector); event CustomRegistryAdded(address registry); event CustomRegistryRemoved(address registry); error ConnectorAlreadySet(address target); error ConnectorNotSet(address target); error ArrayLengthMismatch(); ICustomConnectorRegistry[] public customRegistries; mapping(address target => address connector) private connectors_; constructor( address admin_, address timelockAdmin_ ) Admin(admin_) TimelockAdmin(timelockAdmin_) { } /// Admin functions /// @notice Update connector addresses for a batch of targets. /// @dev Controls which connector contracts are used for the specified /// targets. /// @custom:access Restricted to protocol admin. function setConnectors( address[] calldata targets, address[] calldata connectors ) external onlyAdmin { if (targets.length != connectors.length) { revert ArrayLengthMismatch(); } for (uint256 i; i != targets.length;) { if (connectors_[targets[i]] != address(0)) { revert ConnectorAlreadySet(targets[i]); } connectors_[targets[i]] = connectors[i]; emit ConnectorChanged(targets[i], connectors[i]); unchecked { ++i; } } } function updateConnectors( address[] calldata targets, address[] calldata connectors ) external onlyTimelockAdmin { if (targets.length != connectors.length) { revert ArrayLengthMismatch(); } for (uint256 i; i != targets.length;) { if (connectors_[targets[i]] == address(0)) { revert ConnectorNotSet(targets[i]); } connectors_[targets[i]] = connectors[i]; emit ConnectorChanged(targets[i], connectors[i]); unchecked { ++i; } } } /// @notice Append an address to the custom registries list. /// @custom:access Restricted to protocol admin. function addCustomRegistry( ICustomConnectorRegistry registry ) external onlyAdmin { if (isCustomRegistry(registry)) { revert CustomRegistryAlreadyRegistered(); } customRegistries.push(registry); emit CustomRegistryAdded(address(registry)); } /// @notice Replace an address in the custom registries list. /// @custom:access Restricted to protocol admin. function updateCustomRegistry( uint256 index, ICustomConnectorRegistry newRegistry ) external onlyTimelockAdmin { ICustomConnectorRegistry oldRegistry = customRegistries[index]; emit CustomRegistryRemoved(address(oldRegistry)); customRegistries[index] = newRegistry; if (address(newRegistry) != address(0)) { emit CustomRegistryAdded(address(newRegistry)); } } /// Public functions function connectorOf( address target ) external view returns (address) { address connector = _getConnector(target); if (connector != address(0)) { return connector; } revert ConnectorNotRegistered(target); } function hasConnector( address target ) external view returns (bool) { return _getConnector(target) != address(0); } function isCustomRegistry( ICustomConnectorRegistry registry ) public view returns (bool) { for (uint256 i; i != customRegistries.length;) { if (address(customRegistries[i]) == address(registry)) { return true; } unchecked { ++i; } } return false; } /// Internal functions function _getConnector( address target ) internal view returns (address) { address connector = connectors_[target]; if (connector != address(0)) { return connector; } uint256 length = customRegistries.length; for (uint256 i; i != length;) { if (address(customRegistries[i]) != address(0)) { (bool success, bytes memory data) = address(customRegistries[i]) .staticcall( abi.encodeWithSelector( ICustomConnectorRegistry.connectorOf.selector, target ) ); if (success && data.length == 32) { address _connector = abi.decode(data, (address)); if (_connector != address(0)) { return _connector; } } } unchecked { ++i; } } return address(0); } }
// 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.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 pragma solidity ^0.8.17; contract DelegateModule { function _delegateTo( address to, bytes memory data ) internal returns (bytes memory) { (bool success, bytes memory result) = to.delegatecall(data); if (!success) { if (result.length == 0) revert(); assembly { revert(add(32, result), mload(result)) } } return result; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.17; /// @title Admin contract /// @author vfat.tools /// @notice Provides an administration mechanism allowing restricted functions abstract contract Admin { /// ERRORS /// /// @notice Thrown when the caller is not the admin error NotAdminError(); //0xb5c42b3b /// EVENTS /// /// @notice Emitted when a new admin is set /// @param oldAdmin Address of the old admin /// @param newAdmin Address of the new admin event AdminSet(address oldAdmin, address newAdmin); /// STORAGE /// /// @notice Address of the current admin address public admin; /// MODIFIERS /// /// @dev Restricts a function to the admin modifier onlyAdmin() { if (msg.sender != admin) revert NotAdminError(); _; } /// WRITE FUNCTIONS /// /// @param admin_ Address of the admin constructor( address admin_ ) { emit AdminSet(address(0), admin_); admin = admin_; } /// @notice Sets a new admin /// @param newAdmin Address of the new admin /// @custom:access Restricted to protocol admin. function setAdmin( address newAdmin ) external onlyAdmin { emit AdminSet(admin, newAdmin); admin = newAdmin; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.17; /// @title TimelockAdmin contract /// @author vfat.tools /// @notice Provides an timelockAdministration mechanism allowing restricted /// functions abstract contract TimelockAdmin { /// ERRORS /// /// @notice Thrown when the caller is not the timelockAdmin error NotTimelockAdminError(); /// EVENTS /// /// @notice Emitted when a new timelockAdmin is set /// @param oldTimelockAdmin Address of the old timelockAdmin /// @param newTimelockAdmin Address of the new timelockAdmin event TimelockAdminSet(address oldTimelockAdmin, address newTimelockAdmin); /// STORAGE /// /// @notice Address of the current timelockAdmin address public timelockAdmin; /// MODIFIERS /// /// @dev Restricts a function to the timelockAdmin modifier onlyTimelockAdmin() { if (msg.sender != timelockAdmin) revert NotTimelockAdminError(); _; } /// WRITE FUNCTIONS /// /// @param timelockAdmin_ Address of the timelockAdmin constructor( address timelockAdmin_ ) { emit TimelockAdminSet(timelockAdmin, timelockAdmin_); timelockAdmin = timelockAdmin_; } /// @notice Sets a new timelockAdmin /// @dev Can only be called by the current timelockAdmin /// @param newTimelockAdmin Address of the new timelockAdmin function setTimelockAdmin( address newTimelockAdmin ) external onlyTimelockAdmin { emit TimelockAdminSet(timelockAdmin, newTimelockAdmin); timelockAdmin = newTimelockAdmin; } }
// 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); }
// 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; }
// 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; }
// 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; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (interfaces/IERC721Enumerable.sol) pragma solidity ^0.8.0; import "../token/ERC721/extensions/IERC721Enumerable.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; }
// 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); }
// 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); }
{ "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
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"contract ConnectorRegistry","name":"_connectorRegistry","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"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":"rewardTokens","type":"address[]"},{"internalType":"uint128","name":"maxAmount0","type":"uint128"},{"internalType":"uint128","name":"maxAmount1","type":"uint128"},{"internalType":"bytes","name":"extraData","type":"bytes"}],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"connectorRegistry","outputs":[{"internalType":"contract ConnectorRegistry","name":"","type":"address"}],"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":"extraData","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":"","type":"tuple"},{"internalType":"address[]","name":"rewardTokens","type":"address[]"}],"name":"earned","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"pure","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":"pure","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":"extraData","type":"bytes"}],"name":"withdrawNft","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60a060405234801561001057600080fd5b50604051610d09380380610d0983398101604081905261002f91610040565b6001600160a01b0316608052610070565b60006020828403121561005257600080fd5b81516001600160a01b038116811461006957600080fd5b9392505050565b608051610c786100916000396000818160df015261028c0152610c786000f3fe608060405234801561001057600080fd5b50600436106100625760003560e01c80631ae75562146100675780632847ccf2146100925780633f40c7fa146100a75780636f4621e3146100c7578063b53c86d2146100da578063ff7b926614610092575b600080fd5b61007d61007536600461043e565b600092915050565b60405190151581526020015b60405180910390f35b6100a56100a03660046104bd565b505050565b005b6100ba6100b5366004610619565b610119565b60405161008991906106b5565b6100a56100d53660046106eb565b610167565b6101017f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610089565b6060815167ffffffffffffffff81111561013557610135610511565b60405190808252806020026020018201604052801561015e578160200160208202803683370190505b50949350505050565b600061017582840184610935565b9050600081600001515167ffffffffffffffff81111561019757610197610511565b6040519080825280602002602001820160405280156101c0578160200160208202803683370190505b50905060005b82515181101561020357308282815181106101e3576101e3610a0e565b6001600160a01b03909216602092830291909101909101526001016101c6565b506102116020890189610a24565b6001600160a01b03166371ee95c0828460000151856020015186604001516040518563ffffffff1660e01b815260040161024e9493929190610a7a565b600060405180830381600087803b15801561026857600080fd5b505af115801561027c573d6000803e3d6000fd5b5060009250506001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016905063c79aeaae6102c360608c0160408d01610a24565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602401602060405180830381865afa158015610307573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061032b9190610b3d565b905061037d818a8a8a8a886060015160405160240161034e959493929190610b7e565b60408051601f198184030181529190526020810180516001600160e01b0316636f4621e360e01b179052610389565b50505050505050505050565b6060600080846001600160a01b0316846040516103a69190610c26565b600060405180830381855af49150503d80600081146103e1576040519150601f19603f3d011682016040523d82523d6000602084013e6103e6565b606091505b5091509150816104065780516000036103fe57600080fd5b805181602001fd5b949350505050565b6001600160a01b038116811461042357600080fd5b50565b60006080828403121561043857600080fd5b50919050565b60008060a0838503121561045157600080fd5b823561045c8161040e565b915061046b8460208501610426565b90509250929050565b60008083601f84011261048657600080fd5b50813567ffffffffffffffff81111561049e57600080fd5b6020830191508360208285010111156104b657600080fd5b9250929050565b600080600060a084860312156104d257600080fd5b6104dc8585610426565b9250608084013567ffffffffffffffff8111156104f857600080fd5b61050486828701610474565b9497909650939450505050565b634e487b7160e01b600052604160045260246000fd5b6040516080810167ffffffffffffffff8111828210171561054a5761054a610511565b60405290565b604051601f8201601f1916810167ffffffffffffffff8111828210171561057957610579610511565b604052919050565b600067ffffffffffffffff82111561059b5761059b610511565b5060051b60200190565b600082601f8301126105b657600080fd5b813560206105cb6105c683610581565b610550565b82815260059290921b840181019181810190868411156105ea57600080fd5b8286015b8481101561060e5780356106018161040e565b83529183019183016105ee565b509695505050505050565b600080600060c0848603121561062e57600080fd5b83356106398161040e565b92506106488560208601610426565b915060a084013567ffffffffffffffff81111561066457600080fd5b610670868287016105a5565b9150509250925092565b600081518084526020808501945080840160005b838110156106aa5781518752958201959082019060010161068e565b509495945050505050565b6020815260006106c8602083018461067a565b9392505050565b80356001600160801b03811681146106e657600080fd5b919050565b600080600080600080610100878903121561070557600080fd5b61070f8888610426565b9550608087013567ffffffffffffffff8082111561072c57600080fd5b6107388a838b016105a5565b965061074660a08a016106cf565b955061075460c08a016106cf565b945060e089013591508082111561076a57600080fd5b5061077789828a01610474565b979a9699509497509295939492505050565b600082601f83011261079a57600080fd5b813560206107aa6105c683610581565b82815260059290921b840181019181810190868411156107c957600080fd5b8286015b8481101561060e57803583529183019183016107cd565b600082601f8301126107f557600080fd5b813560206108056105c683610581565b828152600592831b850182019282820191908785111561082457600080fd5b8387015b858110156108b857803567ffffffffffffffff8111156108485760008081fd5b8801603f81018a1361085a5760008081fd5b85810135604061086c6105c683610581565b82815291851b8301810191888101908d8411156108895760008081fd5b938201935b838510156108a75784358252938901939089019061088e565b885250505093850193508401610828565b5090979650505050505050565b600082601f8301126108d657600080fd5b813567ffffffffffffffff8111156108f0576108f0610511565b610903601f8201601f1916602001610550565b81815284602083860101111561091857600080fd5b816020850160208301376000918101602001919091529392505050565b60006020828403121561094757600080fd5b813567ffffffffffffffff8082111561095f57600080fd5b908301906080828603121561097357600080fd5b61097b610527565b82358281111561098a57600080fd5b610996878286016105a5565b8252506020830135828111156109ab57600080fd5b6109b787828601610789565b6020830152506040830135828111156109cf57600080fd5b6109db878286016107e4565b6040830152506060830135828111156109f357600080fd5b6109ff878286016108c5565b60608301525095945050505050565b634e487b7160e01b600052603260045260246000fd5b600060208284031215610a3657600080fd5b81356106c88161040e565b600081518084526020808501945080840160005b838110156106aa5781516001600160a01b031687529582019590820190600101610a55565b608081526000610a8d6080830187610a41565b602083820381850152610aa08288610a41565b91508382036040850152610ab4828761067a565b915083820360608501528185518084528284019150828160051b8501018388016000805b84811015610b2b57878403601f19018652825180518086529088019088860190845b81811015610b165783518352928a0192918a0191600101610afa565b50509688019694505091860191600101610ad8565b50919c9b505050505050505050505050565b600060208284031215610b4f57600080fd5b81516106c88161040e565b60005b83811015610b75578181015183820152602001610b5d565b50506000910152565b60006101008735610b8e8161040e565b6001600160a01b03908116845260208981013590850152604089013590610bb48261040e565b1660408401526060888101359084015260808301819052610bd781840188610a41565b90506001600160801b0380871660a085015280861660c08501525082810360e08401528351808252610c10816020840160208801610b5a565b601f01601f191601602001979650505050505050565b60008251610c38818460208701610b5a565b919091019291505056fea26469706673582212204e591fbe7f0e0847f3fcacf50ed2ac2b59d151ddef34c393dd5600075e63fa0e64736f6c63430008130033000000000000000000000000c6013e57a0811c7111a8fb07acd2e248d9489c99
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106100625760003560e01c80631ae75562146100675780632847ccf2146100925780633f40c7fa146100a75780636f4621e3146100c7578063b53c86d2146100da578063ff7b926614610092575b600080fd5b61007d61007536600461043e565b600092915050565b60405190151581526020015b60405180910390f35b6100a56100a03660046104bd565b505050565b005b6100ba6100b5366004610619565b610119565b60405161008991906106b5565b6100a56100d53660046106eb565b610167565b6101017f000000000000000000000000c6013e57a0811c7111a8fb07acd2e248d9489c9981565b6040516001600160a01b039091168152602001610089565b6060815167ffffffffffffffff81111561013557610135610511565b60405190808252806020026020018201604052801561015e578160200160208202803683370190505b50949350505050565b600061017582840184610935565b9050600081600001515167ffffffffffffffff81111561019757610197610511565b6040519080825280602002602001820160405280156101c0578160200160208202803683370190505b50905060005b82515181101561020357308282815181106101e3576101e3610a0e565b6001600160a01b03909216602092830291909101909101526001016101c6565b506102116020890189610a24565b6001600160a01b03166371ee95c0828460000151856020015186604001516040518563ffffffff1660e01b815260040161024e9493929190610a7a565b600060405180830381600087803b15801561026857600080fd5b505af115801561027c573d6000803e3d6000fd5b5060009250506001600160a01b037f000000000000000000000000c6013e57a0811c7111a8fb07acd2e248d9489c9916905063c79aeaae6102c360608c0160408d01610a24565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602401602060405180830381865afa158015610307573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061032b9190610b3d565b905061037d818a8a8a8a886060015160405160240161034e959493929190610b7e565b60408051601f198184030181529190526020810180516001600160e01b0316636f4621e360e01b179052610389565b50505050505050505050565b6060600080846001600160a01b0316846040516103a69190610c26565b600060405180830381855af49150503d80600081146103e1576040519150601f19603f3d011682016040523d82523d6000602084013e6103e6565b606091505b5091509150816104065780516000036103fe57600080fd5b805181602001fd5b949350505050565b6001600160a01b038116811461042357600080fd5b50565b60006080828403121561043857600080fd5b50919050565b60008060a0838503121561045157600080fd5b823561045c8161040e565b915061046b8460208501610426565b90509250929050565b60008083601f84011261048657600080fd5b50813567ffffffffffffffff81111561049e57600080fd5b6020830191508360208285010111156104b657600080fd5b9250929050565b600080600060a084860312156104d257600080fd5b6104dc8585610426565b9250608084013567ffffffffffffffff8111156104f857600080fd5b61050486828701610474565b9497909650939450505050565b634e487b7160e01b600052604160045260246000fd5b6040516080810167ffffffffffffffff8111828210171561054a5761054a610511565b60405290565b604051601f8201601f1916810167ffffffffffffffff8111828210171561057957610579610511565b604052919050565b600067ffffffffffffffff82111561059b5761059b610511565b5060051b60200190565b600082601f8301126105b657600080fd5b813560206105cb6105c683610581565b610550565b82815260059290921b840181019181810190868411156105ea57600080fd5b8286015b8481101561060e5780356106018161040e565b83529183019183016105ee565b509695505050505050565b600080600060c0848603121561062e57600080fd5b83356106398161040e565b92506106488560208601610426565b915060a084013567ffffffffffffffff81111561066457600080fd5b610670868287016105a5565b9150509250925092565b600081518084526020808501945080840160005b838110156106aa5781518752958201959082019060010161068e565b509495945050505050565b6020815260006106c8602083018461067a565b9392505050565b80356001600160801b03811681146106e657600080fd5b919050565b600080600080600080610100878903121561070557600080fd5b61070f8888610426565b9550608087013567ffffffffffffffff8082111561072c57600080fd5b6107388a838b016105a5565b965061074660a08a016106cf565b955061075460c08a016106cf565b945060e089013591508082111561076a57600080fd5b5061077789828a01610474565b979a9699509497509295939492505050565b600082601f83011261079a57600080fd5b813560206107aa6105c683610581565b82815260059290921b840181019181810190868411156107c957600080fd5b8286015b8481101561060e57803583529183019183016107cd565b600082601f8301126107f557600080fd5b813560206108056105c683610581565b828152600592831b850182019282820191908785111561082457600080fd5b8387015b858110156108b857803567ffffffffffffffff8111156108485760008081fd5b8801603f81018a1361085a5760008081fd5b85810135604061086c6105c683610581565b82815291851b8301810191888101908d8411156108895760008081fd5b938201935b838510156108a75784358252938901939089019061088e565b885250505093850193508401610828565b5090979650505050505050565b600082601f8301126108d657600080fd5b813567ffffffffffffffff8111156108f0576108f0610511565b610903601f8201601f1916602001610550565b81815284602083860101111561091857600080fd5b816020850160208301376000918101602001919091529392505050565b60006020828403121561094757600080fd5b813567ffffffffffffffff8082111561095f57600080fd5b908301906080828603121561097357600080fd5b61097b610527565b82358281111561098a57600080fd5b610996878286016105a5565b8252506020830135828111156109ab57600080fd5b6109b787828601610789565b6020830152506040830135828111156109cf57600080fd5b6109db878286016107e4565b6040830152506060830135828111156109f357600080fd5b6109ff878286016108c5565b60608301525095945050505050565b634e487b7160e01b600052603260045260246000fd5b600060208284031215610a3657600080fd5b81356106c88161040e565b600081518084526020808501945080840160005b838110156106aa5781516001600160a01b031687529582019590820190600101610a55565b608081526000610a8d6080830187610a41565b602083820381850152610aa08288610a41565b91508382036040850152610ab4828761067a565b915083820360608501528185518084528284019150828160051b8501018388016000805b84811015610b2b57878403601f19018652825180518086529088019088860190845b81811015610b165783518352928a0192918a0191600101610afa565b50509688019694505091860191600101610ad8565b50919c9b505050505050505050505050565b600060208284031215610b4f57600080fd5b81516106c88161040e565b60005b83811015610b75578181015183820152602001610b5d565b50506000910152565b60006101008735610b8e8161040e565b6001600160a01b03908116845260208981013590850152604089013590610bb48261040e565b1660408401526060888101359084015260808301819052610bd781840188610a41565b90506001600160801b0380871660a085015280861660c08501525082810360e08401528351808252610c10816020840160208801610b5a565b601f01601f191601602001979650505050505050565b60008251610c38818460208701610b5a565b919091019291505056fea26469706673582212204e591fbe7f0e0847f3fcacf50ed2ac2b59d151ddef34c393dd5600075e63fa0e64736f6c63430008130033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000c6013e57a0811c7111a8fb07acd2e248d9489c99
-----Decoded View---------------
Arg [0] : _connectorRegistry (address): 0xc6013E57a0811C7111A8fB07ACd2E248D9489C99
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 000000000000000000000000c6013e57a0811c7111a8fb07acd2e248d9489c99
Loading...
Loading
Loading...
Loading

Loading...
Loading
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.