Contract Ownership and Function Permissions

All core smart contracts in Apollon inherit from the OpenZeppelin Ownable.sol contract template. As a result, each contract has a single owning address, which is the deploying address. Contract ownership is renounced either upon deployment or immediately after its address setter has been called, connecting it to the rest of the core Apollon system. In some cases, ownership is transferred to the Jellyverse Governance contract for future adjustments. For more details, refer to the Governance section.

Several public and external functions include modifiers such as requireCallerIsTroveManager, requireCallerIsStoragePool, etc., ensuring that they can only be called by the respective permitted contract.

Keeping a sorted list of Troves ordered by LACR

Apollon utilizes a specific data structure known as a sorted doubly-linked list of Troves, which remains ordered by the last active individual collateralization ratio (LACR). The LACR is calculated as the collateral amount in USD divided by the debt amount in USD at the time of the last update by the borrower.

This ordered list is crucial for efficient gas usage during redemption sequences, as it allows Troves to be targeted in ascending order of their individual collateralization ratios (ICR).

The implementation of this sorted doubly-linked list can be found in SortedTroves.sol.

Each node in this list corresponds to an active Trove in the system, identified by the owner's address. The list supports positional hints for efficient O(1) insertion, which is further detailed in the HintHelper section.

Additionally, each node stores the LACR of the Trove at the time it was inserted into the list.

The decision to sort Troves by LACR rather than ICR is based on the fact that each Trove can hold varying proportions of different collateral tokens. Changes in token prices affect individual collateralization ratios differently, making it impractical to maintain a sorted list based solely on ICR.

Nodes are re-inserted into the sorted list only when a Trove operation occurs—such as adding or removing collateral or debt from the position.

Supplying Hints to Trove operations

Last updated