ETH Price: $2,454.84 (+1.72%)
 

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Liquidate109984812020-10-05 22:39:451491 days ago1601937585IN
Bancor: Converter 183
0 ETH0.0052131552
Liquidate109984052020-10-05 22:23:061491 days ago1601936586IN
Bancor: Converter 183
0 ETH0.0049123949
Fund109434222020-09-27 8:03:371500 days ago1601193817IN
Bancor: Converter 183
0 ETH0.01537137105
Fund109347892020-09-25 23:40:081501 days ago1601077208IN
Bancor: Converter 183
0 ETH0.0089300361
Fund108166072020-09-07 20:10:361519 days ago1599509436IN
Bancor: Converter 183
0 ETH0.0127373287
Liquidate104621882020-07-15 5:31:461574 days ago1594791106IN
Bancor: Converter 183
0 ETH0.005070644
Liquidate104433662020-07-12 7:30:041577 days ago1594539004IN
Bancor: Converter 183
0 ETH0.0031118327
Fund104430202020-07-12 6:17:051577 days ago1594534625IN
Bancor: Converter 183
0 ETH0.0034162426
Liquidate104291402020-07-10 2:45:041579 days ago1594349104IN
Bancor: Converter 183
0 ETH0.0035728431
Fund104286252020-07-10 0:51:481579 days ago1594342308IN
Bancor: Converter 183
0 ETH0.0032848525
Fund104282882020-07-09 23:35:031579 days ago1594337703IN
Bancor: Converter 183
0 ETH0.003035223.1
Liquidate103480702020-06-27 13:16:201592 days ago1593263780IN
Bancor: Converter 183
0 ETH0.004149136
Fund103435592020-06-26 20:26:071592 days ago1593203167IN
Bancor: Converter 183
0 ETH0.0035473127
Fund103386852020-06-26 2:22:251593 days ago1593138145IN
Bancor: Converter 183
0 ETH0.0039414630
Fund103383692020-06-26 1:10:361593 days ago1593133836IN
Bancor: Converter 183
0 ETH0.004391130
Liquidate103229302020-06-23 15:41:481596 days ago1592926908IN
Bancor: Converter 183
0 ETH0.0053021946
Liquidate102434052020-06-11 8:46:341608 days ago1591865194IN
Bancor: Converter 183
0 ETH0.004428634
Liquidate101600652020-05-29 10:11:171621 days ago1590747077IN
Bancor: Converter 183
0 ETH0.0031078431
Liquidate101556862020-05-28 17:48:201621 days ago1590688100IN
Bancor: Converter 183
0 ETH0.0046899736
Liquidate101503962020-05-27 21:55:581622 days ago1590616558IN
Bancor: Converter 183
0 ETH0.0036470828
Liquidate101320812020-05-25 1:42:581625 days ago1590370978IN
Bancor: Converter 183
0 ETH0.0027666424
Quick Convert101246192020-05-23 21:44:081626 days ago1590270248IN
Bancor: Converter 183
0 ETH0.0040988512
Quick Convert101246102020-05-23 21:42:251626 days ago1590270145IN
Bancor: Converter 183
0 ETH0.0040981312
Quick Convert101246012020-05-23 21:40:371626 days ago1590270037IN
Bancor: Converter 183
0 ETH0.0040983412
Liquidate101244422020-05-23 21:02:521626 days ago1590267772IN
Bancor: Converter 183
0 ETH0.0014330411
View all transactions

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Similar Match Source Code
This contract matches the deployed Bytecode of the Source Code for Contract 0x78c212ba...d6A098840
The constructor portion of the code might be different and could alter the actual behaviour of the contract

Contract Name:
BancorConverter

Compiler Version
v0.4.26+commit.4563c3fc

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity)

/**
 *Submitted for verification at Etherscan.io on 2019-11-19
*/

pragma solidity 0.4.26;

// File: contracts/token/interfaces/IERC20Token.sol

/*
    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) {this;}
    function symbol() public view returns (string) {this;}
    function decimals() public view returns (uint8) {this;}
    function totalSupply() public view returns (uint256) {this;}
    function balanceOf(address _owner) public view returns (uint256) {_owner; this;}
    function allowance(address _owner, address _spender) public view returns (uint256) {_owner; _spender; this;}

    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);
}

// File: contracts/utility/interfaces/IWhitelist.sol

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

// File: contracts/converter/interfaces/IBancorConverter.sol

/*
    Bancor Converter interface
*/
contract IBancorConverter {
    function getReturn(IERC20Token _fromToken, IERC20Token _toToken, uint256 _amount) public view returns (uint256, uint256);
    function convert2(IERC20Token _fromToken, IERC20Token _toToken, uint256 _amount, uint256 _minReturn, address _affiliateAccount, uint256 _affiliateFee) public returns (uint256);
    function quickConvert2(IERC20Token[] _path, uint256 _amount, uint256 _minReturn, address _affiliateAccount, uint256 _affiliateFee) public payable returns (uint256);
    function conversionWhitelist() public view returns (IWhitelist) {this;}
    function conversionFee() public view returns (uint32) {this;}
    function reserves(address _address) public view returns (uint256, uint32, bool, bool, bool) {_address; this;}
    function getReserveBalance(IERC20Token _reserveToken) public view returns (uint256);
    function reserveTokens(uint256 _index) public view returns (IERC20Token) {_index; this;}
    // deprecated, backward compatibility
    function change(IERC20Token _fromToken, IERC20Token _toToken, uint256 _amount, uint256 _minReturn) public returns (uint256);
    function convert(IERC20Token _fromToken, IERC20Token _toToken, uint256 _amount, uint256 _minReturn) public returns (uint256);
    function quickConvert(IERC20Token[] _path, uint256 _amount, uint256 _minReturn) public payable returns (uint256);
    function connectors(address _address) public view returns (uint256, uint32, bool, bool, bool);
    function getConnectorBalance(IERC20Token _connectorToken) public view returns (uint256);
    function connectorTokens(uint256 _index) public view returns (IERC20Token);
}

// File: contracts/converter/interfaces/IBancorConverterUpgrader.sol

/*
    Bancor Converter Upgrader interface
*/
contract IBancorConverterUpgrader {
    function upgrade(bytes32 _version) public;
    function upgrade(uint16 _version) public;
}

// File: contracts/converter/interfaces/IBancorFormula.sol

/*
    Bancor Formula interface
*/
contract IBancorFormula {
    function calculatePurchaseReturn(uint256 _supply, uint256 _reserveBalance, uint32 _reserveRatio, uint256 _depositAmount) public view returns (uint256);
    function calculateSaleReturn(uint256 _supply, uint256 _reserveBalance, uint32 _reserveRatio, uint256 _sellAmount) public view returns (uint256);
    function calculateCrossReserveReturn(uint256 _fromReserveBalance, uint32 _fromReserveRatio, uint256 _toReserveBalance, uint32 _toReserveRatio, uint256 _amount) public view returns (uint256);
    // deprecated, backward compatibility
    function calculateCrossConnectorReturn(uint256 _fromConnectorBalance, uint32 _fromConnectorWeight, uint256 _toConnectorBalance, uint32 _toConnectorWeight, uint256 _amount) public view returns (uint256);
}

// File: contracts/IBancorNetwork.sol

/*
    Bancor Network interface
*/
contract IBancorNetwork {
    function convert2(
        IERC20Token[] _path,
        uint256 _amount,
        uint256 _minReturn,
        address _affiliateAccount,
        uint256 _affiliateFee
    ) public payable returns (uint256);

    function claimAndConvert2(
        IERC20Token[] _path,
        uint256 _amount,
        uint256 _minReturn,
        address _affiliateAccount,
        uint256 _affiliateFee
    ) public returns (uint256);

    function convertFor2(
        IERC20Token[] _path,
        uint256 _amount,
        uint256 _minReturn,
        address _for,
        address _affiliateAccount,
        uint256 _affiliateFee
    ) public payable returns (uint256);

    function claimAndConvertFor2(
        IERC20Token[] _path,
        uint256 _amount,
        uint256 _minReturn,
        address _for,
        address _affiliateAccount,
        uint256 _affiliateFee
    ) public returns (uint256);

    function convertForPrioritized4(
        IERC20Token[] _path,
        uint256 _amount,
        uint256 _minReturn,
        address _for,
        uint256[] memory _signature,
        address _affiliateAccount,
        uint256 _affiliateFee
    ) public payable returns (uint256);

    // deprecated, backward compatibility
    function convert(
        IERC20Token[] _path,
        uint256 _amount,
        uint256 _minReturn
    ) public payable returns (uint256);

    // deprecated, backward compatibility
    function claimAndConvert(
        IERC20Token[] _path,
        uint256 _amount,
        uint256 _minReturn
    ) public returns (uint256);

    // deprecated, backward compatibility
    function convertFor(
        IERC20Token[] _path,
        uint256 _amount,
        uint256 _minReturn,
        address _for
    ) public payable returns (uint256);

    // deprecated, backward compatibility
    function claimAndConvertFor(
        IERC20Token[] _path,
        uint256 _amount,
        uint256 _minReturn,
        address _for
    ) public returns (uint256);

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

    // deprecated, backward compatibility
    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);
}

// File: contracts/ContractIds.sol

/**
  * @dev 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";
    bytes32 public constant CONTRACT_REGISTRY = "ContractRegistry";
    bytes32 public constant NON_STANDARD_TOKEN_REGISTRY = "NonStandardTokenRegistry";

    // 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_UPGRADER = "BancorConverterUpgrader";
    bytes32 public constant BANCOR_CONVERTER_FACTORY = "BancorConverterFactory";

    // BNT core
    bytes32 public constant BNT_TOKEN = "BNTToken";

    // BancorX
    bytes32 public constant BANCOR_X = "BancorX";
    bytes32 public constant BANCOR_X_UPGRADER = "BancorXUpgrader";
}

// File: contracts/FeatureIds.sol

/**
  * @dev 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;
}

// File: contracts/utility/interfaces/IOwned.sol

/*
    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) {this;}

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

// File: contracts/utility/Owned.sol

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

    /**
      * @dev triggered when the owner is updated
      * 
      * @param _prevOwner previous owner
      * @param _newOwner  new owner
    */
    event OwnerUpdate(address indexed _prevOwner, address indexed _newOwner);

    /**
      * @dev initializes a new Owned instance
    */
    constructor() public {
        owner = msg.sender;
    }

    // allows execution by the owner only
    modifier ownerOnly {
        require(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);
    }
}

// File: contracts/utility/Managed.sol

/**
  * @dev 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;

    /**
      * @dev triggered when the manager is updated
      * 
      * @param _prevManager previous manager
      * @param _newManager  new manager
    */
    event ManagerUpdate(address indexed _prevManager, address indexed _newManager);

    /**
      * @dev initializes a new Managed instance
    */
    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);
    }
}

// File: contracts/utility/Utils.sol

/**
  * @dev 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));
        _;
    }

}

// File: contracts/utility/SafeMath.sol

/**
  * @dev Library for basic math operations with overflow/underflow protection
*/
library SafeMath {
    /**
      * @dev returns the sum of _x and _y, reverts if the calculation overflows
      * 
      * @param _x   value 1
      * @param _y   value 2
      * 
      * @return sum
    */
    function add(uint256 _x, uint256 _y) internal pure returns (uint256) {
        uint256 z = _x + _y;
        require(z >= _x);
        return z;
    }

    /**
      * @dev returns the difference of _x minus _y, reverts if the calculation underflows
      * 
      * @param _x   minuend
      * @param _y   subtrahend
      * 
      * @return difference
    */
    function sub(uint256 _x, uint256 _y) internal pure returns (uint256) {
        require(_x >= _y);
        return _x - _y;
    }

    /**
      * @dev returns the product of multiplying _x by _y, reverts if the calculation overflows
      * 
      * @param _x   factor 1
      * @param _y   factor 2
      * 
      * @return product
    */
    function mul(uint256 _x, uint256 _y) internal pure returns (uint256) {
        // gas optimization
        if (_x == 0)
            return 0;

        uint256 z = _x * _y;
        require(z / _x == _y);
        return z;
    }

      /**
        * ev Integer division of two numbers truncating the quotient, reverts on division by zero.
        * 
        * aram _x   dividend
        * aram _y   divisor
        * 
        * eturn quotient
    */
    function div(uint256 _x, uint256 _y) internal pure returns (uint256) {
        require(_y > 0);
        uint256 c = _x / _y;

        return c;
    }
}

// File: contracts/utility/interfaces/IContractRegistry.sol

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

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

// File: contracts/utility/interfaces/IContractFeatures.sol

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

// File: contracts/utility/interfaces/IAddressList.sol

/*
    Address list interface
*/
contract IAddressList {
    mapping (address => bool) public listedAddresses;
}

// File: contracts/token/interfaces/ISmartToken.sol

/*
    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;
}

// File: contracts/token/interfaces/ISmartTokenController.sol

/*
    Smart Token Controller interface
*/
contract ISmartTokenController {
    function claimTokens(address _from, uint256 _amount) public;
    function token() public view returns (ISmartToken) {this;}
}

