Core Smart Contracts

BorrowerOperations.sol - contains the basic operations by which borrowers interact with their Vault: Vault 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 Vault 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 Vault- i.e. a record of the Vault's collateral and debt. Also contains the Vault'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 Vaults 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 Vaults 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 Vault owners, sorted by their LACR. It inserts and re-inserts Vaults at the correct position, based on their ICR once a Vault owner updates their Vault.

HintHelpers.sol - helper contract, containing the read-only functionality for calculation of accurate hints to be supplied to Vault operations, required to (re-)insert the Vault 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 Vaults. It seperates the assets between:

Active assets of healthy Vaults.

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

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

Unassigned ****assets from a redistribution which liquidated the last vault 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