fbpx

Loan state machine in Solidity

Julien Klepatch

In this video we will create a loan smart contract with Solidity.

There will be 2 kind of parties interacting with the smart contract:

  • investors
  • borrowers

The investor will send Ether at the beginning of the loan, and at the end the borrower will reimburse the investor of the initial amount lent, plus some interest.

The loan has different phases (pending, active, closed), which can be modeled as a state machine. Luckily, Solidity has a construct called enum that is very convenient for state machines. We are going to use a State enum to build our loan state machine and keep our smart contract code clean

0 Comments

Leave a Reply

More great articles

How to import Solidity ABI to Dapp frontend? 4 Solutions

When you develop a Dapp, you need the Solidity ABI of your smart contract in order to configure web3 to…

Read Story

ToDo List Ethereum Dapp (Step3) | Writing The Nodejs Backend

This tutorial is part of the series ToDo List Ethereum Dapp. It is the Step 1. Tutorials already published: Intro…

Read Story

Introduction To Truffle | Episode 5

https://youtu.be/M-w6dDDhu6w Developing smart contracts and distributed applications is hard. There are a lot of different libraries to use, you often…

Read Story

Never miss a minute

Get great content to your inbox every week. No spam.
[contact-form-7 id="6" title="Footer CTA Subscribe Form"]
Arrow-up