// File: contracts/utility/interfaces/ITokenHolder.sol

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

// File: contracts/token/interfaces/INonStandardERC20.sol

/*
    ERC20 Standard Token interface which doesn't return true/false for transfer, transferFrom and approve
*/
contract INonStandardERC20 {
    // these functions aren't abstract since the compiler emits automatically generated getter functions as external
    function name() public view returns (string) {this;}
    function symbol() public view returns (string) {this;}
    function decimals() public view returns (uint8) {this;}
    function totalSupply() public view returns (uint256) {this;}
    function balanceOf(address _owner) public view returns (uint256) {_owner; this;}
    function allowance(address _owner, address _spender) public view returns (uint256) {_owner; _spender; this;}

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

// File: contracts/utility/TokenHolder.sol

/**
  * @dev 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.
  * 
  * Note that we use the non standard ERC-20 interface which has no return value for transfer
  * in order to support both non standard as well as standard token contracts.
  * see https://github.com/ethereum/solidity/issues/4116
*/
contract TokenHolder is ITokenHolder, Owned, Utils {
    /**
      * @dev initializes a new TokenHolder instance
    */
    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)
    {
        INonStandardERC20(_token).transfer(_to, _amount);
    }
}

// File: contracts/token/SmartTokenController.sol

/**
  * @dev 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 ISmartTokenController, TokenHolder {
    ISmartToken public token;   // Smart Token contract
    address public bancorX;     // BancorX contract

    /**
      * @dev initializes a new SmartTokenController instance
      * 
      * @param  _token      smart token governed by the controller
    */
    constructor(ISmartToken _token)
        public
        validAddress(_token)
    {
        token = _token;
    }

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

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

    /**
      * @dev allows transferring the token ownership
      * the new owner needs 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 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);
    }

    /**
      * @dev allows the associated BancorX contract to claim tokens from any address (so that users
      * dont have to first give allowance when calling BancorX)
      * 
      * @param _from      address to claim the tokens from
      * @param _amount    the amount of tokens to claim
     */
    function claimTokens(address _from, uint256 _amount) public {
        // only the associated BancorX contract may call this method
        require(msg.sender == bancorX);

        // destroy the tokens belonging to _from, and issue the same amount to bancorX
        token.destroy(_from, _amount);
        token.issue(msg.sender, _amount);
    }

    /**
      * @dev allows the owner to set the associated BancorX contract
      * @param _bancorX    BancorX contract
     */
    function setBancorX(address _bancorX) public ownerOnly {
        bancorX = _bancorX;
    }
}

// File: contracts/token/interfaces/IEtherToken.sol

/*
    Ether Token interface
*/
contract IEtherToken is ITokenHolder, IERC20Token {
    function deposit() public payable;
    function withdraw(uint256 _amount) public;
    function withdrawTo(address _to, uint256 _amount) public;
}

// File: contracts/bancorx/interfaces/IBancorX.sol

contract IBancorX {
    function xTransfer(bytes32 _toBlockchain, bytes32 _to, uint256 _amount, uint256 _id) public;
    function getXTransferAmount(uint256 _xTransferId, address _for) public view returns (uint256);
}

// File: contracts/converter/BancorConverter.sol

