Address Details
contract

0x204bA494de6a50a116ecD340556BE8A15734C9D4

Contract Name
AddressSortedLinkedList..hMedian
Creator
0xe23a4c–2b2dee at 0xaf7373–d89477
Balance
0 CELO ( )
Locked CELO Balance
0.00 CELO
Voting CELO Balance
0.00 CELO
Pending Unlocked Gold
0.00 CELO
Tokens
Fetching tokens...
Transactions
0 Transactions
Transfers
0 Transfers
Gas Used
Fetching gas used...
Last Balance Update
3628999
Contract name:
AddressSortedLinkedListWithMedian




Optimization enabled
false
Compiler version
v0.5.8+commit.23d335f2




Verified at
2020-04-22T22:48:35.816911Z

Contract source code

pragma solidity ^0.5.3;


library SafeMath {
    
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 c = a + b;
        require(c >= a, "SafeMath: addition overflow");

        return c;
    }

    
    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        return sub(a, b, "SafeMath: subtraction overflow");
    }

    
    function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b <= a, errorMessage);
        uint256 c = a - b;

        return c;
    }

    
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        
        
        
        if (a == 0) {
            return 0;
        }

        uint256 c = a * b;
        require(c / a == b, "SafeMath: multiplication overflow");

        return c;
    }

    
    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        return div(a, b, "SafeMath: division by zero");
    }

    
    function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        
        require(b > 0, errorMessage);
        uint256 c = a / b;
        

        return c;
    }

    
    function mod(uint256 a, uint256 b) internal pure returns (uint256) {
        return mod(a, b, "SafeMath: modulo by zero");
    }

    
    function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
        require(b != 0, errorMessage);
        return a % b;
    }
}

library LinkedList {
  using SafeMath for uint256;

  struct Element {
    bytes32 previousKey;
    bytes32 nextKey;
    bool exists;
  }

  struct List {
    bytes32 head;
    bytes32 tail;
    uint256 numElements;
    mapping(bytes32 => Element) elements;
  }

  
  function insert(List storage list, bytes32 key, bytes32 previousKey, bytes32 nextKey) public {
    require(key != bytes32(0), "Key must be defined");
    require(!contains(list, key), "Can't insert an existing element");
    require(
      previousKey != key && nextKey != key,
      "Key cannot be the same as previousKey or nextKey"
    );

    Element storage element = list.elements[key];
    element.exists = true;

    if (list.numElements == 0) {
      list.tail = key;
      list.head = key;
    } else {
      require(
        previousKey != bytes32(0) || nextKey != bytes32(0),
        "Either previousKey or nextKey must be defined"
      );

      element.previousKey = previousKey;
      element.nextKey = nextKey;

      if (previousKey != bytes32(0)) {
        require(
          contains(list, previousKey),
          "If previousKey is defined, it must exist in the list"
        );
        Element storage previousElement = list.elements[previousKey];
        require(previousElement.nextKey == nextKey, "previousKey must be adjacent to nextKey");
        previousElement.nextKey = key;
      } else {
        list.tail = key;
      }

      if (nextKey != bytes32(0)) {
        require(contains(list, nextKey), "If nextKey is defined, it must exist in the list");
        Element storage nextElement = list.elements[nextKey];
        require(nextElement.previousKey == previousKey, "previousKey must be adjacent to nextKey");
        nextElement.previousKey = key;
      } else {
        list.head = key;
      }
    }

    list.numElements = list.numElements.add(1);
  }

  
  function push(List storage list, bytes32 key) public {
    insert(list, key, bytes32(0), list.tail);
  }

  
  function remove(List storage list, bytes32 key) public {
    Element storage element = list.elements[key];
    require(key != bytes32(0) && contains(list, key), "key not in list");
    if (element.previousKey != bytes32(0)) {
      Element storage previousElement = list.elements[element.previousKey];
      previousElement.nextKey = element.nextKey;
    } else {
      list.tail = element.nextKey;
    }

    if (element.nextKey != bytes32(0)) {
      Element storage nextElement = list.elements[element.nextKey];
      nextElement.previousKey = element.previousKey;
    } else {
      list.head = element.previousKey;
    }

    delete list.elements[key];
    list.numElements = list.numElements.sub(1);
  }

  
  function update(List storage list, bytes32 key, bytes32 previousKey, bytes32 nextKey) public {
    require(
      key != bytes32(0) && key != previousKey && key != nextKey && contains(list, key),
      "key on in list"
    );
    remove(list, key);
    insert(list, key, previousKey, nextKey);
  }

  
  function contains(List storage list, bytes32 key) public view returns (bool) {
    return list.elements[key].exists;
  }

  
  function headN(List storage list, uint256 n) public view returns (bytes32[] memory) {
    require(n <= list.numElements, "not enough elements");
    bytes32[] memory keys = new bytes32[](n);
    bytes32 key = list.head;
    for (uint256 i = 0; i < n; i = i.add(1)) {
      keys[i] = key;
      key = list.elements[key].previousKey;
    }
    return keys;
  }

  
  function getKeys(List storage list) public view returns (bytes32[] memory) {
    return headN(list, list.numElements);
  }
}

