ILockManager

Git Source

Inherits: IERC20, ILockManagerGovernor

This contract allows users to lock WETH and claim fees from the concentrated positions.

Functions

WETH

Returns the WETH contract

function WETH() external view returns (IERC20 _weth);

Returns

NameTypeDescription
_wethIERC20The WETH token

poolRewards

Returns the status of a corresponding pool manager

function poolRewards() external view returns (uint256 wethPerLockedWeth, uint256 tokenPerLockedWeth);

Returns

NameTypeDescription
wethPerLockedWethuint256The value of the reward per WETH locked
tokenPerLockedWethuint256The value of the reward per Token locked

POOL

Returns the underlying uni v3 pool contract

function POOL() external view returns (IUniswapV3Pool _pool);

Returns

NameTypeDescription
_poolIUniswapV3PoolThe underlying uni v3 pool contract

POOL_MANAGER

Returns the pool manager contract

function POOL_MANAGER() external view returns (IPoolManager _poolManager);

Returns

NameTypeDescription
_poolManagerIPoolManagerThe pool manager

IS_WETH_TOKEN0

Returns true if WETH token is the token0

function IS_WETH_TOKEN0() external view returns (bool _isWethToken0);

Returns

NameTypeDescription
_isWethToken0boolIf WETH is token0

userRewards

Returns the pending to the corresponding account

function userRewards(address _account)
    external
    view
    returns (uint256 wethPaid, uint256 tokenPaid, uint256 wethAvailable, uint256 tokenAvailable);

Parameters

NameTypeDescription
_accountaddressThe address of the account

Returns

NameTypeDescription
wethPaiduint256The amount of the claimed rewards in WETH
tokenPaiduint256The amount of the claimed rewards in non-WETH token
wethAvailableuint256The amount of the pending rewards in WETH
tokenAvailableuint256The amount of the pending rewards in non-WETH token

withdrawalData

Returns the withdrawal data

function withdrawalData() external view returns (bool withdrawalsEnabled, uint256 totalWeth, uint256 totalToken);

Returns

NameTypeDescription
withdrawalsEnabledboolTrue if lock manager is deprecated and all positions have been unwound
totalWethuint256The total amount of WETH to distribute between lockers
totalTokenuint256the total amount of non-WETH token to distribute between lockers

STRATEGY

Returns the strategy

function STRATEGY() external view returns (IStrategy _strategy);

Returns

NameTypeDescription
_strategyIStrategyThe strategy

FEE

Returns the fee of the pool manager

function FEE() external view returns (uint24 _fee);

Returns

NameTypeDescription
_feeuint24The fee

TOKEN

Returns the non-WETH token contract of the underlying pool

function TOKEN() external view returns (IERC20 _token);

Returns

NameTypeDescription
_tokenIERC20The non-WETH token contract of the underlying pool

concentratedWeth

Returns the total amount of WETH minted by this lock manager

function concentratedWeth() external view returns (uint256 _concentratedWeth);

Returns

NameTypeDescription
_concentratedWethuint256The total amount of WETH in use by this lock manager

claimable

Get the total WETH claimable for a given account and pool manager

This value is calculated by adding the balance and unclaimed rewards.

function claimable(address _account) external view returns (uint256 _wethClaimable, uint256 _tokenClaimable);

Parameters

NameTypeDescription
_accountaddressThe address of the account

Returns

NameTypeDescription
_wethClaimableuint256The amount of WETH claimable
_tokenClaimableuint256The amount of Token claimable

lock

Lock the amount of WETH token provided by the caller

Same amount of WETH lock token will be provided

function lock(uint256 _wethAmount) external;

Parameters

NameTypeDescription
_wethAmountuint256The amount of WETH tokens that the caller wants to provide

claimRewards

Returns the rewards generated by a caller in a specific pool manager

function claimRewards(address _to) external returns (uint256 _rewardWeth, uint256 _rewardToken);

Parameters

NameTypeDescription
_toaddressThe recipient of these rewards

Returns

NameTypeDescription
_rewardWethuint256The amount of rewards in WETH that have been claimed
_rewardTokenuint256The amount of rewards in non-WETH tokens that have been claimed

addRewards

Adds a donation as a reward to be distributed among the lockers.

function addRewards(uint256 _wethAmount, uint256 _tokenAmount) external;

Parameters

NameTypeDescription
_wethAmountuint256The amount of the donation in WETH sent to the lock manager
_tokenAmountuint256The amount of the donation in non-WETH tokens sent to the lock manager

getPositionsCount

Returns the number of concentrated positions in this lock manager

function getPositionsCount() external view returns (uint256 _positionsCount);

Returns

NameTypeDescription
_positionsCountuint256The number of concentrated positions

getPositionToMint

Get the the position that has to be minted

function getPositionToMint() external returns (IStrategy.LiquidityPosition memory _positionToMint);

Returns

NameTypeDescription
_positionToMintLiquidityPosition.IStrategyThe position that has to be minted

getPositionToBurn

Get the position to burn

function getPositionToBurn(IStrategy.Position calldata _position)
    external
    returns (IStrategy.LiquidityPosition memory _positionToBurn);

Parameters

NameTypeDescription
_positionPosition.IStrategyThe position to burn

Returns

NameTypeDescription
_positionToBurnLiquidityPosition.IStrategyThe position that has to be burned

mintPosition

Creates a concentrated WETH position

function mintPosition() external;

burnPosition

Burns a position that fell out of the active range

