IPoolManager
Inherits: IPoolManagerGovernor
This contract manages the protocol owned positions of the associated uni v3 pool
Functions
WETH
Returns the WETH contract
function WETH() external view returns (IERC20 _weth);
Returns
Name | Type | Description |
---|---|---|
_weth | IERC20 | The WETH token |
UNISWAP_V3_FACTORY
Returns the UniswapV3 factory contract
function UNISWAP_V3_FACTORY() external view returns (IUniswapV3Factory _uniswapV3Factory);
Returns
Name | Type | Description |
---|---|---|
_uniswapV3Factory | IUniswapV3Factory | The UniswapV3 factory contract |
POOL_BYTECODE_HASH
Returns the UniswapV3 pool bytecode hash
function POOL_BYTECODE_HASH() external view returns (bytes32 _poolBytecodeHash);
Returns
Name | Type | Description |
---|---|---|
_poolBytecodeHash | bytes32 | The UniswapV3 pool bytecode hash |
lockManager
Returns the lock manager contract
function lockManager() external view returns (ILockManager _lockManager);
Returns
Name | Type | Description |
---|---|---|
_lockManager | ILockManager | The lock manager |
deprecatedLockManagers
Returns a deprecated lock manager contract at a specific index
function deprecatedLockManagers(uint256 _index) external view returns (ILockManager _deprecatedLockManagers);
Returns
Name | Type | Description |
---|---|---|
_deprecatedLockManagers | ILockManager | A deprecated lock manager |
FEE
Returns the fee of the pool manager
function FEE() external view returns (uint24 _fee);
Returns
Name | Type | Description |
---|---|---|
_fee | uint24 | The pool manager's fee |
TOKEN
Returns the non-WETH token of the underlying pool
function TOKEN() external view returns (IERC20 _token);
Returns
Name | Type | Description |
---|---|---|
_token | IERC20 | The non-WETH token of the underlying pool |
POOL
Returns the underlying UniswapV3 pool contract
function POOL() external view returns (IUniswapV3Pool _pool);
Returns
Name | Type | Description |
---|---|---|
_pool | IUniswapV3Pool | The underlying UniswapV3 pool contract |
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 |
seederRewards
Returns the pending to the corresponding account
function seederRewards(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 claimed rewards in WETH |
tokenPaid | uint256 | The amount of claimed rewards in the non-WETH token |
wethAvailable | uint256 | The amount of pending rewards in WETH |
tokenAvailable | uint256 | The amount of pending rewards in the non-WETH token |
poolRewards
Returns the status of a corresponding pool manager
function poolRewards() external view returns (uint256 wethPerSeededLiquidity, uint256 tokenPerSeededLiquidity);
Returns
Name | Type | Description |
---|---|---|
wethPerSeededLiquidity | uint256 | The value of the reward per WETH locked |
tokenPerSeededLiquidity | uint256 | The value of the reward per non-WETH token locked |
deprecateLockManager
Deprecates the current lock manager and deploys a new one
function deprecateLockManager() external;
mintLiquidityForFullRange
Mint liquidity for the full-range position
function mintLiquidityForFullRange(uint256 _wethAmount, uint256 _tokenAmount) external;
Parameters
Name | Type | Description |
---|---|---|
_wethAmount | uint256 | The amount of WETH token to be inserted in the full-range position |
_tokenAmount | uint256 | The amount of non-WETH token to be inserted in the full-range position |
burn
Burns an amount of liquidity provided by a seeder
The voting power for the user remains the same but they donate all rewards
function burn(uint256 _liquidity) external;
Parameters
Name | Type | Description |
---|---|---|
_liquidity | uint256 | The amount of liquidity |
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 | The data that differentiates through an address whether to mint or transfer from for the full range |
increaseFullRangePosition
Increases the full-range position. The deposited tokens can not withdrawn and all of the generated fees with only benefit the pool itself
function increaseFullRangePosition(address _donor, uint128 _liquidity, uint160 _sqrtPriceX96) external;
Parameters
Name | Type | Description |
---|---|---|
_donor | address | The user that will provide WETH and the other token |
_liquidity | uint128 | The liquidity that will be minted |
_sqrtPriceX96 | uint160 | A sqrt price representing the current pool prices |
increaseFullRangePosition
Increases the full-range position with a given liquidity
Pool manager will make a callback to the fee manager, who will provide the liquidity
function increaseFullRangePosition(uint256 _wethAmount, uint256 _tokenAmount)
external
returns (uint256 __amountWeth, uint256 __amountToken);
Parameters
Name | Type | Description |
---|---|---|
_wethAmount | uint256 | The amount of WETH token to be inserted in the full-range position |
_tokenAmount | uint256 | The amount of non-WETH to be inserted in the full-range position |
Returns
Name | Type | Description |
---|---|---|
__amountWeth | uint256 | The amount in WETH added to the full range |
__amountToken | uint256 | The amount in non-WETH token added to the full range |
collectFees
Claims the fees from the UniswapV3 pool and stores them in the FeeManager
function collectFees() external;
claimRewards
Returns the rewards generated by a caller
function claimRewards(address _to) external returns (uint256 _rewardWeth, uint256 _rewardToken);
Parameters
Name | Type | Description |
---|---|---|
_to | address | The recipient the rewards |
Returns
Name | Type | Description |
---|---|---|
_rewardWeth | uint256 | The amount of rewards in WETH that were claimed |
_rewardToken | uint256 | The amount of rewards in non-WETH token that were claimed |
claimable
Returns the total amount of WETH claimable for a given account
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 non-WETH token claimable |
burn1
Burns a little bit of liquidity in the pool to produce a new observation
The oracle corrections require at least 2 post-manipulation observations to work properly When there is no new observations after a manipulation, the oracle will make then with this function
function burn1() external;
Events
SeederLiquidityBurned
Emitted when a seeder burns liquidity
event SeederLiquidityBurned(uint256 _liquidity);
LockManagerDeprecated
Emitted when a lock manager is deprecated
event LockManagerDeprecated(ILockManager _oldLockManager, ILockManager _newLockManager);
FeesCollected
Emitted when fees are collected
event FeesCollected(uint256 _totalFeeWeth, uint256 _totalFeeToken);
RewardsAdded
Emitted when rewards are added to a pool manager
event RewardsAdded(uint256 _wethAmount, uint256 _tokenAmount);
ClaimedRewards
Emitted when a seeder claims their rewards
event ClaimedRewards(address _user, address _to, uint256 _wethAmount, uint256 _tokenAmount);
Errors
PoolManager_OnlyFactory
Thrown when someone other than the factory tries to call the method
error PoolManager_OnlyFactory();
PoolManager_OnlyPool
Thrown when someone other than the pool tries to call the method
error PoolManager_OnlyPool();
PoolManager_ActiveLockManager
Thrown when someone tries to deploy a new lock manager while the old one is still not deprecated
error PoolManager_ActiveLockManager();
PoolManager_ZeroAmount
Thrown when the amount is zero
error PoolManager_ZeroAmount();
PoolManager_ZeroAddress
Thrown when the provided address is zero
error PoolManager_ZeroAddress();
PoolManager_NoRewardsToClaim
Thrown when the user doesn't have rewards to claim
error PoolManager_NoRewardsToClaim();
PoolManager_PoolManipulated
Thrown when the price oracle detects a manipulation
error PoolManager_PoolManipulated();
PoolManager_InvalidFeeManager
Thrown when the FeeManager provided is incorrect
error PoolManager_InvalidFeeManager();
PoolManager_InvalidPriceOracle
Thrown when the caller of the burn1
function is not the current oracle
error PoolManager_InvalidPriceOracle();
Structs
SeederRewards
The amounts of paid and available rewards per seeder
struct SeederRewards {
uint256 wethPaid;
uint256 tokenPaid;
uint256 wethAvailable;
uint256 tokenAvailable;
}
PoolRewards
Pool status for internal accountancy
struct PoolRewards {
uint256 wethPerSeededLiquidity;
uint256 tokenPerSeededLiquidity;
}
LockManagerParams
The parameters for the lock manager
struct LockManagerParams {
IPoolManagerFactory factory;
IStrategy strategy;
IERC20 token;
IERC20 weth;
IUniswapV3Pool pool;
bool isWethToken0;
uint24 fee;
address governance;
uint256 index;
}
Position
UniswapV3 pool position
struct Position {
int24 lowerTick;
int24 upperTick;
}