library SortedLinkedList {
  using SafeMath for uint256;
  using LinkedList for LinkedList.List;

  struct List {
    LinkedList.List list;
    mapping(bytes32 => uint256) values;
  }

  
  function insert(
    List storage list,
    bytes32 key,
    uint256 value,
    bytes32 lesserKey,
    bytes32 greaterKey
  ) public {
    require(
      key != bytes32(0) && key != lesserKey && key != greaterKey && !contains(list, key),
      "invalid key"
    );
    require(
      (lesserKey != bytes32(0) || greaterKey != bytes32(0)) || list.list.numElements == 0,
      "greater and lesser key zero"
    );
    require(contains(list, lesserKey) || lesserKey == bytes32(0), "invalid lesser key");
    require(contains(list, greaterKey) || greaterKey == bytes32(0), "invalid greater key");
    (lesserKey, greaterKey) = getLesserAndGreater(list, value, lesserKey, greaterKey);
    list.list.insert(key, lesserKey, greaterKey);
    list.values[key] = value;
  }

  
  function remove(List storage list, bytes32 key) public {
    list.list.remove(key);
    list.values[key] = 0;
  }

  
  function update(
    List storage list,
    bytes32 key,
    uint256 value,
    bytes32 lesserKey,
    bytes32 greaterKey
  ) public {
    
    
    
    remove(list, key);
    insert(list, key, value, lesserKey, greaterKey);
  }

  
  function push(List storage list, bytes32 key) public {
    insert(list, key, 0, bytes32(0), list.list.tail);
  }

  
  function popN(List storage list, uint256 n) public returns (bytes32[] memory) {
    require(n <= list.list.numElements, "not enough elements");
    bytes32[] memory keys = new bytes32[](n);
    for (uint256 i = 0; i < n; i = i.add(1)) {
      bytes32 key = list.list.head;
      keys[i] = key;
      remove(list, key);
    }
    return keys;
  }

  
  function contains(List storage list, bytes32 key) public view returns (bool) {
    return list.list.contains(key);
  }

  
  function getValue(List storage list, bytes32 key) public view returns (uint256) {
    return list.values[key];
  }

  
  function getElements(List storage list) public view returns (bytes32[] memory, uint256[] memory) {
    bytes32[] memory keys = getKeys(list);
    uint256[] memory values = new uint256[](keys.length);
    for (uint256 i = 0; i < keys.length; i = i.add(1)) {
      values[i] = list.values[keys[i]];
    }
    return (keys, values);
  }

  
  function getKeys(List storage list) public view returns (bytes32[] memory) {
    return list.list.getKeys();
  }

  
  function headN(List storage list, uint256 n) public view returns (bytes32[] memory) {
    return list.list.headN(n);
  }

  
  
  function getLesserAndGreater(
    List storage list,
    uint256 value,
    bytes32 lesserKey,
    bytes32 greaterKey
  ) private view returns (bytes32, bytes32) {
    
    
    
    
    
    if (lesserKey == bytes32(0) && isValueBetween(list, value, lesserKey, list.list.tail)) {
      return (lesserKey, list.list.tail);
    } else if (
      greaterKey == bytes32(0) && isValueBetween(list, value, list.list.head, greaterKey)
    ) {
      return (list.list.head, greaterKey);
    } else if (
      lesserKey != bytes32(0) &&
      isValueBetween(list, value, lesserKey, list.list.elements[lesserKey].nextKey)
    ) {
      return (lesserKey, list.list.elements[lesserKey].nextKey);
    } else if (
      greaterKey != bytes32(0) &&
      isValueBetween(list, value, list.list.elements[greaterKey].previousKey, greaterKey)
    ) {
      return (list.list.elements[greaterKey].previousKey, greaterKey);
    } else {
      require(false, "get lesser and greater failure");
    }
  }

  
  function isValueBetween(List storage list, uint256 value, bytes32 lesserKey, bytes32 greaterKey)
    private
    view
    returns (bool)
  {
    bool isLesser = lesserKey == bytes32(0) || list.values[lesserKey] <= value;
    bool isGreater = greaterKey == bytes32(0) || list.values[greaterKey] >= value;
    return isLesser && isGreater;
  }
}

