Core Smart Contracts

BorrowerOperations.sol - contains the basic operations by which borrowers interact with their Trove: Trove creation, collateral top-up / withdrawal, debt repayment. It also sends issuance fees to the governance contract. BorrowerOperations functions call in to TroveManager, telling it to update Trove state, where necessary. They also call in to the various Pools, telling them to move Tokens between Pools or between Pool <> user, where necessary.

TroveManager.sol - contains the state of each Trove - i.e. a record of the Trove’s collateral and debt. Also contains the Trove’s stake and rewards related to the redistribution. It does not hold value (tokens). TroveManager functions call in to the various Pools to tell them to move tokens between Pools, where necessary.

LiquidationOperations.sol - no state or token holder, works with the TroveManager and StabilityPoolManager to liquidate Troves if necessary.

StabilityPool.sol - contains functionality for Stability Pool operations: making deposits, and withdrawing compounded deposits and accumulated collateral gains. Holds the jAsset deposits, and the collateral gains for depositors, from liquidations. There is one StabilityPool for each jAsset Token.

StabilityPoolManager.sol - keeps track of all Stability Pool’s and acts as a distributor between them and the LiquidationOperations.

ReservePool.sol - holds jUSD and JLY as reserve compensation. Gets filled by the BorrowerOperations and provides tokens while a under-collaterlized liquidation.

CollSurplusPool.sol - holds the collateral surplus from Troves that have been liquidated in Recovery Mode. Sends the surplus back to the owning borrower while claiming.

RedemptionOperations.sol - uses the state of the TroveManager and SortedTroves to execute redemptions. It burns jUSD (debt) and uses collateral from the StoragePool to payout the redeemer. Redemption fees get transfered to the governance contract.

SortedTroves.sol - a doubly linked list that stores addresses of Trove owners, sorted by their LACR. It inserts and re-inserts Troves at the correct position, based on their ICR once a Trove owner updates their Trove.

HintHelpers.sol - helper contract, containing the read-only functionality for calculation of accurate hints to be supplied to Trove operations, required to (re-)insert the Trove into the SortedList.

DebtToken.sol - the jAsset token contract, which implements the ERC20 fungible token standard in conjunction with EIP-2612 and a mechanism that blocks (accidental) transfers to addresses like the StabilityPool and address(0) that are not supposed to receive funds through direct transfers. The contract mints, burns and transfers jAsset tokens.

TokenManager.sol - contains a list of debt (DebtToken) and collateral (ERC20) tokens which are available to the system. It allows the goverance to introduce the tokens to the system.

StoragePool.sol - holds the total collateral balance and records the total debt of the Troves. It seperates the assets between:

Active assets of healthy Troves.

Default assets of liquidated Troves that are pending redistribution to active Troves. If a Trove has pending debt “rewards”, then they will be applied to the Trove when it next undergoes a borrower operation, a redemption, or a liquidation.

A jUSD gasCompensation as liquidation reserve. jUSD is stored when a Trove is opened, and released a Trove is liquidated or closed.

Unassigned ****assets from a redistribution which liquidated the last trove of a collateral type. Those can be claim by anyone.

SwapPair.sol - swap pool contract. Holds the liquidity of a swap pair. It also calculates the dynamic swap fee based on the reserve (pool price) and oracle difference.

SwapOps.sol - manages SwapPairs and acts as a routing provider between them. It provides the borrower with the interface for debt creation, which is powered by the BorrowerOperations.

PriceFeed.sol - contains functionality for obtaining the current oracle price, which the system uses for calculating collateralization ratios.

Last updated