ETH Price: $2,421.10 (+2.04%)

Contract

0xCA83bD8c4C7B1c0409B25FbD7e70B1ef57629fF4
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Token Holdings

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Change44704052017-11-01 13:11:042499 days ago1509541864IN
Bancor: Changer
0 ETH0.007550
Change43303322017-10-02 11:42:212529 days ago1506944541IN
Bancor: Changer
0 ETH0.000655574
Change43303272017-10-02 11:39:312529 days ago1506944371IN
Bancor: Changer
0 ETH0.0005220
Change43303172017-10-02 11:33:092529 days ago1506943989IN
Bancor: Changer
0 ETH0.000163811
Change43114222017-09-25 21:13:552536 days ago1506374035IN
Bancor: Changer
0 ETH0.003624
Change42654242017-09-12 9:02:412549 days ago1505206961IN
Bancor: Changer
0 ETH0.0031521
Change42654182017-09-12 8:59:032549 days ago1505206743IN
Bancor: Changer
0 ETH0.0031521
Change42650732017-09-12 6:46:532549 days ago1505198813IN
Bancor: Changer
0 ETH0.0031521
Change42650672017-09-12 6:44:342549 days ago1505198674IN
Bancor: Changer
0 ETH0.0031521
Change42650442017-09-12 6:34:102549 days ago1505198050IN
Bancor: Changer
0 ETH0.0031521
Change42650402017-09-12 6:32:402549 days ago1505197960IN
Bancor: Changer
0 ETH0.0031521
Change42647312017-09-12 4:25:052549 days ago1505190305IN
Bancor: Changer
0 ETH0.0031521
Change42646982017-09-12 4:13:262549 days ago1505189606IN
Bancor: Changer
0 ETH0.0031521
Change42645772017-09-12 3:31:212549 days ago1505187081IN
Bancor: Changer
0 ETH0.0031521
Change42631612017-09-11 18:02:402550 days ago1505152960IN
Bancor: Changer
0 ETH0.0027321
Change42629802017-09-11 16:46:032550 days ago1505148363IN
Bancor: Changer
0 ETH0.007550
Change42628732017-09-11 16:03:042550 days ago1505145784IN
Bancor: Changer
0 ETH0.007550
Change42628512017-09-11 15:54:142550 days ago1505145254IN
Bancor: Changer
0 ETH0.0062550
Change42628472017-09-11 15:51:372550 days ago1505145097IN
Bancor: Changer
0 ETH0.0062550
Change42628422017-09-11 15:49:122550 days ago1505144952IN
Bancor: Changer
0 ETH0.00650
Change42627342017-09-11 15:07:452550 days ago1505142465IN
Bancor: Changer
0 ETH0.0031521
Change42626452017-09-11 14:38:332550 days ago1505140713IN
Bancor: Changer
0 ETH0.0031521
Change42626212017-09-11 14:29:442550 days ago1505140184IN
Bancor: Changer
0 ETH0.0031521
Change42623732017-09-11 12:49:062550 days ago1505134146IN
Bancor: Changer
0 ETH0.1529674524
Withdraw Tokens42622092017-09-11 11:53:342550 days ago1505130814IN
Bancor: Changer
0 ETH0.0005642221
View all transactions

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
BancorChanger

Compiler Version
v0.4.11+commit.68ef5810

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion

Contract Source Code (Solidity)

/**
 *Submitted for verification at Etherscan.io on 2017-06-22
*/

pragma solidity ^0.4.11;