library SortedLinkedListWithMedian {
  using SafeMath for uint256;
  using SortedLinkedList for SortedLinkedList.List;

  enum MedianAction { None, Lesser, Greater }

  enum MedianRelation { Undefined, Lesser, Greater, Equal }

  struct List {
    SortedLinkedList.List list;
    bytes32 median;
    mapping(bytes32 => MedianRelation) relation;
  }

  
  function insert(
    List storage list,
    bytes32 key,
    uint256 value,
    bytes32 lesserKey,
    bytes32 greaterKey
  ) public {
    list.list.insert(key, value, lesserKey, greaterKey);
    LinkedList.Element storage element = list.list.list.elements[key];

    MedianAction action = MedianAction.None;
    if (list.list.list.numElements == 1) {
      list.median = key;
      list.relation[key] = MedianRelation.Equal;
    } else if (list.list.list.numElements % 2 == 1) {
      
      
      
      if (
        element.previousKey == bytes32(0) ||
        list.relation[element.previousKey] == MedianRelation.Lesser
      ) {
        action = MedianAction.Lesser;
        list.relation[key] = MedianRelation.Lesser;
      } else {
        list.relation[key] = MedianRelation.Greater;
      }
    } else {
      
      
      
      if (
        element.nextKey == bytes32(0) || list.relation[element.nextKey] == MedianRelation.Greater
      ) {
        action = MedianAction.Greater;
        list.relation[key] = MedianRelation.Greater;
      } else {
        list.relation[key] = MedianRelation.Lesser;
      }
    }
    updateMedian(list, action);
  }

  
  function remove(List storage list, bytes32 key) public {
    MedianAction action = MedianAction.None;
    if (list.list.list.numElements == 0) {
      list.median = bytes32(0);
    } else if (list.list.list.numElements % 2 == 0) {
      
      
      
      if (
        list.relation[key] == MedianRelation.Greater || list.relation[key] == MedianRelation.Equal
      ) {
        action = MedianAction.Lesser;
      }
    } else {
      
      
      
      if (
        list.relation[key] == MedianRelation.Lesser || list.relation[key] == MedianRelation.Equal
      ) {
        action = MedianAction.Greater;
      }
    }
    updateMedian(list, action);

    list.list.remove(key);
  }

  
  function update(
    List storage list,
    bytes32 key,
    uint256 value,
    bytes32 lesserKey,
    bytes32 greaterKey
  ) public {
    
    
    
    remove(list, key);
    insert(list, key, value, lesserKey, greaterKey);
  }

  
  function push(List storage list, bytes32 key) public {
    insert(list, key, 0, bytes32(0), list.list.list.tail);
  }

  
  function popN(List storage list, uint256 n) public returns (bytes32[] memory) {
    require(n <= list.list.list.numElements, "not enough elements");
    bytes32[] memory keys = new bytes32[](n);
    for (uint256 i = 0; i < n; i = i.add(1)) {
      bytes32 key = list.list.list.head;
      keys[i] = key;
      remove(list, key);
    }
    return keys;
  }

  
  function contains(List storage list, bytes32 key) public view returns (bool) {
    return list.list.contains(key);
  }

  
  function getValue(List storage list, bytes32 key) public view returns (uint256) {
    return list.list.values[key];
  }

  
  function getMedianValue(List storage list) public view returns (uint256) {
    return getValue(list, list.median);
  }

  
  function getHead(List storage list) external view returns (bytes32) {
    return list.list.list.head;
  }

  
  function getMedian(List storage list) external view returns (bytes32) {
    return list.median;
  }

  
  function getTail(List storage list) external view returns (bytes32) {
    return list.list.list.tail;
  }

  
  function getNumElements(List storage list) external view returns (uint256) {
    return list.list.list.numElements;
  }

  
  function getElements(List storage list)
    public
    view
    returns (bytes32[] memory, uint256[] memory, MedianRelation[] memory)
  {
    bytes32[] memory keys = getKeys(list);
    uint256[] memory values = new uint256[](keys.length);
    MedianRelation[] memory relations = new MedianRelation[](keys.length);
    for (uint256 i = 0; i < keys.length; i = i.add(1)) {
      values[i] = list.list.values[keys[i]];
      relations[i] = list.relation[keys[i]];
    }
    return (keys, values, relations);
  }

  
  function getKeys(List storage list) public view returns (bytes32[] memory) {
    return list.list.getKeys();
  }

  
  function updateMedian(List storage list, MedianAction action) private {
    LinkedList.Element storage previousMedian = list.list.list.elements[list.median];
    if (action == MedianAction.Lesser) {
      list.relation[list.median] = MedianRelation.Greater;
      list.median = previousMedian.previousKey;
    } else if (action == MedianAction.Greater) {
      list.relation[list.median] = MedianRelation.Lesser;
      list.median = previousMedian.nextKey;
    }
    list.relation[list.median] = MedianRelation.Equal;
  }
}

