Router
#
Functions#
constructor#
receive#
factoryreturns factory address
#
WETHreturns WETH address
#
flashAccepts payment from msg.sender
in the requested token
and calls the corresponding smart contract that implements
the ISfpyCallback
interface.
If the callee is successful, it mints liquidity to the owner
of the flash app contract
#
Parameters:Name | Type | Description |
---|---|---|
token | address | the contract address of the token being used |
tokenAmount | uint256 | the amount of tokenAmount sent |
to | address | the recipient of the minted liquidity. Usually the same address that controls the Flash App |
callback | address | the address of the smart contract that implements the ISfpyCallback interface |
deadline | uint256 | Unix timestamp after which the transaction will revert. |
data | bytes | any aribitrary data needed to execute the Flash App |
#
paySends tokens to a pool designated for a particular address
adds liquidity to an ERC-20 pool. To cover all possible
scenarios msg.sender
should have already given the router
an allowance of at least tokenAmount
on token
#
Parameters:Name | Type | Description |
---|---|---|
token | address | the contract address of the token being used in the payment |
tokenAmount | uint256 | the amount of tokenAmount being paid |
rate | uint256 | a belief of the value of the token in a fiat currency - the exchange rate |
request | bytes32 | an external ID of a payment request |
to | address | recipient of the payment. |
deadline | uint256 | Unix timestamp after which the transaction will revert. |
#
refundRemoves liquidity from an ERC-20 pool and sends the underlying
tokens to the recipient. To cover all possible
scenarios msg.sender
should have already given the router
an allowance of at least the required liquidity to burn
#
Parameters:Name | Type | Description |
---|---|---|
token | address | the contract address of the token being used in the payment |
tokenAmount | uint256 | the amount of tokenAmount being paid |
payment | bytes32 | an external ID of a payment |
to | address | recipient of the payment. |
deadline | uint256 | Unix timestamp after which the transaction will revert. |
#
payETHSends tokens to a pool designated for a particular address
when a payment needs to be made using ETH.
Adds liquidity to a WETH pool.
msg.value
is treated as the amount of ETH being paid.
#
Parameters:Name | Type | Description |
---|---|---|
request | bytes32 | an external ID of a payment request |
to | address | recipient of the payment. |
rate | uint256 | a belief of the value of ETH in a fiat currency - the exchange rate |
deadline | uint256 | Unix timestamp after which the transaction will revert. |
#
refundETHRemoves liquidity from a WETH pool and sends the underlying
ETH to the recipient.
To cover all possible scenarios msg.sender
should have already given the router
an allowance of at least the required liquidity to burn
#
Parameters:Name | Type | Description |
---|---|---|
payment | bytes32 | an external ID of a payment |
tokenAmount | uint256 | the amount of tokenAmount being paid |
to | address | recipient of the payment. |
deadline | uint256 | Unix timestamp after which the transaction will revert. |
#
withdrawRemoves liquidity from an ERC-20 pool and converts liquidity into the underlying token which is sent to the recipient
#
Parameters:Name | Type | Description |
---|---|---|
token | address | the contract address of the desired token. |
liquidity | uint256 | the amount of liquidity tokens to remove. |
amountMin | uint256 | the minimum amount of token that must be received for the transaction not to revert. |
to | address | recipient of the underlying assets. |
deadline | uint256 | Unix timestamp after which the transaction will revert. |
#
withdrawETHRemoves liquidity from a WETH pool and converts liquidity into ETH which is sent to the recipient
#
Parameters:Name | Type | Description |
---|---|---|
liquidity | uint256 | the amount of liquidity tokens to remove. |
amountMin | uint256 | the minimum amount of token that must be received for the transaction not to revert. |
to | address | recipient of the underlying assets. |
deadline | uint256 | Unix timestamp after which the transaction will revert. |
#
refundWithPermitRemoves liquidity from an ERC-20 pool and sends the underlying
tokens to the recipient, without pre-approval using EIP 712 signatures
#
Parameters:Name | Type | Description |
---|---|---|
token | address | the contract address of the token being used in the payment |
tokenAmount | uint256 | the amount of tokenAmount being refunded |
payment | bytes32 | an external ID of a payment |
to | address | recipient of the payment. |
deadline | uint256 | Unix timestamp after which the transaction will revert. |
approveMax | bool | Whether or not the approval amount in the signature is for liquidity or 2**256 |
v | uint8 | The v component of the permit signature. |
r | bytes32 | The r component of the permit signature. |
s | bytes32 | The s component of the permit signature. |
#
withdrawWithPermitRemoves liquidity from an ERC-20 pool and converts liquidity into the underlying token, without pre-approval using EIP 712 signatures
#
Parameters:Name | Type | Description |
---|---|---|
token | address | the contract address of the desired token. |
liquidity | uint256 | the amount of liquidity tokens to remove. |
amountMin | uint256 | the minimum amount of token that must be received for the transaction not to revert. |
to | address | recipient of the underlying assets. |
deadline | uint256 | Unix timestamp after which the transaction will revert. |
approveMax | bool | Whether or not the approval amount in the signature is for liquidity or 2**256 |
v | uint8 | The v component of the permit signature. |
r | bytes32 | The r component of the permit signature. |
s | bytes32 | The s component of the permit signature. |
#
withdrawETHWithPermitRemoves liquidity from a WETH pool and converts liquidity into ETH, without pre-approval using EIP 712 signatures
#
Parameters:Name | Type | Description |
---|---|---|
liquidity | uint256 | the amount of liquidity tokens to remove. |
amountMin | uint256 | the minimum amount of token that must be received for the transaction not to revert. |
to | address | recipient of the underlying assets. |
deadline | uint256 | Unix timestamp after which the transaction will revert. |
approveMax | bool | Whether or not the approval amount in the signature is for liquidity or 2**256 |
v | uint8 | The v component of the permit signature. |
r | bytes32 | The r component of the permit signature. |
s | bytes32 | The s component of the permit signature. |
#
refundETHWithPermitRemoves liquidity from a WETH pool and sends the underlying
ETH to the recipient, without pre-approval using EIP 712 signatures
#
Parameters:Name | Type | Description |
---|---|---|
tokenAmount | bytes32 | the amount of tokenAmount being refunded |
payment | uint256 | an external ID of a payment |
to | address | recipient of the payment. |
deadline | uint256 | Unix timestamp after which the transaction will revert. |
approveMax | bool | Whether or not the approval amount in the signature is for liquidity or 2**256 |
v | uint8 | The v component of the permit signature. |
r | bytes32 | The r component of the permit signature. |
s | bytes32 | The s component of the permit signature. |