/*
    Overflow protected math functions
*/
contract SafeMath {
    /**
        constructor
    */
    function SafeMath() {
    }

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

        @param _x   value 1
        @param _y   value 2

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

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

        @param _x   minuend
        @param _y   subtrahend

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

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

        @param _x   factor 1
        @param _y   factor 2

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

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

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

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

    event OwnerUpdate(address _prevOwner, address _newOwner);

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    /**
        @dev allows the owner to execute the token's issue function

        @param _to         account to receive the new amount
        @param _amount     amount to increase the supply by
    */
    function issueTokens(address _to, uint256 _amount) public ownerOnly {
        token.issue(_to, _amount);
    }

    /**
        @dev allows the owner to execute the token's destroy function

        @param _from       account to remove the amount from
        @param _amount     amount to decrease the supply by
    */
    function destroyTokens(address _from, uint256 _amount) public ownerOnly {
        token.destroy(_from, _amount);
    }

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

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

/*
    Bancor Formula interface
*/
contract IBancorFormula {
    function calculatePurchaseReturn(uint256 _supply, uint256 _reserveBalance, uint16 _reserveRatio, uint256 _depositAmount) public constant returns (uint256);
    function calculateSaleReturn(uint256 _supply, uint256 _reserveBalance, uint16 _reserveRatio, uint256 _sellAmount) public constant returns (uint256);
}

/*
    EIP228 Token Changer interface
*/
contract ITokenChanger {
    function changeableTokenCount() public constant returns (uint16 count);
    function changeableToken(uint16 _tokenIndex) public constant returns (address tokenAddress);
    function getReturn(IERC20Token _fromToken, IERC20Token _toToken, uint256 _amount) public constant returns (uint256 amount);
    function change(IERC20Token _fromToken, IERC20Token _toToken, uint256 _amount, uint256 _minReturn) public returns (uint256 amount);
}

/*
    Open issues:
    - Add miner front-running attack protection. The issue is somewhat mitigated by the use of _minReturn when changing
    - Possibly add getters for reserve fields so that the client won't need to rely on the order in the struct
*/

/*
    Bancor Changer v0.1

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

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

    The changer is upgradable (just like any SmartTokenController).

    WARNING: It is NOT RECOMMENDED to use the changer with Smart Tokens that have less than 8 decimal digits
             or with very small numbers because of precision loss
*/
contract BancorChanger is ITokenChanger, SmartTokenController, SafeMath {
    struct Reserve {
        uint256 virtualBalance;         // virtual balance
        uint8 ratio;                    // constant reserve ratio (CRR), 1-100
        bool isVirtualBalanceEnabled;   // true if virtual balance is enabled, false if not
        bool isPurchaseEnabled;         // is purchase of the smart token enabled with the reserve, can be set by the token owner
        bool isSet;                     // used to tell if the mapping element is defined
    }

    string public version = '0.1';
    string public changerType = 'bancor';

    IBancorFormula public formula;                  // bancor calculation formula contract
    address[] public reserveTokens;                 // ERC20 standard token addresses
    mapping (address => Reserve) public reserves;   // reserve token addresses -> reserve data
    uint8 private totalReserveRatio = 0;            // used to prevent increasing the total reserve ratio above 100% efficiently

    // triggered when a change between two tokens occurs
    event Change(address indexed _fromToken, address indexed _toToken, address indexed _trader, uint256 _amount, uint256 _return);

    /**
        @dev constructor

        @param _token      smart token governed by the changer
        @param _formula    address of a bancor formula contract
    */
    function BancorChanger(ISmartToken _token, IBancorFormula _formula, IERC20Token _reserveToken, uint8 _reserveRatio)
        SmartTokenController(_token)
        validAddress(_formula)
    {
        formula = _formula;

        if (address(_reserveToken) != 0x0)
            addReserve(_reserveToken, _reserveRatio, false);
    }

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

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

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

    // validates reserve ratio range
    modifier validReserveRatio(uint8 _ratio) {
        require(_ratio > 0 && _ratio <= 100);
        _;
    }

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

        @return number of reserve tokens
    */
    function reserveTokenCount() public constant returns (uint16 count) {
        return uint16(reserveTokens.length);
    }

    /**
        @dev returns the number of changeable tokens supported by the contract
        note that the number of changeable tokens is the number of reserve token, plus 1 (that represents the smart token)

        @return number of changeable tokens
    */
    function changeableTokenCount() public constant returns (uint16 count) {
        return reserveTokenCount() + 1;
    }

    /**
        @dev given a changeable token index, returns the changeable token contract address

        @param _tokenIndex  changeable token index

        @return number of changeable tokens
    */
    function changeableToken(uint16 _tokenIndex) public constant returns (address tokenAddress) {
        if (_tokenIndex == 0)
            return token;
        return reserveTokens[_tokenIndex - 1];
    }

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

        @param _formula    address of a bancor formula contract
    */
    function setFormula(IBancorFormula _formula)
        public
        ownerOnly
        validAddress(_formula)
        notThis(_formula)
    {
        require(_formula != formula); // validate input
        formula = _formula;
    }

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

        @param _token                  address of the reserve token
        @param _ratio                  constant reserve ratio, 1-100
        @param _enableVirtualBalance   true to enable virtual balance for the reserve, false to disable it
    */
    function addReserve(IERC20Token _token, uint8 _ratio, bool _enableVirtualBalance)
        public
        ownerOnly
        inactive
        validAddress(_token)
        notThis(_token)
        validReserveRatio(_ratio)
    {
        require(_token != address(token) && !reserves[_token].isSet && totalReserveRatio + _ratio <= 100); // validate input

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

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

        @param _reserveToken           address of the reserve token
        @param _ratio                  constant reserve ratio, 1-100
        @param _enableVirtualBalance   true to enable virtual balance for the reserve, false to disable it
        @param _virtualBalance         new reserve's virtual balance
    */
    function updateReserve(IERC20Token _reserveToken, uint8 _ratio, bool _enableVirtualBalance, uint256 _virtualBalance)
        public
        ownerOnly
        validReserve(_reserveToken)
        validReserveRatio(_ratio)
    {
        Reserve reserve = reserves[_reserveToken];
        require(totalReserveRatio - reserve.ratio + _ratio <= 100); // validate input

        totalReserveRatio = totalReserveRatio - reserve.ratio + _ratio;
        reserve.ratio = _ratio;
        reserve.isVirtualBalanceEnabled = _enableVirtualBalance;
        reserve.virtualBalance = _virtualBalance;
    }

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

        @param _reserveToken    reserve token contract address
        @param _disable         true to disable the token, false to re-enable it
    */
    function disableReservePurchases(IERC20Token _reserveToken, bool _disable)
        public
        ownerOnly
        validReserve(_reserveToken)
    {
        reserves[_reserveToken].isPurchaseEnabled = !_disable;
    }

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

        @param _reserveToken    reserve token contract address

        @return reserve balance
    */
    function getReserveBalance(IERC20Token _reserveToken)
        public
        constant
        validReserve(_reserveToken)
        returns (uint256 balance)
    {
        Reserve reserve = reserves[_reserveToken];
        return reserve.isVirtualBalanceEnabled ? reserve.virtualBalance : _reserveToken.balanceOf(this);
    }

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

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

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

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

        // change between 2 reserves
        uint256 purchaseReturnAmount = getPurchaseReturn(_fromToken, _amount);
        return getSaleReturn(_toToken, purchaseReturnAmount, safeAdd(token.totalSupply(), purchaseReturnAmount));
    }

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

        @param _reserveToken   reserve token contract address
        @param _depositAmount  amount to deposit (in the reserve token)

        @return expected purchase return amount
    */
    function getPurchaseReturn(IERC20Token _reserveToken, uint256 _depositAmount)
        public
        constant
        active
        validReserve(_reserveToken)
        returns (uint256 amount)
    {
        Reserve reserve = reserves[_reserveToken];
        require(reserve.isPurchaseEnabled); // validate input

        uint256 tokenSupply = token.totalSupply();
        uint256 reserveBalance = getReserveBalance(_reserveToken);
        return formula.calculatePurchaseReturn(tokenSupply, reserveBalance, reserve.ratio, _depositAmount);
    }

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

        @param _reserveToken   reserve token contract address
        @param _sellAmount     amount to sell (in the smart token)

        @return expected sale return amount
    */
    function getSaleReturn(IERC20Token _reserveToken, uint256 _sellAmount) public constant returns (uint256 amount) {
        return getSaleReturn(_reserveToken, _sellAmount, token.totalSupply());
    }

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

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

        @return change return amount
    */
    function change(IERC20Token _fromToken, IERC20Token _toToken, uint256 _amount, uint256 _minReturn)
        public
        validToken(_fromToken)
        validToken(_toToken)
        returns (uint256 amount)
    {
        require(_fromToken != _toToken); // validate input

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

        // change between 2 reserves
        uint256 purchaseAmount = buy(_fromToken, _amount, 1);
        return sell(_toToken, purchaseAmount, _minReturn);
    }

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

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

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

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

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

        Change(_reserveToken, token, msg.sender, _depositAmount, amount);
        return amount;
    }

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

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

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

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

        uint256 reserveBalance = getReserveBalance(_reserveToken);
        assert(amount <= reserveBalance); // ensure that the trade won't result in negative reserve

        uint256 tokenSupply = token.totalSupply();
        assert(amount < reserveBalance || _sellAmount == tokenSupply); // ensure that the trade will only deplete the reserve if the total supply is depleted as well

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

        token.destroy(msg.sender, _sellAmount); // destroy _sellAmount from the caller's balance in the smart token
        assert(_reserveToken.transfer(msg.sender, amount)); // transfer funds to the caller in the reserve token
                                                            // note that it might fail if the actual reserve balance is smaller than the virtual balance
        Change(token, _reserveToken, msg.sender, _sellAmount, amount);
        return amount;
    }

    /**
        @dev utility, returns the expected return for selling the token for one of its reserve tokens, given a total supply override

        @param _reserveToken   reserve token contract address
        @param _sellAmount     amount to sell (in the smart token)
        @param _totalSupply    total token supply, overrides the actual token total supply when calculating the return

        @return sale return amount
    */
    function getSaleReturn(IERC20Token _reserveToken, uint256 _sellAmount, uint256 _totalSupply)
        private
        constant
        active
        validReserve(_reserveToken)
        validAmount(_totalSupply)
        returns (uint256 amount)
    {
        Reserve reserve = reserves[_reserveToken];
        uint256 reserveBalance = getReserveBalance(_reserveToken);
        return formula.calculateSaleReturn(_totalSupply, reserveBalance, reserve.ratio, _sellAmount);
    }
}

Contract Security Audit

Contract ABI

