Contract Overview
Balance: 63 wei
Ether Value: Less Than $0.01 (@ $122.30/ETH)
Transactions: 23 txns
Misc:
Address Watch: Add To Watch List
Contract Creator: 0xc4af56cd5254aef959d4bce2f75874007808b701at txn 0x0eca65c8457f60599d55dfe8554e9232b824eba714d941d318660d7e691629af
 Latest 23 txns

TxHash Age From To Value [TxFee]
0x82b18d18d175e4b75c0d144c0f3933f4a6e5e288ca2467dbba8c80bf44e2645e726 days 3 hrs ago0x45689bac94edae26625521f1361748119f05fc30  IN   0x406a65de7a2e94ef19597a79296e269fada85a710 Ether0.001251156
0xba77d63f7cbe876d17e58c51913f0f90ddd00054c2729911a99b3bf3963f7837726 days 4 hrs ago0xaa3f29601a1331745e05c42830a15e71938a6237  IN   0x406a65de7a2e94ef19597a79296e269fada85a7154.5 Ether0.00097238
0x020e864cc410876b0aab4961a47cd9d3bce921fb948b4a621a7cec9f31cb1512726 days 5 hrs ago0x286ff78b23407f502da3e99606bf2c5033f871b5  IN   0x406a65de7a2e94ef19597a79296e269fada85a71201.00841931 Ether0.00224807
0x997c4ee122a52429f0049e3272a941eb0cea504e35393a5f6e6336972303481e726 days 5 hrs ago0xac08cdbd8adf34f1bf8809245a23ef669023a7b0  IN   0x406a65de7a2e94ef19597a79296e269fada85a71313.55135674017336 Ether0.001675834
0x87b7d3317e256cc95b973679953cc07e689ee922d41ceec4a07ab7b87afbbf1e726 days 5 hrs ago0xac08cdbd8adf34f1bf8809245a23ef669023a7b0  IN   0x406a65de7a2e94ef19597a79296e269fada85a711 Ether0.002290834
0xbd38e32ba0145ad1a62089c15308e08bbd6f0089b4867ad03165e75b69c420ec792 days 12 hrs ago0x45689bac94edae26625521f1361748119f05fc30  IN   0x406a65de7a2e94ef19597a79296e269fada85a710 Ether0.0013346816
0x54ea022ab630a3c8fae3cd70dd56e13004e9a47da260aac0da5b762a7c2e7046792 days 12 hrs ago0x45689bac94edae26625521f1361748119f05fc30  IN   0x406a65de7a2e94ef19597a79296e269fada85a710 Ether0.00295298304
0xef49e021ad7d08299847a0e6c1af8f64aaa7bf32394b2628c13d3e1827211a04792 days 12 hrs ago0x45689bac94edae26625521f1361748119f05fc30  IN   0x406a65de7a2e94ef19597a79296e269fada85a710 Ether0.0016782304
0x69572b2e7f4edd2798241b5a4f1223abefd94cdf074a3cd574615aec6ee9b562793 days 13 hrs ago0xede8faa3cd51379798b09ff638cd8f19fd5bd048  IN   0x406a65de7a2e94ef19597a79296e269fada85a711.06 Ether0.002521788
0x13348249cb6b0976e13fcb383861264b2b257dff4ae10433d786353d17afe436793 days 13 hrs ago0xede8faa3cd51379798b09ff638cd8f19fd5bd048  IN   0x406a65de7a2e94ef19597a79296e269fada85a710.01 Ether0.003507462
0x49ac750fd98bbfb99d19ef956f99f2e2144d8c0e91589a81db0fd20a642fb241794 days 1 hr ago0xc214d5c896f95477b2cf96ee780529c3aaaf9717  IN   0x406a65de7a2e94ef19597a79296e269fada85a710.0021 Ether0.002603136
0x3c3bddeda9f14b7628803d5f944ae4af3cff7dd555c3523ba55bee54668c8c2a794 days 1 hr ago0xc214d5c896f95477b2cf96ee780529c3aaaf9717  IN   0x406a65de7a2e94ef19597a79296e269fada85a710.0019 Ether0.002603136
0x4ba7ea61d600f26c2668d0cdf0241e8ea090ca8936263523f703ce09551ba4c7794 days 1 hr ago0xc214d5c896f95477b2cf96ee780529c3aaaf9717  IN   0x406a65de7a2e94ef19597a79296e269fada85a710.015 Ether0.002603136
0x88f2e78a0169789e898be6a9ac3f35834baf33b5fab81423d99f3c4edd744fc6794 days 4 hrs ago0x006b25a7c3d738fef719a2cbcebe088eba405443  IN   0x406a65de7a2e94ef19597a79296e269fada85a7120 Ether0.008127478673
0x5b66980f7af7ec0d938b5e1dc98cd44c0ceca3f796aded8722118ca3c089a6ee794 days 4 hrs ago0x006b25a7c3d738fef719a2cbcebe088eba405443  IN   0x406a65de7a2e94ef19597a79296e269fada85a7125 Ether0.0081348
0xd7c4ece68d278e5868909a33d7f9ddc5e4e3244a2216dd97ea6f66216258cf62794 days 4 hrs ago0x006b25a7c3d738fef719a2cbcebe088eba405443  IN   0x406a65de7a2e94ef19597a79296e269fada85a7120 Ether0.0081348
0xfa75959a22bdcc1c494ce6a39327271fbcfa6989724498038a9f52178333fb98794 days 4 hrs ago0x5cf6584dafa1e407031feb491ca573449878c1f9  IN   0x406a65de7a2e94ef19597a79296e269fada85a7110 Ether0.002603136
0xe9527f913b4724abd6265f45699ba6b3a0c0aff2acad0e6252ab24aba2806065794 days 4 hrs ago0x006b25a7c3d738fef719a2cbcebe088eba405443  IN   0x406a65de7a2e94ef19597a79296e269fada85a7110 Ether0.0081348
0x13e63bc8e4e66f9a35b1ef8938b8fc8940e5bd963aad872ff568da3a6020a3d4794 days 4 hrs ago0x5cf6584dafa1e407031feb491ca573449878c1f9  IN   0x406a65de7a2e94ef19597a79296e269fada85a711 Ether0.003563136
0x36ad9a3926e0ff95bbac0ce5f2ed55c8c9d6bda81bd1227a9aea45cd31bf50bb794 days 4 hrs ago0x006b25a7c3d738fef719a2cbcebe088eba405443  IN   0x406a65de7a2e94ef19597a79296e269fada85a711 Ether0.0111348
0x9987fd84cf826d086bfd7660b1e7c60d76e5b4692e92686458b7505fa722b924794 days 4 hrs ago0x2cc929f852b31a026f818e0ba0cf265713825715  IN   0x406a65de7a2e94ef19597a79296e269fada85a7125 Ether0.002603136
0xe315dc1e8ccfb6d509cf7ed3ceb80aa35cf5f632202c6bc2dfb864554bfbb9c9794 days 6 hrs ago0xc046b59484843b2af6ca105afd88a3ab60e9b7cd  IN   0x406a65de7a2e94ef19597a79296e269fada85a717.7 Ether0.002603136
0xccb9bdb1e3f5f0c1f0acb2da02a5fe17fab8ff64b50585c000f04e924a108dc1794 days 6 hrs ago0xc046b59484843b2af6ca105afd88a3ab60e9b7cd  IN   0x406a65de7a2e94ef19597a79296e269fada85a710.5 Ether0.002603136
[ Download CSV Export  ] 
 Internal Transactions as a result of Contract Execution
 Latest 4 Internal Transactions

