swapExactTokensForETH

This method swaps an exact amount of one ERC20 token (_token0) for ether.

Function

function swapExactTokensForETH(
    address _to,
    address _token,
    uint _amountIn,
    uint _amountOutMin,
    uint _deadline
  ) external returns (uint output);

Parameters

ParameterDescription

_to

The address of the recipient.

_token0

An ERC20 token address.

_amountIn

The amount of _token0 to be swapped.

_amountOutMin

The minimal amount of ether that the user will accept for a given amount of _amountIn.

_deadline

The UTC timestamp that if reached, causes the swap transaction to fail automatically.

Return values

ValueDescription

uint _val

The amount of _token1 returned.

Last updated