Contract 0xb7ac09c2c0217b07d7c103029b4918a2c401eecb

 

OasisDex has migrated to a new contract. Read the announcement here.
TxHash Block Age From To Value [TxFee]
0x0e20fcb33f813966d2ad5c3e677db955dbc3bdfd9409fde88f34ec56b55ccfee723883730 days 5 hrs ago0x1bdb1783505f626a55a5e3dd3e366df1cd69c055 IN  OasisDex: Old Contract 20 Ether0.000161952
0xd83b36624bc6215a6c609da5e01b8096e68e323b86572393ddd790ca40114d74720170639 days 2 hrs ago0x2d2ca04b65a8c1d007237698d215fd12c7da4b3c IN  OasisDex: Old Contract 20 Ether0.001270026
0xc1111c9a3ec2dc09a980a6c52b4d1d2950255e10b7ca2fd60a1f0ad3ac44bcf6720170339 days 2 hrs ago0x2d2ca04b65a8c1d007237698d215fd12c7da4b3c IN  OasisDex: Old Contract 20 Ether0.001270026
0x353c86baff322f3aaa250be13f7fcc500ed4729eed4e03564927c6bd383c37c9720165739 days 2 hrs ago0x2d2ca04b65a8c1d007237698d215fd12c7da4b3c IN  OasisDex: Old Contract 20 Ether0.001489761
0xf2355dd656458c5bcad592e42127b413a72931b45d22c60e430f1cb4931c4d33719896439 days 16 hrs ago0xdb33dfd3d61308c33c63209845dad3e6bfb2c674 IN  OasisDex: Old Contract 20 Ether0.00028306
0xb0fde78ef3d7aec332be6719acaa0acf0b427d611bd4d247b9dda3226d071bbd719896439 days 16 hrs ago0xdb33dfd3d61308c33c63209845dad3e6bfb2c674 IN  OasisDex: Old Contract 20 Ether0.000261588
0x78ff7b8cbe034bc1ef66370901ff262c2480d890eed2a4a904973081a2cba0ca719896339 days 16 hrs ago0xdb33dfd3d61308c33c63209845dad3e6bfb2c674 IN  OasisDex: Old Contract 20 Ether0.000261588
0x27b358bb508d579ebf9cae172d0ce4a7f63af52c4682a6f9a92f2976817d31e0719896339 days 16 hrs ago0xdb33dfd3d61308c33c63209845dad3e6bfb2c674 IN  OasisDex: Old Contract 20 Ether0.000261716
0x01cc4873ae539031d0de2025a5f53a623ec0be4c243a1ab1639db85345eb13cd719896339 days 16 hrs ago0xdb33dfd3d61308c33c63209845dad3e6bfb2c674 IN  OasisDex: Old Contract 20 Ether0.00028306
0x3345cee992b0efdf831d731b6e2bbaadefb3676c0e58ee71a5c32b7dc3afd501719896339 days 16 hrs ago0xf91c932ce1583dabbeebf432691de1be69206a6e IN  OasisDex: Old Contract 20 Ether0.00018984
0x75b6f4bf183d019e50edb3f14e2ae5c98c005ff13a2ee4c88754b3cb6e4e73a5719896239 days 16 hrs ago0xdb33dfd3d61308c33c63209845dad3e6bfb2c674 IN  OasisDex: Old Contract 20 Ether0.000261588
0x83606514a3581efc4b71f4782caf079357e4bf040300dd72fd7ab25298628e45719896039 days 16 hrs ago0xf91c932ce1583dabbeebf432691de1be69206a6e IN  OasisDex: Old Contract 20 Ether0.00018984
0x6406b92b7f8b812cc5183f5264b764351c9b9d14b610aa0f92daf6bfc8638150719896039 days 16 hrs ago0xdb33dfd3d61308c33c63209845dad3e6bfb2c674 IN  OasisDex: Old Contract 20 Ether0.000261588
0xab2a32e50c56ac4ed8e013d156d8f2b94d51008e9bc137638a9a359759f5abc8719895939 days 16 hrs ago0xdb33dfd3d61308c33c63209845dad3e6bfb2c674 IN  OasisDex: Old Contract 20 Ether0.000261588
0xae76760e3b2ed59bd609dd2c564e6bea6c0373b9a8ebbb2dd0c0ba28dea72cc3719895939 days 16 hrs ago0xdb33dfd3d61308c33c63209845dad3e6bfb2c674 IN  OasisDex: Old Contract 20 Ether0.000261588
0xa36d7aa73057011d75561577f296b7681131f025e9f97fab294c28dd32bbe3f8719895839 days 16 hrs ago0xf91c932ce1583dabbeebf432691de1be69206a6e IN  OasisDex: Old Contract 20 Ether0.00018984
0x4113df582a450de98eb56846d99953ca789e612e7897b7b3e9865b4b2303f5f9719895639 days 16 hrs ago0xdb33dfd3d61308c33c63209845dad3e6bfb2c674 IN  OasisDex: Old Contract 20 Ether0.000261588
0x221a6f28eecc2613d8a258eca27386581bcb6d7e193c1685da1db85258ad4175719895639 days 16 hrs ago0xf91c932ce1583dabbeebf432691de1be69206a6e IN  OasisDex: Old Contract 20 Ether0.00018984
0xfcee4388b82cca072dfc0bf9a313081d0a11349921d88627adfb50cbc3b83efa719895539 days 16 hrs ago0xdb33dfd3d61308c33c63209845dad3e6bfb2c674 IN  OasisDex: Old Contract 20 Ether0.000261588
0x04b7c14d4b5d676bb0952e64ed5000dde3ee497a938b99a0b472c519357c0b1f719895539 days 16 hrs ago0xdb33dfd3d61308c33c63209845dad3e6bfb2c674 IN  OasisDex: Old Contract 20 Ether0.000261588
0x9664d5720dae0b75649bdeb41d49109fe3def1e9a3f9c7d72fa65c66bfd9d1a9719895539 days 16 hrs ago0xdb33dfd3d61308c33c63209845dad3e6bfb2c674 IN  OasisDex: Old Contract 20 Ether0.000261588
0x7f75583f778e216b005fae611737c39ec7ee8e49ef064fae67482a5a03ba1726719895339 days 16 hrs ago0xdb33dfd3d61308c33c63209845dad3e6bfb2c674 IN  OasisDex: Old Contract 20 Ether0.000291588
0x2d58336eff7c5c0628d89ca9fcc44970fec93a544fae90ef0b7a941598c94f91719895139 days 16 hrs ago0xf91c932ce1583dabbeebf432691de1be69206a6e IN  OasisDex: Old Contract 20 Ether0.00018984
0x17dd8a2ffc778a39f3b311a4f0e3da93af27ab033e8224072848d9d19016316e719895139 days 16 hrs ago0xdb33dfd3d61308c33c63209845dad3e6bfb2c674 IN  OasisDex: Old Contract 20 Ether0.000261588
0x640d949cadee23b119efe8230e30346b71e5c8cf43fe088a55f8f15c31f70a95719895139 days 16 hrs ago0xdb33dfd3d61308c33c63209845dad3e6bfb2c674 IN  OasisDex: Old Contract 20 Ether0.000261588
[ Download CSV Export 

Internal Transactions as a result of Contract Execution

Parent TxHash Block Age From To Value

Contract Source Code Verified (Exact Match)

Contract Name:
MatchingMarket

Compiler Version
v0.4.25+commit.59dbf8f1

Optimization Enabled:
Yes

Runs (Optimizer):
200

Contract Source Code

/// matching_market.sol

//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program.  If not, see <https://www.gnu.org/licenses/>.

pragma solidity ^0.4.18;

/// expiring_market.sol

//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program.  If not, see <https://www.gnu.org/licenses/>.

pragma solidity ^0.4.18;

// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.

pragma solidity ^0.4.13;

contract DSAuthority {
    function canCall(
        address src, address dst, bytes4 sig
    ) public view returns (bool);
}

contract DSAuthEvents {
    event LogSetAuthority (address indexed authority);
    event LogSetOwner     (address indexed owner);
}

contract DSAuth is DSAuthEvents {
    DSAuthority  public  authority;
    address      public  owner;

    function DSAuth() public {
        owner = msg.sender;
        LogSetOwner(msg.sender);
    }

    function setOwner(address owner_)
        public
        auth
    {
        owner = owner_;
        LogSetOwner(owner);
    }

    function setAuthority(DSAuthority authority_)
        public
        auth
    {
        authority = authority_;
        LogSetAuthority(authority);
    }

    modifier auth {
        require(isAuthorized(msg.sender, msg.sig));
        _;
    }

    function isAuthorized(address src, bytes4 sig) internal view returns (bool) {
        if (src == address(this)) {
            return true;
        } else if (src == owner) {
            return true;
        } else if (authority == DSAuthority(0)) {
            return false;
        } else {
            return authority.canCall(src, this, sig);
        }
    }
}

/// simple_market.sol

//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program.  If not, see <https://www.gnu.org/licenses/>.

pragma solidity ^0.4.18;

/// math.sol -- mixin for inline numerical wizardry

// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.

pragma solidity ^0.4.13;

contract DSMath {
    function add(uint x, uint y) internal pure returns (uint z) {
        require((z = x + y) >= x);
    }
    function sub(uint x, uint y) internal pure returns (uint z) {
        require((z = x - y) <= x);
    }
    function mul(uint x, uint y) internal pure returns (uint z) {
        require(y == 0 || (z = x * y) / y == x);
    }

    function min(uint x, uint y) internal pure returns (uint z) {
        return x <= y ? x : y;
    }
    function max(uint x, uint y) internal pure returns (uint z) {
        return x >= y ? x : y;
    }
    function imin(int x, int y) internal pure returns (int z) {
        return x <= y ? x : y;
    }
    function imax(int x, int y) internal pure returns (int z) {
        return x >= y ? x : y;
    }

    uint constant WAD = 10 ** 18;
    uint constant RAY = 10 ** 27;

    function wmul(uint x, uint y) internal pure returns (uint z) {
        z = add(mul(x, y), WAD / 2) / WAD;
    }
    function rmul(uint x, uint y) internal pure returns (uint z) {
        z = add(mul(x, y), RAY / 2) / RAY;
    }
    function wdiv(uint x, uint y) internal pure returns (uint z) {
        z = add(mul(x, WAD), y / 2) / y;
    }
    function rdiv(uint x, uint y) internal pure returns (uint z) {
        z = add(mul(x, RAY), y / 2) / y;
    }

    // This famous algorithm is called "exponentiation by squaring"
    // and calculates x^n with x as fixed-point and n as regular unsigned.
    //
    // It's O(log n), instead of O(n) for naive repeated multiplication.
    //
    // These facts are why it works:
    //
    //  If n is even, then x^n = (x^2)^(n/2).
    //  If n is odd,  then x^n = x * x^(n-1),
    //   and applying the equation for even x gives
    //    x^n = x * (x^2)^((n-1) / 2).
    //
    //  Also, EVM division is flooring and
    //    floor[(n-1) / 2] = floor[n / 2].
    //
    function rpow(uint x, uint n) internal pure returns (uint z) {
        z = n % 2 != 0 ? x : RAY;

        for (n /= 2; n != 0; n /= 2) {
            x = rmul(x, x);

            if (n % 2 != 0) {
                z = rmul(z, x);
            }
        }
    }
}

/// erc20.sol -- API for the ERC20 token standard

// See <https://github.com/ethereum/EIPs/issues/20>.

// This file likely does not meet the threshold of originality
// required for copyright to apply.  As a result, this is free and
// unencumbered software belonging to the public domain.

pragma solidity ^0.4.8;

contract ERC20Events {
    event Approval(address indexed src, address indexed guy, uint wad);
    event Transfer(address indexed src, address indexed dst, uint wad);
}

contract ERC20 is ERC20Events {
    function totalSupply() public view returns (uint);
    function balanceOf(address guy) public view returns (uint);
    function allowance(address src, address guy) public view returns (uint);

    function approve(address guy, uint wad) public returns (bool);
    function transfer(address dst, uint wad) public returns (bool);
    function transferFrom(
        address src, address dst, uint wad
    ) public returns (bool);
}

contract EventfulMarket {
    event LogItemUpdate(uint id);
    event LogTrade(uint pay_amt, address indexed pay_gem,
                   uint buy_amt, address indexed buy_gem);

    event LogMake(
        bytes32  indexed  id,
        bytes32  indexed  pair,
        address  indexed  maker,
        ERC20             pay_gem,
        ERC20             buy_gem,
        uint128           pay_amt,
        uint128           buy_amt,
        uint64            timestamp
    );

    event LogBump(
        bytes32  indexed  id,
        bytes32  indexed  pair,
        address  indexed  maker,
        ERC20             pay_gem,
        ERC20             buy_gem,
        uint128           pay_amt,
        uint128           buy_amt,
        uint64            timestamp
    );

    event LogTake(
        bytes32           id,
        bytes32  indexed  pair,
        address  indexed  maker,
        ERC20             pay_gem,
        ERC20             buy_gem,
        address  indexed  taker,
        uint128           take_amt,
        uint128           give_amt,
        uint64            timestamp
    );

    event LogKill(
        bytes32  indexed  id,
        bytes32  indexed  pair,
        address  indexed  maker,
        ERC20             pay_gem,
        ERC20             buy_gem,
        uint128           pay_amt,
        uint128           buy_amt,
        uint64            timestamp
    );
}

contract SimpleMarket is EventfulMarket, DSMath {

    uint public last_offer_id;

    mapping (uint => OfferInfo) public offers;

    bool locked;

    struct OfferInfo {
        uint     pay_amt;
        ERC20    pay_gem;
        uint     buy_amt;
        ERC20    buy_gem;
        address  owner;
        uint64   timestamp;
    }

    modifier can_buy(uint id) {
        require(isActive(id));
        _;
    }

    modifier can_cancel(uint id) {
        require(isActive(id));
        require(getOwner(id) == msg.sender);
        _;
    }

    modifier can_offer {
        _;
    }

    modifier synchronized {
        require(!locked);
        locked = true;
        _;
        locked = false;
    }

    function isActive(uint id) public constant returns (bool active) {
        return offers[id].timestamp > 0;
    }

    function getOwner(uint id) public constant returns (address owner) {
        return offers[id].owner;
    }

    function getOffer(uint id) public constant returns (uint, ERC20, uint, ERC20) {
      var offer = offers[id];
      return (offer.pay_amt, offer.pay_gem,
              offer.buy_amt, offer.buy_gem);
    }

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

    function bump(bytes32 id_)
        public
        can_buy(uint256(id_))
    {
        var id = uint256(id_);
        LogBump(
            id_,
            keccak256(offers[id].pay_gem, offers[id].buy_gem),
            offers[id].owner,
            offers[id].pay_gem,
            offers[id].buy_gem,
            uint128(offers[id].pay_amt),
            uint128(offers[id].buy_amt),
            offers[id].timestamp
        );
    }

    // Accept given `quantity` of an offer. Transfers funds from caller to
    // offer maker, and from market to caller.
    function buy(uint id, uint quantity)
        public
        can_buy(id)
        synchronized
        returns (bool)
    {
        OfferInfo memory offer = offers[id];
        uint spend = mul(quantity, offer.buy_amt) / offer.pay_amt;

        require(uint128(spend) == spend);
        require(uint128(quantity) == quantity);

        // For backwards semantic compatibility.
        if (quantity == 0 || spend == 0 ||
            quantity > offer.pay_amt || spend > offer.buy_amt)
        {
            return false;
        }

        offers[id].pay_amt = sub(offer.pay_amt, quantity);
        offers[id].buy_amt = sub(offer.buy_amt, spend);
        require( offer.buy_gem.transferFrom(msg.sender, offer.owner, spend) );
        require( offer.pay_gem.transfer(msg.sender, quantity) );

        LogItemUpdate(id);
        LogTake(
            bytes32(id),
            keccak256(offer.pay_gem, offer.buy_gem),
            offer.owner,
            offer.pay_gem,
            offer.buy_gem,
            msg.sender,
            uint128(quantity),
            uint128(spend),
            uint64(now)
        );
        LogTrade(quantity, offer.pay_gem, spend, offer.buy_gem);

        if (offers[id].pay_amt == 0) {
          delete offers[id];
        }

        return true;
    }

    // Cancel an offer. Refunds offer maker.
    function cancel(uint id)
        public
        can_cancel(id)
        synchronized
        returns (bool success)
    {
        // read-only offer. Modify an offer by directly accessing offers[id]
        OfferInfo memory offer = offers[id];
        delete offers[id];

        require( offer.pay_gem.transfer(offer.owner, offer.pay_amt) );

        LogItemUpdate(id);
        LogKill(
            bytes32(id),
            keccak256(offer.pay_gem, offer.buy_gem),
            offer.owner,
            offer.pay_gem,
            offer.buy_gem,
            uint128(offer.pay_amt),
            uint128(offer.buy_amt),
            uint64(now)
        );

        success = true;
    }

    function kill(bytes32 id)
        public
    {
        require(cancel(uint256(id)));
    }

    function make(
        ERC20    pay_gem,
        ERC20    buy_gem,
        uint128  pay_amt,
        uint128  buy_amt
    )
        public
        returns (bytes32 id)
    {
        return bytes32(offer(pay_amt, pay_gem, buy_amt, buy_gem));
    }

    // Make a new offer. Takes funds from the caller into market escrow.
    function offer(uint pay_amt, ERC20 pay_gem, uint buy_amt, ERC20 buy_gem)
        public
        can_offer
        synchronized
        returns (uint id)
    {
        require(uint128(pay_amt) == pay_amt);
        require(uint128(buy_amt) == buy_amt);
        require(pay_amt > 0);
        require(pay_gem != ERC20(0x0));
        require(buy_amt > 0);
        require(buy_gem != ERC20(0x0));
        require(pay_gem != buy_gem);

        OfferInfo memory info;
        info.pay_amt = pay_amt;
        info.pay_gem = pay_gem;
        info.buy_amt = buy_amt;
        info.buy_gem = buy_gem;
        info.owner = msg.sender;
        info.timestamp = uint64(now);
        id = _next_id();
        offers[id] = info;

        require( pay_gem.transferFrom(msg.sender, this, pay_amt) );

        LogItemUpdate(id);
        LogMake(
            bytes32(id),
            keccak256(pay_gem, buy_gem),
            msg.sender,
            pay_gem,
            buy_gem,
            uint128(pay_amt),
            uint128(buy_amt),
            uint64(now)
        );
    }

    function take(bytes32 id, uint128 maxTakeAmount)
        public
    {
        require(buy(uint256(id), maxTakeAmount));
    }

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

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

contract ExpiringMarket is DSAuth, SimpleMarket {
    uint64 public close_time;
    bool public stopped;

    // after close_time has been reached, no new offers are allowed
    modifier can_offer {
        require(!isClosed());
        _;
    }

    // after close, no new buys are allowed
    modifier can_buy(uint id) {
        require(isActive(id));
        require(!isClosed());
        _;
    }

    // after close, anyone can cancel an offer
    modifier can_cancel(uint id) {
        require(isActive(id));
        require((msg.sender == getOwner(id)) || isClosed());
        _;
    }

    function ExpiringMarket(uint64 _close_time)
        public
    {
        close_time = _close_time;
    }

    function isClosed() public constant returns (bool closed) {
        return stopped || getTime() > close_time;
    }

    function getTime() public constant returns (uint64) {
        return uint64(now);
    }

    function stop() public auth {
        stopped = true;
    }
}

/// note.sol -- the `note' modifier, for logging calls as events

// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.

pragma solidity ^0.4.13;

contract DSNote {
    event LogNote(
        bytes4   indexed  sig,
        address  indexed  guy,
        bytes32  indexed  foo,
        bytes32  indexed  bar,
        uint              wad,
        bytes             fax
    ) anonymous;

    modifier note {
        bytes32 foo;
        bytes32 bar;

        assembly {
            foo := calldataload(4)
            bar := calldataload(36)
        }

        LogNote(msg.sig, msg.sender, foo, bar, msg.value, msg.data);

        _;
    }
}

contract MatchingEvents {
    event LogBuyEnabled(bool isEnabled);
    event LogMinSell(address pay_gem, uint min_amount);
    event LogMatchingEnabled(bool isEnabled);
    event LogUnsortedOffer(uint id);
    event LogSortedOffer(uint id);
    event LogInsert(address keeper, uint id);
    event LogDelete(address keeper, uint id);
}

contract MatchingMarket is MatchingEvents, ExpiringMarket, DSNote {
    bool public buyEnabled = true;      //buy enabled
    bool public matchingEnabled = true; //true: enable matching,
                                         //false: revert to expiring market
    struct sortInfo {
        uint next;  //points to id of next higher offer
        uint prev;  //points to id of previous lower offer
        uint delb;  //the blocknumber where this entry was marked for delete
    }
    mapping(uint => sortInfo) public _rank;                     //doubly linked lists of sorted offer ids
    mapping(address => mapping(address => uint)) public _best;  //id of the highest offer for a token pair
    mapping(address => mapping(address => uint)) public _span;  //number of offers stored for token pair in sorted orderbook
    mapping(address => uint) public _dust;                      //minimum sell amount for a token to avoid dust offers
    mapping(uint => uint) public _near;         //next unsorted offer id
    uint _head;                                 //first unsorted offer id

    function MatchingMarket(uint64 close_time) ExpiringMarket(close_time) public {
    }

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

    function make(
        ERC20    pay_gem,
        ERC20    buy_gem,
        uint128  pay_amt,
        uint128  buy_amt
    )
        public
        returns (bytes32)
    {
        return bytes32(offer(pay_amt, pay_gem, buy_amt, buy_gem));
    }

    function take(bytes32 id, uint128 maxTakeAmount) public {
        require(buy(uint256(id), maxTakeAmount));
    }

    function kill(bytes32 id) public {
        require(cancel(uint256(id)));
    }

    // Make a new offer. Takes funds from the caller into market escrow.
    //
    // If matching is enabled:
    //     * creates new offer without putting it in
    //       the sorted list.
    //     * available to authorized contracts only!
    //     * keepers should call insert(id,pos)
    //       to put offer in the sorted list.
    //
    // If matching is disabled:
    //     * calls expiring market's offer().
    //     * available to everyone without authorization.
    //     * no sorting is done.
    //
    function offer(
        uint pay_amt,    //maker (ask) sell how much
        ERC20 pay_gem,   //maker (ask) sell which token
        uint buy_amt,    //taker (ask) buy how much
        ERC20 buy_gem    //taker (ask) buy which token
    )
        public
        returns (uint)
    {
        require(!locked, "Reentrancy attempt");
        var fn = matchingEnabled ? _offeru : super.offer;
        return fn(pay_amt, pay_gem, buy_amt, buy_gem);
    }

    // Make a new offer. Takes funds from the caller into market escrow.
    function offer(
        uint pay_amt,    //maker (ask) sell how much
        ERC20 pay_gem,   //maker (ask) sell which token
        uint buy_amt,    //maker (ask) buy how much
        ERC20 buy_gem,   //maker (ask) buy which token
        uint pos         //position to insert offer, 0 should be used if unknown
    )
        public
        can_offer
        returns (uint)
    {
        return offer(pay_amt, pay_gem, buy_amt, buy_gem, pos, false);
    }

    function offer(
        uint pay_amt,    //maker (ask) sell how much
        ERC20 pay_gem,   //maker (ask) sell which token
        uint buy_amt,    //maker (ask) buy how much
        ERC20 buy_gem,   //maker (ask) buy which token
        uint pos,        //position to insert offer, 0 should be used if unknown
        bool rounding    //match "close enough" orders?
    )
        public
        can_offer
        returns (uint)
    {
        require(!locked, "Reentrancy attempt");
        require(_dust[pay_gem] <= pay_amt);

        if (matchingEnabled) {
          return _matcho(pay_amt, pay_gem, buy_amt, buy_gem, pos, rounding);
        }
        return super.offer(pay_amt, pay_gem, buy_amt, buy_gem);
    }

    //Transfers funds from caller to offer maker, and from market to caller.
    function buy(uint id, uint amount)
        public
        can_buy(id)
        returns (bool)
    {
        require(!locked, "Reentrancy attempt");
        var fn = matchingEnabled ? _buys : super.buy;
        return fn(id, amount);
    }

    // Cancel an offer. Refunds offer maker.
    function cancel(uint id)
        public
        can_cancel(id)
        returns (bool success)
    {
        require(!locked, "Reentrancy attempt");
        if (matchingEnabled) {
            if (isOfferSorted(id)) {
                require(_unsort(id));
            } else {
                require(_hide(id));
            }
        }
        return super.cancel(id);    //delete the offer.
    }

    //insert offer into the sorted list
    //keepers need to use this function
    function insert(
        uint id,   //maker (ask) id
        uint pos   //position to insert into
    )
        public
        returns (bool)
    {
        require(!locked, "Reentrancy attempt");
        require(!isOfferSorted(id));    //make sure offers[id] is not yet sorted
        require(isActive(id));          //make sure offers[id] is active

        _hide(id);                      //remove offer from unsorted offers list
        _sort(id, pos);                 //put offer into the sorted offers list
        LogInsert(msg.sender, id);
        return true;
    }

    //deletes _rank [id]
    //  Function should be called by keepers.
    function del_rank(uint id)
        public
        returns (bool)
    {
        require(!locked, "Reentrancy attempt");
        require(!isActive(id) && _rank[id].delb != 0 && _rank[id].delb < block.number - 10);
        delete _rank[id];
        LogDelete(msg.sender, id);
        return true;
    }

    //set the minimum sell amount for a token
    //    Function is used to avoid "dust offers" that have
    //    very small amount of tokens to sell, and it would
    //    cost more gas to accept the offer, than the value
    //    of tokens received.
    function setMinSell(
        ERC20 pay_gem,     //token to assign minimum sell amount to
        uint dust          //maker (ask) minimum sell amount
    )
        public
        auth
        note
        returns (bool)
    {
        _dust[pay_gem] = dust;
        LogMinSell(pay_gem, dust);
        return true;
    }

    //returns the minimum sell amount for an offer
    function getMinSell(
        ERC20 pay_gem      //token for which minimum sell amount is queried
    )
        public
        constant
        returns (uint)
    {
        return _dust[pay_gem];
    }

    //set buy functionality enabled/disabled
    function setBuyEnabled(bool buyEnabled_) public auth returns (bool) {
        buyEnabled = buyEnabled_;
        LogBuyEnabled(buyEnabled);
        return true;
    }

    //set matching enabled/disabled
    //    If matchingEnabled true(default), then inserted offers are matched.
    //    Except the ones inserted by contracts, because those end up
    //    in the unsorted list of offers, that must be later sorted by
    //    keepers using insert().
    //    If matchingEnabled is false then MatchingMarket is reverted to ExpiringMarket,
    //    and matching is not done, and sorted lists are disabled.
    function setMatchingEnabled(bool matchingEnabled_) public auth returns (bool) {
        matchingEnabled = matchingEnabled_;
        LogMatchingEnabled(matchingEnabled);
        return true;
    }

    //return the best offer for a token pair
    //      the best offer is the lowest one if it's an ask,
    //      and highest one if it's a bid offer
    function getBestOffer(ERC20 sell_gem, ERC20 buy_gem) public constant returns(uint) {
        return _best[sell_gem][buy_gem];
    }

    //return the next worse offer in the sorted list
    //      the worse offer is the higher one if its an ask,
    //      a lower one if its a bid offer,
    //      and in both cases the newer one if they're equal.
    function getWorseOffer(uint id) public constant returns(uint) {
        return _rank[id].prev;
    }

    //return the next better offer in the sorted list
    //      the better offer is in the lower priced one if its an ask,
    //      the next higher priced one if its a bid offer
    //      and in both cases the older one if they're equal.
    function getBetterOffer(uint id) public constant returns(uint) {

        return _rank[id].next;
    }

    //return the amount of better offers for a token pair
    function getOfferCount(ERC20 sell_gem, ERC20 buy_gem) public constant returns(uint) {
        return _span[sell_gem][buy_gem];
    }

    //get the first unsorted offer that was inserted by a contract
    //      Contracts can't calculate the insertion position of their offer because it is not an O(1) operation.
    //      Their offers get put in the unsorted list of offers.
    //      Keepers can calculate the insertion position offchain and pass it to the insert() function to insert
    //      the unsorted offer into the sorted list. Unsorted offers will not be matched, but can be bought with buy().
    function getFirstUnsortedOffer() public constant returns(uint) {
        return _head;
    }

    //get the next unsorted offer
    //      Can be used to cycle through all the unsorted offers.
    function getNextUnsortedOffer(uint id) public constant returns(uint) {
        return _near[id];
    }

    function isOfferSorted(uint id) public constant returns(bool) {
        return _rank[id].next != 0
               || _rank[id].prev != 0
               || _best[offers[id].pay_gem][offers[id].buy_gem] == id;
    }

    function sellAllAmount(ERC20 pay_gem, uint pay_amt, ERC20 buy_gem, uint min_fill_amount)
        public
        returns (uint fill_amt)
    {
        require(!locked, "Reentrancy attempt");
        uint offerId;
        while (pay_amt > 0) {                           //while there is amount to sell
            offerId = getBestOffer(buy_gem, pay_gem);   //Get the best offer for the token pair
            require(offerId != 0);                      //Fails if there are not more offers

            // There is a chance that pay_amt is smaller than 1 wei of the other token
            if (pay_amt * 1 ether < wdiv(offers[offerId].buy_amt, offers[offerId].pay_amt)) {
                break;                                  //We consider that all amount is sold
            }
            if (pay_amt >= offers[offerId].buy_amt) {                       //If amount to sell is higher or equal than current offer amount to buy
                fill_amt = add(fill_amt, offers[offerId].pay_amt);          //Add amount bought to acumulator
                pay_amt = sub(pay_amt, offers[offerId].buy_amt);            //Decrease amount to sell
                take(bytes32(offerId), uint128(offers[offerId].pay_amt));   //We take the whole offer
            } else { // if lower
                var baux = rmul(pay_amt * 10 ** 9, rdiv(offers[offerId].pay_amt, offers[offerId].buy_amt)) / 10 ** 9;
                fill_amt = add(fill_amt, baux);         //Add amount bought to acumulator
                take(bytes32(offerId), uint128(baux));  //We take the portion of the offer that we need
                pay_amt = 0;                            //All amount is sold
            }
        }
        require(fill_amt >= min_fill_amount);
    }

    function buyAllAmount(ERC20 buy_gem, uint buy_amt, ERC20 pay_gem, uint max_fill_amount)
        public
        returns (uint fill_amt)
    {
        require(!locked, "Reentrancy attempt");
        uint offerId;
        while (buy_amt > 0) {                           //Meanwhile there is amount to buy
            offerId = getBestOffer(buy_gem, pay_gem);   //Get the best offer for the token pair
            require(offerId != 0);

            // There is a chance that buy_amt is smaller than 1 wei of the other token
            if (buy_amt * 1 ether < wdiv(offers[offerId].pay_amt, offers[offerId].buy_amt)) {
                break;                                  //We consider that all amount is sold
            }
            if (buy_amt >= offers[offerId].pay_amt) {                       //If amount to buy is higher or equal than current offer amount to sell
                fill_amt = add(fill_amt, offers[offerId].buy_amt);          //Add amount sold to acumulator
                buy_amt = sub(buy_amt, offers[offerId].pay_amt);            //Decrease amount to buy
                take(bytes32(offerId), uint128(offers[offerId].pay_amt));   //We take the whole offer
            } else {                                                        //if lower
                fill_amt = add(fill_amt, rmul(buy_amt * 10 ** 9, rdiv(offers[offerId].buy_amt, offers[offerId].pay_amt)) / 10 ** 9); //Add amount sold to acumulator
                take(bytes32(offerId), uint128(buy_amt));                   //We take the portion of the offer that we need
                buy_amt = 0;                                                //All amount is bought
            }
        }
        require(fill_amt <= max_fill_amount);
    }

    function getBuyAmount(ERC20 buy_gem, ERC20 pay_gem, uint pay_amt) public constant returns (uint fill_amt) {
        var offerId = getBestOffer(buy_gem, pay_gem);           //Get best offer for the token pair
        while (pay_amt > offers[offerId].buy_amt) {
            fill_amt = add(fill_amt, offers[offerId].pay_amt);  //Add amount to buy accumulator
            pay_amt = sub(pay_amt, offers[offerId].buy_amt);    //Decrease amount to pay
            if (pay_amt > 0) {                                  //If we still need more offers
                offerId = getWorseOffer(offerId);               //We look for the next best offer
                require(offerId != 0);                          //Fails if there are not enough offers to complete
            }
        }
        fill_amt = add(fill_amt, rmul(pay_amt * 10 ** 9, rdiv(offers[offerId].pay_amt, offers[offerId].buy_amt)) / 10 ** 9); //Add proportional amount of last offer to buy accumulator
    }

    function getPayAmount(ERC20 pay_gem, ERC20 buy_gem, uint buy_amt) public constant returns (uint fill_amt) {
        var offerId = getBestOffer(buy_gem, pay_gem);           //Get best offer for the token pair
        while (buy_amt > offers[offerId].pay_amt) {
            fill_amt = add(fill_amt, offers[offerId].buy_amt);  //Add amount to pay accumulator
            buy_amt = sub(buy_amt, offers[offerId].pay_amt);    //Decrease amount to buy
            if (buy_amt > 0) {                                  //If we still need more offers
                offerId = getWorseOffer(offerId);               //We look for the next best offer
                require(offerId != 0);                          //Fails if there are not enough offers to complete
            }
        }
        fill_amt = add(fill_amt, rmul(buy_amt * 10 ** 9, rdiv(offers[offerId].buy_amt, offers[offerId].pay_amt)) / 10 ** 9); //Add proportional amount of last offer to pay accumulator
    }

    // ---- Internal Functions ---- //

    function _buys(uint id, uint amount)
        internal
        returns (bool)
    {
        require(buyEnabled);

        if (amount == offers[id].pay_amt && isOfferSorted(id)) {
            //offers[id] must be removed from sorted list because all of it is bought
            _unsort(id);
        }
        require(super.buy(id, amount));
        return true;
    }

    //find the id of the next higher offer after offers[id]
    function _find(uint id)
        internal
        view
        returns (uint)
    {
        require( id > 0 );

        address buy_gem = address(offers[id].buy_gem);
        address pay_gem = address(offers[id].pay_gem);
        uint top = _best[pay_gem][buy_gem];
        uint old_top = 0;

        // Find the larger-than-id order whose successor is less-than-id.
        while (top != 0 && _isPricedLtOrEq(id, top)) {
            old_top = top;
            top = _rank[top].prev;
        }
        return old_top;
    }

    //find the id of the next higher offer after offers[id]
    function _findpos(uint id, uint pos)
        internal
        view
        returns (uint)
    {
        require(id > 0);

        // Look for an active order.
        while (pos != 0 && !isActive(pos)) {
            pos = _rank[pos].prev;
        }

        if (pos == 0) {
            //if we got to the end of list without a single active offer
            return _find(id);

        } else {
            // if we did find a nearby active offer
            // Walk the order book down from there...
            if(_isPricedLtOrEq(id, pos)) {
                uint old_pos;

                // Guaranteed to run at least once because of
                // the prior if statements.
                while (pos != 0 && _isPricedLtOrEq(id, pos)) {
                    old_pos = pos;
                    pos = _rank[pos].prev;
                }
                return old_pos;

            // ...or walk it up.
            } else {
                while (pos != 0 && !_isPricedLtOrEq(id, pos)) {
                    pos = _rank[pos].next;
                }
                return pos;
            }
        }
    }

    //return true if offers[low] priced less than or equal to offers[high]
    function _isPricedLtOrEq(
        uint low,   //lower priced offer's id
        uint high   //higher priced offer's id
    )
        internal
        view
        returns (bool)
    {
        return mul(offers[low].buy_amt, offers[high].pay_amt)
          >= mul(offers[high].buy_amt, offers[low].pay_amt);
    }

    //these variables are global only because of solidity local variable limit

    //match offers with taker offer, and execute token transactions
    function _matcho(
        uint t_pay_amt,    //taker sell how much
        ERC20 t_pay_gem,   //taker sell which token
        uint t_buy_amt,    //taker buy how much
        ERC20 t_buy_gem,   //taker buy which token
        uint pos,          //position id
        bool rounding      //match "close enough" orders?
    )
        internal
        returns (uint id)
    {
        uint best_maker_id;    //highest maker id
        uint t_buy_amt_old;    //taker buy how much saved
        uint m_buy_amt;        //maker offer wants to buy this much token
        uint m_pay_amt;        //maker offer wants to sell this much token

        // there is at least one offer stored for token pair
        while (_best[t_buy_gem][t_pay_gem] > 0) {
            best_maker_id = _best[t_buy_gem][t_pay_gem];
            m_buy_amt = offers[best_maker_id].buy_amt;
            m_pay_amt = offers[best_maker_id].pay_amt;

            // Ugly hack to work around rounding errors. Based on the idea that
            // the furthest the amounts can stray from their "true" values is 1.
            // Ergo the worst case has t_pay_amt and m_pay_amt at +1 away from
            // their "correct" values and m_buy_amt and t_buy_amt at -1.
            // Since (c - 1) * (d - 1) > (a + 1) * (b + 1) is equivalent to
            // c * d > a * b + a + b + c + d, we write...
            if (mul(m_buy_amt, t_buy_amt) > mul(t_pay_amt, m_pay_amt) +
                (rounding ? m_buy_amt + t_buy_amt + t_pay_amt + m_pay_amt : 0))
            {
                break;
            }
            // ^ The `rounding` parameter is a compromise borne of a couple days
            // of discussion.

            buy(best_maker_id, min(m_pay_amt, t_buy_amt));
            t_buy_amt_old = t_buy_amt;
            t_buy_amt = sub(t_buy_amt, min(m_pay_amt, t_buy_amt));
            t_pay_amt = mul(t_buy_amt, t_pay_amt) / t_buy_amt_old;

            if (t_pay_amt == 0 || t_buy_amt == 0) {
                break;
            }
        }

        if (t_buy_amt > 0 && t_pay_amt > 0) {
            //new offer should be created
            id = super.offer(t_pay_amt, t_pay_gem, t_buy_amt, t_buy_gem);
            //insert offer into the sorted list
            _sort(id, pos);
        }
    }

    // Make a new offer without putting it in the sorted list.
    // Takes funds from the caller into market escrow.
    // ****Available to authorized contracts only!**********
    // Keepers should call insert(id,pos) to put offer in the sorted list.
    function _offeru(
        uint pay_amt,      //maker (ask) sell how much
        ERC20 pay_gem,     //maker (ask) sell which token
        uint buy_amt,      //maker (ask) buy how much
        ERC20 buy_gem      //maker (ask) buy which token
    )
        internal
        returns (uint id)
    {
        require(_dust[pay_gem] <= pay_amt);
        id = super.offer(pay_amt, pay_gem, buy_amt, buy_gem);
        _near[id] = _head;
        _head = id;
        LogUnsortedOffer(id);
    }

    //put offer into the sorted list
    function _sort(
        uint id,    //maker (ask) id
        uint pos    //position to insert into
    )
        internal
    {
        require(isActive(id));

        address buy_gem = address(offers[id].buy_gem);
        address pay_gem = address(offers[id].pay_gem);
        uint prev_id;                                      //maker (ask) id

        if (pos == 0 || !isOfferSorted(pos)) {
            pos = _find(id);
        } else {
            pos = _findpos(id, pos);

            //if user has entered a `pos` that belongs to another currency pair
            //we start from scratch
            if(pos != 0 && (offers[pos].pay_gem != offers[id].pay_gem
                      || offers[pos].buy_gem != offers[id].buy_gem))
            {
                pos = 0;
                pos=_find(id);
            }
        }


        //requirement below is satisfied by statements above
        //require(pos == 0 || isOfferSorted(pos));


        if (pos != 0) {                                    //offers[id] is not the highest offer
            //requirement below is satisfied by statements above
            //require(_isPricedLtOrEq(id, pos));
            prev_id = _rank[pos].prev;
            _rank[pos].prev = id;
            _rank[id].next = pos;
        } else {                                           //offers[id] is the highest offer
            prev_id = _best[pay_gem][buy_gem];
            _best[pay_gem][buy_gem] = id;
        }

        if (prev_id != 0) {                               //if lower offer does exist
            //requirement below is satisfied by statements above
            //require(!_isPricedLtOrEq(id, prev_id));
            _rank[prev_id].next = id;
            _rank[id].prev = prev_id;
        }

        _span[pay_gem][buy_gem]++;
        LogSortedOffer(id);
    }

    // Remove offer from the sorted list (does not cancel offer)
    function _unsort(
        uint id    //id of maker (ask) offer to remove from sorted list
    )
        internal
        returns (bool)
    {
        address buy_gem = address(offers[id].buy_gem);
        address pay_gem = address(offers[id].pay_gem);
        require(_span[pay_gem][buy_gem] > 0);

        require(_rank[id].delb == 0 &&                    //assert id is in the sorted list
                 isOfferSorted(id));

        if (id != _best[pay_gem][buy_gem]) {              // offers[id] is not the highest offer
            require(_rank[_rank[id].next].prev == id);
            _rank[_rank[id].next].prev = _rank[id].prev;
        } else {                                          //offers[id] is the highest offer
            _best[pay_gem][buy_gem] = _rank[id].prev;
        }

        if (_rank[id].prev != 0) {                        //offers[id] is not the lowest offer
            require(_rank[_rank[id].prev].next == id);
            _rank[_rank[id].prev].next = _rank[id].next;
        }

        _span[pay_gem][buy_gem]--;
        _rank[id].delb = block.number;                    //mark _rank[id] for deletion
        return true;
    }

    //Hide offer from the unsorted order book (does not cancel offer)
    function _hide(
        uint id     //id of maker offer to remove from unsorted list
    )
        internal
        returns (bool)
    {
        uint uid = _head;               //id of an offer in unsorted offers list
        uint pre = uid;                 //id of previous offer in unsorted offers list

        require(!isOfferSorted(id));    //make sure offer id is not in sorted offers list

        if (_head == id) {              //check if offer is first offer in unsorted offers list
            _head = _near[id];          //set head to new first unsorted offer
            _near[id] = 0;              //delete order from unsorted order list
            return true;
        }
        while (uid > 0 && uid != id) {  //find offer in unsorted order list
            pre = uid;
            uid = _near[uid];
        }
        if (uid != id) {                //did not find offer id in unsorted offers list
            return false;
        }
        _near[pre] = _near[id];         //set previous unsorted offer to point to offer after offer id
        _near[id] = 0;                  //delete order from unsorted order list
        return true;
    }
}

Contract ABI

[{"constant":true,"inputs":[],"name":"matchingEnabled","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"sell_gem","type":"address"},{"name":"buy_gem","type":"address"}],"name":"getBestOffer","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"pay_gem","type":"address"},{"name":"pay_amt","type":"uint256"},{"name":"buy_gem","type":"address"},{"name":"min_fill_amount","type":"uint256"}],"name":"sellAllAmount","outputs":[{"name":"fill_amt","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[],"name":"stop","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"pay_gem","type":"address"},{"name":"buy_gem","type":"address"},{"name":"pay_amt","type":"uint128"},{"name":"buy_amt","type":"uint128"}],"name":"make","outputs":[{"name":"","type":"bytes32"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"owner_","type":"address"}],"name":"setOwner","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"buy_gem","type":"address"},{"name":"pay_gem","type":"address"},{"name":"pay_amt","type":"uint256"}],"name":"getBuyAmount","outputs":[{"name":"fill_amt","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"pay_amt","type":"uint256"},{"name":"pay_gem","type":"address"},{"name":"buy_amt","type":"uint256"},{"name":"buy_gem","type":"address"},{"name":"pos","type":"uint256"}],"name":"offer","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"id","type":"uint256"},{"name":"pos","type":"uint256"}],"name":"insert","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"last_offer_id","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"matchingEnabled_","type":"bool"}],"name":"setMatchingEnabled","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"id","type":"uint256"}],"name":"cancel","outputs":[{"name":"success","type":"bool"}],"payable":false,"stateMutability":"nonpayable","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,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"id","type":"uint256"}],"name":"del_rank","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"id","type":"bytes32"},{"name":"maxTakeAmount","type":"uint128"}],"name":"take","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"pay_gem","type":"address"}],"name":"getMinSell","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getTime","outputs":[{"name":"","type":"uint64"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"id","type":"uint256"}],"name":"getNextUnsortedOffer","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"close_time","outputs":[{"name":"","type":"uint64"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"address"}],"name":"_span","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"},{"name":"","type":"address"}],"name":"_best","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"stopped","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"id_","type":"bytes32"}],"name":"bump","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"authority_","type":"address"}],"name":"setAuthority","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"sell_gem","type":"address"},{"name":"buy_gem","type":"address"}],"name":"getOfferCount","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"buy_gem","type":"address"},{"name":"buy_amt","type":"uint256"},{"name":"pay_gem","type":"address"},{"name":"max_fill_amount","type":"uint256"}],"name":"buyAllAmount","outputs":[{"name":"fill_amt","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"name":"id","type":"uint256"}],"name":"isActive","outputs":[{"name":"active","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"offers","outputs":[{"name":"pay_amt","type":"uint256"},{"name":"pay_gem","type":"address"},{"name":"buy_amt","type":"uint256"},{"name":"buy_gem","type":"address"},{"name":"owner","type":"address"},{"name":"timestamp","type":"uint64"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getFirstUnsortedOffer","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"id","type":"uint256"}],"name":"getBetterOffer","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"address"}],"name":"_dust","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"id","type":"uint256"}],"name":"getWorseOffer","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"_near","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"id","type":"bytes32"}],"name":"kill","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"pay_gem","type":"address"},{"name":"dust","type":"uint256"}],"name":"setMinSell","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"authority","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"isClosed","outputs":[{"name":"closed","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"","type":"uint256"}],"name":"_rank","outputs":[{"name":"next","type":"uint256"},{"name":"prev","type":"uint256"},{"name":"delb","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"id","type":"uint256"}],"name":"getOwner","outputs":[{"name":"owner","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"id","type":"uint256"}],"name":"isOfferSorted","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"buyEnabled_","type":"bool"}],"name":"setBuyEnabled","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"id","type":"uint256"},{"name":"amount","type":"uint256"}],"name":"buy","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"pay_amt","type":"uint256"},{"name":"pay_gem","type":"address"},{"name":"buy_amt","type":"uint256"},{"name":"buy_gem","type":"address"},{"name":"pos","type":"uint256"},{"name":"rounding","type":"bool"}],"name":"offer","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"pay_amt","type":"uint256"},{"name":"pay_gem","type":"address"},{"name":"buy_amt","type":"uint256"},{"name":"buy_gem","type":"address"}],"name":"offer","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"buyEnabled","outputs":[{"name":"","type":"bool"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"name":"pay_gem","type":"address"},{"name":"buy_gem","type":"address"},{"name":"buy_amt","type":"uint256"}],"name":"getPayAmount","outputs":[{"name":"fill_amt","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"close_time","type":"uint64"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":true,"inputs":[{"indexed":true,"name":"sig","type":"bytes4"},{"indexed":true,"name":"guy","type":"address"},{"indexed":true,"name":"foo","type":"bytes32"},{"indexed":true,"name":"bar","type":"bytes32"},{"indexed":false,"name":"wad","type":"uint256"},{"indexed":false,"name":"fax","type":"bytes"}],"name":"LogNote","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"id","type":"uint256"}],"name":"LogItemUpdate","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"pay_amt","type":"uint256"},{"indexed":true,"name":"pay_gem","type":"address"},{"indexed":false,"name":"buy_amt","type":"uint256"},{"indexed":true,"name":"buy_gem","type":"address"}],"name":"LogTrade","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"id","type":"bytes32"},{"indexed":true,"name":"pair","type":"bytes32"},{"indexed":true,"name":"maker","type":"address"},{"indexed":false,"name":"pay_gem","type":"address"},{"indexed":false,"name":"buy_gem","type":"address"},{"indexed":false,"name":"pay_amt","type":"uint128"},{"indexed":false,"name":"buy_amt","type":"uint128"},{"indexed":false,"name":"timestamp","type":"uint64"}],"name":"LogMake","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"id","type":"bytes32"},{"indexed":true,"name":"pair","type":"bytes32"},{"indexed":true,"name":"maker","type":"address"},{"indexed":false,"name":"pay_gem","type":"address"},{"indexed":false,"name":"buy_gem","type":"address"},{"indexed":false,"name":"pay_amt","type":"uint128"},{"indexed":false,"name":"buy_amt","type":"uint128"},{"indexed":false,"name":"timestamp","type":"uint64"}],"name":"LogBump","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"id","type":"bytes32"},{"indexed":true,"name":"pair","type":"bytes32"},{"indexed":true,"name":"maker","type":"address"},{"indexed":false,"name":"pay_gem","type":"address"},{"indexed":false,"name":"buy_gem","type":"address"},{"indexed":true,"name":"taker","type":"address"},{"indexed":false,"name":"take_amt","type":"uint128"},{"indexed":false,"name":"give_amt","type":"uint128"},{"indexed":false,"name":"timestamp","type":"uint64"}],"name":"LogTake","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"id","type":"bytes32"},{"indexed":true,"name":"pair","type":"bytes32"},{"indexed":true,"name":"maker","type":"address"},{"indexed":false,"name":"pay_gem","type":"address"},{"indexed":false,"name":"buy_gem","type":"address"},{"indexed":false,"name":"pay_amt","type":"uint128"},{"indexed":false,"name":"buy_amt","type":"uint128"},{"indexed":false,"name":"timestamp","type":"uint64"}],"name":"LogKill","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"authority","type":"address"}],"name":"LogSetAuthority","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"}],"name":"LogSetOwner","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"isEnabled","type":"bool"}],"name":"LogBuyEnabled","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"pay_gem","type":"address"},{"indexed":false,"name":"min_amount","type":"uint256"}],"name":"LogMinSell","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"isEnabled","type":"bool"}],"name":"LogMatchingEnabled","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"id","type":"uint256"}],"name":"LogUnsortedOffer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"id","type":"uint256"}],"name":"LogSortedOffer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"keeper","type":"address"},{"indexed":false,"name":"id","type":"uint256"}],"name":"LogInsert","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"keeper","type":"address"},{"indexed":false,"name":"id","type":"uint256"}],"name":"LogDelete","type":"event"}]

