PlusPool
This contract manages the leveraged assets of KLAYswap's plus pool liquidity providers. Liquidity providers can maximize their returns with positive assets (deposited assets + utilized assets) by using positive deposits according to their deposited assets. However, a high asset utilization ratio can result in automatic returns, which can result in losses.
Github Link: (Will be updated after official launch)
- Cypress : 0x
Events
Read-Only Functions
State-Changing Functions
ChangeBorrowFactor
event ChangeBorrowFactor(uint newBorrowFactor);
- Event log of borrow factor change
ChangeLiquidationFactor
event ChangeLiquidationFactor(uint newLiquidationFactor);
- Event log of liquidation factor change
ChangeBorrowable
event ChangeBorrowable(address token, bool b);
- Event that occurs when availability is changed
GiveReward
event GiveReward(address user, uint amount, uint lastIndex, uint rewardSum);
- Event log of when mined KSP is claimed and distributed
- Parameters
user
: address of the user who claimedamount
: the amount of KSP claimedlastIndex
: index result of the pair of the wallet after claimingrewardSum
: The amount of KSP that has been accrued so far
GiveAirdropReward
event GiveAirdropReward(address user, address dist, uint amount, uint currentIndex, uint userAirdropSum);
- Event log of when airdrop token is claimed and distributed
- Parameters
user
: address of the user who claimeddist
: Airdrop contract addressamount
: the amount of token claimedlastIndex
: index result of the pair of the wallet after claimingrewardSum
: The amount of token that has been accrued so far
OpenPosition
event OpenPosition(address user, uint amountA, uint amountB, uint borrowA, uint borrowB, uint amountLP, uint userLP);
- Events that occur when depositing to PlusPool
- If the token to deposit is KLAY,
msg.value
is provided. - Parameters
user
: address of the useramountA
: The deposit amount of tokenAamountB
: The deposit amount of tokenBborrowA
: The utilization amount of tokenAborrowB
: The utilization amount of tokenBamountLP
: The amount of LP tokens minted due to additional liquidityuserLP
: the total amount of LP tokens minted due to additional liquidity
ClosePosition
event ClosePosition(address user, uint amountLP, uint amountA, uint amountB, uint userLP);
- Events that occur when withdraw liquidity
- Parameters
user
: address of the useramountLP
: The amount of LP tokens burned due to liquidity removalamountA
: The withdraw amount of tokenAamountB
: The withdraw amount of tokenBuserLP
: the total amount of LP tokens minted due to additional liquidity
Liquidate
event Liquidate(address user, uint idx, uint debtA, uint debtB, uint lp, uint debtRatio, uint time);
- Event that occur when the automatic return system activates
- Parameters
user
: address of the useridx
: Number of auto-return countdeptA
: Number of tokenA returned automaticallydeptB
: Number of tokenB returned automaticallylp
: the total amount of LP tokensdebtRatio
: Asset utilization ratio in case of automatic returntime
: Automatic return time
- mint/burn depending on liquidity addition/removal
lpToken
- target liquidity pool address
- The first token address composed of the pair
- When KLAY is one part of the pair, tokenA == 0x0
- The second token address composed of the pair
- Whether tokenA can be borrowable
- Whether tokenB can be borrowable
- automatic return factor
- It is a value between 1 and 10^18, in units of 0.000000000000000001%
- Default - 850000000000000000
- Utilization cost interest rate of utilized assets
- It is a value between 1 and 10^18, in units of 0.000000000000000001%
- Default - 750000000000000000
- Number of PlusPool tokens held by each address
- Ratio of resources to be used for KSP buyback & incineration in case of automatic return
function liquidationCount(address user) public view returns (uint)
- Returns the user's cumulative automatic return count
function claimReward() public
- Method that a user calls to claim the claimable KSP that has accumulated for the pair
- When called, KSP is claimed from the Factory and paid to msg.sender
- Even if the method is not called directly, it is automatically called when the LP token balance of the user’s wallet changes.
- When liquidity is added
- When liquidity is removed
function openPosition(uint amountA, uint amountB, uint borrowA, uint borrowB, uint minAmountLP) public payable
- Method that depositing to PlusPool
- If the token to deposit is KLAY,
msg.value
is provided. - After liquidity is provided, the LP token corresponding to the pool share is minted in the
msg.sender
wallet. - If there is claimable KSP when called, the claim proceeds to
msg.sender
. - Parameter
amountA
: The deposit amount of tokenAamountB
: The deposit amount of tokenBborrowA
: The utilization amount of tokenAborrowB
: The utilization amount of tokenBminAmountLP
: Minimum Guaranteed LP amount
function closePosition(uint amountLP, uint minAmountA, uint minAmountB) public
- Returns the amount of LP tokens, and distributes the corresponding tokenA and tokenB to the
msg.sender
wallet - The returned LP token amount is burned
- If there is claimable KSP and Airdrop when called, the claim proceeds to
msg.sender
. - Parameters
amountLP
: The amount of LP tokens burned due to liquidity removalminAmountA
: The withdraw amount of tokenAminAmountB
: The withdraw amount of tokenB
Last modified 7mo ago