The first version of the cauldron, not used in production anymore.
This is the first version of the Cauldron Contracts. It is deployed directly and then used as a masterContract to deploy each market, as clones, following the minimal proxy pattern.
Gets the exchange rate, ie how much collateral to buy 1e18 asset. Invoked if needed since Oracle queries can be expensive.
Returns
Name
Type
Description
updated
bool
boolean determining if the exchange rate has been updated yet or not
rate
uint256
the new exchange rate that was fetched
addCollateral
Adds share amount of collateral from msg.sender to the account to.
Parameters
Name
Type
Description
to
address
receiver of the tokens
skim
bool
True if the amount should be skimmed from the deposit balance of msg.sender.
False if tokens from msg.sender in bentoBox should be transferred.
share
uint256
amount of shares to add for to
removeCollateral
Calls _removeCollateral, which removes the amount share of collateral and transfers it to the account to.
Parameters
Name
Type
Description
to
address
receiver of the shares
share
uint256
amount of shares to send
borrow
Calls _borrow, which allows the sender to borrow amount and transfer to to.
Parameters
Name
Type
Description
to
address
receiver of the borrowed assets
amount
uint256
amount of assets to borrow
Returns
Name
Type
Description
part
uint256
total part of debt held by borrowers
share
uint256
total amount in shares borrowed
repay
Calls _repay, which repays a loan.
Parameters
Name
Type
Description
to
address
address of user payment should go to
skim
bool
true if amount should be skimmed from the deposit balance of msg.sender
part
uint256
amount to repay
Returns
Name
Type
Description
amount
uint256
total amount repayed
cook
Executes a set of actions and allows composability (contract calls) to other contracts.
The cook function allows to bundle functionality within one contract call while passing return values from one call to the next one.
Actions are defined by a numeric identifier and can return two values, value1 and value2 to the next function. The input arrays actions, values and datas define the sequential actions. In the Value array the ether value of a call may be defined.
Whereas calling functions like borrow that have the solvent modifier requires solvency at the end of the function, solvency only needs to be guaranteed at the end of the cook function, thereby allowing more complicated operations such as leveraging within one call.
For certain parameters either an external value can be passed in or the identifier USE_VALUE1 (-1) or USE__VALUE2 (-2) to access either of the local variables. The following variables are marked in bold italic in the table below. If an action returns one value it is saved as value1, if two are returned they are saved as value1 and value2 respectively. Any action can access these values during the whole duration of the cook call.
The call data for the actions is ABI encoded as listed below.
Returns the amount (in shares) of the token collateral used as collateral in this cauldron.
Return values
Name
Type
Description
/
uint256
Amount of shares of collateral deposited into the Cauldron.
userBorrowPart
Returns the amount of borrowParts held by a user.
To convert that amount into a numerical MIM debt amount, you must do totalBorrow.elastic / totalBorrow.base * borrowParts.