View Source Uniswap.Contracts.SwapRouter (Uniswap v0.0.1-dev)

Uniswap's Swap Router V2

Summary

Functions

Default address of the contract. Returns nil if not specified.

Prepares contract constructor values for deployment.

Prepares exactInput((bytes,address,uint256,uint256,uint256) params) call parameters on the contract.

Prepares exactInputSingle((address,address,uint24,address,uint256,uint256,uint256,uint160) params) call parameters on the contract.

Prepares exactOutput((bytes,address,uint256,uint256,uint256) params) call parameters on the contract.

Prepares exactOutputSingle((address,address,uint24,address,uint256,uint256,uint256,uint160) params) call parameters on the contract.

Prepares factory() call parameters on the contract.

Prepares multicall(bytes[] data) call parameters on the contract.

Prepares refundETH() call parameters on the contract.

Prepares selfPermit(address token, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) call parameters on the contract.

Prepares selfPermitAllowed(address token, uint256 nonce, uint256 expiry, uint8 v, bytes32 r, bytes32 s) call parameters on the contract.

Prepares selfPermitAllowedIfNecessary(address token, uint256 nonce, uint256 expiry, uint8 v, bytes32 r, bytes32 s) call parameters on the contract.

Prepares selfPermitIfNecessary(address token, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) call parameters on the contract.

Prepares sweepToken(address token, uint256 amountMinimum, address recipient) call parameters on the contract.

Prepares sweepTokenWithFee(address token, uint256 amountMinimum, address recipient, uint256 feeBips, address feeRecipient) call parameters on the contract.

Prepares uniswapV3SwapCallback(int256 amount0Delta, int256 amount1Delta, bytes _data) call parameters on the contract.

Prepares unwrapWETH9(uint256 amountMinimum, address recipient) call parameters on the contract.

Prepares unwrapWETH9WithFee(uint256 amountMinimum, address recipient, uint256 feeBips, address feeRecipient) call parameters on the contract.

Prepares WETH9() call parameters on the contract.

Functions

@spec __default_address__() :: Ethers.Types.t_address()

Default address of the contract. Returns nil if not specified.

To specify a default address see Ethers.Contract

Link to this function

constructor(factory, weth9)

View Source

Prepares contract constructor values for deployment.

To deploy a contracts use Ethers.deploy/2 and pass the result of this function as :encoded_constructor option.

Parameters

  • _factory: :address
  • _WETH9: :address

Prepares exactInput((bytes,address,uint256,uint256,uint256) params) call parameters on the contract.

This function can be used for a transaction or additionally called for results (Use Ethers.send/2). It also supports receiving ether from the transaction origin.

State mutability: payable

Function Parameter Types

  • params: {:tuple, [:bytes, :address, {:uint, 256}, {:uint, 256}, {:uint, 256}]}

Return Types (when called with Ethers.call/2)

  • amountOut: {:uint, 256}
Link to this function

exact_input_single(params)

View Source

Prepares exactInputSingle((address,address,uint24,address,uint256,uint256,uint256,uint160) params) call parameters on the contract.

This function can be used for a transaction or additionally called for results (Use Ethers.send/2). It also supports receiving ether from the transaction origin.

State mutability: payable

Function Parameter Types

  • params: {:tuple, [:address, :address, {:uint, 24}, :address, {:uint, 256}, {:uint, 256}, {:uint, 256}, {:uint, 160}]}

Return Types (when called with Ethers.call/2)

  • amountOut: {:uint, 256}

Prepares exactOutput((bytes,address,uint256,uint256,uint256) params) call parameters on the contract.

This function can be used for a transaction or additionally called for results (Use Ethers.send/2). It also supports receiving ether from the transaction origin.

State mutability: payable

Function Parameter Types

  • params: {:tuple, [:bytes, :address, {:uint, 256}, {:uint, 256}, {:uint, 256}]}

Return Types (when called with Ethers.call/2)

  • amountIn: {:uint, 256}
Link to this function

exact_output_single(params)

View Source

Prepares exactOutputSingle((address,address,uint24,address,uint256,uint256,uint256,uint160) params) call parameters on the contract.

