Sponsored Link:   Synapse - Decentralized Data & AI Marketplace. TOKEN SALE LIVE - Save 50%.
Contract Overview
ETH Balance: 0 Ether
ETH USD Value: $0
No Of Transactions: 5298 txns
  Latest 25 txns from a total Of 5298 transactions View All

TxHash Age From To Value [TxFee]
0xa55fe01905cb08201a4dff2e6c17f8df5e368246637c81ff288f05000876ad5c248 days 22 hrs ago0xdb33dfd3d61308c33c63209845dad3e6bfb2c674  IN   0xa1b5eedc73a978d181d1ea322ba20f0474bb2a250 Ether0.00098458
0xb07c2b8d1f19c01d860b1e250ef263a68a296234c30b6b2c49359861307537fb248 days 22 hrs ago0xdb33dfd3d61308c33c63209845dad3e6bfb2c674  IN   0xa1b5eedc73a978d181d1ea322ba20f0474bb2a250 Ether0.00098458
0x4d84cc09c4ba8904177d1ca8e8fba2163190521fafed073c2925056995576853248 days 22 hrs ago0xdb33dfd3d61308c33c63209845dad3e6bfb2c674  IN   0xa1b5eedc73a978d181d1ea322ba20f0474bb2a250 Ether0.00098458
0xd471e1d6b268e68287d07d1cab1cf2ba2a2605b479bc3851cb593b813f6c1b7a248 days 22 hrs ago0xdb33dfd3d61308c33c63209845dad3e6bfb2c674  IN   0xa1b5eedc73a978d181d1ea322ba20f0474bb2a250 Ether0.00146294
0x9efcbad8350762fec0110d65ccdc6d334830d981abc283cf76ba013937ea88cb248 days 22 hrs ago0xdb33dfd3d61308c33c63209845dad3e6bfb2c674  IN   0xa1b5eedc73a978d181d1ea322ba20f0474bb2a250 Ether0.00131294
0x32bb722faf457719b5ac357e071fa79f26044a6597e147de423f7b702572182f248 days 22 hrs ago0xdb33dfd3d61308c33c63209845dad3e6bfb2c674  IN   0xa1b5eedc73a978d181d1ea322ba20f0474bb2a250 Ether0.00131294
0xe01ca97a4ef374569c8b633d71b374c47860f59ef48d90a88780ffc83413699b248 days 22 hrs ago0xdb33dfd3d61308c33c63209845dad3e6bfb2c674  IN   0xa1b5eedc73a978d181d1ea322ba20f0474bb2a250 Ether0.00098458
0xf8661b29f305ccef53865defc312173b5aa0b4585d1ba574b1f5e8eea0e8b554248 days 22 hrs ago0x560a17b8687b9701d027b42953c2954118eafc7d  IN   0xa1b5eedc73a978d181d1ea322ba20f0474bb2a250 Ether0.0024
0x8507708d40946bde79a74e95494100d09e799864c08686cfebb0ebbf135f5b12248 days 22 hrs ago0x560a17b8687b9701d027b42953c2954118eafc7d  IN   0xa1b5eedc73a978d181d1ea322ba20f0474bb2a250 Ether0.0018
0xbdad9178bf7e3a8cdf280ef48205630f7e026819b9a3d54da76e824d699aec92248 days 22 hrs ago0x9c557d9639c71b7fa679909fdbe4810610bdd8bc  IN   0xa1b5eedc73a978d181d1ea322ba20f0474bb2a250 Ether0.023517603128
0xfdbf5971f439d7cd5e2c75cdb7606966d4c8a396a5c29919fe62ae13f1976763248 days 22 hrs ago0xc4963e94d919651857c4e11e3424e0554e827f7e  IN   0xa1b5eedc73a978d181d1ea322ba20f0474bb2a250 Ether0.02
0xb40ff25a0613db59d4f61873e62f4ef4e1e2b5ce599f7ca562d74c13aff50b2f248 days 22 hrs ago0xdb33dfd3d61308c33c63209845dad3e6bfb2c674  IN   0xa1b5eedc73a978d181d1ea322ba20f0474bb2a250 Ether0.00098896
0x9132e056843ec492f00b6fa2586da2ad0dccfe88577af3e129a381fd85f9ebf6248 days 22 hrs ago0x9c557d9639c71b7fa679909fdbe4810610bdd8bc  IN   0xa1b5eedc73a978d181d1ea322ba20f0474bb2a250 Ether0.001163651002
0xdd0b9bbd37a9898917fc6d334d3716bd12aecbd35997a5260fa12e5079c4f54e248 days 22 hrs ago0x9c557d9639c71b7fa679909fdbe4810610bdd8bc  IN   0xa1b5eedc73a978d181d1ea322ba20f0474bb2a250 Ether0.001163651002
0xd9d74f94f5d746e4973681a4b35839f8aff1d7c234fcb4746103eaa8ad297989248 days 22 hrs ago0xc4963e94d919651857c4e11e3424e0554e827f7e  IN   0xa1b5eedc73a978d181d1ea322ba20f0474bb2a250 Ether0.02
0x10ae6f7e4bcb13c5c834063f9ec6e77fa7081db2d40dc77389f0541c2604a642248 days 22 hrs ago0x9c557d9639c71b7fa679909fdbe4810610bdd8bc  IN   0xa1b5eedc73a978d181d1ea322ba20f0474bb2a250 Ether0.001173886012
0x19b8e61011ad24c6ede6890b649aba4bee19148ed032ec6d6b04fb232df09a84248 days 22 hrs ago0xdb33dfd3d61308c33c63209845dad3e6bfb2c674  IN   0xa1b5eedc73a978d181d1ea322ba20f0474bb2a250 Ether0.02
0xc92008f28e34d271185cbea9df552a48d703b629f97b969765081c5add62b7bc248 days 22 hrs ago0xc4963e94d919651857c4e11e3424e0554e827f7e  IN   0xa1b5eedc73a978d181d1ea322ba20f0474bb2a250 Ether0.02
0xb0b4ac7227cef0a737d24745bcee50cf850091a8a6f1da4ba4590023fa58e698248 days 22 hrs ago0xc4963e94d919651857c4e11e3424e0554e827f7e  IN   0xa1b5eedc73a978d181d1ea322ba20f0474bb2a250 Ether0.0009896
0xf9443d3d6ed3b7585bdd371c47f422e6c3ef901dbe56c03500de9992b79068a2248 days 22 hrs ago0xc4963e94d919651857c4e11e3424e0554e827f7e  IN   0xa1b5eedc73a978d181d1ea322ba20f0474bb2a250 Ether0.02
0x82598ee3da2f3dbfd2f4d3e6e558dd2a072f97ebfa9377dd727d5d859cf5fa90248 days 22 hrs ago0x9c557d9639c71b7fa679909fdbe4810610bdd8bc  IN   0xa1b5eedc73a978d181d1ea322ba20f0474bb2a250 Ether0.001154407542
0x42f850ec157c50943ff8991f4efe4bf75bb38c1bb35300b2250a0c827ea7f4be248 days 22 hrs ago0x9c557d9639c71b7fa679909fdbe4810610bdd8bc  IN   0xa1b5eedc73a978d181d1ea322ba20f0474bb2a250 Ether0.001165503132
0x3ad556ee80eedf93b996cddd56b33379d876b9babe135a3020852f1c16faef58248 days 22 hrs ago0x9c557d9639c71b7fa679909fdbe4810610bdd8bc  IN   0xa1b5eedc73a978d181d1ea322ba20f0474bb2a250 Ether0.001188423187
0x666949fd1eb2eda729d96576b424d55f8c5eddcf0d6ff9f885c63256d73b02bb248 days 22 hrs ago0x9c557d9639c71b7fa679909fdbe4810610bdd8bc  IN   0xa1b5eedc73a978d181d1ea322ba20f0474bb2a250 Ether0.001077934864
0x2f5890cf93c85b5462a2f59ad3ed4efa01dc78a14c3eb07b3fa07cedf4014099248 days 22 hrs ago0x9c557d9639c71b7fa679909fdbe4810610bdd8bc  IN   0xa1b5eedc73a978d181d1ea322ba20f0474bb2a250 Ether0.001112526214
[ Download CSV Export  ] 
 Internal Transactions as a result of Contract Execution
