getLiquidityValue

function getLiquidityValue(
    address _tokenA,
    address _tokenB,
    uint256 _liquidityAmount
) external view returns (
    uint256 tokenAAmount,
    uint256 tokenBAmount
)

์œ ๋™์„ฑ ํ’€ Token์„ ํ†ตํ•ด ๊ฐ ํ† ํฐ์˜ ๊ฐœ์ˆ˜๋ฅผ ์–ป์„ ๋•Œ ์‚ฌ์šฉ

Parameters

TypeValueDescription

address

_tokenA

LP ํ† ํฐA ์ฃผ์†Œ

address

_tokenB

LP ํ† ํฐB ์ฃผ์†Œ

uint256

_liquidityAmount

LP ํ† ํฐ ๊ฐœ์ˆ˜

Return Values

TypeValueDescription

uint256

tokenAAmount

tokenA์˜ ๊ฐœ์ˆ˜

uint256

tokenBAmount

tokenB์˜ ๊ฐœ์ˆ˜

Example

// ์œ ๋™์„ฑํ’€์„ ํ†ตํ•œ ํ† ํฐ ๊ฐœ์ˆ˜ ์–ป๊ธฐ
await ComputeContract.connect(accounts[0]).getLiquidityValue(
    mockToken0Contract.address,
    mockToken1Contract.address,
    1000000
)

// ๊ฒฐ๊ณผ (ํ† ํฐA, ํ† ํฐB ๊ฐœ์ˆ˜)
[ BigNumber { value: "1414213" }, BigNumber { value: "707106" } ]

2022.12.22

Last updated