Coinmonks

Coinmonks is a non-profit Crypto Educational Publication. Other Project — https://coincodecap.com/ & Email — gaurav@coincodecap.com

Follow publication

Member-only story

Dissection of an ERC-20 StableCoin: Understanding the stablecoin smart contract (Part One)

MD Rafsun Sheikh
Coinmonks
Published in
10 min readSep 30, 2024

--

Image Source: https://learn.swyftx.com/altcoins/what-are-stablecoins/

I have started studying a Stablecoin smart contract that is already running in Ethereum Mainnet. To better understand it, I think it is best to share my understanding with you and engage in a healthy discussion. The code for the stablecoin can be found here.

During this study of the smart contract code, I will follow a top-down approach. That means I’ll try to develop a tree-like structure of the overall smart contract codes. To maintain the length of the article, I will divide it into several parts. This is the first part. Other consecutive parts can be accessed from the links below.

The smart contract contains Library , Interface , abstract contract , and contract .

The libraries are:

  1. Arrayops
  2. AddressUpgradeable

The abstract contract are named as:

  1. Initializable
  2. ReentrancyGuardUpgradeable
  3. ContentUpgreadable
  4. OwnableUpgradeable
  5. PausableUpgradeable
  6. ERC20PausableUpgradeable
Figure 1: List of Inherited libraries, interfaces, abstract contracts and contracts

The interfaces are:

  1. IERC20Upgradeable
  2. IERC20MetadataUpgradeable

And finally the contracts are:

  1. Common
  2. ERC20Upgradeable
  3. StableCoin

The contract, abstract contracts and interfaces inherit each other. It is challenging to keep track of them. Figure 1 shows the list of the inherited libraries, interfaces, abstract contracts and contracts. Before proceeding further, we should understand the difference between contracts, abstract contracts, interfaces and libraries.

Contracts can be deployed into the blockchain network; on the other hand, abstract contracts can’t be deployed by themselves. They can only be inherited by another contract. An abstract contract is somewhat similar…

--

--

Coinmonks
Coinmonks

Published in Coinmonks

Coinmonks is a non-profit Crypto Educational Publication. Other Project — https://coincodecap.com/ & Email — gaurav@coincodecap.com

MD Rafsun Sheikh
MD Rafsun Sheikh

No responses yet

Write a response