Contract Creation Code

608060405260048054605860020a60ff0219605060020a60ff02199091166a010000000000000000000017166b01000000000000000000000017905534801561004757600080fd5b5060405160208061312c833981016040819052905160018054600160a060020a0319163390811790915590918291907fce241d7ca1f669fee44b6fc00b8eba2df3bb514eed0f6f668f8f89096e81ed9490600090a26004805467ffffffffffffffff9092166101000268ffffffffffffffff001990921691909117905550613058806100d46000396000f30060806040526004361061023a5763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166301492a0b811461023f5780630374fc6f146102685780630621b4f6146102a157806307da68f5146102cf578063093f5198146102e657806313af40351461031f578063144a2752146103405780631b33d4121461036a5780631d834a1b1461039b578063232cae0b146103b65780632aed1905146103cb57806340e58ee5146103e55780634579268a146103fd578063467f0b7b14610446578063496064551461045e578063511fa48714610482578063557ed1ba146104a357806361f54a79146104d55780636377ebca146104ed578063677170e11461050257806374c1d7d31461052957806375f12b2114610550578063779997c3146105655780637a9e5e4b1461057d5780637ca9429a1461059e5780638185402b146105c557806382afd23b146105f35780638a72ea6a1461060b5780638af82a2e1461066d5780638da5cb5b14610682578063911550f4146106b357806391be90c8146106cb578063943911bc146106ec578063a78d431614610704578063b4f9b6c81461071c578063bf7c734e14610734578063bf7e214f14610758578063c2b6b58c1461076d578063c2d526aa14610782578063c41a360a146107b8578063d2b420ce146107d0578063d6f15469146107e8578063d6febde814610802578063e1a6f0141461081d578063f09ea2a614610853578063f582d29314610881578063ff1fd97414610896575b600080fd5b34801561024b57600080fd5b506102546108c0565b604080519115158252519081900360200190f35b34801561027457600080fd5b5061028f600160a060020a03600435811690602435166108d8565b60408051918252519081900360200190f35b3480156102ad57600080fd5b5061028f600160a060020a036004358116906024359060443516606435610905565b3480156102db57600080fd5b506102e4610a94565b005b3480156102f257600080fd5b5061028f600160a060020a03600435811690602435166001608060020a0360443581169060643516610ad6565b34801561032b57600080fd5b506102e4600160a060020a0360043516610aff565b34801561034c57600080fd5b5061028f600160a060020a0360043581169060243516604435610b7d565b34801561037657600080fd5b5061028f600435600160a060020a036024358116906044359060643516608435610c49565b3480156103a757600080fd5b50610254600435602435610c76565b3480156103c257600080fd5b5061028f610d41565b3480156103d757600080fd5b506102546004351515610d47565b3480156103f157600080fd5b50610254600435610ddd565b34801561040957600080fd5b50610415600435610ed8565b60408051948552600160a060020a039384166020860152848101929092529091166060830152519081900360800190f35b34801561045257600080fd5b50610254600435610f0e565b34801561046a57600080fd5b506102e46004356001608060020a036024351661100d565b34801561048e57600080fd5b5061028f600160a060020a036004351661102f565b3480156104af57600080fd5b506104b861104a565b6040805167ffffffffffffffff9092168252519081900360200190f35b3480156104e157600080fd5b5061028f60043561104e565b3480156104f957600080fd5b506104b8611060565b34801561050e57600080fd5b5061028f600160a060020a0360043581169060243516611075565b34801561053557600080fd5b5061028f600160a060020a0360043581169060243516611092565b34801561055c57600080fd5b506102546110af565b34801561057157600080fd5b506102e46004356110c5565b34801561058957600080fd5b506102e4600160a060020a03600435166111c5565b3480156105aa57600080fd5b5061028f600160a060020a036004358116906024351661123f565b3480156105d157600080fd5b5061028f600160a060020a03600435811690602435906044351660643561126a565b3480156105ff57600080fd5b506102546004356113de565b34801561061757600080fd5b50610623600435611405565b60408051968752600160a060020a039586166020880152868101949094529184166060860152909216608084015267ffffffffffffffff90911660a0830152519081900360c00190f35b34801561067957600080fd5b5061028f611457565b34801561068e57600080fd5b5061069761145d565b60408051600160a060020a039092168252519081900360200190f35b3480156106bf57600080fd5b5061028f60043561146c565b3480156106d757600080fd5b5061028f600160a060020a036004351661147e565b3480156106f857600080fd5b5061028f600435611490565b34801561071057600080fd5b5061028f6004356114a5565b34801561072857600080fd5b506102e46004356114b7565b34801561074057600080fd5b50610254600160a060020a03600435166024356114ce565b34801561076457600080fd5b506106976115a2565b34801561077957600080fd5b506102546115b1565b34801561078e57600080fd5b5061079a6004356115f8565b60408051938452602084019290925282820152519081900360600190f35b3480156107c457600080fd5b50610697600435611619565b3480156107dc57600080fd5b50610254600435611637565b3480156107f457600080fd5b5061025460043515156116a8565b34801561080e57600080fd5b5061025460043560243561173c565b34801561082957600080fd5b5061028f600435600160a060020a03602435811690604435906064351660843560a43515156117e6565b34801561085f57600080fd5b5061028f600435600160a060020a0360243581169060443590606435166118ae565b34801561088d57600080fd5b50610254611935565b3480156108a257600080fd5b5061028f600160a060020a036004358116906024351660443561194c565b6004546b010000000000000000000000900460ff1681565b600160a060020a038083166000908152600660209081526040808320938516835292905220545b92915050565b6004546000908190819060ff1615610955576040805160e560020a62461bcd028152602060048201526012602482015260008051602061300d833981519152604482015290519081900360640190fd5b6000861115610a7d5761096885886108d8565b915081151561097657600080fd5b6000828152600360205260409020600281015490546109959190611a05565b86670de0b6b3a76400000210156109ab57610a7d565b6000828152600360205260409020600201548610610a1f576000828152600360205260409020546109dd908490611a36565b6000838152600360205260409020600201549093506109fd908790611a46565b600083815260036020526040902054909650610a1a90839061100d565b610a78565b60008281526003602052604090208054600290910154633b9aca0091610a519189840291610a4c91611a56565b611a72565b811515610a5a57fe5b049050610a678382611a36565b9250610a73828261100d565b600095505b610955565b83831015610a8a57600080fd5b5050949350505050565b610aaa33600035600160e060020a031916611aa2565b1515610ab557600080fd5b6004805469ff00000000000000000019166901000000000000000000179055565b6000610af6836001608060020a031686846001608060020a0316876118ae565b95945050505050565b610b1533600035600160e060020a031916611aa2565b1515610b2057600080fd5b6001805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0383811691909117918290556040519116907fce241d7ca1f669fee44b6fc00b8eba2df3bb514eed0f6f668f8f89096e81ed9490600090a250565b600080610b8a85856108d8565b90505b600081815260036020526040902060020154831115610c0757600081815260036020526040902054610bc0908390611a36565b600082815260036020526040902060020154909250610be0908490611a46565b92506000831115610c0257610bf481611490565b9050801515610c0257600080fd5b610b8d565b60008181526003602052604090208054600290910154610af6918491633b9aca0091610c3a9188840291610a4c91611a56565b811515610c4357fe5b04611a36565b6000610c536115b1565b15610c5d57600080fd5b610c6c868686868660006117e6565b9695505050505050565b60045460009060ff1615610cc2576040805160e560020a62461bcd028152602060048201526012602482015260008051602061300d833981519152604482015290519081900360640190fd5b610ccb83611637565b15610cd557600080fd5b610cde836113de565b1515610ce957600080fd5b610cf283611ba9565b50610cfd8383611c51565b604080513381526020810185905281517f6d5c16212bdea16850dce4d9fa2314c446bd30ce84700d9c36c7677c6d283940929181900390910190a150600192915050565b60025481565b6000610d5f33600035600160e060020a031916611aa2565b1515610d6a57600080fd5b600480548315156b0100000000000000000000009081026bff0000000000000000000000199092169190911791829055604080519190920460ff161515815290517fea11e00ec1642be9b494019b756440e2c57dbe9e59242c4f9c64ce33fb4f41d99181900360200190a1506001919050565b600081610de9816113de565b1515610df457600080fd5b610dfd81611619565b600160a060020a031633600160a060020a03161480610e1f5750610e1f6115b1565b1515610e2a57600080fd5b60045460ff1615610e73576040805160e560020a62461bcd028152602060048201526012602482015260008051602061300d833981519152604482015290519081900360640190fd5b6004546b010000000000000000000000900460ff1615610ec857610e9683611637565b15610eb457610ea483611e2c565b1515610eaf57600080fd5b610ec8565b610ebd83611ba9565b1515610ec857600080fd5b610ed183611fec565b9392505050565b600090815260036020819052604090912080546001820154600283015492909301549093600160a060020a039384169390911690565b60045460009060ff1615610f5a576040805160e560020a62461bcd028152602060048201526012602482015260008051602061300d833981519152604482015290519081900360640190fd5b610f63826113de565b158015610f80575060008281526005602052604090206002015415155b8015610fa057506000828152600560205260409020600201546009194301115b1515610fab57600080fd5b60008281526005602090815260408083208381556001810184905560020192909255815133815290810184905281517fcb9d6176c6aac6478ebb9a2754cdce22a944de29ed1f2642f8613884eba4b40c929181900390910190a1506001919050565b611020826001608060020a03831661173c565b151561102b57600080fd5b5050565b600160a060020a031660009081526008602052604090205490565b4290565b60009081526009602052604090205490565b600454610100900467ffffffffffffffff1681565b600760209081526000928352604080842090915290825290205481565b600660209081526000928352604080842090915290825290205481565b6004546901000000000000000000900460ff1681565b6000816110d1816113de565b15156110dc57600080fd5b6110e46115b1565b156110ee57600080fd5b6000838152600360208181526040808420600481015460018201548286015484516c01000000000000000000000000600160a060020a03938416818102835292841690810260148301528651918290036028018220998d90529787528454600290950154918152958601969096526001608060020a039283168585015291909416606084015267ffffffffffffffff60a060020a850416608084015290518796509216929185917f70a14c213064359ede031fd2a1645a11ce2ec825ffe6ab5cfb5b160c3ef4d0a2919081900360a00190a4505050565b6111db33600035600160e060020a031916611aa2565b15156111e657600080fd5b6000805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a03838116919091178083556040519116917f1abebea81bfa2637f28358c371278fb15ede7ea8dd28d2e03b112ff6d936ada491a250565b600160a060020a03918216600090815260076020908152604080832093909416825291909152205490565b600454600090819060ff16156112b8576040805160e560020a62461bcd028152602060048201526012602482015260008051602061300d833981519152604482015290519081900360640190fd5b60008511156113c8576112cb86856108d8565b90508015156112d957600080fd5b600081815260036020526040902080546002909101546112f99190611a05565b85670de0b6b3a764000002101561130f576113c8565b600081815260036020526040902054851061138057600081815260036020526040902060020154611341908390611a36565b60008281526003602052604090205490925061135e908690611a46565b60008281526003602052604090205490955061137b90829061100d565b6113c3565b6000818152600360205260409020600281015490546113b2918491633b9aca0091610c3a918a840291610a4c91611a56565b91506113be818661100d565b600094505b6112b8565b828211156113d557600080fd5b50949350505050565b60009081526003602052604081206004015460a060020a900467ffffffffffffffff161190565b6003602081905260009182526040909120805460018201546002830154938301546004909301549193600160a060020a039182169390929082169181169060a060020a900467ffffffffffffffff1686565b600a5490565b600154600160a060020a031681565b60009081526005602052604090205490565b60086020526000908152604090205481565b60009081526005602052604090206001015490565b60096020526000908152604090205481565b6114c081610ddd565b15156114cb57600080fd5b50565b60006114e633600035600160e060020a031916611aa2565b15156114f157600080fd5b60408051348082526020820183815236938301849052600435936024359384938693339360008035600160e060020a031916949092606082018484808284376040519201829003965090945050505050a4600160a060020a0385166000818152600860209081526040918290208790558151928352820186905280517fc28d56449b0bb31e64ee7487e061f57a2e72aea8019d810832f26dda099823d09281900390910190a1506001949350505050565b600054600160a060020a031681565b6004546000906901000000000000000000900460ff16806115f35750600454610100900467ffffffffffffffff166115e761104a565b67ffffffffffffffff16115b905090565b60056020526000908152604090208054600182015460029092015490919083565b600090815260036020526040902060040154600160a060020a031690565b600081815260056020526040812054151580611663575060008281526005602052604090206001015415155b806108ff57505060008181526003602081815260408084206001810154600160a060020a03908116865260068452828620919094015490931684529190529020541490565b60006116c033600035600160e060020a031916611aa2565b15156116cb57600080fd5b600480548315156a01000000000000000000009081026aff00000000000000000000199092169190911791829055604080519190920460ff161515815290517f7089e4f0bcc948f9f723a361590c32d9c2284da7ab1981b1249ad2edb9f953c19181900360200190a1506001919050565b6000612fd58361174b816113de565b151561175657600080fd5b61175e6115b1565b1561176857600080fd5b60045460ff16156117b1576040805160e560020a62461bcd028152602060048201526012602482015260008051602061300d833981519152604482015290519081900360640190fd5b6004546b010000000000000000000000900460ff166117d2576123b86117d6565b61285b5b9150610af685858463ffffffff16565b60006117f06115b1565b156117fa57600080fd5b60045460ff1615611843576040805160e560020a62461bcd028152602060048201526012602482015260008051602061300d833981519152604482015290519081900360640190fd5b600160a060020a03861660009081526008602052604090205487101561186857600080fd5b6004546b010000000000000000000000900460ff1615611897576118908787878787876128cc565b9050610c6c565b6118a387878787612a0f565b979650505050505050565b600454600090612fd59060ff16156118fe576040805160e560020a62461bcd028152602060048201526012602482015260008051602061300d833981519152604482015290519081900360640190fd5b6004546b010000000000000000000000900460ff1661191f57612a0f611923565b612d465b9050610c6c868686868563ffffffff16565b6004546a0100000000000000000000900460ff1681565b60008061195984866108d8565b90505b6000818152600360205260409020548311156119d35760008181526003602052604090206002015461198f908390611a36565b6000828152600360205260409020549092506119ac908490611a46565b925060008311156119ce576119c081611490565b90508015156119ce57600080fd5b61195c565b600081815260036020526040902060028101549054610af6918491633b9aca0091610c3a9188840291610a4c91611a56565b600081611a25611a1d85670de0b6b3a7640000612dd0565b600285610c43565b811515611a2e57fe5b049392505050565b808201828110156108ff57600080fd5b808203828111156108ff57600080fd5b600081611a25611a1d856b033b2e3c9fd0803ce8000000612dd0565b60006b033b2e3c9fd0803ce8000000611a25611a8e8585612dd0565b60026b033b2e3c9fd0803ce8000000610c43565b6000600160a060020a038316301415611abd575060016108ff565b600154600160a060020a0384811691161415611adb575060016108ff565b600054600160a060020a03161515611af5575060006108ff565b60008054604080517fb7009613000000000000000000000000000000000000000000000000000000008152600160a060020a038781166004830152306024830152600160e060020a0319871660448301529151919092169263b700961392606480820193602093909283900390910190829087803b158015611b7657600080fd5b505af1158015611b8a573d6000803e3d6000fd5b505050506040513d6020811015611ba057600080fd5b505190506108ff565b600a5460009080611bb984611637565b15611bc357600080fd5b83600a541415611bea5760008481526009602052604081208054600a555560019250611c4a565b5b600082118015611bfb5750838214155b15611c16575060008181526009602052604090205490611beb565b818414611c265760009250611c4a565b60008481526009602052604080822080548484529183209190915585825255600192505b5050919050565b6000806000611c5f856113de565b1515611c6a57600080fd5b600085815260036020819052604090912090810154600190910154600160a060020a039182169450169150831580611ca85750611ca684611637565b155b15611cbd57611cb685612df8565b9350611d48565b611cc78585612e81565b93508315801590611d3357506000858152600360205260408082206001908101548784529190922090910154600160a060020a039081169116141580611d335750600085815260036020819052604080832082015487845292200154600160a060020a03908116911614155b15611d485760009350611d4585612df8565b93505b8315611d7457506000838152600560205260408082206001018054908790558683529120849055611da1565b50600160a060020a0381811660009081526006602090815260408083209386168352929052208054908590555b8015611dc55760008181526005602052604080822087905586825290206001018190555b600160a060020a03808316600090815260076020908152604080832093871683529281529082902080546001019055815187815291517f20fb9bad86c18f7e22e8065258790d9416a7d2df8ff05f80f82c46d38b925acd9281900390910190a15050505050565b600081815260036020818152604080842092830154600190930154600160a060020a03908116808652600784528286209190941680865292528320549091908310611e7657600080fd5b600084815260056020526040902060020154158015611e995750611e9984611637565b1515611ea457600080fd5b600160a060020a038082166000908152600660209081526040808320938616835292905220548414611f17576000848152600560205260408082205482529020600101548414611ef357600080fd5b60008481526005602052604080822060018082015491548452919092200155611f4d565b600084815260056020908152604080832060010154600160a060020a038086168552600684528285209087168552909252909120555b60008481526005602052604090206001015415611fa4576000848152600560205260408082206001015482529020548414611f8757600080fd5b600084815260056020526040808220805460019091015483529120555b600160a060020a039081166000908152600760209081526040808320949093168252928352818120805460001901905593845260059091529091204360029091015550600190565b6000611ff6612fd7565b82612000816113de565b151561200b57600080fd5b61201481611619565b600160a060020a031633600160a060020a0316148061203657506120366115b1565b151561204157600080fd5b60045460ff161561205157600080fd5b6001600460006101000a81548160ff0219169083151502179055506003600085815260200190815260200160002060c06040519081016040529081600082015481526020016001820160009054906101000a9004600160a060020a0316600160a060020a0316600160a060020a03168152602001600282015481526020016003820160009054906101000a9004600160a060020a0316600160a060020a0316600160a060020a031681526020016004820160009054906101000a9004600160a060020a0316600160a060020a0316600160a060020a031681526020016004820160149054906101000a900467ffffffffffffffff1667ffffffffffffffff1667ffffffffffffffff16815250509150600360008581526020019081526020016000206000808201600090556001820160006101000a815490600160a060020a03021916905560028201600090556003820160006101000a815490600160a060020a0302191690556004820160006101000a815490600160a060020a0302191690556004820160146101000a81549067ffffffffffffffff021916905550508160200151600160a060020a031663a9059cbb836080015184600001516040518363ffffffff167c01000000000000000000000000000000000000000000000000000000000281526004018083600160a060020a0316600160a060020a0316815260200182815260200192505050602060405180830381600087803b15801561227757600080fd5b505af115801561228b573d6000803e3d6000fd5b505050506040513d60208110156122a157600080fd5b505115156122ae57600080fd5b6040805185815290517fa2c251311b1a7a475913900a2a73dc9789a21b04bc737e050bbc506dd4eb34889181900360200190a16080808301516020808501805160608088018051604080516c01000000000000000000000000600160a060020a039687168102825292861690920260148301528051918290036028018220955192518b51828d01519487168452908616978301979097526001608060020a0396871682820152959091169181019190915267ffffffffffffffff4216958101959095529151919092169287917f9577941d28fff863bfbee4694a6a4a56fb09e169619189d2eaa750b5b48199959181900360a00190a450506004805460ff19169055506001919050565b60006123c2612fd7565b6000846123ce816113de565b15156123d957600080fd5b6123e16115b1565b156123eb57600080fd5b60045460ff16156123fb57600080fd5b60048054600160ff1990911681178255600088815260036020818152604092839020835160c081018552815480825295820154600160a060020a03908116938201939093526002820154948101859052928101548216606084015290940154938416608082015260a060020a90930467ffffffffffffffff1660a084015291945090612488908790612dd0565b81151561249157fe5b0491506001608060020a03821682146124a957600080fd5b6001608060020a03851685146124be57600080fd5b8415806124c9575081155b806124d45750825185115b806124e25750826040015182115b156124f05760009350612848565b82516124fc9086611a46565b600087815260036020526040908190209190915583015161251d9083611a46565b6000878152600360209081526040808320600201939093556060860151608087015184517f23b872dd000000000000000000000000000000000000000000000000000000008152336004820152600160a060020a0391821660248201526044810188905294519116936323b872dd9360648083019493928390030190829087803b1580156125aa57600080fd5b505af11580156125be573d6000803e3d6000fd5b505050506040513d60208110156125d457600080fd5b505115156125e157600080fd5b602080840151604080517fa9059cbb000000000000000000000000000000000000000000000000000000008152336004820152602481018990529051600160a060020a039092169263a9059cbb926044808401938290030181600087803b15801561264b57600080fd5b505af115801561265f573d6000803e3d6000fd5b505050506040513d602081101561267557600080fd5b5051151561268257600080fd5b6040805187815290517fa2c251311b1a7a475913900a2a73dc9789a21b04bc737e050bbc506dd4eb34889181900360200190a16080808401516020808601805160608089018051604080516c01000000000000000000000000600160a060020a039687168102825292861690920260148301528051918290036028018220955192518f835292851696820196909652908316818601526001608060020a03808d16928201929092529088169581019590955267ffffffffffffffff421660a086015291513394939092169290917f3383e3357c77fd2e3a4b30deea81179bc70a795d053d14d5b7f2f01d0fd4596f9181900360c00190a48260600151600160a060020a03168360200151600160a060020a03167f819e390338feffe95e2de57172d6faf337853dfd15c7a09a32d76f7fd24438758785604051808381526020018281526020019250505060405180910390a36000868152600360205260409020541515612843576000868152600360208190526040822082815560018101805473ffffffffffffffffffffffffffffffffffffffff19908116909155600282019390935590810180549092169091556004018054600160e060020a03191690555b600193505b50506004805460ff191690555092915050565b6004546000906a0100000000000000000000900460ff16151561287d57600080fd5b6000838152600360205260409020548214801561289e575061289e83611637565b156128ae576128ac83611e2c565b505b6128b883836123b8565b15156128c357600080fd5b50600192915050565b60008060008060005b600160a060020a038089166000908152600660209081526040808320938e1683529290529081205411156129d4575050600160a060020a038087166000908152600660209081526040808320938c16835292815282822054808352600390915291902060028101549054919350908561294f576000612957565b808b8a840101015b6129618c83612dd0565b0161296c838b612dd0565b1115612977576129d4565b61298a84612985838c612f60565b61173c565b508892506129a18961299c838c612f60565b611a46565b9850826129ae8a8d612dd0565b8115156129b757fe5b049a508a15806129c5575088155b156129cf576129d4565b6128d5565b6000891180156129e4575060008b115b15612a01576129f58b8b8b8b612a0f565b9450612a018588611c51565b505050509695505050505050565b6000612a19612fd7565b612a216115b1565b15612a2b57600080fd5b60045460ff1615612a3b57600080fd5b6004805460ff191660011790556001608060020a0386168614612a5d57600080fd5b6001608060020a0384168414612a7257600080fd5b60008611612a7f57600080fd5b600160a060020a0385161515612a9457600080fd5b60008411612aa157600080fd5b600160a060020a0383161515612ab657600080fd5b600160a060020a038581169084161415612acf57600080fd5b858152600160a060020a038086166020830152604082018590528316606082015233608082015267ffffffffffffffff421660a0820152612b0e612f77565b60008181526003602081815260408084208651815582870151600182018054600160a060020a0392831673ffffffffffffffffffffffffffffffffffffffff1991821617909155838901516002840155606089015195830180549683169682169690961790955560808801516004928301805460a08b015167ffffffffffffffff1660a060020a027fffffffff0000000000000000ffffffffffffffffffffffffffffffffffffffff9385169190981617919091169590951790945581517f23b872dd0000000000000000000000000000000000000000000000000000000081523391810191909152306024820152604481018c90529051949650918916936323b872dd936064808501948390030190829087803b158015612c2f57600080fd5b505af1158015612c43573d6000803e3d6000fd5b505050506040513d6020811015612c5957600080fd5b50511515612c6657600080fd5b6040805183815290517fa2c251311b1a7a475913900a2a73dc9789a21b04bc737e050bbc506dd4eb34889181900360200190a1604080516c01000000000000000000000000600160a060020a0388811682810284529087169182026014840152835192839003602801832090835260208301919091526001608060020a03808a16838501528716606083015267ffffffffffffffff42166080830152915133929185917f773ff502687307abfa024ac9f62f9752a0d210dac2ffd9a29e38e12e2ea82c829181900360a00190a4506004805460ff19169055949350505050565b600160a060020a038316600090815260086020526040812054851015612d6b57600080fd5b612d7785858585612a0f565b600a80546000838152600960209081526040918290209290925591839055815183815291519293507f8173832a493e0a3989e521458e55bfe9feac9f9b675a94e100b9d5a85f81486292918290030190a1949350505050565b6000811580612ded575050808202828282811515612dea57fe5b04145b15156108ff57600080fd5b600080808080808611612e0a57600080fd5b505050600083815260036020818152604080842092830154600190930154600160a060020a039081168086526006845282862091909416808652925283205490935090915b8115801590612e635750612e638683612f85565b15610af6575060008181526005602052604090206001015490612e4f565b600080808411612e9057600080fd5b8215801590612ea55750612ea3836113de565b155b15612ec3576000928352600560205260409092206001015491612e90565b821515612eda57612ed384612df8565b9150612f59565b612ee48484612f85565b15612f24575b8215801590612efe5750612efe8484612f85565b15612f1c575060008281526005602052604090206001015491612eea565b809150612f59565b8215801590612f3a5750612f388484612f85565b155b15612f55576000928352600560205260409092205491612f24565b8291505b5092915050565b600081831115612f705781610ed1565b5090919050565b600280546001019081905590565b6000818152600360205260408082206002015484835290822054612fa99190612dd0565b60008481526003602052604080822060020154858352912054612fcc9190612dd0565b10159392505050565bfe5b6040805160c081018252600080825260208201819052918101829052606081018290526080810182905260a08101919091529056005265656e7472616e637920617474656d70740000000000000000000000000000a165627a7a72305820f276f995529ae8bac0787db2b7b7a45472a56028d3fa937957a08b7ee6582d9a0029000000000000000000000000000000000000000000000000000000005dfa14c0

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

000000000000000000000000000000000000000000000000000000005dfa14c0

-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 000000000000000000000000000000000000000000000000000000005dfa14c0

Swarm Source

bzzr://f276f995529ae8bac0787db2b7b7a45472a56028d3fa937957a08b7ee6582d9a
Block Age Transaction Difficulty GasUsed Reward
Block Age Uncle Number Difficulty GasUsed Reward
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.