View All
ParentTxHash Block Age From To Value
Contract Name: ExpiringMarket
Compiler Version: v0.4.4+commit.4633f3de
Optimization Enabled: Yes
Runs (Optimiser):  200



  Contract Source Code   Find Similiar Contracts
pragma solidity ^0.4.2;

// Token standard API
// https://github.com/ethereum/EIPs/issues/20
contract ERC20Constant {
    function totalSupply() constant returns (uint supply);
    function balanceOf( address who ) constant returns (uint value);
    function allowance(address owner, address spender) constant returns (uint _allowance);
}
contract ERC20Stateful {
    function transfer( address to, uint value) returns (bool ok);
    function transferFrom( address from, address to, uint value) returns (bool ok);
    function approve(address spender, uint value) returns (bool ok);
}
contract ERC20Events {
    event Transfer(address indexed from, address indexed to, uint value);
    event Approval( address indexed owner, address indexed spender, uint value);
}
contract ERC20 is ERC20Constant, ERC20Stateful, ERC20Events {}

contract Assertive {
    function assert(bool assertion) internal {
        if (!assertion) throw;
    }
}

contract FallbackFailer {
  function () {
    throw;
  }
}

contract MutexUser {
    bool private lock;
    modifier exclusive {
        if (lock) throw;
        lock = true;
        _;
        lock = false;
    }
}