ParentTxHash Block Age From To Value
0x82b18d18d175e4b75c0d144c0f3933f4a6e5e288ca2467dbba8c80bf44e2645e3037500726 days 3 hrs ago0x406a65de7a2e94ef19597a79296e269fada85a710x45689bac94edae26625521f1361748119f05fc30570 Ether
0xba77d63f7cbe876d17e58c51913f0f90ddd00054c2729911a99b3bf3963f78373037051726 days 4 hrs ago0x406a65de7a2e94ef19597a79296e269fada85a710xaa3f29601a1331745e05c42830a15e71938a62370.05977605017336066 Ether
0xef49e021ad7d08299847a0e6c1af8f64aaa7bf32394b2628c13d3e1827211a042635709792 days 12 hrs ago0x406a65de7a2e94ef19597a79296e269fada85a710x45689bac94edae26625521f1361748119f05fc30121.289 Ether
0x0eca65c8457f60599d55dfe8554e9232b824eba714d941d318660d7e691629af2624456794 days 9 hrs ago0xc4af56cd5254aef959d4bce2f75874007808b701  Contract Creation0 Ether
[ Download CSV Export  ] 
Contract Name: TokenTrader
Compiler Text: v0.4.0+commit.acd334c9
Optimization Enabled: No
Runs (Optimiser):  200



  Contract Source Code   Find Similiar Contracts

pragma solidity ^0.4.0;

//https://github.com/nexusdev/erc20/blob/master/contracts/erc20.sol

contract ERC20Constant {
    function balanceOf( address who ) constant returns (uint value);
}
contract ERC20Stateful {
    function transfer( address to, uint value) returns (bool ok);
}
contract ERC20Events {
    event Transfer(address indexed from, address indexed to, uint value);
}
contract ERC20 is ERC20Constant, ERC20Stateful, ERC20Events {}

contract owned {
    address public owner;

    function owned() {
        owner = msg.sender;
    }

    modifier onlyOwner {
        if (msg.sender != owner) throw;
        _;
    }

    function transferOwnership(address newOwner) onlyOwner {
        owner = newOwner;
    }
}

