For the complete documentation index, see llms.txt. This page is also available as Markdown.

UniversalRouter

해당 컨트랙트는 V2 및 V3 풀을 사용하는 KLAYswap 라우터입니다. 이 계약은 V2 및 V3 풀에서 거래를 집계하여 사용자가 매우 유연하고 개인화된 거래에 액세스할 수 있도록 합니다.

Code

Github Link: (Will be updated after official launch)

Address

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

Parameter Structs

SwapParams

struct SwapParams {
    address to;
    address[] path;
    address[] pool;
    uint256 deadline;
}

Parameters:

Name
Type
Description

to

address

교환 후 토큰을 받게 될 주소

path

address[]

스왑 경로(토큰 주소 목록)

pool

address[]

스왑의 풀 경로(풀 주소 목록) v2 pool 사용 시 : address(0) v3 pool 사용 시 : v3 풀 주소

deadline

uint256

deadline

Read-Only Functions

getAmountsOut

function getAmountsOut(
    uint256 amountIn, 
    address[] memory path, 
    address[] memory pool
) public view returns (
    uint256[] memory amounts
)

Parameters:

Name
Type
Description

amountIn

uint256

지불해야 하는 첫 번째 토큰의 양

path

address[]

스왑 경로(토큰 주소 목록)

pool

address[]

스왑의 풀 경로(풀 주소 목록) v2 pool 사용 시 : address(0) v3 pool 사용 시 : v3 풀 주소

Return Values:

Name
Type
Description

amounts

uint256[]

입력 토큰 금액 및 모든 후속 출력 토큰 금액.

getAmountsIn

function getAmountsIn(
    uint256 amountOut, 
    address[] memory path, 
    address[] memory pool
) public view returns (
    uint256[] memory amounts
)

Parameters:

Name
Type
Description

amountOut

uint256

마지막으로 받을 토큰의 양

path

address[]

스왑 경로(토큰 주소 목록)

pool

address[]

스왑의 풀 경로(풀 주소 목록) v2 pool 사용 시 : address(0) v3 pool 사용 시 : v3 풀 주소

Return Values:

Name
Type
Description

amounts

uint256[]

입력 토큰 금액 및 모든 후속 출력 토큰 금액.

State-Changing Functions

swapExactTokensForTokens

경로에 의해 결정된 경로를 따라 가능한 한 많은 출력 토큰에 대해 정확한 양의 입력 토큰을 교환합니다.

Parameters:

Name
Type
Description

amountIn

uint256

지불할 입력 토큰의 양

amountOutMin

uint256

트랜잭션이 되돌리지 않기 위해 받아야 하는 출력 토큰의 최소량

p

struct SwapParams

스왑을 위한 struct SwapParams

Return Values:

Name
Type
Description

amounts

uint256[]

입력 토큰 금액 및 모든 후속 출력 토큰 금액.

swapTokensForExactTokens

경로에 의해 결정된 경로를 따라 가능한 한 적은 입력 토큰에 대해 정확한 양의 출력 토큰을 받습니다.

Parameters:

Name
Type
Description

amountOut

uint256

받을 출력 토큰의 양

amountInMax

uint256

트랜잭션이 되돌리기 전에 필요할 수 있는 입력 토큰의 최대 양

p

struct SwapParams

스왑을 위한 struct SwapParams

Return Values:

Name
Type
Description

amounts

uint256[]

입력 토큰 금액 및 모든 후속 출력 토큰 금액.

swapExactETHForTokens

경로에 의해 결정된 경로를 따라 가능한 한 많은 출력 토큰에 대해 정확한 양의 ETH를 교환합니다.

Parameters:

Name
Type
Description

msg.value

uint256

지불할 ETH 금액

amountOutMin

uint256

트랜잭션이 되돌리지 않기 위해 받아야 하는 출력 토큰의 최소량

p

struct SwapParams

스왑을 위한 struct SwapParams

Return Values:

Name
Type
Description

amounts

uint256[]

입력 토큰 금액 및 모든 후속 출력 토큰 금액.

swapTokensForExactETH

경로에 의해 결정된 경로를 따라 가능한 한 적은 입력 토큰에 대해 정확한 양의 ETH를 받습니다.

Parameters:

Name
Type
Description

amountOut

uint256

받을 ETH 금액

amountInMax

uint256

트랜잭션이 되돌리기 전에 필요할 수 있는 입력 토큰의 최대 양

p

struct SwapParams

스왑을 위한 struct SwapParams

Return Values:

Name
Type
Description

amounts

uint256[]

입력 토큰 금액 및 모든 후속 출력 토큰 금액.

swapExactTokensForETH

경로에 의해 결정된 경로를 따라 가능한 한 많은 ETH에 대해 정확한 양의 토큰을 스왑합니다.

Parameters:

Name
Type
Description

amountIn

uint256

지불할 입력 토큰의 양

amountOutMin

uint256

트랜잭션이 되돌리지 않기 위해 받아야 하는 출력 토큰의 최소량

p

struct SwapParams

스왑을 위한 struct SwapParams

Return Values:

Name
Type
Description

amounts

uint256[]

입력 토큰 금액 및 모든 후속 출력 토큰 금액.

swapETHForExactTokens

경로에 의해 결정된 경로를 따라 가능한 한 많은 ETH에 대해 정확한 양의 토큰을 스왑합니다.

Parameters:

Name
Type
Description

amountOut

uint256

받을 토큰의 양

msg.value (amountInMax)

uint256

트랜잭션을 되돌리기 전에 요구할 수 있는 최대 ETH 금액

p

struct SwapParams

스왑을 위한 struct SwapParams

Return Values:

Name
Type
Description

amounts

uint256[]

입력 토큰 금액 및 모든 후속 출력 토큰 금액.

Last updated