function burnPosition(IStrategy.Position calldata _position) external;

Parameters

NameTypeDescription
_positionPosition.IStrategyThe position to be burned

uniswapV3MintCallback

Callback that is called when calling the mint method in a UniswapV3 pool

It is only called in the creation of the full range and when positions need to be updated

function uniswapV3MintCallback(uint256 _amount0Owed, uint256 _amount1Owed, bytes calldata _data) external;

Parameters

NameTypeDescription
_amount0Oweduint256The amount of token0
_amount1Oweduint256The amount of token1
_databytesnot used

positionsList

Returns an array of positions

function positionsList(uint256 _startFrom, uint256 _amount)
    external
    view
    returns (IStrategy.LiquidityPosition[] memory _positions);

Parameters

NameTypeDescription
_startFromuint256Index from where to start the pagination
_amountuint256Maximum amount of positions to retrieve

Returns

NameTypeDescription
_positionsLiquidityPosition.IStrategy[]The positions

collectFees

Claims the fees from the UniswapV3 pool and stores them in the FeeManager

Collects all available fees by passing type(uint128).max as requested amounts

function collectFees(IStrategy.Position[] calldata _positions) external;

Parameters

NameTypeDescription
_positionsPosition.IStrategy[]The positions to claim the fees from

burn

Burn the amount of lockedWeth provided by the caller

function burn(uint256 _lockedWethAmount) external;

Parameters

NameTypeDescription
_lockedWethAmountuint256The amount of lockedWeth to be burned

withdraw

Withdraws the corresponding part of WETH and non-WETH token depending on the locked WETH balance of the user and burns the lockTokens

Only available if lockManager is deprecated and withdraws are enabled

function withdraw(address _receiver) external;

Parameters

NameTypeDescription
_receiveraddressThe receiver of the tokens

unwind

Unwinds a number of positions

lockManager must be deprecated

function unwind(uint256 _positions) external;

Parameters

NameTypeDescription
_positionsuint256The number of positions to unwind from last to first

Events

Locked

Emitted when a user locks WETH in a pool

event Locked(uint256 _wethAmount);

ClaimedRewards

Emitted when a user claims rewards

event ClaimedRewards(address _user, address _to, uint256 _wethAmount, uint256 _tokenAmount);

RewardsAdded

Emitted when a fee manager adds WETH rewards to a given pool manager

event RewardsAdded(uint256 _wethAmount, uint256 _tokenAmount);

FeesCollected

Emitted when we finish the fee-collecting process

event FeesCollected(uint256 _wethFees, uint256 _tokenFees);

Burned

Emitted when an amount of locked WETH is burned

event Burned(uint256 _wethAmount);

WithdrawalsEnabled

Emitted when withdrawals are enabled

event WithdrawalsEnabled();

PositionMinted

Emitted when a position was minted

event PositionMinted(IStrategy.LiquidityPosition _position, uint256 _amount0, uint256 _amount1);

PositionBurned

Emitted when a position was burned

event PositionBurned(IStrategy.LiquidityPosition _position, uint256 _amount0, uint256 _amount1);

Errors

LockManager_NoRewardsToClaim

Thrown when the user doesn't have rewards to claim

error LockManager_NoRewardsToClaim();

LockManager_ZeroAmount

Thrown when the amount is zero

error LockManager_ZeroAmount();

LockManager_ZeroAddress

Thrown when the provided address is zero

error LockManager_ZeroAddress();

LockManager_NoLockedWeth

Thrown when the lock manager has no locked WETH

error LockManager_NoLockedWeth();

LockManager_OnlyPool

Thrown when the UniswapV3 callback caller is not a valid pool

error LockManager_OnlyPool();

LockManager_OverLimitMint

Thrown when the amount of WETH minted by this lock manager exceeds the WETH supply

error LockManager_OverLimitMint(uint256 _totalSupply, uint256 _concentratedWeth);

LockManager_DeprecationRequired

Thrown when enabling withdraws without the lockManager being deprecated

error LockManager_DeprecationRequired();

LockManager_WithdrawalsNotEnabled

Thrown when trying to withdraw with the contract not marked as withdrawable

error LockManager_WithdrawalsNotEnabled();

LockManager_ZeroBalance

Thrown when trying to withdraw with zero lockedWeth

error LockManager_ZeroBalance();

LockManager_NotLockManager

Thrown when the caller is not the lock manager

error LockManager_NotLockManager();

LockManager_NoPositions

Thrown when trying to unwind, and there are no positions left

error LockManager_NoPositions();

LockManager_PoolManipulated

Thrown when the price oracle detects a manipulation

error LockManager_PoolManipulated();

LockManager_InvalidAddress

Thrown when trying to transfer to the same address

error LockManager_InvalidAddress();

LockManager_TransferFailed

Thrown when transfer or transferFrom fails

error LockManager_TransferFailed();

Structs

PoolRewards

Pool status for internal accountancy

struct PoolRewards {
    uint256 wethPerLockedWeth;
    uint256 tokenPerLockedWeth;
}

UserRewards

The amounts of paid and available rewards per user

struct UserRewards {
    uint256 wethPaid;
    uint256 tokenPaid;
    uint256 wethAvailable;
    uint256 tokenAvailable;
}

WithdrawalData

Withdrawal data for balance withdrawals for lockers

struct WithdrawalData {
    bool withdrawalsEnabled;
    uint256 totalWeth;
    uint256 totalToken;
}