Source Code
Overview
S Balance
0 S
More Info
ContractCreator
Latest 1 internal transaction
Parent Transaction Hash | Block | From | To | |||
---|---|---|---|---|---|---|
2939334 | 8 days ago | 0 S |
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:
FarmingCenter
Compiler Version
v0.8.20+commit.a1b79de6
Optimization Enabled:
Yes with 99999999 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: BUSL-1.1 pragma solidity =0.8.20; import '@cryptoalgebra/integral-core/contracts/interfaces/IAlgebraPool.sol'; import '@cryptoalgebra/integral-core/contracts/interfaces/IERC20Minimal.sol'; import '@cryptoalgebra/integral-periphery/contracts/interfaces/IPositionFollower.sol'; import '@cryptoalgebra/integral-periphery/contracts/interfaces/INonfungiblePositionManager.sol'; import '@cryptoalgebra/integral-periphery/contracts/base/Multicall.sol'; import '@cryptoalgebra/integral-periphery/contracts/libraries/PoolAddress.sol'; import '@cryptoalgebra/integral-base-plugin/contracts/interfaces/plugins/IFarmingPlugin.sol'; import './interfaces/IFarmingCenter.sol'; import './libraries/IncentiveId.sol'; /// @title Algebra Integral 1.0 main farming contract /// @dev Manages farmings and performs entry, exit and other actions. contract FarmingCenter is IFarmingCenter, IPositionFollower, Multicall { /// @inheritdoc IFarmingCenter IAlgebraEternalFarming public immutable override eternalFarming; /// @inheritdoc IFarmingCenter INonfungiblePositionManager public immutable override nonfungiblePositionManager; /// @inheritdoc IFarmingCenter address public immutable override algebraPoolDeployer; /// @inheritdoc IFarmingCenter mapping(address poolAddress => address virtualPoolAddress) public override virtualPoolAddresses; /// @inheritdoc IFarmingCenter mapping(uint256 tokenId => bytes32 incentiveId) public override deposits; /// @inheritdoc IFarmingCenter mapping(bytes32 incentiveId => IncentiveKey incentiveKey) public override incentiveKeys; constructor(IAlgebraEternalFarming _eternalFarming, INonfungiblePositionManager _nonfungiblePositionManager) { eternalFarming = _eternalFarming; nonfungiblePositionManager = _nonfungiblePositionManager; algebraPoolDeployer = _nonfungiblePositionManager.poolDeployer(); } modifier isApprovedOrOwner(uint256 tokenId) { require(nonfungiblePositionManager.isApprovedOrOwner(msg.sender, tokenId), 'Not approved for token'); _; } /// @inheritdoc IFarmingCenter function enterFarming(IncentiveKey memory key, uint256 tokenId) external override isApprovedOrOwner(tokenId) { bytes32 incentiveId = IncentiveId.compute(key); if (address(incentiveKeys[incentiveId].pool) == address(0)) incentiveKeys[incentiveId] = key; require(deposits[tokenId] == bytes32(0), 'Token already farmed'); deposits[tokenId] = incentiveId; nonfungiblePositionManager.switchFarmingStatus(tokenId, true); IAlgebraEternalFarming(eternalFarming).enterFarming(key, tokenId); } /// @inheritdoc IFarmingCenter function exitFarming(IncentiveKey memory key, uint256 tokenId) external override isApprovedOrOwner(tokenId) { _exitFarming(key, tokenId, nonfungiblePositionManager.ownerOf(tokenId)); } function _exitFarming(IncentiveKey memory key, uint256 tokenId, address tokenOwner) private { require(deposits[tokenId] == IncentiveId.compute(key), 'Invalid incentiveId'); _switchFarmingStatusOff(tokenId); IAlgebraEternalFarming(eternalFarming).exitFarming(key, tokenId, tokenOwner); } function _switchFarmingStatusOff(uint256 tokenId) internal { deposits[tokenId] = bytes32(0); if (nonfungiblePositionManager.tokenFarmedIn(tokenId) == address(this)) { nonfungiblePositionManager.switchFarmingStatus(tokenId, false); } } /// @inheritdoc IPositionFollower function applyLiquidityDelta(uint256 tokenId, int256) external override { _updatePosition(tokenId); } function _updatePosition(uint256 tokenId) private { require(msg.sender == address(nonfungiblePositionManager), 'Only nonfungiblePosManager'); bytes32 _eternalIncentiveId = deposits[tokenId]; if (_eternalIncentiveId != bytes32(0)) { address tokenOwner = nonfungiblePositionManager.ownerOf(tokenId); (, , , , , , uint128 liquidity, , , , ) = nonfungiblePositionManager.positions(tokenId); IncentiveKey memory key = incentiveKeys[_eternalIncentiveId]; if (liquidity == 0 || virtualPoolAddresses[address(key.pool)] == address(0)) { _exitFarming(key, tokenId, tokenOwner); // nft burned or incentive deactivated, exit completely } else { IAlgebraEternalFarming(eternalFarming).exitFarming(key, tokenId, tokenOwner); if ( IAlgebraEternalFarming(eternalFarming).isIncentiveDeactivated(IncentiveId.compute(key)) || IAlgebraEternalFarming(eternalFarming).isEmergencyWithdrawActivated() ) { // exit completely if the incentive has stopped (manually or automatically) or there is emergency _switchFarmingStatusOff(tokenId); } else { // reenter with new liquidity value IAlgebraEternalFarming(eternalFarming).enterFarming(key, tokenId); } } } } /// @inheritdoc IFarmingCenter function collectRewards( IncentiveKey memory key, uint256 tokenId ) external override isApprovedOrOwner(tokenId) returns (uint256 reward, uint256 bonusReward) { (reward, bonusReward) = eternalFarming.collectRewards(key, tokenId, nonfungiblePositionManager.ownerOf(tokenId)); } /// @inheritdoc IFarmingCenter function claimReward(IERC20Minimal rewardToken, address to, uint256 amountRequested) external override returns (uint256 rewardBalanceBefore) { rewardBalanceBefore = eternalFarming.claimRewardFrom(rewardToken, msg.sender, to, amountRequested); } /// @inheritdoc IFarmingCenter function connectVirtualPoolToPlugin(address newVirtualPool, IFarmingPlugin plugin) external override { IAlgebraPool pool = _checkParamsForVirtualPoolToggle(newVirtualPool, plugin); require(plugin.incentive() == address(0), 'Another incentive is connected'); plugin.setIncentive(newVirtualPool); // revert is possible if the plugin does not allow virtualPoolAddresses[address(pool)] = newVirtualPool; } /// @inheritdoc IFarmingCenter function disconnectVirtualPoolFromPlugin(address virtualPool, IFarmingPlugin plugin) external override { IAlgebraPool pool = _checkParamsForVirtualPoolToggle(virtualPool, plugin); if (plugin.incentive() == virtualPool) plugin.setIncentive(address(0)); // plugin _should_ allow to disconnect incentive virtualPoolAddresses[address(pool)] = address(0); } /// @dev checks input params and fetches corresponding Algebra Integral pool function _checkParamsForVirtualPoolToggle(address virtualPool, IFarmingPlugin plugin) internal returns (IAlgebraPool pool) { require(msg.sender == address(eternalFarming), 'Only farming can call this'); require(virtualPool != address(0), 'Zero address as virtual pool'); pool = IAlgebraPool(plugin.pool()); require(address(pool) == PoolAddress.computeAddress(algebraPoolDeployer, PoolAddress.PoolKey(pool.token0(), pool.token1())), 'Invalid pool'); } }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title The interface for the Algebra farming plugin /// @dev This contract used for virtual pools in farms interface IFarmingPlugin { /// @notice Emitted when new activeIncentive is set /// @param newIncentive The address of the new incentive event Incentive(address newIncentive); /// @notice Returns the address of the pool the plugin is created for /// @return address of the pool function pool() external view returns (address); /// @notice Connects or disconnects an incentive. /// @dev Only farming can connect incentives. /// The one who connected it and the current farming has the right to disconnect the incentive. /// @param newIncentive The address associated with the incentive or zero address function setIncentive(address newIncentive) external; /// @notice Checks if the incentive is connected to pool /// @dev Returns false if the plugin has a different incentive set, the plugin is not connected to the pool, /// or the plugin configuration is incorrect. /// @param targetIncentive The address of the incentive to be checked /// @return Indicates whether the target incentive is active function isIncentiveConnected(address targetIncentive) external view returns (bool); /// @notice Returns the address of active incentive /// @dev if there is no active incentive at the moment, incentiveAddress would be equal to address(0) /// @return The address associated with the current active incentive function incentive() external view returns (address); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.8.4; import './pool/IAlgebraPoolImmutables.sol'; import './pool/IAlgebraPoolState.sol'; import './pool/IAlgebraPoolActions.sol'; import './pool/IAlgebraPoolPermissionedActions.sol'; import './pool/IAlgebraPoolEvents.sol'; import './pool/IAlgebraPoolErrors.sol'; /// @title The interface for a Algebra Pool /// @dev The pool interface is broken up into many smaller pieces. /// This interface includes custom error definitions and cannot be used in older versions of Solidity. /// For older versions of Solidity use #IAlgebraPoolLegacy /// Credit to Uniswap Labs under GPL-2.0-or-later license: /// https://github.com/Uniswap/v3-core/tree/main/contracts/interfaces interface IAlgebraPool is IAlgebraPoolImmutables, IAlgebraPoolState, IAlgebraPoolActions, IAlgebraPoolPermissionedActions, IAlgebraPoolEvents, IAlgebraPoolErrors { // used only for combining interfaces }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title Minimal ERC20 interface for Algebra /// @notice Contains a subset of the full ERC20 interface that is used in Algebra /// @dev Credit to Uniswap Labs under GPL-2.0-or-later license: /// https://github.com/Uniswap/v3-core/tree/main/contracts/interfaces interface IERC20Minimal { /// @notice Returns the balance of a token /// @param account The account for which to look up the number of tokens it has, i.e. its balance /// @return The number of tokens held by the account function balanceOf(address account) external view returns (uint256); /// @notice Transfers the amount of token from the `msg.sender` to the recipient /// @param recipient The account that will receive the amount transferred /// @param amount The number of tokens to send from the sender to the recipient /// @return Returns true for a successful transfer, false for an unsuccessful transfer function transfer(address recipient, uint256 amount) external returns (bool); /// @notice Returns the current allowance given to a spender by an owner /// @param owner The account of the token owner /// @param spender The account of the token spender /// @return The current allowance granted by `owner` to `spender` function allowance(address owner, address spender) external view returns (uint256); /// @notice Sets the allowance of a spender from the `msg.sender` to the value `amount` /// @param spender The account which will be allowed to spend a given amount of the owners tokens /// @param amount The amount of tokens allowed to be used by `spender` /// @return Returns true for a successful approval, false for unsuccessful function approve(address spender, uint256 amount) external returns (bool); /// @notice Transfers `amount` tokens from `sender` to `recipient` up to the allowance given to the `msg.sender` /// @param sender The account from which the transfer will be initiated /// @param recipient The recipient of the transfer /// @param amount The amount of the transfer /// @return Returns true for a successful transfer, false for unsuccessful function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /// @notice Event emitted when tokens are transferred from one address to another, either via `#transfer` or `#transferFrom`. /// @param from The account from which the tokens were sent, i.e. the balance decreased /// @param to The account to which the tokens were sent, i.e. the balance increased /// @param value The amount of tokens that were transferred event Transfer(address indexed from, address indexed to, uint256 value); /// @notice Event emitted when the approval amount for the spender of a given owner's tokens changes. /// @param owner The account that approved spending of its tokens /// @param spender The account for which the spending allowance was modified /// @param value The new allowance from the owner to the spender event Approval(address indexed owner, address indexed spender, uint256 value); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title Permissionless pool actions /// @dev Credit to Uniswap Labs under GPL-2.0-or-later license: /// https://github.com/Uniswap/v3-core/tree/main/contracts/interfaces interface IAlgebraPoolActions { /// @notice Sets the initial price for the pool /// @dev Price is represented as a sqrt(amountToken1/amountToken0) Q64.96 value /// @dev Initialization should be done in one transaction with pool creation to avoid front-running /// @param initialPrice The initial sqrt price of the pool as a Q64.96 function initialize(uint160 initialPrice) external; /// @notice Adds liquidity for the given recipient/bottomTick/topTick position /// @dev The caller of this method receives a callback in the form of IAlgebraMintCallback#algebraMintCallback /// in which they must pay any token0 or token1 owed for the liquidity. The amount of token0/token1 due depends /// on bottomTick, topTick, the amount of liquidity, and the current price. /// @param leftoversRecipient The address which will receive potential surplus of paid tokens /// @param recipient The address for which the liquidity will be created /// @param bottomTick The lower tick of the position in which to add liquidity /// @param topTick The upper tick of the position in which to add liquidity /// @param liquidityDesired The desired amount of liquidity to mint /// @param data Any data that should be passed through to the callback /// @return amount0 The amount of token0 that was paid to mint the given amount of liquidity. Matches the value in the callback /// @return amount1 The amount of token1 that was paid to mint the given amount of liquidity. Matches the value in the callback /// @return liquidityActual The actual minted amount of liquidity function mint( address leftoversRecipient, address recipient, int24 bottomTick, int24 topTick, uint128 liquidityDesired, bytes calldata data ) external returns (uint256 amount0, uint256 amount1, uint128 liquidityActual); /// @notice Collects tokens owed to a position /// @dev Does not recompute fees earned, which must be done either via mint or burn of any amount of liquidity. /// Collect must be called by the position owner. To withdraw only token0 or only token1, amount0Requested or /// amount1Requested may be set to zero. To withdraw all tokens owed, caller may pass any value greater than the /// actual tokens owed, e.g. type(uint128).max. Tokens owed may be from accumulated swap fees or burned liquidity. /// @param recipient The address which should receive the fees collected /// @param bottomTick The lower tick of the position for which to collect fees /// @param topTick The upper tick of the position for which to collect fees /// @param amount0Requested How much token0 should be withdrawn from the fees owed /// @param amount1Requested How much token1 should be withdrawn from the fees owed /// @return amount0 The amount of fees collected in token0 /// @return amount1 The amount of fees collected in token1 function collect( address recipient, int24 bottomTick, int24 topTick, uint128 amount0Requested, uint128 amount1Requested ) external returns (uint128 amount0, uint128 amount1); /// @notice Burn liquidity from the sender and account tokens owed for the liquidity to the position /// @dev Can be used to trigger a recalculation of fees owed to a position by calling with an amount of 0 /// @dev Fees must be collected separately via a call to #collect /// @param bottomTick The lower tick of the position for which to burn liquidity /// @param topTick The upper tick of the position for which to burn liquidity /// @param amount How much liquidity to burn /// @param data Any data that should be passed through to the plugin /// @return amount0 The amount of token0 sent to the recipient /// @return amount1 The amount of token1 sent to the recipient function burn(int24 bottomTick, int24 topTick, uint128 amount, bytes calldata data) external returns (uint256 amount0, uint256 amount1); /// @notice Swap token0 for token1, or token1 for token0 /// @dev The caller of this method receives a callback in the form of IAlgebraSwapCallback#algebraSwapCallback /// @param recipient The address to receive the output of the swap /// @param zeroToOne The direction of the swap, true for token0 to token1, false for token1 to token0 /// @param amountRequired The amount of the swap, which implicitly configures the swap as exact input (positive), or exact output (negative) /// @param limitSqrtPrice The Q64.96 sqrt price limit. If zero for one, the price cannot be less than this /// value after the swap. If one for zero, the price cannot be greater than this value after the swap /// @param data Any data to be passed through to the callback. If using the Router it should contain SwapRouter#SwapCallbackData /// @return amount0 The delta of the balance of token0 of the pool, exact when negative, minimum when positive /// @return amount1 The delta of the balance of token1 of the pool, exact when negative, minimum when positive function swap( address recipient, bool zeroToOne, int256 amountRequired, uint160 limitSqrtPrice, bytes calldata data ) external returns (int256 amount0, int256 amount1); /// @notice Swap token0 for token1, or token1 for token0 with prepayment /// @dev The caller of this method receives a callback in the form of IAlgebraSwapCallback#algebraSwapCallback /// caller must send tokens in callback before swap calculation /// the actually sent amount of tokens is used for further calculations /// @param leftoversRecipient The address which will receive potential surplus of paid tokens /// @param recipient The address to receive the output of the swap /// @param zeroToOne The direction of the swap, true for token0 to token1, false for token1 to token0 /// @param amountToSell The amount of the swap, only positive (exact input) amount allowed /// @param limitSqrtPrice The Q64.96 sqrt price limit. If zero for one, the price cannot be less than this /// value after the swap. If one for zero, the price cannot be greater than this value after the swap /// @param data Any data to be passed through to the callback. If using the Router it should contain SwapRouter#SwapCallbackData /// @return amount0 The delta of the balance of token0 of the pool, exact when negative, minimum when positive /// @return amount1 The delta of the balance of token1 of the pool, exact when negative, minimum when positive function swapWithPaymentInAdvance( address leftoversRecipient, address recipient, bool zeroToOne, int256 amountToSell, uint160 limitSqrtPrice, bytes calldata data ) external returns (int256 amount0, int256 amount1); /// @notice Receive token0 and/or token1 and pay it back, plus a fee, in the callback /// @dev The caller of this method receives a callback in the form of IAlgebraFlashCallback#algebraFlashCallback /// @dev All excess tokens paid in the callback are distributed to currently in-range liquidity providers as an additional fee. /// If there are no in-range liquidity providers, the fee will be transferred to the first active provider in the future /// @param recipient The address which will receive the token0 and token1 amounts /// @param amount0 The amount of token0 to send /// @param amount1 The amount of token1 to send /// @param data Any data to be passed through to the callback function flash(address recipient, uint256 amount0, uint256 amount1, bytes calldata data) external; }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.8.4; /// @title Errors emitted by a pool /// @notice Contains custom errors emitted by the pool /// @dev Custom errors are separated from the common pool interface for compatibility with older versions of Solidity interface IAlgebraPoolErrors { // #### pool errors #### /// @notice Emitted by the reentrancy guard error locked(); /// @notice Emitted if arithmetic error occurred error arithmeticError(); /// @notice Emitted if an attempt is made to initialize the pool twice error alreadyInitialized(); /// @notice Emitted if an attempt is made to mint or swap in uninitialized pool error notInitialized(); /// @notice Emitted if 0 is passed as amountRequired to swap function error zeroAmountRequired(); /// @notice Emitted if invalid amount is passed as amountRequired to swap function error invalidAmountRequired(); /// @notice Emitted if the pool received fewer tokens than it should have error insufficientInputAmount(); /// @notice Emitted if there was an attempt to mint zero liquidity error zeroLiquidityDesired(); /// @notice Emitted if actual amount of liquidity is zero (due to insufficient amount of tokens received) error zeroLiquidityActual(); /// @notice Emitted if the pool received fewer tokens0 after flash than it should have error flashInsufficientPaid0(); /// @notice Emitted if the pool received fewer tokens1 after flash than it should have error flashInsufficientPaid1(); /// @notice Emitted if limitSqrtPrice param is incorrect error invalidLimitSqrtPrice(); /// @notice Tick must be divisible by tickspacing error tickIsNotSpaced(); /// @notice Emitted if a method is called that is accessible only to the factory owner or dedicated role error notAllowed(); /// @notice Emitted if new tick spacing exceeds max allowed value error invalidNewTickSpacing(); /// @notice Emitted if new community fee exceeds max allowed value error invalidNewCommunityFee(); /// @notice Emitted if an attempt is made to manually change the fee value, but dynamic fee is enabled error dynamicFeeActive(); /// @notice Emitted if an attempt is made by plugin to change the fee value, but dynamic fee is disabled error dynamicFeeDisabled(); /// @notice Emitted if an attempt is made to change the plugin configuration, but the plugin is not connected error pluginIsNotConnected(); /// @notice Emitted if a plugin returns invalid selector after hook call /// @param expectedSelector The expected selector error invalidHookResponse(bytes4 expectedSelector); // #### LiquidityMath errors #### /// @notice Emitted if liquidity underflows error liquiditySub(); /// @notice Emitted if liquidity overflows error liquidityAdd(); // #### TickManagement errors #### /// @notice Emitted if the topTick param not greater then the bottomTick param error topTickLowerOrEqBottomTick(); /// @notice Emitted if the bottomTick param is lower than min allowed value error bottomTickLowerThanMIN(); /// @notice Emitted if the topTick param is greater than max allowed value error topTickAboveMAX(); /// @notice Emitted if the liquidity value associated with the tick exceeds MAX_LIQUIDITY_PER_TICK error liquidityOverflow(); /// @notice Emitted if an attempt is made to interact with an uninitialized tick error tickIsNotInitialized(); /// @notice Emitted if there is an attempt to insert a new tick into the list of ticks with incorrect indexes of the previous and next ticks error tickInvalidLinks(); // #### SafeTransfer errors #### /// @notice Emitted if token transfer failed internally error transferFailed(); // #### TickMath errors #### /// @notice Emitted if tick is greater than the maximum or less than the minimum allowed value error tickOutOfRange(); /// @notice Emitted if price is greater than the maximum or less than the minimum allowed value error priceOutOfRange(); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title Events emitted by a pool /// @dev Credit to Uniswap Labs under GPL-2.0-or-later license: /// https://github.com/Uniswap/v3-core/tree/main/contracts/interfaces interface IAlgebraPoolEvents { /// @notice Emitted exactly once by a pool when #initialize is first called on the pool /// @dev Mint/Burn/Swaps cannot be emitted by the pool before Initialize /// @param price The initial sqrt price of the pool, as a Q64.96 /// @param tick The initial tick of the pool, i.e. log base 1.0001 of the starting price of the pool event Initialize(uint160 price, int24 tick); /// @notice Emitted when liquidity is minted for a given position /// @param sender The address that minted the liquidity /// @param owner The owner of the position and recipient of any minted liquidity /// @param bottomTick The lower tick of the position /// @param topTick The upper tick of the position /// @param liquidityAmount The amount of liquidity minted to the position range /// @param amount0 How much token0 was required for the minted liquidity /// @param amount1 How much token1 was required for the minted liquidity event Mint( address sender, address indexed owner, int24 indexed bottomTick, int24 indexed topTick, uint128 liquidityAmount, uint256 amount0, uint256 amount1 ); /// @notice Emitted when fees are collected by the owner of a position /// @param owner The owner of the position for which fees are collected /// @param recipient The address that received fees /// @param bottomTick The lower tick of the position /// @param topTick The upper tick of the position /// @param amount0 The amount of token0 fees collected /// @param amount1 The amount of token1 fees collected event Collect(address indexed owner, address recipient, int24 indexed bottomTick, int24 indexed topTick, uint128 amount0, uint128 amount1); /// @notice Emitted when a position's liquidity is removed /// @dev Does not withdraw any fees earned by the liquidity position, which must be withdrawn via #collect /// @param owner The owner of the position for which liquidity is removed /// @param bottomTick The lower tick of the position /// @param topTick The upper tick of the position /// @param liquidityAmount The amount of liquidity to remove /// @param amount0 The amount of token0 withdrawn /// @param amount1 The amount of token1 withdrawn event Burn(address indexed owner, int24 indexed bottomTick, int24 indexed topTick, uint128 liquidityAmount, uint256 amount0, uint256 amount1); /// @notice Emitted by the pool for any swaps between token0 and token1 /// @param sender The address that initiated the swap call, and that received the callback /// @param recipient The address that received the output of the swap /// @param amount0 The delta of the token0 balance of the pool /// @param amount1 The delta of the token1 balance of the pool /// @param price The sqrt(price) of the pool after the swap, as a Q64.96 /// @param liquidity The liquidity of the pool after the swap /// @param tick The log base 1.0001 of price of the pool after the swap event Swap(address indexed sender, address indexed recipient, int256 amount0, int256 amount1, uint160 price, uint128 liquidity, int24 tick); /// @notice Emitted by the pool for any flashes of token0/token1 /// @param sender The address that initiated the swap call, and that received the callback /// @param recipient The address that received the tokens from flash /// @param amount0 The amount of token0 that was flashed /// @param amount1 The amount of token1 that was flashed /// @param paid0 The amount of token0 paid for the flash, which can exceed the amount0 plus the fee /// @param paid1 The amount of token1 paid for the flash, which can exceed the amount1 plus the fee event Flash(address indexed sender, address indexed recipient, uint256 amount0, uint256 amount1, uint256 paid0, uint256 paid1); /// @notice Emitted when the community fee is changed by the pool /// @param communityFeeNew The updated value of the community fee in thousandths (1e-3) event CommunityFee(uint16 communityFeeNew); /// @notice Emitted when the tick spacing changes /// @param newTickSpacing The updated value of the new tick spacing event TickSpacing(int24 newTickSpacing); /// @notice Emitted when the plugin address changes /// @param newPluginAddress New plugin address event Plugin(address newPluginAddress); /// @notice Emitted when the plugin config changes /// @param newPluginConfig New plugin config event PluginConfig(uint8 newPluginConfig); /// @notice Emitted when the fee changes inside the pool /// @param fee The current fee in hundredths of a bip, i.e. 1e-6 event Fee(uint16 fee); event CommunityVault(address newCommunityVault); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title Pool state that never changes /// @dev Credit to Uniswap Labs under GPL-2.0-or-later license: /// https://github.com/Uniswap/v3-core/tree/main/contracts/interfaces interface IAlgebraPoolImmutables { /// @notice The Algebra factory contract, which must adhere to the IAlgebraFactory 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 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); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title Permissioned pool actions /// @notice Contains pool methods that may only be called by permissioned addresses /// @dev Credit to Uniswap Labs under GPL-2.0-or-later license: /// https://github.com/Uniswap/v3-core/tree/main/contracts/interfaces interface IAlgebraPoolPermissionedActions { /// @notice Set the community's % share of the fees. Only factory owner or POOLS_ADMINISTRATOR_ROLE role /// @param newCommunityFee The new community fee percent in thousandths (1e-3) function setCommunityFee(uint16 newCommunityFee) external; /// @notice Set the new tick spacing values. Only factory owner or POOLS_ADMINISTRATOR_ROLE role /// @param newTickSpacing The new tick spacing value function setTickSpacing(int24 newTickSpacing) external; /// @notice Set the new plugin address. Only factory owner or POOLS_ADMINISTRATOR_ROLE role /// @param newPluginAddress The new plugin address function setPlugin(address newPluginAddress) external; /// @notice Set new plugin config. Only factory owner or POOLS_ADMINISTRATOR_ROLE role /// @param newConfig In the new configuration of the plugin, /// each bit of which is responsible for a particular hook. function setPluginConfig(uint8 newConfig) external; /// @notice Set new community fee vault address. Only factory owner or POOLS_ADMINISTRATOR_ROLE role /// @dev Community fee vault receives collected community fees. /// **accumulated but not yet sent to the vault community fees once will be sent to the `newCommunityVault` address** /// @param newCommunityVault The address of new community fee vault function setCommunityVault(address newCommunityVault) external; /// @notice Set new pool fee. Can be called by owner if dynamic fee is disabled. /// Called by the plugin if dynamic fee is enabled /// @param newFee The new fee value function setFee(uint16 newFee) external; }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title Pool state that can change /// @dev Important security note: when using this data by external contracts, it is necessary to take into account the possibility /// of manipulation (including read-only reentrancy). /// This interface is based on the UniswapV3 interface, credit to Uniswap Labs under GPL-2.0-or-later license: /// https://github.com/Uniswap/v3-core/tree/main/contracts/interfaces interface IAlgebraPoolState { /// @notice Safely get most important state values of Algebra Integral AMM /// @dev Several values exposed as a single method to save gas when accessed externally. /// **Important security note: this method checks reentrancy lock and should be preferred in most cases**. /// @return sqrtPrice The current price of the pool as a sqrt(dToken1/dToken0) Q64.96 value /// @return tick The current global tick of the pool. May not always be equal to SqrtTickMath.getTickAtSqrtRatio(price) if the price is on a tick boundary /// @return lastFee The current (last known) pool fee value in hundredths of a bip, i.e. 1e-6 (so '100' is '0.01%'). May be obsolete if using dynamic fee plugin /// @return pluginConfig The current plugin config as bitmap. Each bit is responsible for enabling/disabling the hooks, the last bit turns on/off dynamic fees logic /// @return activeLiquidity The currently in-range liquidity available to the pool /// @return nextTick The next initialized tick after current global tick /// @return previousTick The previous initialized tick before (or at) current global tick function safelyGetStateOfAMM() external view returns (uint160 sqrtPrice, int24 tick, uint16 lastFee, uint8 pluginConfig, uint128 activeLiquidity, int24 nextTick, int24 previousTick); /// @notice Allows to easily get current reentrancy lock status /// @dev can be used to prevent read-only reentrancy. /// This method just returns `globalState.unlocked` value /// @return unlocked Reentrancy lock flag, true if the pool currently is unlocked, otherwise - false function isUnlocked() external view returns (bool unlocked); // ! IMPORTANT security note: the pool state can be manipulated. // ! The following methods do not check reentrancy lock themselves. /// @notice The globalState structure in the pool stores many values but requires only one slot /// and is exposed as a single method to save gas when accessed externally. /// @dev **important security note: caller should check `unlocked` flag to prevent read-only reentrancy** /// @return price The current price of the pool as a sqrt(dToken1/dToken0) 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(price) if the price is on a tick boundary /// @return lastFee The current (last known) pool fee value in hundredths of a bip, i.e. 1e-6 (so '100' is '0.01%'). May be obsolete if using dynamic fee plugin /// @return pluginConfig The current plugin config as bitmap. Each bit is responsible for enabling/disabling the hooks, the last bit turns on/off dynamic fees logic /// @return communityFee The community fee represented as a percent of all collected fee in thousandths, i.e. 1e-3 (so 100 is 10%) /// @return unlocked Reentrancy lock flag, true if the pool currently is unlocked, otherwise - false function globalState() external view returns (uint160 price, int24 tick, uint16 lastFee, uint8 pluginConfig, uint16 communityFee, bool unlocked); /// @notice Look up information about a specific tick in the pool /// @dev **important security note: caller should check reentrancy lock to prevent read-only reentrancy** /// @param tick The tick to look up /// @return liquidityTotal The total amount of position liquidity that uses the pool either as tick lower or tick upper /// @return liquidityDelta How much liquidity changes when the pool price crosses the tick /// @return prevTick The previous tick in tick list /// @return nextTick The next tick in tick list /// @return outerFeeGrowth0Token The fee growth on the other side of the tick from the current tick in token0 /// @return outerFeeGrowth1Token The fee growth on the other side of the tick from the current tick in token1 /// 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 ( uint256 liquidityTotal, int128 liquidityDelta, int24 prevTick, int24 nextTick, uint256 outerFeeGrowth0Token, uint256 outerFeeGrowth1Token ); /// @notice The timestamp of the last sending of tokens to community vault /// @return The timestamp truncated to 32 bits function communityFeeLastTimestamp() external view returns (uint32); /// @notice The amounts of token0 and token1 that will be sent to the vault /// @dev Will be sent COMMUNITY_FEE_TRANSFER_FREQUENCY after communityFeeLastTimestamp /// @return communityFeePending0 The amount of token0 that will be sent to the vault /// @return communityFeePending1 The amount of token1 that will be sent to the vault function getCommunityFeePending() external view returns (uint128 communityFeePending0, uint128 communityFeePending1); /// @notice Returns the address of currently used plugin /// @dev The plugin is subject to change /// @return pluginAddress The address of currently used plugin function plugin() external view returns (address pluginAddress); /// @notice The contract to which community fees are transferred /// @return communityVaultAddress The communityVault address function communityVault() external view returns (address communityVaultAddress); /// @notice Returns 256 packed tick initialized boolean values. See TickTree for more information /// @param wordPosition Index of 256-bits word with ticks /// @return The 256-bits word with packed ticks info function tickTable(int16 wordPosition) external view returns (uint256); /// @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 /// @return The fee growth accumulator for token0 function totalFeeGrowth0Token() 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 /// @return The fee growth accumulator for token1 function totalFeeGrowth1Token() external view returns (uint256); /// @notice The current pool fee value /// @dev In case dynamic fee is enabled in the pool, this method will call the plugin to get the current fee. /// If the plugin implements complex fee logic, this method may return an incorrect value or revert. /// In this case, see the plugin implementation and related documentation. /// @dev **important security note: caller should check reentrancy lock to prevent read-only reentrancy** /// @return currentFee The current pool fee value in hundredths of a bip, i.e. 1e-6 function fee() external view returns (uint16 currentFee); /// @notice The tracked token0 and token1 reserves of pool /// @dev If at any time the real balance is larger, the excess will be transferred to liquidity providers as additional fee. /// If the balance exceeds uint128, the excess will be sent to the communityVault. /// @return reserve0 The last known reserve of token0 /// @return reserve1 The last known reserve of token1 function getReserves() external view returns (uint128 reserve0, uint128 reserve1); /// @notice Returns the information about a position by the position's key /// @dev **important security note: caller should check reentrancy lock to prevent read-only reentrancy** /// @param key The position's key is a packed concatenation of the owner address, bottomTick and topTick indexes /// @return liquidity The amount of liquidity in the position /// @return innerFeeGrowth0Token Fee growth of token0 inside the tick range as of the last mint/burn/poke /// @return innerFeeGrowth1Token Fee growth of token1 inside the tick range as of the last mint/burn/poke /// @return fees0 The computed amount of token0 owed to the position as of the last mint/burn/poke /// @return fees1 The computed amount of token1 owed to the position as of the last mint/burn/poke function positions( bytes32 key ) external view returns (uint256 liquidity, uint256 innerFeeGrowth0Token, uint256 innerFeeGrowth1Token, uint128 fees0, uint128 fees1); /// @notice The currently in range liquidity available to the pool /// @dev This value has no relationship to the total liquidity across all ticks. /// Returned value cannot exceed type(uint128).max /// @dev **important security note: caller should check reentrancy lock to prevent read-only reentrancy** /// @return The current in range liquidity function liquidity() external view returns (uint128); /// @notice The current tick spacing /// @dev Ticks can only be initialized by new mints at multiples of this value /// e.g.: a tickSpacing of 60 means ticks can be initialized every 60th tick, i.e., ..., -120, -60, 0, 60, 120, ... /// However, tickspacing can be changed after the ticks have been initialized. /// This value is an int24 to avoid casting even though it is always positive. /// @return The current tick spacing function tickSpacing() external view returns (int24); /// @notice The previous initialized tick before (or at) current global tick /// @dev **important security note: caller should check reentrancy lock to prevent read-only reentrancy** /// @return The previous initialized tick function prevTickGlobal() external view returns (int24); /// @notice The next initialized tick after current global tick /// @dev **important security note: caller should check reentrancy lock to prevent read-only reentrancy** /// @return The next initialized tick function nextTickGlobal() external view returns (int24); /// @notice The root of tick search tree /// @dev Each bit corresponds to one node in the second layer of tick tree: '1' if node has at least one active bit. /// **important security note: caller should check reentrancy lock to prevent read-only reentrancy** /// @return The root of tick search tree as bitmap function tickTreeRoot() external view returns (uint32); /// @notice The second layer of tick search tree /// @dev Each bit in node corresponds to one node in the leafs layer (`tickTable`) of tick tree: '1' if leaf has at least one active bit. /// **important security note: caller should check reentrancy lock to prevent read-only reentrancy** /// @return The node of tick search tree second layer function tickTreeSecondLayer(int16) external view returns (uint256); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity =0.8.20; import '../interfaces/IMulticall.sol'; /// @title Multicall /// @notice Enables calling multiple methods in a single call to the contract abstract contract Multicall is IMulticall { /// @inheritdoc IMulticall function multicall(bytes[] calldata data) external payable override returns (bytes[] memory results) { results = new bytes[](data.length); unchecked { for (uint256 i = 0; i < data.length; i++) { (bool success, bytes memory result) = address(this).delegatecall(data[i]); if (!success) { // Look for revert reason and bubble it up if present require(result.length > 0); // The easiest way to bubble the revert reason is using memory via assembly assembly ('memory-safe') { revert(add(32, result), mload(result)) } } results[i] = result; } } } }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.7.5; import '@openzeppelin/contracts/token/ERC721/IERC721.sol'; /// @title ERC721 with permit /// @notice Extension to ERC721 that includes a permit function for signature based approvals interface IERC721Permit is IERC721 { /// @notice The permit typehash used in the permit signature /// @return The typehash for the permit function PERMIT_TYPEHASH() external pure returns (bytes32); /// @notice The domain separator used in the permit signature /// @return The domain separator used in encoding of permit signature function DOMAIN_SEPARATOR() external view returns (bytes32); /// @notice Approve of a specific token ID for spending by spender via signature /// @param spender The account that is being approved /// @param tokenId The ID of the token that is being approved for spending /// @param deadline The deadline timestamp by which the call must be mined for the approve to work /// @param v Must produce valid secp256k1 signature from the holder along with `r` and `s` /// @param r Must produce valid secp256k1 signature from the holder along with `v` and `s` /// @param s Must produce valid secp256k1 signature from the holder along with `r` and `v` function permit( address spender, uint256 tokenId, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external payable; }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.7.5; pragma abicoder v2; /// @title Multicall interface /// @notice Enables calling multiple methods in a single call to the contract interface IMulticall { /// @notice Call multiple functions in the current contract and return the data from all of them if they all succeed /// @dev The `msg.value` should not be trusted for any method callable from multicall. /// @param data The encoded function data for each of the calls to make to this contract /// @return results The results from each of the calls passed in via data function multicall(bytes[] calldata data) external payable returns (bytes[] memory results); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.7.5; pragma abicoder v2; import '@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol'; import '@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol'; import './IPoolInitializer.sol'; import './IERC721Permit.sol'; import './IPeripheryPayments.sol'; import './IPeripheryImmutableState.sol'; /// @title Non-fungible token for positions /// @notice Wraps Algebra positions in a non-fungible token interface which allows for them to be transferred /// and authorized. /// @dev Credit to Uniswap Labs under GPL-2.0-or-later license: /// https://github.com/Uniswap/v3-periphery interface INonfungiblePositionManager is IPoolInitializer, IPeripheryPayments, IPeripheryImmutableState, IERC721Metadata, IERC721Enumerable, IERC721Permit { /// @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 liquidityDesired The amount by which liquidity for the NFT position was increased /// @param actualLiquidity the actual liquidity that was added into a pool. Could differ from /// _liquidity_ when using FeeOnTransfer tokens /// @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 liquidityDesired, uint128 actualLiquidity, uint256 amount0, uint256 amount1, address pool ); /// @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 withdrawalFeeliquidity Withdrawal fee liq /// @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, uint128 withdrawalFeeliquidity, uint256 amount0, uint256 amount1 ); /// @notice Emitted when a fee vault is set for a pool /// @param pool The address of the pool to which the vault have been applied /// @param feeVault The address of the fee vault /// @param fee Percentage of withdrawal fee that will be sent to the vault event FeeVaultForPool(address pool, address feeVault, uint16 fee); /// @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 Emitted if farming failed in call from NonfungiblePositionManager. /// @dev Should never be emitted /// @param tokenId The ID of corresponding token event FarmingFailed(uint256 indexed tokenId); /// @notice Emitted after farming center address change /// @param farmingCenterAddress The new address of connected farming center event FarmingCenter(address farmingCenterAddress); /// @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 nonce The nonce for permits /// @return operator The address that is approved for spending /// @return token0 The address of the token0 for a specific pool /// @return token1 The address of the token1 for a specific 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 ( uint88 nonce, address operator, address token0, address token1, int24 tickLower, int24 tickUpper, uint128 liquidity, uint256 feeGrowthInside0LastX128, uint256 feeGrowthInside1LastX128, uint128 tokensOwed0, uint128 tokensOwed1 ); struct MintParams { address token0; address token1; 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. /// @dev If native token is used as input, this function should be accompanied by a `refundNativeToken` in multicall to avoid potential loss of native tokens /// @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 liquidity delta amount as a result of the increase /// @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 /// @dev If native token is used as input, this function should be accompanied by a `refundNativeToken` in multicall to avoid potential loss of native tokens /// @return liquidity The liquidity delta amount as a result of the increase /// @return amount0 The amount of token0 to achieve resulting liquidity /// @return amount1 The amount of token1 to achieve 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 Changes approval of token ID for farming. /// @param tokenId The ID of the token that is being approved / unapproved /// @param approve New status of approval /// @param farmingAddress The address of farming: used to prevent tx frontrun function approveForFarming(uint256 tokenId, bool approve, address farmingAddress) external payable; /// @notice Changes farming status of token to 'farmed' or 'not farmed' /// @dev can be called only by farmingCenter /// @param tokenId The ID of the token /// @param toActive The new status function switchFarmingStatus(uint256 tokenId, bool toActive) external; struct FeesVault { address feeVault; uint16 fee; } struct WithdrawalFeePoolParams { uint64 apr0; uint64 apr1; uint16 withdrawalFee; FeesVault[] feeVaults; } /// @notice Returns withdrawal fee params for pool /// @param pool Pool address /// @return params function getWithdrawalFeePoolParams(address pool) external view returns (WithdrawalFeePoolParams memory params); /// @notice Changes withdrawalFee for pool /// @dev can be called only by factory owner or NONFUNGIBLE_POSITION_MANAGER_ADMINISTRATOR_ROLE /// @param pool The address of the pool to which the settings have been applied /// @param newWithdrawalFee Percentage of lst token earnings that will be sent to the vault function setWithdrawalFee(address pool, uint16 newWithdrawalFee) external; /// @notice Changes tokens apr for pool /// @dev can be called only by factory owner or NONFUNGIBLE_POSITION_MANAGER_ADMINISTRATOR_ROLE /// @param pool The address of the pool to which the settings have been applied /// @param apr0 APR of LST token0 /// @param apr1 APR of LST token1 function setTokenAPR(address pool, uint64 apr0, uint64 apr1) external; /// @notice Changes fee vault for pool /// @dev can be called only by factory owner or NONFUNGIBLE_POSITION_MANAGER_ADMINISTRATOR_ROLE /// @param pool The address of the pool to which the settings have been applied /// @param fees array of fees values /// @param vaults array of vault addresses function setVaultsForPool(address pool, uint16[] memory fees, address[] memory vaults) external; /// @notice Returns vault address to which fees will be sent /// @return vault The actual vault address function defaultWithdrawalFeesVault() external view returns (address vault); /// @notice Changes vault address /// @dev can be called only by factory owner or NONFUNGIBLE_POSITION_MANAGER_ADMINISTRATOR_ROLE /// @param newVault The new address of vault function setVaultAddress(address newVault) external; /// @notice Returns withdrawalFee information associated with a given token ID /// @param tokenId The ID of the token that represents the position /// @return lastUpdateTimestamp Last increase/decrease liquidity timestamp /// @return withdrawalFeeLiquidity Liqudity of accumulated withdrawal fee function positionsWithdrawalFee( uint256 tokenId ) external view returns (uint32 lastUpdateTimestamp, uint128 withdrawalFeeLiquidity); /// @notice Changes address of farmingCenter /// @dev can be called only by factory owner or NONFUNGIBLE_POSITION_MANAGER_ADMINISTRATOR_ROLE /// @param newFarmingCenter The new address of farmingCenter function setFarmingCenter(address newFarmingCenter) external; /// @notice Returns whether `spender` is allowed to manage `tokenId` /// @dev Requirement: `tokenId` must exist function isApprovedOrOwner(address spender, uint256 tokenId) external view returns (bool); /// @notice Returns the address of currently connected farming, if any /// @return The address of the farming center contract, which handles farmings logic function farmingCenter() external view returns (address); /// @notice Returns the address of farming that is approved for this token, if any function farmingApprovals(uint256 tokenId) external view returns (address); /// @notice Returns the address of farming in which this token is farmed, if any function tokenFarmedIn(uint256 tokenId) external view returns (address); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title Immutable state /// @notice Functions that return immutable state of the router /// @dev Credit to Uniswap Labs under GPL-2.0-or-later license: /// https://github.com/Uniswap/v3-periphery interface IPeripheryImmutableState { /// @return Returns the address of the Algebra factory function factory() external view returns (address); /// @return Returns the address of the pool Deployer function poolDeployer() external view returns (address); /// @return Returns the address of WNativeToken function WNativeToken() external view returns (address); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.7.5; /// @title Periphery Payments /// @notice Functions to ease deposits and withdrawals of NativeToken /// @dev Credit to Uniswap Labs under GPL-2.0-or-later license: /// https://github.com/Uniswap/v3-periphery interface IPeripheryPayments { /// @notice Unwraps the contract's WNativeToken balance and sends it to recipient as NativeToken. /// @dev The amountMinimum parameter prevents malicious contracts from stealing WNativeToken from users. /// @param amountMinimum The minimum amount of WNativeToken to unwrap /// @param recipient The address receiving NativeToken function unwrapWNativeToken(uint256 amountMinimum, address recipient) external payable; /// @notice Refunds any NativeToken balance held by this contract to the `msg.sender` /// @dev Useful for bundling with mint or increase liquidity that uses ether, or exact output swaps /// that use ether for the input amount function refundNativeToken() external payable; /// @notice Transfers the full amount of a token held by this contract to recipient /// @dev The amountMinimum parameter prevents malicious contracts from stealing the token from users /// @param token The contract address of the token which will be transferred to `recipient` /// @param amountMinimum The minimum amount of token required for a transfer /// @param recipient The destination address of the token function sweepToken( address token, uint256 amountMinimum, address recipient ) external payable; }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.7.5; pragma abicoder v2; /// @title Creates and initializes Algebra Pools /// @notice Provides a method for creating and initializing a pool, if necessary, for bundling with other methods that /// require the pool to exist. /// @dev Credit to Uniswap Labs under GPL-2.0-or-later license: /// https://github.com/Uniswap/v3-periphery interface IPoolInitializer { /// @notice Creates a new pool if it does not exist, then initializes if not initialized /// @dev This method can be bundled with others via IMulticall for the first action (e.g. mint) performed against a pool /// @param token0 The contract address of token0 of the pool /// @param token1 The contract address of token1 of the pool /// @param sqrtPriceX96 The initial square root price of the pool as a Q64.96 value /// @return pool Returns the pool address based on the pair of tokens and fee, will return the newly created pool address if necessary function createAndInitializePoolIfNecessary( address token0, address token1, uint160 sqrtPriceX96 ) external payable returns (address pool); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title Contract tracking liquidity position /// @notice Using these methods farmingCenter receives information about changes in the positions interface IPositionFollower { /// @notice Report a change of liquidity in position /// @param tokenId The ID of the token for which liquidity is being added /// @param liquidityDelta The amount of added liquidity function applyLiquidityDelta(uint256 tokenId, int256 liquidityDelta) external; }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title Provides functions for deriving a pool address from the poolDeployer and tokens /// @dev Credit to Uniswap Labs under GPL-2.0-or-later license: /// https://github.com/Uniswap/v3-periphery library PoolAddress { bytes32 internal constant POOL_INIT_CODE_HASH = 0xf96d2474815c32e070cd63233f06af5413efc5dcb430aee4ff18cc29007c562d; /// @notice The identifying key of the pool struct PoolKey { address token0; address token1; } /// @notice Returns PoolKey: the ordered tokens /// @param tokenA The first token of a pool, unsorted /// @param tokenB The second token of a pool, unsorted /// @return Poolkey The pool details with ordered token0 and token1 assignments function getPoolKey(address tokenA, address tokenB) internal pure returns (PoolKey memory) { if (tokenA > tokenB) (tokenA, tokenB) = (tokenB, tokenA); return PoolKey({token0: tokenA, token1: tokenB}); } /// @notice Deterministically computes the pool address given the poolDeployer and PoolKey /// @param poolDeployer The Algebra poolDeployer contract address /// @param key The PoolKey /// @return pool The contract address of the Algebra pool function computeAddress(address poolDeployer, PoolKey memory key) internal pure returns (address pool) { require(key.token0 < key.token1, 'Invalid order of tokens'); pool = address( uint160( uint256( keccak256( abi.encodePacked( hex'ff', poolDeployer, keccak256(abi.encode(key.token0, key.token1)), POOL_INIT_CODE_HASH ) ) ) ) ); } }
// 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 // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol) pragma solidity ^0.8.0; import "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.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); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.7.6; pragma abicoder v2; import '@cryptoalgebra/integral-core/contracts/interfaces/IERC20Minimal.sol'; import '@cryptoalgebra/integral-core/contracts/interfaces/IAlgebraPool.sol'; /// @param rewardToken The token being distributed as a reward (token0) /// @param bonusRewardToken The bonus token being distributed as a reward (token1) /// @param pool The Algebra pool /// @param nonce The nonce of incentive struct IncentiveKey { IERC20Minimal rewardToken; IERC20Minimal bonusRewardToken; IAlgebraPool pool; uint256 nonce; }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.8.4; import '@cryptoalgebra/integral-periphery/contracts/interfaces/INonfungiblePositionManager.sol'; import '../base/IncentiveKey.sol'; /// @title Algebra Eternal Farming Interface /// @notice Allows farming nonfungible liquidity tokens in exchange for reward tokens without locking NFT for incentive time interface IAlgebraEternalFarming { /// @notice Details of the incentive to create struct IncentiveParams { uint128 reward; // The amount of reward tokens to be distributed uint128 bonusReward; // The amount of bonus reward tokens to be distributed uint128 rewardRate; // The rate of reward distribution per second uint128 bonusRewardRate; // The rate of bonus reward distribution per second uint24 minimalPositionWidth; // The minimal allowed width of position (tickUpper - tickLower) } error farmDoesNotExist(); error tokenAlreadyFarmed(); error incentiveNotExist(); error incentiveStopped(); error anotherFarmingIsActive(); error pluginNotConnected(); error minimalPositionWidthTooWide(); error zeroRewardAmount(); error positionIsTooNarrow(); error zeroLiquidity(); error invalidPool(); error claimToZeroAddress(); error invalidTokenAmount(); error emergencyActivated(); error reentrancyLock(); error poolReentrancyLock(); /// @notice Returns hash of 'INCENTIVE_MAKER_ROLE', used as role for incentive creation function INCENTIVE_MAKER_ROLE() external view returns (bytes32); /// @notice Returns hash of 'FARMINGS_ADMINISTRATOR_ROLE', used as role for permissioned actions in farming function FARMINGS_ADMINISTRATOR_ROLE() external view returns (bytes32); /// @notice The nonfungible position manager with which this farming contract is compatible function nonfungiblePositionManager() external view returns (INonfungiblePositionManager); /// @notice Represents a farming incentive /// @param incentiveId The ID of the incentive computed from its parameters function incentives( bytes32 incentiveId ) external view returns ( uint128 totalReward, uint128 bonusReward, address virtualPoolAddress, uint24 minimalPositionWidth, bool deactivated, address pluginAddress ); /// @notice Check if incentive is deactivated (manually or automatically) /// @dev Does not check if the incentive is indeed currently connected to the Algebra pool or not /// @param incentiveId The ID of the incentive computed from its parameters /// @return True if incentive is deactivated (manually or automatically) function isIncentiveDeactivated(bytes32 incentiveId) external view returns (bool); /// @notice Returns address of current farmingCenter function farmingCenter() external view returns (address); /// @notice Users can withdraw liquidity without any checks if active. function isEmergencyWithdrawActivated() external view returns (bool); /// @notice Detach incentive from the pool and deactivate it /// @param key The key of the incentive function deactivateIncentive(IncentiveKey memory key) external; /// @notice Add rewards for incentive /// @param key The key of the incentive /// @param rewardAmount The amount of token0 /// @param bonusRewardAmount The amount of token1 function addRewards(IncentiveKey memory key, uint128 rewardAmount, uint128 bonusRewardAmount) external; /// @notice Decrease rewards for incentive and withdraw /// @param key The key of the incentive /// @param rewardAmount The amount of token0 /// @param bonusRewardAmount The amount of token1 function decreaseRewardsAmount(IncentiveKey memory key, uint128 rewardAmount, uint128 bonusRewardAmount) external; /// @notice Changes `isEmergencyWithdrawActivated`. Users can withdraw liquidity without any checks if activated. /// User cannot enter to farmings if activated. /// _Must_ only be used in emergency situations. Farmings may be unusable after activation. /// @dev only farmings administrator /// @param newStatus The new status of `isEmergencyWithdrawActivated`. function setEmergencyWithdrawStatus(bool newStatus) external; /// @notice Returns amount of created incentives function numOfIncentives() external view returns (uint256); /// @notice Returns amounts of reward tokens owed to a given address according to the last time all farms were updated /// @param owner The owner for which the rewards owed are checked /// @param rewardToken The token for which to check rewards /// @return rewardsOwed The amount of the reward token claimable by the owner function rewards(address owner, IERC20Minimal rewardToken) external view returns (uint256 rewardsOwed); /// @notice Updates farming center address /// @param _farmingCenter The new farming center contract address function setFarmingCenterAddress(address _farmingCenter) external; /// @notice enter farming for Algebra LP token /// @param key The key of the incentive for which to enter farming /// @param tokenId The ID of the token to enter farming function enterFarming(IncentiveKey memory key, uint256 tokenId) external; /// @notice exitFarmings for Algebra LP token /// @param key The key of the incentive for which to exit farming /// @param tokenId The ID of the token to exit farming /// @param _owner Owner of the token function exitFarming(IncentiveKey memory key, uint256 tokenId, address _owner) external; /// @notice Transfers `amountRequested` of accrued `rewardToken` (if possible) rewards from the contract to the recipient `to` /// @param rewardToken The token being distributed as a reward /// @param to The address where claimed rewards will be sent to /// @param amountRequested The amount of reward tokens to claim. Claims entire reward amount if set to 0. /// @return rewardBalanceBefore The total amount of unclaimed reward *before* claim function claimReward(IERC20Minimal rewardToken, address to, uint256 amountRequested) external returns (uint256 rewardBalanceBefore); /// @notice Transfers `amountRequested` of accrued `rewardToken` (if possible) rewards from the contract to the recipient `to` /// @notice only for FarmingCenter /// @param rewardToken The token being distributed as a reward /// @param from The address of position owner /// @param to The address where claimed rewards will be sent to /// @param amountRequested The amount of reward tokens to claim. Claims entire reward amount if set to 0. /// @return rewardBalanceBefore The total amount of unclaimed reward *before* claim function claimRewardFrom( IERC20Minimal rewardToken, address from, address to, uint256 amountRequested ) external returns (uint256 rewardBalanceBefore); /// @notice Calculates the reward amount that will be received for the given farm /// @param key The key of the incentive /// @param tokenId The ID of the token /// @return reward The reward accrued to the NFT for the given incentive thus far /// @return bonusReward The bonus reward accrued to the NFT for the given incentive thus far function getRewardInfo(IncentiveKey memory key, uint256 tokenId) external returns (uint256 reward, uint256 bonusReward); /// @notice Returns information about a farmed liquidity NFT /// @param tokenId The ID of the farmed token /// @param incentiveId The ID of the incentive for which the token is farmed /// @return liquidity The amount of liquidity in the NFT as of the last time the rewards were computed, /// @return tickLower The lower tick of position, /// @return tickUpper The upper tick of position, /// @return innerRewardGrowth0 The last saved reward0 growth inside position, /// @return innerRewardGrowth1 The last saved reward1 growth inside position function farms( uint256 tokenId, bytes32 incentiveId ) external view returns (uint128 liquidity, int24 tickLower, int24 tickUpper, uint256 innerRewardGrowth0, uint256 innerRewardGrowth1); /// @notice Creates a new liquidity farming incentive program /// @param key Details of the incentive to create /// @param params Params of incentive /// @param plugin The address of corresponding plugin /// @return virtualPool The created virtual pool function createEternalFarming(IncentiveKey memory key, IncentiveParams memory params, address plugin) external returns (address virtualPool); /// @notice Change reward rates for incentive /// @param key The key of incentive /// @param rewardRate The new rate of main token (token0) distribution per sec /// @param bonusRewardRate The new rate of bonus token (token1) distribution per sec function setRates(IncentiveKey memory key, uint128 rewardRate, uint128 bonusRewardRate) external; /// @notice Collect rewards for tokenId /// @dev only FarmingCenter /// @param key The key of incentive /// @param tokenId The ID of the token to exit farming /// @param _owner Owner of the token /// @return reward The amount of main token (token0) collected /// @param bonusReward The amount of bonus token (token1) collected function collectRewards(IncentiveKey memory key, uint256 tokenId, address _owner) external returns (uint256 reward, uint256 bonusReward); /// @notice Event emitted when a liquidity mining incentive has been stopped from the outside /// @param incentiveId The stopped incentive event IncentiveDeactivated(bytes32 indexed incentiveId); /// @notice Event emitted when a Algebra LP token has been farmed /// @param tokenId The unique identifier of an Algebra LP token /// @param incentiveId The incentive in which the token is farming /// @param liquidity The amount of liquidity farmed event FarmEntered(uint256 indexed tokenId, bytes32 indexed incentiveId, uint128 liquidity); /// @notice Event emitted when a Algebra LP token exited from farming /// @param tokenId The unique identifier of an Algebra LP token /// @param incentiveId The incentive in which the token is farming /// @param rewardAddress The token being distributed as a reward /// @param bonusRewardToken The token being distributed as a bonus reward /// @param owner The address where claimed rewards were sent to /// @param reward The amount of reward tokens to be claimed /// @param bonusReward The amount of bonus reward tokens to be claimed event FarmEnded( uint256 indexed tokenId, bytes32 indexed incentiveId, address indexed rewardAddress, address bonusRewardToken, address owner, uint256 reward, uint256 bonusReward ); /// @notice Emitted when the farming center is changed /// @param farmingCenter The farming center after the address was changed event FarmingCenter(address indexed farmingCenter); /// @notice Event emitted when rewards were added /// @param rewardAmount The additional amount of main token /// @param bonusRewardAmount The additional amount of bonus token /// @param incentiveId The ID of the incentive for which rewards were added event RewardsAdded(uint256 rewardAmount, uint256 bonusRewardAmount, bytes32 incentiveId); /// @notice Event emitted when rewards were decreased /// @param rewardAmount The withdrawn amount of main token /// @param bonusRewardAmount The withdrawn amount of bonus token /// @param incentiveId The ID of the incentive for which rewards were decreased event RewardAmountsDecreased(uint256 rewardAmount, uint256 bonusRewardAmount, bytes32 incentiveId); /// @notice Event emitted when a reward token has been claimed /// @param to The address where claimed rewards were sent to /// @param reward The amount of reward tokens claimed /// @param rewardAddress The token reward address /// @param owner The address where claimed rewards were claimed from event RewardClaimed(address indexed to, uint256 reward, address indexed rewardAddress, address indexed owner); /// @notice Event emitted when reward rates were changed /// @param rewardRate The new rate of main token (token0) distribution per sec /// @param bonusRewardRate The new rate of bonus token (token1) distribution per sec /// @param incentiveId The ID of the incentive for which rates were changed event RewardsRatesChanged(uint128 rewardRate, uint128 bonusRewardRate, bytes32 incentiveId); /// @notice Event emitted when rewards were collected /// @param tokenId The ID of the token for which rewards were collected /// @param incentiveId The ID of the incentive for which rewards were collected /// @param rewardAmount Collected amount of reward /// @param bonusRewardAmount Collected amount of bonus reward event RewardsCollected(uint256 tokenId, bytes32 incentiveId, uint256 rewardAmount, uint256 bonusRewardAmount); /// @notice Event emitted when a liquidity mining incentive has been created /// @param rewardToken The token being distributed as a reward /// @param bonusRewardToken The token being distributed as a bonus reward /// @param pool The Algebra pool /// @param virtualPool The virtual pool address /// @param nonce The nonce of new farming /// @param reward The amount of reward tokens to be distributed /// @param bonusReward The amount of bonus reward tokens to be distributed /// @param minimalAllowedPositionWidth The minimal allowed position width (tickUpper - tickLower) event EternalFarmingCreated( IERC20Minimal indexed rewardToken, IERC20Minimal indexed bonusRewardToken, IAlgebraPool indexed pool, address virtualPool, uint256 nonce, uint256 reward, uint256 bonusReward, uint24 minimalAllowedPositionWidth ); /// @notice Emitted when status of `isEmergencyWithdrawActivated` changes /// @param newStatus New value of `isEmergencyWithdrawActivated`. Users can withdraw liquidity without any checks if active. event EmergencyWithdraw(bool newStatus); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.7.6; pragma abicoder v2; import '@cryptoalgebra/integral-core/contracts/interfaces/IERC20Minimal.sol'; import '@cryptoalgebra/integral-periphery/contracts/interfaces/IMulticall.sol'; import '@cryptoalgebra/integral-periphery/contracts/interfaces/INonfungiblePositionManager.sol'; import '@cryptoalgebra/integral-base-plugin/contracts/interfaces/plugins/IFarmingPlugin.sol'; import '../base/IncentiveKey.sol'; import '../interfaces/IAlgebraEternalFarming.sol'; /// @title Algebra main farming contract interface /// @dev Manages users deposits and performs entry, exit and other actions. interface IFarmingCenter is IMulticall { /// @notice Returns current virtual pool address for Algebra pool function virtualPoolAddresses(address poolAddress) external view returns (address virtualPoolAddresses); /// @notice The nonfungible position manager with which this farming contract is compatible function nonfungiblePositionManager() external view returns (INonfungiblePositionManager); /// @notice The eternal farming contract function eternalFarming() external view returns (IAlgebraEternalFarming); /// @notice The Algebra poolDeployer contract function algebraPoolDeployer() external view returns (address); /// @notice Returns information about a deposited NFT /// @param tokenId The ID of the deposit (and token) that is being transferred /// @return eternalIncentiveId The id of eternal incentive that is active for this NFT function deposits(uint256 tokenId) external view returns (bytes32 eternalIncentiveId); /// @notice Returns incentive key for specific incentiveId /// @param incentiveId The hash of incentive key function incentiveKeys( bytes32 incentiveId ) external view returns (IERC20Minimal rewardToken, IERC20Minimal bonusRewardToken, IAlgebraPool pool, uint256 nonce); /// @notice Used to connect incentive to compatible AlgebraPool plugin /// @dev only farming can do it /// Will revert if something is already connected to the plugin /// @param virtualPool The virtual pool to be connected, must not be zero address /// @param plugin The Algebra farming plugin function connectVirtualPoolToPlugin(address virtualPool, IFarmingPlugin plugin) external; /// @notice Used to disconnect incentive from compatible AlgebraPool plugin /// @dev only farming can do it. /// If the specified virtual pool is not connected to the plugin, nothing will happen /// @param virtualPool The virtual pool to be disconnected, must not be zero address /// @param plugin The Algebra farming plugin function disconnectVirtualPoolFromPlugin(address virtualPool, IFarmingPlugin plugin) external; /// @notice Enters in incentive (eternal farming) with NFT-position token /// @dev msg.sender must be the owner of NFT /// @param key The incentive key /// @param tokenId The id of position NFT function enterFarming(IncentiveKey memory key, uint256 tokenId) external; /// @notice Exits from incentive (eternal farming) with NFT-position token /// @dev msg.sender must be the owner of NFT /// @param key The incentive key /// @param tokenId The id of position NFT function exitFarming(IncentiveKey memory key, uint256 tokenId) external; /// @notice Used to collect reward from eternal farming. Then reward can be claimed. /// @param key The incentive key /// @param tokenId The id of position NFT /// @return reward The amount of collected reward /// @return bonusReward The amount of collected bonus reward function collectRewards(IncentiveKey memory key, uint256 tokenId) external returns (uint256 reward, uint256 bonusReward); /// @notice Used to claim and send rewards from farming(s) /// @dev can be used via static call to get current rewards for user /// @param rewardToken The token that is a reward /// @param to The address to be rewarded /// @param amountRequested Amount to claim in eternal farming /// @return rewardBalanceBefore The total amount of unclaimed reward *before* claim function claimReward(IERC20Minimal rewardToken, address to, uint256 amountRequested) external returns (uint256 rewardBalanceBefore); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.7.6; import '../base/IncentiveKey.sol'; library IncentiveId { /// @notice Calculate the key for a farming incentive /// @param key The components used to compute the incentive identifier /// @return incentiveId The identifier for the incentive function compute(IncentiveKey memory key) internal pure returns (bytes32 incentiveId) { return keccak256(abi.encode(key)); } }
{ "evmVersion": "paris", "optimizer": { "enabled": true, "runs": 99999999 }, "metadata": { "bytecodeHash": "none" }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
[{"inputs":[{"internalType":"contract IAlgebraEternalFarming","name":"_eternalFarming","type":"address"},{"internalType":"contract INonfungiblePositionManager","name":"_nonfungiblePositionManager","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"algebraPoolDeployer","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"int256","name":"","type":"int256"}],"name":"applyLiquidityDelta","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20Minimal","name":"rewardToken","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amountRequested","type":"uint256"}],"name":"claimReward","outputs":[{"internalType":"uint256","name":"rewardBalanceBefore","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"contract IERC20Minimal","name":"rewardToken","type":"address"},{"internalType":"contract IERC20Minimal","name":"bonusRewardToken","type":"address"},{"internalType":"contract IAlgebraPool","name":"pool","type":"address"},{"internalType":"uint256","name":"nonce","type":"uint256"}],"internalType":"struct IncentiveKey","name":"key","type":"tuple"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"collectRewards","outputs":[{"internalType":"uint256","name":"reward","type":"uint256"},{"internalType":"uint256","name":"bonusReward","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newVirtualPool","type":"address"},{"internalType":"contract IFarmingPlugin","name":"plugin","type":"address"}],"name":"connectVirtualPoolToPlugin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"deposits","outputs":[{"internalType":"bytes32","name":"incentiveId","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"virtualPool","type":"address"},{"internalType":"contract IFarmingPlugin","name":"plugin","type":"address"}],"name":"disconnectVirtualPoolFromPlugin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"contract IERC20Minimal","name":"rewardToken","type":"address"},{"internalType":"contract IERC20Minimal","name":"bonusRewardToken","type":"address"},{"internalType":"contract IAlgebraPool","name":"pool","type":"address"},{"internalType":"uint256","name":"nonce","type":"uint256"}],"internalType":"struct IncentiveKey","name":"key","type":"tuple"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"enterFarming","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"eternalFarming","outputs":[{"internalType":"contract IAlgebraEternalFarming","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"contract IERC20Minimal","name":"rewardToken","type":"address"},{"internalType":"contract IERC20Minimal","name":"bonusRewardToken","type":"address"},{"internalType":"contract IAlgebraPool","name":"pool","type":"address"},{"internalType":"uint256","name":"nonce","type":"uint256"}],"internalType":"struct IncentiveKey","name":"key","type":"tuple"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"exitFarming","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"incentiveId","type":"bytes32"}],"name":"incentiveKeys","outputs":[{"internalType":"contract IERC20Minimal","name":"rewardToken","type":"address"},{"internalType":"contract IERC20Minimal","name":"bonusRewardToken","type":"address"},{"internalType":"contract IAlgebraPool","name":"pool","type":"address"},{"internalType":"uint256","name":"nonce","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes[]","name":"data","type":"bytes[]"}],"name":"multicall","outputs":[{"internalType":"bytes[]","name":"results","type":"bytes[]"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"nonfungiblePositionManager","outputs":[{"internalType":"contract INonfungiblePositionManager","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"poolAddress","type":"address"}],"name":"virtualPoolAddresses","outputs":[{"internalType":"address","name":"virtualPoolAddress","type":"address"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
60e06040523480156200001157600080fd5b506040516200278e3803806200278e8339810160408190526200003491620000d9565b6001600160a01b03808316608052811660a08190526040805163188c824d60e11b81529051633119049a916004808201926020929091908290030181865afa15801562000085573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620000ab919062000118565b6001600160a01b031660c052506200013f9050565b6001600160a01b0381168114620000d657600080fd5b50565b60008060408385031215620000ed57600080fd5b8251620000fa81620000c0565b60208401519092506200010d81620000c0565b809150509250929050565b6000602082840312156200012b57600080fd5b81516200013881620000c0565b9392505050565b60805160a05160c05161258c6200020260003960008181610116015261185c01526000818161036901528181610675015281816107670152818161084201528181610ab001528181610c1e01528181610d2f0152818161115901528181611227015281816112f101528181611bf20152611cae0152600081816103bd015281816105c701528181610b5c01528181610cf101528181611468015281816114d50152818161157f01528181611657015281816116e20152611afb015261258c6000f3fe6080604052600436106100dd5760003560e01c80636af00aee1161007f578063b02c43d011610059578063b02c43d01461032a578063b44a272214610357578063d68516bc1461038b578063de2356d1146103ab57600080fd5b80636af00aee146102335780638c27f1f614610268578063ac9650d81461030a57600080fd5b80632f2d783d116100bb5780632f2d783d1461018257806332dc5a25146101b05780634473eca6146101f35780635739f0b91461021357600080fd5b806306e65c90146100e257806314258256146101045780632bd34c4814610162575b600080fd5b3480156100ee57600080fd5b506101026100fd366004611efc565b6103df565b005b34801561011057600080fd5b506101387f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b34801561016e57600080fd5b5061010261017d366004611f40565b6103ec565b34801561018e57600080fd5b506101a261019d366004611f89565b61056a565b604051908152602001610159565b3480156101bc57600080fd5b506101386101cb366004611fca565b60006020819052908152604090205473ffffffffffffffffffffffffffffffffffffffff1681565b3480156101ff57600080fd5b5061010261020e36600461201d565b61063e565b34801561021f57600080fd5b5061010261022e36600461201d565b61080b565b34801561023f57600080fd5b5061025361024e36600461201d565b610bcd565b60408051928352602083019190915201610159565b34801561027457600080fd5b506102c86102833660046120d1565b6002602081905260009182526040909120805460018201549282015460039092015473ffffffffffffffffffffffffffffffffffffffff918216938216929091169084565b604051610159949392919073ffffffffffffffffffffffffffffffffffffffff9485168152928416602084015292166040820152606081019190915260800190565b61031d6103183660046120ea565b610e35565b604051610159919061215f565b34801561033657600080fd5b506101a26103453660046120d1565b60016020526000908152604090205481565b34801561036357600080fd5b506101387f000000000000000000000000000000000000000000000000000000000000000081565b34801561039757600080fd5b506101026103a6366004611f40565b610f56565b3480156103b757600080fd5b506101387f000000000000000000000000000000000000000000000000000000000000000081565b6103e882611141565b5050565b60006103f883836116c8565b90508273ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16631d4632ac6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561045c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104809190612238565b73ffffffffffffffffffffffffffffffffffffffff160361051c576040517f7c1fe0c80000000000000000000000000000000000000000000000000000000081526000600482015273ffffffffffffffffffffffffffffffffffffffff831690637c1fe0c890602401600060405180830381600087803b15801561050357600080fd5b505af1158015610517573d6000803e3d6000fd5b505050505b73ffffffffffffffffffffffffffffffffffffffff16600090815260208190526040902080547fffffffffffffffffffffffff00000000000000000000000000000000000000001690555050565b6040517f0a53075400000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff84811660048301523360248301528381166044830152606482018390526000917f000000000000000000000000000000000000000000000000000000000000000090911690630a530754906084016020604051808303816000875af1158015610612573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106369190612255565b949350505050565b6040517f430c20810000000000000000000000000000000000000000000000000000000081523360048201526024810182905281907f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff169063430c208190604401602060405180830381865afa1580156106d1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106f5919061226e565b610760576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f4e6f7420617070726f76656420666f7220746f6b656e0000000000000000000060448201526064015b60405180910390fd5b61080683837f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16636352211e866040518263ffffffff1660e01b81526004016107c091815260200190565b602060405180830381865afa1580156107dd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108019190612238565b611a36565b505050565b6040517f430c20810000000000000000000000000000000000000000000000000000000081523360048201526024810182905281907f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff169063430c208190604401602060405180830381865afa15801561089e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108c2919061226e565b610928576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f4e6f7420617070726f76656420666f7220746f6b656e000000000000000000006044820152606401610757565b600061093384611b6b565b6000818152600260208190526040909120015490915073ffffffffffffffffffffffffffffffffffffffff166109ef57600081815260026020818152604092839020875181547fffffffffffffffffffffffff000000000000000000000000000000000000000090811673ffffffffffffffffffffffffffffffffffffffff9283161783559289015160018301805485169183169190911790559388015192810180549092169290931691909117905560608501516003909101555b60008381526001602052604090205415610a65576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f546f6b656e20616c7265616479206661726d65640000000000000000000000006044820152606401610757565b60008381526001602081905260409182902083905590517f702275150000000000000000000000000000000000000000000000000000000081526004810185905260248101919091527f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1690637022751590604401600060405180830381600087803b158015610b0957600080fd5b505af1158015610b1d573d6000803e3d6000fd5b50506040517f5739f0b900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000169250635739f0b99150610b959087908790600401612290565b600060405180830381600087803b158015610baf57600080fd5b505af1158015610bc3573d6000803e3d6000fd5b5050505050505050565b6040517f430c2081000000000000000000000000000000000000000000000000000000008152336004820152602481018290526000908190839073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000169063430c208190604401602060405180830381865afa158015610c65573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c89919061226e565b610cef576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f4e6f7420617070726f76656420666f7220746f6b656e000000000000000000006044820152606401610757565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663046ec16686867f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16636352211e896040518263ffffffff1660e01b8152600401610d8891815260200190565b602060405180830381865afa158015610da5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dc99190612238565b6040518463ffffffff1660e01b8152600401610de7939291906122e8565b60408051808303816000875af1158015610e05573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e29919061235d565b90969095509350505050565b60608167ffffffffffffffff811115610e5057610e50611fee565b604051908082528060200260200182016040528015610e8357816020015b6060815260200190600190039081610e6e5790505b50905060005b82811015610f4f5760008030868685818110610ea757610ea7612381565b9050602002810190610eb991906123b0565b604051610ec792919061241c565b600060405180830381855af49150503d8060008114610f02576040519150601f19603f3d011682016040523d82523d6000602084013e610f07565b606091505b509150915081610f27576000815111610f1f57600080fd5b805181602001fd5b80848481518110610f3a57610f3a612381565b60209081029190910101525050600101610e89565b5092915050565b6000610f6283836116c8565b9050600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16631d4632ac6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610fc7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610feb9190612238565b73ffffffffffffffffffffffffffffffffffffffff1614611068576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f416e6f7468657220696e63656e7469766520697320636f6e6e656374656400006044820152606401610757565b6040517f7c1fe0c800000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8481166004830152831690637c1fe0c890602401600060405180830381600087803b1580156110d157600080fd5b505af11580156110e5573d6000803e3d6000fd5b5050505073ffffffffffffffffffffffffffffffffffffffff908116600090815260208190526040902080547fffffffffffffffffffffffff000000000000000000000000000000000000000016939091169290921790915550565b3373ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016146111e0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f4f6e6c79206e6f6e66756e6769626c65506f734d616e616765720000000000006044820152606401610757565b60008181526001602052604090205480156103e8576040517f6352211e000000000000000000000000000000000000000000000000000000008152600481018390526000907f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1690636352211e90602401602060405180830381865afa158015611283573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112a79190612238565b6040517f99fbab880000000000000000000000000000000000000000000000000000000081526004810185905290915060009073ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016906399fbab889060240161016060405180830381865afa158015611339573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061135d919061245e565b50505060008b8152600260208181526040928390208351608081018552815473ffffffffffffffffffffffffffffffffffffffff908116825260018301548116938201939093529281015490911692820192909252600390910154606082015291985090965050506fffffffffffffffffffffffffffffffff8616159350839250611416915050575060408082015173ffffffffffffffffffffffffffffffffffffffff90811660009081526020819052919091205416155b1561142b57611426818685611a36565b6116c1565b6040517f36808b1900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016906336808b19906114a1908490899088906004016122e8565b600060405180830381600087803b1580156114bb57600080fd5b505af11580156114cf573d6000803e3d6000fd5b505050507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663b5bae00a61151883611b6b565b6040518263ffffffff1660e01b815260040161153691815260200190565b602060405180830381865afa158015611553573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611577919061226e565b8061160c57507f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663f22563196040518163ffffffff1660e01b8152600401602060405180830381865afa1580156115e8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061160c919061226e565b1561161a5761142685611b9b565b6040517f5739f0b900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001690635739f0b99061168e9084908990600401612290565b600060405180830381600087803b1580156116a857600080fd5b505af11580156116bc573d6000803e3d6000fd5b505050505b5050505050565b60003373ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001614611769576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f4f6e6c79206661726d696e672063616e2063616c6c20746869730000000000006044820152606401610757565b73ffffffffffffffffffffffffffffffffffffffff83166117e6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f5a65726f2061646472657373206173207669727475616c20706f6f6c000000006044820152606401610757565b8173ffffffffffffffffffffffffffffffffffffffff166316f0115b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611831573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118559190612238565b905061199c7f000000000000000000000000000000000000000000000000000000000000000060405180604001604052808473ffffffffffffffffffffffffffffffffffffffff16630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa1580156118d1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118f59190612238565b73ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa15801561195b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061197f9190612238565b73ffffffffffffffffffffffffffffffffffffffff169052611d1e565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614611a30576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f496e76616c696420706f6f6c00000000000000000000000000000000000000006044820152606401610757565b92915050565b611a3f83611b6b565b60008381526001602052604090205414611ab5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f496e76616c696420696e63656e746976654964000000000000000000000000006044820152606401610757565b611abe82611b9b565b6040517f36808b1900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f000000000000000000000000000000000000000000000000000000000000000016906336808b1990611b34908690869086906004016122e8565b600060405180830381600087803b158015611b4e57600080fd5b505af1158015611b62573d6000803e3d6000fd5b50505050505050565b600081604051602001611b7e9190612534565b604051602081830303815290604052805190602001209050919050565b60008181526001602052604080822091909155517fe7ce18a300000000000000000000000000000000000000000000000000000000815260048101829052309073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000000000000000000000000000000000000000000000169063e7ce18a390602401602060405180830381865afa158015611c39573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c5d9190612238565b73ffffffffffffffffffffffffffffffffffffffff1603611d1b576040517f7022751500000000000000000000000000000000000000000000000000000000815260048101829052600060248201527f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1690637022751590604401600060405180830381600087803b158015611d0757600080fd5b505af11580156116c1573d6000803e3d6000fd5b50565b6000816020015173ffffffffffffffffffffffffffffffffffffffff16826000015173ffffffffffffffffffffffffffffffffffffffff1610611dbd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f496e76616c6964206f72646572206f6620746f6b656e730000000000000000006044820152606401610757565b8282600001518360200151604051602001611dfb92919073ffffffffffffffffffffffffffffffffffffffff92831681529116602082015260400190565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152908290528051602091820120611ebf939290917ff96d2474815c32e070cd63233f06af5413efc5dcb430aee4ff18cc29007c562d91017fff00000000000000000000000000000000000000000000000000000000000000815260609390931b7fffffffffffffffffffffffffffffffffffffffff0000000000000000000000001660018401526015830191909152603582015260550190565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815291905280516020909101209392505050565b60008060408385031215611f0f57600080fd5b50508035926020909101359150565b73ffffffffffffffffffffffffffffffffffffffff81168114611d1b57600080fd5b60008060408385031215611f5357600080fd5b8235611f5e81611f1e565b91506020830135611f6e81611f1e565b809150509250929050565b8035611f8481611f1e565b919050565b600080600060608486031215611f9e57600080fd5b8335611fa981611f1e565b92506020840135611fb981611f1e565b929592945050506040919091013590565b600060208284031215611fdc57600080fd5b8135611fe781611f1e565b9392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60008082840360a081121561203157600080fd5b608081121561203f57600080fd5b506040516080810181811067ffffffffffffffff8211171561208a577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405261209684611f79565b81526120a460208501611f79565b60208201526120b560408501611f79565b6040820152606084810135908201529460809093013593505050565b6000602082840312156120e357600080fd5b5035919050565b600080602083850312156120fd57600080fd5b823567ffffffffffffffff8082111561211557600080fd5b818501915085601f83011261212957600080fd5b81358181111561213857600080fd5b8660208260051b850101111561214d57600080fd5b60209290920196919550909350505050565b6000602080830181845280855180835260408601915060408160051b87010192508387016000805b8381101561221f577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc089870301855282518051808852835b818110156121da578281018a01518982018b015289016121bf565b508781018901849052601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016909601870195509386019391860191600101612187565b509398975050505050505050565b8051611f8481611f1e565b60006020828403121561224a57600080fd5b8151611fe781611f1e565b60006020828403121561226757600080fd5b5051919050565b60006020828403121561228057600080fd5b81518015158114611fe757600080fd5b60a081016122db828573ffffffffffffffffffffffffffffffffffffffff80825116835280602083015116602084015280604083015116604084015250606081015160608301525050565b8260808301529392505050565b60c08101612333828673ffffffffffffffffffffffffffffffffffffffff80825116835280602083015116602084015280604083015116604084015250606081015160608301525050565b83608083015273ffffffffffffffffffffffffffffffffffffffff831660a0830152949350505050565b6000806040838503121561237057600080fd5b505080516020909101519092909150565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18436030181126123e557600080fd5b83018035915067ffffffffffffffff82111561240057600080fd5b60200191503681900382131561241557600080fd5b9250929050565b8183823760009101908152919050565b8051600281900b8114611f8457600080fd5b80516fffffffffffffffffffffffffffffffff81168114611f8457600080fd5b60008060008060008060008060008060006101608c8e03121561248057600080fd5b8b516affffffffffffffffffffff8116811461249b57600080fd5b60208d0151909b506124ac81611f1e565b60408d0151909a506124bd81611f1e565b98506124cb60608d0161222d565b97506124d960808d0161242c565b96506124e760a08d0161242c565b95506124f560c08d0161243e565b945060e08c015193506101008c015192506125136101208d0161243e565b91506125226101408d0161243e565b90509295989b509295989b9093969950565b60808101611a30828473ffffffffffffffffffffffffffffffffffffffff8082511683528060208301511660208401528060408301511660408401525060608101516060830152505056fea164736f6c6343000814000a0000000000000000000000007064c7bb85979f008212877c4ce41285ddf5374c0000000000000000000000001c4cbb62e18cf9c137c5d85096b5bc7819082691
Deployed Bytecode
0x6080604052600436106100dd5760003560e01c80636af00aee1161007f578063b02c43d011610059578063b02c43d01461032a578063b44a272214610357578063d68516bc1461038b578063de2356d1146103ab57600080fd5b80636af00aee146102335780638c27f1f614610268578063ac9650d81461030a57600080fd5b80632f2d783d116100bb5780632f2d783d1461018257806332dc5a25146101b05780634473eca6146101f35780635739f0b91461021357600080fd5b806306e65c90146100e257806314258256146101045780632bd34c4814610162575b600080fd5b3480156100ee57600080fd5b506101026100fd366004611efc565b6103df565b005b34801561011057600080fd5b506101387f000000000000000000000000f03875b5ec5eac83cab83a6c2ab17844304aa7a081565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b34801561016e57600080fd5b5061010261017d366004611f40565b6103ec565b34801561018e57600080fd5b506101a261019d366004611f89565b61056a565b604051908152602001610159565b3480156101bc57600080fd5b506101386101cb366004611fca565b60006020819052908152604090205473ffffffffffffffffffffffffffffffffffffffff1681565b3480156101ff57600080fd5b5061010261020e36600461201d565b61063e565b34801561021f57600080fd5b5061010261022e36600461201d565b61080b565b34801561023f57600080fd5b5061025361024e36600461201d565b610bcd565b60408051928352602083019190915201610159565b34801561027457600080fd5b506102c86102833660046120d1565b6002602081905260009182526040909120805460018201549282015460039092015473ffffffffffffffffffffffffffffffffffffffff918216938216929091169084565b604051610159949392919073ffffffffffffffffffffffffffffffffffffffff9485168152928416602084015292166040820152606081019190915260800190565b61031d6103183660046120ea565b610e35565b604051610159919061215f565b34801561033657600080fd5b506101a26103453660046120d1565b60016020526000908152604090205481565b34801561036357600080fd5b506101387f0000000000000000000000001c4cbb62e18cf9c137c5d85096b5bc781908269181565b34801561039757600080fd5b506101026103a6366004611f40565b610f56565b3480156103b757600080fd5b506101387f0000000000000000000000007064c7bb85979f008212877c4ce41285ddf5374c81565b6103e882611141565b5050565b60006103f883836116c8565b90508273ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16631d4632ac6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561045c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104809190612238565b73ffffffffffffffffffffffffffffffffffffffff160361051c576040517f7c1fe0c80000000000000000000000000000000000000000000000000000000081526000600482015273ffffffffffffffffffffffffffffffffffffffff831690637c1fe0c890602401600060405180830381600087803b15801561050357600080fd5b505af1158015610517573d6000803e3d6000fd5b505050505b73ffffffffffffffffffffffffffffffffffffffff16600090815260208190526040902080547fffffffffffffffffffffffff00000000000000000000000000000000000000001690555050565b6040517f0a53075400000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff84811660048301523360248301528381166044830152606482018390526000917f0000000000000000000000007064c7bb85979f008212877c4ce41285ddf5374c90911690630a530754906084016020604051808303816000875af1158015610612573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106369190612255565b949350505050565b6040517f430c20810000000000000000000000000000000000000000000000000000000081523360048201526024810182905281907f0000000000000000000000001c4cbb62e18cf9c137c5d85096b5bc781908269173ffffffffffffffffffffffffffffffffffffffff169063430c208190604401602060405180830381865afa1580156106d1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106f5919061226e565b610760576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f4e6f7420617070726f76656420666f7220746f6b656e0000000000000000000060448201526064015b60405180910390fd5b61080683837f0000000000000000000000001c4cbb62e18cf9c137c5d85096b5bc781908269173ffffffffffffffffffffffffffffffffffffffff16636352211e866040518263ffffffff1660e01b81526004016107c091815260200190565b602060405180830381865afa1580156107dd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108019190612238565b611a36565b505050565b6040517f430c20810000000000000000000000000000000000000000000000000000000081523360048201526024810182905281907f0000000000000000000000001c4cbb62e18cf9c137c5d85096b5bc781908269173ffffffffffffffffffffffffffffffffffffffff169063430c208190604401602060405180830381865afa15801561089e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108c2919061226e565b610928576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f4e6f7420617070726f76656420666f7220746f6b656e000000000000000000006044820152606401610757565b600061093384611b6b565b6000818152600260208190526040909120015490915073ffffffffffffffffffffffffffffffffffffffff166109ef57600081815260026020818152604092839020875181547fffffffffffffffffffffffff000000000000000000000000000000000000000090811673ffffffffffffffffffffffffffffffffffffffff9283161783559289015160018301805485169183169190911790559388015192810180549092169290931691909117905560608501516003909101555b60008381526001602052604090205415610a65576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f546f6b656e20616c7265616479206661726d65640000000000000000000000006044820152606401610757565b60008381526001602081905260409182902083905590517f702275150000000000000000000000000000000000000000000000000000000081526004810185905260248101919091527f0000000000000000000000001c4cbb62e18cf9c137c5d85096b5bc781908269173ffffffffffffffffffffffffffffffffffffffff1690637022751590604401600060405180830381600087803b158015610b0957600080fd5b505af1158015610b1d573d6000803e3d6000fd5b50506040517f5739f0b900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000007064c7bb85979f008212877c4ce41285ddf5374c169250635739f0b99150610b959087908790600401612290565b600060405180830381600087803b158015610baf57600080fd5b505af1158015610bc3573d6000803e3d6000fd5b5050505050505050565b6040517f430c2081000000000000000000000000000000000000000000000000000000008152336004820152602481018290526000908190839073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000001c4cbb62e18cf9c137c5d85096b5bc7819082691169063430c208190604401602060405180830381865afa158015610c65573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c89919061226e565b610cef576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f4e6f7420617070726f76656420666f7220746f6b656e000000000000000000006044820152606401610757565b7f0000000000000000000000007064c7bb85979f008212877c4ce41285ddf5374c73ffffffffffffffffffffffffffffffffffffffff1663046ec16686867f0000000000000000000000001c4cbb62e18cf9c137c5d85096b5bc781908269173ffffffffffffffffffffffffffffffffffffffff16636352211e896040518263ffffffff1660e01b8152600401610d8891815260200190565b602060405180830381865afa158015610da5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dc99190612238565b6040518463ffffffff1660e01b8152600401610de7939291906122e8565b60408051808303816000875af1158015610e05573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e29919061235d565b90969095509350505050565b60608167ffffffffffffffff811115610e5057610e50611fee565b604051908082528060200260200182016040528015610e8357816020015b6060815260200190600190039081610e6e5790505b50905060005b82811015610f4f5760008030868685818110610ea757610ea7612381565b9050602002810190610eb991906123b0565b604051610ec792919061241c565b600060405180830381855af49150503d8060008114610f02576040519150601f19603f3d011682016040523d82523d6000602084013e610f07565b606091505b509150915081610f27576000815111610f1f57600080fd5b805181602001fd5b80848481518110610f3a57610f3a612381565b60209081029190910101525050600101610e89565b5092915050565b6000610f6283836116c8565b9050600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16631d4632ac6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610fc7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610feb9190612238565b73ffffffffffffffffffffffffffffffffffffffff1614611068576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601e60248201527f416e6f7468657220696e63656e7469766520697320636f6e6e656374656400006044820152606401610757565b6040517f7c1fe0c800000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8481166004830152831690637c1fe0c890602401600060405180830381600087803b1580156110d157600080fd5b505af11580156110e5573d6000803e3d6000fd5b5050505073ffffffffffffffffffffffffffffffffffffffff908116600090815260208190526040902080547fffffffffffffffffffffffff000000000000000000000000000000000000000016939091169290921790915550565b3373ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000001c4cbb62e18cf9c137c5d85096b5bc781908269116146111e0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f4f6e6c79206e6f6e66756e6769626c65506f734d616e616765720000000000006044820152606401610757565b60008181526001602052604090205480156103e8576040517f6352211e000000000000000000000000000000000000000000000000000000008152600481018390526000907f0000000000000000000000001c4cbb62e18cf9c137c5d85096b5bc781908269173ffffffffffffffffffffffffffffffffffffffff1690636352211e90602401602060405180830381865afa158015611283573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112a79190612238565b6040517f99fbab880000000000000000000000000000000000000000000000000000000081526004810185905290915060009073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000001c4cbb62e18cf9c137c5d85096b5bc781908269116906399fbab889060240161016060405180830381865afa158015611339573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061135d919061245e565b50505060008b8152600260208181526040928390208351608081018552815473ffffffffffffffffffffffffffffffffffffffff908116825260018301548116938201939093529281015490911692820192909252600390910154606082015291985090965050506fffffffffffffffffffffffffffffffff8616159350839250611416915050575060408082015173ffffffffffffffffffffffffffffffffffffffff90811660009081526020819052919091205416155b1561142b57611426818685611a36565b6116c1565b6040517f36808b1900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000007064c7bb85979f008212877c4ce41285ddf5374c16906336808b19906114a1908490899088906004016122e8565b600060405180830381600087803b1580156114bb57600080fd5b505af11580156114cf573d6000803e3d6000fd5b505050507f0000000000000000000000007064c7bb85979f008212877c4ce41285ddf5374c73ffffffffffffffffffffffffffffffffffffffff1663b5bae00a61151883611b6b565b6040518263ffffffff1660e01b815260040161153691815260200190565b602060405180830381865afa158015611553573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611577919061226e565b8061160c57507f0000000000000000000000007064c7bb85979f008212877c4ce41285ddf5374c73ffffffffffffffffffffffffffffffffffffffff1663f22563196040518163ffffffff1660e01b8152600401602060405180830381865afa1580156115e8573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061160c919061226e565b1561161a5761142685611b9b565b6040517f5739f0b900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000007064c7bb85979f008212877c4ce41285ddf5374c1690635739f0b99061168e9084908990600401612290565b600060405180830381600087803b1580156116a857600080fd5b505af11580156116bc573d6000803e3d6000fd5b505050505b5050505050565b60003373ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000007064c7bb85979f008212877c4ce41285ddf5374c1614611769576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f4f6e6c79206661726d696e672063616e2063616c6c20746869730000000000006044820152606401610757565b73ffffffffffffffffffffffffffffffffffffffff83166117e6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601c60248201527f5a65726f2061646472657373206173207669727475616c20706f6f6c000000006044820152606401610757565b8173ffffffffffffffffffffffffffffffffffffffff166316f0115b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611831573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118559190612238565b905061199c7f000000000000000000000000f03875b5ec5eac83cab83a6c2ab17844304aa7a060405180604001604052808473ffffffffffffffffffffffffffffffffffffffff16630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa1580156118d1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118f59190612238565b73ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa15801561195b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061197f9190612238565b73ffffffffffffffffffffffffffffffffffffffff169052611d1e565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614611a30576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f496e76616c696420706f6f6c00000000000000000000000000000000000000006044820152606401610757565b92915050565b611a3f83611b6b565b60008381526001602052604090205414611ab5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f496e76616c696420696e63656e746976654964000000000000000000000000006044820152606401610757565b611abe82611b9b565b6040517f36808b1900000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000007064c7bb85979f008212877c4ce41285ddf5374c16906336808b1990611b34908690869086906004016122e8565b600060405180830381600087803b158015611b4e57600080fd5b505af1158015611b62573d6000803e3d6000fd5b50505050505050565b600081604051602001611b7e9190612534565b604051602081830303815290604052805190602001209050919050565b60008181526001602052604080822091909155517fe7ce18a300000000000000000000000000000000000000000000000000000000815260048101829052309073ffffffffffffffffffffffffffffffffffffffff7f0000000000000000000000001c4cbb62e18cf9c137c5d85096b5bc7819082691169063e7ce18a390602401602060405180830381865afa158015611c39573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c5d9190612238565b73ffffffffffffffffffffffffffffffffffffffff1603611d1b576040517f7022751500000000000000000000000000000000000000000000000000000000815260048101829052600060248201527f0000000000000000000000001c4cbb62e18cf9c137c5d85096b5bc781908269173ffffffffffffffffffffffffffffffffffffffff1690637022751590604401600060405180830381600087803b158015611d0757600080fd5b505af11580156116c1573d6000803e3d6000fd5b50565b6000816020015173ffffffffffffffffffffffffffffffffffffffff16826000015173ffffffffffffffffffffffffffffffffffffffff1610611dbd576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f496e76616c6964206f72646572206f6620746f6b656e730000000000000000006044820152606401610757565b8282600001518360200151604051602001611dfb92919073ffffffffffffffffffffffffffffffffffffffff92831681529116602082015260400190565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152908290528051602091820120611ebf939290917ff96d2474815c32e070cd63233f06af5413efc5dcb430aee4ff18cc29007c562d91017fff00000000000000000000000000000000000000000000000000000000000000815260609390931b7fffffffffffffffffffffffffffffffffffffffff0000000000000000000000001660018401526015830191909152603582015260550190565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815291905280516020909101209392505050565b60008060408385031215611f0f57600080fd5b50508035926020909101359150565b73ffffffffffffffffffffffffffffffffffffffff81168114611d1b57600080fd5b60008060408385031215611f5357600080fd5b8235611f5e81611f1e565b91506020830135611f6e81611f1e565b809150509250929050565b8035611f8481611f1e565b919050565b600080600060608486031215611f9e57600080fd5b8335611fa981611f1e565b92506020840135611fb981611f1e565b929592945050506040919091013590565b600060208284031215611fdc57600080fd5b8135611fe781611f1e565b9392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60008082840360a081121561203157600080fd5b608081121561203f57600080fd5b506040516080810181811067ffffffffffffffff8211171561208a577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405261209684611f79565b81526120a460208501611f79565b60208201526120b560408501611f79565b6040820152606084810135908201529460809093013593505050565b6000602082840312156120e357600080fd5b5035919050565b600080602083850312156120fd57600080fd5b823567ffffffffffffffff8082111561211557600080fd5b818501915085601f83011261212957600080fd5b81358181111561213857600080fd5b8660208260051b850101111561214d57600080fd5b60209290920196919550909350505050565b6000602080830181845280855180835260408601915060408160051b87010192508387016000805b8381101561221f577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc089870301855282518051808852835b818110156121da578281018a01518982018b015289016121bf565b508781018901849052601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016909601870195509386019391860191600101612187565b509398975050505050505050565b8051611f8481611f1e565b60006020828403121561224a57600080fd5b8151611fe781611f1e565b60006020828403121561226757600080fd5b5051919050565b60006020828403121561228057600080fd5b81518015158114611fe757600080fd5b60a081016122db828573ffffffffffffffffffffffffffffffffffffffff80825116835280602083015116602084015280604083015116604084015250606081015160608301525050565b8260808301529392505050565b60c08101612333828673ffffffffffffffffffffffffffffffffffffffff80825116835280602083015116602084015280604083015116604084015250606081015160608301525050565b83608083015273ffffffffffffffffffffffffffffffffffffffff831660a0830152949350505050565b6000806040838503121561237057600080fd5b505080516020909101519092909150565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18436030181126123e557600080fd5b83018035915067ffffffffffffffff82111561240057600080fd5b60200191503681900382131561241557600080fd5b9250929050565b8183823760009101908152919050565b8051600281900b8114611f8457600080fd5b80516fffffffffffffffffffffffffffffffff81168114611f8457600080fd5b60008060008060008060008060008060006101608c8e03121561248057600080fd5b8b516affffffffffffffffffffff8116811461249b57600080fd5b60208d0151909b506124ac81611f1e565b60408d0151909a506124bd81611f1e565b98506124cb60608d0161222d565b97506124d960808d0161242c565b96506124e760a08d0161242c565b95506124f560c08d0161243e565b945060e08c015193506101008c015192506125136101208d0161243e565b91506125226101408d0161243e565b90509295989b509295989b9093969950565b60808101611a30828473ffffffffffffffffffffffffffffffffffffffff8082511683528060208301511660208401528060408301511660408401525060608101516060830152505056fea164736f6c6343000814000a
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000007064c7bb85979f008212877c4ce41285ddf5374c0000000000000000000000001c4cbb62e18cf9c137c5d85096b5bc7819082691
-----Decoded View---------------
Arg [0] : _eternalFarming (address): 0x7064C7Bb85979f008212877c4CE41285ddf5374C
Arg [1] : _nonfungiblePositionManager (address): 0x1C4cbb62e18CF9C137c5D85096b5bC7819082691
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 0000000000000000000000007064c7bb85979f008212877c4ce41285ddf5374c
Arg [1] : 0000000000000000000000001c4cbb62e18cf9c137c5d85096b5bc7819082691
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.