// A simple direct exchange order manager.

contract EventfulMarket {
    event ItemUpdate( uint id );
    event Trade( uint sell_how_much, address indexed sell_which_token,
                 uint buy_how_much, address indexed buy_which_token );
}

contract SimpleMarket is EventfulMarket
                       , Assertive
                       , FallbackFailer
                       , MutexUser
{
    struct OfferInfo {
        uint sell_how_much;
        ERC20 sell_which_token;
        uint buy_how_much;
        ERC20 buy_which_token;
        address owner;
        bool active;
    }
    mapping( uint => OfferInfo ) public offers;

    uint public last_offer_id;

    function next_id() internal returns (uint) {
        last_offer_id++; return last_offer_id;
    }

    modifier can_offer {
        _;
    }
    modifier can_buy(uint id) {
        assert(isActive(id));
        _;
    }
    modifier can_cancel(uint id) {
        assert(isActive(id));
        assert(getOwner(id) == msg.sender);
        _;
    }
    function isActive(uint id) constant returns (bool active) {
        return offers[id].active;
    }
    function getOwner(uint id) constant returns (address owner) {
        return offers[id].owner;
    }
    function getOffer( uint id ) constant returns (uint, ERC20, uint, ERC20) {
      var offer = offers[id];
      return (offer.sell_how_much, offer.sell_which_token,
              offer.buy_how_much, offer.buy_which_token);
    }

    // non underflowing subtraction
    function safeSub(uint a, uint b) internal returns (uint) {
        assert(b <= a);
        return a - b;
    }
    // non overflowing multiplication
    function safeMul(uint a, uint b) internal returns (uint c) {
        c = a * b;
        assert(a == 0 || c / a == b);
    }

    function trade( address seller, uint sell_how_much, ERC20 sell_which_token,
                    address buyer,  uint buy_how_much,  ERC20 buy_which_token )
        internal
    {
        var seller_paid_out = buy_which_token.transferFrom( buyer, seller, buy_how_much );
        assert(seller_paid_out);
        var buyer_paid_out = sell_which_token.transfer( buyer, sell_how_much );
        assert(buyer_paid_out);
        Trade( sell_how_much, sell_which_token, buy_how_much, buy_which_token );
    }

    // ---- Public entrypoints ---- //

    // Make a new offer. Takes funds from the caller into market escrow.
    function offer( uint sell_how_much, ERC20 sell_which_token
                  , uint buy_how_much,  ERC20 buy_which_token )
        can_offer
        exclusive
        returns (uint id)
    {
        assert(sell_how_much > 0);
        assert(sell_which_token != ERC20(0x0));
        assert(buy_how_much > 0);
        assert(buy_which_token != ERC20(0x0));
        assert(sell_which_token != buy_which_token);

        OfferInfo memory info;
        info.sell_how_much = sell_how_much;
        info.sell_which_token = sell_which_token;
        info.buy_how_much = buy_how_much;
        info.buy_which_token = buy_which_token;
        info.owner = msg.sender;
        info.active = true;
        id = next_id();
        offers[id] = info;

        var seller_paid = sell_which_token.transferFrom( msg.sender, this, sell_how_much );
        assert(seller_paid);

        ItemUpdate(id);
    }
    // Accept given `quantity` of an offer. Transfers funds from caller to
    // offer maker, and from market to caller.
    function buy( uint id, uint quantity )
        can_buy(id)
        exclusive
        returns ( bool success )
    {
        // read-only offer. Modify an offer by directly accessing offers[id]
        OfferInfo memory offer = offers[id];

        // inferred quantity that the buyer wishes to spend
        uint spend = safeMul(quantity, offer.buy_how_much) / offer.sell_how_much;

        if ( spend > offer.buy_how_much || quantity > offer.sell_how_much ) {
            // buyer wants more than is available
            success = false;
        } else if ( spend == offer.buy_how_much && quantity == offer.sell_how_much ) {
            // buyer wants exactly what is available
            delete offers[id];

            trade( offer.owner, quantity, offer.sell_which_token,
                   msg.sender, spend, offer.buy_which_token );

            ItemUpdate(id);
            success = true;
        } else if ( spend > 0 && quantity > 0 ) {
            // buyer wants a fraction of what is available
            offers[id].sell_how_much = safeSub(offer.sell_how_much, quantity);
            offers[id].buy_how_much = safeSub(offer.buy_how_much, spend);

            trade( offer.owner, quantity, offer.sell_which_token,
                    msg.sender, spend, offer.buy_which_token );

            ItemUpdate(id);
            success = true;
        } else {
            // buyer wants an unsatisfiable amount (less than 1 integer)
            success = false;
        }
    }
    // Cancel an offer. Refunds offer maker.
    function cancel( uint id )
        can_cancel(id)
        exclusive
        returns ( bool success )
    {
        // read-only offer. Modify an offer by directly accessing offers[id]
        OfferInfo memory offer = offers[id];
        delete offers[id];

        var seller_refunded = offer.sell_which_token.transfer( offer.owner , offer.sell_how_much );
        assert(seller_refunded);

        ItemUpdate(id);
        success = true;
    }
}