[{"constant":true,"inputs":[{"name":"_reserveToken","type":"address"}],"name":"getReserveBalance","outputs":[{"name":"balance","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_fromToken","type":"address"},{"name":"_toToken","type":"address"},{"name":"_amount","type":"uint256"}],"name":"getReturn","outputs":[{"name":"amount","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_newOwner","type":"address"}],"name":"transferTokenOwnership","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"changerType","outputs":[{"name":"","type":"string"}],"payable":false,"type":"function"},{"constant":false,"inputs":[],"name":"acceptTokenOwnership","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_token","type":"address"},{"name":"_to","type":"address"},{"name":"_amount","type":"uint256"}],"name":"withdrawFromToken","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_reserveToken","type":"address"},{"name":"_ratio","type":"uint8"},{"name":"_enableVirtualBalance","type":"bool"},{"name":"_virtualBalance","type":"uint256"}],"name":"updateReserve","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_amount","type":"uint256"}],"name":"issueTokens","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"formula","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_tokenIndex","type":"uint16"}],"name":"changeableToken","outputs":[{"name":"tokenAddress","type":"address"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"version","outputs":[{"name":"","type":"string"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"changeableTokenCount","outputs":[{"name":"count","type":"uint16"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_token","type":"address"},{"name":"_to","type":"address"},{"name":"_amount","type":"uint256"}],"name":"withdrawTokens","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_fromToken","type":"address"},{"name":"_toToken","type":"address"},{"name":"_amount","type":"uint256"},{"name":"_minReturn","type":"uint256"}],"name":"change","outputs":[{"name":"amount","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_reserveToken","type":"address"},{"name":"_sellAmount","type":"uint256"},{"name":"_minReturn","type":"uint256"}],"name":"sell","outputs":[{"name":"amount","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_reserveToken","type":"address"},{"name":"_sellAmount","type":"uint256"}],"name":"getSaleReturn","outputs":[{"name":"amount","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[],"name":"acceptOwnership","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_disable","type":"bool"}],"name":"disableTokenTransfers","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"reserveTokenCount","outputs":[{"name":"count","type":"uint16"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_reserveToken","type":"address"},{"name":"_depositAmount","type":"uint256"}],"name":"getPurchaseReturn","outputs":[{"name":"amount","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_reserveToken","type":"address"},{"name":"_depositAmount","type":"uint256"},{"name":"_minReturn","type":"uint256"}],"name":"buy","outputs":[{"name":"amount","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_token","type":"address"},{"name":"_ratio","type":"uint8"},{"name":"_enableVirtualBalance","type":"bool"}],"name":"addReserve","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"reserveTokens","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_amount","type":"uint256"}],"name":"destroyTokens","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"newOwner","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"reserves","outputs":[{"name":"virtualBalance","type":"uint256"},{"name":"ratio","type":"uint8"},{"name":"isVirtualBalanceEnabled","type":"bool"},{"name":"isPurchaseEnabled","type":"bool"},{"name":"isSet","type":"bool"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_reserveToken","type":"address"},{"name":"_disable","type":"bool"}],"name":"disableReservePurchases","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_formula","type":"address"}],"name":"setFormula","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"token","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"inputs":[{"name":"_token","type":"address"},{"name":"_formula","type":"address"},{"name":"_reserveToken","type":"address"},{"name":"_reserveRatio","type":"uint8"}],"payable":false,"type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"name":"_fromToken","type":"address"},{"indexed":true,"name":"_toToken","type":"address"},{"indexed":true,"name":"_trader","type":"address"},{"indexed":false,"name":"_amount","type":"uint256"},{"indexed":false,"name":"_return","type":"uint256"}],"name":"Change","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"_prevOwner","type":"address"},{"indexed":false,"name":"_newOwner","type":"address"}],"name":"OwnerUpdate","type":"event"}]

