This contract is the main entry point for Bancor token conversions.
It also allows for the conversion of any token in the Bancor Network to any other token in a single
transaction by providing a conversion path.
A note on Conversion Path: Conversion path is a data structure that is used when converting a token
to another token in the Bancor Network, when the conversion cannot necessarily be done by a single
converter and might require multiple 'hops'.
The path defines which converters should be used and what kind of conversion should be done in each step.
The path format doesn't include complex structure; instead, it is represented by a single array
in which each 'hop' is represented by a 2-tuple - converter anchor & target token.
In addition, the first element is always the source token.
The converter anchor is only used as a pointer to a converter (since converter addresses are more
likely to change as opposed to anchor addresses).
Format:
[source token, converter anchor, target token, converter anchor, target token...]
initializes a new BancorNetwork instance
_registry
: address of a contract registry contract
allows the owner to update the maximum affiliate-fee
_maxAffiliateFee
: maximum affiliate-fee
allows the owner to register/unregister ether tokens
_token
: ether token contract address
_register
: true to register, false to unregister
returns the conversion path between two tokens in the network
note that this method is quite expensive in terms of gas and should generally be called off-chain
_sourceToken
: source token address
_targetToken
: target token address
conversion path between the two tokens
returns the expected target amount of converting a given amount on a given path
note that there is no support for circular paths
_path
: conversion path (see conversion path format above)
_amount
: amount of _path[0] tokens received from the sender
expected target amount
converts the token to any other token in the bancor network by following
a predefined conversion path and transfers the result tokens to a target account
affiliate account/fee can also be passed in to receive a conversion fee (on top of the liquidity provider fees)
note that the network should already have been given allowance of the source token (if not ETH)
_path
: conversion path, see conversion path format above
_amount
: amount to convert from, in the source token
_minReturn
: if the conversion results in an amount smaller than the minimum return - it is cancelled, must be greater than zero
_beneficiary
: account that will receive the conversion result or 0x0 to send the result to the sender account
_affiliateAccount
: wallet address to receive the affiliate fee or 0x0 to disable affiliate fee
_affiliateFee
: affiliate fee in PPM or 0 to disable affiliate fee
amount of tokens received from the conversion
converts any other token to BNT in the bancor network by following
a predefined conversion path and transfers the result to an account on a different blockchain
note that the network should already have been given allowance of the source token (if not ETH)
_path
: conversion path, see conversion path format above
_amount
: amount to convert from, in the source token
_minReturn
: if the conversion results in an amount smaller than the minimum return - it is cancelled, must be greater than zero
_targetBlockchain
: blockchain BNT will be issued on
_targetAccount
: address/account on the target blockchain to send the BNT to
_conversionId
: pre-determined unique (if non zero) id which refers to this transaction
the amount of BNT received from this conversion
converts any other token to BNT in the bancor network by following
a predefined conversion path and transfers the result to an account on a different blockchain
note that the network should already have been given allowance of the source token (if not ETH)
_path
: conversion path, see conversion path format above
_amount
: amount to convert from, in the source token
_minReturn
: if the conversion results in an amount smaller than the minimum return - it is cancelled, must be greater than zero
_targetBlockchain
: blockchain BNT will be issued on
_targetAccount
: address/account on the target blockchain to send the BNT to
_conversionId
: pre-determined unique (if non zero) id which refers to this transaction
_affiliateAccount
: affiliate account
_affiliateFee
: affiliate fee in PPM
the amount of BNT received from this conversion
allows a user to convert a token that was sent from another blockchain into any other
token on the BancorNetwork
ideally this transaction is created before the previous conversion is even complete, so
so the input amount isn't known at that point - the amount is actually take from the
BancorX contract directly by specifying the conversion id
_path
: conversion path
_bancorX
: address of the BancorX contract for the source token
_conversionId
: pre-determined unique (if non zero) id which refers to this conversion
_minReturn
: if the conversion results in an amount smaller than the minimum return - it is cancelled, must be nonzero
_beneficiary
: wallet to receive the conversion result
amount of tokens received from the conversion
deprecated, backward compatibility
deprecated, backward compatibility
deprecated, backward compatibility
deprecated, backward compatibility
deprecated, backward compatibility
deprecated, backward compatibility
deprecated, backward compatibility
deprecated, backward compatibility
deprecated, backward compatibility
triggered when a conversion between two tokens occurs
_smartToken
: anchor governed by the converter
_fromToken
: source ERC20 token
_toToken
: target ERC20 token
_fromAmount
: amount converted, in the source token
_toAmount
: amount returned, minus conversion fee
_trader
: wallet that initiated the trade