Publisher avatar
13 min read

How to use DEFI lending protocols

How to use DEFI lending protocols

What you'll learn

  • What a smart contract is & why they are important
  • The most common smart contract use cases
  • How to guide for interacting with a DEFI Smart Contract
  • Smart Contracts for more complex use cases

After several years of consolidation around the crypto space, emerging innovative protocols are finally starting to draw interest, and it is much more than just reminiscent of the 2017 ICO boom. DeFi, short for Decentralised Finance, is one of the most popular. 

Bitcoin delivered blockchain technology and decentralization, but the crypto market remained plagued by centralized finance, which became laden with governance to meet regulatory and investor demands. 

DeFi, however, stands as truly decentralised, with no actual governance and a trustless and permissionless ethos. The crypto space may look like a once-in-a-lifetime opportunity to roll out a decentralised financial service, but a deep understanding of how smart contracts work is critical.

With the explosion of the DeFi industry in 2020, the use of Smart Contracts - which provide their logic - necessarily grew alongside. While CeFi depends on intermediaries to manage transactions, DeFi uses immutable Smart Contracts to create trust and transparency.

What is a Smart Contract?

Smart Contracts are self-executing programs running on a blockchain network,  with the terms of the contracts between two parties - such as a seller and buyer - written into lines of code, rather than a formal, legal document. 

Smart Contracts are written in a specific object-orientated programming language called Solidity.

The goal is to simplify business and trade between both identified and anonymous parties without needing an intermediary. 

They enable developers to build far more sophisticated functionality than simply receiving or sending digital assets. These programs are known as dApps, short for decentralised applications, which, in their essence, are a series of linked Smart Contracts linked to a user interface.. 

Smart Contracts are deployed on blockchain networks to launch decentralised financial protocols and applications that run exactly as programmed.

Some Use Cases of Smart Contracts

  • Intellectual Property - Smart contracts can establish and enforce intellectual property agreements like licenses and allow the transfer of payment in real-time to the property owners. 
  • Provenance - Smart contracts protect against counterfeit and theft since blockchains are immutable. The goods sold without a transaction record in a blockchain network will lead to rejection.
  • Certification - The job certificates, diplomas, college degrees, etc., can be authenticated using smart contracts. 
  • Authenticity - A smart contract can ensure that a product bought by a customer is authentic. 
  • Insurance Claims - Insurance sectors can also benefit from Smart Contracts to speed up the claiming process. If a claim meets the conditions, the contract can execute automatically. 

To sum up, smart contracts can offer the following benefits:

  • Security - The distributed ledger is impossible to change.
  • Disintermediation - Parties can use smart contracts to enter into agreements without depending on a third-party.
  • Reduced Cost - As no intermediaries exist in a smart contract, individuals and companies can reduce the cost otherwise incurred on traditional contracts. 
  • Near Real-time Execution - Transactions take place almost simultaneously for all the participating parties as soon as the required criteria are satisfied.
  • Transparency - Since terms and conditions are visible to anyone, smart contracts create an environment of trust among all the parties in the blockchain network. 

Learn how to Use and Interact with Smart Contracts Effectively

Smart contracts on Ethereum platforms represent and manage tokens. The MakerDao protocol, for example, is the backbone of the DeFi sector. The project is a big part of the DeFi ecosystem because out of $1 billion of locked ETH in the DeFi market, 60% of ETH is held in MakerDAO.

DAI is the primary product of MakerDAO-a stablecoin pegged to 1 US dollar that maintains a consistent value via a system of price feeds and underlying collateral (ETH).

The project is deployed on the Ethereum blockchain and doesn't need any intermediary to function. MakerDAO issues loans directly in the DAI stablecoin via Smart Contracts that control Collateralized Debt Positions (CDP). 

CDP allows borrowers to deposit a digital asset into a Smart Contract as collateral to take out a loan on MakerDAO's platform. Once the asset is deposited, the conditions are written in a way that the CDP holds the assets and allows the borrowers to generate the equivalent of USD value in DAI to take out a loan.

Let's look at how CDP- a type of Smart Contract works. 

  • A user deposits Ether to Maker's Smart Contract, creating a CollateraliSed Debt Position, which will allow you to take out DAIs as per the collateralisation rate. 
  • Let's say, you deposited 1 ETH (worth $1800), which will allow you to take up to 905 DAI at a collateralisation ratio of 200%
  • To take your Ether back, you would have to pay back the borrowed amount in DAI along with a stability minor fee which helps maintain the DAI peg to USD.

But, if the price of Ether goes down by an agreed amount, your CDP will automatically close. This provides a safety buffer to ensure against default on loans. 

To prevent this, you need to either take out less DAI or put in more Ether as collateral. The CDP smart contract ensures that the MakerDAO system always has enough capital locked against the borrowed amount. 

Other Conditions set by MakerDAO in CDP smart contract.

  1. If the price of a collateralised asset doesn't change, users can pay back the borrowed amount along with the annual stability fee.
  2.  If the price of a collateralised asset drops, the CDP becomes under-collateralised, and a third-party will liquidate the collateralised CDP with a penalty. These third parties have various ways to profit from a liquidated position.
  3. If the price of collateralised assets increases, the collateralised ratio increases, allowing borrowers to draw extra DAIs against their collateralised asset, which eventually will bring the CDP ratio down. 

Smart Contracts to Control the System

MakerDAO is a self-governing protocol, and the native MKR token allows token holders to make changes to the Maker Protocol through a voting process which is written in a smart contract. These changes include:

  • What should be the stability fee (or the annual borrowing rate)?
  • How much collateral should back a CDP?
  • To shut down the protocol in the case of a flash crash of the collateralized asset or any other emergency.

The MKR token holders interact with the voting smart contract, and their vote is permanently recorded on the MakerDAO's blockchain for complete transparency. This contract records the votes weighted in proportion to the number of tokens each voter uses. This means the larger holders have a greater influence on the decisions. After collecting the votes, MakerDAO's voting smart contract processes the vote results. 

Again, another smart contract called "spell" is deployed to implement the changes decided by the contract. As of now, one of the members of the Smart Contract Team develops the contract. However, as the project progresses to become a truly decentralised platform, this process will be made automatic to remove a single point of failure from the system. 

More Complex Use Cases of Smart Contracts

The use cases of smart contracts go beyond just simple payment transactions and can be used in a wide range of fields, including medical, entertainment, and prediction markets.

Medical Trials

During medical trials, a patient visits different healthcare centres and carries all the documents physically to make it easier for doctors to understand the medical history. Smart contracts can ease up the hassle by offering 360 degree visibility of the data of a patient. 

Prediction Markets

A prediction market is essential to gain valuable insights regarding public opinion about a campaign or an organisation. Smart contracts can record the predictable outcome of events transparently to get accurate forecasts.


Smart contracts can enable rights for the content in the entertainment industry to remove plagiarism and piracy by watermarking media content. As soon as someone tries to steal the data, the legit owner will know immediately. 

Smart Contracts will seem alien to anyone that has no concept of how blockchains function. Once, however, you appreciate the way that blockchains can achieve consensus on data management without a central authority, the additional layer of complexity and logic that Smart Contracts seems both a natural progression and an exciting way to bring the benefits of blockchain technology to so many areas of our lives.