60a0604052600360608190527f302e31000000000000000000000000000000000000000000000000000000000060809081526200003e919081620003b8565b506040805180820190915260068082527f62616e636f72000000000000000000000000000000000000000000000000000060209092019182526200008591600491620003b8565b506008805460ff1916905534156200009957fe5b6040516080806200258883398101604090815281516020830151918301516060909301519092905b5b835b5b5b60008054600160a060020a03191633600160a060020a03161790555b5b80600160a060020a0381161515620000fb5760006000fd5b60028054600160a060020a031916600160a060020a0384161790555b5b50505b82600160a060020a0381161515620001335760006000fd5b60058054600160a060020a031916600160a060020a038681169190911790915583161562000177576200017783836000640100000000620019cd6200018582021704565b5b5b5b50505050506200048f565b60005433600160a060020a039081169116146200019e57fe5b600254604080516000602091820181905282517f8da5cb5b0000000000000000000000000000000000000000000000000000000081529251600160a060020a03308116951693638da5cb5b936004808301949193928390030190829087803b15156200020657fe5b6102c65a03f115156200021557fe5b505060405151600160a060020a0316919091141590506200023257fe5b82600160a060020a03811615156200024a5760006000fd5b8330600160a060020a031681600160a060020a0316141515156200026e5760006000fd5b8360008160ff1611801562000287575060648160ff1611155b1515620002945760006000fd5b600254600160a060020a03878116911614801590620002d65750600160a060020a0386166000908152600760205260409020600101546301000000900460ff16155b8015620002f05750600854606460ff918216870190911611155b1515620002fd5760006000fd5b600160a060020a03861660009081526007602052604081209081556001908101805463010000006201000060ff1990921660ff8a161761ff001916610100891515021762ff000019169190911763ff000000191617905560068054909181016200036883826200043e565b916000526020600020900160005b8154600160a060020a03808b166101009390930a92830292021916179055506008805460ff80821688011660ff199091161790555b5b505b505b505b5b505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10620003fb57805160ff19168380011785556200042b565b828001600101855582156200042b579182015b828111156200042b5782518255916020019190600101906200040e565b5b506200043a9291506200046b565b5090565b815481835581811511620003b257600083815260209020620003b29181019083016200046b565b5b505050565b6200048c91905b808211156200043a576000815560010162000472565b5090565b90565b6120e9806200049f6000396000f3006060604052361561016f5763ffffffff60e060020a60003504166315226b5481146101715780631e1401f81461019f57806321e6b53d146101d65780632ee6f8b6146101f457806338a5e0161461028457806341a5b33d14610296578063466e561f146102bd578063475a9fa9146102e95780634b75f54f1461030a578063503adbf61461033657806354fd4d501461036957806359f8714b146103f95780635e35359e146104205780635e5144eb146104475780636a2724621461048157806372b44b2c146104b557806379ba5097146104e657806385d5e631146104f85780638da5cb5b1461050f5780639b99a8e21461053b578063a2c4c33614610562578063a59ac6dd14610593578063c1596534146105c7578063d031370b146105f0578063d3ce77fe1461061f578063d4ee1d9014610640578063d66bd5241461066c578063e8c78934146106b9578063ecc06c76146106dc578063f2fde38b146106fa578063fc0c546a14610718575bfe5b341561017957fe5b61018d600160a060020a0360043516610744565b60408051918252519081900360200190f35b34156101a757fe5b61018d600160a060020a036004358116906024351660443561082f565b60408051918252519081900360200190f35b34156101de57fe5b6101f2600160a060020a03600435166109d4565b005b34156101fc57fe5b610204610a65565b60408051602080825283518183015283519192839290830191850190808383821561024a575b80518252602083111561024a57601f19909201916020918201910161022a565b505050905090810190601f1680156102765780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561028c57fe5b6101f2610af3565b005b341561029e57fe5b6101f2600160a060020a0360043581169060243516604435610b7b565b005b34156102c557fe5b6101f2600160a060020a036004351660ff602435166044351515606435610c1d565b005b34156102f157fe5b6101f2600160a060020a0360043516602435610d1b565b005b341561031257fe5b61031a610db4565b60408051600160a060020a039092168252519081900360200190f35b341561033e57fe5b61031a61ffff60043516610dc3565b60408051600160a060020a039092168252519081900360200190f35b341561037157fe5b610204610e20565b60408051602080825283518183015283519192839290830191850190808383821561024a575b80518252602083111561024a57601f19909201916020918201910161022a565b505050905090810190601f1680156102765780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561040157fe5b610409610eae565b6040805161ffff9092168252519081900360200190f35b341561042857fe5b6101f2600160a060020a0360043581169060243516604435610ec1565b005b341561044f57fe5b61018d600160a060020a0360043581169060243516604435606435610fbd565b60408051918252519081900360200190f35b341561048957fe5b61018d600160a060020a03600435166024356044356110ee565b60408051918252519081900360200190f35b34156104bd57fe5b61018d600160a060020a03600435166024356113f5565b60408051918252519081900360200190f35b34156104ee57fe5b6101f261147b565b005b341561050057fe5b6101f26004351515611518565b005b341561051757fe5b61031a6115a9565b60408051600160a060020a039092168252519081900360200190f35b341561054357fe5b6104096115b8565b6040805161ffff9092168252519081900360200190f35b341561056a57fe5b61018d600160a060020a03600435166024356115bf565b60408051918252519081900360200190f35b341561059b57fe5b61018d600160a060020a03600435166024356044356117f3565b60408051918252519081900360200190f35b34156105cf57fe5b6101f2600160a060020a036004351660ff6024351660443515156119cd565b005b34156105f857fe5b61031a600435611bf3565b60408051600160a060020a039092168252519081900360200190f35b341561062757fe5b6101f2600160a060020a0360043516602435611c25565b005b341561064857fe5b61031a611cbe565b60408051600160a060020a039092168252519081900360200190f35b341561067457fe5b610688600160a060020a0360043516611ccd565b6040805195865260ff9094166020860152911515848401521515606084015215156080830152519081900360a00190f35b34156106c157fe5b6101f2600160a060020a03600435166024351515611d05565b005b34156106e457fe5b6101f2600160a060020a0360043516611d86565b005b341561070257fe5b6101f2600160a060020a0360043516611e25565b005b341561072057fe5b61031a611e86565b60408051600160a060020a039092168252519081900360200190f35b600160a060020a038116600090815260076020526040812060010154819083906301000000900460ff16151561077a5760006000fd5b600160a060020a03841660009081526007602052604090206001810154909250610100900460ff166108215783600160a060020a03166370a08231306000604051602001526040518263ffffffff1660e060020a0281526004018082600160a060020a0316600160a060020a03168152602001915050602060405180830381600087803b151561080657fe5b6102c65a03f1151561081457fe5b5050604051519050610824565b81545b92505b5b5050919050565b60025460009081908590600160a060020a03808316911614806108745750600160a060020a0381166000908152600760205260409020600101546301000000900460ff165b15156108805760006000fd5b6002548590600160a060020a03808316911614806108c05750600160a060020a0381166000908152600760205260409020600101546301000000900460ff165b15156108cc5760006000fd5b600160a060020a0387811690871614156108e65760006000fd5b600254600160a060020a038781169116141561090d5761090687866115bf565b93506109c8565b600254600160a060020a03888116911614156109345761090686866113f5565b93506109c8565b5b61093f87866115bf565b92506109c586846109c0600260009054906101000a9004600160a060020a0316600160a060020a03166318160ddd6000604051602001526040518163ffffffff1660e060020a028152600401809050602060405180830381600087803b15156109a457fe5b6102c65a03f115156109b257fe5b505060405151905087611e95565b611eaf565b93505b5b505b50509392505050565b60005433600160a060020a039081169116146109ec57fe5b600254604080517ff2fde38b000000000000000000000000000000000000000000000000000000008152600160a060020a0384811660048301529151919092169163f2fde38b91602480830192600092919082900301818387803b1515610a4f57fe5b6102c65a03f11515610a5d57fe5b5050505b5b50565b6004805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610aeb5780601f10610ac057610100808354040283529160200191610aeb565b820191906000526020600020905b815481529060010190602001808311610ace57829003601f168201915b505050505081565b60005433600160a060020a03908116911614610b0b57fe5b600254604080517f79ba50970000000000000000000000000000000000000000000000000000000081529051600160a060020a03909216916379ba50979160048082019260009290919082900301818387803b1515610b6657fe5b6102c65a03f11515610b7457fe5b5050505b5b565b60005433600160a060020a03908116911614610b9357fe5b600254604080517f5e35359e000000000000000000000000000000000000000000000000000000008152600160a060020a03868116600483015285811660248301526044820185905291519190921691635e35359e91606480830192600092919082900301818387803b1515610c0557fe5b6102c65a03f11515610c1357fe5b5050505b5b505050565b6000805433600160a060020a03908116911614610c3657fe5b600160a060020a03851660009081526007602052604090206001015485906301000000900460ff161515610c6a5760006000fd5b8460008160ff16118015610c82575060648160ff1611155b1515610c8e5760006000fd5b600160a060020a03871660009081526007602052604090206001810154600854919450606460ff918216928216929092038801161115610cce5760006000fd5b6001830180546008805460ff928316818416038a01831660ff199182161790915582548815156101000261ff0019938b169190921617919091161790558383555b5b505b505b5050505050565b60005433600160a060020a03908116911614610d3357fe5b600254604080517f867904b4000000000000000000000000000000000000000000000000000000008152600160a060020a038581166004830152602482018590529151919092169163867904b491604480830192600092919082900301818387803b1515610d9d57fe5b6102c65a03f11515610d1457fe5b5050505b5b5050565b600554600160a060020a031681565b600061ffff82161515610de25750600254600160a060020a0316610e1b565b6006805461ffff600019850116908110610df857fe5b906000526020600020900160005b9054906101000a9004600160a060020a031690505b919050565b6003805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610aeb5780601f10610ac057610100808354040283529160200191610aeb565b820191906000526020600020905b815481529060010190602001808311610ace57829003601f168201915b505050505081565b6000610eb86115b8565b60010190505b90565b60005433600160a060020a03908116911614610ed957fe5b82600160a060020a0381161515610ef05760006000fd5b82600160a060020a0381161515610f075760006000fd5b8330600160a060020a031681600160a060020a031614151515610f2a5760006000fd5b85600160a060020a031663a9059cbb86866000604051602001526040518363ffffffff1660e060020a0281526004018083600160a060020a0316600160a060020a0316815260200182815260200192505050602060405180830381600087803b1515610f9257fe5b6102c65a03f11515610fa057fe5b50506040515115159050610c1357fe5b5b5b505b505b505b505050565b60025460009081908690600160a060020a03808316911614806110025750600160a060020a0381166000908152600760205260409020600101546301000000900460ff165b151561100e5760006000fd5b6002548690600160a060020a038083169116148061104e5750600160a060020a0381166000908152600760205260409020600101546301000000900460ff165b151561105a5760006000fd5b600160a060020a0388811690881614156110745760006000fd5b600254600160a060020a038881169116141561109c576110958887876117f3565b93506110e1565b600254600160a060020a03898116911614156110c4576110958787876110ee565b93506110e1565b5b6110d1888760016117f3565b92506110de8784876110ee565b93505b5b505b5050949350505050565b6000808080848181116111015760006000fd5b600254604080516000602091820181905282517f70a08231000000000000000000000000000000000000000000000000000000008152600160a060020a033381166004830152935193909416936370a08231936024808301949391928390030190829087803b151561116f57fe5b6102c65a03f1151561117d57fe5b50506040515188111590506111925760006000fd5b61119c88886113f5565b945084158015906111ad5750858510155b15156111b557fe5b6111be88610744565b9350838511156111ca57fe5b600254604080516000602091820181905282517f18160ddd0000000000000000000000000000000000000000000000000000000081529251600160a060020a03909416936318160ddd9360048082019493918390030190829087803b151561122e57fe5b6102c65a03f1151561123c57fe5b5050604051519350508385108061125257508287145b151561125a57fe5b600160a060020a03881660009081526007602052604090206001810154909250610100900460ff1615611296578154611293908661205b565b82555b600254604080517fa24835d1000000000000000000000000000000000000000000000000000000008152600160a060020a033381166004830152602482018b90529151919092169163a24835d191604480830192600092919082900301818387803b151561130057fe5b6102c65a03f1151561130e57fe5b50505087600160a060020a031663a9059cbb33876000604051602001526040518363ffffffff1660e060020a0281526004018083600160a060020a0316600160a060020a0316815260200182815260200192505050602060405180830381600087803b151561137957fe5b6102c65a03f1151561138757fe5b5050604051511515905061139757fe5b60025460408051898152602081018890528151600160a060020a03338116948d8216949116927f24cee3d6b5651a987362aa6216b9d34a39212f0f1967dfd48c2c3a4fc3c576dc929081900390910190a45b5b505050509392505050565b60006114728383600260009054906101000a9004600160a060020a0316600160a060020a03166318160ddd6000604051602001526040518163ffffffff1660e060020a028152600401809050602060405180830381600087803b151561145757fe5b6102c65a03f1151561146557fe5b5050604051519050611eaf565b90505b92915050565b60015433600160a060020a039081169116146114975760006000fd5b60005460015460408051600160a060020a03938416815292909116602083015280517f343765429aea5a34b3ff6a3785a98a5abb2597aca87bfbb58632c173d585373a9281900390910190a1600180546000805473ffffffffffffffffffffffffffffffffffffffff19908116600160a060020a038416179091551690555b565b60005433600160a060020a0390811691161461153057fe5b600254604080517f1608f18f00000000000000000000000000000000000000000000000000000000815283151560048201529051600160a060020a0390921691631608f18f9160248082019260009290919082900301818387803b1515610a4f57fe5b6102c65a03f11515610a5d57fe5b5050505b5b50565b600054600160a060020a031681565b6006545b90565b600060006000600030600160a060020a0316600260009054906101000a9004600160a060020a0316600160a060020a0316638da5cb5b6000604051602001526040518163ffffffff1660e060020a028152600401809050602060405180830381600087803b151561162c57fe5b6102c65a03f1151561163a57fe5b505060405151600160a060020a031691909114905061165557fe5b600160a060020a03861660009081526007602052604090206001015486906301000000900460ff1615156116895760006000fd5b600160a060020a0387166000908152600760205260409020600181015490945062010000900460ff1615156116be5760006000fd5b600254604080516000602091820181905282517f18160ddd0000000000000000000000000000000000000000000000000000000081529251600160a060020a03909416936318160ddd9360048082019493918390030190829087803b151561172257fe5b6102c65a03f1151561173057fe5b5050604051519350611743905087610744565b6005546001860154604080516000602091820181905282517fa78e887c000000000000000000000000000000000000000000000000000000008152600481018a90526024810187905260ff9094166044850152606484018c90529151949650600160a060020a039093169363a78e887c936084808501949193918390030190829087803b15156117cf57fe5b6102c65a03f115156117dd57fe5b5050604051519550505b5b505b50505092915050565b600080828181116118045760006000fd5b61180e86866115bf565b9250821580159061181f5750838310155b151561182757fe5b600160a060020a03861660009081526007602052604090206001810154909250610100900460ff16156118635781546118609086611e95565b82555b604080516000602091820181905282517f23b872dd000000000000000000000000000000000000000000000000000000008152600160a060020a0333811660048301523081166024830152604482018a90529351938a16936323b872dd9360648084019491938390030190829087803b15156118db57fe5b6102c65a03f115156118e957fe5b505060405151151590506118f957fe5b600254604080517f867904b4000000000000000000000000000000000000000000000000000000008152600160a060020a033381166004830152602482018790529151919092169163867904b491604480830192600092919082900301818387803b151561196357fe5b6102c65a03f1151561197157fe5b505060025460408051888152602081018790528151600160a060020a033381169550938416938b16927f24cee3d6b5651a987362aa6216b9d34a39212f0f1967dfd48c2c3a4fc3c576dc928290030190a45b5b50509392505050565b60005433600160a060020a039081169116146119e557fe5b600254604080516000602091820181905282517f8da5cb5b0000000000000000000000000000000000000000000000000000000081529251600160a060020a03308116951693638da5cb5b936004808301949193928390030190829087803b1515611a4c57fe5b6102c65a03f11515611a5a57fe5b505060405151600160a060020a031691909114159050611a7657fe5b82600160a060020a0381161515611a8d5760006000fd5b8330600160a060020a031681600160a060020a031614151515611ab05760006000fd5b8360008160ff16118015611ac8575060648160ff1611155b1515611ad45760006000fd5b600254600160a060020a03878116911614801590611b155750600160a060020a0386166000908152600760205260409020600101546301000000900460ff16155b8015611b2e5750600854606460ff918216870190911611155b1515611b3a5760006000fd5b600160a060020a03861660009081526007602052604081209081556001908101805463010000006201000060ff1990921660ff8a161761ff001916610100891515021762ff000019169190911763ff00000019161790556006805490918101611ba38382612072565b916000526020600020900160005b8154600160a060020a03808b166101009390930a92830292021916179055506008805460ff80821688011660ff199091161790555b5b505b505b505b5b505050565b6006805482908110611c0157fe5b906000526020600020900160005b915054906101000a9004600160a060020a031681565b60005433600160a060020a03908116911614611c3d57fe5b600254604080517fa24835d1000000000000000000000000000000000000000000000000000000008152600160a060020a038581166004830152602482018590529151919092169163a24835d191604480830192600092919082900301818387803b1515610d9d57fe5b6102c65a03f11515610d1457fe5b5050505b5b5050565b600154600160a060020a031681565b6007602052600090815260409020805460019091015460ff808216916101008104821691620100008204811691630100000090041685565b60005433600160a060020a03908116911614611d1d57fe5b600160a060020a03821660009081526007602052604090206001015482906301000000900460ff161515611d515760006000fd5b600160a060020a0383166000908152600760205260409020600101805462ff00001916831562010000021790555b5b505b5050565b60005433600160a060020a03908116911614611d9e57fe5b80600160a060020a0381161515611db55760006000fd5b8130600160a060020a031681600160a060020a031614151515611dd85760006000fd5b600554600160a060020a0384811691161415611df45760006000fd5b6005805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0385161790555b5b505b505b50565b60005433600160a060020a03908116911614611e3d57fe5b600054600160a060020a0382811691161415611e595760006000fd5b6001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b5b50565b600254600160a060020a031681565b600082820183811015611ea457fe5b8091505b5092915050565b60006000600030600160a060020a0316600260009054906101000a9004600160a060020a0316600160a060020a0316638da5cb5b6000604051602001526040518163ffffffff1660e060020a028152600401809050602060405180830381600087803b1515611f1a57fe5b6102c65a03f11515611f2857fe5b505060405151600160a060020a0316919091149050611f4357fe5b600160a060020a03861660009081526007602052604090206001015486906301000000900460ff161515611f775760006000fd5b8460008111611f865760006000fd5b600160a060020a03881660009081526007602052604090209350611fa988610744565b6005546001860154604080516000602091820181905282517fd39cce1c000000000000000000000000000000000000000000000000000000008152600481018d90526024810187905260ff9094166044850152606484018d90529151949750600160a060020a039093169363d39cce1c936084808501949193918390030190829087803b151561203557fe5b6102c65a03f1151561204357fe5b5050604051519550505b5b505b505b50509392505050565b60008183101561206757fe5b508082035b92915050565b815481835581811511610b7457600083815260209020610b7491810190830161209c565b5b505050565b610ebe91905b808211156120b657600081556001016120a2565b5090565b905600a165627a7a72305820936b3384688a107546870ed1ae8593a5ae8f334196f119286e47d47f0b31bdad00290000000000000000000000001f573d6fb3f13d689ff844b4ce37794d79a7ff1c0000000000000000000000008d10c03bc0889a2edea0de12e455a19ac7395b98000000000000000000000000d76b5c2a23ef78368d8e34288b5b65d616b746ae000000000000000000000000000000000000000000000000000000000000000a

