Contract 0x5039d9b575bd5722d310af6d2fc11e053c6d03da

Bancor 

 

TxHash Block Age From To Value [TxFee]
0xc50844fd343b4046de5726c15af9c2639bc4737e1cff9f57e18979c4a343a22672297106 hrs 1 min ago0xaedfcc68372de2bfea371ada3289ef6f6a53f99d  IN   BancorConverter_#1970 Ether0.0023607305
0xf68b7fee797cec72f87662df48ef87e57855752d0a29b6331addad61790f27e072296856 hrs 6 mins ago0x3dee4a4e076e8d82859d241db0baf46f112cfa23  IN   BancorConverter_#1970 Ether0.0023609684
0x0719d95eff3d3753b7348712d3b6460edca61fee32c477df4fd2d1b6a4e9113a72296856 hrs 6 mins ago0xaedfcc68372de2bfea371ada3289ef6f6a53f99d  IN   BancorConverter_#1970 Ether0.0024526209
0xe91f14ba4af809d819a3552d988131cbc48a45804bd1110fdf3f16fb8333b98672296496 hrs 17 mins ago0xaedfcc68372de2bfea371ada3289ef6f6a53f99d  IN   BancorConverter_#1970 Ether0.0024526209
0x473a598056a047d84df1096acdeb8b9c1ddf754154bec2c0a5b84f595d09326372296076 hrs 30 mins ago0x7059010320d07a47d2ad54db88bb89ea644c3e6f  IN   BancorConverter_#1970 Ether0.0018474699
0xdf60722ae6bd6aa602cb3b428a8ca77df0909e9393296f3894b5b4834cba7aa172295926 hrs 36 mins ago0x3cd4be83e14c24b063480ab4fa36c49b8df3467f  IN   BancorConverter_#1970 Ether0.0024510593
0x7ae8d0412128193e785ad063d7cb17bf05cae54b6551a6b76d508cbfe980620a72295896 hrs 37 mins ago0xaedfcc68372de2bfea371ada3289ef6f6a53f99d  IN   BancorConverter_#1970 Ether0.0024534017
0x86b7aea04a230455ca95d9430ef46c77af32da638ed2aaca196b3b573397ea5a722821014 hrs 25 mins ago0x3dee4a4e076e8d82859d241db0baf46f112cfa23  IN   BancorConverter_#1970 Ether0.0046076443
0xc642e953a59f2028b3ccd20a91ee31f308a552d3d5b441d7133f864d64ef25ab722805715 hrs 20 mins ago0xe20d86ba369ce570754367d8dcb0715dc70b3c95  IN   BancorConverter_#1970 Ether0.004519042
0x553fe62d3a8462e6032d6db7dfd03334fa221ecf614d4a5d28aa5ce42f95f341722779016 hrs 49 mins ago0xe20d86ba369ce570754367d8dcb0715dc70b3c95  IN   BancorConverter_#1970 Ether0.004086466334
0x1ba1f1743365bea86c29f7567dcd227220be3d501193e552a84aaf463975ae9b722778516 hrs 51 mins ago0xf1073872c0f3888fe00ca24791422ca0ad42af79  IN   BancorConverter_#1970 Ether0.003940991869
0xd1ccac20693a21496c5cbf55f6c855512ed532aaf57bc50a1fae353278f48f8e722768017 hrs 29 mins ago0xe89a602316ded9b9f283b4b67f5c4969df8861b6  IN   BancorConverter_#1970 Ether0.003620349
0x14f5ec93821160d6edd1949b2c92d51003f31cd97ff7210d19020f5e2399b3da722759417 hrs 51 mins ago0xba2bdef55e002be35bb1be787c0c9e95781e0ca6  IN   BancorConverter_#1970 Ether0.00387261
0x38bc8bbfc496953b2b9af60f9e04a313257ca49c2a75a24aaf462c9a08dc067e722756418 hrs 3 mins ago0xaedfcc68372de2bfea371ada3289ef6f6a53f99d  IN   BancorConverter_#1970 Ether0.00402069
0x938654c933f96e53c094df0b1cd8179bca5e052c6fb01ad3167d0aae27b9ff83722747818 hrs 29 mins ago0x0dc411b17d337af85d83ea5a3577d09132aae866  IN   BancorConverter_#1970 Ether0.00387261
0xb874fed55ead3155a91de60d140b6ab357f3dfb3457b5a70220f9b330d67bc2d722747118 hrs 31 mins ago0xaedfcc68372de2bfea371ada3289ef6f6a53f99d  IN   BancorConverter_#1970 Ether0.00402197
0x15a698d61a4860933518ea99d64f58669bb884d17688c3b4879395190f92adf1722742618 hrs 43 mins ago0x7059010320d07a47d2ad54db88bb89ea644c3e6f  IN   BancorConverter_#1970 Ether0.003485349
0x43fd0961694e7a7c652b0b593a8b5eb7a8200822aa59ecff9b3a3e3f8258340d722741218 hrs 47 mins ago0xaedfcc68372de2bfea371ada3289ef6f6a53f99d  IN   BancorConverter_#1970 Ether0.003618045
0x1735b810f0de52fee3398b143f17b34f4e23fd42b2e2fb90dd108b204ae681ae722739018 hrs 54 mins ago0x3eb52ea7131ac92427cf00a048d44ea72f594b00  IN   BancorConverter_#1970 Ether0.003616317
0xd4716fa59c120f392a318de5a93221949e614638e72a59a68d4a60b62771f8df722738418 hrs 56 mins ago0xaedfcc68372de2bfea371ada3289ef6f6a53f99d  IN   BancorConverter_#1970 Ether0.003618621
0x26f2bf6a7424b8f25b4ad887e895f06fef53976096a756eddb8793d4d71244f7722733119 hrs 20 mins ago0x7059010320d07a47d2ad54db88bb89ea644c3e6f  IN   BancorConverter_#1970 Ether0.003485349
0x2556cae72d3a1726c8176c1f7c9029d95341451cfa8a43db641573f470d4cc21722725919 hrs 43 mins ago0xaedfcc68372de2bfea371ada3289ef6f6a53f99d  IN   BancorConverter_#1970 Ether0.003618621
0x67796717aa22dc0d194ef3b3811fb299fc1f6e98576ca8569fcf240dda9ea319722724019 hrs 51 mins ago0xaedfcc68372de2bfea371ada3289ef6f6a53f99d  IN   BancorConverter_#1970 Ether0.003618621
0xe9de374d89e074cb33d1ac6883047a85060d0f161e2f38d0d023d2dac0da29a6722718820 hrs 12 mins ago0xaedfcc68372de2bfea371ada3289ef6f6a53f99d  IN   BancorConverter_#1970 Ether0.003618621
0x7ebb16f0bc0603d013afd68403ac4fb49e72feebf9fda61fc4dda03f160655e8722716420 hrs 21 mins ago0xaedfcc68372de2bfea371ada3289ef6f6a53f99d  IN   BancorConverter_#1970 Ether0.003618621
[ Download CSV Export 

Latest 25 Internal Transaction, Click here to view more Internal Transactions as a result of Contract Execution

Parent TxHash Block Age From To Value
0xf531b3fd27bdf4634cb7f71a918887c637aaade698136169c89d6e6a0cac681472295896 hrs 37 mins ago0x5039d9b575bd5722d310af6d2fc11e053c6d03da0x6690819cb98c1211a8e38790d6cd48316ed518db1.3 Ether
0xf531b3fd27bdf4634cb7f71a918887c637aaade698136169c89d6e6a0cac681472295896 hrs 37 mins ago0xc1055167b42a5d01b4384afcc9d6682d61a67f2a0x5039d9b575bd5722d310af6d2fc11e053c6d03da1.3 Ether
0x45a6f420b956e2b894a08cddb737f08f4c41110690c54664d5a4a4d3a00c384c722747118 hrs 31 mins ago0x5039d9b575bd5722d310af6d2fc11e053c6d03da0x6690819cb98c1211a8e38790d6cd48316ed518db1.3 Ether
0x45a6f420b956e2b894a08cddb737f08f4c41110690c54664d5a4a4d3a00c384c722747118 hrs 31 mins ago0xc1055167b42a5d01b4384afcc9d6682d61a67f2a0x5039d9b575bd5722d310af6d2fc11e053c6d03da1.3 Ether
0xa24f503959503c3e079454ad367b282964e8e3b4a83667a7a89f93cdca4ff73c722713720 hrs 28 mins ago0x5039d9b575bd5722d310af6d2fc11e053c6d03da0x6690819cb98c1211a8e38790d6cd48316ed518db1.4 Ether
0xa24f503959503c3e079454ad367b282964e8e3b4a83667a7a89f93cdca4ff73c722713720 hrs 28 mins ago0xc1055167b42a5d01b4384afcc9d6682d61a67f2a0x5039d9b575bd5722d310af6d2fc11e053c6d03da1.4 Ether
0x36bee6071d34b14c5dde378a791af907407eb2b1b4684b48eadfabe95606fd19722702521 hrs 9 mins ago0x5039d9b575bd5722d310af6d2fc11e053c6d03da0x6690819cb98c1211a8e38790d6cd48316ed518db1.5 Ether
0x36bee6071d34b14c5dde378a791af907407eb2b1b4684b48eadfabe95606fd19722702521 hrs 9 mins ago0xc1055167b42a5d01b4384afcc9d6682d61a67f2a0x5039d9b575bd5722d310af6d2fc11e053c6d03da1.5 Ether
0x5e09cbfac363acf56f150e1677f29fbe06262943f032174845651e18d3f12ece722674722 hrs 50 mins ago0x5039d9b575bd5722d310af6d2fc11e053c6d03da0x6690819cb98c1211a8e38790d6cd48316ed518db1.4 Ether
0x5e09cbfac363acf56f150e1677f29fbe06262943f032174845651e18d3f12ece722674722 hrs 50 mins ago0xc1055167b42a5d01b4384afcc9d6682d61a67f2a0x5039d9b575bd5722d310af6d2fc11e053c6d03da1.4 Ether
0x636e761ce405d4bc7ecef6355419bde89696a5cb37badb471fbe0e744ac9e7b4722668623 hrs 14 mins ago0x5039d9b575bd5722d310af6d2fc11e053c6d03da0x6690819cb98c1211a8e38790d6cd48316ed518db1.6 Ether
0x636e761ce405d4bc7ecef6355419bde89696a5cb37badb471fbe0e744ac9e7b4722668623 hrs 14 mins ago0xc1055167b42a5d01b4384afcc9d6682d61a67f2a0x5039d9b575bd5722d310af6d2fc11e053c6d03da1.6 Ether
0x27e184789330634b5bf22ad7db623fcd90af3eeedc15d261e4d030a04ecfe08372233531 day 18 hrs ago0x5039d9b575bd5722d310af6d2fc11e053c6d03da0x6690819cb98c1211a8e38790d6cd48316ed518db1.3 Ether
0x27e184789330634b5bf22ad7db623fcd90af3eeedc15d261e4d030a04ecfe08372233531 day 18 hrs ago0xc1055167b42a5d01b4384afcc9d6682d61a67f2a0x5039d9b575bd5722d310af6d2fc11e053c6d03da1.3 Ether
0x01055638a3500c15f2df0e36c2272a1d91e263db3381f3bfa99b12224562bfe972233481 day 18 hrs ago0x5039d9b575bd5722d310af6d2fc11e053c6d03da0x6690819cb98c1211a8e38790d6cd48316ed518db1.4 Ether
0x01055638a3500c15f2df0e36c2272a1d91e263db3381f3bfa99b12224562bfe972233481 day 18 hrs ago0xc1055167b42a5d01b4384afcc9d6682d61a67f2a0x5039d9b575bd5722d310af6d2fc11e053c6d03da1.4 Ether
0xfcce7a665ed8f854c7dbfc9201d8ffbfe13ab089469e321ed3967bb40317d01f72233301 day 18 hrs ago0x5039d9b575bd5722d310af6d2fc11e053c6d03da0x6690819cb98c1211a8e38790d6cd48316ed518db1.4 Ether
0xfcce7a665ed8f854c7dbfc9201d8ffbfe13ab089469e321ed3967bb40317d01f72233301 day 18 hrs ago0xc1055167b42a5d01b4384afcc9d6682d61a67f2a0x5039d9b575bd5722d310af6d2fc11e053c6d03da1.4 Ether
0x89635b59639780d0525ab4656a37da40e941d4ba06c2d91afad91f2ce7577ab172230621 day 19 hrs ago0x5039d9b575bd5722d310af6d2fc11e053c6d03da0x6690819cb98c1211a8e38790d6cd48316ed518db1.5 Ether
0x89635b59639780d0525ab4656a37da40e941d4ba06c2d91afad91f2ce7577ab172230621 day 19 hrs ago0xc1055167b42a5d01b4384afcc9d6682d61a67f2a0x5039d9b575bd5722d310af6d2fc11e053c6d03da1.5 Ether
0x3e9374fd457730335b3a82db938beaf6fe4c440fadb4100d63be6e31cd42400c72229161 day 20 hrs ago0x5039d9b575bd5722d310af6d2fc11e053c6d03da0x6690819cb98c1211a8e38790d6cd48316ed518db1.6 Ether
0x3e9374fd457730335b3a82db938beaf6fe4c440fadb4100d63be6e31cd42400c72229161 day 20 hrs ago0xc1055167b42a5d01b4384afcc9d6682d61a67f2a0x5039d9b575bd5722d310af6d2fc11e053c6d03da1.6 Ether
0xdcce1e94fb001307e2987818a44671505c1f4c8559a90903501f3a6a9a5a224e72227481 day 21 hrs ago0x5039d9b575bd5722d310af6d2fc11e053c6d03da0x6690819cb98c1211a8e38790d6cd48316ed518db2.9 Ether
0xdcce1e94fb001307e2987818a44671505c1f4c8559a90903501f3a6a9a5a224e72227481 day 21 hrs ago0xc1055167b42a5d01b4384afcc9d6682d61a67f2a0x5039d9b575bd5722d310af6d2fc11e053c6d03da2.9 Ether
0xd8b2c66f44c91858d539b69e19366c287de1e91517b3cb3a8f354dd29c060c5d72197462 days 15 hrs ago0x5039d9b575bd5722d310af6d2fc11e053c6d03da0x6690819cb98c1211a8e38790d6cd48316ed518db2.9 Ether
[ Download CSV Export 
Warning: The compiled contract might be susceptible to ExpExponentCleanup (medium/high-severity), EventStructWrongData (very low-severity) Solidity Compiler Bugs.

Contract Source Code Verified (Similar Match)
Note: This contract matches the deployed ByteCode of the Verified Source Code for Contract 0x40A36b6D7F956f80D07e401A5f620C3A4f252e16
Contract Name: BancorConverter
Compiler Version: v0.4.23+commit.124ca40d
Optimization Enabled: Yes
Runs (Optimizer):  500


Contract Source Code
pragma solidity ^0.4.23;

/*
    Owned contract interface
*/
contract IOwned {
    // this function isn't abstract since the compiler emits automatically generated getter functions as external
    function owner() public view returns (address) {}

    function transferOwnership(address _newOwner) public;
    function acceptOwnership() public;
}

/*
    Whitelist interface
*/
contract IWhitelist {
    function isWhitelisted(address _address) public view returns (bool);
}

/*
    Contract Registry interface
*/
contract IContractRegistry {
    function addressOf(bytes32 _contractName) public view returns (address);

    // deprecated, backward compatibility
    function getAddress(bytes32 _contractName) public view returns (address);
}

/*
    Contract Features interface
*/
contract IContractFeatures {
    function isSupported(address _contract, uint256 _features) public view returns (bool);
    function enableFeatures(uint256 _features, bool _enable) public;
}

/*
    ERC20 Standard Token interface
*/
contract IERC20Token {
    // these functions aren't abstract since the compiler emits automatically generated getter functions as external
    function name() public view returns (string) {}
    function symbol() public view returns (string) {}
    function decimals() public view returns (uint8) {}
    function totalSupply() public view returns (uint256) {}
    function balanceOf(address _owner) public view returns (uint256) { _owner; }
    function allowance(address _owner, address _spender) public view returns (uint256) { _owner; _spender; }

    function transfer(address _to, uint256 _value) public returns (bool success);
    function transferFrom(address _from, address _to, uint256 _value) public returns (bool success);
    function approve(address _spender, uint256 _value) public returns (bool success);
}

/*
    Smart Token interface
*/
contract ISmartToken is IOwned, IERC20Token {
    function disableTransfers(bool _disable) public;
    function issue(address _to, uint256 _amount) public;
    function destroy(address _from, uint256 _amount) public;
}

/*
    Token Holder interface
*/
contract ITokenHolder is IOwned {
    function withdrawTokens(IERC20Token _token, address _to, uint256 _amount) public;
}

/*
    Bancor Converter interface
*/
contract IBancorConverter {
    function getReturn(IERC20Token _fromToken, IERC20Token _toToken, uint256 _amount) public view returns (uint256);
    function convert(IERC20Token _fromToken, IERC20Token _toToken, uint256 _amount, uint256 _minReturn) public returns (uint256);
    function conversionWhitelist() public view returns (IWhitelist) {}
    // deprecated, backward compatibility
    function change(IERC20Token _fromToken, IERC20Token _toToken, uint256 _amount, uint256 _minReturn) public returns (uint256);
}

/*
    Bancor Formula interface
*/
contract IBancorFormula {
    function calculatePurchaseReturn(uint256 _supply, uint256 _connectorBalance, uint32 _connectorWeight, uint256 _depositAmount) public view returns (uint256);
    function calculateSaleReturn(uint256 _supply, uint256 _connectorBalance, uint32 _connectorWeight, uint256 _sellAmount) public view returns (uint256);
    function calculateCrossConnectorReturn(uint256 _fromConnectorBalance, uint32 _fromConnectorWeight, uint256 _toConnectorBalance, uint32 _toConnectorWeight, uint256 _amount) public view returns (uint256);
}

/*
    Bancor Network interface
*/
contract IBancorNetwork {
    function convert(IERC20Token[] _path, uint256 _amount, uint256 _minReturn) public payable returns (uint256);
    function convertFor(IERC20Token[] _path, uint256 _amount, uint256 _minReturn, address _for) public payable returns (uint256);
    function convertForPrioritized2(
        IERC20Token[] _path,
        uint256 _amount,
        uint256 _minReturn,
        address _for,
        uint256 _block,
        uint8 _v,
        bytes32 _r,
        bytes32 _s)
        public payable returns (uint256);

    // deprecated, backward compatibility
    function convertForPrioritized(
        IERC20Token[] _path,
        uint256 _amount,
        uint256 _minReturn,
        address _for,
        uint256 _block,
        uint256 _nonce,
        uint8 _v,
        bytes32 _r,
        bytes32 _s)
        public payable returns (uint256);
}

/*
    Utilities & Common Modifiers
*/
contract Utils {
    /**
        constructor
    */
    constructor() public {
    }

    // verifies that an amount is greater than zero
    modifier greaterThanZero(uint256 _amount) {
        require(_amount > 0);
        _;
    }

    // validates an address - currently only checks that it isn't null
    modifier validAddress(address _address) {
        require(_address != address(0));
        _;
    }

    // verifies that the address is different than this contract address
    modifier notThis(address _address) {
        require(_address != address(this));
        _;
    }

    // Overflow protected math functions

    /**
        @dev returns the sum of _x and _y, asserts if the calculation overflows

        @param _x   value 1
        @param _y   value 2

        @return sum
    */
    function safeAdd(uint256 _x, uint256 _y) internal pure returns (uint256) {
        uint256 z = _x + _y;
        assert(z >= _x);
        return z;
    }

    /**
        @dev returns the difference of _x minus _y, asserts if the subtraction results in a negative number

        @param _x   minuend
        @param _y   subtrahend

        @return difference
    */
    function safeSub(uint256 _x, uint256 _y) internal pure returns (uint256) {
        assert(_x >= _y);
        return _x - _y;
    }

    /**
        @dev returns the product of multiplying _x by _y, asserts if the calculation overflows

        @param _x   factor 1
        @param _y   factor 2

        @return product
    */
    function safeMul(uint256 _x, uint256 _y) internal pure returns (uint256) {
        uint256 z = _x * _y;
        assert(_x == 0 || z / _x == _y);
        return z;
    }
}

/*
    Provides support and utilities for contract ownership
*/
contract Owned is IOwned {
    address public owner;
    address public newOwner;

    event OwnerUpdate(address indexed _prevOwner, address indexed _newOwner);

    /**
        @dev constructor
    */
    constructor() public {
        owner = msg.sender;
    }

    // allows execution by the owner only
    modifier ownerOnly {
        assert(msg.sender == owner);
        _;
    }

    /**
        @dev allows transferring the contract ownership
        the new owner still needs to accept the transfer
        can only be called by the contract owner

        @param _newOwner    new contract owner
    */
    function transferOwnership(address _newOwner) public ownerOnly {
        require(_newOwner != owner);
        newOwner = _newOwner;
    }

    /**
        @dev used by a new owner to accept an ownership transfer
    */
    function acceptOwnership() public {
        require(msg.sender == newOwner);
        emit OwnerUpdate(owner, newOwner);
        owner = newOwner;
        newOwner = address(0);
    }
}

/*
    Provides support and utilities for contract management
    Note that a managed contract must also have an owner
*/
contract Managed is Owned {
    address public manager;
    address public newManager;

    event ManagerUpdate(address indexed _prevManager, address indexed _newManager);

    /**
        @dev constructor
    */
    constructor() public {
        manager = msg.sender;
    }

    // allows execution by the manager only
    modifier managerOnly {
        assert(msg.sender == manager);
        _;
    }

    // allows execution by either the owner or the manager only
    modifier ownerOrManagerOnly {
        require(msg.sender == owner || msg.sender == manager);
        _;
    }

    /**
        @dev allows transferring the contract management
        the new manager still needs to accept the transfer
        can only be called by the contract manager

        @param _newManager    new contract manager
    */
    function transferManagement(address _newManager) public ownerOrManagerOnly {
        require(_newManager != manager);
        newManager = _newManager;
    }

    /**
        @dev used by a new manager to accept a management transfer
    */
    function acceptManagement() public {
        require(msg.sender == newManager);
        emit ManagerUpdate(manager, newManager);
        manager = newManager;
        newManager = address(0);
    }
}

/**
    Id definitions for bancor contracts

    Can be used in conjunction with the contract registry to get contract addresses
*/
contract ContractIds {
    // generic
    bytes32 public constant CONTRACT_FEATURES = "ContractFeatures";

    // bancor logic
    bytes32 public constant BANCOR_NETWORK = "BancorNetwork";
    bytes32 public constant BANCOR_FORMULA = "BancorFormula";
    bytes32 public constant BANCOR_GAS_PRICE_LIMIT = "BancorGasPriceLimit";
    bytes32 public constant BANCOR_CONVERTER_FACTORY = "BancorConverterFactory";
}

/**
    Id definitions for bancor contract features

    Can be used to query the ContractFeatures contract to check whether a certain feature is supported by a contract
*/
contract FeatureIds {
    // converter features
    uint256 public constant CONVERTER_CONVERSION_WHITELIST = 1 << 0;
}

/*
    We consider every contract to be a 'token holder' since it's currently not possible
    for a contract to deny receiving tokens.

    The TokenHolder's contract sole purpose is to provide a safety mechanism that allows
    the owner to send tokens that were sent to the contract by mistake back to their sender.
*/
contract TokenHolder is ITokenHolder, Owned, Utils {
    /**
        @dev constructor
    */
    constructor() public {
    }

    /**
        @dev withdraws tokens held by the contract and sends them to an account
        can only be called by the owner

        @param _token   ERC20 token contract address
        @param _to      account to receive the new amount
        @param _amount  amount to withdraw
    */
    function withdrawTokens(IERC20Token _token, address _to, uint256 _amount)
        public
        ownerOnly
        validAddress(_token)
        validAddress(_to)
        notThis(_to)
    {
        assert(_token.transfer(_to, _amount));
    }
}

/*
    The smart token controller is an upgradable part of the smart token that allows
    more functionality as well as fixes for bugs/exploits.
    Once it accepts ownership of the token, it becomes the token's sole controller
    that can execute any of its functions.

    To upgrade the controller, ownership must be transferred to a new controller, along with
    any relevant data.

    The smart token must be set on construction and cannot be changed afterwards.
    Wrappers are provided (as opposed to a single 'execute' function) for each of the token's functions, for easier access.

    Note that the controller can transfer token ownership to a new controller that
    doesn't allow executing any function on the token, for a trustless solution.
    Doing that will also remove the owner's ability to upgrade the controller.
*/
contract SmartTokenController is TokenHolder {
    ISmartToken public token;   // smart token

    /**
        @dev constructor
    */
    constructor(ISmartToken _token)
        public
        validAddress(_token)
    {
        token = _token;
    }

    // ensures that the controller is the token's owner
    modifier active() {
        assert(token.owner() == address(this));
        _;
    }

    // ensures that the controller is not the token's owner
    modifier inactive() {
        assert(token.owner() != address(this));
        _;
    }

    /**
        @dev allows transferring the token ownership
        the new owner still need to accept the transfer
        can only be called by the contract owner

        @param _newOwner    new token owner
    */
    function transferTokenOwnership(address _newOwner) public ownerOnly {
        token.transferOwnership(_newOwner);
    }

    /**
        @dev used by a new owner to accept a token ownership transfer
        can only be called by the contract owner
    */
    function acceptTokenOwnership() public ownerOnly {
        token.acceptOwnership();
    }

    /**
        @dev disables/enables token transfers
        can only be called by the contract owner

        @param _disable    true to disable transfers, false to enable them
    */
    function disableTokenTransfers(bool _disable) public ownerOnly {
        token.disableTransfers(_disable);
    }

    /**
        @dev withdraws tokens held by the controller and sends them to an account
        can only be called by the owner

        @param _token   ERC20 token contract address
        @param _to      account to receive the new amount
        @param _amount  amount to withdraw
    */
    function withdrawFromToken(
        IERC20Token _token, 
        address _to, 
        uint256 _amount
    ) 
        public
        ownerOnly
    {
        ITokenHolder(token).withdrawTokens(_token, _to, _amount);
    }
}

/*
    Bancor Converter v0.10

    The Bancor version of the token converter, allows conversion between a smart token and other ERC20 tokens and between different ERC20 tokens and themselves.

    ERC20 connector balance can be virtual, meaning that the calculations are based on the virtual balance instead of relying on
    the actual connector balance. This is a security mechanism that prevents the need to keep a very large (and valuable) balance in a single contract.

    The converter is upgradable (just like any SmartTokenController).

    WARNING: It is NOT RECOMMENDED to use the converter with Smart Tokens that have less than 8 decimal digits
             or with very small numbers because of precision loss

    Open issues:
    - Front-running attacks are currently mitigated by the following mechanisms:
        - minimum return argument for each conversion provides a way to define a minimum/maximum price for the transaction
        - gas price limit prevents users from having control over the order of execution
        - gas price limit check can be skipped if the transaction comes from a trusted, whitelisted signer
      Other potential solutions might include a commit/reveal based schemes
    - Possibly add getters for the connector fields so that the client won't need to rely on the order in the struct
*/
contract BancorConverter is IBancorConverter, SmartTokenController, Managed, ContractIds, FeatureIds {
    uint32 private constant MAX_WEIGHT = 1000000;
    uint64 private constant MAX_CONVERSION_FEE = 1000000;

    struct Connector {
        uint256 virtualBalance;         // connector virtual balance
        uint32 weight;                  // connector weight, represented in ppm, 1-1000000
        bool isVirtualBalanceEnabled;   // true if virtual balance is enabled, false if not
        bool isPurchaseEnabled;         // is purchase of the smart token enabled with the connector, can be set by the owner
        bool isSet;                     // used to tell if the mapping element is defined
    }

    string public version = '0.10';
    string public converterType = 'bancor';

    IContractRegistry public registry;                  // contract registry contract
    IWhitelist public conversionWhitelist;              // whitelist contract with list of addresses that are allowed to use the converter
    IERC20Token[] public connectorTokens;               // ERC20 standard token addresses
    IERC20Token[] public quickBuyPath;                  // conversion path that's used in order to buy the token with ETH
    mapping (address => Connector) public connectors;   // connector token addresses -> connector data
    uint32 private totalConnectorWeight = 0;            // used to efficiently prevent increasing the total connector weight above 100%
    uint32 public maxConversionFee = 0;                 // maximum conversion fee for the lifetime of the contract,
                                                        // represented in ppm, 0...1000000 (0 = no fee, 100 = 0.01%, 1000000 = 100%)
    uint32 public conversionFee = 0;                    // current conversion fee, represented in ppm, 0...maxConversionFee
    bool public conversionsEnabled = true;              // true if token conversions is enabled, false if not
    IERC20Token[] private convertPath;

    // triggered when a conversion between two tokens occurs
    event Conversion(
        address indexed _fromToken,
        address indexed _toToken,
        address indexed _trader,
        uint256 _amount,
        uint256 _return,
        int256 _conversionFee
    );
    // triggered after a conversion with new price data
    event PriceDataUpdate(
        address indexed _connectorToken,
        uint256 _tokenSupply,
        uint256 _connectorBalance,
        uint32 _connectorWeight
    );
    // triggered when the conversion fee is updated
    event ConversionFeeUpdate(uint32 _prevFee, uint32 _newFee);

    /**
        @dev constructor

        @param  _token              smart token governed by the converter
        @param  _registry           address of a contract registry contract
        @param  _maxConversionFee   maximum conversion fee, represented in ppm
        @param  _connectorToken     optional, initial connector, allows defining the first connector at deployment time
        @param  _connectorWeight    optional, weight for the initial connector
    */
    constructor(
        ISmartToken _token,
        IContractRegistry _registry,
        uint32 _maxConversionFee,
        IERC20Token _connectorToken,
        uint32 _connectorWeight
    )
        public
        SmartTokenController(_token)
        validAddress(_registry)
        validMaxConversionFee(_maxConversionFee)
    {
        registry = _registry;
        IContractFeatures features = IContractFeatures(registry.addressOf(ContractIds.CONTRACT_FEATURES));

        // initialize supported features
        if (features != address(0))
            features.enableFeatures(FeatureIds.CONVERTER_CONVERSION_WHITELIST, true);

        maxConversionFee = _maxConversionFee;

        if (_connectorToken != address(0))
            addConnector(_connectorToken, _connectorWeight, false);
    }

    // validates a connector token address - verifies that the address belongs to one of the connector tokens
    modifier validConnector(IERC20Token _address) {
        require(connectors[_address].isSet);
        _;
    }

    // validates a token address - verifies that the address belongs to one of the convertible tokens
    modifier validToken(IERC20Token _address) {
        require(_address == token || connectors[_address].isSet);
        _;
    }

    // validates maximum conversion fee
    modifier validMaxConversionFee(uint32 _conversionFee) {
        require(_conversionFee >= 0 && _conversionFee <= MAX_CONVERSION_FEE);
        _;
    }

    // validates conversion fee
    modifier validConversionFee(uint32 _conversionFee) {
        require(_conversionFee >= 0 && _conversionFee <= maxConversionFee);
        _;
    }

    // validates connector weight range
    modifier validConnectorWeight(uint32 _weight) {
        require(_weight > 0 && _weight <= MAX_WEIGHT);
        _;
    }

    // validates a conversion path - verifies that the number of elements is odd and that maximum number of 'hops' is 10
    modifier validConversionPath(IERC20Token[] _path) {
        require(_path.length > 2 && _path.length <= (1 + 2 * 10) && _path.length % 2 == 1);
        _;
    }

    // allows execution only when conversions aren't disabled
    modifier conversionsAllowed {
        assert(conversionsEnabled);
        _;
    }

    // allows execution by the BancorNetwork contract only
    modifier bancorNetworkOnly {
        IBancorNetwork bancorNetwork = IBancorNetwork(registry.addressOf(ContractIds.BANCOR_NETWORK));
        require(msg.sender == address(bancorNetwork));
        _;
    }

    /**
        @dev returns the number of connector tokens defined

        @return number of connector tokens
    */
    function connectorTokenCount() public view returns (uint16) {
        return uint16(connectorTokens.length);
    }

    /*
        @dev allows the owner to update the contract registry contract address

        @param _registry   address of a contract registry contract
    */
    function setRegistry(IContractRegistry _registry)
        public
        ownerOnly
        validAddress(_registry)
        notThis(_registry)
    {
        registry = _registry;
    }

    /*
        @dev allows the owner to update & enable the conversion whitelist contract address
        when set, only addresses that are whitelisted are actually allowed to use the converter
        note that the whitelist check is actually done by the BancorNetwork contract

        @param _whitelist    address of a whitelist contract
    */
    function setConversionWhitelist(IWhitelist _whitelist)
        public
        ownerOnly
        notThis(_whitelist)
    {
        conversionWhitelist = _whitelist;
    }

    /*
        @dev allows the manager to update the quick buy path

        @param _path    new quick buy path, see conversion path format in the bancorNetwork contract
    */
    function setQuickBuyPath(IERC20Token[] _path)
        public
        ownerOnly
        validConversionPath(_path)
    {
        quickBuyPath = _path;
    }

    /*
        @dev allows the manager to clear the quick buy path
    */
    function clearQuickBuyPath() public ownerOnly {
        quickBuyPath.length = 0;
    }

    /**
        @dev returns the length of the quick buy path array

        @return quick buy path length
    */
    function getQuickBuyPathLength() public view returns (uint256) {
        return quickBuyPath.length;
    }

    /**
        @dev disables the entire conversion functionality
        this is a safety mechanism in case of a emergency
        can only be called by the manager

        @param _disable true to disable conversions, false to re-enable them
    */
    function disableConversions(bool _disable) public ownerOrManagerOnly {
        conversionsEnabled = !_disable;
    }

    /**
        @dev updates the current conversion fee
        can only be called by the manager

        @param _conversionFee new conversion fee, represented in ppm
    */
    function setConversionFee(uint32 _conversionFee)
        public
        ownerOrManagerOnly
        validConversionFee(_conversionFee)
    {
        emit ConversionFeeUpdate(conversionFee, _conversionFee);
        conversionFee = _conversionFee;
    }

    /*
        @dev given a return amount, returns the amount minus the conversion fee

        @param _amount      return amount
        @param _magnitude   1 for standard conversion, 2 for cross connector conversion

        @return return amount minus conversion fee
    */
    function getFinalAmount(uint256 _amount, uint8 _magnitude) public view returns (uint256) {
        return safeMul(_amount, (MAX_CONVERSION_FEE - conversionFee) ** _magnitude) / MAX_CONVERSION_FEE ** _magnitude;
    }

    /**
        @dev defines a new connector for the token
        can only be called by the owner while the converter is inactive

        @param _token                  address of the connector token
        @param _weight                 constant connector weight, represented in ppm, 1-1000000
        @param _enableVirtualBalance   true to enable virtual balance for the connector, false to disable it
    */
    function addConnector(IERC20Token _token, uint32 _weight, bool _enableVirtualBalance)
        public
        ownerOnly
        inactive
        validAddress(_token)
        notThis(_token)
        validConnectorWeight(_weight)
    {
        require(_token != token && !connectors[_token].isSet && totalConnectorWeight + _weight <= MAX_WEIGHT); // validate input

        connectors[_token].virtualBalance = 0;
        connectors[_token].weight = _weight;
        connectors[_token].isVirtualBalanceEnabled = _enableVirtualBalance;
        connectors[_token].isPurchaseEnabled = true;
        connectors[_token].isSet = true;
        connectorTokens.push(_token);
        totalConnectorWeight += _weight;
    }

    /**
        @dev updates one of the token connectors
        can only be called by the owner

        @param _connectorToken         address of the connector token
        @param _weight                 constant connector weight, represented in ppm, 1-1000000
        @param _enableVirtualBalance   true to enable virtual balance for the connector, false to disable it
        @param _virtualBalance         new connector's virtual balance
    */
    function updateConnector(IERC20Token _connectorToken, uint32 _weight, bool _enableVirtualBalance, uint256 _virtualBalance)
        public
        ownerOnly
        validConnector(_connectorToken)
        validConnectorWeight(_weight)
    {
        Connector storage connector = connectors[_connectorToken];
        require(totalConnectorWeight - connector.weight + _weight <= MAX_WEIGHT); // validate input

        totalConnectorWeight = totalConnectorWeight - connector.weight + _weight;
        connector.weight = _weight;
        connector.isVirtualBalanceEnabled = _enableVirtualBalance;
        connector.virtualBalance = _virtualBalance;
    }

    /**
        @dev disables purchasing with the given connector token in case the connector token got compromised
        can only be called by the owner
        note that selling is still enabled regardless of this flag and it cannot be disabled by the owner

        @param _connectorToken  connector token contract address
        @param _disable         true to disable the token, false to re-enable it
    */
    function disableConnectorPurchases(IERC20Token _connectorToken, bool _disable)
        public
        ownerOnly
        validConnector(_connectorToken)
    {
        connectors[_connectorToken].isPurchaseEnabled = !_disable;
    }

    /**
        @dev returns the connector's virtual balance if one is defined, otherwise returns the actual balance

        @param _connectorToken  connector token contract address

        @return connector balance
    */
    function getConnectorBalance(IERC20Token _connectorToken)
        public
        view
        validConnector(_connectorToken)
        returns (uint256)
    {
        Connector storage connector = connectors[_connectorToken];
        return connector.isVirtualBalanceEnabled ? connector.virtualBalance : _connectorToken.balanceOf(this);
    }

    /**
        @dev returns the expected return for converting a specific amount of _fromToken to _toToken

        @param _fromToken  ERC20 token to convert from
        @param _toToken    ERC20 token to convert to
        @param _amount     amount to convert, in fromToken

        @return expected conversion return amount
    */
    function getReturn(IERC20Token _fromToken, IERC20Token _toToken, uint256 _amount) public view returns (uint256) {
        require(_fromToken != _toToken); // validate input

        // conversion between the token and one of its connectors
        if (_toToken == token)
            return getPurchaseReturn(_fromToken, _amount);
        else if (_fromToken == token)
            return getSaleReturn(_toToken, _amount);

        // conversion between 2 connectors
        return getCrossConnectorReturn(_fromToken, _toToken, _amount);
    }

    /**
        @dev returns the expected return for buying the token for a connector token

        @param _connectorToken  connector token contract address
        @param _depositAmount   amount to deposit (in the connector token)

        @return expected purchase return amount
    */
    function getPurchaseReturn(IERC20Token _connectorToken, uint256 _depositAmount)
        public
        view
        active
        validConnector(_connectorToken)
        returns (uint256)
    {
        Connector storage connector = connectors[_connectorToken];
        require(connector.isPurchaseEnabled); // validate input

        uint256 tokenSupply = token.totalSupply();
        uint256 connectorBalance = getConnectorBalance(_connectorToken);
        IBancorFormula formula = IBancorFormula(registry.addressOf(ContractIds.BANCOR_FORMULA));
        uint256 amount = formula.calculatePurchaseReturn(tokenSupply, connectorBalance, connector.weight, _depositAmount);

        // return the amount minus the conversion fee
        return getFinalAmount(amount, 1);
    }

    /**
        @dev returns the expected return for selling the token for one of its connector tokens

        @param _connectorToken  connector token contract address
        @param _sellAmount      amount to sell (in the smart token)

        @return expected sale return amount
    */
    function getSaleReturn(IERC20Token _connectorToken, uint256 _sellAmount)
        public
        view
        active
        validConnector(_connectorToken)
        returns (uint256)
    {
        Connector storage connector = connectors[_connectorToken];
        uint256 tokenSupply = token.totalSupply();
        uint256 connectorBalance = getConnectorBalance(_connectorToken);
        IBancorFormula formula = IBancorFormula(registry.addressOf(ContractIds.BANCOR_FORMULA));
        uint256 amount = formula.calculateSaleReturn(tokenSupply, connectorBalance, connector.weight, _sellAmount);

        // return the amount minus the conversion fee
        return getFinalAmount(amount, 1);
    }

    /**
        @dev returns the expected return for selling one of the connector tokens for another connector token

        @param _fromConnectorToken  contract address of the connector token to convert from
        @param _toConnectorToken    contract address of the connector token to convert to
        @param _sellAmount          amount to sell (in the from connector token)

        @return expected sale return amount (in the to connector token)
    */
    function getCrossConnectorReturn(IERC20Token _fromConnectorToken, IERC20Token _toConnectorToken, uint256 _sellAmount)
        public
        view
        active
        validConnector(_fromConnectorToken)
        validConnector(_toConnectorToken)
        returns (uint256)
    {
        Connector storage fromConnector = connectors[_fromConnectorToken];
        Connector storage toConnector = connectors[_toConnectorToken];
        require(toConnector.isPurchaseEnabled); // validate input

        uint256 fromConnectorBalance = getConnectorBalance(_fromConnectorToken);
        uint256 toConnectorBalance = getConnectorBalance(_toConnectorToken);

        IBancorFormula formula = IBancorFormula(registry.addressOf(ContractIds.BANCOR_FORMULA));
        uint256 amount = formula.calculateCrossConnectorReturn(fromConnectorBalance, fromConnector.weight, toConnectorBalance, toConnector.weight, _sellAmount);

        // return the amount minus the conversion fee
        // the fee is higher (magnitude = 2) since cross connector conversion equals 2 conversions (from / to the smart token)
        return getFinalAmount(amount, 2);
    }

    /**
        @dev converts a specific amount of _fromToken to _toToken

        @param _fromToken  ERC20 token to convert from
        @param _toToken    ERC20 token to convert to
        @param _amount     amount to convert, in fromToken
        @param _minReturn  if the conversion results in an amount smaller than the minimum return - it is cancelled, must be nonzero

        @return conversion return amount
    */
    function convertInternal(IERC20Token _fromToken, IERC20Token _toToken, uint256 _amount, uint256 _minReturn)
        public
        bancorNetworkOnly
        conversionsAllowed
        greaterThanZero(_minReturn)
        returns (uint256)
    {
        require(_fromToken != _toToken); // validate input

        // conversion between the token and one of its connectors
        if (_toToken == token)
            return buy(_fromToken, _amount, _minReturn);
        else if (_fromToken == token)
            return sell(_toToken, _amount, _minReturn);

        // conversion between 2 connectors
        uint256 amount = getCrossConnectorReturn(_fromToken, _toToken, _amount);
        // ensure the trade gives something in return and meets the minimum requested amount
        require(amount != 0 && amount >= _minReturn);

        // update the source token virtual balance if relevant
        Connector storage fromConnector = connectors[_fromToken];
        if (fromConnector.isVirtualBalanceEnabled)
            fromConnector.virtualBalance = safeAdd(fromConnector.virtualBalance, _amount);

        // update the target token virtual balance if relevant
        Connector storage toConnector = connectors[_toToken];
        if (toConnector.isVirtualBalanceEnabled)
            toConnector.virtualBalance = safeSub(toConnector.virtualBalance, amount);

        // ensure that the trade won't deplete the connector balance
        uint256 toConnectorBalance = getConnectorBalance(_toToken);
        assert(amount < toConnectorBalance);

        // transfer funds from the caller in the from connector token
        assert(_fromToken.transferFrom(msg.sender, this, _amount));
        // transfer funds to the caller in the to connector token
        // the transfer might fail if the actual connector balance is smaller than the virtual balance
        assert(_toToken.transfer(msg.sender, amount));

        // calculate conversion fee and dispatch the conversion event
        // the fee is higher (magnitude = 2) since cross connector conversion equals 2 conversions (from / to the smart token)
        uint256 feeAmount = safeSub(amount, getFinalAmount(amount, 2));
        dispatchConversionEvent(_fromToken, _toToken, _amount, amount, feeAmount);

        // dispatch price data updates for the smart token / both connectors
        emit PriceDataUpdate(_fromToken, token.totalSupply(), getConnectorBalance(_fromToken), fromConnector.weight);
        emit PriceDataUpdate(_toToken, token.totalSupply(), getConnectorBalance(_toToken), toConnector.weight);
        return amount;
    }

    /**
        @dev converts a specific amount of _fromToken to _toToken

        @param _fromToken  ERC20 token to convert from
        @param _toToken    ERC20 token to convert to
        @param _amount     amount to convert, in fromToken
        @param _minReturn  if the conversion results in an amount smaller than the minimum return - it is cancelled, must be nonzero

        @return conversion return amount
    */
    function convert(IERC20Token _fromToken, IERC20Token _toToken, uint256 _amount, uint256 _minReturn) public returns (uint256) {
        convertPath = [_fromToken, token, _toToken];
        return quickConvert(convertPath, _amount, _minReturn);
    }

    /**
        @dev buys the token by depositing one of its connector tokens

        @param _connectorToken  connector token contract address
        @param _depositAmount   amount to deposit (in the connector token)
        @param _minReturn       if the conversion results in an amount smaller than the minimum return - it is cancelled, must be nonzero

        @return buy return amount
    */
    function buy(IERC20Token _connectorToken, uint256 _depositAmount, uint256 _minReturn) internal returns (uint256) {
        uint256 amount = getPurchaseReturn(_connectorToken, _depositAmount);
        // ensure the trade gives something in return and meets the minimum requested amount
        require(amount != 0 && amount >= _minReturn);

        // update virtual balance if relevant
        Connector storage connector = connectors[_connectorToken];
        if (connector.isVirtualBalanceEnabled)
            connector.virtualBalance = safeAdd(connector.virtualBalance, _depositAmount);

        // transfer funds from the caller in the connector token
        assert(_connectorToken.transferFrom(msg.sender, this, _depositAmount));
        // issue new funds to the caller in the smart token
        token.issue(msg.sender, amount);

        // calculate conversion fee and dispatch the conversion event
        uint256 feeAmount = safeSub(amount, getFinalAmount(amount, 1));
        dispatchConversionEvent(_connectorToken, token, _depositAmount, amount, feeAmount);

        // dispatch price data update for the smart token/connector
        emit PriceDataUpdate(_connectorToken, token.totalSupply(), getConnectorBalance(_connectorToken), connector.weight);
        return amount;
    }

    /**
        @dev sells the token by withdrawing from one of its connector tokens

        @param _connectorToken  connector token contract address
        @param _sellAmount      amount to sell (in the smart token)
        @param _minReturn       if the conversion results in an amount smaller the minimum return - it is cancelled, must be nonzero

        @return sell return amount
    */
    function sell(IERC20Token _connectorToken, uint256 _sellAmount, uint256 _minReturn) internal returns (uint256) {
        require(_sellAmount <= token.balanceOf(msg.sender)); // validate input

        uint256 amount = getSaleReturn(_connectorToken, _sellAmount);
        // ensure the trade gives something in return and meets the minimum requested amount
        require(amount != 0 && amount >= _minReturn);

        // ensure that the trade will only deplete the connector balance if the total supply is depleted as well
        uint256 tokenSupply = token.totalSupply();
        uint256 connectorBalance = getConnectorBalance(_connectorToken);
        assert(amount < connectorBalance || (amount == connectorBalance && _sellAmount == tokenSupply));

        // update virtual balance if relevant
        Connector storage connector = connectors[_connectorToken];
        if (connector.isVirtualBalanceEnabled)
            connector.virtualBalance = safeSub(connector.virtualBalance, amount);

        // destroy _sellAmount from the caller's balance in the smart token
        token.destroy(msg.sender, _sellAmount);
        // transfer funds to the caller in the connector token
        // the transfer might fail if the actual connector balance is smaller than the virtual balance
        assert(_connectorToken.transfer(msg.sender, amount));

        // calculate conversion fee and dispatch the conversion event
        uint256 feeAmount = safeSub(amount, getFinalAmount(amount, 1));
        dispatchConversionEvent(token, _connectorToken, _sellAmount, amount, feeAmount);

        // dispatch price data update for the smart token/connector
        emit PriceDataUpdate(_connectorToken, token.totalSupply(), getConnectorBalance(_connectorToken), connector.weight);
        return amount;
    }

    /**
        @dev converts the token to any other token in the bancor network by following a predefined conversion path
        note that when converting from an ERC20 token (as opposed to a smart token), allowance must be set beforehand

        @param _path        conversion path, see conversion path format in the BancorNetwork contract
        @param _amount      amount to convert from (in the initial source token)
        @param _minReturn   if the conversion results in an amount smaller than the minimum return - it is cancelled, must be nonzero

        @return tokens issued in return
    */
    function quickConvert(IERC20Token[] _path, uint256 _amount, uint256 _minReturn)
        public
        payable
        validConversionPath(_path)
        returns (uint256)
    {
        return quickConvertPrioritized(_path, _amount, _minReturn, 0x0, 0x0, 0x0, 0x0);
    }

    /**
        @dev converts the token to any other token in the bancor network by following a predefined conversion path
        note that when converting from an ERC20 token (as opposed to a smart token), allowance must be set beforehand

        @param _path        conversion path, see conversion path format in the BancorNetwork contract
        @param _amount      amount to convert from (in the initial source token)
        @param _minReturn   if the conversion results in an amount smaller than the minimum return - it is cancelled, must be nonzero
        @param _block       if the current block exceeded the given parameter - it is cancelled
        @param _v           (signature[128:130]) associated with the signer address and helps validating if the signature is legit
        @param _r           (signature[0:64]) associated with the signer address and helps validating if the signature is legit
        @param _s           (signature[64:128]) associated with the signer address and helps validating if the signature is legit

        @return tokens issued in return
    */
    function quickConvertPrioritized(IERC20Token[] _path, uint256 _amount, uint256 _minReturn, uint256 _block, uint8 _v, bytes32 _r, bytes32 _s)
        public
        payable
        validConversionPath(_path)
        returns (uint256)
    {
        IERC20Token fromToken = _path[0];
        IBancorNetwork bancorNetwork = IBancorNetwork(registry.addressOf(ContractIds.BANCOR_NETWORK));

        // we need to transfer the source tokens from the caller to the BancorNetwork contract,
        // so it can execute the conversion on behalf of the caller
        if (msg.value == 0) {
            // not ETH, send the source tokens to the BancorNetwork contract
            // if the token is the smart token, no allowance is required - destroy the tokens
            // from the caller and issue them to the BancorNetwork contract
            if (fromToken == token) {
                token.destroy(msg.sender, _amount); // destroy _amount tokens from the caller's balance in the smart token
                token.issue(bancorNetwork, _amount); // issue _amount new tokens to the BancorNetwork contract
            } else {
                // otherwise, we assume we already have allowance, transfer the tokens directly to the BancorNetwork contract
                assert(fromToken.transferFrom(msg.sender, bancorNetwork, _amount));
            }
        }

        // execute the conversion and pass on the ETH with the call
        return bancorNetwork.convertForPrioritized2.value(msg.value)(_path, _amount, _minReturn, msg.sender, _block, _v, _r, _s);
    }

    // deprecated, backward compatibility
    function change(IERC20Token _fromToken, IERC20Token _toToken, uint256 _amount, uint256 _minReturn) public returns (uint256) {
        return convertInternal(_fromToken, _toToken, _amount, _minReturn);
    }

    /**
        @dev helper, dispatches the Conversion event

        @param _fromToken       ERC20 token to convert from
        @param _toToken         ERC20 token to convert to
        @param _amount          amount purchased/sold (in the source token)
        @param _returnAmount    amount returned (in the target token)
    */
    function dispatchConversionEvent(IERC20Token _fromToken, IERC20Token _toToken, uint256 _amount, uint256 _returnAmount, uint256 _feeAmount) private {
        // fee amount is converted to 255 bits -
        // negative amount means the fee is taken from the source token, positive amount means its taken from the target token
        // currently the fee is always taken from the target token
        // since we convert it to a signed number, we first ensure that it's capped at 255 bits to prevent overflow
        assert(_feeAmount <= 2 ** 255);
        emit Conversion(_fromToken, _toToken, msg.sender, _amount, _returnAmount, int256(_feeAmount));
    }

    /**
        @dev fallback, buys the smart token with ETH
        note that the purchase will use the price at the time of the purchase
    */
    function() payable public {
        quickConvert(quickBuyPath, msg.value, 1);
    }
}

Contract ABI
[{"constant":false,"inputs":[{"name":"_connectorToken","type":"address"},{"name":"_weight","type":"uint32"},{"name":"_enableVirtualBalance","type":"bool"},{"name":"_virtualBalance","type":"uint256"}],"name":"updateConnector","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"connectors","outputs":[{"name":"virtualBalance","type":"uint256"},{"name":"weight","type":"uint32"},{"name":"isVirtualBalanceEnabled","type":"bool"},{"name":"isPurchaseEnabled","type":"bool"},{"name":"isSet","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"connectorTokens","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_fromToken","type":"address"},{"name":"_toToken","type":"address"},{"name":"_amount","type":"uint256"}],"name":"getReturn","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_newOwner","type":"address"}],"name":"transferTokenOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_path","type":"address[]"},{"name":"_amount","type":"uint256"},{"name":"_minReturn","type":"uint256"},{"name":"_block","type":"uint256"},{"name":"_v","type":"uint8"},{"name":"_r","type":"bytes32"},{"name":"_s","type":"bytes32"}],"name":"quickConvertPrioritized","outputs":[{"name":"","type":"uint256"}],"payable":true,"stateMutability":"payable","type":"function"},{"constant":false,"inputs":[{"name":"_disable","type":"bool"}],"name":"disableConversions","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_fromToken","type":"address"},{"name":"_toToken","type":"address"},{"name":"_amount","type":"uint256"},{"name":"_minReturn","type":"uint256"}],"name":"convertInternal","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"acceptTokenOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_amount","type":"uint256"},{"name":"_magnitude","type":"uint8"}],"name":"getFinalAmount","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"converterType","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_token","type":"address"},{"name":"_weight","type":"uint32"},{"name":"_enableVirtualBalance","type":"bool"}],"name":"addConnector","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_token","type":"address"},{"name":"_to","type":"address"},{"name":"_amount","type":"uint256"}],"name":"withdrawFromToken","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"newManager","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"manager","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_whitelist","type":"address"}],"name":"setConversionWhitelist","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"clearQuickBuyPath","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_connectorToken","type":"address"},{"name":"_disable","type":"bool"}],"name":"disableConnectorPurchases","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"version","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"conversionFee","outputs":[{"name":"","type":"uint32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"BANCOR_CONVERTER_FACTORY","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_token","type":"address"},{"name":"_to","type":"address"},{"name":"_amount","type":"uint256"}],"name":"withdrawTokens","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_fromToken","type":"address"},{"name":"_toToken","type":"address"},{"name":"_amount","type":"uint256"},{"name":"_minReturn","type":"uint256"}],"name":"change","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"BANCOR_FORMULA","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"connectorTokenCount","outputs":[{"name":"","type":"uint16"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_connectorToken","type":"address"},{"name":"_sellAmount","type":"uint256"}],"name":"getSaleReturn","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_fromToken","type":"address"},{"name":"_toToken","type":"address"},{"name":"_amount","type":"uint256"},{"name":"_minReturn","type":"uint256"}],"name":"convert","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"acceptOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"registry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONTRACT_FEATURES","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_disable","type":"bool"}],"name":"disableTokenTransfers","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_fromConnectorToken","type":"address"},{"name":"_toConnectorToken","type":"address"},{"name":"_sellAmount","type":"uint256"}],"name":"getCrossConnectorReturn","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"BANCOR_NETWORK","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"BANCOR_GAS_PRICE_LIMIT","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"CONVERTER_CONVERSION_WHITELIST","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getQuickBuyPathLength","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"maxConversionFee","outputs":[{"name":"","type":"uint32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_connectorToken","type":"address"},{"name":"_depositAmount","type":"uint256"}],"name":"getPurchaseReturn","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_registry","type":"address"}],"name":"setRegistry","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"conversionsEnabled","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"conversionWhitelist","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"acceptManagement","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_path","type":"address[]"}],"name":"setQuickBuyPath","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"newOwner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_connectorToken","type":"address"}],"name":"getConnectorBalance","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_newManager","type":"address"}],"name":"transferManagement","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"quickBuyPath","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_conversionFee","type":"uint32"}],"name":"setConversionFee","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_path","type":"address[]"},{"name":"_amount","type":"uint256"},{"name":"_minReturn","type":"uint256"}],"name":"quickConvert","outputs":[{"name":"","type":"uint256"}],"payable":true,"stateMutability":"payable","type":"function"},{"constant":false,"inputs":[{"name":"_newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"token","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"_token","type":"address"},{"name":"_registry","type":"address"},{"name":"_maxConversionFee","type":"uint32"},{"name":"_connectorToken","type":"address"},{"name":"_connectorWeight","type":"uint32"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"payable":true,"stateMutability":"payable","type":"fallback"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_fromToken","type":"address"},{"indexed":true,"name":"_toToken","type":"address"},{"indexed":true,"name":"_trader","type":"address"},{"indexed":false,"name":"_amount","type":"uint256"},{"indexed":false,"name":"_return","type":"uint256"},{"indexed":false,"name":"_conversionFee","type":"int256"}],"name":"Conversion","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_connectorToken","type":"address"},{"indexed":false,"name":"_tokenSupply","type":"uint256"},{"indexed":false,"name":"_connectorBalance","type":"uint256"},{"indexed":false,"name":"_connectorWeight","type":"uint32"}],"name":"PriceDataUpdate","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"_prevFee","type":"uint32"},{"indexed":false,"name":"_newFee","type":"uint32"}],"name":"ConversionFeeUpdate","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_prevManager","type":"address"},{"indexed":true,"name":"_newManager","type":"address"}],"name":"ManagerUpdate","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_prevOwner","type":"address"},{"indexed":true,"name":"_newOwner","type":"address"}],"name":"OwnerUpdate","type":"event"}]

