Search…
About Bancor Network
Bancor V3
Bancor Basics
Resources
Token Whitelisting Requirements
Security & Audits
Developer Guides
Contracts
Write Functions
Transaction Prerequisites
Trading
tradeBySourceAmount()
tradeByTargetAmount()
tradeBySourceAmountPermitted()
tradeByTargetAmountPermitted()
Trading Troubleshooting
Adding Liquidity
Removing Liquidity
Flashloan
Migrating Liquidity to v3
Read Functions
Data & Events
Other Guides
Bancor Vortex Burner
Bancor V3 Beta Tutorial
Migration to V3 Tutorial
Marketing
Brand Guide
Powered By
GitBook
tradeBySourceAmount()
Trade an exact amount of source tokens for as many target tokens as possible
Function
tradeBySourceAmount()
BancorNetwork.sol
1
function
tradeBySourceAmount
(
2
Token sourceToken
,
3
Token targetToken
,
4
uint256
sourceAmount
,
5
uint256
minReturnAmount
,
6
uint256
deadline
,
7
address
beneficiary
8
)
external
payable
Copied!
Trades the exact amount of
source
tokens for as many
target
tokens as possible.
Function Arguments
Name
Type
Description
sourceToken
Token
The source token address
targetToken
Token
The target token address
sourceAmount
uint256
The amount of source tokens
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
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
Previous
Trading
Next
tradeByTargetAmount()
Last modified
1mo ago
Copy link
Contents
Function tradeBySourceAmount()
Function Arguments