// contract can sell tokens for ETH
// prices are in amount of wei per batch of token units

contract TokenTrader is owned {

    address public asset;       // address of token
    uint256 public sellPrice;   // contract sells lots of tokens at this price
    uint256 public units;       // lot size (token-wei)

    bool public sellsTokens;    // is contract selling

    event ActivatedEvent(bool sells);
    event UpdateEvent();

    function TokenTrader (
        address _asset, 
        uint256 _sellPrice, 
        uint256 _units,
        bool    _sellsTokens
        )
    {
          asset         = _asset; 
          sellPrice    = _sellPrice;
          units         = _units; 
          sellsTokens   = _sellsTokens;

          ActivatedEvent(sellsTokens);
    }

    // modify trading behavior
    function activate (
        bool    _sellsTokens
        ) onlyOwner
    {
          sellsTokens   = _sellsTokens;

          ActivatedEvent(sellsTokens);
    }

    // allow owner to remove trade token
    function withdrawAsset(uint256 _value) onlyOwner returns (bool ok)
    {
        return ERC20(asset).transfer(owner,_value);
        UpdateEvent();
    }

    // allow owner to remove arbitrary tokens
    // included just in case contract receives wrong token
    function withdrawToken(address _token, uint256 _value) onlyOwner returns (bool ok)
    {
        return ERC20(_token).transfer(owner,_value);
        UpdateEvent();
    }

    // allow owner to remove ETH
    function withdraw(uint256 _value) onlyOwner returns (bool ok)
    {
        if(this.balance >= _value) {
            return owner.send(_value);
        }
        UpdateEvent();
    }

    //user buys token with ETH
    function buy() payable {
        if(sellsTokens || msg.sender == owner) 
        {
            uint order   = msg.value / sellPrice; 
            uint can_sell = ERC20(asset).balanceOf(address(this)) / units;

            if(order > can_sell)
            {
                uint256 change = msg.value - (can_sell * sellPrice);
                order = can_sell;
                if(!msg.sender.send(change)) throw;
            }

            if(order > 0) {
                if(!ERC20(asset).transfer(msg.sender,order * units)) throw;
            }
            UpdateEvent();
        }
        else if(!msg.sender.send(msg.value)) throw;  // return user funds if the contract is not selling
    }

    // sending ETH to contract sells GNT to user
    function () payable {
        buy();
    }
}

// This contract deploys TokenTrader contracts and logs the event
// trade pairs are identified with sha3(asset,units)

contract TokenTraderFactory {

    event TradeListing(bytes32 bookid, address owner, address addr);
    event NewBook(bytes32 bookid, address asset, uint256 units);

    mapping( address => bool ) _verify;
    mapping( bytes32 => bool ) pairExits;

    function verify(address tradeContract)  constant returns (
        bool valid,
        address asset, 
        uint256 sellPrice, 
        uint256 units,
        bool    sellsTokens
        ) {

            valid = _verify[tradeContract];

            if(valid) {
                TokenTrader t = TokenTrader(tradeContract);

                asset = t.asset();
                sellPrice = t.sellPrice();
                units = t.units();
                sellsTokens = t.sellsTokens();
            }

    }

    function createTradeContract(       
        address _asset, 
        uint256 _sellPrice, 
        uint256 _units,
        bool    _sellsTokens
        ) returns (address) 
    {
        if(_units == 0) throw;              // can't sell zero units

        address trader = new TokenTrader (
                     _asset, 
                     _sellPrice, 
                     _units,
                     _sellsTokens);

        var bookid = sha3(_asset,_units);

        _verify[trader] = true; // record that this factory created the trader

        TokenTrader(trader).transferOwnership(msg.sender); // set the owner to whoever called the function

        if(pairExits[bookid] == false) {
            pairExits[bookid] = true;
            NewBook(bookid, _asset, _units);
        }

        TradeListing(bookid,msg.sender,trader);
    }

    function () {
        throw;     // Prevents accidental sending of ether to the factory
    }
}

    Contract ABI  
