KLAYswap
한국어
한국어
  • 소개
  • 프로토콜 개요
  • 핵심 개념
  • 클레이스왑의 장점
  • 위험 & 보안
  • 개인정보처리방침
  • 보안 감사
  • Tokenomics
    • KSP
      • KSP Tokenomics
      • KSP 분배율 자동화
        • 거버넌스 통과 투표 정책
        • KSP 분배율 반영 정책
      • KSP Allocation
  • Product
    • 스왑
    • 단일 예치
      • 단일예치 상세정책
    • 일반 페어 예치(V2)
    • 집중화 페어 예치(V3)
      • V2 to V3 마이그레이션
        • V2 to V3 마이그레이션 가이드
        • V2 to V3 마이그레이션 상세 정책
      • 집중화 페어 풀(V3) 예치
        • 집중화 페어 예치(V3) 가이드
        • 집중화 페어 예치(V3) 상세 정책
      • V3 to V3 마이그레이션
        • V3 to V3 마이그레이션 가이드
        • V3 to V3 마이그레이션 상세 정책
      • 집중화 페어 예치(V3) 출금
        • 집중화 풀(V3) 출금 가이드
        • 집중화 풀(V3) 출금 상세 정책
    • 플러스 예치
      • 플러스 예치 상세 정책
    • 롱/숏 포지션 예치
      • 롱/숏 포지션 오픈과 종료
        • 롱 포지션 오픈
        • 숏 포지션 오픈
        • 롱 포지션 종료
        • 숏 포지션 종료
      • 포지션 예치 상세 정책
    • KSP 스테이킹 & 보팅
      • 스테이킹, 풀 투표 정책
    • 거버넌스
      • 거버넌스 투표 정책
    • Drops(드랍스)
    • Ecopot(에코팟)
    • 풀에어드랍
    • APR & APY
      • TVL
      • Pool
      • Staking
    • 이자율 모델
  • 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
      • Airdrop Operator 권한 획득
      • Airdrop 계획 진행
    • EcoPot
      • EcoPot Operator 권한 획득
      • EcoPot 계획 진행
  • HOW-TO GUIDES
    • 클레이스왑 가이드
    • 서비스에 연결하기
      • [클립] PC에서 연결하기
      • [클립] 모바일에서 연결하기
      • [카이카스] PC에서 연결하기
    • 활용할 자산 입금하기
      • 클레이튼 자산 입금하기
      • 이더리움/BSC 자산 입금하기
      • 리플 자산 입금하기
    • 풀에 예치하기
      • [클립] PC에서 단일 예치하기
      • [부리또월렛] 모바일에서 단일 예치하기
      • [클립] PC에서 일반 페어 예치 하기
      • [클립] 모바일에서 일반 페어 예치 하기
      • [카이카스] PC에서 일반 페어 예치하기
      • [클립] PC에서 플러스 페어 예치하기
      • [공통] 활용할 자산 선택하기
    • 풀에서 출금하기
      • [클립] PC에서 단일 예치출금하기
      • [클립] PC에서 플러스 예치 출금하기
    • KSP 스테이킹 & 풀 투표하기
      • [클립] PC에서 KSP 스테이킹 하기
      • [클립] 모바일에서 KSP 스테이킹 하기
      • [카이카스] PC에서 KSP 스테이킹 하기
      • [클립] PC에서 풀 투표 하기
      • [클립] 모바일에서 풀 투표 하기
      • [카이카스] PC에서 풀 투표 하기
    • 보상 수령하기
    • FAQ
      • 클레이스왑은 어떤 서비스인가요?
      • 클레이(KLAY) & 클레이스왑(KSP)은 무엇인가요?
      • 유동성 풀(Liquidity pool)이 무엇인가요?
      • 유동성 풀의 예치방법, 특징이 무엇인가요?
      • 왜 클레이스왑에서 예치해야 하나요?
      • 획득한 보상은 어떻게 활용하나요?
  • 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

Factory

PreviousContractNextExchange

Last updated 2 years ago

Was this helpful?

The Factory smart contract oversees the full functionality of token pair registration and transactions in KLAYswap. It is also a token contract for KLAYswap's KSP governance token that complies with the KIP7 standard, and a smart contract that implements all functions related to KSP mining.

Code

Github Link: (Will be updated after official launch)

Address

  • Cypress :

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

Events

Transfer