Deployed Bytecode

0x6060604052361561016f5763ffffffff60e060020a60003504166315226b5481146101715780631e1401f81461019f57806321e6b53d146101d65780632ee6f8b6146101f457806338a5e0161461028457806341a5b33d14610296578063466e561f146102bd578063475a9fa9146102e95780634b75f54f1461030a578063503adbf61461033657806354fd4d501461036957806359f8714b146103f95780635e35359e146104205780635e5144eb146104475780636a2724621461048157806372b44b2c146104b557806379ba5097146104e657806385d5e631146104f85780638da5cb5b1461050f5780639b99a8e21461053b578063a2c4c33614610562578063a59ac6dd14610593578063c1596534146105c7578063d031370b146105f0578063d3ce77fe1461061f578063d4ee1d9014610640578063d66bd5241461066c578063e8c78934146106b9578063ecc06c76146106dc578063f2fde38b146106fa578063fc0c546a14610718575bfe5b341561017957fe5b61018d600160a060020a0360043516610744565b60408051918252519081900360200190f35b34156101a757fe5b61018d600160a060020a036004358116906024351660443561082f565b60408051918252519081900360200190f35b34156101de57fe5b6101f2600160a060020a03600435166109d4565b005b34156101fc57fe5b610204610a65565b60408051602080825283518183015283519192839290830191850190808383821561024a575b80518252602083111561024a57601f19909201916020918201910161022a565b505050905090810190601f1680156102765780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561028c57fe5b6101f2610af3565b005b341561029e57fe5b6101f2600160a060020a0360043581169060243516604435610b7b565b005b34156102c557fe5b6101f2600160a060020a036004351660ff602435166044351515606435610c1d565b005b34156102f157fe5b6101f2600160a060020a0360043516602435610d1b565b005b341561031257fe5b61031a610db4565b60408051600160a060020a039092168252519081900360200190f35b341561033e57fe5b61031a61ffff60043516610dc3565b60408051600160a060020a039092168252519081900360200190f35b341561037157fe5b610204610e20565b60408051602080825283518183015283519192839290830191850190808383821561024a575b80518252602083111561024a57601f19909201916020918201910161022a565b505050905090810190601f1680156102765780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b341561040157fe5b610409610eae565b6040805161ffff9092168252519081900360200190f35b341561042857fe5b6101f2600160a060020a0360043581169060243516604435610ec1565b005b341561044f57fe5b61018d600160a060020a0360043581169060243516604435606435610fbd565b60408051918252519081900360200190f35b341561048957fe5b61018d600160a060020a03600435166024356044356110ee565b60408051918252519081900360200190f35b34156104bd57fe5b61018d600160a060020a03600435166024356113f5565b60408051918252519081900360200190f35b34156104ee57fe5b6101f261147b565b005b341561050057fe5b6101f26004351515611518565b005b341561051757fe5b61031a6115a9565b60408051600160a060020a039092168252519081900360200190f35b341561054357fe5b6104096115b8565b6040805161ffff9092168252519081900360200190f35b341561056a57fe5b61018d600160a060020a03600435166024356115bf565b60408051918252519081900360200190f35b341561059b57fe5b61018d600160a060020a03600435166024356044356117f3565b60408051918252519081900360200190f35b34156105cf57fe5b6101f2600160a060020a036004351660ff6024351660443515156119cd565b005b34156105f857fe5b61031a600435611bf3565b60408051600160a060020a039092168252519081900360200190f35b341561062757fe5b6101f2600160a060020a0360043516602435611c25565b005b341561064857fe5b61031a611cbe565b60408051600160a060020a039092168252519081900360200190f35b341561067457fe5b610688600160a060020a0360043516611ccd565b6040805195865260ff9094166020860152911515848401521515606084015215156080830152519081900360a00190f35b34156106c157fe5b6101f2600160a060020a03600435166024351515611d05565b005b34156106e457fe5b6101f2600160a060020a0360043516611d86565b005b341561070257fe5b6101f2600160a060020a0360043516611e25565b005b341561072057fe5b61031a611e86565b60408051600160a060020a039092168252519081900360200190f35b600160a060020a038116600090815260076020526040812060010154819083906301000000900460ff16151561077a5760006000fd5b600160a060020a03841660009081526007602052604090206001810154909250610100900460ff166108215783600160a060020a03166370a08231306000604051602001526040518263ffffffff1660e060020a0281526004018082600160a060020a0316600160a060020a03168152602001915050602060405180830381600087803b151561080657fe5b6102c65a03f1151561081457fe5b5050604051519050610824565b81545b92505b5b5050919050565b60025460009081908590600160a060020a03808316911614806108745750600160a060020a0381166000908152600760205260409020600101546301000000900460ff165b15156108805760006000fd5b6002548590600160a060020a03808316911614806108c05750600160a060020a0381166000908152600760205260409020600101546301000000900460ff165b15156108cc5760006000fd5b600160a060020a0387811690871614156108e65760006000fd5b600254600160a060020a038781169116141561090d5761090687866115bf565b93506109c8565b600254600160a060020a03888116911614156109345761090686866113f5565b93506109c8565b5b61093f87866115bf565b92506109c586846109c0600260009054906101000a9004600160a060020a0316600160a060020a03166318160ddd6000604051602001526040518163ffffffff1660e060020a028152600401809050602060405180830381600087803b15156109a457fe5b6102c65a03f115156109b257fe5b505060405151905087611e95565b611eaf565b93505b5b505b50509392505050565b60005433600160a060020a039081169116146109ec57fe5b600254604080517ff2fde38b000000000000000000000000000000000000000000000000000000008152600160a060020a0384811660048301529151919092169163f2fde38b91602480830192600092919082900301818387803b1515610a4f57fe5b6102c65a03f11515610a5d57fe5b5050505b5b50565b6004805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610aeb5780601f10610ac057610100808354040283529160200191610aeb565b820191906000526020600020905b815481529060010190602001808311610ace57829003601f168201915b505050505081565b60005433600160a060020a03908116911614610b0b57fe5b600254604080517f79ba50970000000000000000000000000000000000000000000000000000000081529051600160a060020a03909216916379ba50979160048082019260009290919082900301818387803b1515610b6657fe5b6102c65a03f11515610b7457fe5b5050505b5b565b60005433600160a060020a03908116911614610b9357fe5b600254604080517f5e35359e000000000000000000000000000000000000000000000000000000008152600160a060020a03868116600483015285811660248301526044820185905291519190921691635e35359e91606480830192600092919082900301818387803b1515610c0557fe5b6102c65a03f11515610c1357fe5b5050505b5b505050565b6000805433600160a060020a03908116911614610c3657fe5b600160a060020a03851660009081526007602052604090206001015485906301000000900460ff161515610c6a5760006000fd5b8460008160ff16118015610c82575060648160ff1611155b1515610c8e5760006000fd5b600160a060020a03871660009081526007602052604090206001810154600854919450606460ff918216928216929092038801161115610cce5760006000fd5b6001830180546008805460ff928316818416038a01831660ff199182161790915582548815156101000261ff0019938b169190921617919091161790558383555b5b505b505b5050505050565b60005433600160a060020a03908116911614610d3357fe5b600254604080517f867904b4000000000000000000000000000000000000000000000000000000008152600160a060020a038581166004830152602482018590529151919092169163867904b491604480830192600092919082900301818387803b1515610d9d57fe5b6102c65a03f11515610d1457fe5b5050505b5b5050565b600554600160a060020a031681565b600061ffff82161515610de25750600254600160a060020a0316610e1b565b6006805461ffff600019850116908110610df857fe5b906000526020600020900160005b9054906101000a9004600160a060020a031690505b919050565b6003805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610aeb5780601f10610ac057610100808354040283529160200191610aeb565b820191906000526020600020905b815481529060010190602001808311610ace57829003601f168201915b505050505081565b6000610eb86115b8565b60010190505b90565b60005433600160a060020a03908116911614610ed957fe5b82600160a060020a0381161515610ef05760006000fd5b82600160a060020a0381161515610f075760006000fd5b8330600160a060020a031681600160a060020a031614151515610f2a5760006000fd5b85600160a060020a031663a9059cbb86866000604051602001526040518363ffffffff1660e060020a0281526004018083600160a060020a0316600160a060020a0316815260200182815260200192505050602060405180830381600087803b1515610f9257fe5b6102c65a03f11515610fa057fe5b50506040515115159050610c1357fe5b5b5b505b505b505b505050565b60025460009081908690600160a060020a03808316911614806110025750600160a060020a0381166000908152600760205260409020600101546301000000900460ff165b151561100e5760006000fd5b6002548690600160a060020a038083169116148061104e5750600160a060020a0381166000908152600760205260409020600101546301000000900460ff165b151561105a5760006000fd5b600160a060020a0388811690881614156110745760006000fd5b600254600160a060020a038881169116141561109c576110958887876117f3565b93506110e1565b600254600160a060020a03898116911614156110c4576110958787876110ee565b93506110e1565b5b6110d1888760016117f3565b92506110de8784876110ee565b93505b5b505b5050949350505050565b6000808080848181116111015760006000fd5b600254604080516000602091820181905282517f70a08231000000000000000000000000000000000000000000000000000000008152600160a060020a033381166004830152935193909416936370a08231936024808301949391928390030190829087803b151561116f57fe5b6102c65a03f1151561117d57fe5b50506040515188111590506111925760006000fd5b61119c88886113f5565b945084158015906111ad5750858510155b15156111b557fe5b6111be88610744565b9350838511156111ca57fe5b600254604080516000602091820181905282517f18160ddd0000000000000000000000000000000000000000000000000000000081529251600160a060020a03909416936318160ddd9360048082019493918390030190829087803b151561122e57fe5b6102c65a03f1151561123c57fe5b5050604051519350508385108061125257508287145b151561125a57fe5b600160a060020a03881660009081526007602052604090206001810154909250610100900460ff1615611296578154611293908661205b565b82555b600254604080517fa24835d1000000000000000000000000000000000000000000000000000000008152600160a060020a033381166004830152602482018b90529151919092169163a24835d191604480830192600092919082900301818387803b151561130057fe5b6102c65a03f1151561130e57fe5b50505087600160a060020a031663a9059cbb33876000604051602001526040518363ffffffff1660e060020a0281526004018083600160a060020a0316600160a060020a0316815260200182815260200192505050602060405180830381600087803b151561137957fe5b6102c65a03f1151561138757fe5b5050604051511515905061139757fe5b60025460408051898152602081018890528151600160a060020a03338116948d8216949116927f24cee3d6b5651a987362aa6216b9d34a39212f0f1967dfd48c2c3a4fc3c576dc929081900390910190a45b5b505050509392505050565b60006114728383600260009054906101000a9004600160a060020a0316600160a060020a03166318160ddd6000604051602001526040518163ffffffff1660e060020a028152600401809050602060405180830381600087803b151561145757fe5b6102c65a03f1151561146557fe5b5050604051519050611eaf565b90505b92915050565b60015433600160a060020a039081169116146114975760006000fd5b60005460015460408051600160a060020a03938416815292909116602083015280517f343765429aea5a34b3ff6a3785a98a5abb2597aca87bfbb58632c173d585373a9281900390910190a1600180546000805473ffffffffffffffffffffffffffffffffffffffff19908116600160a060020a038416179091551690555b565b60005433600160a060020a0390811691161461153057fe5b600254604080517f1608f18f00000000000000000000000000000000000000000000000000000000815283151560048201529051600160a060020a0390921691631608f18f9160248082019260009290919082900301818387803b1515610a4f57fe5b6102c65a03f11515610a5d57fe5b5050505b5b50565b600054600160a060020a031681565b6006545b90565b600060006000600030600160a060020a0316600260009054906101000a9004600160a060020a0316600160a060020a0316638da5cb5b6000604051602001526040518163ffffffff1660e060020a028152600401809050602060405180830381600087803b151561162c57fe5b6102c65a03f1151561163a57fe5b505060405151600160a060020a031691909114905061165557fe5b600160a060020a03861660009081526007602052604090206001015486906301000000900460ff1615156116895760006000fd5b600160a060020a0387166000908152600760205260409020600181015490945062010000900460ff1615156116be5760006000fd5b600254604080516000602091820181905282517f18160ddd0000000000000000000000000000000000000000000000000000000081529251600160a060020a03909416936318160ddd9360048082019493918390030190829087803b151561172257fe5b6102c65a03f1151561173057fe5b5050604051519350611743905087610744565b6005546001860154604080516000602091820181905282517fa78e887c000000000000000000000000000000000000000000000000000000008152600481018a90526024810187905260ff9094166044850152606484018c90529151949650600160a060020a039093169363a78e887c936084808501949193918390030190829087803b15156117cf57fe5b6102c65a03f115156117dd57fe5b5050604051519550505b5b505b50505092915050565b600080828181116118045760006000fd5b61180e86866115bf565b9250821580159061181f5750838310155b151561182757fe5b600160a060020a03861660009081526007602052604090206001810154909250610100900460ff16156118635781546118609086611e95565b82555b604080516000602091820181905282517f23b872dd000000000000000000000000000000000000000000000000000000008152600160a060020a0333811660048301523081166024830152604482018a90529351938a16936323b872dd9360648084019491938390030190829087803b15156118db57fe5b6102c65a03f115156118e957fe5b505060405151151590506118f957fe5b600254604080517f867904b4000000000000000000000000000000000000000000000000000000008152600160a060020a033381166004830152602482018790529151919092169163867904b491604480830192600092919082900301818387803b151561196357fe5b6102c65a03f1151561197157fe5b505060025460408051888152602081018790528151600160a060020a033381169550938416938b16927f24cee3d6b5651a987362aa6216b9d34a39212f0f1967dfd48c2c3a4fc3c576dc928290030190a45b5b50509392505050565b60005433600160a060020a039081169116146119e557fe5b600254604080516000602091820181905282517f8da5cb5b0000000000000000000000000000000000000000000000000000000081529251600160a060020a03308116951693638da5cb5b936004808301949193928390030190829087803b1515611a4c57fe5b6102c65a03f11515611a5a57fe5b505060405151600160a060020a031691909114159050611a7657fe5b82600160a060020a0381161515611a8d5760006000fd5b8330600160a060020a031681600160a060020a031614151515611ab05760006000fd5b8360008160ff16118015611ac8575060648160ff1611155b1515611ad45760006000fd5b600254600160a060020a03878116911614801590611b155750600160a060020a0386166000908152600760205260409020600101546301000000900460ff16155b8015611b2e5750600854606460ff918216870190911611155b1515611b3a5760006000fd5b600160a060020a03861660009081526007602052604081209081556001908101805463010000006201000060ff1990921660ff8a161761ff001916610100891515021762ff000019169190911763ff00000019161790556006805490918101611ba38382612072565b916000526020600020900160005b8154600160a060020a03808b166101009390930a92830292021916179055506008805460ff80821688011660ff199091161790555b5b505b505b505b5b505050565b6006805482908110611c0157fe5b906000526020600020900160005b915054906101000a9004600160a060020a031681565b60005433600160a060020a03908116911614611c3d57fe5b600254604080517fa24835d1000000000000000000000000000000000000000000000000000000008152600160a060020a038581166004830152602482018590529151919092169163a24835d191604480830192600092919082900301818387803b1515610d9d57fe5b6102c65a03f11515610d1457fe5b5050505b5b5050565b600154600160a060020a031681565b6007602052600090815260409020805460019091015460ff808216916101008104821691620100008204811691630100000090041685565b60005433600160a060020a03908116911614611d1d57fe5b600160a060020a03821660009081526007602052604090206001015482906301000000900460ff161515611d515760006000fd5b600160a060020a0383166000908152600760205260409020600101805462ff00001916831562010000021790555b5b505b5050565b60005433600160a060020a03908116911614611d9e57fe5b80600160a060020a0381161515611db55760006000fd5b8130600160a060020a031681600160a060020a031614151515611dd85760006000fd5b600554600160a060020a0384811691161415611df45760006000fd5b6005805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0385161790555b5b505b505b50565b60005433600160a060020a03908116911614611e3d57fe5b600054600160a060020a0382811691161415611e595760006000fd5b6001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383161790555b5b50565b600254600160a060020a031681565b600082820183811015611ea457fe5b8091505b5092915050565b60006000600030600160a060020a0316600260009054906101000a9004600160a060020a0316600160a060020a0316638da5cb5b6000604051602001526040518163ffffffff1660e060020a028152600401809050602060405180830381600087803b1515611f1a57fe5b6102c65a03f11515611f2857fe5b505060405151600160a060020a0316919091149050611f4357fe5b600160a060020a03861660009081526007602052604090206001015486906301000000900460ff161515611f775760006000fd5b8460008111611f865760006000fd5b600160a060020a03881660009081526007602052604090209350611fa988610744565b6005546001860154604080516000602091820181905282517fd39cce1c000000000000000000000000000000000000000000000000000000008152600481018d90526024810187905260ff9094166044850152606484018d90529151949750600160a060020a039093169363d39cce1c936084808501949193918390030190829087803b151561203557fe5b6102c65a03f1151561204357fe5b5050604051519550505b5b505b505b50509392505050565b60008183101561206757fe5b508082035b92915050565b815481835581811511610b7457600083815260209020610b7491810190830161209c565b5b505050565b610ebe91905b808211156120b657600081556001016120a2565b5090565b905600a165627a7a72305820936b3384688a107546870ed1ae8593a5ae8f334196f119286e47d47f0b31bdad0029

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