[{"constant":false,"inputs":[{"name":"_value","type":"uint256"}],"name":"withdraw","outputs":[{"name":"ok","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"asset","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"sellPrice","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"sellsTokens","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_value","type":"uint256"}],"name":"withdrawAsset","outputs":[{"name":"ok","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"units","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_token","type":"address"},{"name":"_value","type":"uint256"}],"name":"withdrawToken","outputs":[{"name":"ok","type":"bool"}],"payable":false,"type":"function"},{"constant":false,"inputs":[],"name":"buy","outputs":[],"payable":true,"type":"function"},{"constant":false,"inputs":[{"name":"_sellsTokens","type":"bool"}],"name":"activate","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"type":"function"},{"inputs":[{"name":"_asset","type":"address"},{"name":"_sellPrice","type":"uint256"},{"name":"_units","type":"uint256"},{"name":"_sellsTokens","type":"bool"}],"type":"constructor"},{"payable":true,"type":"fallback"},{"anonymous":false,"inputs":[{"indexed":false,"name":"sells","type":"bool"}],"name":"ActivatedEvent","type":"event"},{"anonymous":false,"inputs":[],"name":"UpdateEvent","type":"event"}]

  Contract Creation Code Switch To Opcodes View
6060604052604051608080610c47833981016040528080519060200190919080519060200190919080519060200190919080519060200190919050505b5b33600060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908302179055505b83600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff02191690830217905550826002600050819055508160036000508190555080600460006101000a81548160ff021916908302179055507fce78b7525a161aee9986871a8dcad7e2783f9a4d66383783243cf14ec7086f85600460009054906101000a900460ff1660405180821515815260200191505060405180910390a15b50505050610b2c8061011b6000396000f3606060405236156100ab576000357c0100000000000000000000000000000000000000000000000000000000900480632e1a7d4d146100bc57806338d52e0f146100ef5780634b7503341461012d5780634ca50f59146101555780638d92fdf31461017f5780638da5cb5b146101b2578063976a8435146101f05780639e281a9814610218578063a6f2ae3a14610254578063ce5e84a314610263578063f2fde38b14610280576100ab565b6100ba5b6100b761029d565b5b565b005b34610002576100d76004808035906020019091905050610590565b60405180821515815260200191505060405180910390f35b346100025761010160048050506106a5565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b346100025761013f60048050506106cb565b6040518082815260200191505060405180910390f35b346100025761016760048050506106d4565b60405180821515815260200191505060405180910390f35b346100025761019a60048080359060200190919050506106e7565b60405180821515815260200191505060405180910390f35b34610002576101c4600480505061085c565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34610002576102026004805050610882565b6040518082815260200191505060405180910390f35b346100025761023c600480803590602001909190803590602001909190505061088b565b60405180821515815260200191505060405180910390f35b610261600480505061029d565b005b346100025761027e60048080359060200190919050506109df565b005b346100025761029b6004808035906020019091905050610aa0565b005b600060006000600460009054906101000a900460ff168061030b5750600060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16145b156105465760026000505434811561000257049250600360005054600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166370a0823130604051827c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b156100025760325a03f11561000257505050604051805190602001508115610002570491508183111561043d5760026000505482023403905081925082503373ffffffffffffffffffffffffffffffffffffffff166108fc829081150290604051809050600060405180830381858888f19350505050151561043c57610002565b5b600083111561051257600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb336003600050548602604051837c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b156100025760325a03f1156100025750505060405180519060200150151561051157610002565b5b7f36ff37f436d9a671f4776bd73e3be89800c29518da3abc0618ef2b18c707481f60405180905060405180910390a161058a565b3373ffffffffffffffffffffffffffffffffffffffff166108fc349081150290604051809050600060405180830381858888f19350505050151561058957610002565b5b5b505050565b6000600060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156105ee57610002565b813073ffffffffffffffffffffffffffffffffffffffff163110151561066f57600060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166108fc839081150290604051809050600060405180830381858888f19350505050905061069f565b7f36ff37f436d9a671f4776bd73e3be89800c29518da3abc0618ef2b18c707481f60405180905060405180910390a15b5b919050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60026000505481565b600460009054906101000a900460ff1681565b6000600060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614151561074557610002565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb600060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684604051837c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b156100025760325a03f11561000257505050604051805190602001509050610856567f36ff37f436d9a671f4776bd73e3be89800c29518da3abc0618ef2b18c707481f60405180905060405180910390a15b5b919050565b600060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60036000505481565b6000600060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156108e957610002565b8273ffffffffffffffffffffffffffffffffffffffff1663a9059cbb600060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1684604051837c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b156100025760325a03f115610002575050506040518051906020015090506109d8567f36ff37f436d9a671f4776bd73e3be89800c29518da3abc0618ef2b18c707481f60405180905060405180910390a15b5b92915050565b600060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610a3b57610002565b80600460006101000a81548160ff021916908302179055507fce78b7525a161aee9986871a8dcad7e2783f9a4d66383783243cf14ec7086f85600460009054906101000a900460ff1660405180821515815260200191505060405180910390a15b5b50565b600060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610afc57610002565b80600060006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908302179055505b5b5056000000000000000000000000a74476443119a942de498590fe1f2454d7d4ac0d00000000000000000000000000000000000000000000000000000000000007be00000000000000000000000000000000000000000000000000000000000f42400000000000000000000000000000000000000000000000000000000000000001

 

View All
Block Age transaction Difficulty GasUsed Reward
View All
Block Age UncleNumber Difficulty GasUsed Reward
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.