Search…
About Bancor Network
Bancor V3
Bancor Basics
Resources for DAOs
Security & Audits
Contracts & Functions
Contracts
Write Functions
Read Functions
Rewards
Liquidity Pool Details
Trades
tradeOutputBySourceAmount()
tradeInputByTargetAmount()
tradingEnabled()
tradingFeePMM()
Withdrawals
Pool Token Information
Vortex
Data & Events
Developer Guides
Bancor Vortex Burner
Bancor Etherscan Guide
REST API
Marketing
Brand Guide
Powered By
GitBook
tradeInputByTargetAmount()
Function tradeInputByTargetAmount()
BancorNetworkInfo.sol
1
function
tradeInputByTargetAmount
(
Token sourceToken
,
Token targetToken
,
uint256 targetAmount
)
2
external view
validTokensForTrade
(
sourceToken
,
targetToken
)
greaterThanZero
(
targetAmount
)
3
returns
(
uint256
)
Copied!
This function is used to determine how many source tokens need to be swapped to receive a specific number of target tokens.
For example, this could be used to determine how many ETH would be required to swap for 1000 LINK.
Function Arguments
Name
Type
Description
sourceToken
Token
The token being sold.
targetToken
Token
The token being bought.
targetAmount
uint256
The number of target tokens desired to be received.
Return Variables
This function returns the number of source tokens required to be swapped to receive a specific number of target tokens.
Variable Type
Returns
uint256
The number of source tokens required to receive a specific number of target tokens.
Previous
tradeOutputBySourceAmount()
Next
tradingEnabled()
Last modified
19d ago
Copy link
Contents
Function tradeInputByTargetAmount()
Function Arguments
Return Variables