Cauldron V1
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.
You can find the full contract here.
constructor nonpayable (address)
This will create the masterContract that will be used by all the clones (markets).
Write Functions
accrue
Accrues the interest on the borrowed tokens and handles the accumulation of fees.
updateExchangeRate
Gets the exchange rate, ie how much collateral to buy 1e18 asset. Invoked if needed since Oracle queries can be expensive.
Returns
addCollateral
Adds share
amount of collateral from msg.sender
to the account to
.
Parameters
removeCollateral
Calls _removeCollateral
, which removes the amount share
of collateral and transfers it to the account to
.
Parameters
borrow
Calls _borrow
, which allows the sender to borrow amount
and transfer to to
.
Parameters
Returns
repay
Calls _repay
, which repays a loan.
Parameters
Returns
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 USEVALUE1 (-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.
Parameters
Returns
liquidate
Handles the liquidation of users' balances once the users' amount of collateral is too low.
Parameters
withdrawFees
Withdraw the fees accumulated to the feeTo address.
setFeeTo
Sets the beneficiary of fees accrued in liquidations. Can only be called by the owner of the contract.
Parameters
reduceSupply
Reduces the supply of MIM
Parameters
View Functions
accrueInfo
Return values
bentoBox
Return values
collateral
Return values
exchangeRate
Return values
feeTo
Return values
magicInternetMoney
Return values
masterContract
Return values
oracle
Return values
oracleData
Return values
owner
Return values
pendingOwner
When transferring ownership, the future owner is pending until they claims ownership.
Return values
totalBorrow
Returns the total amounts borrowed from the cauldron.
Return values
totalCollateralShare
Returns the amount (in shares) of the token collateral
used as collateral in this cauldron.
Return values
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.
Parameters
Return values
userCollateralShare
Amount (in shares) of the token collateral
used as collateral by the user.
Parameters
Return values
Last updated