getShareOfPool

function getShareOfPool(
    address _token, 
    uint _amountDesired,  
    bool _owned
)external view returns (uint poolRatio)

스테이킹 지분율 구할 때 사용

Parameters

Type
Value
Description

address

_token

스테이킹 토큰 주소

uint

_amountDesired

스테이킹 토큰 개수

bool

_owned

소유중인 지분율 확인 여부 true : 소유중인 유동성 풀 지분율 false : 값에 의한 유동성 풀 지분

Return Values

Type
Value
Description

uint

poolRatio

지분 % 1만자리(백분율, 소수점2까지 표현)

Example

// 지분율 얻기(값에 의한)
await stakingRouterContract.getShareOfPool(
    mockToken0Contract.address,
    ethers.utils.parseEther("0.1"),
    false
)

// 결과 (0.99%의 영향도)
BigNumber { value: "99" }

// 지분율 얻기(소유중인)
await stakingRouterContract.getShareOfPool(
    mockToken0Contract.address,
    0,
    true
)

// 결과 (100%의 영향도)
BigNumber { value: "10000" }

2022.12.23

Last updated