event Transfer(address indexed from, address indexed to, uint amount);
  • Event for the movement and burning of KSP tokens

  • A KIP7 Standard Event

Approval

event Approval(address indexed holder, address indexed spender, uint amount);
  • Event for KSP token approval

  • A KIP7 Standard Event

ChangeCreateFee

event ChangeCreateFee(uint _createFee);
  • An event to change the Pool Contract Creation Fee when adding a new liquidity pool pair

CreatePool

event CreatePool(address tokenA, uint amountA, address tokenB, uint amountB, uint fee, address exchange, uint exid);
  • Event to create new liquidity pool

  • parameters

    • tokenA : A token address in pair

    • amountA : A token amount in pool

    • tokenB : B token address in pair

    • amountB : B token amount in pool

    • fee : pool fee rate exchange :

    • exchange : contract address of this pool

    • exid : exchange id

ExchangePos

event ExchangePos(address tokenA, uint amountA, address tokenB, uint amountB);
  • Positive exchange Event

  • parameters

    • tokenA : User input tokenA address

    • amountA : User input tokenA amount

    • tokenB : User get tokenB address

    • amountB : User get tokenB amount

ExchangeNeg

event ExchangePos(address tokenA, uint amountA, address tokenB, uint amountB);
  • Positive exchange Event

  • parameters

    • tokenA : User input tokenA address

    • amountA : User input tokenA amount

    • tokenB : User get tokenB address

    • amountB : User get tokenB amount

Read-Only Functions

name

  • KlaySwap Protocol

symbol

  • KSP

decimals

  • 18

totalSupply

  • 126144000000000000000000000 = 126144000 KSP

  • There is only one case in which the total supply can be changed:

    • A decrease due to fee payments for adding new liquidity pairs

balanceOf

  • The amount of KSP held in each address

allowance

  • Status of approval to spender for each address

owner

  • Governance Contract Address

miningAmount

  • The total mining amount

  • This cannot be changed after a contract is deployed

halfLife

  • The block unit that proceeds with halving

  • This cannot be changed after a contract is deployed

minableBlock

  • The block number that starts mining

unfreezeBlock

  • The block number that makes KSP token transfers possible

teamRatio

  • The ratio of the mined amount given to the developement team for the first two years.

pools

  • List of liquidity pool pairings

  • Each item saves the smart contract address of the liquidity pool

poolExist

  • Returns if the contract for the given liquidiy pool pair exists

tokenToPool

  • When the addresses of tokenA and tokenB are inputted, this returns the contract address of the corresponding pairing

  • Returns the same contract address regardless of the order of the liquidity pool pairing tokens:

    tokenToPool[tokenA][tokenB] == tokenToPool[tokenB][tokenA]

createFee

  • The amount of KSP that must be paired to create a new liquidity pool pair

teamWallet

  • The address to which the development team can claim their reward

teamAward

  • The team reward amount that has already been claimed

mined

function mined() public view returns (uint) 
  • Returns the KSP amount mined so far

  • This amount includes the quantity already claimed and the quantity to be claimed

  • The teamAward quantity is exempted from this amount

estimatePos

function estimatePos(address inToken, uint inAmount, address outToken) private view returns (uint)
  • Returns the possible quantity received for a POS transaction.

  • Parameters

    • inToken : token address for payment

    • inAmount : amount of tokens for payment

    • outToken : token address for receiving

estimateNeg

function estimateNeg(address inToken, address outToken, uint outAmount) private view returns (uint)
  • Function to return the amount of tokens that need to be paid for a NEG transaction.

  • Parameters

    • inToken : token address for payment

    • outToken : token address for receiving

    • outAmount : amount of tokens to receive

getPoolCount

function getPoolCount() public view returns (uint)
  • Returns the current number of registered liquidity pools.

getPoolAddress

function getPoolAddress(uint idx) public view returns (address)
  • Returns the liquidity pair contract address of the pair's index.

State-Changing Functions

transfer

function transfer(address _to, uint _value) public returns (bool)
  • KIP7 Standard

  • Method to transfer KSP tokens

transferFrom

function transferFrom(address _from, address _to, uint _value) public returns (bool)
  • KIP7 Standard

  • Method to transfer tokens on behalf of the approved wallet

approve

function approve(address _spender, uint _value) public returns (bool)
  • KIP7 Standard

  • Method to approve a transfer as much as value to spender

burn

function burn(uint amount) public
  • KIP7 Standard

  • Method to burn as much as value to spender

