BancorX (ETH)
This contract allows cross chain token transfers.
There are two processes that take place in the contract -
Initiate a cross chain transfer to a target blockchain (locks tokens from the caller account on Ethereum)
Report a cross chain transfer initiated on a source blockchain (releases tokens to an account on Ethereum)
Reporting cross chain transfers works similar to standard multisig contracts, meaning that multiple
callers are required to report a transfer before tokens are released to the target account.
Functions:
Events:
Function constructor(uint256 _maxLockLimit, uint256 _maxReleaseLimit, uint256 _minLimit, uint256 _limitIncPerBlock, uint8 _minRequiredReports, contract IContractRegistry _registry, contract IERC20 _token)
constructor(uint256 _maxLockLimit, uint256 _maxReleaseLimit, uint256 _minLimit, uint256 _limitIncPerBlock, uint8 _minRequiredReports, contract IContractRegistry _registry, contract IERC20 _token)
initializes a new BancorX instance
Parameters:
_maxLockLimit
: maximum amount of tokens that can be locked in one transaction_maxReleaseLimit
: maximum amount of tokens that can be released in one transaction_minLimit
: minimum amount of tokens that can be transferred in one transaction_limitIncPerBlock
: how much the limit increases per block_minRequiredReports
: minimum number of reporters to report transaction before tokens can be released_registry
: address of contract registry_token
: erc20 token
Function setMaxLockLimit(uint256 _maxLockLimit)
setMaxLockLimit(uint256 _maxLockLimit)
setter
Parameters:
_maxLockLimit
: new maxLockLimit
Function setMaxReleaseLimit(uint256 _maxReleaseLimit)
setMaxReleaseLimit(uint256 _maxReleaseLimit)
setter
Parameters:
_maxReleaseLimit
: new maxReleaseLimit
Function setMinLimit(uint256 _minLimit)
setMinLimit(uint256 _minLimit)
setter
Parameters:
_minLimit
: new minLimit
Function setLimitIncPerBlock(uint256 _limitIncPerBlock)
setLimitIncPerBlock(uint256 _limitIncPerBlock)
setter
Parameters:
_limitIncPerBlock
: new limitIncPerBlock
Function setMinRequiredReports(uint8 _minRequiredReports)
setMinRequiredReports(uint8 _minRequiredReports)
setter
Parameters:
_minRequiredReports
: new minRequiredReports
Function setReporter(address _reporter, bool _active)
setReporter(address _reporter, bool _active)
allows the owner to set/remove reporters
Parameters:
_reporter
: reporter whos status is to be set_active
: true if the reporter is approved, false otherwise
Function enableXTransfers(bool _enable)
enableXTransfers(bool _enable)
allows the owner enable/disable the xTransfer method
Parameters:
_enable
: true to enable, false to disable
Function enableReporting(bool _enable)
enableReporting(bool _enable)
allows the owner enable/disable the reportTransaction method
Parameters:
_enable
: true to enable, false to disable
Function upgrade(address[] _reporters)
upgrade(address[] _reporters)
upgrades the contract to the latest version
can only be called by the owner
note that the owner needs to call acceptOwnership on the new contract after the upgrade
Parameters:
_reporters
: new list of reporters
Function xTransfer(bytes32 _toBlockchain, bytes32 _to, uint256 _amount)
xTransfer(bytes32 _toBlockchain, bytes32 _to, uint256 _amount)
claims tokens from msg.sender to be converted to tokens on another blockchain
Parameters:
_toBlockchain
: blockchain on which tokens will be issued_to
: address to send the tokens to_amount
: the amount of tokens to transfer
Function xTransfer(bytes32 _toBlockchain, bytes32 _to, uint256 _amount, uint256 _id)
xTransfer(bytes32 _toBlockchain, bytes32 _to, uint256 _amount, uint256 _id)
claims tokens from msg.sender to be converted to tokens on another blockchain
Parameters:
_toBlockchain
: blockchain on which tokens will be issued_to
: address to send the tokens to_amount
: the amount of tokens to transfer_id
: pre-determined unique (if non zero) id which refers to this transaction
Function reportTx(bytes32 _fromBlockchain, uint256 _txId, address _to, uint256 _amount, uint256 _xTransferId)
reportTx(bytes32 _fromBlockchain, uint256 _txId, address _to, uint256 _amount, uint256 _xTransferId)
allows reporter to report transaction which occured on another blockchain
Parameters:
_fromBlockchain
: blockchain in which tokens were destroyed_txId
: transactionId of transaction thats being reported_to
: address to receive tokens_amount
: amount of tokens destroyed on another blockchain_xTransferId
: unique (if non zero) pre-determined id (unlike _txId which is determined after the transactions been mined)
Function getXTransferAmount(uint256 _xTransferId, address _for) → uint256
getXTransferAmount(uint256 _xTransferId, address _for) → uint256
gets x transfer amount by xTransferId (not txId)
Parameters:
_xTransferId
: unique (if non zero) pre-determined id (unlike _txId which is determined after the transactions been broadcasted)_for
: address corresponding to xTransferId
Return Values:
amount that was sent in xTransfer corresponding to _xTransferId
Function getCurrentLockLimit() → uint256
getCurrentLockLimit() → uint256
method for calculating current lock limit
Return Values:
the current maximum limit of tokens that can be locked
Function getCurrentReleaseLimit() → uint256
getCurrentReleaseLimit() → uint256
method for calculating current release limit
Return Values:
the current maximum limit of tokens that can be released
Event TokensLock(address _from, uint256 _amount)
TokensLock(address _from, uint256 _amount)
triggered when tokens are locked in smart contract
Parameters:
_from
: wallet address that the tokens are locked from_amount
: amount locked
Event TokensRelease(address _to, uint256 _amount)
TokensRelease(address _to, uint256 _amount)
triggered when tokens are released by the smart contract
Parameters:
_to
: wallet address that the tokens are released to_amount
: amount released
Event XTransfer(address _from, bytes32 _toBlockchain, bytes32 _to, uint256 _amount, uint256 _id)
XTransfer(address _from, bytes32 _toBlockchain, bytes32 _to, uint256 _amount, uint256 _id)
triggered when xTransfer is successfully called
Parameters:
_from
: wallet address that initiated the xtransfer_toBlockchain
: target blockchain_to
: target wallet_amount
: transfer amount_id
: xtransfer id
Event TxReport(address _reporter, bytes32 _fromBlockchain, uint256 _txId, address _to, uint256 _amount, uint256 _xTransferId)
TxReport(address _reporter, bytes32 _fromBlockchain, uint256 _txId, address _to, uint256 _amount, uint256 _xTransferId)
triggered when report is successfully submitted
Parameters:
_reporter
: reporter wallet_fromBlockchain
: source blockchain_txId
: tx id on the source blockchain_to
: target wallet_amount
: transfer amount_xTransferId
: xtransfer id
Event XTransferComplete(address _to, uint256 _id)
XTransferComplete(address _to, uint256 _id)
triggered when final report is successfully submitted
Parameters:
_to
: target wallet_id
: xtransfer id
Last updated