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 Two)

MD Rafsun Sheikh
Coinmonks
Published in
9 min readOct 1, 2024
Image Source: https://solanafloor.com/learn/stablecoins-explained

This is the continuation of my study of stablecoin smart contract. In the previous part, we introduced the smart contract code, illustrated a dependency mapping among the contracts and interfaces, started describing the abstract contracts, and we could cover up to PausableUpgradeable . You can find all the parts of the article in the following links:

Let’s jump right into the smart contract!!!

Interface IERC20Upgradeable {}

The provided IERC20Upgradeable interface defines the standard functions and events for ERC20 tokens, as described in the Ethereum Improvement Proposal (EIP) 20. ERC20 is one of the most widely adopted standards for fungible tokens on Ethereum and other blockchain networks.

Key Functions and Events in IERC20Upgradeable

Events

  1. Transfer:
  • Emitted when tokens are moved from one account to another.
  • Includes the sender’s address (from), the receiver's address (to), and the number of tokens moved (value).
  • This event also fires when value is zero, to reflect zero-value transfers.

2. Approval:

  • Emitted when a spender’s allowance for an owner’s tokens is set or updated.
  • Includes the owner (owner), the spender (spender), and the updated allowance (value).

Functions

1. totalSupply():

  • Returns the total amount of tokens in existence.
  • This function allows for querying the overall supply of the ERC20 token.

2. balanceOf(address account):

  • Returns the token balance of the specified account (account).
  • The balance represents how many…

Create an account to read the full story.

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Or, continue in mobile web

Already have an account? Sign in

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

Hi, Kirshi Yin! I am forwarding your story to my daughter, who is a tech buff and who isn’t on Medium. I hope she enjoys your story!

--

Thanks a lot for such an easy explanation. It really helped me alot in my thesis.

--