Search…
tradeByTargetAmountPermitted()
Trade the exact amount of target tokens for the least amount of source tokens possible

Function tradeByTargetAmountPermitted()

1
function tradeByTargetAmountPermitted(
2
Token sourceToken,
3
Token targetToken,
4
uint256 targetAmount,
5
uint256 maxSourceAmount,
6
uint256 deadline,
7
address beneficiary,
8
uint8 v,
9
bytes32 r,
10
bytes32 s
11
) external
Copied!
Trades to receive the exact amount of target tokens for as few source 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
targetAmount
uint256
The exact amount of tokens to receive
maxSourceAmount
uint256
The maximum amount of source tokens that can be used for the transaction not to 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