/**
  * @dev Bancor Converter
  * 
  * The Bancor converter allows for conversions between a Smart Token and other ERC20 tokens and between different ERC20 tokens and themselves. 
  * 
  * The ERC20 reserve balance can be virtual, meaning that conversions between reserve tokens are based on the virtual balance instead of relying on the actual reserve balance.
  * 
  * This mechanism opens the possibility to create different financial tools (for example, lower slippage in conversions).
  * 
  * The converter is upgradable (just like any SmartTokenController) and all upgrades are opt-in. 
  * 
  * 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 reserve fields so that the client won't need to rely on the order in the struct
*/
contract BancorConverter is IBancorConverter, SmartTokenController, Managed, ContractIds, FeatureIds {
    using SafeMath for uint256;

    uint32 private constant RATIO_RESOLUTION = 1000000;
    uint64 private constant CONVERSION_FEE_RESOLUTION = 1000000;

    struct Reserve {
        uint256 virtualBalance;         // reserve virtual balance
        uint32 ratio;                   // reserve ratio, represented in ppm, 1-1000000
        bool isVirtualBalanceEnabled;   // true if virtual balance is enabled, false if not
        bool isSaleEnabled;             // is sale of the reserve token enabled, can be set by the owner
        bool isSet;                     // used to tell if the mapping element is defined
    }

    /**
      * @dev version number
    */
    uint16 public version = 20;
    string public converterType = 'bancor';

    bool public allowRegistryUpdate = true;             // allows the owner to prevent/allow the registry to be updated
    IContractRegistry public prevRegistry;              // address of previous registry as security mechanism
    IContractRegistry public registry;                  // contract registry contract
    IWhitelist public conversionWhitelist;              // whitelist contract with list of addresses that are allowed to use the converter
    IERC20Token[] public reserveTokens;                 // ERC20 standard token addresses (prior version 17, use 'connectorTokens' instead)
    mapping (address => Reserve) public reserves;       // reserve token addresses -> reserve data (prior version 17, use 'connectors' instead)
    uint32 private totalReserveRatio = 0;               // used to efficiently prevent increasing the total reserve ratio 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

    /**
      * @dev triggered when a conversion between two tokens occurs
      * 
      * @param _fromToken       ERC20 token converted from
      * @param _toToken         ERC20 token converted to
      * @param _trader          wallet that initiated the trade
      * @param _amount          amount converted, in fromToken
      * @param _return          amount returned, minus conversion fee
      * @param _conversionFee   conversion fee
    */
    event Conversion(
        address indexed _fromToken,
        address indexed _toToken,
        address indexed _trader,
        uint256 _amount,
        uint256 _return,
        int256 _conversionFee
    );

    /**
      * @dev triggered after a conversion with new price data
      * 
      * @param  _connectorToken     reserve token
      * @param  _tokenSupply        smart token supply
      * @param  _connectorBalance   reserve balance
      * @param  _connectorWeight    reserve ratio
    */
    event PriceDataUpdate(
        address indexed _connectorToken,
        uint256 _tokenSupply,
        uint256 _connectorBalance,
        uint32 _connectorWeight
    );

    /**
      * @dev triggered when the conversion fee is updated
      * 
      * @param  _prevFee    previous fee percentage, represented in ppm
      * @param  _newFee     new fee percentage, represented in ppm
    */
    event ConversionFeeUpdate(uint32 _prevFee, uint32 _newFee);

    /**
      * @dev triggered when conversions are enabled/disabled
      * 
      * @param  _conversionsEnabled true if conversions are enabled, false if not
    */
    event ConversionsEnable(bool _conversionsEnabled);

    /**
      * @dev triggered when virtual balances are enabled/disabled
      * 
      * @param  _enabled true if virtual balances are enabled, false if not
    */
    event VirtualBalancesEnable(bool _enabled);

    /**
      * @dev initializes a new BancorConverter instance
      * 
      * @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  _reserveToken       optional, initial reserve, allows defining the first reserve at deployment time
      * @param  _reserveRatio       optional, ratio for the initial reserve
    */
    constructor(
        ISmartToken _token,
        IContractRegistry _registry,
        uint32 _maxConversionFee,
        IERC20Token _reserveToken,
        uint32 _reserveRatio
    )
        public
        SmartTokenController(_token)
        validAddress(_registry)
        validConversionFee(_maxConversionFee)
    {
        registry = _registry;
        prevRegistry = _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 (_reserveToken != address(0))
            addReserve(_reserveToken, _reserveRatio);
    }

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

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

    // validates reserve ratio
    modifier validReserveRatio(uint32 _ratio) {
        require(_ratio > 0 && _ratio <= RATIO_RESOLUTION);
        _;
    }

    // allows execution only when the total ratio is 100%
    modifier fullTotalRatioOnly() {
        require(totalReserveRatio == RATIO_RESOLUTION);
        _;
    }

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

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

    // allows execution by the converter upgrader contract only
    modifier converterUpgraderOnly {
        address converterUpgrader = registry.addressOf(ContractIds.BANCOR_CONVERTER_UPGRADER);
        require(msg.sender == converterUpgrader);
        _;
    }

    // allows execution only if the total-supply of the token is greater than zero
    modifier totalSupplyGreaterThanZeroOnly {
        require(token.totalSupply() > 0);
        _;
    }

    /**
      * @dev sets the contract registry to whichever address the current registry is pointing to
     */
    function updateRegistry() public {
        // require that upgrading is allowed or that the caller is the owner
        require(allowRegistryUpdate || msg.sender == owner);

        // get the address of whichever registry the current registry is pointing to
        address newRegistry = registry.addressOf(ContractIds.CONTRACT_REGISTRY);

        // if the new registry hasn't changed or is the zero address, revert
        require(newRegistry != address(registry) && newRegistry != address(0));

        // set the previous registry as current registry and current registry as newRegistry
        prevRegistry = registry;
        registry = IContractRegistry(newRegistry);
    }

    /**
      * @dev security mechanism allowing the converter owner to revert to the previous registry,
      * to be used in emergency scenario
    */
    function restoreRegistry() public ownerOrManagerOnly {
        // set the registry as previous registry
        registry = prevRegistry;

        // after a previous registry is restored, only the owner can allow future updates
        allowRegistryUpdate = false;
    }

    /**
      * @dev disables the registry update functionality
      * this is a safety mechanism in case of a emergency
      * can only be called by the manager or owner
      * 
      * @param _disable    true to disable registry updates, false to re-enable them
    */
    function disableRegistryUpdate(bool _disable) public ownerOrManagerOnly {
        allowRegistryUpdate = !_disable;
    }

    /**
      * @dev returns the number of reserve tokens defined
      * note that prior to version 17, you should use 'connectorTokenCount' instead
      * 
      * @return number of reserve tokens
    */
    function reserveTokenCount() public view returns (uint16) {
        return uint16(reserveTokens.length);
    }

    /**
      * @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 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 {
        if (conversionsEnabled == _disable) {
            conversionsEnabled = !_disable;
            emit ConversionsEnable(conversionsEnabled);
        }
    }

    /**
      * @dev allows transferring the token ownership
      * the new owner needs to accept the transfer
      * can only be called by the contract owner
      * note that token ownership can only be transferred while the owner is the converter upgrader contract
      * 
      * @param _newOwner    new token owner
    */
    function transferTokenOwnership(address _newOwner)
        public
        ownerOnly
        converterUpgraderOnly
    {
        super.transferTokenOwnership(_newOwner);
    }

    /**
      * @dev used by a new owner to accept a token ownership transfer
      * can only be called by the contract owner
      * note that token ownership can only be accepted if its total-supply is greater than zero
    */
    function acceptTokenOwnership()
        public
        ownerOnly
        totalSupplyGreaterThanZeroOnly
    {
        super.acceptTokenOwnership();
    }

    /**
      * @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
    {
        require(_conversionFee >= 0 && _conversionFee <= maxConversionFee);
        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 reserve conversion
      * 
      * @return return amount minus conversion fee
    */
    function getFinalAmount(uint256 _amount, uint8 _magnitude) public view returns (uint256) {
        return _amount.mul((CONVERSION_FEE_RESOLUTION - conversionFee) ** _magnitude).div(CONVERSION_FEE_RESOLUTION ** _magnitude);
    }

    /**
      * @dev withdraws tokens held by the converter and sends them to an account
      * can only be called by the owner
      * note that reserve tokens can only be withdrawn by the owner while the converter is inactive
      * unless the owner is the converter upgrader contract
      * 
      * @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 {
        address converterUpgrader = registry.addressOf(ContractIds.BANCOR_CONVERTER_UPGRADER);

        // if the token is not a reserve token, allow withdrawal
        // otherwise verify that the converter is inactive or that the owner is the upgrader contract
        require(!reserves[_token].isSet || token.owner() != address(this) || owner == converterUpgrader);
        super.withdrawTokens(_token, _to, _amount);
    }

    /**
      * @dev upgrades the converter to the latest version
      * can only be called by the owner
      * note that the owner needs to call acceptOwnership/acceptManagement on the new converter after the upgrade
    */
    function upgrade() public ownerOnly {
        IBancorConverterUpgrader converterUpgrader = IBancorConverterUpgrader(registry.addressOf(ContractIds.BANCOR_CONVERTER_UPGRADER));

        transferOwnership(converterUpgrader);
        converterUpgrader.upgrade(version);
        acceptOwnership();
    }

    /**
      * @dev defines a new reserve for the token
      * can only be called by the owner while the converter is inactive
      * note that prior to version 17, you should use 'addConnector' instead
      * 
      * @param _token                  address of the reserve token
      * @param _ratio                  constant reserve ratio, represented in ppm, 1-1000000
    */
    function addReserve(IERC20Token _token, uint32 _ratio)
        public
        ownerOnly
        inactive
        validAddress(_token)
        notThis(_token)
        validReserveRatio(_ratio)
    {
        require(_token != token && !reserves[_token].isSet && totalReserveRatio + _ratio <= RATIO_RESOLUTION); // validate input

        reserves[_token].ratio = _ratio;
        reserves[_token].isVirtualBalanceEnabled = false;
        reserves[_token].virtualBalance = 0;
        reserves[_token].isSaleEnabled = true;
        reserves[_token].isSet = true;
        reserveTokens.push(_token);
        totalReserveRatio += _ratio;
    }

    /**
      * @dev updates a reserve's virtual balance
      * only used during an upgrade process
      * can only be called by the contract owner while the owner is the converter upgrader contract
      * note that prior to version 17, you should use 'updateConnector' instead
      * 
      * @param _reserveToken    address of the reserve token
      * @param _virtualBalance  new reserve virtual balance, or 0 to disable virtual balance
    */
    function updateReserveVirtualBalance(IERC20Token _reserveToken, uint256 _virtualBalance)
        public
        ownerOnly
        converterUpgraderOnly
        validReserve(_reserveToken)
    {
        Reserve storage reserve = reserves[_reserveToken];
        reserve.isVirtualBalanceEnabled = _virtualBalance != 0;
        reserve.virtualBalance = _virtualBalance;
    }

    /**
      * @dev enables virtual balance for the reserves
      * virtual balance only affects conversions between reserve tokens
      * virtual balance of all reserves can only scale by the same factor, to keep the ratio between them the same
      * note that the balance is determined during the execution of this function and set statically -
      * meaning that it's not calculated dynamically based on the factor after each conversion
      * can only be called by the contract owner while the converter is active
      * 
      * @param _scaleFactor  percentage, 100-1000 (100 = no virtual balance, 1000 = virtual balance = actual balance * 10)
    */
    function enableVirtualBalances(uint16 _scaleFactor)
        public
        ownerOnly
        active
    {
        // validate input
        require(_scaleFactor >= 100 && _scaleFactor <= 1000);
        bool enable = _scaleFactor != 100;

        // iterate through the reserves and scale their balance by the ratio provided,
        // or disable virtual balance altogether if a factor of 100% is passed in
        IERC20Token reserveToken;
        for (uint16 i = 0; i < reserveTokens.length; i++) {
            reserveToken = reserveTokens[i];
            Reserve storage reserve = reserves[reserveToken];
            reserve.isVirtualBalanceEnabled = enable;
            reserve.virtualBalance = enable ? reserveToken.balanceOf(this).mul(_scaleFactor).div(100) : 0;
        }

        emit VirtualBalancesEnable(enable);
    }

    /**
      * @dev disables converting from the given reserve token in case the reserve token got compromised
      * can only be called by the owner
      * note that converting to the token is still enabled regardless of this flag and it cannot be disabled by the owner
      * note that prior to version 17, you should use 'disableConnectorSale' instead
      * 
      * @param _reserveToken    reserve token contract address
      * @param _disable         true to disable the token, false to re-enable it
    */
    function disableReserveSale(IERC20Token _reserveToken, bool _disable)
        public
        ownerOnly
        validReserve(_reserveToken)
    {
        reserves[_reserveToken].isSaleEnabled = !_disable;
    }

    /**
      * @dev returns the reserve's virtual balance if one is defined, otherwise returns the actual balance
      * note that prior to version 17, you should use 'getConnectorBalance' instead
      * 
      * @param _reserveToken    reserve token contract address
      * 
      * @return reserve balance
    */
    function getReserveBalance(IERC20Token _reserveToken)
        public
        view
        validReserve(_reserveToken)
        returns (uint256)
    {
        Reserve storage reserve = reserves[_reserveToken];
        return reserve.isVirtualBalanceEnabled ? reserve.virtualBalance : _reserveToken.balanceOf(this);
    }

    /**
      * @dev calculates the expected return of converting a given amount of tokens
      * 
      * @param _fromToken  contract address of the token to convert from
      * @param _toToken    contract address of the token to convert to
      * @param _amount     amount of tokens received from the user
      * 
      * @return amount of tokens that the user will receive
      * @return amount of tokens that the user will pay as fee
    */
    function getReturn(IERC20Token _fromToken, IERC20Token _toToken, uint256 _amount) public view returns (uint256, uint256) {
        require(_fromToken != _toToken); // validate input

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

        // conversion between 2 reserves
        return getCrossReserveReturn(_fromToken, _toToken, _amount);
    }

    /**
      * @dev calculates the expected return of buying with a given amount of tokens
      * 
      * @param _reserveToken    contract address of the reserve token
      * @param _depositAmount   amount of reserve-tokens received from the user
      * 
      * @return amount of supply-tokens that the user will receive
      * @return amount of supply-tokens that the user will pay as fee
    */
    function getPurchaseReturn(IERC20Token _reserveToken, uint256 _depositAmount)
        public
        view
        active
        validReserve(_reserveToken)
        returns (uint256, uint256)
    {
        Reserve storage reserve = reserves[_reserveToken];
        require(reserve.isSaleEnabled); // validate input

        uint256 tokenSupply = token.totalSupply();
        uint256 reserveBalance = _reserveToken.balanceOf(this);
        IBancorFormula formula = IBancorFormula(registry.addressOf(ContractIds.BANCOR_FORMULA));
        uint256 amount = formula.calculatePurchaseReturn(tokenSupply, reserveBalance, reserve.ratio, _depositAmount);
        uint256 finalAmount = getFinalAmount(amount, 1);

        // return the amount minus the conversion fee and the conversion fee
        return (finalAmount, amount - finalAmount);
    }

    /**
      * @dev calculates the expected return of selling a given amount of tokens
      * 
      * @param _reserveToken    contract address of the reserve token
      * @param _sellAmount      amount of supply-tokens received from the user
      * 
      * @return amount of reserve-tokens that the user will receive
      * @return amount of reserve-tokens that the user will pay as fee
    */
    function getSaleReturn(IERC20Token _reserveToken, uint256 _sellAmount)
        public
        view
        active
        validReserve(_reserveToken)
        returns (uint256, uint256)
    {
        Reserve storage reserve = reserves[_reserveToken];
        uint256 tokenSupply = token.totalSupply();
        uint256 reserveBalance = _reserveToken.balanceOf(this);
        IBancorFormula formula = IBancorFormula(registry.addressOf(ContractIds.BANCOR_FORMULA));
        uint256 amount = formula.calculateSaleReturn(tokenSupply, reserveBalance, reserve.ratio, _sellAmount);
        uint256 finalAmount = getFinalAmount(amount, 1);

        // return the amount minus the conversion fee and the conversion fee
        return (finalAmount, amount - finalAmount);
    }

    /**
      * @dev calculates the expected return of converting a given amount from one reserve to another
      * note that prior to version 17, you should use 'getCrossConnectorReturn' instead
      * 
      * @param _fromReserveToken    contract address of the reserve token to convert from
      * @param _toReserveToken      contract address of the reserve token to convert to
      * @param _amount              amount of tokens received from the user
      * 
      * @return amount of tokens that the user will receive
      * @return amount of tokens that the user will pay as fee
    */
    function getCrossReserveReturn(IERC20Token _fromReserveToken, IERC20Token _toReserveToken, uint256 _amount)
        public
        view
        active
        validReserve(_fromReserveToken)
        validReserve(_toReserveToken)
        returns (uint256, uint256)
    {
        Reserve storage fromReserve = reserves[_fromReserveToken];
        Reserve storage toReserve = reserves[_toReserveToken];
        require(fromReserve.isSaleEnabled); // validate input

        IBancorFormula formula = IBancorFormula(registry.addressOf(ContractIds.BANCOR_FORMULA));
        uint256 amount = formula.calculateCrossReserveReturn(
            getReserveBalance(_fromReserveToken), 
            fromReserve.ratio, 
            getReserveBalance(_toReserveToken), 
            toReserve.ratio, 
            _amount);
        uint256 finalAmount = getFinalAmount(amount, 2);

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

    /**
      * @dev converts a specific amount of _fromToken to _toToken
      * can only be called by the bancor network contract
      * 
      * @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 reserves
        if (_toToken == token)
            return buy(_fromToken, _amount, _minReturn);
        else if (_fromToken == token)
            return sell(_toToken, _amount, _minReturn);

        uint256 amount;
        uint256 feeAmount;

        // conversion between 2 reserves
        (amount, feeAmount) = getCrossReserveReturn(_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
        Reserve storage fromReserve = reserves[_fromToken];
        if (fromReserve.isVirtualBalanceEnabled)
            fromReserve.virtualBalance = fromReserve.virtualBalance.add(_amount);

        // update the target token virtual balance if relevant
        Reserve storage toReserve = reserves[_toToken];
        if (toReserve.isVirtualBalanceEnabled)
            toReserve.virtualBalance = toReserve.virtualBalance.sub(amount);

        // ensure that the trade won't deplete the reserve balance
        uint256 toReserveBalance = getReserveBalance(_toToken);
        assert(amount < toReserveBalance);

        // transfer funds from the caller in the from reserve token
        ensureTransferFrom(_fromToken, msg.sender, this, _amount);
        // transfer funds to the caller in the to reserve token
        // the transfer might fail if virtual balance is enabled
        ensureTransfer(_toToken, msg.sender, amount);

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

        // dispatch price data updates for the smart token / both reserves
        emit PriceDataUpdate(_fromToken, token.totalSupply(), _fromToken.balanceOf(this), fromReserve.ratio);
        emit PriceDataUpdate(_toToken, token.totalSupply(), _toToken.balanceOf(this), toReserve.ratio);
        return amount;
    }

    /**
      * @dev buys the token by depositing one of its reserve tokens
      * 
      * @param _reserveToken    reserve token contract address
      * @param _depositAmount   amount to deposit (in the reserve 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 _reserveToken, uint256 _depositAmount, uint256 _minReturn) internal returns (uint256) {
        uint256 amount;
        uint256 feeAmount;
        (amount, feeAmount) = getPurchaseReturn(_reserveToken, _depositAmount);
        // ensure the trade gives something in return and meets the minimum requested amount
        require(amount != 0 && amount >= _minReturn);

        // update virtual balance if relevant
        Reserve storage reserve = reserves[_reserveToken];
        if (reserve.isVirtualBalanceEnabled)
            reserve.virtualBalance = reserve.virtualBalance.add(_depositAmount);

        // transfer funds from the caller in the reserve token
        ensureTransferFrom(_reserveToken, msg.sender, this, _depositAmount);
        // issue new funds to the caller in the smart token
        token.issue(msg.sender, amount);

        // dispatch the conversion event
        dispatchConversionEvent(_reserveToken, token, _depositAmount, amount, feeAmount);

        // dispatch price data update for the smart token/reserve
        emit PriceDataUpdate(_reserveToken, token.totalSupply(), _reserveToken.balanceOf(this), reserve.ratio);
        return amount;
    }

    /**
      * @dev sells the token by withdrawing from one of its reserve tokens
      * 
      * @param _reserveToken    reserve 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 _reserveToken, uint256 _sellAmount, uint256 _minReturn) internal returns (uint256) {
        require(_sellAmount <= token.balanceOf(msg.sender)); // validate input
        uint256 amount;
        uint256 feeAmount;
        (amount, feeAmount) = getSaleReturn(_reserveToken, _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 reserve balance if the total supply is depleted as well
        uint256 tokenSupply = token.totalSupply();
        uint256 reserveBalance = _reserveToken.balanceOf(this);
        assert(amount < reserveBalance || (amount == reserveBalance && _sellAmount == tokenSupply));

        // update virtual balance if relevant
        Reserve storage reserve = reserves[_reserveToken];
        if (reserve.isVirtualBalanceEnabled)
            reserve.virtualBalance = reserve.virtualBalance.sub(amount);

        // destroy _sellAmount from the caller's balance in the smart token
        token.destroy(msg.sender, _sellAmount);
        // transfer funds to the caller in the reserve token
        ensureTransfer(_reserveToken, msg.sender, amount);

        // dispatch the conversion event
        dispatchConversionEvent(token, _reserveToken, _sellAmount, amount, feeAmount);

        // dispatch price data update for the smart token/reserve
        emit PriceDataUpdate(_reserveToken, token.totalSupply(), _reserveToken.balanceOf(this), reserve.ratio);
        return amount;
    }

    /**
      * @dev converts a specific amount of _fromToken to _toToken
      * note that prior to version 16, you should use 'convert' instead
      * 
      * @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
      * @param _affiliateAccount    affiliate account
      * @param _affiliateFee        affiliate fee in PPM
      * 
      * @return conversion return amount
    */
    function convert2(IERC20Token _fromToken, IERC20Token _toToken, uint256 _amount, uint256 _minReturn, address _affiliateAccount, uint256 _affiliateFee) public returns (uint256) {
        IERC20Token[] memory path = new IERC20Token[](3);
        (path[0], path[1], path[2]) = (_fromToken, token, _toToken);
        return quickConvert2(path, _amount, _minReturn, _affiliateAccount, _affiliateFee);
    }

    /**
      * @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
      * note that prior to version 16, you should use 'quickConvert' instead
      * 
      * @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 _affiliateAccount    affiliate account
      * @param _affiliateFee        affiliate fee in PPM
      * 
      * @return tokens issued in return
    */
    function quickConvert2(IERC20Token[] _path, uint256 _amount, uint256 _minReturn, address _affiliateAccount, uint256 _affiliateFee)
        public
        payable
        returns (uint256)
    {
        return quickConvertPrioritized2(_path, _amount, _minReturn, getSignature(0x0, 0x0, 0x0, 0x0, 0x0), _affiliateAccount, _affiliateFee);
    }

    /**
      * @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
      * note that prior to version 16, you should use 'quickConvertPrioritized' instead
      * 
      * @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 _signature           an array of the following elements:
      *     [0] uint256             custom value that was signed for prioritized conversion; must be equal to _amount
      *     [1] uint256             if the current block exceeded the given parameter - it is cancelled
      *     [2] uint8               (signature[128:130]) associated with the signer address and helps to validate if the signature is legit
      *     [3] bytes32             (signature[0:64]) associated with the signer address and helps to validate if the signature is legit
      *     [4] bytes32             (signature[64:128]) associated with the signer address and helps to validate if the signature is legit
      * if the array is empty (length == 0), then the gas-price limit is verified instead of the signature
      * @param _affiliateAccount    affiliate account
      * @param _affiliateFee        affiliate fee in PPM
      * 
      * @return tokens issued in return
    */
    function quickConvertPrioritized2(IERC20Token[] _path, uint256 _amount, uint256 _minReturn, uint256[] memory _signature, address _affiliateAccount, uint256 _affiliateFee)
        public
        payable
        returns (uint256)
    {
        require(_signature.length == 0 || _signature[0] == _amount);

        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 (_path[0] == 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
                ensureTransferFrom(_path[0], msg.sender, bancorNetwork, _amount);
            }
        }

        // execute the conversion and pass on the ETH with the call
        return bancorNetwork.convertForPrioritized4.value(msg.value)(_path, _amount, _minReturn, msg.sender, _signature, _affiliateAccount, _affiliateFee);
    }

    /**
      * @dev allows a user to convert BNT that was sent from another blockchain into any other
      * token on the BancorNetwork without specifying the amount of BNT to be converted, but
      * rather by providing the xTransferId which allows us to get the amount from BancorX.
      * note that prior to version 16, you should use 'completeXConversion' instead
      * 
      * @param _path            conversion path, see conversion path format in the BancorNetwork contract
      * @param _minReturn       if the conversion results in an amount smaller than the minimum return - it is cancelled, must be nonzero
      * @param _conversionId    pre-determined unique (if non zero) id which refers to this transaction 
      * @param _signature       an array of the following elements:
      *     [0] uint256         custom value that was signed for prioritized conversion; must be equal to _conversionId
      *     [1] uint256         if the current block exceeded the given parameter - it is cancelled
      *     [2] uint8           (signature[128:130]) associated with the signer address and helps to validate if the signature is legit
      *     [3] bytes32         (signature[0:64]) associated with the signer address and helps to validate if the signature is legit
      *     [4] bytes32         (signature[64:128]) associated with the signer address and helps to validate if the signature is legit
      * if the array is empty (length == 0), then the gas-price limit is verified instead of the signature
      * 
      * @return tokens issued in return
    */
    function completeXConversion2(
        IERC20Token[] _path,
        uint256 _minReturn,
        uint256 _conversionId,
        uint256[] memory _signature
    )
        public
        returns (uint256)
    {
        // verify that the custom value (if valid) is equal to _conversionId
        require(_signature.length == 0 || _signature[0] == _conversionId);

        IBancorX bancorX = IBancorX(registry.addressOf(ContractIds.BANCOR_X));
        IBancorNetwork bancorNetwork = IBancorNetwork(registry.addressOf(ContractIds.BANCOR_NETWORK));

        // verify that the first token in the path is BNT
        require(_path[0] == registry.addressOf(ContractIds.BNT_TOKEN));

        // get conversion amount from BancorX contract
        uint256 amount = bancorX.getXTransferAmount(_conversionId, msg.sender);

        // send BNT from msg.sender to the BancorNetwork contract
        token.destroy(msg.sender, amount);
        token.issue(bancorNetwork, amount);

        return bancorNetwork.convertForPrioritized4(_path, amount, _minReturn, msg.sender, _signature, address(0), 0);
    }

    /**
      * @dev ensures transfer of tokens, taking into account that some ERC-20 implementations don't return
      * true on success but revert on failure instead
      * 
      * @param _token     the token to transfer
      * @param _to        the address to transfer the tokens to
      * @param _amount    the amount to transfer
    */
    function ensureTransfer(IERC20Token _token, address _to, uint256 _amount) private {
        IAddressList addressList = IAddressList(registry.addressOf(ContractIds.NON_STANDARD_TOKEN_REGISTRY));

        if (addressList.listedAddresses(_token)) {
            uint256 prevBalance = _token.balanceOf(_to);
            // we have to cast the token contract in an interface which has no return value
            INonStandardERC20(_token).transfer(_to, _amount);
            uint256 postBalance = _token.balanceOf(_to);
            assert(postBalance > prevBalance);
        } else {
            // if the token isn't whitelisted, we assert on transfer
            assert(_token.transfer(_to, _amount));
        }
    }

    /**
      * @dev ensures transfer of tokens, taking into account that some ERC-20 implementations don't return
      * true on success but revert on failure instead
      * 
      * @param _token     the token to transfer
      * @param _from      the address to transfer the tokens from
      * @param _to        the address to transfer the tokens to
      * @param _amount    the amount to transfer
    */
    function ensureTransferFrom(IERC20Token _token, address _from, address _to, uint256 _amount) private {
        IAddressList addressList = IAddressList(registry.addressOf(ContractIds.NON_STANDARD_TOKEN_REGISTRY));

        if (addressList.listedAddresses(_token)) {
            uint256 prevBalance = _token.balanceOf(_to);
            // we have to cast the token contract in an interface which has no return value
            INonStandardERC20(_token).transferFrom(_from, _to, _amount);
            uint256 postBalance = _token.balanceOf(_to);
            assert(postBalance > prevBalance);
        } else {
            // if the token is standard, we assert on transfer
            assert(_token.transferFrom(_from, _to, _amount));
        }
    }

    /**
      * @dev buys the token with all reserve tokens using the same percentage
      * for example, if the caller increases the supply by 10%,
      * then it will cost an amount equal to 10% of each reserve token balance
      * note that the function can be called only if the total ratio is 100% and conversions are enabled
      * 
      * @param _amount  amount to increase the supply by (in the smart token)
    */
    function fund(uint256 _amount)
        public
        fullTotalRatioOnly
        conversionsAllowed
    {
        uint256 supply = token.totalSupply();

        // iterate through the reserve tokens and transfer a percentage equal to the ratio between _amount
        // and the total supply in each reserve from the caller to the converter
        IERC20Token reserveToken;
        uint256 reserveBalance;
        uint256 reserveAmount;
        for (uint16 i = 0; i < reserveTokens.length; i++) {
            reserveToken = reserveTokens[i];
            reserveBalance = reserveToken.balanceOf(this);
            reserveAmount = _amount.mul(reserveBalance).sub(1).div(supply).add(1);

            // update virtual balance if relevant
            Reserve storage reserve = reserves[reserveToken];
            if (reserve.isVirtualBalanceEnabled)
                reserve.virtualBalance = reserve.virtualBalance.add(reserveAmount);

            // transfer funds from the caller in the reserve token
            ensureTransferFrom(reserveToken, msg.sender, this, reserveAmount);

            // dispatch price data update for the smart token/reserve
            emit PriceDataUpdate(reserveToken, supply + _amount, reserveBalance + reserveAmount, reserve.ratio);
        }

        // issue new funds to the caller in the smart token
        token.issue(msg.sender, _amount);
    }

    /**
      * @dev sells the token for all reserve tokens using the same percentage
      * for example, if the holder sells 10% of the supply,
      * then they will receive 10% of each reserve token balance in return
      * note that the function can be called only if the total ratio is 100%
      * 
      * @param _amount  amount to liquidate (in the smart token)
    */
    function liquidate(uint256 _amount) public fullTotalRatioOnly {
        uint256 supply = token.totalSupply();

        // destroy _amount from the caller's balance in the smart token
        token.destroy(msg.sender, _amount);

        // iterate through the reserve tokens and send a percentage equal to the ratio between _amount
        // and the total supply from each reserve balance to the caller
        IERC20Token reserveToken;
        uint256 reserveBalance;
        uint256 reserveAmount;
        for (uint16 i = 0; i < reserveTokens.length; i++) {
            reserveToken = reserveTokens[i];
            reserveBalance = reserveToken.balanceOf(this);
            reserveAmount = _amount.mul(reserveBalance).div(supply);

            // update virtual balance if relevant
            Reserve storage reserve = reserves[reserveToken];
            if (reserve.isVirtualBalanceEnabled)
                reserve.virtualBalance = reserve.virtualBalance.sub(reserveAmount);

            // transfer funds to the caller in the reserve token
            ensureTransfer(reserveToken, msg.sender, reserveAmount);

            // dispatch price data update for the smart token/reserve
            emit PriceDataUpdate(reserveToken, supply - _amount, reserveBalance - reserveAmount, reserve.ratio);
        }
    }

    /**
      * @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));
    }

    function getSignature(
        uint256 _customVal,
        uint256 _block,
        uint8 _v,
        bytes32 _r,
        bytes32 _s
    ) private pure returns (uint256[] memory) {
        if (_v == 0x0 && _r == 0x0 && _s == 0x0)
            return new uint256[](0);
        uint256[] memory signature = new uint256[](5);
        signature[0] = _customVal;
        signature[1] = _block;
        signature[2] = uint256(_v);
        signature[3] = uint256(_r);
        signature[4] = uint256(_s);
        return signature;
    }

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

    /**
      * @dev deprecated, backward compatibility
    */
    function convert(IERC20Token _fromToken, IERC20Token _toToken, uint256 _amount, uint256 _minReturn) public returns (uint256) {
        return convert2(_fromToken, _toToken, _amount, _minReturn, address(0), 0);
    }

    /**
      * @dev deprecated, backward compatibility
    */
    function quickConvert(IERC20Token[] _path, uint256 _amount, uint256 _minReturn) public payable returns (uint256) {
        return quickConvert2(_path, _amount, _minReturn, address(0), 0);
    }

    /**
      * @dev deprecated, backward compatibility
    */
    function quickConvertPrioritized(IERC20Token[] _path, uint256 _amount, uint256 _minReturn, uint256 _block, uint8 _v, bytes32 _r, bytes32 _s) public payable returns (uint256) {
        return quickConvertPrioritized2(_path, _amount, _minReturn, getSignature(_amount, _block, _v, _r, _s), address(0), 0);
    }

    /**
      * @dev deprecated, backward compatibility
    */
    function completeXConversion(IERC20Token[] _path, uint256 _minReturn, uint256 _conversionId, uint256 _block, uint8 _v, bytes32 _r, bytes32 _s) public returns (uint256) {
        return completeXConversion2(_path, _minReturn, _conversionId, getSignature(_conversionId, _block, _v, _r, _s));
    }

    /**
      * @dev deprecated, backward compatibility
    */
    function connectors(address _address) public view returns (uint256, uint32, bool, bool, bool) {
        Reserve storage reserve = reserves[_address];
        return(reserve.virtualBalance, reserve.ratio, reserve.isVirtualBalanceEnabled, reserve.isSaleEnabled, reserve.isSet);
    }

    /**
      * @dev deprecated, backward compatibility
    */
    function connectorTokens(uint256 _index) public view returns (IERC20Token) {
        return BancorConverter.reserveTokens[_index];
    }

    /**
      * @dev deprecated, backward compatibility
    */
    function connectorTokenCount() public view returns (uint16) {
        return reserveTokenCount();
    }

    /**
      * @dev deprecated, backward compatibility
    */
    function addConnector(IERC20Token _token, uint32 _weight, bool /*_enableVirtualBalance*/) public {
        addReserve(_token, _weight);
    }

    /**
      * @dev deprecated, backward compatibility
    */
    function updateConnector(IERC20Token _connectorToken, uint32 /*_weight*/, bool /*_enableVirtualBalance*/, uint256 _virtualBalance) public {
        updateReserveVirtualBalance(_connectorToken, _virtualBalance);
    }

    /**
      * @dev deprecated, backward compatibility
    */
    function disableConnectorSale(IERC20Token _connectorToken, bool _disable) public {
        disableReserveSale(_connectorToken, _disable);
    }

    /**
      * @dev deprecated, backward compatibility
    */
    function getConnectorBalance(IERC20Token _connectorToken) public view returns (uint256) {
        return getReserveBalance(_connectorToken);
    }

    /**
      * @dev deprecated, backward compatibility
    */
    function getCrossConnectorReturn(IERC20Token _fromConnectorToken, IERC20Token _toConnectorToken, uint256 _amount) public view returns (uint256, uint256) {
        return getCrossReserveReturn(_fromConnectorToken, _toConnectorToken, _amount);
    }
}

