DeFi
Primitives
DECENTRALIZED FINANCE
S E R I E S I I
Quick Recap of DeFi Infrastructure
Blockchain: Blockchain is a decentralized ledger that encrypts
data ‘chained’ to one another while ensuring immutability
through hashing algorithms.
Smart Contracts: It allows the user to encode rules for any type
of transaction trustlessly. Executes contracts based on the
predetermined condition given in the blockchain.
Oracles: Connects smart contracts to real-world databases for
importing crucial data from the outside world.
Comparison between centralized and decentralized Systems:
In the former, decision-making and control reside on one central
authority, while in the latter, this power is distributed among a
group of individuals.
Decentralized applications: dApps are similar to traditional
software applications, except they live on a decentralized smart
contract platform.
1
2
3
4
5
1
2
4
5
3
What Will This Webinar Tell Us?
Equity, Utility, and
Governance Tokens
Transactions
NFTs and It's token
Standards
Custody & Escrow
Services
Burning, Minting, and
the Bonding Curve
Asset swapping
Staking Reward &
Staking Penalties
Collateralized and
uncollateralized loans
Now that we have covered the basics of DeFi infrastructure, in this webinar, we will discuss the primitive financial actions
that developers can use. A developer can combine these actions to create complex dApps.
Transactions
● A transaction is a message signed by an account owner that is added to a block and recorded in the blockchain.
● It can be originated only by an externally owned account (owned by a human), not by a contract account, and then transmitted to the
Ethereum network.
● The transaction can be any action, such as transferring ether or calling functions of a smart contract. Consequently, the state of the
Ethereum virtual machine (EVM) is changed.
● Any account or node has the right to initiate a transaction. But it must be verified through mining.
● Every transaction has a gas limit and a gas fee. This fee is given to miners as a reward for verifying (or mining) that transaction.
Externally
owned account
Transaction
Externally
owned account
Contract
Account
Internal
Transaction
Externally
owned account
Transaction
Externally
owned account
Transactions set in motion by
an externally owned account
Fired in response to the
transaction set in motion by
an externally owned account
Fungible Tokens
Divisible to a certain decimal granularity and with units that are all identical and interchangeable. Like:
$100 USD Bill.
The Ethereum blockchain fungible token standard is ERC-20- A standard interface for fungible
(interchangeable) tokens, like voting tokens, staking tokens, or virtual currencies.
There are three MAIN types of ERC-20 tokens: Equity Tokens, Utility Tokens, Governance Tokens.
Convergence between multiple categories is possible.
Example functionalities ERC-20 provides:
• Transfer tokens from one account to another
• Get the current token balance of an account
• Get the total supply of the token available on the network
• approve whether an amount of token from an account can be spent by a third-party account
Equity and
Security Tokens
• Represents ownership/ equity of an underlying
asset/ pool of assets.
• Equity tokens are actually more of a subgroup
of the security token. Security and equity
tokens are tokens that represent a tradable
security on a blockchain.
• Example: Depositing 1 ETH and getting back 100
'XYZ'' tokens on Aave or Compound.
• The exchange rate is variable & depends on
supply and demand.
• The Smart contract ensures it returns a Pro-
rata amount of ETH for every 'XYZ' it receives.
• Examples:
– Polymath Network is a platform for the
creation of tokenized securities
on Ethereum.
– Templum provides a regulated,
end-to-end solution for raising capital and
secondary trading in the private market.
• Developed for use inside a specific
blockchain ecosystem. They are meant to
be used to use the network.
• Do not exist to create value independently.
• Depends on a smart contract system or
dApp to fulfill their use case.
• Examples:
– $DAI, $LINK, $MATIC: Used to pay
application specific fees
– Synthetix (SNX): Used as a collateral
– ETH in the Ethereum Network for Fee
Utility
Tokens
• Governance tokens are also a kind of Equity
tokens. But not for assets.
• They represent VOTING RIGHTS for a DeFi
protocol or DAOs.
• From implementing Smart contract upgrades
to governance proposals- everything is done
through token holders' votes.
• Eliminates admin-controlled functionalities &
creates true DeFi.
• The governance token's supply can be:
– Static: (MKR token for Maker DAO)
– Inflationary: (COMP token for Compound)
– Deflationary: (MKR token, fees are burned)
Governance
Tokens
Non-Fungible and Semi-Fungible Tokens
• Each unit is unique. Divisible (fractional NFTs) but not interchangeable.
• Hence, it can be used as Deeds or proof of unique ownership of unitary assets.
• Example: A p2p loan with its own terms & interest rates can be represented as NFTs.
• Technically, NFTs follow ERC-721 & ERC-1155 standards & NOT ERC-20
• ERC-1155 represents both fungible + non-fungible ones.
• ERC-1155 also offers batch transfer (saves Gas) & semi-fungibility.
Vouchers
Vouchers resemble semi-fungible
tokens since you can interchange
them with the same voucher with
the same expiration date. Once
redeemed, SFTs lose their value
and become non-fungible tokens.
Event Tickets
Creating event tickets in the form of
crypto tokens is a widely popular
use of SFTs. The ticket will act like a
fungible token before the event and
will turn into a non-fungible token
after the event.
Gaming Assets
Games include both fungible tokens
(game dollars and gold bars) and
non-fungible tokens (in-game
assets). Games supporting SFTs
let players interchange their FTs
with NFTs or vice versa.
Semi-Fungible Tokens Uses:
Custody
• A critical DeFi primitive is the ability to escrow or custody funds
directly in a smart contract. This is distinct from the situation in ERC-20
when operators are approved to transfer a user’s balance.
• The user retains custody of his funds and could transfer the balance at
any time or revoke the contract's approval.
• When a smart contract has full custody over funds, new capabilities
(and additional primitives) are possible:
– Retaining fees and disbursing incentives
– Facilitation of token swaps
– Market making of a bonding curve
– Collateralized Loans
– Auctions
– Insurance funds
• The Smart Contract must be programmed to handle unique token
types – ERC20 or ERC 721
– Risk of permanent custody if no mechanism for releasing funds
– Safety checks in token transfer
• Token supplies can be adjusted using MINTING & BURNING
mechanisms.
• Minting -> Mint new tokens using the mechanics encoded into
Smart contracts. Inflationary, LP Tokens, Rewards
– Example: Entering a pool and acquiring ownership using
cTokens in Compound.
• Burning -> Send tokens to an unowned address or add feature
burning functions to smart contracts to make tokens unusable.
Deflationary and Redemption
– Example: Burning of AAVE tokens for driving scarcity.
• Bonding curves -> A dynamic approach to calculate the token
value, taking supply into consideration. Work independently from
Crypto exchanges.
– It sells tokens by calculating token prices in Ether and issuing
them after payment. Also, buy them and pay with Ether.
– The growth rate for the bonding curve determines users'
performances.
Supply
Adjustments
Swapping
Swapping is simply
exchanging one type
of token with another.
It’s Non-custodial and
done using a DEX.
There are two
approaches to which
a DEX gets liquidity.
• Order Book
Matching
• Automated
Market Makers
For a successful
order-book match, all
parties must agree on
the swap exchange
rate. Kuber Network
has a fully automated
order books.
The order-matching
approach is expensive
and inefficient
because each update
requires an on-chain
transaction.
• Collateralized loans are backed by an
equivalent or excess amount of collateral.
• Collateral can become less valuable than
the debt. due to price volatility, leading to
unfortunate liquidation.
• To mitigate risk, a larger collateralization
ratio is required to avoid margin calls.
• For Maker DAO, borrowers must keep 150%
collateral on loan value. Any drop in ETH
value below that will come at a 13% penalty.
• If the private key is lost or the contract gets
hacked, borrowers or lenders will lose their
assets.
• Decentralized Insurance protocols
(like Nexus Mutual or CDx) can help in
such cases.
Collateralized Loan
Flash | Uncollateralized Loan
• DeFi uses a multi-layered architecture.
• Every layer has a distinct purpose.
• The layers build on each other and create an open and highly composable infrastructure
that allows everyone to build on, rehash, or use other parts of the stack.
• If, for example, the blockchain in the settlement layer is compromised, all subsequent layers
would not be secure.
• Similarly, if we used a permissioned ledger as the foundation, any decentralization efforts on
subsequent layers would be ineffective.