Contract Creation Code
60c0604052600460808190527f302e31300000000000000000000000000000000000000000000000000000000060a090815262000040916005919062000594565b506040805180820190915260068082527f62616e636f720000000000000000000000000000000000000000000000000000602090920191825262000085918162000594565b50600c80546001606860020a0319166c01000000000000000000000000179055348015620000b257600080fd5b5060405160a08062003ce58339810160409081528151602083015191830151606084015160809094015160008054600160a060020a03191633600160a060020a039081169190911782559395929386908190811615156200011257600080fd5b5060028054600160a060020a0319908116600160a060020a0393841617909155600380549091163383161790558590811615156200014f57600080fd5b8460008163ffffffff1610158015620001715750620f424063ffffffff821611155b15156200017d57600080fd5b60078054600160a060020a031916600160a060020a038981169190911791829055604080517fbb34534c0000000000000000000000000000000000000000000000000000000081527f436f6e747261637446656174757265730000000000000000000000000000000060048201529051929091169163bb34534c916024808201926020929091908290030181600087803b1580156200021b57600080fd5b505af115801562000230573d6000803e3d6000fd5b505050506040513d60208110156200024757600080fd5b50519250600160a060020a03831615620002de57604080517f2c7077c000000000000000000000000000000000000000000000000000000000815260016004820181905260248201529051600160a060020a03851691632c7077c091604480830192600092919082900301818387803b158015620002c457600080fd5b505af1158015620002d9573d6000803e3d6000fd5b505050505b600c805467ffffffff00000000191664010000000063ffffffff891602179055600160a060020a038516156200032557620003258585600064010000000062000333810204565b505050505050505062000639565b60005433600160a060020a039081169116146200034c57fe5b600254604080517f8da5cb5b0000000000000000000000000000000000000000000000000000000081529051600160a060020a03308116931691638da5cb5b9160048083019260209291908290030181600087803b158015620003ae57600080fd5b505af1158015620003c3573d6000803e3d6000fd5b505050506040513d6020811015620003da57600080fd5b5051600160a060020a03161415620003ee57fe5b82600160a060020a03811615156200040557600080fd5b8330600160a060020a031681600160a060020a0316141515156200042857600080fd5b8360008163ffffffff16118015620004495750620f424063ffffffff821611155b15156200045557600080fd5b600254600160a060020a038781169116148015906200049a5750600160a060020a0386166000908152600b60205260409020600101546601000000000000900460ff16155b8015620004b95750600c54620f424063ffffffff918216870190911611155b1515620004c557600080fd5b505050600160a060020a039092166000818152600b602052604081208181556001908101805466ff0000000000001965ff0000000000199715156401000000000264ff000000001963ffffffff808a1663ffffffff19958616179190911691909117989098166501000000000017166601000000000000179091556009805492830181559092527f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af018054600160a060020a031916909217909155600c80548085169093019093169116179055565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10620005d757805160ff191683800117855562000607565b8280016001018555821562000607579182015b8281111562000607578251825591602001919060010190620005ea565b506200061592915062000619565b5090565b6200063691905b8082111562000615576000815560010162000620565b90565b61369c80620006496000396000f3006080604052600436106102585763ffffffff60e060020a6000350416630ca7892381146102c15780630e53aae9146102f557806319b640151461034a5780631e1401f81461037e57806321e6b53d146103ba57806322742564146103db578063228d2820146104435780632a2e2f0c1461045d57806338a5e0161461048a5780633aa0145a1461049f5780633e8ff43f146104bd5780633f4d2fc21461054757806341a5b33d1461057657806342906029146105a0578063481c6a75146105b55780634af80f0e146105ca5780634e2280c4146105eb578063514385be1461060057806354fd4d5014610626578063579cd3ca1461063b5780635a46f06c146106695780635e35359e1461067e5780635e5144eb146106a85780636d7bd3fc146106d557806371f52bf3146106ea57806372b44b2c1461071657806375892cf11461073a57806379ba5097146107675780637b1039991461077c57806383315b6e1461079157806385d5e631146107a65780638da5cb5b146107c05780638e3047e0146107d55780639232494e146107ff5780639249993a1461081457806392d1abb7146108295780639396a7f01461083e57806394c275ad14610853578063a2c4c33614610868578063a91ee0dc1461088c578063bf754558146108ad578063c45d3d92146108d6578063c8c2fe6c146108eb578063d395ee0f14610900578063d4ee1d9014610955578063d89595121461096a578063e4edf8521461098b578063e7ee85a5146109ac578063ecbca55d146109c4578063f0843ba9146109e2578063f2fde38b14610a33578063fc0c546a14610a54575b6102be600a8054806020026020016040519081016040528092919081815260200182805480156102b157602002820191906000526020600020905b8154600160a060020a03168152600190910190602001808311610293575b5050505050346001610a69565b50005b3480156102cd57600080fd5b506102f3600160a060020a036004351663ffffffff602435166044351515606435610ab4565b005b34801561030157600080fd5b50610316600160a060020a0360043516610bc8565b6040805195865263ffffffff9094166020860152911515848401521515606084015215156080830152519081900360a00190f35b34801561035657600080fd5b50610362600435610c0e565b60408051600160a060020a039092168252519081900360200190f35b34801561038a57600080fd5b506103a8600160a060020a0360043581169060243516604435610c36565b60408051918252519081900360200190f35b3480156103c657600080fd5b506102f3600160a060020a0360043516610cad565b604080516020600480358082013583810280860185019096528085526103a895369593946024949385019291829185019084908082843750949750508435955050506020830135926040810135925060ff606082013516915060808101359060a00135610d47565b34801561044f57600080fd5b506102f3600435151561114a565b34801561046957600080fd5b506103a8600160a060020a03600435811690602435166044356064356111ad565b34801561049657600080fd5b506102f36116f7565b3480156104ab57600080fd5b506103a860043560ff6024351661177c565b3480156104c957600080fd5b506104d26117d8565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561050c5781810151838201526020016104f4565b50505050905090810190601f1680156105395780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561055357600080fd5b506102f3600160a060020a036004351663ffffffff602435166044351515611866565b34801561058257600080fd5b506102f3600160a060020a0360043581169060243516604435611ac8565b3480156105ac57600080fd5b50610362611b73565b3480156105c157600080fd5b50610362611b82565b3480156105d657600080fd5b506102f3600160a060020a0360043516611b91565b3480156105f757600080fd5b506102f3611bfb565b34801561060c57600080fd5b506102f3600160a060020a03600435166024351515611c23565b34801561063257600080fd5b506104d2611cac565b34801561064757600080fd5b50610650611d07565b6040805163ffffffff9092168252519081900360200190f35b34801561067557600080fd5b506103a8611d1f565b34801561068a57600080fd5b506102f3600160a060020a0360043581169060243516604435611d43565b3480156106b457600080fd5b506103a8600160a060020a0360043581169060243516604435606435611e48565b3480156106e157600080fd5b506103a8611e56565b3480156106f657600080fd5b506106ff611e7a565b6040805161ffff9092168252519081900360200190f35b34801561072257600080fd5b506103a8600160a060020a0360043516602435611e81565b34801561074657600080fd5b506103a8600160a060020a0360043581169060243516604435606435612180565b34801561077357600080fd5b506102f3612221565b34801561078857600080fd5b506103626122ad565b34801561079d57600080fd5b506103a86122bc565b3480156107b257600080fd5b506102f360043515156122e0565b3480156107cc57600080fd5b5061036261235f565b3480156107e157600080fd5b506103a8600160a060020a036004358116906024351660443561236e565b34801561080b57600080fd5b506103a8612665565b34801561082057600080fd5b506103a8612689565b34801561083557600080fd5b506103a86126ad565b34801561084a57600080fd5b506103a86126b2565b34801561085f57600080fd5b506106506126b8565b34801561087457600080fd5b506103a8600160a060020a03600435166024356126cc565b34801561089857600080fd5b506102f3600160a060020a036004351661299f565b3480156108b957600080fd5b506108c2612a20565b604080519115158252519081900360200190f35b3480156108e257600080fd5b50610362612a39565b3480156108f757600080fd5b506102f3612a48565b34801561090c57600080fd5b50604080516020600480358082013583810280860185019096528085526102f395369593946024949385019291829185019084908082843750949750612ad69650505050505050565b34801561096157600080fd5b50610362612b36565b34801561097657600080fd5b506103a8600160a060020a0360043516612b45565b34801561099757600080fd5b506102f3600160a060020a0360043516612c43565b3480156109b857600080fd5b50610362600435612cc3565b3480156109d057600080fd5b506102f363ffffffff60043516612cd1565b604080516020600480358082013583810280860185019096528085526103a895369593946024949385019291829185019084908082843750949750508435955050506020909201359150610a699050565b348015610a3f57600080fd5b506102f3600160a060020a0360043516612dc0565b348015610a6057600080fd5b50610362612e22565b60008360028151118015610a7f57506015815111155b8015610a9057508051600290066001145b1515610a9b57600080fd5b610aab8585856000808080610d47565b95945050505050565b6000805433600160a060020a03908116911614610acd57fe5b600160a060020a0385166000908152600b602052604090206001015485906601000000000000900460ff161515610b0357600080fd5b8460008163ffffffff16118015610b235750620f424063ffffffff821611155b1515610b2e57600080fd5b600160a060020a0387166000908152600b602052604090206001810154600c54919450620f424063ffffffff918216928216929092038801161115610b7257600080fd5b5050600181018054600c805463ffffffff928316818416038801831663ffffffff199182161790915582549515156401000000000264ff0000000019929097169516949094179390931693909317909155905550565b600b602052600090815260409020805460019091015463ffffffff81169060ff640100000000820481169165010000000000810482169166010000000000009091041685565b6009805482908110610c1c57fe5b600091825260209091200154600160a060020a0316905081565b6000600160a060020a038481169084161415610c5157600080fd5b600254600160a060020a0384811691161415610c7857610c7184836126cc565b9050610ca6565b600254600160a060020a0385811691161415610c9857610c718383611e81565b610ca384848461236e565b90505b9392505050565b60005433600160a060020a03908116911614610cc557fe5b600254604080517ff2fde38b000000000000000000000000000000000000000000000000000000008152600160a060020a0384811660048301529151919092169163f2fde38b91602480830192600092919082900301818387803b158015610d2c57600080fd5b505af1158015610d40573d6000803e3d6000fd5b5050505050565b60008060008960028151118015610d6057506015815111155b8015610d7157508051600290066001145b1515610d7c57600080fd5b8a6000815181101515610d8b57fe5b6020908102909101810151600754604080517fbb34534c0000000000000000000000000000000000000000000000000000000081527f42616e636f724e6574776f726b0000000000000000000000000000000000000060048201529051929650600160a060020a039091169263bb34534c926024808401938290030181600087803b158015610e1957600080fd5b505af1158015610e2d573d6000803e3d6000fd5b505050506040513d6020811015610e4357600080fd5b5051915034151561102757600254600160a060020a0384811691161415610f7f57600254604080517fa24835d1000000000000000000000000000000000000000000000000000000008152600160a060020a033381166004830152602482018e90529151919092169163a24835d191604480830192600092919082900301818387803b158015610ed257600080fd5b505af1158015610ee6573d6000803e3d6000fd5b50505050600260009054906101000a9004600160a060020a0316600160a060020a031663867904b4838c6040518363ffffffff1660e060020a0281526004018083600160a060020a0316600160a060020a0316815260200182815260200192505050600060405180830381600087803b158015610f6257600080fd5b505af1158015610f76573d6000803e3d6000fd5b50505050611027565b604080517f23b872dd000000000000000000000000000000000000000000000000000000008152600160a060020a0333811660048301528481166024830152604482018d90529151918516916323b872dd916064808201926020929091908290030181600087803b158015610ff357600080fd5b505af1158015611007573d6000803e3d6000fd5b505050506040513d602081101561101d57600080fd5b5051151561102757fe5b81600160a060020a0316636b08f2ef348d8d8d338e8e8e8e6040518a63ffffffff1660e060020a028152600401808060200189815260200188815260200187600160a060020a0316600160a060020a031681526020018681526020018560ff1660ff1681526020018460001916600019168152602001836000191660001916815260200182810382528a818151815260200191508051906020019060200280838360005b838110156110e35781810151838201526020016110cb565b5050505090500199505050505050505050506020604051808303818588803b15801561110e57600080fd5b505af1158015611122573d6000803e3d6000fd5b50505050506040513d602081101561113957600080fd5b50519b9a5050505050505050505050565b60005433600160a060020a0390811691161480611175575060035433600160a060020a039081169116145b151561118057600080fd5b600c80546cff000000000000000000000000191691156c0100000000000000000000000002919091179055565b600754604080517fbb34534c0000000000000000000000000000000000000000000000000000000081527f42616e636f724e6574776f726b0000000000000000000000000000000000000060048201529051600092839283928392839283928392600160a060020a03169163bb34534c91602480830192602092919082900301818787803b15801561123e57600080fd5b505af1158015611252573d6000803e3d6000fd5b505050506040513d602081101561126857600080fd5b5051905033600160a060020a039081169082161461128557600080fd5b600c546c01000000000000000000000000900460ff1615156112a357fe5b87600081116112b157600080fd5b600160a060020a038c8116908c1614156112ca57600080fd5b600254600160a060020a038c8116911614156112f2576112eb8c8b8b612e31565b97506116e8565b600254600160a060020a038d811691161415611313576112eb8b8b8b6130dc565b61131e8c8c8c61236e565b9650861580159061132f5750888710155b151561133a57600080fd5b600160a060020a038c166000908152600b602052604090206001810154909650640100000000900460ff1615611379578554611376908b6134c5565b86555b600160a060020a038b166000908152600b602052604090206001810154909550640100000000900460ff16156113b85784546113b590886134d4565b85555b6113c18b612b45565b93508387106113cc57fe5b604080517f23b872dd000000000000000000000000000000000000000000000000000000008152600160a060020a0333811660048301523081166024830152604482018d90529151918e16916323b872dd916064808201926020929091908290030181600087803b15801561144057600080fd5b505af1158015611454573d6000803e3d6000fd5b505050506040513d602081101561146a57600080fd5b5051151561147457fe5b8a600160a060020a031663a9059cbb33896040518363ffffffff1660e060020a0281526004018083600160a060020a0316600160a060020a0316815260200182815260200192505050602060405180830381600087803b1580156114d757600080fd5b505af11580156114eb573d6000803e3d6000fd5b505050506040513d602081101561150157600080fd5b5051151561150b57fe5b61151f8761151a89600261177c565b6134d4565b925061152e8c8c8c8a876134e6565b8b600160a060020a03167f8a6a7f53b3c8fa1dc4b83e3f1be668c1b251ff8d44cdcb83eb3acec3fec6a788600260009054906101000a9004600160a060020a0316600160a060020a03166318160ddd6040518163ffffffff1660e060020a028152600401602060405180830381600087803b1580156115ac57600080fd5b505af11580156115c0573d6000803e3d6000fd5b505050506040513d60208110156115d657600080fd5b50516115e18f612b45565b60018a015460408051938452602084019290925263ffffffff1682820152519081900360600190a28a600160a060020a03167f8a6a7f53b3c8fa1dc4b83e3f1be668c1b251ff8d44cdcb83eb3acec3fec6a788600260009054906101000a9004600160a060020a0316600160a060020a03166318160ddd6040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561168757600080fd5b505af115801561169b573d6000803e3d6000fd5b505050506040513d60208110156116b157600080fd5b50516116bc8e612b45565b600189015460408051938452602084019290925263ffffffff1682820152519081900360600190a28697505b50505050505050949350505050565b60005433600160a060020a0390811691161461170f57fe5b600260009054906101000a9004600160a060020a0316600160a060020a03166379ba50976040518163ffffffff1660e060020a028152600401600060405180830381600087803b15801561176257600080fd5b505af1158015611776573d6000803e3d6000fd5b50505050565b60008160ff16620f42400a67ffffffffffffffff166117c7848460ff16600c60089054906101000a900463ffffffff1663ffffffff16620f4240030a67ffffffffffffffff1661356b565b8115156117d057fe5b049392505050565b6006805460408051602060026001851615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561185e5780601f106118335761010080835404028352916020019161185e565b820191906000526020600020905b81548152906001019060200180831161184157829003601f168201915b505050505081565b60005433600160a060020a0390811691161461187e57fe5b600254604080517f8da5cb5b0000000000000000000000000000000000000000000000000000000081529051600160a060020a03308116931691638da5cb5b9160048083019260209291908290030181600087803b1580156118df57600080fd5b505af11580156118f3573d6000803e3d6000fd5b505050506040513d602081101561190957600080fd5b5051600160a060020a0316141561191c57fe5b82600160a060020a038116151561193257600080fd5b8330600160a060020a031681600160a060020a03161415151561195457600080fd5b8360008163ffffffff161180156119745750620f424063ffffffff821611155b151561197f57600080fd5b600254600160a060020a038781169116148015906119c35750600160a060020a0386166000908152600b60205260409020600101546601000000000000900460ff16155b80156119e15750600c54620f424063ffffffff918216870190911611155b15156119ec57600080fd5b505050600160a060020a039092166000818152600b602052604081208181556001908101805466ff0000000000001965ff0000000000199715156401000000000264ff000000001963ffffffff808a1663ffffffff19958616179190911691909117989098166501000000000017166601000000000000179091556009805492830181559092527f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af01805473ffffffffffffffffffffffffffffffffffffffff1916909217909155600c80548085169093019093169116179055565b60005433600160a060020a03908116911614611ae057fe5b600254604080517f5e35359e000000000000000000000000000000000000000000000000000000008152600160a060020a03868116600483015285811660248301526044820185905291519190921691635e35359e91606480830192600092919082900301818387803b158015611b5657600080fd5b505af1158015611b6a573d6000803e3d6000fd5b50505050505050565b600454600160a060020a031681565b600354600160a060020a031681565b60005433600160a060020a03908116911614611ba957fe5b8030600160a060020a031681600160a060020a031614151515611bcb57600080fd5b506008805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b60005433600160a060020a03908116911614611c1357fe5b6000611c20600a8261358f565b50565b60005433600160a060020a03908116911614611c3b57fe5b600160a060020a0382166000908152600b602052604090206001015482906601000000000000900460ff161515611c7157600080fd5b50600160a060020a03919091166000908152600b60205260409020600101805465ff0000000000191691156501000000000002919091179055565b6005805460408051602060026001851615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561185e5780601f106118335761010080835404028352916020019161185e565b600c5468010000000000000000900463ffffffff1681565b7f42616e636f72436f6e766572746572466163746f72790000000000000000000081565b60005433600160a060020a03908116911614611d5b57fe5b82600160a060020a0381161515611d7157600080fd5b82600160a060020a0381161515611d8757600080fd5b8330600160a060020a031681600160a060020a031614151515611da957600080fd5b85600160a060020a031663a9059cbb86866040518363ffffffff1660e060020a0281526004018083600160a060020a0316600160a060020a0316815260200182815260200192505050602060405180830381600087803b158015611e0c57600080fd5b505af1158015611e20573d6000803e3d6000fd5b505050506040513d6020811015611e3657600080fd5b50511515611e4057fe5b505050505050565b6000610aab858585856111ad565b7f42616e636f72466f726d756c610000000000000000000000000000000000000081565b6009545b90565b60008060008060008030600160a060020a0316600260009054906101000a9004600160a060020a0316600160a060020a0316638da5cb5b6040518163ffffffff1660e060020a028152600401602060405180830381600087803b158015611ee757600080fd5b505af1158015611efb573d6000803e3d6000fd5b505050506040513d6020811015611f1157600080fd5b5051600160a060020a031614611f2357fe5b600160a060020a0388166000908152600b602052604090206001015488906601000000000000900460ff161515611f5957600080fd5b600160a060020a03808a166000908152600b6020908152604080832060025482517f18160ddd0000000000000000000000000000000000000000000000000000000081529251919b50909416936318160ddd93600480840194938390030190829087803b158015611fc957600080fd5b505af1158015611fdd573d6000803e3d6000fd5b505050506040513d6020811015611ff357600080fd5b5051945061200089612b45565b600754604080517fbb34534c0000000000000000000000000000000000000000000000000000000081527f42616e636f72466f726d756c610000000000000000000000000000000000000060048201529051929650600160a060020a039091169163bb34534c916024808201926020929091908290030181600087803b15801561208957600080fd5b505af115801561209d573d6000803e3d6000fd5b505050506040513d60208110156120b357600080fd5b50516001870154604080517f49f9b0f7000000000000000000000000000000000000000000000000000000008152600481018990526024810188905263ffffffff9092166044830152606482018b905251919450600160a060020a038516916349f9b0f7916084808201926020929091908290030181600087803b15801561213a57600080fd5b505af115801561214e573d6000803e3d6000fd5b505050506040513d602081101561216457600080fd5b5051915061217382600161177c565b9998505050505050505050565b60408051606081018252600160a060020a038087168252600254811660208301528516918101919091526000906121bb90600d9060036135b3565b50610aab600d80548060200260200160405190810160405280929190818152602001828054801561221557602002820191906000526020600020905b8154600160a060020a031681526001909101906020018083116121f7575b50505050508484610a69565b60015433600160a060020a0390811691161461223c57600080fd5b60015460008054604051600160a060020a0393841693909116917f343765429aea5a34b3ff6a3785a98a5abb2597aca87bfbb58632c173d585373a91a3600180546000805473ffffffffffffffffffffffffffffffffffffffff19908116600160a060020a03841617909155169055565b600754600160a060020a031681565b7f436f6e747261637446656174757265730000000000000000000000000000000081565b60005433600160a060020a039081169116146122f857fe5b600254604080517f1608f18f00000000000000000000000000000000000000000000000000000000815283151560048201529051600160a060020a0390921691631608f18f9160248082019260009290919082900301818387803b158015610d2c57600080fd5b600054600160a060020a031681565b600080600080600080600030600160a060020a0316600260009054906101000a9004600160a060020a0316600160a060020a0316638da5cb5b6040518163ffffffff1660e060020a028152600401602060405180830381600087803b1580156123d657600080fd5b505af11580156123ea573d6000803e3d6000fd5b505050506040513d602081101561240057600080fd5b5051600160a060020a03161461241257fe5b600160a060020a038a166000908152600b60205260409020600101548a906601000000000000900460ff16151561244857600080fd5b600160a060020a038a166000908152600b60205260409020600101548a906601000000000000900460ff16151561247e57600080fd5b600160a060020a038c81166000908152600b6020526040808220928e16825290206001810154919950975065010000000000900460ff1615156124c057600080fd5b6124c98c612b45565b95506124d48b612b45565b600754604080517fbb34534c0000000000000000000000000000000000000000000000000000000081527f42616e636f72466f726d756c610000000000000000000000000000000000000060048201529051929750600160a060020a039091169163bb34534c916024808201926020929091908290030181600087803b15801561255d57600080fd5b505af1158015612571573d6000803e3d6000fd5b505050506040513d602081101561258757600080fd5b505160018981015490890154604080517f65098bb3000000000000000000000000000000000000000000000000000000008152600481018b905263ffffffff9384166024820152604481018a9052929091166064830152608482018d905251919550600160a060020a038616916365098bb39160a4808201926020929091908290030181600087803b15801561261c57600080fd5b505af1158015612630573d6000803e3d6000fd5b505050506040513d602081101561264657600080fd5b5051925061265583600261177c565b9c9b505050505050505050505050565b7f42616e636f724e6574776f726b0000000000000000000000000000000000000081565b7f42616e636f7247617350726963654c696d69740000000000000000000000000081565b600181565b600a5490565b600c54640100000000900463ffffffff1681565b60008060008060008030600160a060020a0316600260009054906101000a9004600160a060020a0316600160a060020a0316638da5cb5b6040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561273257600080fd5b505af1158015612746573d6000803e3d6000fd5b505050506040513d602081101561275c57600080fd5b5051600160a060020a03161461276e57fe5b600160a060020a0388166000908152600b602052604090206001015488906601000000000000900460ff1615156127a457600080fd5b600160a060020a0389166000908152600b60205260409020600181015490965065010000000000900460ff1615156127db57600080fd5b600260009054906101000a9004600160a060020a0316600160a060020a03166318160ddd6040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561282e57600080fd5b505af1158015612842573d6000803e3d6000fd5b505050506040513d602081101561285857600080fd5b5051945061286589612b45565b600754604080517fbb34534c0000000000000000000000000000000000000000000000000000000081527f42616e636f72466f726d756c610000000000000000000000000000000000000060048201529051929650600160a060020a039091169163bb34534c916024808201926020929091908290030181600087803b1580156128ee57600080fd5b505af1158015612902573d6000803e3d6000fd5b505050506040513d602081101561291857600080fd5b50516001870154604080517f29a00e7c000000000000000000000000000000000000000000000000000000008152600481018990526024810188905263ffffffff9092166044830152606482018b905251919450600160a060020a038516916329a00e7c916084808201926020929091908290030181600087803b15801561213a57600080fd5b60005433600160a060020a039081169116146129b757fe5b80600160a060020a03811615156129cd57600080fd5b8130600160a060020a031681600160a060020a0316141515156129ef57600080fd5b50506007805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600c546c01000000000000000000000000900460ff1681565b600854600160a060020a031681565b60045433600160a060020a03908116911614612a6357600080fd5b600454600354604051600160a060020a0392831692909116907fbe4cc281795971a471c980e842627a7f1ea3892ddfce8c5b6357cd2611c1973290600090a3600480546003805473ffffffffffffffffffffffffffffffffffffffff19908116600160a060020a03841617909155169055565b60005433600160a060020a03908116911614612aee57fe5b8060028151118015612b0257506015815111155b8015612b1357508051600290066001145b1515612b1e57600080fd5b8151612b3190600a9060208501906135b3565b505050565b600154600160a060020a031681565b600160a060020a0381166000908152600b6020526040812060010154819083906601000000000000900460ff161515612b7d57600080fd5b600160a060020a0384166000908152600b602052604090206001810154909250640100000000900460ff16612c385783600160a060020a03166370a08231306040518263ffffffff1660e060020a0281526004018082600160a060020a0316600160a060020a03168152602001915050602060405180830381600087803b158015612c0757600080fd5b505af1158015612c1b573d6000803e3d6000fd5b505050506040513d6020811015612c3157600080fd5b5051612c3b565b81545b949350505050565b60005433600160a060020a0390811691161480612c6e575060035433600160a060020a039081169116145b1515612c7957600080fd5b600354600160a060020a0382811691161415612c9457600080fd5b6004805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600a805482908110610c1c57fe5b60005433600160a060020a0390811691161480612cfc575060035433600160a060020a039081169116145b1515612d0757600080fd5b8060008163ffffffff1610158015612d335750600c5463ffffffff640100000000909104811690821611155b1515612d3e57600080fd5b600c546040805163ffffffff6801000000000000000090930483168152918416602083015280517f81cd2ffb37dd237c0e4e2a3de5265fcf9deb43d3e7801e80db9f1ccfba7ee6009281900390910190a150600c805463ffffffff90921668010000000000000000026bffffffff000000000000000019909216919091179055565b60005433600160a060020a03908116911614612dd857fe5b600054600160a060020a0382811691161415612df357600080fd5b6001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0392909216919091179055565b600254600160a060020a031681565b600080600080612e4187876126cc565b92508215801590612e525750848310155b1515612e5d57600080fd5b600160a060020a0387166000908152600b602052604090206001810154909250640100000000900460ff1615612e9c578154612e9990876134c5565b82555b604080517f23b872dd000000000000000000000000000000000000000000000000000000008152600160a060020a0333811660048301523081166024830152604482018990529151918916916323b872dd916064808201926020929091908290030181600087803b158015612f1057600080fd5b505af1158015612f24573d6000803e3d6000fd5b505050506040513d6020811015612f3a57600080fd5b50511515612f4457fe5b600254604080517f867904b4000000000000000000000000000000000000000000000000000000008152600160a060020a033381166004830152602482018790529151919092169163867904b491604480830192600092919082900301818387803b158015612fb257600080fd5b505af1158015612fc6573d6000803e3d6000fd5b50505050612fd98361151a85600161177c565b600254909150612ff6908890600160a060020a03168886856134e6565b86600160a060020a03167f8a6a7f53b3c8fa1dc4b83e3f1be668c1b251ff8d44cdcb83eb3acec3fec6a788600260009054906101000a9004600160a060020a0316600160a060020a03166318160ddd6040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561307457600080fd5b505af1158015613088573d6000803e3d6000fd5b505050506040513d602081101561309e57600080fd5b50516130a98a612b45565b600186015460408051938452602084019290925263ffffffff1682820152519081900360600190a2509095945050505050565b600254604080517f70a08231000000000000000000000000000000000000000000000000000000008152600160a060020a03338116600483015291516000938493849384938493849316916370a0823191602480830192602092919082900301818787803b15801561314d57600080fd5b505af1158015613161573d6000803e3d6000fd5b505050506040513d602081101561317757600080fd5b505188111561318557600080fd5b61318f8989611e81565b945084158015906131a05750868510155b15156131ab57600080fd5b600260009054906101000a9004600160a060020a0316600160a060020a03166318160ddd6040518163ffffffff1660e060020a028152600401602060405180830381600087803b1580156131fe57600080fd5b505af1158015613212573d6000803e3d6000fd5b505050506040513d602081101561322857600080fd5b5051935061323589612b45565b92508285108061324e5750828514801561324e57508388145b151561325657fe5b600160a060020a0389166000908152600b602052604090206001810154909250640100000000900460ff161561329557815461329290866134d4565b82555b600254604080517fa24835d1000000000000000000000000000000000000000000000000000000008152600160a060020a033381166004830152602482018c90529151919092169163a24835d191604480830192600092919082900301818387803b15801561330357600080fd5b505af1158015613317573d6000803e3d6000fd5b5050505088600160a060020a031663a9059cbb33876040518363ffffffff1660e060020a0281526004018083600160a060020a0316600160a060020a0316815260200182815260200192505050602060405180830381600087803b15801561337e57600080fd5b505af1158015613392573d6000803e3d6000fd5b505050506040513d60208110156133a857600080fd5b505115156133b257fe5b6133c18561151a87600161177c565b6002549091506133dd90600160a060020a03168a8a88856134e6565b88600160a060020a03167f8a6a7f53b3c8fa1dc4b83e3f1be668c1b251ff8d44cdcb83eb3acec3fec6a788600260009054906101000a9004600160a060020a0316600160a060020a03166318160ddd6040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561345b57600080fd5b505af115801561346f573d6000803e3d6000fd5b505050506040513d602081101561348557600080fd5b50516134908c612b45565b600186015460408051938452602084019290925263ffffffff1682820152519081900360600190a25092979650505050505050565b600082820183811015610ca657fe5b6000818310156134e057fe5b50900390565b7f800000000000000000000000000000000000000000000000000000000000000081111561351057fe5b60408051848152602081018490528082018390529051600160a060020a033381169287821692918916917f276856b36cbc45526a0ba64f44611557a2a8b68662c5388e9fe6d72e86e1c8cb9181900360600190a45050505050565b6000828202831580613587575082848281151561358457fe5b04145b1515610ca657fe5b815481835581811115612b3157600083815260209020612b31918101908301613625565b828054828255906000526020600020908101928215613615579160200282015b82811115613615578251825473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a039091161782556020909201916001909101906135d3565b5061362192915061363f565b5090565b611e7e91905b80821115613621576000815560010161362b565b611e7e91905b8082111561362157805473ffffffffffffffffffffffffffffffffffffffff191681556001016136455600a165627a7a723058207222a3b070f5f814d7a34fa79f50764677d4d3759aafdd49d616faf8b33d822c00290000000000000000000000001f573d6fb3f13d689ff844b4ce37794d79a7ff1c0000000000000000000000007148b1c9154bcf273a2c7d7b90e3edc6fee395e60000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c0829421c1d260bd3cb3e0f06cfe2d52db2ce31500000000000000000000000000000000000000000000000000000000000186a0


   Swarm Source:
bzzr://7222a3b070f5f814d7a34fa79f50764677d4d3759aafdd49d616faf8b33d822c
Block Age transaction Difficulty GasUsed Reward
Block Age Uncle Number Difficulty GasUsed Reward
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.