library AddressSortedLinkedListWithMedian {
  using SafeMath for uint256;
  using SortedLinkedListWithMedian for SortedLinkedListWithMedian.List;

  function toBytes(address a) public pure returns (bytes32) {
    return bytes32(uint256(a) << 96);
  }

  function toAddress(bytes32 b) public pure returns (address) {
    return address(uint256(b) >> 96);
  }

  
  function insert(
    SortedLinkedListWithMedian.List storage list,
    address key,
    uint256 value,
    address lesserKey,
    address greaterKey
  ) public {
    list.insert(toBytes(key), value, toBytes(lesserKey), toBytes(greaterKey));
  }

  
  function remove(SortedLinkedListWithMedian.List storage list, address key) public {
    list.remove(toBytes(key));
  }

  
  function update(
    SortedLinkedListWithMedian.List storage list,
    address key,
    uint256 value,
    address lesserKey,
    address greaterKey
  ) public {
    list.update(toBytes(key), value, toBytes(lesserKey), toBytes(greaterKey));
  }

  
  function contains(SortedLinkedListWithMedian.List storage list, address key)
    public
    view
    returns (bool)
  {
    return list.contains(toBytes(key));
  }

  
  function getValue(SortedLinkedListWithMedian.List storage list, address key)
    public
    view
    returns (uint256)
  {
    return list.getValue(toBytes(key));
  }

  
  function getMedianValue(SortedLinkedListWithMedian.List storage list)
    public
    view
    returns (uint256)
  {
    return list.getValue(list.median);
  }

  
  function getHead(SortedLinkedListWithMedian.List storage list) external view returns (address) {
    return toAddress(list.getHead());
  }

  
  function getMedian(SortedLinkedListWithMedian.List storage list) external view returns (address) {
    return toAddress(list.getMedian());
  }

  
  function getTail(SortedLinkedListWithMedian.List storage list) external view returns (address) {
    return toAddress(list.getTail());
  }

  
  function getNumElements(SortedLinkedListWithMedian.List storage list)
    external
    view
    returns (uint256)
  {
    return list.getNumElements();
  }

  
  function getElements(SortedLinkedListWithMedian.List storage list)
    public
    view
    returns (address[] memory, uint256[] memory, SortedLinkedListWithMedian.MedianRelation[] memory)
  {
    bytes32[] memory byteKeys = list.getKeys();
    address[] memory keys = new address[](byteKeys.length);
    uint256[] memory values = new uint256[](byteKeys.length);
    
    SortedLinkedListWithMedian.MedianRelation[] memory relations =
      new SortedLinkedListWithMedian.MedianRelation[](keys.length);
    for (uint256 i = 0; i < byteKeys.length; i = i.add(1)) {
      keys[i] = toAddress(byteKeys[i]);
      values[i] = list.getValue(byteKeys[i]);
      relations[i] = list.relation[byteKeys[i]];
    }
    return (keys, values, relations);
  }
}
        

