Reserves

Reserves

Reserves are a balance of the base or collateral asset, stored internally in the protocol, which automatically protect users from bad debt. Reserves can also be withdrawn or used through the governance process.

Reserves are generated in two ways: the difference in interest paid by borrowers, and earned by suppliers of the base asset, accrue as reserves into the protocol. Second, the liquidation process uses, and can add to, protocol reserves based on the target reserve level set by governance.

Get Base Asset Reserves

This function returns the amount of protocol reserves for the base asset as an integer.

function getReserves() public view returns (int)
  • RETURNS: The amount of base asset stored as reserves in the protocol as an unsigned integer scaled up by 10 to the “decimals” integer in the asset’s contract.

Get Collateral Asset Reserves

This function returns the amount of protocol reserves for the specified collateral asset as an integer.

function getCollateralReserves(address asset) public view returns (uint)
  • RETURNS: The amount of collateral asset stored as reserves in the protocol as an unsigned integer scaled up by 10 to the “decimals” integer in the collateral asset’s contract.

Target Reserves

This immutable value represents the target amount of reserves of the base token. If the protocol holds greater than or equal to this amount of reserves, the buyCollateral function can no longer be successfully called.

function targetReserves() public view returns (uint)
  • RETURN: The target reserve value of the base asset as an integer, scaled up by 10 to the “decimals” integer in the base asset’s contract.

Last updated