Keep3r V2
Search…
Keep3r Liquidity Pools

Keep3r Liquidity Provider Tokens

Keep3r Liquidity Provider Tokens, known askLP,are protocol-specific tokens minted to the users that provide liquidity to the network's liquidity pools, also known as pair managers. Jobs can bond kLP,which will periodically generate KP3R credits for them, which can be used as a form of payment for the keepers that work their job. This is further explained in Credit Mining.
To achieve this, Keep3rV2 has a factory in charge of creating wrapper contracts designed to manage the underlying token pairs they wrap. These wrappers or pair managers conform the network's accepted liquidity pools. They provide all the necessary functions to enable the user to get kLP in return for their liquidity provision to the underlying token pair, as well as the burning of those kLP to recover the liquidity they had previously provided.
The pair manager contracts' name and symbol subscribe to the the following nomenclature:
  • Name: Keep3rLP - token0/token1. For example: Keep3rLP - KP3R/WETH
  • Symbol: kLP - token0/token1. For example: kLP - KP3R/WETH

Providing Liquidity

To provide liquidity, users have to approve their chosen pair manager contract to spend their ERC20 tokens and call the pair manager contract's mint function. This function will provide liquidity to the underlying token pair, calculate the corresponding kLPowed to the user according to the liquidity they provided, and mint them to whatever address the user has chosen to mint them to.
To compensate the protocol, the fees generated by the liquidity provided to the underlying token pair will go to governance.
For example, Alice decides she needs a keeper to work on her job, but at the same time she wants to periodically earn KP3R. After doing some research, Alice finds aboutkLPand looks for the pair managers of the Keep3r Network. Among them she finds the kLP - KP3R/WETHpair manager. She looks for the contract's address, and approves it to spend her KP3R and WETH. Once all approvals are signed, Alice calls the mint function of thekLP - KP3R/WETHcontract. The contract, in turn, mints her kLP, which she can bond in her job to periodically earnKP3R. Or, should she have a change of heart, Alice can burn her kLPin order to recover the KP3R and WETHshe had provided.
1
/// @notice Mints kLP tokens to an address according to the liquidity the msg.sender provides to the UniswapV3 pool
2
/// @dev Triggers UniV3PairManager#uniswapV3MintCallback
3
/// @param amount0Desired The amount of token0 we would like to provide
4
/// @param amount1Desired The amount of token1 we would like to provide
5
/// @param amount0Min The minimum amount of token0 we want to provide
6
/// @param amount1Min The minimum amount of token1 we want to provide
7
/// @param to The address to which the kLP tokens are going to be minted to
8
/// @return liquidity kLP tokens sent in exchange for the provision of tokens
9
function mint(
10
uint256 amount0Desired,
11
uint256 amount1Desired,
12
uint256 amount0Min,
13
uint256 amount1Min,
14
address to
15
) external returns (uint128 liquidity);
Copied!

Burning Liquidity

Liquidity providers can choose to burn their kLP in order to collect the liquidity they had previously provided. To do this, they must call the burn function.
Only an address that holds kLP can call the burn function, otherwise it will revert.
1
/// @notice Burns the corresponding amount of kLP tokens from the msg.sender and withdraws the specified liquidity
2
// in the entire range
3
/// @param liquidity The amount of liquidity to be burned
4
/// @param amount0Min The minimum amount of token0 we want to send to the recipient (to)
5
/// @param amount1Min The minimum amount of token1 we want to send to the recipient (to)
6
/// @param to The address that will receive the due fees
7
/// @return amount0 The calculated amount of token0 that will be sent to the recipient
8
/// @return amount1 The calculated amount of token1 that will be sent to the recipient
9
function burn(
10
uint128 liquidity,
11
uint256 amount0Min,
12
uint256 amount1Min,
13
address to
14
) external returns (uint256 amount0, uint256 amount1);
Copied!

Transfer kLP

If a user wishes to transfer his kLP to another address, the user can call the transfer function.
1
/// @notice Transfer kLP from the caller to another address
2
/// @param to The address that will receive the kLP
3
/// @param amount The amount of kLP to be sent
4
function transfer(address to, uint256 amount) external returns (bool)
Copied!

Approve User to Spend my kLP

If a user has deposited liquidity in a pair manager and wants to approve another address to spend her kLP, all the user has to do is call the pair manager's approve function.
1
/// @notice Approves another address to spend the caller's kLP
2
/// @param spender The address allowed to spend the caller's kLP
3
/// @param amount The amount of kLP the spender will be able to spend
4
function approve(address spender, uint256 amount) external returns (bool);
Copied!
To execute addLiquidityToJob the provider needs first to approve the spending for the Keep3r address

Position

The pair manager contracts include a function that allows anyone to check the pair manager's position in the underlying token pair.
1
/// @notice Returns the pair manager's position in the corresponding UniswapV3 pool
2
/// @return liquidity The amount of liquidity provided to the UniswapV3 pool by the pair manager
3
/// @return feeGrowthInside0LastX128 The fee growth of token0 as of the last action on the individual position
4
/// @return feeGrowthInside1LastX128 The fee growth of token1 as of the last action on the individual position
5
/// @return tokensOwed0 The uncollected amount of token0 owed to the position as of the last computation
6
/// @return tokensOwed1 The uncollected amount of token1 owed to the position as of the last computation
7
function position()
8
external
9
view
10
returns (
11
uint128 liquidity,
12
uint256 feeGrowthInside0LastX128,
13
uint256 feeGrowthInside1LastX128,
14
uint128 tokensOwed0,
15
uint128 tokensOwed1
16
);
Copied!