DeFi Series – Webinar 2- DeFi Primitives

  • 1.
  • 2.
    Quick Recap ofDeFi Infrastructure Blockchain: Blockchain is a decentralized ledger that encrypts data ‘chained’ to one another while ensuring immutability through hashing algorithms. Smart Contracts: It allows the user to encode rules for any type of transaction trustlessly. Executes contracts based on the predetermined condition given in the blockchain. Oracles: Connects smart contracts to real-world databases for importing crucial data from the outside world. Comparison between centralized and decentralized Systems: In the former, decision-making and control reside on one central authority, while in the latter, this power is distributed among a group of individuals. Decentralized applications: dApps are similar to traditional software applications, except they live on a decentralized smart contract platform. 1 2 3 4 5 1 2 4 5 3
  • 3.
    What Will ThisWebinar Tell Us? Equity, Utility, and Governance Tokens Transactions NFTs and It's token Standards Custody & Escrow Services Burning, Minting, and the Bonding Curve Asset swapping Staking Reward & Staking Penalties Collateralized and uncollateralized loans Now that we have covered the basics of DeFi infrastructure, in this webinar, we will discuss the primitive financial actions that developers can use. A developer can combine these actions to create complex dApps.
  • 4.
    Transactions ● A transactionis a message signed by an account owner that is added to a block and recorded in the blockchain. ● It can be originated only by an externally owned account (owned by a human), not by a contract account, and then transmitted to the Ethereum network. ● The transaction can be any action, such as transferring ether or calling functions of a smart contract. Consequently, the state of the Ethereum virtual machine (EVM) is changed. ● Any account or node has the right to initiate a transaction. But it must be verified through mining. ● Every transaction has a gas limit and a gas fee. This fee is given to miners as a reward for verifying (or mining) that transaction. Externally owned account Transaction Externally owned account Contract Account Internal Transaction Externally owned account Transaction Externally owned account Transactions set in motion by an externally owned account Fired in response to the transaction set in motion by an externally owned account
  • 5.
    Fungible Tokens Divisible toa certain decimal granularity and with units that are all identical and interchangeable. Like: $100 USD Bill. The Ethereum blockchain fungible token standard is ERC-20- A standard interface for fungible (interchangeable) tokens, like voting tokens, staking tokens, or virtual currencies. There are three MAIN types of ERC-20 tokens: Equity Tokens, Utility Tokens, Governance Tokens. Convergence between multiple categories is possible. Example functionalities ERC-20 provides: • Transfer tokens from one account to another • Get the current token balance of an account • Get the total supply of the token available on the network • approve whether an amount of token from an account can be spent by a third-party account
  • 6.
    Equity and Security Tokens •Represents ownership/ equity of an underlying asset/ pool of assets. • Equity tokens are actually more of a subgroup of the security token. Security and equity tokens are tokens that represent a tradable security on a blockchain. • Example: Depositing 1 ETH and getting back 100 'XYZ'' tokens on Aave or Compound. • The exchange rate is variable & depends on supply and demand. • The Smart contract ensures it returns a Pro- rata amount of ETH for every 'XYZ' it receives. • Examples: – Polymath Network is a platform for the creation of tokenized securities on Ethereum. – Templum provides a regulated, end-to-end solution for raising capital and secondary trading in the private market.
  • 7.
    • Developed foruse inside a specific blockchain ecosystem. They are meant to be used to use the network. • Do not exist to create value independently. • Depends on a smart contract system or dApp to fulfill their use case. • Examples: – $DAI, $LINK, $MATIC: Used to pay application specific fees – Synthetix (SNX): Used as a collateral – ETH in the Ethereum Network for Fee Utility Tokens
  • 8.
    • Governance tokensare also a kind of Equity tokens. But not for assets. • They represent VOTING RIGHTS for a DeFi protocol or DAOs. • From implementing Smart contract upgrades to governance proposals- everything is done through token holders' votes. • Eliminates admin-controlled functionalities & creates true DeFi. • The governance token's supply can be: – Static: (MKR token for Maker DAO) – Inflationary: (COMP token for Compound) – Deflationary: (MKR token, fees are burned) Governance Tokens
  • 9.
    Non-Fungible and Semi-FungibleTokens • Each unit is unique. Divisible (fractional NFTs) but not interchangeable. • Hence, it can be used as Deeds or proof of unique ownership of unitary assets. • Example: A p2p loan with its own terms & interest rates can be represented as NFTs. • Technically, NFTs follow ERC-721 & ERC-1155 standards & NOT ERC-20 • ERC-1155 represents both fungible + non-fungible ones. • ERC-1155 also offers batch transfer (saves Gas) & semi-fungibility. Vouchers Vouchers resemble semi-fungible tokens since you can interchange them with the same voucher with the same expiration date. Once redeemed, SFTs lose their value and become non-fungible tokens. Event Tickets Creating event tickets in the form of crypto tokens is a widely popular use of SFTs. The ticket will act like a fungible token before the event and will turn into a non-fungible token after the event. Gaming Assets Games include both fungible tokens (game dollars and gold bars) and non-fungible tokens (in-game assets). Games supporting SFTs let players interchange their FTs with NFTs or vice versa. Semi-Fungible Tokens Uses:
  • 10.
    Custody • A criticalDeFi primitive is the ability to escrow or custody funds directly in a smart contract. This is distinct from the situation in ERC-20 when operators are approved to transfer a user’s balance. • The user retains custody of his funds and could transfer the balance at any time or revoke the contract's approval. • When a smart contract has full custody over funds, new capabilities (and additional primitives) are possible: – Retaining fees and disbursing incentives – Facilitation of token swaps – Market making of a bonding curve – Collateralized Loans – Auctions – Insurance funds • The Smart Contract must be programmed to handle unique token types – ERC20 or ERC 721 – Risk of permanent custody if no mechanism for releasing funds – Safety checks in token transfer
  • 11.
    • Token suppliescan be adjusted using MINTING & BURNING mechanisms. • Minting -> Mint new tokens using the mechanics encoded into Smart contracts. Inflationary, LP Tokens, Rewards – Example: Entering a pool and acquiring ownership using cTokens in Compound. • Burning -> Send tokens to an unowned address or add feature burning functions to smart contracts to make tokens unusable. Deflationary and Redemption – Example: Burning of AAVE tokens for driving scarcity. • Bonding curves -> A dynamic approach to calculate the token value, taking supply into consideration. Work independently from Crypto exchanges. – It sells tokens by calculating token prices in Ether and issuing them after payment. Also, buy them and pay with Ether. – The growth rate for the bonding curve determines users' performances. Supply Adjustments
  • 12.
    Swapping Swapping is simply exchangingone type of token with another. It’s Non-custodial and done using a DEX. There are two approaches to which a DEX gets liquidity. • Order Book Matching • Automated Market Makers For a successful order-book match, all parties must agree on the swap exchange rate. Kuber Network has a fully automated order books. The order-matching approach is expensive and inefficient because each update requires an on-chain transaction.
  • 13.
    • Collateralized loansare backed by an equivalent or excess amount of collateral. • Collateral can become less valuable than the debt. due to price volatility, leading to unfortunate liquidation. • To mitigate risk, a larger collateralization ratio is required to avoid margin calls. • For Maker DAO, borrowers must keep 150% collateral on loan value. Any drop in ETH value below that will come at a 13% penalty. • If the private key is lost or the contract gets hacked, borrowers or lenders will lose their assets. • Decentralized Insurance protocols (like Nexus Mutual or CDx) can help in such cases. Collateralized Loan
  • 14.
    Flash | UncollateralizedLoan • DeFi uses a multi-layered architecture. • Every layer has a distinct purpose. • The layers build on each other and create an open and highly composable infrastructure that allows everyone to build on, rehash, or use other parts of the stack. • If, for example, the blockchain in the settlement layer is compromised, all subsequent layers would not be secure. • Similarly, if we used a permissioned ledger as the foundation, any decentralization efforts on subsequent layers would be ineffective.