0000000000000000000000001f573d6fb3f13d689ff844b4ce37794d79a7ff1c0000000000000000000000008d10c03bc0889a2edea0de12e455a19ac7395b98000000000000000000000000d76b5c2a23ef78368d8e34288b5b65d616b746ae000000000000000000000000000000000000000000000000000000000000000a

-----Decoded View---------------
Arg [0] : _token (address): 0x1F573D6Fb3F13d689FF844B4cE37794d79a7FF1C
Arg [1] : _formula (address): 0x8D10C03bC0889A2eDEa0De12e455a19Ac7395B98
Arg [2] : _reserveToken (address): 0xD76b5c2A23ef78368d8E34288B5b65D616B746aE
Arg [3] : _reserveRatio (uint8): 10

-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 0000000000000000000000001f573d6fb3f13d689ff844b4ce37794d79a7ff1c
Arg [1] : 0000000000000000000000008d10c03bc0889a2edea0de12e455a19ac7395b98
Arg [2] : 000000000000000000000000d76b5c2a23ef78368d8e34288b5b65d616b746ae
Arg [3] : 000000000000000000000000000000000000000000000000000000000000000a


Swarm Source

bzzr://936b3384688a107546870ed1ae8593a5ae8f334196f119286e47d47f0b31bdad

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

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

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