Sorted Troves
Discover the sophisticated data structure that keeps Troves organized: Sorted Troves. This contract maintains a doubly-linked list of all Troves, sorted by their Individual Collateralization Ratio (ICR), enabling efficient liquidation and redemption processes. Explore its functions for navigating and managing this crucial list.
Functions
contains
Checks if a Trove ID is present in the sorted list. (View)
data
Returns internal data of the sorted list. (View)
findInsertPosition
Finds the correct position (previous and next Trove IDs) to insert a new Trove based on its NICR. (View)
getFirst
Returns the ID of the first Trove in the sorted list (lowest ICR). (View)
getLast
Returns the ID of the last Trove in the sorted list (highest ICR). (View)
getNext
Returns the ID of the next Trove in the list relative to a given Trove ID. (View)
getPrev
Returns the ID of the previous Trove in the list relative to a given Trove ID. (View)
getSize
Returns the total number of Troves in the sorted list. (View)
insert
Inserts a new Trove ID into the sorted list at the correct position based on its NICR.
isEmpty
Checks if the sorted list of Troves is empty. (View)
reInsert
Re-inserts a Trove ID into the sorted list when its NICR changes, finding its new correct position.
remove
Removes a Trove ID from the sorted list.
setAddresses
Sets the address of the Trove Manager contract.
troveManager
Returns the address of the associated ITroveManager
contract. (View)
validInsertPosition
Validates if a given insert position (based on NICR, previous ID, and next ID) is correct. (View)
Events
NodeAdded
Emitted when a new Trove (node) is added to the sorted list.
NodeRemoved
Emitted when a Trove (node) is removed from the sorted list.