Refinery

The Mellow protocol's Refinery serves as its hub for smart contracts. Powering the Refinery is the RefineryV1.sol contract. The Refinery will take yield-bearing assets as collateral (and can accept underlying collateral as deposits as well, which are converted to yield tokens). There may be several yield strategies in a refinery, but only one mAsset may be issued (i.e., the mUSD refinery issues mUSD, but has yield strategies and accepts yield bearing tokens for USDC, BUSD , and DAI). Below is an example of how Refinery operates using DAI and Mellow's synthetic stablecoin, mUSD, utilizing the DFI.money DAI Vault. The system operates the same for other accepted stablecoins, as well as BNB and mBNB

  1. User provides iDAI to the Refinery (if user deposits DAI, the Refinery will first deposit the DAI in DFI to obtain iDAI, then accept the deposit.)

  2. The user can borrow up to 50% of the value of the deposited collateral in mUSD. The collateralization ratio for loans will be at least 200%. Accordingly, a user may borrow up to 1 mUSD for every 2 DAI deposited.

  3. Periodically, the iDAI harvests its output in order to pay off depositors' outstanding debts. A proportional share of each yield will be credited to the user's account, lowering their debt with each harvest. The harvest will raise your mUSD borrow limit if you've deposited DAI but haven't yet withdrawn any funds.

  4. Yield is transferred to the Interswap contract as it is harvested.

  5. The user can take out larger quantities of DAI from the refinery as the protocol reduces their debt, or they can re-up their mUSD loan, as long as they always maintain a minimum 200% collateralization ratio.

  6. The user has the option to pay off any sum of their loan, in full or in part, at any moment to unlock their collateral. The Refinery treats DAI, USDC, and BUSD as mUSD at a 1:1 ratio for repayment and self-liquidation. Therefore, mUSD debt can be paid off using mUSD as well as DAI, USDC, and BUSD. Because users can purchase mUSD from AMMs at a discount when its price falls below $1, using mUSD to pay off debt also functions as a price-restoring mechanism.

  7. You have the option to liquidate all or a portion of your collateral at any time. The DAI from your iDAI collateral will be used by the contract to pay off your mUSD debt.

The Refinery essentially offers users a revolving line of credit for their potential future yield. Users don't have to commit to lengthy lockups because they can enter and quit at any time. Because a user's debt will always decrease, their collateral will never be liquidated unless they take care of it themselves.

Mellow places the highest priority on the security of user deposits. Multiple organizations are auditing Mellow, and it will also conduct bug bounties. Mellow is subject to security checks and assessments, but nothing can be taken for granted that nothing bad won't ever happen. The Mellow synthetic tokens are safeguarded by two extra security mechanisms.

First off, only a certain amount of each accepted underlying collateral may be transferred into Mellow in order to create mAssets. This cap is based on the degree of market, legal, and technical risk associated with a specific asset. Second, by controlling the Maximum Loss, Repay Cap, and Liquidate Cap settings, the Refinery restricts the harm that may be caused.

The price of a yield token expressed in units of the underlying token is taken into account by maximumLoss. Liquidate, deposit, depositUnderlying, withdrawUnderlying, withdrawUnderlyingFrom, and harvest are only a few of the yield token's associated functions that are disabled once the given maximumLoss (usually between 1 and 25 bps) is reached. You should take note that in this case, the user can still withdraw the yield token but not the underlying collateral. The user can withdraw iDAI but not DAI, as an example.

In case an underlying collateral asset were to depeg, the Repay Cap and Liquidate Cap would be in place to stop substantial arbitrage movements. Sentinels now have time to respond to market developments. The limitations are time-based:

  1. Repay Cap - The total amount of debt that can be paid off over a specific period of time. For instance, it may say, "5k BNB can be refunded every 10 minutes."

  2. Liquidate Cap - The amount of an asset that can be liquidated within a specific period of time. For instance, it might state that "5k BNB can be liquidated every 10 minutes."

Due to the fact that they are intended to be firmly pegged to USD, Repay and Liquidate caps are presently only set for stablecoin collateral. Since BNB is a stand-alone asset with a fluctuating price, they are not necessary.

These safety precautions won't completely shield the Refinery synthetic token from the harm caused by a stablecoin losing its peg or depreciating, but they will safeguard most of it.

Last updated