Contract Security Audit

Contract ABI

[{"constant":true,"inputs":[],"name":"BANCOR_CONVERTER_UPGRADER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_connectorToken","type":"address"},{"name":"","type":"uint32"},{"name":"","type":"bool"},{"name":"_virtualBalance","type":"uint256"}],"name":"updateConnector","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_address","type":"address"}],"name":"connectors","outputs":[{"name":"","type":"uint256"},{"name":"","type":"uint32"},{"name":"","type":"bool"},{"name":"","type":"bool"},{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"bancorX","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_reserveToken","type":"address"}],"name":"getReserveBalance","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_index","type":"uint256"}],"name":"connectorTokens","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"BNT_TOKEN","outputs":[{"name":"","type":"bytes32"}],"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"},{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"allowRegistryUpdate","outputs":[{"name":"","type":"bool"}],"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":true,"inputs":[],"name":"CONTRACT_REGISTRY","outputs":[{"name":"","type":"bytes32"}],"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":"convertInternal","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_path","type":"address[]"},{"name":"_minReturn","type":"uint256"},{"name":"_conversionId","type":"uint256"},{"name":"_signature","type":"uint256[]"}],"name":"completeXConversion2","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":"","type":"bool"}],"name":"addConnector","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_amount","type":"uint256"}],"name":"liquidate","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":"updateRegistry","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_whitelist","type":"address"}],"name":"setConversionWhitelist","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_path","type":"address[]"},{"name":"_minReturn","type":"uint256"},{"name":"_conversionId","type":"uint256"},{"name":"_block","type":"uint256"},{"name":"_v","type":"uint8"},{"name":"_r","type":"bytes32"},{"name":"_s","type":"bytes32"}],"name":"completeXConversion","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"version","outputs":[{"name":"","type":"uint16"}],"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":"prevRegistry","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_scaleFactor","type":"uint16"}],"name":"enableVirtualBalances","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_token","type":"address"},{"name":"_ratio","type":"uint32"}],"name":"addReserve","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"BANCOR_FORMULA","outputs":[{"name":"","type":"bytes32"}],"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":"_affiliateAccount","type":"address"},{"name":"_affiliateFee","type":"uint256"}],"name":"convert2","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"connectorTokenCount","outputs":[{"name":"","type":"uint16"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_reserveToken","type":"address"},{"name":"_sellAmount","type":"uint256"}],"name":"getSaleReturn","outputs":[{"name":"","type":"uint256"},{"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":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":"_amount","type":"uint256"}],"name":"getCrossConnectorReturn","outputs":[{"name":"","type":"uint256"},{"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":false,"inputs":[{"name":"_reserveToken","type":"address"},{"name":"_virtualBalance","type":"uint256"}],"name":"updateReserveVirtualBalance","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"maxConversionFee","outputs":[{"name":"","type":"uint32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"reserveTokenCount","outputs":[{"name":"","type":"uint16"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_connectorToken","type":"address"},{"name":"_disable","type":"bool"}],"name":"disableConnectorSale","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"_reserveToken","type":"address"},{"name":"_depositAmount","type":"uint256"}],"name":"getPurchaseReturn","outputs":[{"name":"","type":"uint256"},{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_reserveToken","type":"address"},{"name":"_disable","type":"bool"}],"name":"disableReserveSale","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_path","type":"address[]"},{"name":"_amount","type":"uint256"},{"name":"_minReturn","type":"uint256"},{"name":"_signature","type":"uint256[]"},{"name":"_affiliateAccount","type":"address"},{"name":"_affiliateFee","type":"uint256"}],"name":"quickConvertPrioritized2","outputs":[{"name":"","type":"uint256"}],"payable":true,"stateMutability":"payable","type":"function"},{"constant":false,"inputs":[],"name":"restoreRegistry","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":true,"inputs":[],"name":"BANCOR_X","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"acceptManagement","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_amount","type":"uint256"}],"name":"fund","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"BANCOR_X_UPGRADER","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"_fromReserveToken","type":"address"},{"name":"_toReserveToken","type":"address"},{"name":"_amount","type":"uint256"}],"name":"getCrossReserveReturn","outputs":[{"name":"","type":"uint256"},{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"reserveTokens","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"newOwner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"upgrade","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"reserves","outputs":[{"name":"virtualBalance","type":"uint256"},{"name":"ratio","type":"uint32"},{"name":"isVirtualBalanceEnabled","type":"bool"},{"name":"isSaleEnabled","type":"bool"},{"name":"isSet","type":"bool"}],"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":"_bancorX","type":"address"}],"name":"setBancorX","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"_path","type":"address[]"},{"name":"_amount","type":"uint256"},{"name":"_minReturn","type":"uint256"},{"name":"_affiliateAccount","type":"address"},{"name":"_affiliateFee","type":"uint256"}],"name":"quickConvert2","outputs":[{"name":"","type":"uint256"}],"payable":true,"stateMutability":"payable","type":"function"},{"constant":false,"inputs":[{"name":"_newManager","type":"address"}],"name":"transferManagement","outputs":[],"payable":false,"stateMutability":"nonpayable","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":"NON_STANDARD_TOKEN_REGISTRY","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_disable","type":"bool"}],"name":"disableRegistryUpdate","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"token","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_amount","type":"uint256"}],"name":"claimTokens","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[{"name":"_token","type":"address"},{"name":"_registry","type":"address"},{"name":"_maxConversionFee","type":"uint32"},{"name":"_reserveToken","type":"address"},{"name":"_reserveRatio","type":"uint32"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"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":false,"name":"_conversionsEnabled","type":"bool"}],"name":"ConversionsEnable","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"_enabled","type":"bool"}],"name":"VirtualBalancesEnable","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"}]

