KLAYswap
Search…
Utils
This contract can check asset details and swap estimates of KLAYswap service

Address

Read-Only Functions

Read-Only Functions

getPoolData
1
function getPoolData(address lp) public view returns (
2
uint miningRate,
3
uint rateDecimals,
4
address tokenA,
5
uint reserveA,
6
address tokenB,
7
uint reserveB,
8
uint airdropCount,
9
address[] memory airdropTokens,
10
uint[] memory airdropSettings
11
)
Copied!
  • Amount of TokenA held by LP
  • Airdrop only between startBlock and endBlock of blocks in the network
  • Parameters
    • miningRate : KSP distribution ratio numerator value
    • rateDecimals : KSP distribution ratio denominator
      • 예) Daily KSP distribution ratio
        • miningRate - 130323276365080043, rateDecimals - 10000000000000000
        • 130323276365080043 / 10000000000000000 = 13.03...%
    • tokenA : LP tokenA
    • reserveA : Amount of tokenA held by LP
    • tokenB : LP tokenB
    • reserveB : Amount of tokenB held by LP
    • airdropCount : Number of airdrop plans in progress at LP
    • airdropTokens : Airdrop token address array
    • airdropSettings : Airdrop info array
      • [0]: blockAmount, [1]: startBlock, [2]: endBlock
  • airdropSettings Data format
    • 예) TokenA, TokenB Airdrop
      • airdropTokens = [ TokenA address, TokenB address]
      • airdropSettings = [ TokenA blockAmount, TokenA startBlock, TokenA endBlock, TokenB blockAmount, TokenB startBlock, TokenB endBlock ]
getPendingReward
1
function getPendingReward(address lp, address user) public view returns (
2
uint kspReward,
3
uint airdropCount,
4
address[] memory airdropTokens,
5
uint[] memory airdropRewards )
Copied!
  • User's claimable reward information
  • Parameters
    • kspReward : Claimable KSP
    • airdropCount : Number of airdrop plans the LP has
    • airdropTokens : Airdrop token address array
    • airdropRewards : Arrangement of Airdrop token amount Information claimable
  • airdrop data format
    • 예) TokenA, TokenB Airdrop
      • airdropTokens = [ TokenA address, TokenB address]
      • airdropSettings = [ TokenA reward, TokenB reward ]
estimateSwap
1
function estimateSwap(
2
address tokenIn,
3
address tokenOut,
4
uint amountIn,
5
address[] memory path
6
) public view returns (uint amountOut)
Copied!
  • KLAYswap swap estimate lookup function
  • Input Parameters
    • tokenIn : Token address to be exchanged
    • tokenOut : Token address to receive
    • amountIn : Token amount to be exchanged
    • path : exchange route
  • example
    • KLAY -> KSP
      • tokenIn = KLAY token address
      • tokenOut = KSP token address
      • amountIn = 1000000000000000000 ( =1KLAY )
      • path = []
    • KLAY -> ORC -> KSP
      • tokenIn = KLAY token address
      • tokenOut = KSP token address
      • amountIn = 1000000000000000000 ( =1KLAY )
      • path = ["{ORC token Address}"]
Copy link
Contents
Address