ETH Price: $3,385.46 (-1.51%)
Gas: 2 Gwei

Contract

0xe24C8bbDBA150aa3Cb13C785d3A19D012dDC1e86
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Value
Transfer Ownersh...156735462022-10-04 8:20:59634 days ago1664871659IN
Bancor: Converter 439
0 ETH0.000212098.82615798
Upgrade121994952021-04-08 13:43:011177 days ago1617889381IN
Bancor: Converter 439
0 ETH0.53785688122
Remove Liquidity121921442021-04-07 10:34:481178 days ago1617791688IN
Bancor: Converter 439
0 ETH0.01087957115
Remove Liquidity121844712021-04-06 6:20:521180 days ago1617690052IN
Bancor: Converter 439
0 ETH0.0104124795
Remove Liquidity121840902021-04-06 4:53:411180 days ago1617684821IN
Bancor: Converter 439
0 ETH0.0106238996.8
Remove Liquidity121738122021-04-04 14:59:031181 days ago1617548343IN
Bancor: Converter 439
0 ETH0.01205523110
Remove Liquidity121737112021-04-04 14:40:161181 days ago1617547216IN
Bancor: Converter 439
0 ETH0.0124936114
Remove Liquidity121736992021-04-04 14:37:431181 days ago1617547063IN
Bancor: Converter 439
0 ETH0.00983642104
Remove Liquidity121556352021-04-01 20:05:351184 days ago1617307535IN
Bancor: Converter 439
0 ETH0.02005332183
Remove Liquidity121531372021-04-01 10:40:521184 days ago1617273652IN
Bancor: Converter 439
0 ETH0.01644075150
Remove Liquidity121518402021-04-01 5:50:131185 days ago1617256213IN
Bancor: Converter 439
0 ETH0.01654491151
Remove Liquidity121469642021-03-31 11:55:381185 days ago1617191738IN
Bancor: Converter 439
0 ETH0.01270861116
Remove Liquidity121425642021-03-30 19:39:161186 days ago1617133156IN
Bancor: Converter 439
0 ETH0.01391983127
Remove Liquidity121383972021-03-30 4:12:201187 days ago1617077540IN
Bancor: Converter 439
0 ETH0.0104101995
Remove Liquidity121371422021-03-29 23:32:191187 days ago1617060739IN
Bancor: Converter 439
0 ETH0.01205655110
Remove Liquidity121368802021-03-29 22:36:581187 days ago1617057418IN
Bancor: Converter 439
0 ETH0.01059576112
Remove Liquidity121362372021-03-29 20:16:241187 days ago1617048984IN
Bancor: Converter 439
0 ETH0.01739407184
Remove Liquidity121300642021-03-28 21:26:351188 days ago1616966795IN
Bancor: Converter 439
0 ETH0.01201635127
Remove Liquidity121285162021-03-28 15:43:241188 days ago1616946204IN
Bancor: Converter 439
0 ETH0.01337034122
Remove Liquidity121284802021-03-28 15:36:051188 days ago1616945765IN
Bancor: Converter 439
0 ETH0.01326075121
Remove Liquidity121284362021-03-28 15:25:231188 days ago1616945123IN
Bancor: Converter 439
0 ETH0.01358953124
Remove Liquidity121283452021-03-28 15:06:411188 days ago1616944001IN
Bancor: Converter 439
0 ETH0.01271278116
Remove Liquidity121283062021-03-28 14:58:181188 days ago1616943498IN
Bancor: Converter 439
0 ETH0.01293197118
Remove Liquidity121282592021-03-28 14:46:391188 days ago1616942799IN
Bancor: Converter 439
0 ETH0.0104113395
Remove Liquidity121282102021-03-28 14:38:051188 days ago1616942285IN
Bancor: Converter 439
0 ETH0.01205523110
View all transactions

Latest 25 internal transactions (View All)

Advanced mode:
Parent Transaction Hash Block From To Value
121994952021-04-08 13:43:011177 days ago1617889381
Bancor: Converter 439
97,537.50523722 ETH
121994822021-04-08 13:40:101177 days ago1617889210
Bancor: Converter 439
45.88162404 ETH
121994652021-04-08 13:35:001177 days ago1617888900
Bancor: Converter 439
24.73370354 ETH
121994572021-04-08 13:33:581177 days ago1617888838
Bancor: Converter 439
1.64826097 ETH
121994512021-04-08 13:33:091177 days ago1617888789
Bancor: Converter 439
2.44180668 ETH
121994502021-04-08 13:32:511177 days ago1617888771
Bancor: Converter 439
7.3 ETH
121994502021-04-08 13:32:511177 days ago1617888771
Bancor: Converter 439
3.52742936 ETH
121994392021-04-08 13:30:381177 days ago1617888638
Bancor: Converter 439
0.23097298 ETH
121994232021-04-08 13:27:081177 days ago1617888428
Bancor: Converter 439
0.71115891 ETH
121994142021-04-08 13:25:151177 days ago1617888315
Bancor: Converter 439
5.44981055 ETH
121994012021-04-08 13:23:031177 days ago1617888183
Bancor: Converter 439
6.90705129 ETH
121993872021-04-08 13:20:351177 days ago1617888035
Bancor: Converter 439
30.69965229 ETH
121993752021-04-08 13:18:291177 days ago1617887909
Bancor: Converter 439
35.05981032 ETH
121993552021-04-08 13:15:051177 days ago1617887705
Bancor: Converter 439
25.23662908 ETH
121993442021-04-08 13:11:211177 days ago1617887481
Bancor: Converter 439
40 ETH
121993442021-04-08 13:11:211177 days ago1617887481
Bancor: Converter 439
24.5514 ETH
121993432021-04-08 13:11:081177 days ago1617887468
Bancor: Converter 439
24.5437 ETH
121993412021-04-08 13:11:031177 days ago1617887463
Bancor: Converter 439
2.65759876 ETH
121993302021-04-08 13:08:101177 days ago1617887290
Bancor: Converter 439
17 ETH
121993232021-04-08 13:06:591177 days ago1617887219
Bancor: Converter 439
28.92737231 ETH
121993132021-04-08 13:04:091177 days ago1617887049
Bancor: Converter 439
2.64216713 ETH
121993102021-04-08 13:03:441177 days ago1617887024
Bancor: Converter 439
37.50185 ETH
121993002021-04-08 13:02:481177 days ago1617886968
Bancor: Converter 439
7 ETH
121992622021-04-08 12:55:271177 days ago1617886527
Bancor: Converter 439
0.95 ETH
121992522021-04-08 12:53:371177 days ago1617886417
Bancor: Converter 439
5.37687972 ETH
View All Internal Transactions
Loading...
Loading

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

Contract Name:
StandardPoolConverter

Compiler Version
v0.6.12+commit.27d51765

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity)

/**
 *Submitted for verification at Etherscan.io on 2020-12-14
*/

// File: solidity/contracts/converter/ConverterVersion.sol

// SPDX-License-Identifier: SEE LICENSE IN LICENSE
pragma solidity 0.6.12;

contract ConverterVersion {
    uint16 public constant version = 44;
}

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


pragma solidity 0.6.12;

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

    function transferOwnership(address _newOwner) external;

    function acceptOwnership() external;
}

// File: solidity/contracts/converter/interfaces/IConverterAnchor.sol


pragma solidity 0.6.12;


/*
    Converter Anchor interface
*/
interface IConverterAnchor is IOwned {

}

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


pragma solidity 0.6.12;

/*
    ERC20 Standard Token interface
*/
interface IERC20Token {
    function name() external view returns (string memory);

    function symbol() external view returns (string memory);

    function decimals() external view returns (uint8);

    function totalSupply() external view returns (uint256);

    function balanceOf(address _owner) external view returns (uint256);

    function allowance(address _owner, address _spender) external view returns (uint256);

    function transfer(address _to, uint256 _value) external returns (bool);

    function transferFrom(
        address _from,
        address _to,
        uint256 _value
    ) external returns (bool);

    function approve(address _spender, uint256 _value) external returns (bool);
}

// File: solidity/contracts/converter/interfaces/IConverter.sol


pragma solidity 0.6.12;




/*
    Converter interface
*/
interface IConverter is IOwned {
    function converterType() external pure returns (uint16);

    function anchor() external view returns (IConverterAnchor);

    function isActive() external view returns (bool);

    function targetAmountAndFee(
        IERC20Token _sourceToken,
        IERC20Token _targetToken,
        uint256 _amount
    ) external view returns (uint256, uint256);

    function convert(
        IERC20Token _sourceToken,
        IERC20Token _targetToken,
        uint256 _amount,
        address _trader,
        address payable _beneficiary
    ) external payable returns (uint256);

    function conversionFee() external view returns (uint32);

    function maxConversionFee() external view returns (uint32);

    function reserveBalance(IERC20Token _reserveToken) external view returns (uint256);

    receive() external payable;

    function transferAnchorOwnership(address _newOwner) external;

    function acceptAnchorOwnership() external;

    function setConversionFee(uint32 _conversionFee) external;

    function withdrawTokens(
        IERC20Token _token,
        address _to,
        uint256 _amount
    ) external;

    function withdrawETH(address payable _to) external;

    function addReserve(IERC20Token _token, uint32 _ratio) external;

    // deprecated, backward compatibility
    function token() external view returns (IConverterAnchor);

    function transferTokenOwnership(address _newOwner) external;

    function acceptTokenOwnership() external;

    function connectors(IERC20Token _address)
        external
        view
        returns (
            uint256,
            uint32,
            bool,
            bool,
            bool
        );

    function getConnectorBalance(IERC20Token _connectorToken) external view returns (uint256);

    function connectorTokens(uint256 _index) external view returns (IERC20Token);

    function connectorTokenCount() external view returns (uint16);

    /**
     * @dev triggered when the converter is activated
     *
     * @param _type        converter type
     * @param _anchor      converter anchor
     * @param _activated   true if the converter was activated, false if it was deactivated
     */
    event Activation(uint16 indexed _type, IConverterAnchor indexed _anchor, bool indexed _activated);

    /**
     * @dev triggered when a conversion between two tokens occurs
     *
     * @param _fromToken       source ERC20 token
     * @param _toToken         target ERC20 token
     * @param _trader          wallet that initiated the trade
     * @param _amount          input amount in units of the source token
     * @param _return          output amount minus conversion fee in units of the target token
     * @param _conversionFee   conversion fee in units of the target token
     */
    event Conversion(
        IERC20Token indexed _fromToken,
        IERC20Token indexed _toToken,
        address indexed _trader,
        uint256 _amount,
        uint256 _return,
        int256 _conversionFee
    );

    /**
     * @dev triggered when the rate between two tokens in the converter changes
     * note that the event might be dispatched for rate updates between any two tokens in the converter
     *
     * @param  _token1 address of the first token
     * @param  _token2 address of the second token
     * @param  _rateN  rate of 1 unit of `_token1` in `_token2` (numerator)
     * @param  _rateD  rate of 1 unit of `_token1` in `_token2` (denominator)
     */
    event TokenRateUpdate(IERC20Token indexed _token1, IERC20Token indexed _token2, uint256 _rateN, uint256 _rateD);

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

// File: solidity/contracts/converter/interfaces/IConverterUpgrader.sol


pragma solidity 0.6.12;

/*
    Converter Upgrader interface
*/
interface IConverterUpgrader {
    function upgrade(bytes32 _version) external;

    function upgrade(uint16 _version) external;
}

// File: solidity/contracts/token/interfaces/IDSToken.sol


pragma solidity 0.6.12;




/*
    DSToken interface
*/
interface IDSToken is IConverterAnchor, IERC20Token {
    function issue(address _to, uint256 _amount) external;