Deployed Bytecode

0x60806040526004361061036b5763ffffffff60e060020a6000350416630c87355e81146103705780630ca78923146103975780630e53aae9146103cb5780631120a7761461042057806315226b541461045157806319b64015146104725780631d000b611461048a5780631e1401f81461049f57806320d7d367146104e257806321e6b53d1461050b578063227425641461052c578063228d28201461059457806325f9bfef146105ae5780632a2e2f0c146105c35780632cc1cd65146105f057806338a5e0161461068d5780633aa0145a146106a25780633e8ff43f146106c05780633f4d2fc21461074a578063415f12401461077957806341a5b33d1461079157806342906029146107bb578063481c6a75146107d057806349d10b64146107e55780634af80f0e146107fa578063500573511461081b57806354fd4d5014610890578063579cd3ca146108bc5780635a46f06c146108ea5780635e35359e146108ff5780635e5144eb1461092957806361cd756e14610956578063677c08121461096b5780636a49d2c4146109875780636d7bd3fc146109b15780636ebf36c0146109c657806371f52bf3146109fe57806372b44b2c14610a1357806375892cf114610a3757806379ba509714610a645780637b10399914610a7957806383315b6e14610a8e5780638da5cb5b14610aa35780638e3047e014610ab85780639232494e14610ae25780639249993a14610af757806392d1abb714610b0c578063935e2ae114610b2157806394c275ad14610b455780639b99a8e214610b5a5780639e56855314610b6f578063a2c4c33614610b95578063a6a11c7114610bb9578063b3a426d514610bdf578063b4a176d314610c80578063bf75455814610c95578063c45d3d9214610caa578063c4a8598e14610cbf578063c8c2fe6c14610cd4578063ca1d209d14610ce9578063cc97b38f14610d01578063cf73266a14610d16578063d031370b14610d40578063d4ee1d9014610d58578063d55ec69714610d6d578063d66bd52414610d82578063d895951214610da3578063d924f0c314610dc4578063e4dd22f614610de5578063e4edf85214610e48578063ecbca55d14610e69578063f0843ba914610e87578063f2fde38b14610ed8578063f5286b9c14610ef9578063fa1c594e14610f0e578063fc0c546a14610f28578063fe417fa514610f3d575b600080fd5b34801561037c57600080fd5b50610385610f61565b60408051918252519081900360200190f35b3480156103a357600080fd5b506103c9600160a060020a036004351663ffffffff602435166044351515606435610f73565b005b3480156103d757600080fd5b506103ec600160a060020a0360043516610f83565b6040805195865263ffffffff9094166020860152911515848401521515606084015215156080830152519081900360a00190f35b34801561042c57600080fd5b50610435610fd5565b60408051600160a060020a039092168252519081900360200190f35b34801561045d57600080fd5b50610385600160a060020a0360043516610fe4565b34801561047e57600080fd5b506104356004356110d2565b34801561049657600080fd5b506103856110fe565b3480156104ab57600080fd5b506104c9600160a060020a0360043581169060243516604435611122565b6040805192835260208301919091528051918290030190f35b3480156104ee57600080fd5b506104f761119f565b604080519115158252519081900360200190f35b34801561051757600080fd5b506103c9600160a060020a03600435166111a8565b6040805160206004803580820135838102808601850190965280855261038595369593946024949385019291829185019084908082843750949750508435955050506020830135926040810135925060ff606082013516915060808101359060a0013561126c565b3480156105a057600080fd5b506103c96004351515611295565b3480156105ba57600080fd5b50610385611354565b3480156105cf57600080fd5b50610385600160a060020a0360043581169060243516604435606435611378565b3480156105fc57600080fd5b5060408051602060048035808201358381028086018501909652808552610385953695939460249493850192918291850190849080828437505060408051818801358901803560208181028481018201909552818452989b8a359b8a8c01359b919a909950606090910197509295509082019350918291850190849080828437509497506118609650505050505050565b34801561069957600080fd5b506103c9611d5f565b3480156106ae57600080fd5b5061038560043560ff60243516611e15565b3480156106cc57600080fd5b506106d5611e73565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561070f5781810151838201526020016106f7565b50505050905090810190601f16801561073c5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561075657600080fd5b506103c9600160a060020a036004351663ffffffff602435166044351515611f01565b34801561078557600080fd5b506103c9600435611f10565b34801561079d57600080fd5b506103c9600160a060020a0360043581169060243516604435612195565b3480156107c757600080fd5b50610435612236565b3480156107dc57600080fd5b50610435612245565b3480156107f157600080fd5b506103c9612254565b34801561080657600080fd5b506103c9600160a060020a036004351661239c565b34801561082757600080fd5b506040805160206004803580820135838102808601850190965280855261038595369593946024949385019291829185019084908082843750949750508435955050506020830135926040810135925060ff606082013516915060808101359060a001356123ed565b34801561089c57600080fd5b506108a5612407565b6040805161ffff9092168252519081900360200190f35b3480156108c857600080fd5b506108d1612429565b6040805163ffffffff9092168252519081900360200190f35b3480156108f657600080fd5b50610385612441565b34801561090b57600080fd5b506103c9600160a060020a0360043581169060243516604435612465565b34801561093557600080fd5b50610385600160a060020a03600435811690602435166044356064356125e6565b34801561096257600080fd5b506104356125fd565b34801561097757600080fd5b506103c961ffff60043516612611565b34801561099357600080fd5b506103c9600160a060020a036004351663ffffffff6024351661285d565b3480156109bd57600080fd5b50610385612a95565b3480156109d257600080fd5b50610385600160a060020a0360043581169060243581169060443590606435906084351660a435612aa7565b348015610a0a57600080fd5b506108a5612b4d565b348015610a1f57600080fd5b506104c9600160a060020a0360043516602435612b5c565b348015610a4357600080fd5b50610385600160a060020a0360043581169060243516604435606435612eb0565b348015610a7057600080fd5b506103c9612ec1565b348015610a8557600080fd5b50610435612f3c565b348015610a9a57600080fd5b50610385612f4b565b348015610aaf57600080fd5b50610435612f6f565b348015610ac457600080fd5b506104c9600160a060020a0360043581169060243516604435612f7e565b348015610aee57600080fd5b50610385612f8c565b348015610b0357600080fd5b50610385612f9e565b348015610b1857600080fd5b50610385612fc2565b348015610b2d57600080fd5b506103c9600160a060020a0360043516602435612fc7565b348015610b5157600080fd5b506108d16130f0565b348015610b6657600080fd5b506108a5613104565b348015610b7b57600080fd5b506103c9600160a060020a0360043516602435151561310a565b348015610ba157600080fd5b506104c9600160a060020a0360043516602435613114565b348015610bc557600080fd5b506103c9600160a060020a03600435166024351515613435565b60408051602060048035808201358381028086018501909652808552610385953695939460249493850192918291850190849080828437505060408051818801358901803560208181028481018201909552818452989b8a359b8a8c01359b919a9099506060909101975092955090820193509182918501908490808284375094975050508335600160a060020a03169450505060209091013590506134bd565b348015610c8c57600080fd5b506103c9613807565b348015610ca157600080fd5b506104f7613860565b348015610cb657600080fd5b50610435613879565b348015610ccb57600080fd5b50610385613888565b348015610ce057600080fd5b506103c96138ac565b348015610cf557600080fd5b506103c9600435613929565b348015610d0d57600080fd5b50610385613bf0565b348015610d2257600080fd5b506104c9600160a060020a0360043581169060243516604435613c14565b348015610d4c57600080fd5b50610435600435613ed3565b348015610d6457600080fd5b50610435613efb565b348015610d7957600080fd5b506103c9613f0a565b348015610d8e57600080fd5b506103ec600160a060020a0360043516614055565b348015610daf57600080fd5b50610385600160a060020a036004351661409b565b348015610dd057600080fd5b506103c9600160a060020a03600435166140ac565b604080516020600480358082013583810280860185019096528085526103859536959394602494938501929182918501908490808284375094975050843595505050602083013592600160a060020a0360408201351692506060013590506140e5565b348015610e5457600080fd5b506103c9600160a060020a036004351661410b565b348015610e7557600080fd5b506103c963ffffffff60043516614176565b604080516020600480358082013583810280860185019096528085526103859536959394602494938501929182918501908490808284375094975050843595505050602090920135915061425b9050565b348015610ee457600080fd5b506103c9600160a060020a036004351661426b565b348015610f0557600080fd5b506103856142bf565b348015610f1a57600080fd5b506103c960043515156142e3565b348015610f3457600080fd5b50610435614323565b348015610f4957600080fd5b506103c9600160a060020a0360043516602435614332565b60008051602061559383398151915281565b610f7d8482612fc7565b50505050565b600160a060020a03166000908152600b602052604090208054600190910154909163ffffffff82169160ff64010000000082048116926501000000000083048216926601000000000000900490911690565b600354600160a060020a031681565b600160a060020a0381166000908152600b6020526040812060010154819083906601000000000000900460ff16151561101c57600080fd5b600160a060020a0384166000908152600b602052604090206001810154909250640100000000900460ff166110c7576040805160e060020a6370a082310281523060048201529051600160a060020a038616916370a082319160248083019260209291908290030181600087803b15801561109657600080fd5b505af11580156110aa573d6000803e3d6000fd5b505050506040513d60208110156110c057600080fd5b50516110ca565b81545b949350505050565b6000600a828154811015156110e357fe5b600091825260209091200154600160a060020a031692915050565b7f424e54546f6b656e00000000000000000000000000000000000000000000000081565b600080600160a060020a03858116908516141561113e57600080fd5b600254600160a060020a03858116911614156111675761115e8584613114565b91509150611197565b600254600160a060020a03868116911614156111875761115e8484612b5c565b611192858585613c14565b915091505b935093915050565b60075460ff1681565b600054600160a060020a031633146111bf57600080fd5b6008546040805160e260020a632ecd14d302815260008051602061559383398151915260048201529051600092600160a060020a03169163bb34534c91602480830192602092919082900301818787803b15801561121c57600080fd5b505af1158015611230573d6000803e3d6000fd5b505050506040513d602081101561124657600080fd5b5051905033600160a060020a0382161461125f57600080fd5b6112688261442b565b5050565b60006112898888886112818b8a8a8a8a6144c4565b6000806134bd565b98975050505050505050565b600054600160a060020a03163314806112b85750600454600160a060020a031633145b15156112c357600080fd5b600c5460ff6c01000000000000000000000000909104161515811515141561135157600c80546c01000000000000000000000000831581026cff000000000000000000000000199092169190911791829055604080519190920460ff161515815290517fb8e670608a57255ce4f35952b324cba70211a4200a91ce81d26e06d488c1f66b9181900360200190a15b50565b7f436f6e747261637452656769737472790000000000000000000000000000000081565b6008546040805160e260020a632ecd14d302815260008051602061557383398151915260048201529051600092839283928392839283928392600160a060020a03169163bb34534c91602480830192602092919082900301818787803b1580156113e157600080fd5b505af11580156113f5573d6000803e3d6000fd5b505050506040513d602081101561140b57600080fd5b5051905033600160a060020a0382161461142457600080fd5b600c546c01000000000000000000000000900460ff16151561144557600080fd5b876000811161145357600080fd5b600160a060020a038c8116908c16141561146c57600080fd5b600254600160a060020a038c8116911614156114945761148d8c8b8b6145b3565b9750611851565b600254600160a060020a038d8116911614156114b55761148d8b8b8b6147fb565b6114c08c8c8c613c14565b909750955086158015906114d45750888710155b15156114df57600080fd5b600160a060020a038c166000908152600b602052604090206001810154909550640100000000900460ff1615611524578454611521908b63ffffffff614bec16565b85555b600160a060020a038b166000908152600b602052604090206001810154909450640100000000900460ff1615611569578354611566908863ffffffff614c0916565b84555b6115728b610fe4565b925082871061157d57fe5b6115898c33308d614c1e565b6115948b3389614fad565b6115a18c8c8c8a8a615323565b8b600160a060020a03166000805160206155b3833981519152600260009054906101000a9004600160a060020a0316600160a060020a03166318160ddd6040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561160d57600080fd5b505af1158015611621573d6000803e3d6000fd5b505050506040513d602081101561163757600080fd5b81019080805190602001909291905050508e600160a060020a03166370a08231306040518263ffffffff1660e060020a0281526004018082600160a060020a0316600160a060020a03168152602001915050602060405180830381600087803b1580156116a357600080fd5b505af11580156116b7573d6000803e3d6000fd5b505050506040513d60208110156116cd57600080fd5b5051600189015460408051938452602084019290925263ffffffff1682820152519081900360600190a28a600160a060020a03166000805160206155b3833981519152600260009054906101000a9004600160a060020a0316600160a060020a03166318160ddd6040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561176357600080fd5b505af1158015611777573d6000803e3d6000fd5b505050506040513d602081101561178d57600080fd5b81019080805190602001909291905050508d600160a060020a03166370a08231306040518263ffffffff1660e060020a0281526004018082600160a060020a0316600160a060020a03168152602001915050602060405180830381600087803b1580156117f957600080fd5b505af115801561180d573d6000803e3d6000fd5b505050506040513d602081101561182357600080fd5b5051600188015460408051938452602084019290925263ffffffff1682820152519081900360600190a28697505b50505050505050949350505050565b60008060008084516000148061188d57508585600081518110151561188157fe5b90602001906020020151145b151561189857600080fd5b6008546040805160e260020a632ecd14d30281527f42616e636f72580000000000000000000000000000000000000000000000000060048201529051600160a060020a039092169163bb34534c916024808201926020929091908290030181600087803b15801561190857600080fd5b505af115801561191c573d6000803e3d6000fd5b505050506040513d602081101561193257600080fd5b50516008546040805160e260020a632ecd14d302815260008051602061557383398151915260048201529051929550600160a060020a039091169163bb34534c916024808201926020929091908290030181600087803b15801561199557600080fd5b505af11580156119a9573d6000803e3d6000fd5b505050506040513d60208110156119bf57600080fd5b50516008546040805160e260020a632ecd14d30281527f424e54546f6b656e00000000000000000000000000000000000000000000000060048201529051929450600160a060020a039091169163bb34534c916024808201926020929091908290030181600087803b158015611a3457600080fd5b505af1158015611a48573d6000803e3d6000fd5b505050506040513d6020811015611a5e57600080fd5b50518851600160a060020a039091169089906000908110611a7b57fe5b60209081029091010151600160a060020a031614611a9857600080fd5b604080517faafd6b76000000000000000000000000000000000000000000000000000000008152600481018890523360248201529051600160a060020a0385169163aafd6b769160448083019260209291908290030181600087803b158015611b0057600080fd5b505af1158015611b14573d6000803e3d6000fd5b505050506040513d6020811015611b2a57600080fd5b50516002546040805160e060020a63a24835d1028152336004820152602481018490529051929350600160a060020a039091169163a24835d19160448082019260009290919082900301818387803b158015611b8557600080fd5b505af1158015611b99573d6000803e3d6000fd5b50506002546040805160e260020a63219e412d028152600160a060020a03878116600483015260248201879052915191909216935063867904b49250604480830192600092919082900301818387803b158015611bf557600080fd5b505af1158015611c09573d6000803e3d6000fd5b5050505081600160a060020a0316634de006cb89838a338a6000806040518863ffffffff1660e060020a028152600401808060200188815260200187815260200186600160a060020a0316600160a060020a031681526020018060200185600160a060020a0316600160a060020a0316815260200184815260200183810383528a818151815260200191508051906020019060200280838360005b83811015611cbc578181015183820152602001611ca4565b50505050905001838103825286818151815260200191508051906020019060200280838360005b83811015611cfb578181015183820152602001611ce3565b505050509050019950505050505050505050602060405180830381600087803b158015611d2757600080fd5b505af1158015611d3b573d6000803e3d6000fd5b505050506040513d6020811015611d5157600080fd5b505198975050505050505050565b600054600160a060020a03163314611d7657600080fd5b600254604080517f18160ddd0000000000000000000000000000000000000000000000000000000081529051600092600160a060020a0316916318160ddd91600480830192602092919082900301818787803b158015611dd557600080fd5b505af1158015611de9573d6000803e3d6000fd5b505050506040513d6020811015611dff57600080fd5b505111611e0b57600080fd5b611e136153a6565b565b600c54600090611e6c9060ff8416620f424081810a67ffffffffffffffff90811693611e6093899363ffffffff680100000000000000009093048316900383160a9091169061542416565b9063ffffffff61545216565b9392505050565b6006805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015611ef95780601f10611ece57610100808354040283529160200191611ef9565b820191906000526020600020905b815481529060010190602001808311611edc57829003601f168201915b505050505081565b611f0b838361285d565b505050565b600c546000908190819081908190819063ffffffff16620f424014611f3457600080fd5b600260009054906101000a9004600160a060020a0316600160a060020a03166318160ddd6040518163ffffffff1660e060020a028152600401602060405180830381600087803b158015611f8757600080fd5b505af1158015611f9b573d6000803e3d6000fd5b505050506040513d6020811015611fb157600080fd5b50516002546040805160e060020a63a24835d1028152336004820152602481018b90529051929850600160a060020a039091169163a24835d19160448082019260009290919082900301818387803b15801561200c57600080fd5b505af1158015612020573d6000803e3d6000fd5b50505050600091505b600a5461ffff8316101561218c57600a805461ffff841690811061204957fe5b60009182526020808320909101546040805160e060020a6370a082310281523060048201529051600160a060020a03909216985088936370a082319360248084019491939192918390030190829087803b1580156120a657600080fd5b505af11580156120ba573d6000803e3d6000fd5b505050506040513d60208110156120d057600080fd5b505193506120e886611e60898763ffffffff61542416565b600160a060020a0386166000908152600b6020526040902060018101549194509150640100000000900460ff161561212f57805461212c908463ffffffff614c0916565b81555b61213a853385614fad565b6001810154604080518989038152858703602082015263ffffffff9092168282015251600160a060020a038716916000805160206155b3833981519152919081900360600190a2600190910190612029565b50505050505050565b600054600160a060020a031633146121ac57600080fd5b600254604080517f5e35359e000000000000000000000000000000000000000000000000000000008152600160a060020a03868116600483015285811660248301526044820185905291519190921691635e35359e91606480830192600092919082900301818387803b15801561222257600080fd5b505af115801561218c573d6000803e3d6000fd5b600554600160a060020a031681565b600454600160a060020a031681565b60075460009060ff16806122725750600054600160a060020a031633145b151561227d57600080fd5b6008546040805160e260020a632ecd14d30281527f436f6e747261637452656769737472790000000000000000000000000000000060048201529051600160a060020a039092169163bb34534c916024808201926020929091908290030181600087803b1580156122ed57600080fd5b505af1158015612301573d6000803e3d6000fd5b505050506040513d602081101561231757600080fd5b5051600854909150600160a060020a038083169116148015906123425750600160a060020a03811615155b151561234d57600080fd5b600880546007805474ffffffffffffffffffffffffffffffffffffffff001916610100600160a060020a038085169190910291909117909155600160a060020a03199091169216919091179055565b600054600160a060020a031633146123b357600080fd5b80600160a060020a0381163014156123ca57600080fd5b5060098054600160a060020a031916600160a060020a0392909216919091179055565b60006112898888886124028a8a8a8a8a6144c4565b611860565b60055474010000000000000000000000000000000000000000900461ffff1681565b600c5468010000000000000000900463ffffffff1681565b7f42616e636f72436f6e766572746572466163746f72790000000000000000000081565b6008546040805160e260020a632ecd14d302815260008051602061559383398151915260048201529051600092600160a060020a03169163bb34534c91602480830192602092919082900301818787803b1580156124c257600080fd5b505af11580156124d6573d6000803e3d6000fd5b505050506040513d60208110156124ec57600080fd5b5051600160a060020a0385166000908152600b60205260409020600101549091506601000000000000900460ff1615806125b85750600254604080517f8da5cb5b00000000000000000000000000000000000000000000000000000000815290513092600160a060020a031691638da5cb5b9160048083019260209291908290030181600087803b15801561258057600080fd5b505af1158015612594573d6000803e3d6000fd5b505050506040513d60208110156125aa57600080fd5b5051600160a060020a031614155b806125d05750600054600160a060020a038281169116145b15156125db57600080fd5b610f7d848484615475565b60006125f485858585611378565b95945050505050565b6007546101009004600160a060020a031681565b60008054819081908190600160a060020a0316331461262f57600080fd5b600254604080517f8da5cb5b00000000000000000000000000000000000000000000000000000000815290513092600160a060020a031691638da5cb5b9160048083019260209291908290030181600087803b15801561268e57600080fd5b505af11580156126a2573d6000803e3d6000fd5b505050506040513d60208110156126b857600080fd5b5051600160a060020a0316146126cd57600080fd5b60648561ffff16101580156126e857506103e88561ffff1611155b15156126f357600080fd5b8461ffff16606414159350600091505b600a5461ffff8316101561282157600a805461ffff841690811061272357fe5b600091825260208083209190910154600160a060020a0316808352600b909152604090912060018101805464ff00000000191664010000000088151502179055909350905083612774576000612814565b6128146064611e608761ffff1686600160a060020a03166370a08231306040518263ffffffff1660e060020a0281526004018082600160a060020a0316600160a060020a03168152602001915050602060405180830381600087803b1580156127dc57600080fd5b505af11580156127f0573d6000803e3d6000fd5b505050506040513d602081101561280657600080fd5b50519063ffffffff61542416565b8155600190910190612703565b60408051851515815290517f64622fbd54039f76d87a876ecaea9bdb6b9b493d7a35ca38ae82b53dcddbe2e49181900360200190a15050505050565b600054600160a060020a0316331461287457600080fd5b600254604080517f8da5cb5b00000000000000000000000000000000000000000000000000000000815290513092600160a060020a031691638da5cb5b9160048083019260209291908290030181600087803b1580156128d357600080fd5b505af11580156128e7573d6000803e3d6000fd5b505050506040513d60208110156128fd57600080fd5b5051600160a060020a0316141561291357600080fd5b81600160a060020a038116151561292957600080fd5b82600160a060020a03811630141561294057600080fd5b8260008163ffffffff161180156129605750620f424063ffffffff821611155b151561296b57600080fd5b600254600160a060020a038681169116148015906129af5750600160a060020a0385166000908152600b60205260409020600101546601000000000000900460ff16155b80156129cd5750600c54620f424063ffffffff918216860190911611155b15156129d857600080fd5b505050600160a060020a03919091166000818152600b60205260408120600180820180549284905566010000000000006501000000000063ffffffff1994851663ffffffff808a169190911765ffff0000000019169190911766ff000000000000191691909117909155600a805492830181559093527fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a8018054600160a060020a031916909317909255600c805492831692821690930116179055565b60008051602061555383398151915281565b6040805160038082526080820190925260009160609190602082018380388339505060025482519293508a92600160a060020a039091169150899084906000908110612aef57fe5b906020019060200201846001815181101515612b0757fe5b906020019060200201856002815181101515612b1f57fe5b600160a060020a039485166020918202909201015292821690925291909116905261128981878787876140e5565b6000612b57613104565b905090565b60008060008060008060008030600160a060020a0316600260009054906101000a9004600160a060020a0316600160a060020a0316638da5cb5b6040518163ffffffff1660e060020a028152600401602060405180830381600087803b158015612bc557600080fd5b505af1158015612bd9573d6000803e3d6000fd5b505050506040513d6020811015612bef57600080fd5b5051600160a060020a031614612c0457600080fd5b600160a060020a038a166000908152600b60205260409020600101548a906601000000000000900460ff161515612c3a57600080fd5b600160a060020a03808c166000908152600b6020908152604080832060025482517f18160ddd0000000000000000000000000000000000000000000000000000000081529251919c50909416936318160ddd93600480840194938390030190829087803b158015612caa57600080fd5b505af1158015612cbe573d6000803e3d6000fd5b505050506040513d6020811015612cd457600080fd5b50516040805160e060020a6370a082310281523060048201529051919750600160a060020a038d16916370a08231916024808201926020929091908290030181600087803b158015612d2557600080fd5b505af1158015612d39573d6000803e3d6000fd5b505050506040513d6020811015612d4f57600080fd5b50516008546040805160e260020a632ecd14d302815260008051602061555383398151915260048201529051929750600160a060020a039091169163bb34534c916024808201926020929091908290030181600087803b158015612db257600080fd5b505af1158015612dc6573d6000803e3d6000fd5b505050506040513d6020811015612ddc57600080fd5b50516001880154604080517f49f9b0f7000000000000000000000000000000000000000000000000000000008152600481018a90526024810189905263ffffffff9092166044830152606482018d905251919550600160a060020a038616916349f9b0f7916084808201926020929091908290030181600087803b158015612e6357600080fd5b505af1158015612e77573d6000803e3d6000fd5b505050506040513d6020811015612e8d57600080fd5b50519250612e9c836001611e15565b9b928c90039a509198505050505050505050565b60006125f485858585600080612aa7565b600154600160a060020a03163314612ed857600080fd5b60015460008054604051600160a060020a0393841693909116917f343765429aea5a34b3ff6a3785a98a5abb2597aca87bfbb58632c173d585373a91a36001805460008054600160a060020a0319908116600160a060020a03841617909155169055565b600854600160a060020a031681565b7f436f6e747261637446656174757265730000000000000000000000000000000081565b600054600160a060020a031681565b600080611192858585613c14565b60008051602061557383398151915281565b7f42616e636f7247617350726963654c696d69740000000000000000000000000081565b600181565b60008054600160a060020a03163314612fdf57600080fd5b6008546040805160e260020a632ecd14d302815260008051602061559383398151915260048201529051600092600160a060020a03169163bb34534c91602480830192602092919082900301818787803b15801561303c57600080fd5b505af1158015613050573d6000803e3d6000fd5b505050506040513d602081101561306657600080fd5b5051905033600160a060020a0382161461307f57600080fd5b600160a060020a0384166000908152600b602052604090206001015484906601000000000000900460ff1615156130b557600080fd5b505050600160a060020a03919091166000908152600b6020526040902060018101805464ff0000000019168315156401000000000217905555565b600c54640100000000900463ffffffff1681565b600a5490565b6112688282613435565b60008060008060008060008030600160a060020a0316600260009054906101000a9004600160a060020a0316600160a060020a0316638da5cb5b6040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561317d57600080fd5b505af1158015613191573d6000803e3d6000fd5b505050506040513d60208110156131a757600080fd5b5051600160a060020a0316146131bc57600080fd5b600160a060020a038a166000908152600b60205260409020600101548a906601000000000000900460ff1615156131f257600080fd5b600160a060020a038b166000908152600b60205260409020600181015490975065010000000000900460ff16151561322957600080fd5b600260009054906101000a9004600160a060020a0316600160a060020a03166318160ddd6040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561327c57600080fd5b505af1158015613290573d6000803e3d6000fd5b505050506040513d60208110156132a657600080fd5b50516040805160e060020a6370a082310281523060048201529051919750600160a060020a038d16916370a08231916024808201926020929091908290030181600087803b1580156132f757600080fd5b505af115801561330b573d6000803e3d6000fd5b505050506040513d602081101561332157600080fd5b50516008546040805160e260020a632ecd14d302815260008051602061555383398151915260048201529051929750600160a060020a039091169163bb34534c916024808201926020929091908290030181600087803b15801561338457600080fd5b505af1158015613398573d6000803e3d6000fd5b505050506040513d60208110156133ae57600080fd5b50516001880154604080517f29a00e7c000000000000000000000000000000000000000000000000000000008152600481018a90526024810189905263ffffffff9092166044830152606482018d905251919550600160a060020a038616916329a00e7c916084808201926020929091908290030181600087803b158015612e6357600080fd5b600054600160a060020a0316331461344c57600080fd5b600160a060020a0382166000908152600b602052604090206001015482906601000000000000900460ff16151561348257600080fd5b50600160a060020a03919091166000908152600b60205260409020600101805465ff0000000000191691156501000000000002919091179055565b6000808451600014806134e75750868560008151811015156134db57fe5b90602001906020020151145b15156134f257600080fd5b6008546040805160e260020a632ecd14d302815260008051602061557383398151915260048201529051600160a060020a039092169163bb34534c916024808201926020929091908290030181600087803b15801561355057600080fd5b505af1158015613564573d6000803e3d6000fd5b505050506040513d602081101561357a57600080fd5b505190503415156136c3576002548851600160a060020a0390911690899060009081106135a357fe5b90602001906020020151600160a060020a0316141561369f576002546040805160e060020a63a24835d1028152336004820152602481018a90529051600160a060020a039092169163a24835d19160448082019260009290919082900301818387803b15801561361257600080fd5b505af1158015613626573d6000803e3d6000fd5b50506002546040805160e260020a63219e412d028152600160a060020a038681166004830152602482018d9052915191909216935063867904b49250604480830192600092919082900301818387803b15801561368257600080fd5b505af1158015613696573d6000803e3d6000fd5b505050506136c3565b6136c38860008151811015156136b157fe5b9060200190602002015133838a614c1e565b80600160a060020a0316634de006cb348a8a8a338b8b8b6040518963ffffffff1660e060020a028152600401808060200188815260200187815260200186600160a060020a0316600160a060020a031681526020018060200185600160a060020a0316600160a060020a0316815260200184815260200183810383528a818151815260200191508051906020019060200280838360005b8381101561377257818101518382015260200161375a565b50505050905001838103825286818151815260200191508051906020019060200280838360005b838110156137b1578181015183820152602001613799565b5050505090500199505050505050505050506020604051808303818588803b1580156137dc57600080fd5b505af11580156137f0573d6000803e3d6000fd5b50505050506040513d6020811015611d5157600080fd5b600054600160a060020a031633148061382a5750600454600160a060020a031633145b151561383557600080fd5b6007805460088054600160a060020a031916600160a060020a0361010084041617905560ff19169055565b600c546c01000000000000000000000000900460ff1681565b600954600160a060020a031681565b7f42616e636f72580000000000000000000000000000000000000000000000000081565b600554600160a060020a031633146138c357600080fd5b600554600454604051600160a060020a0392831692909116907fbe4cc281795971a471c980e842627a7f1ea3892ddfce8c5b6357cd2611c1973290600090a36005805460048054600160a060020a0319908116600160a060020a03841617909155169055565b600c546000908190819081908190819063ffffffff16620f42401461394d57600080fd5b600c546c01000000000000000000000000900460ff16151561396e57600080fd5b600260009054906101000a9004600160a060020a0316600160a060020a03166318160ddd6040518163ffffffff1660e060020a028152600401602060405180830381600087803b1580156139c157600080fd5b505af11580156139d5573d6000803e3d6000fd5b505050506040513d60208110156139eb57600080fd5b50519550600091505b600a5461ffff83161015613b7957600a805461ffff8416908110613a1457fe5b60009182526020808320909101546040805160e060020a6370a082310281523060048201529051600160a060020a03909216985088936370a082319360248084019491939192918390030190829087803b158015613a7157600080fd5b505af1158015613a85573d6000803e3d6000fd5b505050506040513d6020811015613a9b57600080fd5b50519350613ad46001613ac888611e6083613abc8d8b63ffffffff61542416565b9063ffffffff614c0916565b9063ffffffff614bec16565b600160a060020a0386166000908152600b6020526040902060018101549194509150640100000000900460ff1615613b1b578054613b18908463ffffffff614bec16565b81555b613b2785333086614c1e565b600181015460408051888a018152868601602082015263ffffffff9092168282015251600160a060020a038716916000805160206155b3833981519152919081900360600190a26001909101906139f4565b6002546040805160e260020a63219e412d028152336004820152602481018a90529051600160a060020a039092169163867904b49160448082019260009290919082900301818387803b158015613bcf57600080fd5b505af1158015613be3573d6000803e3d6000fd5b5050505050505050505050565b7f42616e636f72585570677261646572000000000000000000000000000000000081565b600080600080600080600030600160a060020a0316600260009054906101000a9004600160a060020a0316600160a060020a0316638da5cb5b6040518163ffffffff1660e060020a028152600401602060405180830381600087803b158015613c7c57600080fd5b505af1158015613c90573d6000803e3d6000fd5b505050506040513d6020811015613ca657600080fd5b5051600160a060020a031614613cbb57600080fd5b600160a060020a038a166000908152600b60205260409020600101548a906601000000000000900460ff161515613cf157600080fd5b600160a060020a038a166000908152600b60205260409020600101548a906601000000000000900460ff161515613d2757600080fd5b600160a060020a038c81166000908152600b6020526040808220928e16825290206001820154919850965065010000000000900460ff161515613d6957600080fd5b6008546040805160e260020a632ecd14d302815260008051602061555383398151915260048201529051600160a060020a039092169163bb34534c916024808201926020929091908290030181600087803b158015613dc757600080fd5b505af1158015613ddb573d6000803e3d6000fd5b505050506040513d6020811015613df157600080fd5b50519450600160a060020a0385166379c1b450613e0d8e610fe4565b60018a015463ffffffff16613e218f610fe4565b60018b01546040805163ffffffff87811660e060020a028252600482019690965293851660248501526044840192909252929092166064820152608481018e9052905160a48083019260209291908290030181600087803b158015613e8557600080fd5b505af1158015613e99573d6000803e3d6000fd5b505050506040513d6020811015613eaf57600080fd5b50519350613ebe846002611e15565b9c938d90039b50929950505050505050505050565b600a805482908110613ee157fe5b600091825260209091200154600160a060020a0316905081565b600154600160a060020a031681565b60008054600160a060020a03163314613f2257600080fd5b6008546040805160e260020a632ecd14d302815260008051602061559383398151915260048201529051600160a060020a039092169163bb34534c916024808201926020929091908290030181600087803b158015613f8057600080fd5b505af1158015613f94573d6000803e3d6000fd5b505050506040513d6020811015613faa57600080fd5b50519050613fb78161426b565b600554604080517f90f58c960000000000000000000000000000000000000000000000000000000081527401000000000000000000000000000000000000000090920461ffff16600483015251600160a060020a038316916390f58c9691602480830192600092919082900301818387803b15801561403557600080fd5b505af1158015614049573d6000803e3d6000fd5b50505050611351612ec1565b600b602052600090815260409020805460019091015463ffffffff81169060ff640100000000820481169165010000000000810482169166010000000000009091041685565b60006140a682610fe4565b92915050565b600054600160a060020a031633146140c357600080fd5b60038054600160a060020a031916600160a060020a0392909216919091179055565b60006141018686866140fa85808080806144c4565b87876134bd565b9695505050505050565b600054600160a060020a031633148061412e5750600454600160a060020a031633145b151561413957600080fd5b600454600160a060020a038281169116141561415457600080fd5b60058054600160a060020a031916600160a060020a0392909216919091179055565b600054600160a060020a03163314806141995750600454600160a060020a031633145b15156141a457600080fd5b60008163ffffffff16101580156141cf5750600c5463ffffffff640100000000909104811690821611155b15156141da57600080fd5b600c546040805163ffffffff6801000000000000000090930483168152918316602083015280517f81cd2ffb37dd237c0e4e2a3de5265fcf9deb43d3e7801e80db9f1ccfba7ee6009281900390910190a1600c805463ffffffff90921668010000000000000000026bffffffff000000000000000019909216919091179055565b60006110ca8484846000806140e5565b600054600160a060020a0316331461428257600080fd5b600054600160a060020a038281169116141561429d57600080fd5b60018054600160a060020a031916600160a060020a0392909216919091179055565b7f4e6f6e5374616e64617264546f6b656e5265676973747279000000000000000081565b600054600160a060020a03163314806143065750600454600160a060020a031633145b151561431157600080fd5b6007805460ff19169115919091179055565b600254600160a060020a031681565b600354600160a060020a0316331461434957600080fd5b6002546040805160e060020a63a24835d1028152600160a060020a038581166004830152602482018590529151919092169163a24835d191604480830192600092919082900301818387803b1580156143a157600080fd5b505af11580156143b5573d6000803e3d6000fd5b50506002546040805160e260020a63219e412d028152336004820152602481018690529051600160a060020a03909216935063867904b4925060448082019260009290919082900301818387803b15801561440f57600080fd5b505af1158015614423573d6000803e3d6000fd5b505050505050565b600054600160a060020a0316331461444257600080fd5b600254604080517ff2fde38b000000000000000000000000000000000000000000000000000000008152600160a060020a0384811660048301529151919092169163f2fde38b91602480830192600092919082900301818387803b1580156144a957600080fd5b505af11580156144bd573d6000803e3d6000fd5b5050505050565b60608060ff85161580156144d6575083155b80156144e0575082155b156144fb5760408051600081526020810190915291506145a9565b60408051600580825260c08201909252906020820160a0803883390190505090508681600081518110151561452c57fe5b60209081029091010152805186908290600190811061454757fe5b60209081029091010152805160ff8616908290600290811061456557fe5b60209081029091010152805184908290600390811061458057fe5b60209081029091010152805183908290600490811061459b57fe5b602090810290910101529050805b5095945050505050565b6000806000806145c38787613114565b909350915082158015906145d75750848310155b15156145e257600080fd5b50600160a060020a0386166000908152600b602052604090206001810154640100000000900460ff1615614625578054614622908763ffffffff614bec16565b81555b61463187333089614c1e565b6002546040805160e260020a63219e412d028152336004820152602481018690529051600160a060020a039092169163867904b49160448082019260009290919082900301818387803b15801561468757600080fd5b505af115801561469b573d6000803e3d6000fd5b50506002546146b99250899150600160a060020a0316888686615323565b86600160a060020a03166000805160206155b3833981519152600260009054906101000a9004600160a060020a0316600160a060020a03166318160ddd6040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561472557600080fd5b505af1158015614739573d6000803e3d6000fd5b505050506040513d602081101561474f57600080fd5b50516040805160e060020a6370a082310281523060048201529051600160a060020a038c16916370a082319160248083019260209291908290030181600087803b15801561479c57600080fd5b505af11580156147b0573d6000803e3d6000fd5b505050506040513d60208110156147c657600080fd5b5051600185015460408051938452602084019290925263ffffffff1682820152519081900360600190a2509095945050505050565b6002546040805160e060020a6370a08231028152336004820152905160009283928392839283928392600160a060020a03909216916370a082319160248082019260209290919082900301818787803b15801561485757600080fd5b505af115801561486b573d6000803e3d6000fd5b505050506040513d602081101561488157600080fd5b505188111561488f57600080fd5b6148998989612b5c565b909550935084158015906148ad5750868510155b15156148b857600080fd5b600260009054906101000a9004600160a060020a0316600160a060020a03166318160ddd6040518163ffffffff1660e060020a028152600401602060405180830381600087803b15801561490b57600080fd5b505af115801561491f573d6000803e3d6000fd5b505050506040513d602081101561493557600080fd5b50516040805160e060020a6370a082310281523060048201529051919450600160a060020a038b16916370a08231916024808201926020929091908290030181600087803b15801561498657600080fd5b505af115801561499a573d6000803e3d6000fd5b505050506040513d60208110156149b057600080fd5b50519150818510806149cb575081851480156149cb57508288145b15156149d357fe5b50600160a060020a0388166000908152600b602052604090206001810154640100000000900460ff1615614a16578054614a13908663ffffffff614c0916565b81555b6002546040805160e060020a63a24835d1028152336004820152602481018b90529051600160a060020a039092169163a24835d19160448082019260009290919082900301818387803b158015614a6c57600080fd5b505af1158015614a80573d6000803e3d6000fd5b50505050614a8f893387614fad565b600254614aa890600160a060020a03168a8a8888615323565b88600160a060020a03166000805160206155b3833981519152600260009054906101000a9004600160a060020a0316600160a060020a03166318160ddd6040518163ffffffff1660e060020a028152600401602060405180830381600087803b158015614b1457600080fd5b505af1158015614b28573d6000803e3d6000fd5b505050506040513d6020811015614b3e57600080fd5b50516040805160e060020a6370a082310281523060048201529051600160a060020a038e16916370a082319160248083019260209291908290030181600087803b158015614b8b57600080fd5b505af1158015614b9f573d6000803e3d6000fd5b505050506040513d6020811015614bb557600080fd5b5051600185015460408051938452602084019290925263ffffffff1682820152519081900360600190a25092979650505050505050565b600082820183811015614bfe57600080fd5b8091505b5092915050565b600081831015614c1857600080fd5b50900390565b6008546040805160e260020a632ecd14d30281527f4e6f6e5374616e64617264546f6b656e526567697374727900000000000000006004820152905160009283928392600160a060020a039092169163bb34534c9160248082019260209290919082900301818787803b158015614c9457600080fd5b505af1158015614ca8573d6000803e3d6000fd5b505050506040513d6020811015614cbe57600080fd5b5051604080517faeea10bd000000000000000000000000000000000000000000000000000000008152600160a060020a038a8116600483015291519295509085169163aeea10bd916024808201926020929091908290030181600087803b158015614d2857600080fd5b505af1158015614d3c573d6000803e3d6000fd5b505050506040513d6020811015614d5257600080fd5b505115614f055786600160a060020a03166370a08231866040518263ffffffff1660e060020a0281526004018082600160a060020a0316600160a060020a03168152602001915050602060405180830381600087803b158015614db457600080fd5b505af1158015614dc8573d6000803e3d6000fd5b505050506040513d6020811015614dde57600080fd5b5051604080517f23b872dd000000000000000000000000000000000000000000000000000000008152600160a060020a0389811660048301528881166024830152604482018890529151929450908916916323b872dd9160648082019260009290919082900301818387803b158015614e5657600080fd5b505af1158015614e6a573d6000803e3d6000fd5b5050505086600160a060020a03166370a08231866040518263ffffffff1660e060020a0281526004018082600160a060020a0316600160a060020a03168152602001915050602060405180830381600087803b158015614ec957600080fd5b505af1158015614edd573d6000803e3d6000fd5b505050506040513d6020811015614ef357600080fd5b50519050818111614f0057fe5b61218c565b604080517f23b872dd000000000000000000000000000000000000000000000000000000008152600160a060020a0388811660048301528781166024830152604482018790529151918916916323b872dd916064808201926020929091908290030181600087803b158015614f7957600080fd5b505af1158015614f8d573d6000803e3d6000fd5b505050506040513d6020811015614fa357600080fd5b5051151561218c57fe5b6008546040805160e260020a632ecd14d30281527f4e6f6e5374616e64617264546f6b656e526567697374727900000000000000006004820152905160009283928392600160a060020a039092169163bb34534c9160248082019260209290919082900301818787803b15801561502357600080fd5b505af1158015615037573d6000803e3d6000fd5b505050506040513d602081101561504d57600080fd5b5051604080517faeea10bd000000000000000000000000000000000000000000000000000000008152600160a060020a03898116600483015291519295509085169163aeea10bd916024808201926020929091908290030181600087803b1580156150b757600080fd5b505af11580156150cb573d6000803e3d6000fd5b505050506040513d60208110156150e157600080fd5b50511561528c5785600160a060020a03166370a08231866040518263ffffffff1660e060020a0281526004018082600160a060020a0316600160a060020a03168152602001915050602060405180830381600087803b15801561514357600080fd5b505af1158015615157573d6000803e3d6000fd5b505050506040513d602081101561516d57600080fd5b5051604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152600160a060020a0388811660048301526024820188905291519294509088169163a9059cbb9160448082019260009290919082900301818387803b1580156151dd57600080fd5b505af11580156151f1573d6000803e3d6000fd5b5050505085600160a060020a03166370a08231866040518263ffffffff1660e060020a0281526004018082600160a060020a0316600160a060020a03168152602001915050602060405180830381600087803b15801561525057600080fd5b505af1158015615264573d6000803e3d6000fd5b505050506040513d602081101561527a57600080fd5b5051905081811161528757fe5b614423565b85600160a060020a031663a9059cbb86866040518363ffffffff1660e060020a0281526004018083600160a060020a0316600160a060020a0316815260200182815260200192505050602060405180830381600087803b1580156152ef57600080fd5b505af1158015615303573d6000803e3d6000fd5b505050506040513d602081101561531957600080fd5b5051151561442357fe5b7f8000000000000000000000000000000000000000000000000000000000000000811061534c57fe5b604080518481526020810184905280820183905290513391600160a060020a0387811692908916917f276856b36cbc45526a0ba64f44611557a2a8b68662c5388e9fe6d72e86e1c8cb919081900360600190a45050505050565b600054600160a060020a031633146153bd57600080fd5b600260009054906101000a9004600160a060020a0316600160a060020a03166379ba50976040518163ffffffff1660e060020a028152600401600060405180830381600087803b15801561541057600080fd5b505af1158015610f7d573d6000803e3d6000fd5b6000808315156154375760009150614c02565b5082820282848281151561544757fe5b0414614bfe57600080fd5b60008080831161546157600080fd5b828481151561546c57fe5b04949350505050565b600054600160a060020a0316331461548c57600080fd5b82600160a060020a03811615156154a257600080fd5b82600160a060020a03811615156154b857600080fd5b83600160a060020a0381163014156154cf57600080fd5b85600160a060020a031663a9059cbb86866040518363ffffffff1660e060020a0281526004018083600160a060020a0316600160a060020a0316815260200182815260200192505050600060405180830381600087803b15801561553257600080fd5b505af1158015615546573d6000803e3d6000fd5b50505050505050505050560042616e636f72466f726d756c610000000000000000000000000000000000000042616e636f724e6574776f726b0000000000000000000000000000000000000042616e636f72436f6e76657274657255706772616465720000000000000000008a6a7f53b3c8fa1dc4b83e3f1be668c1b251ff8d44cdcb83eb3acec3fec6a788a165627a7a72305820a1d5240c498906975038de9bdb52dacf0a95be608af2600ce15c20774b5be07a0029

Swarm Source

bzzr://a1d5240c498906975038de9bdb52dacf0a95be608af2600ce15c20774b5be07a

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

OVERVIEW

Bancor converter address.

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.