Banks are Dumb like Smart Contracts Part 2

A Day in the Life of a DeFi Primitive

Kashaf Bashir
EnreachDAO
8 min readJun 18, 2022

--

The personal views expressed by the author in the below article should not form the basis for making investment decisions, nor be construed as a recommendation or advice to engage in investment transactions.

If you are new to this series of articles, have a quick read through the previous published content to gain some context (yes it is important)

We kicked off with this banger:

Then followed up with some foundational logic:

In this article we will look at the User Experience of interacting with the cornerstone of what DeFi has to offer in the form of its Primitives.

Primitive = not derived : original, primary

Bare in mind the context of DeFi;GROW or DIE and some of the logic of Creditor and Debtor relationships with Smart contracts as described in Part 1.

Aave & Compound

Deposits into Aave or Compound result in the user receiving aTKNs or cTKNs respectively. Users might want to deposit into Aave or Compound should they wish to earn interest.

The Aave aTKN and Compounds cTKN are composable ERC20 tokens that represent shares of the smart contract you deposited into. The smart contract underlying increases in amounts of token deposited as the interest accrues in the smart contract.

Example; Stacy has 10 WBTC + 1m USDC and she can get 10% APR from depositing BTC into Aave and 10% APR from depositing USDC into Compound. Stacy receives Y aWBTC and Z cUSDC representing her initial 10 WBTC and 1m USDC deposits into Aave and Compound respectively.

After 1 year, Stacy should have accrued 11 WBTC in Aave and 1.1m USDC in Compound. Stacy can redeem her Y aWBTC for 11 WBTC and Z cUSDC for 1.1m USDC.

Stacy is a Creditor to Aave and Compound with her respective ERC20 aTKN and cTKN representing her creditor account balance with both protocols.

Aave and Compound are pooled lending protocols where the assets supplied into the smart contracts can be used as collateral to borrow other assets pooled in the overall lending environment.

Example; Bob has P aWBTC and Q cUSDC with a total collateral value of $10m. Bob is bullish on BTC, NRCH and VOODOO and is positioning accordingly. Bob loans $1m of ETH from Compound and $1m of BUSD from Aave to accumulate NRCH and VOODOO. Bob loans a further $3m of USDT from both protocols where 50% of each of Bob’s P aWBTC and Q cUSDC are blocked as collateral.

New assets cannot be added to Aave and Compound in a permission-less manner, this is governed by the respective DAOs of Aave and Compound.

Opening up the existing assets pooled in Aave and Compound smart contracts; “to a permission-less environment”; could lead to liquidity being maliciously exploited. This would lead to long-tail liabilities for the protocol towards its creditors who supplied assets to Aave and Compound respectively (i.e. rug liquidity).

Aave and Compound are NOT “Isolated Lending” Protocols and both deploy algorithmic interest rate protocols that can be calibrated to manage liquidity risk.

Borrowers of both Aave and Compound are at risk of liquidation if their collateral value falls below the amount of the loan debt i.e. Debt amount > Creditor amount.

Maker

Deposits into Maker Protocols vaults result in the user being able to loan DAI stable coins. Users might want to create vaults in Maker should they wish to speculate further on cryptocurrencies by using DAI to accumulate digital assets. Users can leverage their collateral by depositing and repurchasing Maker cryptocurrency collateral types. Maker Protocol is a Collateralized Debt Position Protocol (CDP).

Example; Stacy has 1k ETH with a total collateral value of $1.1m. Stacy deposits her $1.1m of ETH into Maker vaults and takes a $0.5m DAI loan. If ETH price drops to $500, Stacy’s vault will be liquidated but she retains the DAI loaned.

Stacy is a Creditor to the Maker vault smart contract where she supplied ETH. Stacy is also a Debtor to the Maker vault for the DAI she borrowed, her creditor/debtor account balance is shown on the Maker Oasis dApp (along with other factors such as health score against liquidation).

Maker vaults are isolated debt positions used in the lending of DAI stable coins. Whatever amount of approved Ethereum based collateral types are supplied to the Maker vault, any risk associated with lending DAI against that vault’s value is isolated from the overall ecosystem.

New collateral types cannot be added to Maker vaults in a permissionless manner, this is governed by MakerDAO using the MKR token to vote on such proposals. The MKR token also acts as a liquidity backstop to stabilise the Maker Protocol in the event that there is insufficient collateral in the ecosystem to back DAI in circulation.

