ERC20

import "@thirdweb-dev/contracts/eip/interface/IERC20.sol";

ERC20 is the standard for representing fungible tokens; where each token is of equal valuable and interchangeable.


GitHub
View on GitHub

Usage

This is an example smart contract demonstrating how to inherit from this extension and override the functions to add (optional) custom functionality.

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@thirdweb-dev/contracts/eip/interface/IERC20.sol";
contract Contract is IERC20 {
constructor(
string memory _name,
string memory _symbol
) {}
function totalSupply() external view returns (uint256) {
// Your custom implementation here
}
function balanceOf(address who) external view returns (uint256) {
// Your custom implementation here
}
function allowance(address owner, address spender) external view returns (uint256) {
// Your custom implementation here
}
function transfer(address to, uint256 value) external returns (bool) {
// Your custom implementation here
}
function approve(address spender, uint256 value) external returns (bool) {
// Your custom implementation here
}
function transferFrom(
address from,
address to,
uint256 value
) external returns (bool); {
// Your custom implementation here
}
}
GitHub
View on GitHub

Base Contracts Implementing This Extension