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

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:
- Arrayops
- AddressUpgradeable
The abstract contract
are named as:
- Initializable
- ReentrancyGuardUpgradeable
- ContentUpgreadable
- OwnableUpgradeable
- PausableUpgradeable
- ERC20PausableUpgradeable

The interfaces
are:
- IERC20Upgradeable
- IERC20MetadataUpgradeable
And finally the contracts
are:
- Common
- ERC20Upgradeable
- 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…