This function can be used for a transaction or additionally called for results (Use Ethers.send/2). It also supports receiving ether from the transaction origin.

State mutability: payable

Function Parameter Types

  • params: {:tuple, [:address, :address, {:uint, 24}, :address, {:uint, 256}, {:uint, 256}, {:uint, 256}, {:uint, 160}]}

Return Types (when called with Ethers.call/2)

  • amountIn: {:uint, 256}
@spec factory() :: Ethers.TxData.t()

Prepares factory() call parameters on the contract.

This function should only be called for result and never in a transaction on its own. (Use Ethers.call/2)

State mutability: view

Return Types (when called with Ethers.call/2)

  • :address
@spec multicall([binary()]) :: Ethers.TxData.t()

Prepares multicall(bytes[] data) call parameters on the contract.

This function can be used for a transaction or additionally called for results (Use Ethers.send/2). It also supports receiving ether from the transaction origin.

State mutability: payable

Function Parameter Types

  • data: {:array, :bytes}

Return Types (when called with Ethers.call/2)

  • results: {:array, :bytes}
@spec refund_eth() :: Ethers.TxData.t()

Prepares refundETH() call parameters on the contract.

This function can be used for a transaction or additionally called for results (Use Ethers.send/2). It also supports receiving ether from the transaction origin.

State mutability: payable

Return Types (when called with Ethers.call/2)

This function does not return any values!

Link to this function

self_permit(token, value, deadline, v, r, s)

View Source
@spec self_permit(
  Ethers.Types.t_address(),
  non_neg_integer(),
  non_neg_integer(),
  non_neg_integer(),
  <<_::256>>,
  <<_::256>>
) :: Ethers.TxData.t()

Prepares selfPermit(address token, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) call parameters on the contract.

This function can be used for a transaction or additionally called for results (Use Ethers.send/2). It also supports receiving ether from the transaction origin.

State mutability: payable

Function Parameter Types

  • token: :address
  • value: {:uint, 256}
  • deadline: {:uint, 256}
  • v: {:uint, 8}
  • r: {:bytes, 32}
  • s: {:bytes, 32}

Return Types (when called with Ethers.call/2)

This function does not return any values!

Link to this function

self_permit_allowed(token, nonce, expiry, v, r, s)

View Source
@spec self_permit_allowed(
  Ethers.Types.t_address(),
  non_neg_integer(),
  non_neg_integer(),
  non_neg_integer(),
  <<_::256>>,
  <<_::256>>
) :: Ethers.TxData.t()

Prepares selfPermitAllowed(address token, uint256 nonce, uint256 expiry, uint8 v, bytes32 r, bytes32 s) call parameters on the contract.

This function can be used for a transaction or additionally called for results (Use Ethers.send/2). It also supports receiving ether from the transaction origin.

State mutability: payable

Function Parameter Types

  • token: :address
  • nonce: {:uint, 256}
  • expiry: {:uint, 256}
  • v: {:uint, 8}
  • r: {:bytes, 32}
  • s: {:bytes, 32}

Return Types (when called with Ethers.call/2)

This function does not return any values!

Link to this function

self_permit_allowed_if_necessary(token, nonce, expiry, v, r, s)

View Source
@spec self_permit_allowed_if_necessary(
  Ethers.Types.t_address(),
  non_neg_integer(),
  non_neg_integer(),
  non_neg_integer(),
  <<_::256>>,
  <<_::256>>
) :: Ethers.TxData.t()

Prepares selfPermitAllowedIfNecessary(address token, uint256 nonce, uint256 expiry, uint8 v, bytes32 r, bytes32 s) call parameters on the contract.

This function can be used for a transaction or additionally called for results (Use Ethers.send/2). It also supports receiving ether from the transaction origin.

State mutability: payable

Function Parameter Types

  • token: :address
  • nonce: {:uint, 256}
  • expiry: {:uint, 256}
  • v: {:uint, 8}
  • r: {:bytes, 32}
  • s: {:bytes, 32}

Return Types (when called with Ethers.call/2)