Contract ABI

[{"type":"function","stateMutability":"pure","payable":false,"outputs":[{"type":"address","name":""}],"name":"toAddress","inputs":[{"type":"bytes32","name":"b"}],"constant":true},{"type":"function","stateMutability":"pure","payable":false,"outputs":[{"type":"bytes32","name":""}],"name":"toBytes","inputs":[{"type":"address","name":"a"}],"constant":true}]
              

Contract Creation Code

0x611153610026600b82828239805160001a60731461001957fe5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600436106100d95760003560e01c80636eafa6c31161009657806395073a791161007057806395073a791461051e578063c1e728e914610584578063d4a09272146105df578063d938ec7b14610684576100d9565b80636eafa6c3146103d55780637c6bb86214610417578063832a214714610479576100d9565b80630944c594146100de5780633118159e1461014c578063341f6623146101ba578063593b79fe1461022857806359d556a8146102805780636cfa3873146102c2575b600080fd5b61010a600480360360208110156100f457600080fd5b81019080803590602001909291905050506106f2565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6101786004803603602081101561016257600080fd5b810190808035906020019092919050505061078f565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6101e6600480360360208110156101d057600080fd5b810190808035906020019092919050505061082c565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61026a6004803603602081101561023e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061083d565b6040518082815260200191505060405180910390f35b6102ac6004803603602081101561029657600080fd5b8101908080359060200190929190505050610864565b6040518082815260200191505060405180910390f35b6102ee600480360360208110156102d857600080fd5b8101908080359060200190929190505050610905565b60405180806020018060200180602001848103845287818151815260200191508051906020019060200280838360005b8381101561033957808201518184015260208101905061031e565b50505050905001848103835286818151815260200191508051906020019060200280838360005b8381101561037b578082015181840152602081019050610360565b50505050905001848103825285818151815260200191508051906020019060200280838360005b838110156103bd5780820151818401526020810190506103a2565b50505050905001965050505050505060405180910390f35b610401600480360360208110156103eb57600080fd5b8101908080359060200190929190505050610c54565b6040518082815260200191505060405180910390f35b6104636004803603604081101561042d57600080fd5b8101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ce9565b6040518082815260200191505060405180910390f35b81801561048557600080fd5b5061051c600480360360a081101561049c57600080fd5b8101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d8f565b005b61056a6004803603604081101561053457600080fd5b8101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e37565b604051808215151515815260200191505060405180910390f35b81801561059057600080fd5b506105dd600480360360408110156105a757600080fd5b8101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610edd565b005b8180156105eb57600080fd5b50610682600480360360a081101561060257600080fd5b8101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f5a565b005b6106b06004803603602081101561069a57600080fd5b8101908080359060200190929190505050611002565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6000610788827309b17f887721035c2d73b0628c4bdb5666a31cce630944c59490916040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561074857600080fd5b505af415801561075c573d6000803e3d6000fd5b505050506040513d602081101561077257600080fd5b810190808051906020019092919050505061082c565b9050919050565b6000610825827309b17f887721035c2d73b0628c4bdb5666a31cce633118159e90916040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b1580156107e557600080fd5b505af41580156107f9573d6000803e3d6000fd5b505050506040513d602081101561080f57600080fd5b810190808051906020019092919050505061082c565b9050919050565b600060608260001c901c9050919050565b600060608273ffffffffffffffffffffffffffffffffffffffff16901b60001b9050919050565b6000817309b17f887721035c2d73b0628c4bdb5666a31cce63b52c01b4909184600501546040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b1580156108c357600080fd5b505af41580156108d7573d6000803e3d6000fd5b505050506040513d60208110156108ed57600080fd5b81019080805190602001909291905050509050919050565b606080606080847309b17f887721035c2d73b0628c4bdb5666a31cce63c31b9b9390916040518263ffffffff1660e01b81526004018082815260200191505060006040518083038186803b15801561095c57600080fd5b505af4158015610970573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f82011682018060405250602081101561099a57600080fd5b8101908080516401000000008111156109b257600080fd5b828101905060208101848111156109c857600080fd5b81518560208202830111640100000000821117156109e557600080fd5b5050929190505050905060608151604051908082528060200260200182016040528015610a215781602001602082028038833980820191505090505b50905060608251604051908082528060200260200182016040528015610a565781602001602082028038833980820191505090505b50905060608251604051908082528060200260200182016040528015610a8b5781602001602082028038833980820191505090505b50905060008090505b8451811015610c3f57610ab9858281518110610aac57fe5b602002602001015161082c565b848281518110610ac557fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050887309b17f887721035c2d73b0628c4bdb5666a31cce63b52c01b49091878481518110610b2857fe5b60200260200101516040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b158015610b6b57600080fd5b505af4158015610b7f573d6000803e3d6000fd5b505050506040513d6020811015610b9557600080fd5b8101908080519060200190929190505050838281518110610bb257fe5b602002602001018181525050886006016000868381518110610bd057fe5b6020026020010151815260200190815260200160002060009054906101000a900460ff16828281518110610c0057fe5b60200260200101906003811115610c1357fe5b90816003811115610c2057fe5b81525050610c3860018261109f90919063ffffffff16565b9050610a94565b50828282965096509650505050509193909250565b6000817309b17f887721035c2d73b0628c4bdb5666a31cce636eafa6c390916040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b158015610ca757600080fd5b505af4158015610cbb573d6000803e3d6000fd5b505050506040513d6020811015610cd157600080fd5b81019080805190602001909291905050509050919050565b6000827309b17f887721035c2d73b0628c4bdb5666a31cce63b52c01b49091610d118561083d565b6040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b158015610d4c57600080fd5b505af4158015610d60573d6000803e3d6000fd5b505050506040513d6020811015610d7657600080fd5b8101908080519060200190929190505050905092915050565b847309b17f887721035c2d73b0628c4bdb5666a31cce63e01e42c69091610db58761083d565b86610dbf8761083d565b610dc88761083d565b6040518663ffffffff1660e01b8152600401808681526020018581526020018481526020018381526020018281526020019550505050505060006040518083038186803b158015610e1857600080fd5b505af4158015610e2c573d6000803e3d6000fd5b505050505050505050565b6000827309b17f887721035c2d73b0628c4bdb5666a31cce636b2c8c309091610e5f8561083d565b6040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b158015610e9a57600080fd5b505af4158015610eae573d6000803e3d6000fd5b505050506040513d6020811015610ec457600080fd5b8101908080519060200190929190505050905092915050565b817309b17f887721035c2d73b0628c4bdb5666a31cce63cfc5e4419091610f038461083d565b6040518363ffffffff1660e01b8152600401808381526020018281526020019250505060006040518083038186803b158015610f3e57600080fd5b505af4158015610f52573d6000803e3d6000fd5b505050505050565b847309b17f887721035c2d73b0628c4bdb5666a31cce633916b5fa9091610f808761083d565b86610f8a8761083d565b610f938761083d565b6040518663ffffffff1660e01b8152600401808681526020018581526020018481526020018381526020018281526020019550505050505060006040518083038186803b158015610fe357600080fd5b505af4158015610ff7573d6000803e3d6000fd5b505050505050505050565b6000611098827309b17f887721035c2d73b0628c4bdb5666a31cce63d938ec7b90916040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561105857600080fd5b505af415801561106c573d6000803e3d6000fd5b505050506040513d602081101561108257600080fd5b810190808051906020019092919050505061082c565b9050919050565b60008082840190508381101561111d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b809150509291505056fea165627a7a723058208e2ff2d83d098d2c5e643fd2e323f8ccd29ccd4ca06d88dd7937206fc10c8ca50029