// Simple Market with a market lifetime. When the lifetime has elapsed,
// offers can only be cancelled (offer and buy will throw).

contract ExpiringMarket is SimpleMarket {
    uint public close_time;
    function ExpiringMarket(uint lifetime) {
        close_time = getTime() + lifetime;
    }
    function getTime() constant returns (uint) {
        return block.timestamp;
    }
    function isClosed() constant returns (bool closed) {
        return (getTime() > close_time);
    }

    // after market lifetime has elapsed, no new offers are allowed
    modifier can_offer {
        assert(!isClosed());
        _;
    }
    // after close, no new buys are allowed
    modifier can_buy(uint id) {
        assert(isActive(id));
        assert(!isClosed());
        _;
    }
    // after close, anyone can cancel an offer
    modifier can_cancel(uint id) {
        assert(isActive(id));
        assert(isClosed() || (msg.sender == getOwner(id)));
        _;
    }
}

    Contract ABI  
[{"constant":true,"inputs":[],"name":"last_offer_id","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"id","type":"uint256"}],"name":"cancel","outputs":[{"name":"success","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"id","type":"uint256"}],"name":"getOffer","outputs":[{"name":"","type":"uint256"},{"name":"","type":"address"},{"name":"","type":"uint256"},{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"getTime","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"close_time","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"id","type":"uint256"}],"name":"isActive","outputs":[{"name":"active","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"offers","outputs":[{"name":"sell_how_much","type":"uint256"},{"name":"sell_which_token","type":"address"},{"name":"buy_how_much","type":"uint256"},{"name":"buy_which_token","type":"address"},{"name":"owner","type":"address"},{"name":"active","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"isClosed","outputs":[{"name":"closed","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"id","type":"uint256"}],"name":"getOwner","outputs":[{"name":"owner","type":"address"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"id","type":"uint256"},{"name":"quantity","type":"uint256"}],"name":"buy","outputs":[{"name":"success","type":"bool"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"sell_how_much","type":"uint256"},{"name":"sell_which_token","type":"address"},{"name":"buy_how_much","type":"uint256"},{"name":"buy_which_token","type":"address"}],"name":"offer","outputs":[{"name":"id","type":"uint256"}],"payable":false,"type":"function"},{"inputs":[{"name":"lifetime","type":"uint256"}],"type":"constructor"},{"payable":false,"type":"fallback"},{"anonymous":false,"inputs":[{"indexed":false,"name":"id","type":"uint256"}],"name":"ItemUpdate","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"sell_how_much","type":"uint256"},{"indexed":true,"name":"sell_which_token","type":"address"},{"indexed":false,"name":"buy_how_much","type":"uint256"},{"indexed":true,"name":"buy_which_token","type":"address"}],"name":"Trade","type":"event"}]

  Contract Creation Code Switch To Opcodes View