Maker also enables depositors to leverage their collateral in order to increase or decrease exposure to a single asset. Make does this by depositing and repurchasing within the vault for the same collateral type within a single transaction using DAI.

Example; Stacy has 1k ETH with a total collateral value of $1.1m. Stacy doesn’t think ETH will drop below $950, so Stacy deposits her $1.1m of ETH into Maker vaults and leverages her 1k ETH to take a 3k ETH position. If ETH price drops to $950, Stacy’s vault will be liquidated and Stacy will lose all her capital. If ETH price increases to $1500, Stacy is safe from liquidation but has amplified her profits 3x to $1.2m. Stacy can now decrease her position to 1533 ETH without any capital at risk as all DAI loans would have been paid off. Stacy made 533 ETH leveraging her CDP on Maker!

Opening Maker Protocol collateral types; “to a permission-less environment”; could lead to liquidity being maliciously exploited. A systematic risk for any CDP protocol like Maker is failure or black swan event of a collateral asset type.

Maker Protocol charges a variable rate “Stability Fee” to your DAI Debtor balance. Each collateral type has its own Stability Fee and Stability Fees are subject to change by Maker Governance. Stability Fees accrue in DAI and are added to the outstanding debt.

Yearn Finance

Deposits into Yearn Finance result in the user receiving yvTKN. Users might want to deposit into Yearn Finance should they wish to earn yield.

The Yearn yvTKNs are composable ERC20 tokens that represent shares of the smart contract you deposited into. The smart contract underlying increases in amounts of token deposited as the yield accrues in the smart contract.

Example; Stacy has 0.5m DAI she loaned from Maker that she wants to deposit into Yearn. Stacy has a strategy to farm a high yield vault on Yearn for 6 weeks to cover her annual Maker stability fee. Stacy deposits her DAI into the vault via Yearns ZAP function.

After 6 weeks, Stacy should have accrued at least 520,000 DAI in Yearn. Stacy can redeem as much DAI as she needs, but now has enough capital to repay Maker after 1 year.

Stacy is a Creditor to Yearn with her ERC20 yvTKN representing her creditor account balance of the vault she deposited into. Stacy accepted additional risk that comes with the high yield Yearn vault to accrue yield aggressively over a short space of time.

The composability of Yearns ERC20 yvTKNs have enabled other Collateralized Debt Protocol (CDP) technology to emerge, using yvTKNs as collateral.

As we have reiterated throughout this series of articles, depositors into smart contracts such as Yearn vaults; are CREDITORS to the smart contract. Holders of Yearn yvTKNs can redeem liquidity at any time by withdrawing from the Yearn vault into BTC, ETH, USDC, USDT or DAI.

Yearn Finance is run as a Decentralised Autonomous Organisation (DAO) which employs teams of strategists to create new yield generating operations for Yearn depositors to benefit from. Strategies on Yearn earn 20% performance fees and 2% annual management fees.

Uniswap

Deposits into Uniswap result in the user receiving Uniswap Liquidity Provider Tokens. Users might want to deposit assets into Uniswap should they wish to earn yield from transaction fees. Users are required to deposit 2 different types of assets to become a Uniswap LP.

The Uniswap LP tokens are composable ERC20* tokens that represent shares of the smart contract you deposited into. The smart contract underlying increases in amounts of token deposited as the transaction fees accrue in the smart contract.

*Uniswap Version 2 provides ERC20 LP Tokens. Uniswap Version 3 provides ERC721 NFTs to represent a user’s position when providing liquidity.

Example; Stacy has 1m DAI + 1m USDC and she can get 10% APY from depositing a total of $2m into Uniswap.

After 1 year, Stacy should have accrued $2.2m as a result of transaction fees generated on Uniswap volume traded in DAI-USDC.

Stacy is a Creditor to Uniswap with her respective ERC20 LP Token (or ERC721 NFT) representing her creditor account balance within the Uniswap protocol.

Uniswap is an automated liquidity protocol where a pair of assets supplied into the smart contracts can be used to create a decentralized trading market governed by a product constant formula; xy=k.

New assets can be added to Uniswap in a permissionless manner. Uniswap is open source technology with non-upgradeable smart contracts on the Ethereum blockchain. Anybody can use Uniswap at any time for any asset without restriction or limitation.

STAY TUNED FOR PART 3

--

--

Kashaf Bashir
EnreachDAO

Inventor @ CommSettle / Founder @ EnreachDAO / Founder @EnableDeFi