Deployed ByteCode

0x73204ba494de6a50a116ecd340556be8a15734c9d430146080604052600436106100d95760003560e01c80636eafa6c31161009657806395073a791161007057806395073a791461051e578063c1e728e914610584578063d4a09272146105df578063d938ec7b14610684576100d9565b80636eafa6c3146103d55780637c6bb86214610417578063832a214714610479576100d9565b80630944c594146100de5780633118159e1461014c578063341f6623146101ba578063593b79fe1461022857806359d556a8146102805780636cfa3873146102c2575b600080fd5b61010a600480360360208110156100f457600080fd5b81019080803590602001909291905050506106f2565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6101786004803603602081101561016257600080fd5b810190808035906020019092919050505061078f565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6101e6600480360360208110156101d057600080fd5b810190808035906020019092919050505061082c565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61026a6004803603602081101561023e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061083d565b6040518082815260200191505060405180910390f35b6102ac6004803603602081101561029657600080fd5b8101908080359060200190929190505050610864565b6040518082815260200191505060405180910390f35b6102ee600480360360208110156102d857600080fd5b8101908080359060200190929190505050610905565b60405180806020018060200180602001848103845287818151815260200191508051906020019060200280838360005b8381101561033957808201518184015260208101905061031e565b50505050905001848103835286818151815260200191508051906020019060200280838360005b8381101561037b578082015181840152602081019050610360565b50505050905001848103825285818151815260200191508051906020019060200280838360005b838110156103bd5780820151818401526020810190506103a2565b50505050905001965050505050505060405180910390f35b610401600480360360208110156103eb57600080fd5b8101908080359060200190929190505050610c54565b6040518082815260200191505060405180910390f35b6104636004803603604081101561042d57600080fd5b8101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610ce9565b6040518082815260200191505060405180910390f35b81801561048557600080fd5b5061051c600480360360a081101561049c57600080fd5b8101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d8f565b005b61056a6004803603604081101561053457600080fd5b8101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610e37565b604051808215151515815260200191505060405180910390f35b81801561059057600080fd5b506105dd600480360360408110156105a757600080fd5b8101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610edd565b005b8180156105eb57600080fd5b50610682600480360360a081101561060257600080fd5b8101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610f5a565b005b6106b06004803603602081101561069a57600080fd5b8101908080359060200190929190505050611002565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6000610788827309b17f887721035c2d73b0628c4bdb5666a31cce630944c59490916040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561074857600080fd5b505af415801561075c573d6000803e3d6000fd5b505050506040513d602081101561077257600080fd5b810190808051906020019092919050505061082c565b9050919050565b6000610825827309b17f887721035c2d73b0628c4bdb5666a31cce633118159e90916040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b1580156107e557600080fd5b505af41580156107f9573d6000803e3d6000fd5b505050506040513d602081101561080f57600080fd5b810190808051906020019092919050505061082c565b9050919050565b600060608260001c901c9050919050565b600060608273ffffffffffffffffffffffffffffffffffffffff16901b60001b9050919050565b6000817309b17f887721035c2d73b0628c4bdb5666a31cce63b52c01b4909184600501546040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b1580156108c357600080fd5b505af41580156108d7573d6000803e3d6000fd5b505050506040513d60208110156108ed57600080fd5b81019080805190602001909291905050509050919050565b606080606080847309b17f887721035c2d73b0628c4bdb5666a31cce63c31b9b9390916040518263ffffffff1660e01b81526004018082815260200191505060006040518083038186803b15801561095c57600080fd5b505af4158015610970573d6000803e3d6000fd5b505050506040513d6000823e3d601f19601f82011682018060405250602081101561099a57600080fd5b8101908080516401000000008111156109b257600080fd5b828101905060208101848111156109c857600080fd5b81518560208202830111640100000000821117156109e557600080fd5b5050929190505050905060608151604051908082528060200260200182016040528015610a215781602001602082028038833980820191505090505b50905060608251604051908082528060200260200182016040528015610a565781602001602082028038833980820191505090505b50905060608251604051908082528060200260200182016040528015610a8b5781602001602082028038833980820191505090505b50905060008090505b8451811015610c3f57610ab9858281518110610aac57fe5b602002602001015161082c565b848281518110610ac557fe5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050887309b17f887721035c2d73b0628c4bdb5666a31cce63b52c01b49091878481518110610b2857fe5b60200260200101516040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b158015610b6b57600080fd5b505af4158015610b7f573d6000803e3d6000fd5b505050506040513d6020811015610b9557600080fd5b8101908080519060200190929190505050838281518110610bb257fe5b602002602001018181525050886006016000868381518110610bd057fe5b6020026020010151815260200190815260200160002060009054906101000a900460ff16828281518110610c0057fe5b60200260200101906003811115610c1357fe5b90816003811115610c2057fe5b81525050610c3860018261109f90919063ffffffff16565b9050610a94565b50828282965096509650505050509193909250565b6000817309b17f887721035c2d73b0628c4bdb5666a31cce636eafa6c390916040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b158015610ca757600080fd5b505af4158015610cbb573d6000803e3d6000fd5b505050506040513d6020811015610cd157600080fd5b81019080805190602001909291905050509050919050565b6000827309b17f887721035c2d73b0628c4bdb5666a31cce63b52c01b49091610d118561083d565b6040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b158015610d4c57600080fd5b505af4158015610d60573d6000803e3d6000fd5b505050506040513d6020811015610d7657600080fd5b8101908080519060200190929190505050905092915050565b847309b17f887721035c2d73b0628c4bdb5666a31cce63e01e42c69091610db58761083d565b86610dbf8761083d565b610dc88761083d565b6040518663ffffffff1660e01b8152600401808681526020018581526020018481526020018381526020018281526020019550505050505060006040518083038186803b158015610e1857600080fd5b505af4158015610e2c573d6000803e3d6000fd5b505050505050505050565b6000827309b17f887721035c2d73b0628c4bdb5666a31cce636b2c8c309091610e5f8561083d565b6040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b158015610e9a57600080fd5b505af4158015610eae573d6000803e3d6000fd5b505050506040513d6020811015610ec457600080fd5b8101908080519060200190929190505050905092915050565b817309b17f887721035c2d73b0628c4bdb5666a31cce63cfc5e4419091610f038461083d565b6040518363ffffffff1660e01b8152600401808381526020018281526020019250505060006040518083038186803b158015610f3e57600080fd5b505af4158015610f52573d6000803e3d6000fd5b505050505050565b847309b17f887721035c2d73b0628c4bdb5666a31cce633916b5fa9091610f808761083d565b86610f8a8761083d565b610f938761083d565b6040518663ffffffff1660e01b8152600401808681526020018581526020018481526020018381526020018281526020019550505050505060006040518083038186803b158015610fe357600080fd5b505af4158015610ff7573d6000803e3d6000fd5b505050505050505050565b6000611098827309b17f887721035c2d73b0628c4bdb5666a31cce63d938ec7b90916040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b15801561105857600080fd5b505af415801561106c573d6000803e3d6000fd5b505050506040513d602081101561108257600080fd5b810190808051906020019092919050505061082c565b9050919050565b60008082840190508381101561111d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b809150509291505056fea165627a7a723058208e2ff2d83d098d2c5e643fd2e323f8ccd29ccd4ca06d88dd7937206fc10c8ca50029

External libraries

SortedLinkedListWithMedian : 0x09B17F887721035C2D73b0628c4bdb5666a31Cce