    function destroy(address _from, uint256 _amount) external;
}

// File: solidity/contracts/utility/Owned.sol


pragma solidity 0.6.12;


/**
 * @dev This contract provides support and utilities for contract ownership.
 */
contract Owned is IOwned {
    address public override 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 {
        _ownerOnly();
        _;
    }

    // error message binary size optimization
    function _ownerOnly() internal view {
        require(msg.sender == owner, "ERR_ACCESS_DENIED");
    }

    /**
     * @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 override ownerOnly {
        require(_newOwner != owner, "ERR_SAME_OWNER");
        newOwner = _newOwner;
    }

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

// File: solidity/contracts/utility/Utils.sol


pragma solidity 0.6.12;

/**
 * @dev Utilities & Common Modifiers
 */
contract Utils {
    // verifies that a value is greater than zero
    modifier greaterThanZero(uint256 _value) {
        _greaterThanZero(_value);
        _;
    }

    // error message binary size optimization
    function _greaterThanZero(uint256 _value) internal pure {
        require(_value > 0, "ERR_ZERO_VALUE");
    }

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

    // error message binary size optimization
    function _validAddress(address _address) internal pure {
        require(_address != address(0), "ERR_INVALID_ADDRESS");
    }

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

    // error message binary size optimization
    function _notThis(address _address) internal view {
        require(_address != address(this), "ERR_ADDRESS_IS_SELF");
    }
}

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


pragma solidity 0.6.12;

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

// File: solidity/contracts/utility/ContractRegistryClient.sol


pragma solidity 0.6.12;




/**
 * @dev This is the base contract for ContractRegistry clients.
 */
contract ContractRegistryClient is Owned, Utils {
    bytes32 internal constant CONTRACT_REGISTRY = "ContractRegistry";
    bytes32 internal constant BANCOR_NETWORK = "BancorNetwork";
    bytes32 internal constant BANCOR_FORMULA = "BancorFormula";
    bytes32 internal constant CONVERTER_FACTORY = "ConverterFactory";
    bytes32 internal constant CONVERSION_PATH_FINDER = "ConversionPathFinder";
    bytes32 internal constant CONVERTER_UPGRADER = "BancorConverterUpgrader";
    bytes32 internal constant CONVERTER_REGISTRY = "BancorConverterRegistry";
    bytes32 internal constant CONVERTER_REGISTRY_DATA = "BancorConverterRegistryData";
    bytes32 internal constant BNT_TOKEN = "BNTToken";
    bytes32 internal constant BANCOR_X = "BancorX";
    bytes32 internal constant BANCOR_X_UPGRADER = "BancorXUpgrader";

    IContractRegistry public registry; // address of the current contract-registry
    IContractRegistry public prevRegistry; // address of the previous contract-registry
    bool public onlyOwnerCanUpdateRegistry; // only an owner can update the contract-registry

    /**
     * @dev verifies that the caller is mapped to the given contract name
     *
     * @param _contractName    contract name
     */
    modifier only(bytes32 _contractName) {
        _only(_contractName);
        _;
    }

    // error message binary size optimization
    function _only(bytes32 _contractName) internal view {
        require(msg.sender == addressOf(_contractName), "ERR_ACCESS_DENIED");
    }

    /**
     * @dev initializes a new ContractRegistryClient instance
     *
     * @param  _registry   address of a contract-registry contract
     */
    constructor(IContractRegistry _registry) internal validAddress(address(_registry)) {
        registry = IContractRegistry(_registry);
        prevRegistry = IContractRegistry(_registry);
    }

    /**
     * @dev updates to the new contract-registry
     */
    function updateRegistry() public {
        // verify that this function is permitted
        require(msg.sender == owner || !onlyOwnerCanUpdateRegistry, "ERR_ACCESS_DENIED");

        // get the new contract-registry
        IContractRegistry newRegistry = IContractRegistry(addressOf(CONTRACT_REGISTRY));

        // verify that the new contract-registry is different and not zero
        require(newRegistry != registry && address(newRegistry) != address(0), "ERR_INVALID_REGISTRY");

        // verify that the new contract-registry is pointing to a non-zero contract-registry
        require(newRegistry.addressOf(CONTRACT_REGISTRY) != address(0), "ERR_INVALID_REGISTRY");

        // save a backup of the current contract-registry before replacing it
        prevRegistry = registry;

        // replace the current contract-registry with the new contract-registry
        registry = newRegistry;
    }

    /**
     * @dev restores the previous contract-registry
     */
    function restoreRegistry() public ownerOnly {
        // restore the previous contract-registry
        registry = prevRegistry;
    }

    /**
     * @dev restricts the permission to update the contract-registry
     *
     * @param _onlyOwnerCanUpdateRegistry  indicates whether or not permission is restricted to owner only
     */
    function restrictRegistryUpdate(bool _onlyOwnerCanUpdateRegistry) public ownerOnly {
        // change the permission to update the contract-registry
        onlyOwnerCanUpdateRegistry = _onlyOwnerCanUpdateRegistry;
    }

    /**
     * @dev returns the address associated with the given contract name
     *
     * @param _contractName    contract name
     *
     * @return contract address
     */
    function addressOf(bytes32 _contractName) internal view returns (address) {
        return registry.addressOf(_contractName);
    }
}

// File: solidity/contracts/utility/ReentrancyGuard.sol


pragma solidity 0.6.12;

/**
 * @dev This contract provides protection against calling a function
 * (directly or indirectly) from within itself.
 */
contract ReentrancyGuard {
    uint256 private constant UNLOCKED = 1;
    uint256 private constant LOCKED = 2;

    // LOCKED while protected code is being executed, UNLOCKED otherwise
    uint256 private state = UNLOCKED;

    /**
     * @dev ensures instantiation only by sub-contracts
     */
    constructor() internal {}

    // protects a function against reentrancy attacks
    modifier protected() {
        _protected();
        state = LOCKED;
        _;
        state = UNLOCKED;
    }

    // error message binary size optimization
    function _protected() internal view {
        require(state == UNLOCKED, "ERR_REENTRANCY");
    }
}

// File: solidity/contracts/utility/SafeMath.sol


pragma solidity 0.6.12;

/**
 * @dev This library supports 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, "ERR_OVERFLOW");
        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, "ERR_UNDERFLOW");
        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, "ERR_OVERFLOW");
        return z;
    }

    /**
     * @dev Integer division of two numbers truncating the quotient, reverts on division by zero.
     *
     * @param _x   dividend
     * @param _y   divisor
     *
     * @return quotient
     */
    function div(uint256 _x, uint256 _y) internal pure returns (uint256) {
        require(_y > 0, "ERR_DIVIDE_BY_ZERO");
        uint256 c = _x / _y;
        return c;
    }
}

// File: solidity/contracts/utility/TokenHandler.sol


pragma solidity 0.6.12;


contract TokenHandler {
    bytes4 private constant APPROVE_FUNC_SELECTOR = bytes4(keccak256("approve(address,uint256)"));
    bytes4 private constant TRANSFER_FUNC_SELECTOR = bytes4(keccak256("transfer(address,uint256)"));
    bytes4 private constant TRANSFER_FROM_FUNC_SELECTOR = bytes4(keccak256("transferFrom(address,address,uint256)"));

    /**
     * @dev executes the ERC20 token's `approve` function and reverts upon failure
     * the main purpose of this function is to prevent a non standard ERC20 token
     * from failing silently
     *
     * @param _token   ERC20 token address
     * @param _spender approved address
     * @param _value   allowance amount
     */
    function safeApprove(
        IERC20Token _token,
        address _spender,
        uint256 _value
    ) internal {
        (bool success, bytes memory data) = address(_token).call(
            abi.encodeWithSelector(APPROVE_FUNC_SELECTOR, _spender, _value)
        );
        require(success && (data.length == 0 || abi.decode(data, (bool))), "ERR_APPROVE_FAILED");
    }

    /**
     * @dev executes the ERC20 token's `transfer` function and reverts upon failure
     * the main purpose of this function is to prevent a non standard ERC20 token
     * from failing silently
     *
     * @param _token   ERC20 token address
     * @param _to      target address
     * @param _value   transfer amount
     */
    function safeTransfer(
        IERC20Token _token,
        address _to,
        uint256 _value
    ) internal {
        (bool success, bytes memory data) = address(_token).call(
            abi.encodeWithSelector(TRANSFER_FUNC_SELECTOR, _to, _value)
        );
        require(success && (data.length == 0 || abi.decode(data, (bool))), "ERR_TRANSFER_FAILED");
    }

    /**
     * @dev executes the ERC20 token's `transferFrom` function and reverts upon failure
     * the main purpose of this function is to prevent a non standard ERC20 token
     * from failing silently
     *
     * @param _token   ERC20 token address
     * @param _from    source address
     * @param _to      target address
     * @param _value   transfer amount
     */
    function safeTransferFrom(
        IERC20Token _token,
        address _from,
        address _to,
        uint256 _value
    ) internal {
        (bool success, bytes memory data) = address(_token).call(
            abi.encodeWithSelector(TRANSFER_FROM_FUNC_SELECTOR, _from, _to, _value)
        );
        require(success && (data.length == 0 || abi.decode(data, (bool))), "ERR_TRANSFER_FROM_FAILED");
    }
}

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


pragma solidity 0.6.12;



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

// File: solidity/contracts/utility/TokenHolder.sol


pragma solidity 0.6.12;






/**
 * @dev This contract provides a safety mechanism for allowing the owner to
 * send tokens that were sent to the contract by mistake back to the sender.
 *
 * We consider every contract to be a 'token holder' since it's currently not possible
 * for a contract to deny receiving tokens.
 *
 * 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, TokenHandler, Owned, Utils {
    /**
     * @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 virtual override ownerOnly validAddress(address(_token)) validAddress(_to) notThis(_to) {
        safeTransfer(_token, _to, _amount);
    }
}

// File: solidity/contracts/utility/Math.sol


pragma solidity 0.6.12;

/**
 * @dev This library provides a set of complex math operations.
 */
library Math {
    /**
     * @dev returns the largest integer smaller than or equal to the square root of a positive integer
     *
     * @param _num a positive integer
     *
     * @return the largest integer smaller than or equal to the square root of the positive integer
     */
    function floorSqrt(uint256 _num) internal pure returns (uint256) {
        uint256 x = _num / 2 + 1;
        uint256 y = (x + _num / x) / 2;
        while (x > y) {
            x = y;
            y = (x + _num / x) / 2;
        }
        return x;
    }

    /**
     * @dev returns the smallest integer larger than or equal to the square root of a positive integer
     *
     * @param _num a positive integer
     *
     * @return the smallest integer larger than or equal to the square root of the positive integer
     */
    function ceilSqrt(uint256 _num) internal pure returns (uint256) {
        uint256 x = floorSqrt(_num);
        return x * x == _num ? x : x + 1;
    }

    /**
     * @dev computes a reduced-scalar ratio
     *
     * @param _n   ratio numerator
     * @param _d   ratio denominator
     * @param _max maximum desired scalar
     *
     * @return ratio's numerator and denominator
     */
    function reducedRatio(
        uint256 _n,
        uint256 _d,
        uint256 _max
    ) internal pure returns (uint256, uint256) {
        (uint256 n, uint256 d) = (_n, _d);
        if (n > _max || d > _max) {
            (n, d) = normalizedRatio(n, d, _max);
        }
        if (n != d) {
            return (n, d);
        }
        return (1, 1);
    }

    /**
     * @dev computes "scale * a / (a + b)" and "scale * b / (a + b)".
     */
    function normalizedRatio(
        uint256 _a,
        uint256 _b,
        uint256 _scale
    ) internal pure returns (uint256, uint256) {
        if (_a <= _b) {
            return accurateRatio(_a, _b, _scale);
        }
        (uint256 y, uint256 x) = accurateRatio(_b, _a, _scale);
        return (x, y);
    }

    /**
     * @dev computes "scale * a / (a + b)" and "scale * b / (a + b)", assuming that "a <= b".
     */
    function accurateRatio(
        uint256 _a,
        uint256 _b,
        uint256 _scale
    ) internal pure returns (uint256, uint256) {
        uint256 maxVal = uint256(-1) / _scale;
        if (_a > maxVal) {
            uint256 c = _a / (maxVal + 1) + 1;
            _a /= c; // we can now safely compute `_a * _scale`
            _b /= c;
        }
        if (_a != _b) {
            uint256 n = _a * _scale;
            uint256 d = _a + _b; // can overflow
            if (d >= _a) { // no overflow in `_a + _b`
                uint256 x = roundDiv(n, d); // we can now safely compute `_scale - x`
                uint256 y = _scale - x;
                return (x, y);
            }
            if (n < _b - (_b - _a) / 2) {
                return (0, _scale); // `_a * _scale < (_a + _b) / 2 < MAX_UINT256 < _a + _b`
            }
            return (1, _scale - 1); // `(_a + _b) / 2 < _a * _scale < MAX_UINT256 < _a + _b`
        }
        return (_scale / 2, _scale / 2); // allow reduction to `(1, 1)` in the calling function
    }

    /**
     * @dev computes the nearest integer to a given quotient without overflowing or underflowing.
     */
    function roundDiv(uint256 _n, uint256 _d) internal pure returns (uint256) {
        return _n / _d + (_n % _d) / (_d - _d / 2);
    }

    /**
     * @dev returns the average number of decimal digits in a given list of positive integers
     *
     * @param _values  list of positive integers
     *
     * @return the average number of decimal digits in the given list of positive integers
     */
    function geometricMean(uint256[] memory _values) internal pure returns (uint256) {
        uint256 numOfDigits = 0;
        uint256 length = _values.length;
        for (uint256 i = 0; i < length; i++) {
            numOfDigits += decimalLength(_values[i]);
        }
        return uint256(10)**(roundDivUnsafe(numOfDigits, length) - 1);
    }

    /**
     * @dev returns the number of decimal digits in a given positive integer
     *
     * @param _x   positive integer
     *
     * @return the number of decimal digits in the given positive integer
     */
    function decimalLength(uint256 _x) internal pure returns (uint256) {
        uint256 y = 0;
        for (uint256 x = _x; x > 0; x /= 10) {
            y++;
        }
        return y;
    }

    /**
     * @dev returns the nearest integer to a given quotient
     * the computation is overflow-safe assuming that the input is sufficiently small
     *
     * @param _n   quotient numerator
     * @param _d   quotient denominator
     *
     * @return the nearest integer to the given quotient
     */
    function roundDivUnsafe(uint256 _n, uint256 _d) internal pure returns (uint256) {
        return (_n + _d / 2) / _d;
    }

    /**
     * @dev returns the larger of two values
     *
     * @param _val1 the first value
     * @param _val2 the second value
     */
    function max(uint256 _val1, uint256 _val2) internal pure returns (uint256) {
        return _val1 > _val2 ? _val1 : _val2;
    }
}

// File: solidity/contracts/utility/Time.sol


pragma solidity 0.6.12;

/*
    Time implementing contract
*/
contract Time {
    /**
     * @dev returns the current time
     */
    function time() internal view virtual returns (uint256) {
        return block.timestamp;
    }
}

// File: solidity/contracts/converter/types/standard-pool/StandardPoolConverter.sol


pragma solidity 0.6.12;













/**
 * @dev This contract is a specialized version of the converter, which is
 * optimized for a liquidity pool that has 2 reserves with 50%/50% weights.
 */
contract StandardPoolConverter is
    ConverterVersion,
    IConverter,
    TokenHandler,
    TokenHolder,
    ContractRegistryClient,
    ReentrancyGuard,
    Time
{
    using SafeMath for uint256;
    using Math for *;

    IERC20Token private constant ETH_RESERVE_ADDRESS = IERC20Token(0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE);
    uint256 private constant MAX_UINT128 = 2**128 - 1;
    uint256 private constant MAX_UINT112 = 2**112 - 1;
    uint256 private constant MAX_UINT32 = 2**32 - 1;
    uint256 private constant AVERAGE_RATE_PERIOD = 10 minutes;
    uint32 private constant PPM_RESOLUTION = 1000000;

    uint256 private __reserveBalances;
    IERC20Token[] private __reserveTokens;
    mapping(IERC20Token => uint256) private __reserveIds;

    IConverterAnchor public override anchor; // converter anchor contract
    uint32 public override maxConversionFee; // maximum conversion fee, represented in ppm, 0...1000000
    uint32 public override conversionFee; // current conversion fee, represented in ppm, 0...maxConversionFee

    // average rate details:
    // bits 0...111 represent the numerator of the rate between reserve token 0 and reserve token 1
    // bits 111...223 represent the denominator of the rate between reserve token 0 and reserve token 1
    // bits 224...255 represent the update-time of the rate between reserve token 0 and reserve token 1
    // where `numerator / denominator` gives the worth of one reserve token 0 in units of reserve token 1
    uint256 public averageRateInfo;

    /**
     * @dev triggered after liquidity is added
     *
     * @param  _provider       liquidity provider
     * @param  _reserveToken   reserve token address
     * @param  _amount         reserve token amount
     * @param  _newBalance     reserve token new balance
     * @param  _newSupply      pool token new supply
     */
    event LiquidityAdded(
        address indexed _provider,
        IERC20Token indexed _reserveToken,
        uint256 _amount,
        uint256 _newBalance,
        uint256 _newSupply
    );

    /**
     * @dev triggered after liquidity is removed
     *
     * @param  _provider       liquidity provider
     * @param  _reserveToken   reserve token address
     * @param  _amount         reserve token amount
     * @param  _newBalance     reserve token new balance
     * @param  _newSupply      pool token new supply
     */
    event LiquidityRemoved(
        address indexed _provider,
        IERC20Token indexed _reserveToken,
        uint256 _amount,
        uint256 _newBalance,
        uint256 _newSupply
    );

    /**
     * @dev initializes a new StandardPoolConverter instance
     *
     * @param  _anchor             anchor governed by the converter
     * @param  _registry           address of a contract registry contract
     * @param  _maxConversionFee   maximum conversion fee, represented in ppm
     */
    constructor(
        IConverterAnchor _anchor,
        IContractRegistry _registry,
        uint32 _maxConversionFee
    ) public ContractRegistryClient(_registry) validAddress(address(_anchor)) validConversionFee(_maxConversionFee) {
        anchor = _anchor;
        maxConversionFee = _maxConversionFee;
    }

    // ensures that the converter is active
    modifier active() {
        _active();
        _;
    }

    // error message binary size optimization
    function _active() internal view {
        require(isActive(), "ERR_INACTIVE");
    }

    // ensures that the converter is not active
    modifier inactive() {
        _inactive();
        _;
    }

    // error message binary size optimization
    function _inactive() internal view {
        require(!isActive(), "ERR_ACTIVE");
    }

    // validates a reserve token address - verifies that the address belongs to one of the reserve tokens
    modifier validReserve(IERC20Token _address) {
        _validReserve(_address);
        _;
    }

    // error message binary size optimization
    function _validReserve(IERC20Token _address) internal view {
        require(__reserveIds[_address] != 0, "ERR_INVALID_RESERVE");
    }

    // validates conversion fee
    modifier validConversionFee(uint32 _conversionFee) {
        _validConversionFee(_conversionFee);
        _;
    }

    // error message binary size optimization
    function _validConversionFee(uint32 _conversionFee) internal pure {
        require(_conversionFee <= PPM_RESOLUTION, "ERR_INVALID_CONVERSION_FEE");
    }

    // validates reserve weight
    modifier validReserveWeight(uint32 _weight) {
        _validReserveWeight(_weight);
        _;
    }

    // error message binary size optimization
    function _validReserveWeight(uint32 _weight) internal pure {
        require(_weight == PPM_RESOLUTION / 2, "ERR_INVALID_RESERVE_WEIGHT");
    }

    /**
     * @dev returns the converter type
     *
     * @return see the converter types in the the main contract doc
     */
    function converterType() public pure override returns (uint16) {
        return 3;
    }

    /**
     * @dev deposits ether
     * can only be called if the converter has an ETH reserve
     */
    receive() external payable override validReserve(ETH_RESERVE_ADDRESS) {}

    /**
     * @dev withdraws ether
     * can only be called by the owner if the converter is inactive or by upgrader contract
     * can only be called after the upgrader contract has accepted the ownership of this contract
     * can only be called if the converter has an ETH reserve
     *
     * @param _to  address to send the ETH to
     */
    function withdrawETH(address payable _to) public override protected ownerOnly validReserve(ETH_RESERVE_ADDRESS) {
        address converterUpgrader = addressOf(CONVERTER_UPGRADER);

        // verify that the converter is inactive or that the owner is the upgrader contract
        require(!isActive() || owner == converterUpgrader, "ERR_ACCESS_DENIED");
        _to.transfer(address(this).balance);

        // sync the ETH reserve balance
        syncReserveBalance(ETH_RESERVE_ADDRESS);
    }

    /**
     * @dev checks whether or not the converter version is 28 or higher
     *
     * @return true, since the converter version is 28 or higher
     */
    function isV28OrHigher() public pure returns (bool) {
        return true;
    }

    /**
     * @dev returns true if the converter is active, false otherwise
     *
     * @return true if the converter is active, false otherwise
     */
    function isActive() public view virtual override returns (bool) {
        return anchor.owner() == address(this);
    }

    /**
     * @dev transfers the anchor ownership
     * the new owner needs to accept the transfer
     * can only be called by the converter upgrder while the upgrader is the owner
     * note that prior to version 28, you should use 'transferAnchorOwnership' instead
     *
     * @param _newOwner    new token owner
     */
    function transferAnchorOwnership(address _newOwner) public override ownerOnly only(CONVERTER_UPGRADER) {
        anchor.transferOwnership(_newOwner);
    }

    /**
     * @dev accepts ownership of the anchor after an ownership transfer
     * most converters are also activated as soon as they accept the anchor ownership
     * can only be called by the contract owner
     * note that prior to version 28, you should use 'acceptTokenOwnership' instead
     */
    function acceptAnchorOwnership() public virtual override ownerOnly {
        // verify the the converter has exactly two reserves
        require(reserveTokenCount() == 2, "ERR_INVALID_RESERVE_COUNT");
        anchor.acceptOwnership();
        syncReserveBalances();
        emit Activation(converterType(), anchor, true);
    }

    /**
     * @dev updates the current conversion fee
     * can only be called by the contract owner
     *
     * @param _conversionFee new conversion fee, represented in ppm
     */
    function setConversionFee(uint32 _conversionFee) public override ownerOnly {
        require(_conversionFee <= maxConversionFee, "ERR_INVALID_CONVERSION_FEE");
        emit ConversionFeeUpdate(conversionFee, _conversionFee);
        conversionFee = _conversionFee;
    }

    /**
     * @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 override(IConverter, TokenHolder) protected ownerOnly {
        address converterUpgrader = addressOf(CONVERTER_UPGRADER);
        uint256 reserveId = __reserveIds[_token];

        // 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(reserveId == 0 || !isActive() || owner == converterUpgrader, "ERR_ACCESS_DENIED");
        super.withdrawTokens(_token, _to, _amount);

        // if the token is a reserve token, sync the reserve balance
        if (reserveId != 0) {
            syncReserveBalance(_token);
        }
    }

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

        // trigger de-activation event
        emit Activation(converterType(), anchor, false);

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

    /**
     * @dev returns the number of reserve tokens
     * 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 returns the array of reserve tokens
     *
     * @return array of reserve tokens
     */
    function reserveTokens() public view returns (IERC20Token[] memory) {
        return __reserveTokens;
    }

    /**
     * @dev defines a new reserve token for the converter
     * can only be called by the owner while the converter is inactive
     *
     * @param _token   address of the reserve token
     * @param _weight  reserve weight, represented in ppm, 1-1000000
     */
    function addReserve(IERC20Token _token, uint32 _weight)
        public
        virtual
        override
        ownerOnly
        inactive
        validAddress(address(_token))
        notThis(address(_token))
        validReserveWeight(_weight)
    {
        // validate input
        require(address(_token) != address(anchor) && __reserveIds[_token] == 0, "ERR_INVALID_RESERVE");
        require(reserveTokenCount() < 2, "ERR_INVALID_RESERVE_COUNT");

        __reserveTokens.push(_token);
        __reserveIds[_token] = __reserveTokens.length;
    }

    /**
     * @dev returns the reserve's weight
     * added in version 28
     *
     * @param _reserveToken    reserve token contract address
     *
     * @return reserve weight
     */
    function reserveWeight(IERC20Token _reserveToken) public view validReserve(_reserveToken) returns (uint32) {
        return PPM_RESOLUTION / 2;
    }

    /**
     * @dev returns the balance of a given reserve token
     *
     * @param _reserveToken    reserve token contract address
     *
     * @return the balance of the given reserve token
     */
    function reserveBalance(IERC20Token _reserveToken) public view override returns (uint256) {
        uint256 reserveId = __reserveIds[_reserveToken];
        require(reserveId != 0, "ERR_INVALID_RESERVE");
        return reserveBalance(reserveId);
    }

    /**
     * @dev returns the balances of both reserve tokens
     *
     * @return the balances of both reserve tokens
     */
    function reserveBalances() public view returns (uint256, uint256) {
        return reserveBalances(1, 2);
    }

    /**
     * @dev converts a specific amount of source tokens to target tokens
     * can only be called by the bancor network contract
     *
     * @param _sourceToken source ERC20 token
     * @param _targetToken target ERC20 token
     * @param _amount      amount of tokens to convert (in units of the source token)
     * @param _trader      address of the caller who executed the conversion
     * @param _beneficiary wallet to receive the conversion result
     *
     * @return amount of tokens received (in units of the target token)
     */
    function convert(
        IERC20Token _sourceToken,
        IERC20Token _targetToken,
        uint256 _amount,
        address _trader,
        address payable _beneficiary
    ) public payable override protected only(BANCOR_NETWORK) returns (uint256) {
        // validate input
        require(_sourceToken != _targetToken, "ERR_SAME_SOURCE_TARGET");

        return doConvert(_sourceToken, _targetToken, _amount, _trader, _beneficiary);
    }

    /**
     * @dev returns the conversion fee for a given target amount
     *
     * @param _targetAmount  target amount
     *
     * @return conversion fee
     */
    function calculateFee(uint256 _targetAmount) internal view returns (uint256) {
        return _targetAmount.mul(conversionFee) / PPM_RESOLUTION;
    }

    /**
     * @dev loads the stored reserve balance for a given reserve id
     *
     * @param _reserveId   reserve id
     */
    function reserveBalance(uint256 _reserveId) internal view returns (uint256) {
        return decodeReserveBalance(__reserveBalances, _reserveId);
    }

    /**
     * @dev loads the stored reserve balances
     *
     * @param _sourceId    source reserve id
     * @param _targetId    target reserve id
     */
    function reserveBalances(uint256 _sourceId, uint256 _targetId) internal view returns (uint256, uint256) {
        require((_sourceId == 1 && _targetId == 2) || (_sourceId == 2 && _targetId == 1), "ERR_INVALID_RESERVES");
        return decodeReserveBalances(__reserveBalances, _sourceId, _targetId);
    }

    /**
     * @dev stores the stored reserve balance for a given reserve id
     *
     * @param _reserveId       reserve id
     * @param _reserveBalance  reserve balance
     */
    function setReserveBalance(uint256 _reserveId, uint256 _reserveBalance) internal {
        require(_reserveBalance <= MAX_UINT128, "ERR_RESERVE_BALANCE_OVERFLOW");
        uint256 otherBalance = decodeReserveBalance(__reserveBalances, 3 - _reserveId);
        __reserveBalances = encodeReserveBalances(_reserveBalance, _reserveId, otherBalance, 3 - _reserveId);
    }

    /**
     * @dev stores the stored reserve balances
     *
     * @param _sourceId        source reserve id
     * @param _targetId        target reserve id
     * @param _sourceBalance   source reserve balance
     * @param _targetBalance   target reserve balance
     */
    function setReserveBalances(
        uint256 _sourceId,
        uint256 _targetId,
        uint256 _sourceBalance,
        uint256 _targetBalance
    ) internal {
        require(_sourceBalance <= MAX_UINT128 && _targetBalance <= MAX_UINT128, "ERR_RESERVE_BALANCE_OVERFLOW");
        __reserveBalances = encodeReserveBalances(_sourceBalance, _sourceId, _targetBalance, _targetId);
    }

    /**
     * @dev syncs the stored reserve balance for a given reserve with the real reserve balance
     *
     * @param _reserveToken    address of the reserve token
     */
    function syncReserveBalance(IERC20Token _reserveToken) internal {
        uint256 reserveId = __reserveIds[_reserveToken];
        uint256 balance = _reserveToken == ETH_RESERVE_ADDRESS
            ? address(this).balance
            : _reserveToken.balanceOf(address(this));
        setReserveBalance(reserveId, balance);
    }

    /**
     * @dev syncs all stored reserve balances
     */
    function syncReserveBalances() internal {
        IERC20Token _reserveToken0 = __reserveTokens[0];
        IERC20Token _reserveToken1 = __reserveTokens[1];
        uint256 balance0 = _reserveToken0 == ETH_RESERVE_ADDRESS
            ? address(this).balance
            : _reserveToken0.balanceOf(address(this));
        uint256 balance1 = _reserveToken1 == ETH_RESERVE_ADDRESS
            ? address(this).balance
            : _reserveToken1.balanceOf(address(this));
        setReserveBalances(1, 2, balance0, balance1);
    }

    /**
     * @dev syncs all stored reserve balances, excluding a given amount of ether from the ether reserve balance (if relevant)
     *
     * @param _value   amount of ether to exclude from the ether reserve balance (if relevant)
     */
    function syncReserveBalances(uint256 _value) internal {
        IERC20Token _reserveToken0 = __reserveTokens[0];
        IERC20Token _reserveToken1 = __reserveTokens[1];
        uint256 balance0 = _reserveToken0 == ETH_RESERVE_ADDRESS
            ? address(this).balance - _value
            : _reserveToken0.balanceOf(address(this));
        uint256 balance1 = _reserveToken1 == ETH_RESERVE_ADDRESS
            ? address(this).balance - _value
            : _reserveToken1.balanceOf(address(this));
        setReserveBalances(1, 2, balance0, balance1);
    }

    /**
     * @dev helper, dispatches the Conversion event
     *
     * @param _sourceToken     source ERC20 token
     * @param _targetToken     target ERC20 token
     * @param _trader          address of the caller who executed the conversion
     * @param _amount          amount purchased/sold (in the source token)
     * @param _returnAmount    amount returned (in the target token)
     */
    function dispatchConversionEvent(
        IERC20Token _sourceToken,
        IERC20Token _targetToken,
        address _trader,
        uint256 _amount,
        uint256 _returnAmount,
        uint256 _feeAmount
    ) internal {
        emit Conversion(_sourceToken, _targetToken, _trader, _amount, _returnAmount, int256(_feeAmount));
    }

    /**
     * @dev returns the expected target amount of converting one reserve to another along with the fee
     *
     * @param _sourceToken contract address of the source reserve token
     * @param _targetToken contract address of the target reserve token
     * @param _amount      amount of tokens received from the user
     *
     * @return expected target amount
     * @return expected fee
     */
    function targetAmountAndFee(
        IERC20Token _sourceToken,
        IERC20Token _targetToken,
        uint256 _amount
    ) public view override active returns (uint256, uint256) {
        uint256 sourceId = __reserveIds[_sourceToken];
        uint256 targetId = __reserveIds[_targetToken];

        (uint256 sourceBalance, uint256 targetBalance) = reserveBalances(sourceId, targetId);
        uint256 amount = crossReserveTargetAmount(sourceBalance, targetBalance, _amount);

        // return the amount minus the conversion fee and the conversion fee
        uint256 fee = calculateFee(amount);
        return (amount - fee, fee);
    }

    /**
     * @dev converts a specific amount of source tokens to target tokens
     *
     * @param _sourceToken source ERC20 token
     * @param _targetToken target ERC20 token
     * @param _amount      amount of tokens to convert (in units of the source token)
     * @param _trader      address of the caller who executed the conversion
     * @param _beneficiary wallet to receive the conversion result
     *
     * @return amount of tokens received (in units of the target token)
     */
    function doConvert(
        IERC20Token _sourceToken,
        IERC20Token _targetToken,
        uint256 _amount,
        address _trader,
        address payable _beneficiary
    ) internal returns (uint256) {
        // update the recent average rate
        updateRecentAverageRate();

        uint256 sourceId = __reserveIds[_sourceToken];
        uint256 targetId = __reserveIds[_targetToken];

        (uint256 sourceBalance, uint256 targetBalance) = reserveBalances(sourceId, targetId);
        uint256 targetAmount = crossReserveTargetAmount(sourceBalance, targetBalance, _amount);

        // get the target amount minus the conversion fee and the conversion fee
        uint256 fee = calculateFee(targetAmount);
        uint256 amount = targetAmount - fee;

        // ensure that the trade gives something in return
        require(amount != 0, "ERR_ZERO_TARGET_AMOUNT");

        // ensure that the trade won't deplete the reserve balance
        assert(amount < targetBalance);

        // ensure that the input amount was already deposited
        uint256 actualSourceBalance;
        if (_sourceToken == ETH_RESERVE_ADDRESS) {
            actualSourceBalance = address(this).balance;
            require(msg.value == _amount, "ERR_ETH_AMOUNT_MISMATCH");
        } else {
            actualSourceBalance = _sourceToken.balanceOf(address(this));
            require(msg.value == 0 && actualSourceBalance.sub(sourceBalance) >= _amount, "ERR_INVALID_AMOUNT");
        }

        // sync the reserve balances
        setReserveBalances(sourceId, targetId, actualSourceBalance, targetBalance - amount);

        // transfer funds to the beneficiary in the to reserve token
        if (_targetToken == ETH_RESERVE_ADDRESS) {
            _beneficiary.transfer(amount);
        } else {
            safeTransfer(_targetToken, _beneficiary, amount);
        }

        // dispatch the conversion event
        dispatchConversionEvent(_sourceToken, _targetToken, _trader, _amount, amount, fee);

        // dispatch rate updates
        dispatchTokenRateUpdateEvents(_sourceToken, _targetToken, actualSourceBalance, targetBalance - amount);

        return amount;
    }

    /**
     * @dev returns the recent average rate of 1 `_token` in the other reserve token units
     *
     * @param _token   token to get the rate for
     * @return recent average rate between the reserves (numerator)
     * @return recent average rate between the reserves (denominator)
     */
    function recentAverageRate(IERC20Token _token)
        external
        view
        validReserve(_token)
        returns (uint256, uint256)
    {
        // get the recent average rate of reserve 0
        uint256 rate = calcRecentAverageRate(averageRateInfo);

        uint256 rateN = decodeAverageRateN(rate);
        uint256 rateD = decodeAverageRateD(rate);

        if (_token == __reserveTokens[0]) {
            return (rateN, rateD);
        }

        return (rateD, rateN);
    }

    /**
     * @dev updates the recent average rate if needed
     */
    function updateRecentAverageRate() internal {
        uint256 averageRateInfo1 = averageRateInfo;
        uint256 averageRateInfo2 = calcRecentAverageRate(averageRateInfo1);
        if (averageRateInfo1 != averageRateInfo2) {
            averageRateInfo = averageRateInfo2;
        }
    }

    /**
     * @dev returns the recent average rate of 1 reserve token 0 in reserve token 1 units
     *
     * @param _averageRateInfo a local copy of the `averageRateInfo` state-variable
     * @return recent average rate between the reserves
     */
    function calcRecentAverageRate(uint256 _averageRateInfo) internal view returns (uint256) {
        // get the previous average rate and its update-time
        uint256 prevAverageRateT = decodeAverageRateT(_averageRateInfo);
        uint256 prevAverageRateN = decodeAverageRateN(_averageRateInfo);
        uint256 prevAverageRateD = decodeAverageRateD(_averageRateInfo);

        // get the elapsed time since the previous average rate was calculated
        uint256 currentTime = time();
        uint256 timeElapsed = currentTime - prevAverageRateT;

        // if the previous average rate was calculated in the current block, the average rate remains unchanged
        if (timeElapsed == 0) {
            return _averageRateInfo;
        }

        // get the current rate between the reserves
        (uint256 currentRateD, uint256 currentRateN) = reserveBalances();

        // if the previous average rate was calculated a while ago or never, the average rate is equal to the current rate
        if (timeElapsed >= AVERAGE_RATE_PERIOD || prevAverageRateT == 0) {
            (currentRateN, currentRateD) = Math.reducedRatio(currentRateN, currentRateD, MAX_UINT112);
            return encodeAverageRateInfo(currentTime, currentRateN, currentRateD);
        }

        uint256 x = prevAverageRateD.mul(currentRateN);
        uint256 y = prevAverageRateN.mul(currentRateD);

        // since we know that timeElapsed < AVERAGE_RATE_PERIOD, we can avoid using SafeMath:
        uint256 newRateN = y.mul(AVERAGE_RATE_PERIOD - timeElapsed).add(x.mul(timeElapsed));
        uint256 newRateD = prevAverageRateD.mul(currentRateD).mul(AVERAGE_RATE_PERIOD);

        (newRateN, newRateD) = Math.reducedRatio(newRateN, newRateD, MAX_UINT112);
        return encodeAverageRateInfo(currentTime, newRateN, newRateD);
    }

    /**
     * @dev increases the pool's liquidity and mints new shares in the pool to the caller
     * this version receives the two reserve amounts as separate args
     *
     * @param _reserve1Amount  amount of the first reserve token
     * @param _reserve2Amount  amount of the second reserve token
     * @param _minReturn       token minimum return-amount
     *
     * @return amount of pool tokens issued
     */
    function addLiquidity(uint256 _reserve1Amount, uint256 _reserve2Amount, uint256 _minReturn) public payable returns (uint256) {
        uint256[] memory reserveAmounts = new uint256[](2);
        reserveAmounts[0] = _reserve1Amount;
        reserveAmounts[1] = _reserve2Amount;
        return addLiquidity(__reserveTokens, reserveAmounts, _minReturn);
    }

    /**
     * @dev increases the pool's liquidity and mints new shares in the pool to the caller
     *
     * @param _reserveTokens   address of each reserve token
     * @param _reserveAmounts  amount of each reserve token
     * @param _minReturn       token minimum return-amount
     *
     * @return amount of pool tokens issued
     */
    function addLiquidity(
        IERC20Token[] memory _reserveTokens,
        uint256[] memory _reserveAmounts,
        uint256 _minReturn
    ) public payable protected active returns (uint256) {
        // verify the user input
        verifyLiquidityInput(_reserveTokens, _reserveAmounts, _minReturn);

        // if one of the reserves is ETH, then verify that the input amount of ETH is equal to the input value of ETH
        for (uint256 i = 0; i < 2; i++) {
            if (_reserveTokens[i] == ETH_RESERVE_ADDRESS) {
                require(_reserveAmounts[i] == msg.value, "ERR_ETH_AMOUNT_MISMATCH");
            }
        }

        // if the input value of ETH is larger than zero, then verify that one of the reserves is ETH
        if (msg.value > 0) {
            require(__reserveIds[ETH_RESERVE_ADDRESS] != 0, "ERR_NO_ETH_RESERVE");
        }

        // save a local copy of the pool token
        IDSToken poolToken = IDSToken(address(anchor));

        // get the total supply
        uint256 totalSupply = poolToken.totalSupply();

        // sync the balances to ensure no mismatch
        syncReserveBalances(msg.value);

        uint256[2] memory oldReserveBalances;
        uint256[2] memory newReserveBalances;
        (oldReserveBalances[0], oldReserveBalances[1]) = reserveBalances();

        // calculate the amount of pool tokens to mint
        uint256 amount;
        uint256[] memory reserveAmounts = new uint256[](2);

        if (totalSupply == 0) {
            for (uint256 i = 0; i < 2; i++) {
                reserveAmounts[i] = _reserveAmounts[i];
            }
            amount = Math.geometricMean(reserveAmounts);
        }
        else {
            uint256 index = (_reserveAmounts[0].mul(oldReserveBalances[1]) < _reserveAmounts[1].mul(oldReserveBalances[0])) ? 0 : 1;
            amount = fundSupplyAmount(totalSupply, oldReserveBalances[index], _reserveAmounts[index]);
            for (uint256 i = 0; i < 2; i++) {
                reserveAmounts[i] = fundCost(totalSupply, oldReserveBalances[i], amount);
            }
        }

        uint256 newPoolTokenSupply = totalSupply.add(amount);
        for (uint256 i = 0; i < 2; i++) {
            IERC20Token reserveToken = _reserveTokens[i];
            uint256 reserveAmount = reserveAmounts[i];
            require(reserveAmount > 0, "ERR_ZERO_TARGET_AMOUNT");
            assert(reserveAmount <= _reserveAmounts[i]);

            // transfer each one of the reserve amounts from the user to the pool
            if (reserveToken != ETH_RESERVE_ADDRESS) {
                // ETH has already been transferred as part of the transaction
                safeTransferFrom(reserveToken, msg.sender, address(this), reserveAmount);
            } else if (_reserveAmounts[i] > reserveAmount) {
                // transfer the extra amount of ETH back to the user
                msg.sender.transfer(_reserveAmounts[i] - reserveAmount);
            }

            // save the new reserve balance
            newReserveBalances[i] = oldReserveBalances[i].add(reserveAmount);

            emit LiquidityAdded(msg.sender, reserveToken, reserveAmount, newReserveBalances[i], newPoolTokenSupply);

            // dispatch the `TokenRateUpdate` event for the pool token
            emit TokenRateUpdate(poolToken, reserveToken, newReserveBalances[i], newPoolTokenSupply);
        }

        // set the reserve balances
        setReserveBalances(1, 2, newReserveBalances[0], newReserveBalances[1]);

        // verify that the equivalent amount of tokens is equal to or larger than the user's expectation
        require(amount >= _minReturn, "ERR_RETURN_TOO_LOW");

        // issue the tokens to the user
        poolToken.issue(msg.sender, amount);

        // return the amount of pool tokens issued
        return amount;
    }

    /**
     * @dev decreases the pool's liquidity and burns the caller's shares in the pool
     * this version receives the two minimum return amounts as separate args
     *
     * @param _amount               token amount
     * @param _reserve1MinReturn    minimum return for the first reserve token
     * @param _reserve2MinReturn    minimum return for the second reserve token
     *
     * @return the first reserve amount returned
     * @return the second reserve amount returned
     */
    function removeLiquidity(uint256 _amount, uint256 _reserve1MinReturn, uint256 _reserve2MinReturn) public returns (uint256, uint256) {
        uint256[] memory minReturnAmounts = new uint256[](2);
        minReturnAmounts[0] = _reserve1MinReturn;
        minReturnAmounts[1] = _reserve2MinReturn;
        uint256[] memory reserveAmounts = removeLiquidity(_amount, __reserveTokens, minReturnAmounts);
        return (reserveAmounts[0], reserveAmounts[1]);
    }

    /**
     * @dev decreases the pool's liquidity and burns the caller's shares in the pool
     *
     * @param _amount                  token amount
     * @param _reserveTokens           address of each reserve token
     * @param _reserveMinReturnAmounts minimum return-amount of each reserve token
     *
     * @return the amount of each reserve token granted for the given amount of pool tokens
     */
    function removeLiquidity(
        uint256 _amount,
        IERC20Token[] memory _reserveTokens,
        uint256[] memory _reserveMinReturnAmounts
    ) public protected active returns (uint256[] memory) {
        // verify the user input
        bool inputRearranged = verifyLiquidityInput(_reserveTokens, _reserveMinReturnAmounts, _amount);

        // save a local copy of the pool token
        IDSToken poolToken = IDSToken(address(anchor));

        // get the total supply BEFORE destroying the user tokens
        uint256 totalSupply = poolToken.totalSupply();

        // destroy the user tokens
        poolToken.destroy(msg.sender, _amount);

        // sync the balances to ensure no mismatch
        syncReserveBalances();

        uint256 newPoolTokenSupply = totalSupply.sub(_amount);
        uint256[] memory reserveAmounts = removeLiquidityReserveAmounts(_amount, _reserveTokens, totalSupply);

        uint256[2] memory oldReserveBalances;
        uint256[2] memory newReserveBalances;
        (oldReserveBalances[0], oldReserveBalances[1]) = reserveBalances();

        for (uint256 i = 0; i < 2; i++) {
            IERC20Token reserveToken = _reserveTokens[i];
            uint256 reserveAmount = reserveAmounts[i];
            require(reserveAmount >= _reserveMinReturnAmounts[i], "ERR_ZERO_TARGET_AMOUNT");

            // save the new reserve balance
            newReserveBalances[i] = oldReserveBalances[i].sub(reserveAmount);

            // transfer each one of the reserve amounts from the pool to the user
            if (reserveToken == ETH_RESERVE_ADDRESS) {
                msg.sender.transfer(reserveAmount);
            } else {
                safeTransfer(reserveToken, msg.sender, reserveAmount);
            }

            emit LiquidityRemoved(msg.sender, reserveToken, reserveAmount, newReserveBalances[i], newPoolTokenSupply);

            // dispatch the `TokenRateUpdate` event for the pool token
            emit TokenRateUpdate(poolToken, reserveToken, newReserveBalances[i], newPoolTokenSupply);
        }

        // set the reserve balances
        setReserveBalances(1, 2, newReserveBalances[0], newReserveBalances[1]);

        if (inputRearranged) {
            uint256 tempReserveAmount = reserveAmounts[0];
            reserveAmounts[0] = reserveAmounts[1];
            reserveAmounts[1] = tempReserveAmount;
        }

        // return the amount of each reserve token granted for the given amount of pool tokens
        return reserveAmounts;
    }

    /**
     * @dev given the amount of one of the reserve tokens to add liquidity of,
     * returns the required amount of each one of the other reserve tokens
     * since an empty pool can be funded with any list of non-zero input amounts,
     * this function assumes that the pool is not empty (has already been funded)
     *
     * @param _reserveTokens       address of each reserve token
     * @param _reserveTokenIndex   index of the relevant reserve token
     * @param _reserveAmount       amount of the relevant reserve token
     *
     * @return the required amount of each one of the reserve tokens
     */
    function addLiquidityCost(
        IERC20Token[] memory _reserveTokens,
        uint256 _reserveTokenIndex,
        uint256 _reserveAmount
    ) public view returns (uint256[] memory) {
        uint256[] memory _reserveAmounts = new uint256[](2);
        uint256[] memory _reserveBalances = new uint256[](2);

        uint256 reserve0Id = __reserveIds[_reserveTokens[0]];
        uint256 reserve1Id = __reserveIds[_reserveTokens[1]];
        (_reserveBalances[0], _reserveBalances[1]) = reserveBalances(reserve0Id, reserve1Id);

        uint256 totalSupply = IDSToken(address(anchor)).totalSupply();
        uint256 amount = fundSupplyAmount(totalSupply, _reserveBalances[_reserveTokenIndex], _reserveAmount);

        for (uint256 i = 0; i < 2; i++) _reserveAmounts[i] = fundCost(totalSupply, _reserveBalances[i], amount);

        return _reserveAmounts;
    }

    /**
     * @dev given the amount of one of the reserve tokens to add liquidity of,
     * returns the amount of pool tokens entitled for it
     * since an empty pool can be funded with any list of non-zero input amounts,
     * this function assumes that the pool is not empty (has already been funded)
     *
     * @param _reserveToken    address of the reserve token
     * @param _reserveAmount   amount of the reserve token
     *
     * @return the amount of pool tokens entitled
     */
    function addLiquidityReturn(IERC20Token _reserveToken, uint256 _reserveAmount) public view returns (uint256) {
        uint256 totalSupply = IDSToken(address(anchor)).totalSupply();
        return fundSupplyAmount(totalSupply, reserveBalance(__reserveIds[_reserveToken]), _reserveAmount);
    }

    /**
     * @dev returns the amount of each reserve token entitled for a given amount of pool tokens
     *
     * @param _amount          amount of pool tokens
     * @param _reserveTokens   address of each reserve token
     *
     * @return the amount of each reserve token entitled for the given amount of pool tokens
     */
    function removeLiquidityReturn(uint256 _amount, IERC20Token[] memory _reserveTokens)
        public
        view
        returns (uint256[] memory)
    {
        uint256 totalSupply = IDSToken(address(anchor)).totalSupply();
        return removeLiquidityReserveAmounts(_amount, _reserveTokens, totalSupply);
    }

    /**
     * @dev verifies that a given array of tokens is identical to the converter's array of reserve tokens
     * we take this input in order to allow specifying the corresponding reserve amounts in any order
     * this function rearranges the input arrays according to the converter's array of reserve tokens
     *
     * @param _reserveTokens   array of reserve tokens
     * @param _reserveAmounts  array of reserve amounts
     * @param _amount          token amount
     *
     * @return true if the function has rearranged the input arrays; false otherwise
     */
    function verifyLiquidityInput(
        IERC20Token[] memory _reserveTokens,
        uint256[] memory _reserveAmounts,
        uint256 _amount
    ) private view returns (bool) {
        require(_reserveAmounts[0] > 0 && _reserveAmounts[1] > 0 && _amount > 0, "ERR_ZERO_AMOUNT");

        uint256 reserve0Id = __reserveIds[_reserveTokens[0]];
        uint256 reserve1Id = __reserveIds[_reserveTokens[1]];

        if (reserve0Id == 2 && reserve1Id == 1) {
            IERC20Token tempReserveToken = _reserveTokens[0];
            _reserveTokens[0] = _reserveTokens[1];
            _reserveTokens[1] = tempReserveToken;
            uint256 tempReserveAmount = _reserveAmounts[0];
            _reserveAmounts[0] = _reserveAmounts[1];
            _reserveAmounts[1] = tempReserveAmount;
            return true;
        }

        require(reserve0Id == 1 && reserve1Id == 2, "ERR_INVALID_RESERVE");
        return false;
    }

    /**
     * @dev returns the amount of each reserve token entitled for a given amount of pool tokens
     *
     * @param _amount          amount of pool tokens
     * @param _reserveTokens   address of each reserve token
     * @param _totalSupply     token total supply
     *
     * @return the amount of each reserve token entitled for the given amount of pool tokens
     */
    function removeLiquidityReserveAmounts(
        uint256 _amount,
        IERC20Token[] memory _reserveTokens,
        uint256 _totalSupply
    ) private view returns (uint256[] memory) {
        uint256[] memory _reserveAmounts = new uint256[](2);
        uint256[] memory _reserveBalances = new uint256[](2);

        uint256 reserve0Id = __reserveIds[_reserveTokens[0]];
        uint256 reserve1Id = __reserveIds[_reserveTokens[1]];
        (_reserveBalances[0], _reserveBalances[1]) = reserveBalances(reserve0Id, reserve1Id);

        for (uint256 i = 0; i < 2; i++)
            _reserveAmounts[i] = liquidateReserveAmount(_totalSupply, _reserveBalances[i], _amount);
        return _reserveAmounts;
    }

    /**
     * @dev dispatches token rate update events for the reserve tokens and the pool token
     *
     * @param _sourceToken     address of the source reserve token
     * @param _targetToken     address of the target reserve token
     * @param _sourceBalance   balance of the source reserve token
     * @param _targetBalance   balance of the target reserve token
     */
    function dispatchTokenRateUpdateEvents(
        IERC20Token _sourceToken,
        IERC20Token _targetToken,
        uint256 _sourceBalance,
        uint256 _targetBalance
    ) private {
        // save a local copy of the pool token
        IDSToken poolToken = IDSToken(address(anchor));

        // get the total supply of pool tokens
        uint256 poolTokenSupply = poolToken.totalSupply();

        // dispatch token rate update event for the reserve tokens
        emit TokenRateUpdate(_sourceToken, _targetToken, _targetBalance, _sourceBalance);

        // dispatch token rate update events for the pool token
        emit TokenRateUpdate(poolToken, _sourceToken, _sourceBalance, poolTokenSupply);
        emit TokenRateUpdate(poolToken, _targetToken, _targetBalance, poolTokenSupply);
    }

    function encodeReserveBalance(uint256 _balance, uint256 _id) private pure returns (uint256) {
        assert(_balance <= MAX_UINT128 && (_id == 1 || _id == 2));
        return _balance << ((_id - 1) * 128);
    }

    function decodeReserveBalance(uint256 _balances, uint256 _id) private pure returns (uint256) {
        assert(_id == 1 || _id == 2);
        return (_balances >> ((_id - 1) * 128)) & MAX_UINT128;
    }

    function encodeReserveBalances(
        uint256 _balance0,
        uint256 _id0,
        uint256 _balance1,
        uint256 _id1
    ) private pure returns (uint256) {
        return encodeReserveBalance(_balance0, _id0) | encodeReserveBalance(_balance1, _id1);
    }

    function decodeReserveBalances(
        uint256 _balances,
        uint256 _id0,
        uint256 _id1
    ) private pure returns (uint256, uint256) {
        return (decodeReserveBalance(_balances, _id0), decodeReserveBalance(_balances, _id1));
    }

    function encodeAverageRateInfo(
        uint256 _averageRateT,
        uint256 _averageRateN,
        uint256 _averageRateD
    ) private pure returns (uint256) {
        assert(_averageRateT <= MAX_UINT32 && _averageRateN <= MAX_UINT112 && _averageRateD <= MAX_UINT112);
        return (_averageRateT << 224) | (_averageRateN << 112) | _averageRateD;
    }

    function decodeAverageRateT(uint256 _averageRateInfo) private pure returns (uint256) {
        return _averageRateInfo >> 224;
    }

    function decodeAverageRateN(uint256 _averageRateInfo) private pure returns (uint256) {
        return (_averageRateInfo >> 112) & MAX_UINT112;
    }

    function decodeAverageRateD(uint256 _averageRateInfo) private pure returns (uint256) {
        return _averageRateInfo & MAX_UINT112;
    }

    function crossReserveTargetAmount(
        uint256 _sourceReserveBalance,
        uint256 _targetReserveBalance,
        uint256 _amount
    ) private pure returns (uint256) {
        // validate input
        require(_sourceReserveBalance > 0 && _targetReserveBalance > 0, "ERR_INVALID_RESERVE_BALANCE");

        return _targetReserveBalance.mul(_amount) / _sourceReserveBalance.add(_amount);
    }

    function fundCost(
        uint256 _supply,
        uint256 _reserveBalance,
        uint256 _amount
    ) private pure returns (uint256) {
        // validate input
        require(_supply > 0, "ERR_INVALID_SUPPLY");
        require(_reserveBalance > 0, "ERR_INVALID_RESERVE_BALANCE");

        // special case for 0 amount
        if (_amount == 0) {
            return 0;
        }

        return (_amount.mul(_reserveBalance) - 1) / _supply + 1;
    }

    function fundSupplyAmount(
        uint256 _supply,
        uint256 _reserveBalance,
        uint256 _amount
    ) private pure returns (uint256) {
        // validate input
        require(_supply > 0, "ERR_INVALID_SUPPLY");
        require(_reserveBalance > 0, "ERR_INVALID_RESERVE_BALANCE");

        // special case for 0 amount
        if (_amount == 0) {
            return 0;
        }

        return _amount.mul(_supply) / _reserveBalance;
    }

    function liquidateReserveAmount(
        uint256 _supply,
        uint256 _reserveBalance,
        uint256 _amount
    ) private pure returns (uint256) {
        // validate input
        require(_supply > 0, "ERR_INVALID_SUPPLY");
        require(_reserveBalance > 0, "ERR_INVALID_RESERVE_BALANCE");
        require(_amount <= _supply, "ERR_INVALID_AMOUNT");

        // special case for 0 amount
        if (_amount == 0) {
            return 0;
        }

        // special case for liquidating the entire supply
        if (_amount == _supply) {
            return _reserveBalance;
        }

        return _amount.mul(_reserveBalance) / _supply;
    }

    /**
     * @dev deprecated since version 28, backward compatibility - use only for earlier versions
     */
    function token() public view override returns (IConverterAnchor) {
        return anchor;
    }

    /**
     * @dev deprecated, backward compatibility
     */
    function transferTokenOwnership(address _newOwner) public override ownerOnly {
        transferAnchorOwnership(_newOwner);
    }

    /**
     * @dev deprecated, backward compatibility
     */
    function acceptTokenOwnership() public override ownerOnly {
        acceptAnchorOwnership();
    }

    /**
     * @dev deprecated, backward compatibility
     */
    function connectors(IERC20Token _address)
        public
        view
        override
        returns (
            uint256,
            uint32,
            bool,
            bool,
            bool
        )
    {
        uint256 reserveId = __reserveIds[_address];
        if (reserveId != 0) {
            return (reserveBalance(reserveId), PPM_RESOLUTION / 2, false, false, true);
        }
        return (0, 0, false, false, false);
    }

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

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

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

    /**
     * @dev deprecated, backward compatibility
     */
    function getReturn(
        IERC20Token _sourceToken,
        IERC20Token _targetToken,
        uint256 _amount
    ) public view returns (uint256, uint256) {
        return targetAmountAndFee(_sourceToken, _targetToken, _amount);
    }
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"contract IConverterAnchor","name":"_anchor","type":"address"},{"internalType":"contract IContractRegistry","name":"_registry","type":"address"},{"internalType":"uint32","name":"_maxConversionFee","type":"uint32"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint16","name":"_type","type":"uint16"},{"indexed":true,"internalType":"contract IConverterAnchor","name":"_anchor","type":"address"},{"indexed":true,"internalType":"bool","name":"_activated","type":"bool"}],"name":"Activation","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract IERC20Token","name":"_fromToken","type":"address"},{"indexed":true,"internalType":"contract IERC20Token","name":"_toToken","type":"address"},{"indexed":true,"internalType":"address","name":"_trader","type":"address"},{"indexed":false,"internalType":"uint256","name":"_amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_return","type":"uint256"},{"indexed":false,"internalType":"int256","name":"_conversionFee","type":"int256"}],"name":"Conversion","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint32","name":"_prevFee","type":"uint32"},{"indexed":false,"internalType":"uint32","name":"_newFee","type":"uint32"}],"name":"ConversionFeeUpdate","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_provider","type":"address"},{"indexed":true,"internalType":"contract IERC20Token","name":"_reserveToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"_amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_newBalance","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_newSupply","type":"uint256"}],"name":"LiquidityAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_provider","type":"address"},{"indexed":true,"internalType":"contract IERC20Token","name":"_reserveToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"_amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_newBalance","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_newSupply","type":"uint256"}],"name":"LiquidityRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_prevOwner","type":"address"},{"indexed":true,"internalType":"address","name":"_newOwner","type":"address"}],"name":"OwnerUpdate","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"contract IERC20Token","name":"_token1","type":"address"},{"indexed":true,"internalType":"contract IERC20Token","name":"_token2","type":"address"},{"indexed":false,"internalType":"uint256","name":"_rateN","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_rateD","type":"uint256"}],"name":"TokenRateUpdate","type":"event"},{"inputs":[],"name":"acceptAnchorOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"acceptTokenOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_reserve1Amount","type":"uint256"},{"internalType":"uint256","name":"_reserve2Amount","type":"uint256"},{"internalType":"uint256","name":"_minReturn","type":"uint256"}],"name":"addLiquidity","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"contract IERC20Token[]","name":"_reserveTokens","type":"address[]"},{"internalType":"uint256[]","name":"_reserveAmounts","type":"uint256[]"},{"internalType":"uint256","name":"_minReturn","type":"uint256"}],"name":"addLiquidity","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"contract IERC20Token[]","name":"_reserveTokens","type":"address[]"},{"internalType":"uint256","name":"_reserveTokenIndex","type":"uint256"},{"internalType":"uint256","name":"_reserveAmount","type":"uint256"}],"name":"addLiquidityCost","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20Token","name":"_reserveToken","type":"address"},{"internalType":"uint256","name":"_reserveAmount","type":"uint256"}],"name":"addLiquidityReturn","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20Token","name":"_token","type":"address"},{"internalType":"uint32","name":"_weight","type":"uint32"}],"name":"addReserve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"anchor","outputs":[{"internalType":"contract IConverterAnchor","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"averageRateInfo","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"connectorTokenCount","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_index","type":"uint256"}],"name":"connectorTokens","outputs":[{"internalType":"contract IERC20Token","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20Token","name":"_address","type":"address"}],"name":"connectors","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint32","name":"","type":"uint32"},{"internalType":"bool","name":"","type":"bool"},{"internalType":"bool","name":"","type":"bool"},{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"conversionFee","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20Token","name":"_sourceToken","type":"address"},{"internalType":"contract IERC20Token","name":"_targetToken","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"address","name":"_trader","type":"address"},{"internalType":"address payable","name":"_beneficiary","type":"address"}],"name":"convert","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"converterType","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"contract IERC20Token","name":"_connectorToken","type":"address"}],"name":"getConnectorBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20Token","name":"_sourceToken","type":"address"},{"internalType":"contract IERC20Token","name":"_targetToken","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"getReturn","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isActive","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isV28OrHigher","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"maxConversionFee","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"newOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"onlyOwnerCanUpdateRegistry","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"prevRegistry","outputs":[{"internalType":"contract IContractRegistry","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20Token","name":"_token","type":"address"}],"name":"recentAverageRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"registry","outputs":[{"internalType":"contract IContractRegistry","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint256","name":"_reserve1MinReturn","type":"uint256"},{"internalType":"uint256","name":"_reserve2MinReturn","type":"uint256"}],"name":"removeLiquidity","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"contract IERC20Token[]","name":"_reserveTokens","type":"address[]"},{"internalType":"uint256[]","name":"_reserveMinReturnAmounts","type":"uint256[]"}],"name":"removeLiquidity","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"contract IERC20Token[]","name":"_reserveTokens","type":"address[]"}],"name":"removeLiquidityReturn","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20Token","name":"_reserveToken","type":"address"}],"name":"reserveBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"reserveBalances","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"reserveTokenCount","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"reserveTokens","outputs":[{"internalType":"contract IERC20Token[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20Token","name":"_reserveToken","type":"address"}],"name":"reserveWeight","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"restoreRegistry","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_onlyOwnerCanUpdateRegistry","type":"bool"}],"name":"restrictRegistryUpdate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"_conversionFee","type":"uint32"}],"name":"setConversionFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20Token","name":"_sourceToken","type":"address"},{"internalType":"contract IERC20Token","name":"_targetToken","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"targetAmountAndFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token","outputs":[{"internalType":"contract IConverterAnchor","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_newOwner","type":"address"}],"name":"transferAnchorOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newOwner","type":"address"}],"name":"transferTokenOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"updateRegistry","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"upgrade","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"version","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address payable","name":"_to","type":"address"}],"name":"withdrawETH","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20Token","name":"_token","type":"address"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdrawTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]

