CoolerTreasuryBorrower.sol

CoolerTreasuryBorrower connects MonoCooler to the Treasury's sUSDS reserves. It handles debt management and conversion between USDS and sUSDS - when Treasury holds funds it keeps them in sUSDS for yield, but loans are provided in USDS.

The contract tracks total debt to Treasury and ensures all USDS operations are properly converted when interacting with Treasury's sUSDS holdings.

Note: This contract is decoupled from MonoCooler.sol in part to allow the token that debt is denominated in to be changed by Olympus governance.

Functions

Loan Functions

borrow(uint256 amountInWad, address recipient)

  • Called by MonoCooler to borrow USDS

  • Records debt to Treasury

  • Converts Treasury's sUSDS to USDS before sending to recipient

repay()

  • Called by MonoCooler to repay debt

  • Takes USDS amount held by contract

  • Converts to sUSDS and sends to Treasury

  • Updates total debt

Debt Management

setDebt(uint256 debtTokenAmount) [admin]

  • Manually sets total Treasury debt amount

  • Used for recovery or migration

View Functions

debtToken()

  • Returns USDS token address

convertToDebtTokenAmount(uint256 amountInWad)

  • Converts 18 decimal amounts to debt token decimals

  • Used for handling repayments

Key State

  • Treasury debt tracking

  • USDS <> sUSDS conversion logic

  • Borrow and repay permissions

Last updated