swapTokensForExactETH

function swapTokensForExactETH(
    uint _amountOut, 
    uint _amountInMax, 
    address[] calldata _path, 
    address _to, 
    uint _deadline
) external virtual ensure(_deadline) returns (uint[] memory amounts)

ํ† ํฐ->์ฝ”์ธ์œผ๋กœ swap (TO->FROM)

โ€ป ์ฝ”์ธ์€ msg.value ํ˜•ํƒœ๋กœ ์ถ”๊ฐ€

Parameters

Return Values

Example

// ํ† ํฐ ๊ฑฐ๋ž˜์— ๋Œ€ํ•œ ํ—ˆ์šฉ
await mockToken0Contract.approve(routerContract.address, MaxUint256)

// swap
await swapRouterContract.swapTokensForExactETH(
    5000,
    MaxUint256,
    [mockToken0Contract.address, WMATICContract.address],
    accounts[0].address,
    MaxUint256,
    overrides
)

2022.12.22

Last updated