ILockManager
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
Name | Type | Description |
---|---|---|
_weth | IERC20 | The WETH token |
poolRewards
Returns the status of a corresponding pool manager
function poolRewards() external view returns (uint256 wethPerLockedWeth, uint256 tokenPerLockedWeth);
Returns
Name | Type | Description |
---|---|---|
wethPerLockedWeth | uint256 | The value of the reward per WETH locked |
tokenPerLockedWeth | uint256 | The value of the reward per Token locked |
POOL
Returns the underlying uni v3 pool contract
function POOL() external view returns (IUniswapV3Pool _pool);
Returns
Name | Type | Description |
---|---|---|
_pool | IUniswapV3Pool | The underlying uni v3 pool contract |
POOL_MANAGER
Returns the pool manager contract
function POOL_MANAGER() external view returns (IPoolManager _poolManager);
Returns
Name | Type | Description |
---|---|---|
_poolManager | IPoolManager | The pool manager |
IS_WETH_TOKEN0
Returns true if WETH token is the token0
function IS_WETH_TOKEN0() external view returns (bool _isWethToken0);
Returns
Name | Type | Description |
---|---|---|
_isWethToken0 | bool | If 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
Name | Type | Description |
---|---|---|
_account | address | The address of the account |
Returns
Name | Type | Description |
---|---|---|
wethPaid | uint256 | The amount of the claimed rewards in WETH |
tokenPaid | uint256 | The amount of the claimed rewards in non-WETH token |
wethAvailable | uint256 | The amount of the pending rewards in WETH |
tokenAvailable | uint256 | The 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
Name | Type | Description |
---|---|---|
withdrawalsEnabled | bool | True if lock manager is deprecated and all positions have been unwound |
totalWeth | uint256 | The total amount of WETH to distribute between lockers |
totalToken | uint256 | the total amount of non-WETH token to distribute between lockers |
STRATEGY
Returns the strategy
function STRATEGY() external view returns (IStrategy _strategy);
Returns
Name | Type | Description |
---|---|---|
_strategy | IStrategy | The strategy |
FEE
Returns the fee of the pool manager
function FEE() external view returns (uint24 _fee);
Returns
Name | Type | Description |
---|---|---|
_fee | uint24 | The fee |
TOKEN
Returns the non-WETH token contract of the underlying pool
function TOKEN() external view returns (IERC20 _token);
Returns
Name | Type | Description |
---|---|---|
_token | IERC20 | The 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
Name | Type | Description |
---|---|---|
_concentratedWeth | uint256 | The 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
Name | Type | Description |
---|---|---|
_account | address | The address of the account |
Returns
Name | Type | Description |
---|---|---|
_wethClaimable | uint256 | The amount of WETH claimable |
_tokenClaimable | uint256 | The 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
Name | Type | Description |
---|---|---|
_wethAmount | uint256 | The 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
Name | Type | Description |
---|---|---|
_to | address | The recipient of these rewards |
Returns
Name | Type | Description |
---|---|---|
_rewardWeth | uint256 | The amount of rewards in WETH that have been claimed |
_rewardToken | uint256 | The 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
Name | Type | Description |
---|---|---|
_wethAmount | uint256 | The amount of the donation in WETH sent to the lock manager |
_tokenAmount | uint256 | The 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
Name | Type | Description |
---|---|---|
_positionsCount | uint256 | The number of concentrated positions |
getPositionToMint
Get the the position that has to be minted
function getPositionToMint() external returns (IStrategy.LiquidityPosition memory _positionToMint);
Returns
Name | Type | Description |
---|---|---|
_positionToMint | LiquidityPosition.IStrategy | The 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
Name | Type | Description |
---|---|---|
_position | Position.IStrategy | The position to burn |
Returns
Name | Type | Description |
---|---|---|
_positionToBurn | LiquidityPosition.IStrategy | The 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
Name | Type | Description |
---|---|---|
_position | Position.IStrategy | The 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
Name | Type | Description |
---|---|---|
_amount0Owed | uint256 | The amount of token0 |
_amount1Owed | uint256 | The amount of token1 |
_data | bytes | not used |
positionsList
Returns an array of positions
function positionsList(uint256 _startFrom, uint256 _amount)
external
view
returns (IStrategy.LiquidityPosition[] memory _positions);
Parameters
Name | Type | Description |
---|---|---|
_startFrom | uint256 | Index from where to start the pagination |
_amount | uint256 | Maximum amount of positions to retrieve |
Returns
Name | Type | Description |
---|---|---|
_positions | LiquidityPosition.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
Name | Type | Description |
---|---|---|
_positions | Position.IStrategy[] | The positions to claim the fees from |
burn
Burn the amount of lockedWeth provided by the caller
function burn(uint256 _lockedWethAmount) external;
Parameters
Name | Type | Description |
---|---|---|
_lockedWethAmount | uint256 | The 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
Name | Type | Description |
---|---|---|
_receiver | address | The receiver of the tokens |
unwind
Unwinds a number of positions
lockManager must be deprecated
function unwind(uint256 _positions) external;
Parameters
Name | Type | Description |
---|---|---|
_positions | uint256 | The 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;
}