Skip to content

Latest commit

 

History

History
491 lines (374 loc) · 11.1 KB

ISortedTroves.md

File metadata and controls

491 lines (374 loc) · 11.1 KB

ISortedTroves.sol

View Source: contracts/Interfaces/ISortedTroves.sol

↘ Derived Contracts: SortedTroves

ISortedTroves

Events

event SortedTrovesAddressChanged(address  _sortedDoublyLLAddress);
event BorrowerOperationsAddressChanged(address  _borrowerOperationsAddress);
event NodeAdded(address  _id, uint256  _NICR);
event NodeRemoved(address  _id);

Functions


setParams

Called only once on init, to set addresses of other Zero contracts and size. Callable only by owner

function setParams(uint256 _size, address _TroveManagerAddress, address _borrowerOperationsAddress) external nonpayable

Arguments

Name Type Description
_size uint256 max size of troves list
_TroveManagerAddress address TroveManager contract address
_borrowerOperationsAddress address BorrowerOperations contract address
Source Code
function setParams(
        uint256 _size,
        address _TroveManagerAddress,
        address _borrowerOperationsAddress
    ) external;

insert

Add a node to the list

function insert(address _id, uint256 _ICR, address _prevId, address _nextId) external nonpayable

Arguments

Name Type Description
_id address Node's id
_ICR uint256 Node's NICR
_prevId address Id of previous node for the insert position
_nextId address Id of next node for the insert position
Source Code
function insert(
        address _id,
        uint256 _ICR,
        address _prevId,
        address _nextId
    ) external;

remove

Remove a node from the list

function remove(address _id) external nonpayable

Arguments

Name Type Description
_id address Node's id
Source Code
function remove(address _id) external;

reInsert

Re-insert the node at a new position, based on its new NICR

function reInsert(address _id, uint256 _newICR, address _prevId, address _nextId) external nonpayable

Arguments

Name Type Description
_id address Node's id
_newICR uint256 Node's new NICR
_prevId address Id of previous node for the new insert position
_nextId address Id of next node for the new insert position
Source Code
function reInsert(
        address _id,
        uint256 _newICR,
        address _prevId,
        address _nextId
    ) external;

contains

Checks if the list contains a node

function contains(address _id) external view
returns(bool)

Arguments

Name Type Description
_id address Node's id

Returns

true if list contains a node with given id

Source Code
function contains(address _id) external view returns (bool);

isFull

Checks if the list is full

function isFull() external view
returns(bool)
Source Code
function isFull() external view returns (bool);

isEmpty

Checks if the list is empty

function isEmpty() external view
returns(bool)
Source Code
function isEmpty() external view returns (bool);

getSize

function getSize() external view
returns(uint256)
Source Code
function getSize() external view returns (uint256);

getMaxSize

function getMaxSize() external view
returns(uint256)
Source Code
function getMaxSize() external view returns (uint256);

getFirst

function getFirst() external view
returns(address)
Source Code
function getFirst() external view returns (address);

getLast

function getLast() external view
returns(address)
Source Code
function getLast() external view returns (address);

getNext

function getNext(address _id) external view
returns(address)

Arguments

Name Type Description
_id address Node's id

Returns

the next node (with a smaller NICR) in the list for a given node

Source Code
function getNext(address _id) external view returns (address);

getPrev

function getPrev(address _id) external view
returns(address)

Arguments

Name Type Description
_id address Node's id

Returns

the previous node (with a larger NICR) in the list for a given node

Source Code
function getPrev(address _id) external view returns (address);

validInsertPosition

Check if a pair of nodes is a valid insertion point for a new node with the given NICR

function validInsertPosition(uint256 _ICR, address _prevId, address _nextId) external view
returns(bool)

Arguments

Name Type Description
_ICR uint256 Node's NICR
_prevId address Id of previous node for the insert position
_nextId address Id of next node for the insert position
Source Code
function validInsertPosition(
        uint256 _ICR,
        address _prevId,
        address _nextId
    ) external view returns (bool);

findInsertPosition

Find the insert position for a new node with the given NICR

function findInsertPosition(uint256 _ICR, address _prevId, address _nextId) external view
returns(address, address)

Arguments

Name Type Description
_ICR uint256 Node's NICR
_prevId address Id of previous node for the insert position
_nextId address Id of next node for the insert position
Source Code
function findInsertPosition(
        uint256 _ICR,
        address _prevId,
        address _nextId
    ) external view returns (address, address);

Contracts