Skip to main content

ERC-20 Token Contract

A minimal, standard-compliant ERC-20 fungible token implementation in Solidity. A minimal, standard-compliant ERC-20 fungible token implementation in Solidity.

Explanation

This contract inherits from OpenZeppelin’s ERC20 implementation, which handles all standard token logic (transfers, allowances, balances). Key points:
  • The constructor mints initialSupply tokens to the deployer.
  • decimals() defaults to 18 (standard for ERC-20).
  • Using OpenZeppelin means the contract is audited and standard-compliant.
Deploy with a constructor argument for the initial supply, e.g. 1000000 for one million tokens.

Code


Canonical knowledge ID: code-example:erc-20-token-contract