KLAYswap
English
English
  • Introduction
  • Protocol Overview
  • Core Concept
  • KLAYswap Advantages
  • Risk & Security
  • Privacy Policy
  • Audit
  • TOKENOMICS
    • KSP
      • KSP TOKENOMICS
      • Automation of KSP distribution rate
        • Voting policy on passing governance
        • KSP distribution ratio reflection policy
      • KSP Allocation
  • PRODUCT
    • SWAP
    • Single-side Deposit
      • Detailed policy of Single Deposit
    • Pair Deposit
    • V3 Pair Deposit
      • V2 to V3 Migration
        • V2 to V3 Migration Guide
        • V2 to V3 Migration Policy
      • V3 Pair Deposit
        • V3 Deposit Guide
        • V3 pair Deposit Policy
      • V3 to V3 Migration
        • V3 to V3 Migration Guide
        • V3 to V3 Migration Policy
      • V3 Pair Withdraw
        • V3 Withdraw Guide
        • V3 Withdraw Policy
    • Plus Deposit
      • Detailed policy of Plus Deposit
    • Long/Short Position Deposit
      • Open and Close Long/Short Positions
        • Open Short Positions
        • Open Long Positions
        • Remove Long Position
        • Remove Short Position
      • Position Deposit Details Policy
    • KSP Staking & Voting
      • Staking, Pool Voting Policy
    • Governance
      • Governance Voting Policy
    • Drops
    • Ecopot
    • Pool Airdrop
    • APR & APY
      • TVL
      • Pool
      • Staking
    • Interest rate
  • DEVELOPERS
    • Contract
      • Factory
      • Exchange
      • PoolVoting
      • VotingKSP
      • Treasury
      • Distribution
      • Governor
      • SinglePool
      • SinglePool Factory
      • PlusPool
      • PlusPool Factory
      • Store
      • Utils
      • Single/Plus Utils
      • Helper
      • EcoPotVoting
      • EcoPot
      • V3
        • V3Factory
        • V3Pool
        • NonfungiblePositionManager
        • NonfungibleTokenPositionDescriptor
        • V3SwapRouter
        • V3Migrator
        • V3Estimator
        • PositionMigrator
        • V3Treasury
        • V3AirdropOperator
        • UniversalRouter
    • Airdrop
      • Set Airdrop Operator
      • Start Airdrop
    • EcoPot
      • Set EcoPot
      • Start EcoPot
  • HOW-TO GUIDES
    • KLAYswap Guide
    • How to add liquidity on KLAYswap
    • [Burrito Wallet] How to deposit assets using mobile devices?
    • How to create a liquidity pool on KLAYswap
    • How to stake and vote on KLAYswap
    • How to deposit assets
      • Deposit Klaytn-based assets
      • Deposit Ethereum-based assets
      • Deposit XRP
    • FAQ
  • KLAYswap
  • Orbit Bridge
  • KLAYswap git
  • Orbit Bridge git
  • KLAYswap audit report
Powered by GitBook
On this page
  • Code
  • Address
  • Events, Read-Only Functions, and State-Changing Functions

Was this helpful?

  1. DEVELOPERS
  2. Contract

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.

Code

Github Link: (Will be updated after official launch)

Address

  • Cypress : 0x

Events, Read-Only Functions, and State-Changing Functions

Events

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 claimed

    • amount : the amount of KSP claimed

    • lastIndex : index result of the pair of the wallet after claiming

    • rewardSum : 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 claimed

    • dist : Airdrop contract address

    • amount : the amount of token claimed

    • lastIndex : index result of the pair of the wallet after claiming

    • rewardSum : 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 user

    • amountA : The deposit amount of tokenA

    • amountB : The deposit amount of tokenB

    • borrowA : The utilization amount of tokenA

    • borrowB: The utilization amount of tokenB

    • amountLP: The amount of LP tokens minted due to additional liquidity

    • userLP : 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 user

    • amountLP: The amount of LP tokens burned due to liquidity removal

    • amountA : The withdraw amount of tokenA

    • amountB : The withdraw amount of tokenB

    • userLP : 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 user

    • idx : Number of auto-return count

    • deptA : Number of tokenA returned automatically

    • deptB : Number of tokenB returned automatically

    • lp : the total amount of LP tokens

    • debtRatio : Asset utilization ratio in case of automatic return

    • time : Automatic return time

Read-Only Functions

totalLP

  • mint/burn depending on liquidity addition/removal

lpToken

  • target liquidity pool address

tokenA

  • The first token address composed of the pair

  • When KLAY is one part of the pair, tokenA == 0x0

tokenB

  • The second token address composed of the pair

borrowableA

  • Whether tokenA can be borrowable

borrowableB

  • Whether tokenB can be borrowable

liquidationFactor

  • automatic return factor

  • It is a value between 1 and 10^18, in units of 0.000000000000000001%

  • Default - 850000000000000000

borrowFactor

  • Utilization cost interest rate of utilized assets

  • It is a value between 1 and 10^18, in units of 0.000000000000000001%

  • Default - 750000000000000000

userLP

  • Number of PlusPool tokens held by each address

liquidationBonusRate

  • Ratio of resources to be used for KSP buyback & incineration in case of automatic return

liquidationCount

function liquidationCount(address user) public view returns (uint)
  • Returns the user's cumulative automatic return count

State-Changing Functions

claimReward

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

openPosition

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 tokenA

    • amountB : The deposit amount of tokenB

    • borrowA : The utilization amount of tokenA

    • borrowB: The utilization amount of tokenB

    • minAmountLP : Minimum Guaranteed LP amount

closePosition

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 removal

    • minAmountA : The withdraw amount of tokenA

    • minAmountB : The withdraw amount of tokenB

PreviousSinglePool FactoryNextPlusPool Factory

Last updated 2 years ago

Was this helpful?