6060604052604051602080610c3f8339506080604052514201600355610c16806100296000396000f36060604052361561008d5760e060020a6000350463232cae0b811461009a57806340e58ee5146100a85780634579268a14610119578063557ed1ba146101745780636377ebca1461018157806382afd23b1461018f5780638a72ea6a1461019f578063c2b6b58c146101f4578063c41a360a14610201578063d6febde81461022d578063f09ea2a614610283575b34610002576102e8610002565b34610002576102ea60025481565b34610002576102fc600435600060c0604051908101604052806000815260200160008152602001600081526020016000815260200160008152602001600081526020015060008361036d61038d825b60008181526001602052604090206004015460a060020a900460ff165b919050565b346100025760043560009081526001602081815260409283902080549281015460028201546003909201548551948552600160a060020a03918216938501939093528385019190915216606082015290519081900360800190f35b34610002576102ea6102e3565b34610002576102ea60035481565b34610002576102fc6004356100f7565b3461000257610310600435600160208190526000918252604090912080549181015460028201546003830154600490930154600160a060020a039283169391929182169181169060ff60a060020a9091041686565b34610002576102fc6102d9565b34610002576103516004355b600081815260016020526040902060040154600160a060020a0316610114565b34610002576102fc600435602435600060c0604051908101604052806000815260200160008152602001600081526020016000815260200160008152602001600081526020015060008461060a61038d826100f7565b34610002576102ea600435602435604435606435600060c0604051908101604052806000815260200160008152602001600081526020016000815260200160008152602001600081526020015060006108e96106255b6003546000906106025b425b90565b005b60408051918252519081900360200190f35b604080519115158252519081900360200190f35b60408051968752600160a060020a039586166020880152868101949094529184166060860152909216608084015290151560a0830152519081900360c00190f35b60408051600160a060020a039092168252519081900360200190f35b6103996103a96102d9565b600160a060020a031633600160a060020a0316145b801515610b3857610002565b60005460ff16156103b857610002565b8061038d57506103788261020d565b6001600060006101000a81548160ff021916908360f860020a9081020402179055506001600050600086815260200190815260200160002060005060c06040519081016040529081600082016000505481526020016001820160009054906101000a9004600160a060020a0316600160a060020a03168152602001600282016000505481526020016003820160009054906101000a9004600160a060020a0316600160a060020a031681526020016004820160009054906101000a9004600160a060020a0316600160a060020a031681526020016004820160149054906101000a900460ff16151581526020015050925060016000506000868152602001908152602001600020600060008201600050600090556001820160006101000a815490600160a060020a03021916905560028201600050600090556003820160006101000a815490600160a060020a0302191690556004820160006101000a815490600160a060020a0302191690556004820160146101000a81549060ff021916905550508260200151600160a060020a031663a9059cbb846080015185600001516000604051602001526040518360e060020a0281526004018083600160a060020a0316815260200182815260200192505050602060405180830381600087803b156100025760325a03f1156100025750506040515192506105ba90508261038d565b6040805186815290517fde857d2761836ca6234345c7f7f4c783271ed7d1aedf9268b3fe32800d186fde9181900360200190a150506000805460ff1916905550600192915050565b1190506102e5565b6106156106256102d9565b60005460ff161561062b57610002565b1561038d565b6000805460ff1916600190811782558782526020818152604092839020835160c081018552815480825293820154600160a060020a03908116938201939093526002820154948101859052600382015483166060820152600490910154918216608082015260a060020a90910460ff16151560a08201529450906106c9908790818102610b4083158061038d5750828483811561000257041461038d565b81156100025704915082604001518211806106e45750825185115b156106f257600093506108ab565b8260400151821480156107055750825185145b1561078f5760008681526001602081815260408320838155918201805473ffffffffffffffffffffffffffffffffffffffff199081169091556002830193909355600382018054909316909255600401805474ffffffffffffffffffffffffffffffffffffffffff1916905560808401519084015160608501516107b0929188913390879061081e565b60008211801561079f5750600085115b156108a65782516108be90866108db565b6040805187815290517fde857d2761836ca6234345c7f7f4c783271ed7d1aedf9268b3fe32800d186fde9181900360200190a1600193506108ab565b60008781526001602090815260409091206002019190915560808401519084015160608501516107b092918891339087905b6000600082600160a060020a03166323b872dd868a876000604051602001526040518460e060020a0281526004018084600160a060020a0316815260200183600160a060020a031681526020018281526020019350505050602060405180830381600087803b156100025760325a03f115610002575050604051519250610b4690508261038d565b600093505b6000805460ff1916905550505092915050565b60008781526001602052604090819020919091558301516107ec90835b6000610b3b8383111561038d565b60005460ff16156108f957610002565b6000805460ff1916600117815561091190881161038d565b610925600160a060020a038716151561038d565b6109316000861161038d565b610945600160a060020a038516151561038d565b61096384600160a060020a031687600160a060020a0316141561038d565b868252600160a060020a03808716602084015260408301869052848116606084015233166080830152600160a08301526109a660028054600101908190556102e5565b60008181526001602081815260408084208751815587830151938101805473ffffffffffffffffffffffffffffffffffffffff199081166c01000000000000000000000000968702879004179091558883015160028301556060890151600383018054831691870287900491909117905560808901516004928301805460a08c01519316918702969096041774ff0000000000000000000000000000000000000000191660a060020a60f860020a9283029290920491909102179093558051820184905280517f23b872dd000000000000000000000000000000000000000000000000000000008152600160a060020a03338116948201949094523084166024820152604481018d90529051949750918a16936323b872dd936064808501948390030190829087803b156100025760325a03f115610002575050604051519150610af190508161038d565b6040805184815290517fde857d2761836ca6234345c7f7f4c783271ed7d1aedf9268b3fe32800d186fde9181900360200190a16000805460ff191690555050949350505050565b50565b508082035b92915050565b85600160a060020a031663a9059cbb86896000604051602001526040518360e060020a0281526004018083600160a060020a0316815260200182815260200192505050602060405180830381600087803b156100025760325a03f115610002575050604051519150610bb990508161038d565b82600160a060020a031686600160a060020a03167fa5ca35f5c7b1c108bbc4c25279f619f720805890f993005d9f00ef1e32663f9b8987604051808381526020018281526020019250505060405180910390a3505050505050505056
View All
Block Age txn Difficulty GasUsed Reward
View All
Block Age UncleNumber Difficulty GasUsed Reward
Make sure to use the "downvote" button for any spammy posts, and the "upvote" for interesting conversations.