This function does not return any values!

Link to this function

self_permit_if_necessary(token, value, deadline, v, r, s)

View Source
@spec self_permit_if_necessary(
  Ethers.Types.t_address(),
  non_neg_integer(),
  non_neg_integer(),
  non_neg_integer(),
  <<_::256>>,
  <<_::256>>
) :: Ethers.TxData.t()

Prepares selfPermitIfNecessary(address token, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) call parameters on the contract.

This function can be used for a transaction or additionally called for results (Use Ethers.send/2). It also supports receiving ether from the transaction origin.

State mutability: payable

Function Parameter Types

  • token: :address
  • value: {:uint, 256}
  • deadline: {:uint, 256}
  • v: {:uint, 8}
  • r: {:bytes, 32}
  • s: {:bytes, 32}

Return Types (when called with Ethers.call/2)

This function does not return any values!

Link to this function

sweep_token(token, amount_minimum, recipient)

View Source

Prepares sweepToken(address token, uint256 amountMinimum, address recipient) call parameters on the contract.

This function can be used for a transaction or additionally called for results (Use Ethers.send/2). It also supports receiving ether from the transaction origin.

State mutability: payable

Function Parameter Types

  • token: :address
  • amountMinimum: {:uint, 256}
  • recipient: :address

Return Types (when called with Ethers.call/2)

This function does not return any values!

Link to this function

sweep_token_with_fee(token, amount_minimum, recipient, fee_bips, fee_recipient)

View Source

Prepares sweepTokenWithFee(address token, uint256 amountMinimum, address recipient, uint256 feeBips, address feeRecipient) call parameters on the contract.

This function can be used for a transaction or additionally called for results (Use Ethers.send/2). It also supports receiving ether from the transaction origin.

State mutability: payable

Function Parameter Types

  • token: :address
  • amountMinimum: {:uint, 256}
  • recipient: :address
  • feeBips: {:uint, 256}
  • feeRecipient: :address

Return Types (when called with Ethers.call/2)

This function does not return any values!

Link to this function

uniswap_v3_swap_callback(amount0_delta, amount1_delta, data)

View Source
@spec uniswap_v3_swap_callback(integer(), integer(), binary()) :: Ethers.TxData.t()

Prepares uniswapV3SwapCallback(int256 amount0Delta, int256 amount1Delta, bytes _data) call parameters on the contract.

This function can be used for a transaction or additionally called for results (Use Ethers.send/2). No amount of Ether can be sent with this function.

State mutability: non_payable

Function Parameter Types

  • amount0Delta: {:int, 256}
  • amount1Delta: {:int, 256}
  • _data: :bytes

Return Types (when called with Ethers.call/2)

This function does not return any values!

Link to this function

unwrap_weth9(amount_minimum, recipient)

View Source

Prepares unwrapWETH9(uint256 amountMinimum, address recipient) call parameters on the contract.

This function can be used for a transaction or additionally called for results (Use Ethers.send/2). It also supports receiving ether from the transaction origin.

State mutability: payable

Function Parameter Types

  • amountMinimum: {:uint, 256}
  • recipient: :address

Return Types (when called with Ethers.call/2)

This function does not return any values!

Link to this function

unwrap_weth9_with_fee(amount_minimum, recipient, fee_bips, fee_recipient)

View Source

Prepares unwrapWETH9WithFee(uint256 amountMinimum, address recipient, uint256 feeBips, address feeRecipient) call parameters on the contract.

This function can be used for a transaction or additionally called for results (Use Ethers.send/2). It also supports receiving ether from the transaction origin.

State mutability: payable

Function Parameter Types

  • amountMinimum: {:uint, 256}
  • recipient: :address
  • feeBips: {:uint, 256}
  • feeRecipient: :address

Return Types (when called with Ethers.call/2)

This function does not return any values!

@spec weth9() :: Ethers.TxData.t()

Prepares WETH9() call parameters on the contract.

This function should only be called for result and never in a transaction on its own. (Use Ethers.call/2)

State mutability: view

Return Types (when called with Ethers.call/2)

  • :address