changePoolFee

function changePoolFee(address tokenA, address tokenB, uint fee) public
  • Method to change transaction fees for each liquidity pair

  • only owner

changeMiningRate

function changeMiningRate(address[] memory tokenA, address[] memory tokenB, uint[] memory rate) public
  • Method to change the mining weight per liquidity pair

  • All pairs for mining must be changed at once

  • The rate of each pair is between 1 and 100

  • The sum of rates for all pairs is 100

  • only owner

  • Parameters

    • tokenA : list of addresses of the first token pair

    • tokenB : list of addresses of the second token pair

    • rate : list of mining rate for a pair

createKlayPool

function createKlayPool(address token, uint amount, uint fee) public payable
  • A method called to add a liquidity pair with one side as KLAY

  • The wallet that calls this must have KSP greater than or equal to createFee

  • Token for when the KLAY-KIP7 pair to be registered has never been registered before

  • Parameters

    • token : KIP7 token address to add liquidity

    • amount : the amount of tokens (KIP7) to be provided for the initial liquidity

    • fee : Sets the initial fee value for liquidity pairs

      • A value between 30 and 100

      • Meaning: 30 -> 0.3%, 100 -> 1%

    • msg.value : KLAY quantity to initially supply liquidity

      • Delivers the transaction value without specifying otherwise

createKctPool

function createKctPool(address tokenA, uint amountA, address tokenB, uint amountB, uint fee) public
  • 양쪽 다 KIP7인 경우의 유동성 페어 추가를 위해 호출하는 method

  • createFee 이상의 KSP를 호출하는 지갑이 보유하고 있어야 함

  • 등록하려는 KIP7-KIP7 페어가 한번도 등록되지 않은 토큰 페어여야 함

  • parameter

    • tokenA : The address of the first token

    • amountA : The quantity of the first token that supplies the initial liquidity

    • tokenB : The address of the second token

    • amountB : The quantity of the second token that supplies the initial liquidity

    • fee : Sets the initial fee value for liquidity pairs

exchangeKlayPos

function exchangeKlayPos(address token, uint amount, address[] memory path) public payable
  • Method to call when token to be paid is KLAY and a POS transaction is desired

  • Parameters

    • token : Address of the KIP7 to be recieved

    • amount : the minimum amount tokens that you want to receive

      • If the amount of tokens to be received is lower than this amount, the Tx will fail.

    • path : list of token addresses to go through for routing transactions

      • If routing transaction is not needed, submit empty list

    • msg.value : KLAY quantity to be paid

exchangeKctPos

function exchangeKctPos(address tokenA, uint amountA, address tokenB, uint amountB, address[] memory path) public
  • Method called when the token to be paid is KIP7 and a POS transaction is desired

  • Parameters

    • tokenA : address of token to be paid

    • amountA : the amount of tokens to be paid

    • tokenB : address of token to be received

      • When KLAY, it is 0x0

    • amountB : the minimum amount of tokens that you want to receive

      • If the amount of tokens to be received is lower than this amount, the Tx will fail.

    • path :list of token addresses to go through for routing transactions

      • If routing transaction is not needed, submit empty list

exchangeKlayNeg

function exchangeKlayNeg(address token, uint amount, address[] memory path) public payable
  • Method for executing a NEG transaction by paying KLAY

  • Parameters

    • token : address of tokens to be received

    • amount : quantity of tokens to be received

    • path : list of token addresses to go through for routing transactions

      • If routing transaction is not needed, submit empty list

    • msg.value : maximum amount of payable KLAY

      • If more KLAY than the corresponding quantity needs to be paid, theTx will fail

      • the difference with KLAY used in the actual transaction is returned to msg.sender

exchangeKctNeg

function exchangeKctNeg(address tokenA, uint amountA, address tokenB, uint amountB, address[] memory path) public
  • Method for executing NEG transaction by paying KIP7

  • Parameters

    • tokenA : address of token to be paid

    • amountA : the maximum amount of tokenA that can be paid

      • If more tokenA than the corresponding amount is needed, the Tx will fail.

    • tokenB : address of the token to be received

      • For KLAY: 0x0

    • amountB : the amount of tokens to be received

    • path : list of token addresses to go through for routing transactions

      • If routing transaction is not needed, submit empty list

0xC6a2Ad8cC6e4A7E08FC37cC5954be07d499E7654