Deployed Bytecode

0x6080604052600436106102975760003560e01c806371f52bf31161015a578063cdc91c69116100c1578063dc8de3791161007a578063dc8de37914610cba578063e8dc12ff14610ced578063ecbca55d14610d33578063f0413a1f14610d63578063f2fde38b14610d78578063fc0c546a14610dab576102b7565b8063cdc91c6914610c1e578063d260529c14610c33578063d3fb73b414610c48578063d4ee1d9014610c5d578063d55ec69714610c72578063d895951214610c87576102b7565b80638da5cb5b116101135780638da5cb5b14610a5057806394c275ad14610a655780639b99a8e214610a7a578063af94b8d814610a8f578063b127c0a514610ad2578063b4a176d314610c09576102b7565b806371f52bf31461080357806379ba5097146108185780637b1039991461082d5780637d8916bd1461084257806380d9416d14610967578063857620e114610a1a576102b7565b80633e8ff43f116101fe5780635e35359e116101b75780635e35359e146106f1578063613e53a71461073457806361cd756e1461074957806367b6d57c1461075e578063690d8320146107915780636a49d2c4146107c4576102b7565b80633e8ff43f14610612578063422f10431461063e57806349d10b64146106795780634e40c2601461068e57806354fd4d50146106c7578063579cd3ca146106dc576102b7565b80631f0181bc116102505780631f0181bc1461054457806321e6b53d1461057757806322f3e2d4146105aa57806327ac36c4146105d35780632fe8a6ad146105e857806338a5e016146105fd576102b7565b8063024c7ec7146102bc5780630e53aae9146102ea578063154588371461035157806319b64015146104565780631cfab2901461049c5780631e1401f8146104e8576102b7565b366102b7576000805160206148688339815191526102b481610dc0565b50005b600080fd5b3480156102c857600080fd5b506102e8600480360360208110156102df57600080fd5b50351515610e23565b005b3480156102f657600080fd5b5061031d6004803603602081101561030d57600080fd5b50356001600160a01b0316610e49565b6040805195865263ffffffff9094166020860152911515848401521515606084015215156080830152519081900360a00190f35b34801561035d57600080fd5b506104066004803603604081101561037457600080fd5b81359190810190604081016020820135600160201b81111561039557600080fd5b8201836020820111156103a757600080fd5b803590602001918460208302840111600160201b831117156103c857600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250929550610eb0945050505050565b60408051602080825283518183015283519192839290830191858101910280838360005b8381101561044257818101518382015260200161042a565b505050509050019250505060405180910390f35b34801561046257600080fd5b506104806004803603602081101561047957600080fd5b5035610f45565b604080516001600160a01b039092168252519081900360200190f35b3480156104a857600080fd5b506104cf600480360360208110156104bf57600080fd5b50356001600160a01b0316610f71565b6040805163ffffffff9092168252519081900360200190f35b3480156104f457600080fd5b5061052b6004803603606081101561050b57600080fd5b506001600160a01b03813581169160208101359091169060400135610f88565b6040805192835260208301919091528051918290030190f35b34801561055057600080fd5b5061052b6004803603602081101561056757600080fd5b50356001600160a01b0316610fa3565b34801561058357600080fd5b506102e86004803603602081101561059a57600080fd5b50356001600160a01b031661101e565b3480156105b657600080fd5b506105bf61102f565b604080519115158252519081900360200190f35b3480156105df57600080fd5b506104066110c4565b3480156105f457600080fd5b506105bf611126565b34801561060957600080fd5b506102e8611136565b34801561061e57600080fd5b50610627611148565b6040805161ffff9092168252519081900360200190f35b6106676004803603606081101561065457600080fd5b508035906020810135906040013561114d565b60408051918252519081900360200190f35b34801561068557600080fd5b506102e8611217565b34801561069a57600080fd5b50610667600480360360408110156106b157600080fd5b506001600160a01b03813516906020013561141f565b3480156106d357600080fd5b506106276114cd565b3480156106e857600080fd5b506104cf6114d2565b3480156106fd57600080fd5b506102e86004803603606081101561071457600080fd5b506001600160a01b038135811691602081013590911690604001356114e5565b34801561074057600080fd5b5061052b6115d0565b34801561075557600080fd5b506104806115e7565b34801561076a57600080fd5b506102e86004803603602081101561078157600080fd5b50356001600160a01b03166115f6565b34801561079d57600080fd5b506102e8600480360360208110156107b457600080fd5b50356001600160a01b031661168c565b3480156107d057600080fd5b506102e8600480360360408110156107e757600080fd5b5080356001600160a01b0316906020013563ffffffff1661179d565b34801561080f57600080fd5b50610627611905565b34801561082457600080fd5b506102e8611914565b34801561083957600080fd5b506104806119cb565b6106676004803603606081101561085857600080fd5b810190602081018135600160201b81111561087257600080fd5b82018360208201111561088457600080fd5b803590602001918460208302840111600160201b831117156108a557600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b8111156108f457600080fd5b82018360208201111561090657600080fd5b803590602001918460208302840111600160201b8311171561092757600080fd5b91908080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525092955050913592506119da915050565b34801561097357600080fd5b506104066004803603606081101561098a57600080fd5b810190602081018135600160201b8111156109a457600080fd5b8201836020820111156109b657600080fd5b803590602001918460208302840111600160201b831117156109d757600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295505082359350505060200135612036565b348015610a2657600080fd5b5061052b60048036036060811015610a3d57600080fd5b5080359060208101359060400135612232565b348015610a5c57600080fd5b5061048061232e565b348015610a7157600080fd5b506104cf61233d565b348015610a8657600080fd5b50610627612350565b348015610a9b57600080fd5b5061052b60048036036060811015610ab257600080fd5b506001600160a01b03813581169160208101359091169060400135612356565b348015610ade57600080fd5b5061040660048036036060811015610af557600080fd5b81359190810190604081016020820135600160201b811115610b1657600080fd5b820183602082011115610b2857600080fd5b803590602001918460208302840111600160201b83111715610b4957600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b811115610b9857600080fd5b820183602082011115610baa57600080fd5b803590602001918460208302840111600160201b83111715610bcb57600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295506123c3945050505050565b348015610c1557600080fd5b506102e8612787565b348015610c2a57600080fd5b506102e86127b3565b348015610c3f57600080fd5b506105bf6128d0565b348015610c5457600080fd5b506104806128d5565b348015610c6957600080fd5b506104806128e4565b348015610c7e57600080fd5b506102e86128f3565b348015610c9357600080fd5b5061066760048036036020811015610caa57600080fd5b50356001600160a01b03166129db565b348015610cc657600080fd5b5061066760048036036020811015610cdd57600080fd5b50356001600160a01b03166129e2565b610667600480360360a0811015610d0357600080fd5b506001600160a01b0381358116916020810135821691604082013591606081013582169160809091013516612a4c565b348015610d3f57600080fd5b506102e860048036036020811015610d5657600080fd5b503563ffffffff16612af2565b348015610d6f57600080fd5b50610667612bd4565b348015610d8457600080fd5b506102e860048036036020811015610d9b57600080fd5b50356001600160a01b0316612bda565b348015610db757600080fd5b50610480612c58565b6001600160a01b038116600090815260076020526040902054610e20576040805162461bcd60e51b81526020600482015260136024820152724552525f494e56414c49445f5245534552564560681b604482015290519081900360640190fd5b50565b610e2b612c67565b60038054911515600160a01b0260ff60a01b19909216919091179055565b6001600160a01b03811660009081526007602052604081205481908190819081908015610e9357610e7981612cba565b95506207a12094506000935083925060019150610ea79050565b600080600080600095509550955095509550505b91939590929450565b60606000600860009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b158015610f0257600080fd5b505afa158015610f16573d6000803e3d6000fd5b505050506040513d6020811015610f2c57600080fd5b50519050610f3b848483612cc8565b9150505b92915050565b600060068281548110610f5457fe5b6000918252602090912001546001600160a01b031690505b919050565b600081610f7d81610dc0565b506207a12092915050565b600080610f96858585612356565b915091505b935093915050565b60008082610fb081610dc0565b6000610fbd600954612e1a565b90506000610fca82612f44565b90506000610fd783612f53565b90506006600081548110610fe757fe5b6000918252602090912001546001600160a01b03888116911614156110125790945092506110189050565b94509250505b50915091565b611026612c67565b610e20816115f6565b6000306001600160a01b0316600860009054906101000a90046001600160a01b03166001600160a01b0316638da5cb5b6040518163ffffffff1660e01b815260040160206040518083038186803b15801561108957600080fd5b505afa15801561109d573d6000803e3d6000fd5b505050506040513d60208110156110b357600080fd5b50516001600160a01b031614905090565b6060600680548060200260200160405190810160405280929190818152602001828054801561111c57602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116110fe575b5050505050905090565b600354600160a01b900460ff1681565b61113e612c67565b6111466127b3565b565b600390565b6040805160028082526060808301845260009390929190602083019080368337019050509050848160008151811061118157fe5b602002602001018181525050838160018151811061119b57fe5b60200260200101818152505061120c600680548060200260200160405190810160405280929190818152602001828054801561120057602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116111e2575b505050505082856119da565b9150505b9392505050565b6000546001600160a01b031633148061123a5750600354600160a01b900460ff16155b61127f576040805162461bcd60e51b815260206004820152601160248201527011549497d050d0d154d4d7d11153925151607a1b604482015290519081900360640190fd5b600061129d6f436f6e7472616374526567697374727960801b612f5f565b6002549091506001600160a01b038083169116148015906112c657506001600160a01b03811615155b61130e576040805162461bcd60e51b81526020600482015260146024820152734552525f494e56414c49445f524547495354525960601b604482015290519081900360640190fd5b60006001600160a01b0316816001600160a01b031663bb34534c6f436f6e7472616374526567697374727960801b6040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561137057600080fd5b505afa158015611384573d6000803e3d6000fd5b505050506040513d602081101561139a57600080fd5b50516001600160a01b031614156113ef576040805162461bcd60e51b81526020600482015260146024820152734552525f494e56414c49445f524547495354525960601b604482015290519081900360640190fd5b60028054600380546001600160a01b038084166001600160a01b0319928316179092559091169216919091179055565b600080600860009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561147057600080fd5b505afa158015611484573d6000803e3d6000fd5b505050506040513d602081101561149a57600080fd5b50516001600160a01b038516600090815260076020526040902054909150610f3b9082906114c790612cba565b85612fdd565b602c81565b600854600160c01b900463ffffffff1681565b6114ed613093565b60026004556114fa612c67565b600061151f762130b731b7b921b7b73b32b93a32b92ab833b930b232b960491b612f5f565b6001600160a01b03851660009081526007602052604090205490915080158061154d575061154b61102f565b155b8061156557506000546001600160a01b038381169116145b6115aa576040805162461bcd60e51b815260206004820152601160248201527011549497d050d0d154d4d7d11153925151607a1b604482015290519081900360640190fd5b6115b58585856130db565b80156115c4576115c48561310c565b50506001600455505050565b6000806115df600160026131c4565b915091509091565b6003546001600160a01b031681565b6115fe612c67565b762130b731b7b921b7b73b32b93a32b92ab833b930b232b960491b6116228161324d565b6008546040805163f2fde38b60e01b81526001600160a01b0385811660048301529151919092169163f2fde38b91602480830192600092919082900301818387803b15801561167057600080fd5b505af1158015611684573d6000803e3d6000fd5b505050505050565b611694613093565b60026004556116a1612c67565b6000805160206148688339815191526116b981610dc0565b60006116de762130b731b7b921b7b73b32b93a32b92ab833b930b232b960491b612f5f565b90506116e861102f565b158061170157506000546001600160a01b038281169116145b611746576040805162461bcd60e51b815260206004820152601160248201527011549497d050d0d154d4d7d11153925151607a1b604482015290519081900360640190fd5b6040516001600160a01b038416904780156108fc02916000818181858888f1935050505015801561177b573d6000803e3d6000fd5b5061179360008051602061486883398151915261310c565b5050600160045550565b6117a5612c67565b6117ad6132af565b816117b7816132f6565b826117c181613347565b826117cb8161339b565b6008546001600160a01b038681169116148015906117ff57506001600160a01b038516600090815260076020526040902054155b611846576040805162461bcd60e51b81526020600482015260136024820152724552525f494e56414c49445f5245534552564560681b604482015290519081900360640190fd5b6002611850612350565b61ffff16106118a2576040805162461bcd60e51b815260206004820152601960248201527811549497d253959053125117d49154d154959157d0d3d55395603a1b604482015290519081900360640190fd5b5050600680546001810182557ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f0180546001600160a01b039095166001600160a01b03199095168517905554600093845260076020526040909320929092555050565b600061190f612350565b905090565b6001546001600160a01b03163314611967576040805162461bcd60e51b815260206004820152601160248201527011549497d050d0d154d4d7d11153925151607a1b604482015290519081900360640190fd5b600154600080546040516001600160a01b0393841693909116917f343765429aea5a34b3ff6a3785a98a5abb2597aca87bfbb58632c173d585373a91a360018054600080546001600160a01b03199081166001600160a01b03841617909155169055565b6002546001600160a01b031681565b60006119e4613093565b60026004556119f16133f8565b6119fc848484613440565b5060005b6002811015611aad576000805160206148688339815191526001600160a01b0316858281518110611a2d57fe5b60200260200101516001600160a01b03161415611aa55734848281518110611a5157fe5b602002602001015114611aa5576040805162461bcd60e51b815260206004820152601760248201527608aa4a4be8aa890be829a9eaa9ca8be9a92a69a82a8869604b1b604482015290519081900360640190fd5b600101611a00565b503415611b335760008051602061486883398151915260005260076020527fb2084a3e4595ccf007fb44245853374aaf0de960074375e8e0fb334712e94d0e54611b33576040805162461bcd60e51b81526020600482015260126024820152714552525f4e4f5f4554485f5245534552564560701b604482015290519081900360640190fd5b600854604080516318160ddd60e01b815290516001600160a01b039092169160009183916318160ddd91600480820192602092909190829003018186803b158015611b7d57600080fd5b505afa158015611b91573d6000803e3d6000fd5b505050506040513d6020811015611ba757600080fd5b50519050611bb4346136b3565b611bbc614829565b611bc4614829565b611bcc6115d0565b602084015282526040805160028082526060828101909352600092919081602001602082028036833701905050905084611c505760005b6002811015611c3f57898181518110611c1857fe5b6020026020010151828281518110611c2c57fe5b6020908102919091010152600101611c03565b50611c4981613848565b9150611d24565b6000611c7f858260200201518b600181518110611c6957fe5b602002602001015161389a90919063ffffffff16565b611c9786600160200201518c600081518110611c6957fe5b10611ca3576001611ca6565b60005b60ff169050611cd986868360028110611cbb57fe5b60200201518c8481518110611ccc57fe5b6020026020010151612fdd565b925060005b6002811015611d2157611d0287878360028110611cf757fe5b6020020151866138f8565b838281518110611d0e57fe5b6020908102919091010152600101611cde565b50505b6000611d3086846139b5565b905060005b6002811015611f585760008c8281518110611d4c57fe5b602002602001015190506000848381518110611d6457fe5b6020026020010151905060008111611dbc576040805162461bcd60e51b815260206004820152601660248201527511549497d6915493d7d5105491d15517d05353d5539560521b604482015290519081900360640190fd5b8c8381518110611dc857fe5b6020026020010151811115611dd957fe5b6001600160a01b03821660008051602061486883398151915214611e0857611e03823330846139fe565b611e73565b808d8481518110611e1557fe5b60200260200101511115611e7357336001600160a01b03166108fc828f8681518110611e3d57fe5b6020026020010151039081150290604051600060405180830381858888f19350505050158015611e71573d6000803e3d6000fd5b505b611e8e81898560028110611e8357fe5b6020020151906139b5565b878460028110611e9a57fe5b60200201526001600160a01b038216337f4a1a2a6176e9646d9e3157f7c2ab3c499f18337c0b0828cfb28e0a61de4a11f7838a8760028110611ed857fe5b602090810291909101516040805193845291830152818101899052519081900360600190a3816001600160a01b03168a6001600160a01b0316600080516020614848833981519152898660028110611f2c57fe5b602002015187604051808381526020018281526020019250505060405180910390a35050600101611d35565b508351611f729060019060029087835b6020020151613b69565b88831015611fbc576040805162461bcd60e51b81526020600482015260126024820152714552525f52455455524e5f544f4f5f4c4f5760701b604482015290519081900360640190fd5b6040805163219e412d60e21b81523360048201526024810185905290516001600160a01b0389169163867904b491604480830192600092919082900301818387803b15801561200a57600080fd5b505af115801561201e573d6000803e3d6000fd5b5050600160045550929b9a5050505050505050505050565b604080516002808252606080830184529283929190602083019080368337505060408051600280825260608083018452949550909250906020830190803683370190505090506000600760008860008151811061208f57fe5b60200260200101516001600160a01b03166001600160a01b03168152602001908152602001600020549050600060076000896001815181106120cd57fe5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002054905061210282826131c4565b8460008151811061210f57fe5b602002602001018560018151811061212357fe5b60200260200101828152508281525050506000600860009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561218457600080fd5b505afa158015612198573d6000803e3d6000fd5b505050506040513d60208110156121ae57600080fd5b505184519091506000906121d890839087908c9081106121ca57fe5b60200260200101518a612fdd565b905060005b600281101561222357612204838783815181106121f657fe5b6020026020010151846138f8565b87828151811061221057fe5b60209081029190910101526001016121dd565b50949998505050505050505050565b604080516002808252606080830184526000938493919290602083019080368337019050509050848160008151811061226757fe5b602002602001018181525050838160018151811061228157fe5b60200260200101818152505060606122f48760068054806020026020016040519081016040528092919081815260200182805480156122e957602002820191906000526020600020905b81546001600160a01b031681526001909101906020018083116122cb575b5050505050846123c3565b90508060008151811061230357fe5b60200260200101518160018151811061231857fe5b6020026020010151935093505050935093915050565b6000546001600160a01b031681565b600854600160a01b900463ffffffff1681565b60065490565b6000806123616133f8565b6001600160a01b03808616600090815260076020526040808220549287168252812054908061239084846131c4565b9150915060006123a183838a613bed565b905060006123ae82613c51565b918290039b919a509098505050505050505050565b60606123cd613093565b60026004556123da6133f8565b60006123e7848487613440565b90506000600860009054906101000a90046001600160a01b031690506000816001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561243e57600080fd5b505afa158015612452573d6000803e3d6000fd5b505050506040513d602081101561246857600080fd5b50516040805163a24835d160e01b8152336004820152602481018a905290519192506001600160a01b0384169163a24835d19160448082019260009290919082900301818387803b1580156124bc57600080fd5b505af11580156124d0573d6000803e3d6000fd5b505050506124dc613c86565b60006124e88289613e16565b905060606124f7898985612cc8565b9050612501614829565b612509614829565b6125116115d0565b6020840152825260005b60028110156126f75760008b828151811061253257fe5b60200260200101519050600085838151811061254a57fe5b602002602001015190508b838151811061256057fe5b60200260200101518110156125b5576040805162461bcd60e51b815260206004820152601660248201527511549497d6915493d7d5105491d15517d05353d5539560521b604482015290519081900360640190fd5b6125d0818685600281106125c557fe5b602002015190613e16565b8484600281106125dc57fe5b60200201526001600160a01b038216600080516020614868833981519152141561263357604051339082156108fc029083906000818181858888f1935050505015801561262d573d6000803e3d6000fd5b5061263e565b61263e823383613e63565b6001600160a01b038216337fbc7d19d505c7ec4db83f3b51f19fb98c4c8a99922e7839d1ee608dfbee29501b8387876002811061267757fe5b6020908102919091015160408051938452918301528181018c9052519081900360600190a3816001600160a01b0316896001600160a01b03166000805160206148488339815191528686600281106126cb57fe5b60200201518a604051808381526020018281526020019250505060405180910390a3505060010161251b565b50805161270b906001906002908483611f68565b86156127745760008360008151811061272057fe5b602002602001015190508360018151811061273757fe5b60200260200101518460008151811061274c57fe5b602002602001018181525050808460018151811061276657fe5b602002602001018181525050505b5050600160045598975050505050505050565b61278f612c67565b600354600280546001600160a01b0319166001600160a01b03909216919091179055565b6127bb612c67565b6127c3612350565b61ffff16600214612817576040805162461bcd60e51b815260206004820152601960248201527811549497d253959053125117d49154d154959157d0d3d55395603a1b604482015290519081900360640190fd5b600860009054906101000a90046001600160a01b03166001600160a01b03166379ba50976040518163ffffffff1660e01b8152600401600060405180830381600087803b15801561286757600080fd5b505af115801561287b573d6000803e3d6000fd5b50505050612887613c86565b6008546001906001600160a01b031661289e611148565b61ffff167f6b08c2e2c9969e55a647a764db9b554d64dc42f1a704da11a6d5b129ad163f2c60405160405180910390a4565b600190565b6008546001600160a01b031681565b6001546001600160a01b031681565b6128fb612c67565b6000612920762130b731b7b921b7b73b32b93a32b92ab833b930b232b960491b612f5f565b6008549091506000906001600160a01b031661293a611148565b61ffff167f6b08c2e2c9969e55a647a764db9b554d64dc42f1a704da11a6d5b129ad163f2c60405160405180910390a461297381612bda565b6040805163487ac64b60e11b8152602c600482015290516001600160a01b038316916390f58c9691602480830192600092919082900301818387803b1580156129bb57600080fd5b505af11580156129cf573d6000803e3d6000fd5b50505050610e20611914565b6000610f3f825b6001600160a01b03811660009081526007602052604081205480612a43576040805162461bcd60e51b81526020600482015260136024820152724552525f494e56414c49445f5245534552564560681b604482015290519081900360640190fd5b61121081612cba565b6000612a56613093565b60026004556c42616e636f724e6574776f726b60981b612a758161324d565b856001600160a01b0316876001600160a01b03161415612ad5576040805162461bcd60e51b815260206004820152601660248201527511549497d4d0535157d4d3d55490d157d5105491d15560521b604482015290519081900360640190fd5b612ae28787878787613fbc565b6001600455979650505050505050565b612afa612c67565b60085463ffffffff600160a01b90910481169082161115612b62576040805162461bcd60e51b815260206004820152601a60248201527f4552525f494e56414c49445f434f4e56455253494f4e5f464545000000000000604482015290519081900360640190fd5b6008546040805163ffffffff600160c01b90930483168152918316602083015280517f81cd2ffb37dd237c0e4e2a3de5265fcf9deb43d3e7801e80db9f1ccfba7ee6009281900390910190a16008805463ffffffff909216600160c01b0263ffffffff60c01b19909216919091179055565b60095481565b612be2612c67565b6000546001600160a01b0382811691161415612c36576040805162461bcd60e51b815260206004820152600e60248201526d22a9292fa9a0a6a2afa7aba722a960911b604482015290519081900360640190fd5b600180546001600160a01b0319166001600160a01b0392909216919091179055565b6008546001600160a01b031690565b6000546001600160a01b03163314611146576040805162461bcd60e51b815260206004820152601160248201527011549497d050d0d154d4d7d11153925151607a1b604482015290519081900360640190fd5b6000610f3f6005548361425b565b6040805160028082526060808301845292839291906020830190803683375050604080516002808252606080830184529495509092509060208301908036833701905050905060006007600087600081518110612d2157fe5b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002054905060006007600088600181518110612d5f57fe5b60200260200101516001600160a01b03166001600160a01b03168152602001908152602001600020549050612d9482826131c4565b84600081518110612da157fe5b6020026020010185600181518110612db557fe5b60209081029190910101919091525260005b6002811015612e0d57612dee87858381518110612de057fe5b60200260200101518b61428d565b858281518110612dfa57fe5b6020908102919091010152600101612dc7565b5092979650505050505050565b600080612e268361438c565b90506000612e3384612f44565b90506000612e4085612f53565b90506000612e4c614392565b905083810380612e63578695505050505050610f6c565b600080612e6e6115d0565b9150915061025883101580612e81575086155b15612eb557612e9881836001600160701b03614396565b92509050612ea78482846143de565b975050505050505050610f6c565b6000612ec1868361389a565b90506000612ecf888561389a565b90506000612ef5612ee0848861389a565b612eef846102588a900361389a565b906139b5565b90506000612f0f610258612f098b8961389a565b9061389a565b9050612f2382826001600160701b03614396565b9092509050612f338883836143de565b9d9c50505050505050505050505050565b60701c6001600160701b031690565b6001600160701b031690565b60025460408051632ecd14d360e21b81526004810184905290516000926001600160a01b03169163bb34534c916024808301926020929190829003018186803b158015612fab57600080fd5b505afa158015612fbf573d6000803e3d6000fd5b505050506040513d6020811015612fd557600080fd5b505192915050565b6000808411613028576040805162461bcd60e51b81526020600482015260126024820152714552525f494e56414c49445f535550504c5960701b604482015290519081900360640190fd5b6000831161306b576040805162461bcd60e51b815260206004820152601b6024820152600080516020614888833981519152604482015290519081900360640190fd5b8161307857506000611210565b82613083838661389a565b8161308a57fe5b04949350505050565b600160045414611146576040805162461bcd60e51b815260206004820152600e60248201526d4552525f5245454e5452414e435960901b604482015290519081900360640190fd5b6130e3612c67565b826130ed816132f6565b826130f7816132f6565b8361310181613347565b611684868686613e63565b6001600160a01b03811660008181526007602052604081205491600080516020614868833981519152146131b157604080516370a0823160e01b815230600482015290516001600160a01b038516916370a08231916024808301926020929190829003018186803b15801561318057600080fd5b505afa158015613194573d6000803e3d6000fd5b505050506040513d60208110156131aa57600080fd5b50516131b3565b475b90506131bf8282614429565b505050565b6000808360011480156131d75750826002145b806131ed57508360021480156131ed5750826001145b613235576040805162461bcd60e51b81526020600482015260146024820152734552525f494e56414c49445f524553455256455360601b604482015290519081900360640190fd5b61324260055485856144af565b915091509250929050565b61325681612f5f565b6001600160a01b0316336001600160a01b031614610e20576040805162461bcd60e51b815260206004820152601160248201527011549497d050d0d154d4d7d11153925151607a1b604482015290519081900360640190fd5b6132b761102f565b15611146576040805162461bcd60e51b815260206004820152600a6024820152694552525f41435449564560b01b604482015290519081900360640190fd5b6001600160a01b038116610e20576040805162461bcd60e51b81526020600482015260136024820152724552525f494e56414c49445f4144445245535360681b604482015290519081900360640190fd5b6001600160a01b038116301415610e20576040805162461bcd60e51b815260206004820152601360248201527222a9292fa0a2222922a9a9afa4a9afa9a2a62360691b604482015290519081900360640190fd5b63ffffffff81166207a12014610e20576040805162461bcd60e51b815260206004820152601a60248201527f4552525f494e56414c49445f524553455256455f574549474854000000000000604482015290519081900360640190fd5b61340061102f565b611146576040805162461bcd60e51b815260206004820152600c60248201526b4552525f494e41435449564560a01b604482015290519081900360640190fd5b6000808360008151811061345057fe5b6020026020010151118015613479575060008360018151811061346f57fe5b6020026020010151115b80156134855750600082115b6134c8576040805162461bcd60e51b815260206004820152600f60248201526e11549497d6915493d7d05353d55395608a1b604482015290519081900360640190fd5b600060076000866000815181106134db57fe5b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000205490506000600760008760018151811061351957fe5b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000205490508160021480156135545750806001145b156136505760008660008151811061356857fe5b602002602001015190508660018151811061357f57fe5b60200260200101518760008151811061359457fe5b60200260200101906001600160a01b031690816001600160a01b03168152505080876001815181106135c257fe5b60200260200101906001600160a01b031690816001600160a01b0316815250506000866000815181106135f157fe5b602002602001015190508660018151811061360857fe5b60200260200101518760008151811061361d57fe5b602002602001018181525050808760018151811061363757fe5b6020026020010181815250506001945050505050611210565b8160011480156136605750806002145b6136a7576040805162461bcd60e51b81526020600482015260136024820152724552525f494e56414c49445f5245534552564560681b604482015290519081900360640190fd5b50600095945050505050565b600060066000815481106136c357fe5b6000918252602082200154600680546001600160a01b0390921693509060019081106136eb57fe5b60009182526020822001546001600160a01b03908116925083166000805160206148688339815191521461379057604080516370a0823160e01b815230600482015290516001600160a01b038516916370a08231916024808301926020929190829003018186803b15801561375f57600080fd5b505afa158015613773573d6000803e3d6000fd5b505050506040513d602081101561378957600080fd5b5051613794565b8347035b905060006001600160a01b0383166000805160206148688339815191521461382d57604080516370a0823160e01b815230600482015290516001600160a01b038516916370a08231916024808301926020929190829003018186803b1580156137fc57600080fd5b505afa158015613810573d6000803e3d6000fd5b505050506040513d602081101561382657600080fd5b5051613831565b8447035b9050613841600160028484613b69565b5050505050565b80516000908190815b818110156138815761387585828151811061386857fe5b60200260200101516144c6565b90920191600101613851565b50600161388e83836144e8565b03600a0a949350505050565b6000826138a957506000610f3f565b828202828482816138b657fe5b0414611210576040805162461bcd60e51b815260206004820152600c60248201526b4552525f4f564552464c4f5760a01b604482015290519081900360640190fd5b6000808411613943576040805162461bcd60e51b81526020600482015260126024820152714552525f494e56414c49445f535550504c5960701b604482015290519081900360640190fd5b60008311613986576040805162461bcd60e51b815260206004820152601b6024820152600080516020614888833981519152604482015290519081900360640190fd5b8161399357506000611210565b8360016139a0848661389a565b03816139a857fe5b0460010190509392505050565b600082820183811015611210576040805162461bcd60e51b815260206004820152600c60248201526b4552525f4f564552464c4f5760a01b604482015290519081900360640190fd5b604080516001600160a01b0385811660248301528481166044830152606480830185905283518084039091018152608490920183526020820180516001600160e01b03166323b872dd60e01b17815292518251600094606094938a169392918291908083835b60208310613a835780518252601f199092019160209182019101613a64565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114613ae5576040519150601f19603f3d011682016040523d82523d6000602084013e613aea565b606091505b5091509150818015613b18575080511580613b185750808060200190516020811015613b1557600080fd5b50515b611684576040805162461bcd60e51b815260206004820152601860248201527f4552525f5452414e534645525f46524f4d5f4641494c45440000000000000000604482015290519081900360640190fd5b6001600160801b038211158015613b8757506001600160801b038111155b613bd8576040805162461bcd60e51b815260206004820152601c60248201527f4552525f524553455256455f42414c414e43455f4f564552464c4f5700000000604482015290519081900360640190fd5b613be482858386614500565b60055550505050565b60008084118015613bfe5750600083115b613c3d576040805162461bcd60e51b815260206004820152601b6024820152600080516020614888833981519152604482015290519081900360640190fd5b613c4784836139b5565b613083848461389a565b600854600090620f424090613c78908490600160c01b900463ffffffff9081169061389a16565b81613c7f57fe5b0492915050565b60006006600081548110613c9657fe5b6000918252602082200154600680546001600160a01b039092169350906001908110613cbe57fe5b60009182526020822001546001600160a01b039081169250831660008051602061486883398151915214613d6357604080516370a0823160e01b815230600482015290516001600160a01b038516916370a08231916024808301926020929190829003018186803b158015613d3257600080fd5b505afa158015613d46573d6000803e3d6000fd5b505050506040513d6020811015613d5c57600080fd5b5051613d65565b475b905060006001600160a01b03831660008051602061486883398151915214613dfe57604080516370a0823160e01b815230600482015290516001600160a01b038516916370a08231916024808301926020929190829003018186803b158015613dcd57600080fd5b505afa158015613de1573d6000803e3d6000fd5b505050506040513d6020811015613df757600080fd5b5051613e00565b475b9050613e10600160028484613b69565b50505050565b600081831015613e5d576040805162461bcd60e51b815260206004820152600d60248201526c4552525f554e444552464c4f5760981b604482015290519081900360640190fd5b50900390565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b178152925182516000946060949389169392918291908083835b60208310613ee05780518252601f199092019160209182019101613ec1565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114613f42576040519150601f19603f3d011682016040523d82523d6000602084013e613f47565b606091505b5091509150818015613f75575080511580613f755750808060200190516020811015613f7257600080fd5b50515b613841576040805162461bcd60e51b815260206004820152601360248201527211549497d514905394d1915497d19052531151606a1b604482015290519081900360640190fd5b6000613fc6614520565b6001600160a01b038087166000908152600760205260408082205492881682528120549080613ff584846131c4565b91509150600061400683838b613bed565b9050600061401382613c51565b905080820380614063576040805162461bcd60e51b815260206004820152601660248201527511549497d6915493d7d5105491d15517d05353d5539560521b604482015290519081900360640190fd5b83811061406c57fe5b60006001600160a01b038e1660008051602061486883398151915214156140e2575047348c146140dd576040805162461bcd60e51b815260206004820152601760248201527608aa4a4be8aa890be829a9eaa9ca8be9a92a69a82a8869604b1b604482015290519081900360640190fd5b6141ba565b8d6001600160a01b03166370a08231306040518263ffffffff1660e01b815260040180826001600160a01b0316815260200191505060206040518083038186803b15801561412f57600080fd5b505afa158015614143573d6000803e3d6000fd5b505050506040513d602081101561415957600080fd5b505190503415801561417457508b6141718288613e16565b10155b6141ba576040805162461bcd60e51b815260206004820152601260248201527111549497d253959053125117d05353d5539560721b604482015290519081900360640190fd5b6141c8888883858903613b69565b6001600160a01b038d166000805160206148688339815191521415614223576040516001600160a01b038b169083156108fc029084906000818181858888f1935050505015801561421d573d6000803e3d6000fd5b5061422e565b61422e8d8b84613e63565b61423c8e8e8d8f8688614541565b61424a8e8e8385890361459d565b509c9b505050505050505050505050565b6000816001148061426c5750816002145b61427257fe5b50608060001982010282901c6001600160801b031692915050565b60008084116142d8576040805162461bcd60e51b81526020600482015260126024820152714552525f494e56414c49445f535550504c5960701b604482015290519081900360640190fd5b6000831161431b576040805162461bcd60e51b815260206004820152601b6024820152600080516020614888833981519152604482015290519081900360640190fd5b83821115614365576040805162461bcd60e51b815260206004820152601260248201527111549497d253959053125117d05353d5539560721b604482015290519081900360640190fd5b8161437257506000611210565b83821415614381575081611210565b83613083838561389a565b60e01c90565b4290565b6000808484848211806143a857508481115b156143be576143b88282876146d6565b90925090505b8082146143cf579092509050610f9b565b50600196879650945050505050565b600063ffffffff84111580156143fb57506001600160701b038311155b801561440e57506001600160701b038211155b61441457fe5b5060e083901b607083901b1781179392505050565b6001600160801b03811115614485576040805162461bcd60e51b815260206004820152601c60248201527f4552525f524553455256455f42414c414e43455f4f564552464c4f5700000000604482015290519081900360640190fd5b60006144966005548460030361425b565b90506144a782848386600303614500565b600555505050565b6000806144bc858561425b565b610f96868561425b565b600080825b80156144e15760019190910190600a90046144cb565b5092915050565b600081600281048401816144f857fe5b049392505050565b600061450c838361470f565b614516868661470f565b1795945050505050565b600954600061452e82612e1a565b905080821461453d5760098190555b5050565b604080518481526020810184905280820183905290516001600160a01b038087169288821692918a16917f276856b36cbc45526a0ba64f44611557a2a8b68662c5388e9fe6d72e86e1c8cb9181900360600190a4505050505050565b600854604080516318160ddd60e01b815290516001600160a01b039092169160009183916318160ddd91600480820192602092909190829003018186803b1580156145e757600080fd5b505afa1580156145fb573d6000803e3d6000fd5b505050506040513d602081101561461157600080fd5b5051604080518581526020810187905281519293506001600160a01b0380891693908a1692600080516020614848833981519152928290030190a3856001600160a01b0316826001600160a01b03166000805160206148488339815191528684604051808381526020018281526020019250505060405180910390a3846001600160a01b0316826001600160a01b03166000805160206148488339815191528584604051808381526020018281526020019250505060405180910390a3505050505050565b6000808385116146f4576146eb858585614744565b91509150610f9b565b600080614702868887614744565b9890975095505050505050565b60006001600160801b038311158015614732575081600114806147325750816002145b61473857fe5b50600019016080021b90565b6000806000836000198161475457fe5b0490508086111561478d57600081600101878161476d57fe5b04600101905080878161477c57fe5b04965080868161478857fe5b049550505b8486146147ed578584028587018781106147be5760006147ad83836147fd565b955050508385039250610f9b915050565b60028888030487038210156147dc5760008694509450505050610f9b565b600180870394509450505050610f9b565b5050600290910493849350915050565b600060028204820382848161480e57fe5b068161481657fe5b0482848161482057fe5b04019392505050565b6040518060400160405280600290602082028036833750919291505056fe77f29993cf2c084e726f7e802da0719d6a0ade3e204badc7a3ffd57ecb768c24000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee4552525f494e56414c49445f524553455256455f42414c414e43450000000000a2646970667358221220b3b5f3364e7f551eeae731149fe97094c8289bce5d0313a34b3f80740d6f40a264736f6c634300060c0033

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  ]
[ 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.