Search…
tradeBySourceAmountPermitted()
Trade the exact amount of source tokens for the most target tokens

Function tradeBySourceAmountPermitted()

1
function tradeBySourceAmountPermitted(
2
Token sourceToken,
3
Token targetToken,
4
uint256 sourceAmount,
5
uint256 minReturnAmount,
6
uint256 deadline,
7
address beneficiary,
8
uint8 v,
9
bytes32 r,
10
bytes32 s
11
) external
Copied!
Trades the exact amount of source tokens for as many target tokens as possible. Using this requires the user approving the transaction using the permit() function. See permit() for details.

Function Arguments

Name
Type
Description
sourceToken
Token
The source token address
targetToken
Token
The target token address
sourceAmount
uint256
The amount of tokens to trade out of
minReturnAmount
uint256
The minimum amount of target tokens that must be received for the transaction to not revert
deadline
uint256
Unix timestamp after which the transaction will revert
beneficiary
address
The address receiving the target tokens
v
uint8
Must produce valid secp256k1 signature from the holder along with r and s
r
bytes32
Must produce valid secp256k1 signature from the holder along with v and s
s
bytes32
Must produce valid secp256k1 signature from the holder along with r and v
See Errors and Troubleshooting for a list of common errors and how to resolve them.
To trade directly with the Ether token, use the contract address: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE