{
    "Function": "slitherConstructorConstantVariables",
    "File": "contracts/RubiconMarket.sol",
    "Parent Contracts": [
        "contracts/RubiconMarket.sol",
        "contracts/RubiconMarket.sol",
        "contracts/RubiconMarket.sol",
        "contracts/RubiconMarket.sol",
        "contracts/RubiconMarket.sol",
        "contracts/RubiconMarket.sol",
        "contracts/RubiconMarket.sol",
        "contracts/RubiconMarket.sol"
    ],
    "High-Level Calls": [],
    "Internal Calls": [],
    "Library Calls": [],
    "Low-Level Calls": [],
    "Code": "contract RubiconMarket is MatchingEvents, ExpiringMarket, DSNote {\n    bool public buyEnabled = true; //buy enabled\n    bool public matchingEnabled = true; //true: enable matching,\n    //false: revert to expiring market\n    /// @dev Below is variable to allow for a proxy-friendly constructor\n    bool public initialized;\n\n    /// @dev unused deprecated variable for applying a token distribution on top of a trade\n    bool public AqueductDistributionLive;\n    /// @dev unused deprecated variable for applying a token distribution of this token on top of a trade\n    address public AqueductAddress;\n\n    struct sortInfo {\n        uint256 next; //points to id of next higher offer\n        uint256 prev; //points to id of previous lower offer\n        uint256 delb; //the blocknumber where this entry was marked for delete\n    }\n    mapping(uint256 => sortInfo) public _rank; //doubly linked lists of sorted offer ids\n    mapping(address => mapping(address => uint256)) public _best; //id of the highest offer for a token pair\n    mapping(address => mapping(address => uint256)) public _span; //number of offers stored for token pair in sorted orderbook\n    mapping(address => uint256) public _dust; //minimum sell amount for a token to avoid dust offers\n    mapping(uint256 => uint256) public _near; //next unsorted offer id\n    uint256 public _head; //first unsorted offer id\n    uint256 public dustId; // id of the latest offer marked as dust\n\n    /// @dev Proxy-safe initialization of storage\n    function initialize(bool _live, address _feeTo) public {\n        require(!initialized, \"contract is already initialized\");\n        AqueductDistributionLive = _live;\n\n        /// @notice The market fee recipient\n        feeTo = _feeTo;\n\n        owner = msg.sender;\n        emit LogSetOwner(msg.sender);\n\n        /// @notice The starting fee on taker trades in basis points\n        feeBPS = 20;\n\n        initialized = true;\n        matchingEnabled = true;\n        buyEnabled = true;\n    }\n\n    // After close, anyone can cancel an offer\n    modifier can_cancel(uint256 id) override {\n        require(isActive(id), \"Offer was deleted or taken, or never existed.\");\n        require(\n            isClosed() || msg.sender == getOwner(id) || id == dustId,\n            \"Offer can not be cancelled because user is not owner, and market is open, and offer sells required amount of tokens.\"\n        );\n        _;\n    }\n\n    // ---- Public entrypoints ---- //\n\n    function make(\n        ERC20 pay_gem,\n        ERC20 buy_gem,\n        uint128 pay_amt,\n        uint128 buy_amt\n    ) public override returns (bytes32) {\n        return bytes32(offer(pay_amt, pay_gem, buy_amt, buy_gem));\n    }\n\n    function take(bytes32 id, uint128 maxTakeAmount) public override {\n        require(buy(uint256(id), maxTakeAmount));\n    }\n\n    function kill(bytes32 id) external override {\n        require(cancel(uint256(id)));\n    }\n\n    // Make a new offer. Takes funds from the caller into market escrow.\n    //\n    // If matching is enabled:\n    //     * creates new offer without putting it in\n    //       the sorted list.\n    //     * available to authorized contracts only!\n    //     * keepers should call insert(id,pos)\n    //       to put offer in the sorted list.\n    //\n    // If matching is disabled:\n    //     * calls expiring market's offer().\n    //     * available to everyone without authorization.\n    //     * no sorting is done.\n    //\n    function offer(\n        uint256 pay_amt, //maker (ask) sell how much\n        ERC20 pay_gem, //maker (ask) sell which token\n        uint256 buy_amt, //taker (ask) buy how much\n        ERC20 buy_gem //taker (ask) buy which token\n    ) public override returns (uint256) {\n        require(!locked, \"Reentrancy attempt\");\n\n\n            function(uint256, ERC20, uint256, ERC20) returns (uint256) fn\n         = matchingEnabled ? _offeru : super.offer;\n        return fn(pay_amt, pay_gem, buy_amt, buy_gem);\n    }\n\n    // Make a new offer. Takes funds from the caller into market escrow.\n    function offer(\n        uint256 pay_amt, //maker (ask) sell how much\n        ERC20 pay_gem, //maker (ask) sell which token\n        uint256 buy_amt, //maker (ask) buy how much\n        ERC20 buy_gem, //maker (ask) buy which token\n        uint256 pos //position to insert offer, 0 should be used if unknown\n    ) external can_offer returns (uint256) {\n        return offer(pay_amt, pay_gem, buy_amt, buy_gem, pos, true);\n    }\n\n    function offer(\n        uint256 pay_amt, //maker (ask) sell how much\n        ERC20 pay_gem, //maker (ask) sell which token\n        uint256 buy_amt, //maker (ask) buy how much\n        ERC20 buy_gem, //maker (ask) buy which token\n        uint256 pos, //position to insert offer, 0 should be used if unknown\n        bool matching //match \"close enough\" orders?\n    ) public can_offer returns (uint256) {\n        require(!locked, \"Reentrancy attempt\");\n        require(_dust[address(pay_gem)] <= pay_amt);\n\n        if (matchingEnabled) {\n            return _matcho(pay_amt, pay_gem, buy_amt, buy_gem, pos, matching);\n        }\n        return super.offer(pay_amt, pay_gem, buy_amt, buy_gem);\n    }\n\n    //Transfers funds from caller to offer maker, and from market to caller.\n    function buy(uint256 id, uint256 amount)\n        public\n        override\n        can_buy(id)\n        returns (bool)\n    {\n        require(!locked, \"Reentrancy attempt\");\n\n        //Optional distribution on trade\n        if (AqueductDistributionLive) {\n            IAqueduct(AqueductAddress).distributeToMakerAndTaker(\n                getOwner(id),\n                msg.sender\n            );\n        }\n        function(uint256, uint256) returns (bool) fn = matchingEnabled\n            ? _buys\n            : super.buy;\n\n        return fn(id, amount);\n    }\n\n    // Cancel an offer. Refunds offer maker.\n    function cancel(uint256 id)\n        public\n        override\n        can_cancel(id)\n        returns (bool success)\n    {\n        require(!locked, \"Reentrancy attempt\");\n        if (matchingEnabled) {\n            if (isOfferSorted(id)) {\n                require(_unsort(id));\n            } else {\n                require(_hide(id));\n            }\n        }\n        return super.cancel(id); //delete the offer.\n    }\n\n    //insert offer into the sorted list\n    //keepers need to use this function\n    function insert(\n        uint256 id, //maker (ask) id\n        uint256 pos //position to insert into\n    ) public returns (bool) {\n        require(!locked, \"Reentrancy attempt\");\n        require(!isOfferSorted(id)); //make sure offers[id] is not yet sorted\n        require(isActive(id)); //make sure offers[id] is active\n\n        _hide(id); //remove offer from unsorted offers list\n        _sort(id, pos); //put offer into the sorted offers list\n        emit LogInsert(msg.sender, id);\n        return true;\n    }\n\n    //deletes _rank [id]\n    //  Function should be called by keepers.\n    function del_rank(uint256 id) external returns (bool) {\n        require(!locked, \"Reentrancy attempt\");\n        require(\n            !isActive(id) &&\n                _rank[id].delb != 0 &&\n                _rank[id].delb < block.number - 10\n        );\n        delete _rank[id];\n        emit LogDelete(msg.sender, id);\n        return true;\n    }\n\n    //set the minimum sell amount for a token\n    //    Function is used to avoid \"dust offers\" that have\n    //    very small amount of tokens to sell, and it would\n    //    cost more gas to accept the offer, than the value\n    //    of tokens received.\n    function setMinSell(\n        ERC20 pay_gem, //token to assign minimum sell amount to\n        uint256 dust //maker (ask) minimum sell amount\n    ) external auth note returns (bool) {\n        _dust[address(pay_gem)] = dust;\n        emit LogMinSell(address(pay_gem), dust);\n        return true;\n    }\n\n    //returns the minimum sell amount for an offer\n    function getMinSell(\n        ERC20 pay_gem //token for which minimum sell amount is queried\n    ) external view returns (uint256) {\n        return _dust[address(pay_gem)];\n    }\n\n    //set buy functionality enabled/disabled\n    function setBuyEnabled(bool buyEnabled_) external auth returns (bool) {\n        buyEnabled = buyEnabled_;\n        emit LogBuyEnabled(buyEnabled);\n        return true;\n    }\n\n    //set matching enabled/disabled\n    //    If matchingEnabled true(default), then inserted offers are matched.\n    //    Except the ones inserted by contracts, because those end up\n    //    in the unsorted list of offers, that must be later sorted by\n    //    keepers using insert().\n    //    If matchingEnabled is false then RubiconMarket is reverted to ExpiringMarket,\n    //    and matching is not done, and sorted lists are disabled.\n    function setMatchingEnabled(bool matchingEnabled_)\n        external\n        auth\n        returns (bool)\n    {\n        matchingEnabled = matchingEnabled_;\n        emit LogMatchingEnabled(matchingEnabled);\n        return true;\n    }\n\n    //return the best offer for a token pair\n    //      the best offer is the lowest one if it's an ask,\n    //      and highest one if it's a bid offer\n    function getBestOffer(ERC20 sell_gem, ERC20 buy_gem)\n        public\n        view\n        returns (uint256)\n    {\n        return _best[address(sell_gem)][address(buy_gem)];\n    }\n\n    //return the next worse offer in the sorted list\n    //      the worse offer is the higher one if its an ask,\n    //      a lower one if its a bid offer,\n    //      and in both cases the newer one if they're equal.\n    function getWorseOffer(uint256 id) public view returns (uint256) {\n        return _rank[id].prev;\n    }\n\n    //return the next better offer in the sorted list\n    //      the better offer is in the lower priced one if its an ask,\n    //      the next higher priced one if its a bid offer\n    //      and in both cases the older one if they're equal.\n    function getBetterOffer(uint256 id) external view returns (uint256) {\n        return _rank[id].next;\n    }\n\n    //return the amount of better offers for a token pair\n    function getOfferCount(ERC20 sell_gem, ERC20 buy_gem)\n        public\n        view\n        returns (uint256)\n    {\n        return _span[address(sell_gem)][address(buy_gem)];\n    }\n\n    //get the first unsorted offer that was inserted by a contract\n    //      Contracts can't calculate the insertion position of their offer because it is not an O(1) operation.\n    //      Their offers get put in the unsorted list of offers.\n    //      Keepers can calculate the insertion position offchain and pass it to the insert() function to insert\n    //      the unsorted offer into the sorted list. Unsorted offers will not be matched, but can be bought with buy().\n    function getFirstUnsortedOffer() public view returns (uint256) {\n        return _head;\n    }\n\n    //get the next unsorted offer\n    //      Can be used to cycle through all the unsorted offers.\n    function getNextUnsortedOffer(uint256 id) public view returns (uint256) {\n        return _near[id];\n    }\n\n    function isOfferSorted(uint256 id) public view returns (bool) {\n        return\n            _rank[id].next != 0 ||\n            _rank[id].prev != 0 ||\n            _best[address(offers[id].pay_gem)][address(offers[id].buy_gem)] ==\n            id;\n    }\n\n    function sellAllAmount(\n        ERC20 pay_gem,\n        uint256 pay_amt,\n        ERC20 buy_gem,\n        uint256 min_fill_amount\n    ) external returns (uint256 fill_amt) {\n        require(!locked, \"Reentrancy attempt\");\n        uint256 offerId;\n        while (pay_amt > 0) {\n            //while there is amount to sell\n            offerId = getBestOffer(buy_gem, pay_gem); //Get the best offer for the token pair\n            require(offerId != 0); //Fails if there are not more offers\n\n            // There is a chance that pay_amt is smaller than 1 wei of the other token\n            if (\n                pay_amt * 1 ether <\n                wdiv(offers[offerId].buy_amt, offers[offerId].pay_amt)\n            ) {\n                break; //We consider that all amount is sold\n            }\n            if (pay_amt >= offers[offerId].buy_amt) {\n                //If amount to sell is higher or equal than current offer amount to buy\n                fill_amt = add(fill_amt, offers[offerId].pay_amt); //Add amount bought to acumulator\n                pay_amt = sub(pay_amt, offers[offerId].buy_amt); //Decrease amount to sell\n                take(bytes32(offerId), uint128(offers[offerId].pay_amt)); //We take the whole offer\n            } else {\n                // if lower\n                uint256 baux = rmul(\n                    pay_amt * 10**9,\n                    rdiv(offers[offerId].pay_amt, offers[offerId].buy_amt)\n                ) / 10**9;\n                fill_amt = add(fill_amt, baux); //Add amount bought to acumulator\n                take(bytes32(offerId), uint128(baux)); //We take the portion of the offer that we need\n                pay_amt = 0; //All amount is sold\n            }\n        }\n        require(fill_amt >= min_fill_amount);\n    }\n\n    function buyAllAmount(\n        ERC20 buy_gem,\n        uint256 buy_amt,\n        ERC20 pay_gem,\n        uint256 max_fill_amount\n    ) external returns (uint256 fill_amt) {\n        require(!locked, \"Reentrancy attempt\");\n        uint256 offerId;\n        while (buy_amt > 0) {\n            //Meanwhile there is amount to buy\n            offerId = getBestOffer(buy_gem, pay_gem); //Get the best offer for the token pair\n            require(offerId != 0);\n\n            // There is a chance that buy_amt is smaller than 1 wei of the other token\n            if (\n                buy_amt * 1 ether <\n                wdiv(offers[offerId].pay_amt, offers[offerId].buy_amt)\n            ) {\n                break; //We consider that all amount is sold\n            }\n            if (buy_amt >= offers[offerId].pay_amt) {\n                //If amount to buy is higher or equal than current offer amount to sell\n                fill_amt = add(fill_amt, offers[offerId].buy_amt); //Add amount sold to acumulator\n                buy_amt = sub(buy_amt, offers[offerId].pay_amt); //Decrease amount to buy\n                take(bytes32(offerId), uint128(offers[offerId].pay_amt)); //We take the whole offer\n            } else {\n                //if lower\n                fill_amt = add(\n                    fill_amt,\n                    rmul(\n                        buy_amt * 10**9,\n                        rdiv(offers[offerId].buy_amt, offers[offerId].pay_amt)\n                    ) / 10**9\n                ); //Add amount sold to acumulator\n                take(bytes32(offerId), uint128(buy_amt)); //We take the portion of the offer that we need\n                buy_amt = 0; //All amount is bought\n            }\n        }\n        require(fill_amt <= max_fill_amount);\n    }\n\n    function getBuyAmount(\n        ERC20 buy_gem,\n        ERC20 pay_gem,\n        uint256 pay_amt\n    ) external view returns (uint256 fill_amt) {\n        uint256 offerId = getBestOffer(buy_gem, pay_gem); //Get best offer for the token pair\n        while (pay_amt > offers[offerId].buy_amt) {\n            fill_amt = add(fill_amt, offers[offerId].pay_amt); //Add amount to buy accumulator\n            pay_amt = sub(pay_amt, offers[offerId].buy_amt); //Decrease amount to pay\n            if (pay_amt > 0) {\n                //If we still need more offers\n                offerId = getWorseOffer(offerId); //We look for the next best offer\n                require(offerId != 0); //Fails if there are not enough offers to complete\n            }\n        }\n        fill_amt = add(\n            fill_amt,\n            rmul(\n                pay_amt * 10**9,\n                rdiv(offers[offerId].pay_amt, offers[offerId].buy_amt)\n            ) / 10**9\n        ); //Add proportional amount of last offer to buy accumulator\n    }\n\n    function getPayAmount(\n        ERC20 pay_gem,\n        ERC20 buy_gem,\n        uint256 buy_amt\n    ) external view returns (uint256 fill_amt) {\n        uint256 offerId = getBestOffer(buy_gem, pay_gem); //Get best offer for the token pair\n        while (buy_amt > offers[offerId].pay_amt) {\n            fill_amt = add(fill_amt, offers[offerId].buy_amt); //Add amount to pay accumulator\n            buy_amt = sub(buy_amt, offers[offerId].pay_amt); //Decrease amount to buy\n            if (buy_amt > 0) {\n                //If we still need more offers\n                offerId = getWorseOffer(offerId); //We look for the next best offer\n                require(offerId != 0); //Fails if there are not enough offers to complete\n            }\n        }\n        fill_amt = add(\n            fill_amt,\n            rmul(\n                buy_amt * 10**9,\n                rdiv(offers[offerId].buy_amt, offers[offerId].pay_amt)\n            ) / 10**9\n        ); //Add proportional amount of last offer to pay accumulator\n    }\n\n    // ---- Internal Functions ---- //\n\n    function _buys(uint256 id, uint256 amount) internal returns (bool) {\n        require(buyEnabled);\n        if (amount == offers[id].pay_amt) {\n            if (isOfferSorted(id)) {\n                //offers[id] must be removed from sorted list because all of it is bought\n                _unsort(id);\n            } else {\n                _hide(id);\n            }\n        }\n\n        require(super.buy(id, amount));\n\n        // If offer has become dust during buy, we cancel it\n        if (\n            isActive(id) &&\n            offers[id].pay_amt < _dust[address(offers[id].pay_gem)]\n        ) {\n            dustId = id; //enable current msg.sender to call cancel(id)\n            cancel(id);\n        }\n        return true;\n    }\n\n    //find the id of the next higher offer after offers[id]\n    function _find(uint256 id) internal view returns (uint256) {\n        require(id > 0);\n\n        address buy_gem = address(offers[id].buy_gem);\n        address pay_gem = address(offers[id].pay_gem);\n        uint256 top = _best[pay_gem][buy_gem];\n        uint256 old_top = 0;\n\n        // Find the larger-than-id order whose successor is less-than-id.\n        while (top != 0 && _isPricedLtOrEq(id, top)) {\n            old_top = top;\n            top = _rank[top].prev;\n        }\n        return old_top;\n    }\n\n    //find the id of the next higher offer after offers[id]\n    function _findpos(uint256 id, uint256 pos) internal view returns (uint256) {\n        require(id > 0);\n\n        // Look for an active order.\n        while (pos != 0 && !isActive(pos)) {\n            pos = _rank[pos].prev;\n        }\n\n        if (pos == 0) {\n            //if we got to the end of list without a single active offer\n            return _find(id);\n        } else {\n            // if we did find a nearby active offer\n            // Walk the order book down from there...\n            if (_isPricedLtOrEq(id, pos)) {\n                uint256 old_pos;\n\n                // Guaranteed to run at least once because of\n                // the prior if statements.\n                while (pos != 0 && _isPricedLtOrEq(id, pos)) {\n                    old_pos = pos;\n                    pos = _rank[pos].prev;\n                }\n                return old_pos;\n\n                // ...or walk it up.\n            } else {\n                while (pos != 0 && !_isPricedLtOrEq(id, pos)) {\n                    pos = _rank[pos].next;\n                }\n                return pos;\n            }\n        }\n    }\n\n    //return true if offers[low] priced less than or equal to offers[high]\n    function _isPricedLtOrEq(\n        uint256 low, //lower priced offer's id\n        uint256 high //higher priced offer's id\n    ) internal view returns (bool) {\n        return\n            mul(offers[low].buy_amt, offers[high].pay_amt) >=\n            mul(offers[high].buy_amt, offers[low].pay_amt);\n    }\n\n    //these variables are global only because of solidity local variable limit\n\n    //match offers with taker offer, and execute token transactions\n    function _matcho(\n        uint256 t_pay_amt, //taker sell how much\n        ERC20 t_pay_gem, //taker sell which token\n        uint256 t_buy_amt, //taker buy how much\n        ERC20 t_buy_gem, //taker buy which token\n        uint256 pos, //position id\n        bool rounding //match \"close enough\" orders?\n    ) internal returns (uint256 id) {\n        uint256 best_maker_id; //highest maker id\n        uint256 t_buy_amt_old; //taker buy how much saved\n        uint256 m_buy_amt; //maker offer wants to buy this much token\n        uint256 m_pay_amt; //maker offer wants to sell this much token\n\n        // there is at least one offer stored for token pair\n        while (_best[address(t_buy_gem)][address(t_pay_gem)] > 0) {\n            best_maker_id = _best[address(t_buy_gem)][address(t_pay_gem)];\n            m_buy_amt = offers[best_maker_id].buy_amt;\n            m_pay_amt = offers[best_maker_id].pay_amt;\n\n            // Ugly hack to work around rounding errors. Based on the idea that\n            // the furthest the amounts can stray from their \"true\" values is 1.\n            // Ergo the worst case has t_pay_amt and m_pay_amt at +1 away from\n            // their \"correct\" values and m_buy_amt and t_buy_amt at -1.\n            // Since (c - 1) * (d - 1) > (a + 1) * (b + 1) is equivalent to\n            // c * d > a * b + a + b + c + d, we write...\n            if (\n                mul(m_buy_amt, t_buy_amt) >\n                mul(t_pay_amt, m_pay_amt) +\n                    (\n                        rounding\n                            ? m_buy_amt + t_buy_amt + t_pay_amt + m_pay_amt\n                            : 0\n                    )\n            ) {\n                break;\n            }\n            // ^ The `rounding` parameter is a compromise borne of a couple days\n            // of discussion.\n            buy(best_maker_id, min(m_pay_amt, t_buy_amt));\n            emit LogMatch(id, min(m_pay_amt, t_buy_amt));\n            t_buy_amt_old = t_buy_amt;\n            t_buy_amt = sub(t_buy_amt, min(m_pay_amt, t_buy_amt));\n            t_pay_amt = mul(t_buy_amt, t_pay_amt) / t_buy_amt_old;\n\n            if (t_pay_amt == 0 || t_buy_amt == 0) {\n                break;\n            }\n        }\n\n        if (\n            t_buy_amt > 0 &&\n            t_pay_amt > 0 &&\n            t_pay_amt >= _dust[address(t_pay_gem)]\n        ) {\n            //new offer should be created\n            id = super.offer(t_pay_amt, t_pay_gem, t_buy_amt, t_buy_gem);\n            //insert offer into the sorted list\n            _sort(id, pos);\n        }\n    }\n\n    // Make a new offer without putting it in the sorted list.\n    // Takes funds from the caller into market escrow.\n    // Keepers should call insert(id,pos) to put offer in the sorted list.\n    function _offeru(\n        uint256 pay_amt, //maker (ask) sell how much\n        ERC20 pay_gem, //maker (ask) sell which token\n        uint256 buy_amt, //maker (ask) buy how much\n        ERC20 buy_gem //maker (ask) buy which token\n    ) internal returns (uint256 id) {\n        require(_dust[address(pay_gem)] <= pay_amt);\n        id = super.offer(pay_amt, pay_gem, buy_amt, buy_gem);\n        _near[id] = _head;\n        _head = id;\n        emit LogUnsortedOffer(id);\n    }\n\n    //put offer into the sorted list\n    function _sort(\n        uint256 id, //maker (ask) id\n        uint256 pos //position to insert into\n    ) internal {\n        require(isActive(id));\n\n        ERC20 buy_gem = offers[id].buy_gem;\n        ERC20 pay_gem = offers[id].pay_gem;\n        uint256 prev_id; //maker (ask) id\n\n        pos = pos == 0 ||\n            offers[pos].pay_gem != pay_gem ||\n            offers[pos].buy_gem != buy_gem ||\n            !isOfferSorted(pos)\n            ? _find(id)\n            : _findpos(id, pos);\n\n        if (pos != 0) {\n            //offers[id] is not the highest offer\n            //requirement below is satisfied by statements above\n            //require(_isPricedLtOrEq(id, pos));\n            prev_id = _rank[pos].prev;\n            _rank[pos].prev = id;\n            _rank[id].next = pos;\n        } else {\n            //offers[id] is the highest offer\n            prev_id = _best[address(pay_gem)][address(buy_gem)];\n            _best[address(pay_gem)][address(buy_gem)] = id;\n        }\n\n        if (prev_id != 0) {\n            //if lower offer does exist\n            //requirement below is satisfied by statements above\n            //require(!_isPricedLtOrEq(id, prev_id));\n            _rank[prev_id].next = id;\n            _rank[id].prev = prev_id;\n        }\n\n        _span[address(pay_gem)][address(buy_gem)]++;\n        emit LogSortedOffer(id);\n    }\n\n    // Remove offer from the sorted list (does not cancel offer)\n    function _unsort(\n        uint256 id //id of maker (ask) offer to remove from sorted list\n    ) internal returns (bool) {\n        address buy_gem = address(offers[id].buy_gem);\n        address pay_gem = address(offers[id].pay_gem);\n        require(_span[pay_gem][buy_gem] > 0);\n\n        require(\n            _rank[id].delb == 0 && //assert id is in the sorted list\n                isOfferSorted(id)\n        );\n\n        if (id != _best[pay_gem][buy_gem]) {\n            // offers[id] is not the highest offer\n            require(_rank[_rank[id].next].prev == id);\n            _rank[_rank[id].next].prev = _rank[id].prev;\n        } else {\n            //offers[id] is the highest offer\n            _best[pay_gem][buy_gem] = _rank[id].prev;\n        }\n\n        if (_rank[id].prev != 0) {\n            //offers[id] is not the lowest offer\n            require(_rank[_rank[id].prev].next == id);\n            _rank[_rank[id].prev].next = _rank[id].next;\n        }\n\n        _span[pay_gem][buy_gem]--;\n        _rank[id].delb = block.number; //mark _rank[id] for deletion\n        return true;\n    }\n\n    //Hide offer from the unsorted order book (does not cancel offer)\n    function _hide(\n        uint256 id //id of maker offer to remove from unsorted list\n    ) internal returns (bool) {\n        uint256 uid = _head; //id of an offer in unsorted offers list\n        uint256 pre = uid; //id of previous offer in unsorted offers list\n\n        require(!isOfferSorted(id)); //make sure offer id is not in sorted offers list\n\n        if (_head == id) {\n            //check if offer is first offer in unsorted offers list\n            _head = _near[id]; //set head to new first unsorted offer\n            _near[id] = 0; //delete order from unsorted order list\n            return true;\n        }\n        while (uid > 0 && uid != id) {\n            //find offer in unsorted order list\n            pre = uid;\n            uid = _near[uid];\n        }\n        if (uid != id) {\n            //did not find offer id in unsorted offers list\n            return false;\n        }\n        _near[pre] = _near[id]; //set previous unsorted offer to point to offer after offer id\n        _near[id] = 0; //delete order from unsorted order list\n        return true;\n    }\n\n    function setFeeBPS(uint256 _newFeeBPS) external auth returns (bool) {\n        feeBPS = _newFeeBPS;\n        return true;\n    }\n\n    /// @dev unused deprecated function for applying a token distribution on top of a trade\n    function setAqueductDistributionLive(bool live)\n        external\n        auth\n        returns (bool)\n    {\n        AqueductDistributionLive = live;\n        return true;\n    }\n\n    /// @dev unused deprecated variable for applying a token distribution on top of a trade\n    function setAqueductAddress(address _Aqueduct)\n        external\n        auth\n        returns (bool)\n    {\n        AqueductAddress = _Aqueduct;\n        return true;\n    }\n\n    function setFeeTo(address newFeeTo) external auth returns (bool) {\n        feeTo = newFeeTo;\n        return true;\n    }\n}"
}