# 10. ERC20s

### EIPs

* Stands for Ethereum Improvement Proposals
* These are ideas to improve L1 technology
* [eips.ethereum.org](https://eips.ethereum.org/) holds all improvement proposals

***

### ERCs

* Stands for Ethereum Request for Comments
* ERC & EIP share same number
  * ERC-20 (EIP-20)
  * It also means it is the 20th proposal

***

### ERC-20

* Token deployed on ethereum chains which follows ERC-20 token standard
* Tether, chainlink (ERC-677), unitoken, dai are examples of ERC-20 tokens

***

### Creating ERC-20 Token

#### Manual

```sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;

contract ManualToken {
    uint256 initialSupply;
    mapping(address => uint256) public balanceOf;
    mapping(address => mapping(address => uint256)) public allowance;

    // Transfer Tokens
    // Subtract "from address" amount and add "to address" amount

    function transfer(address from, address to, uint256 amount) public {
        balanceOf[from] -= amount;
        balanceOf[to] += amount;
    }

    /** Send _value tokens to _to on behalf of _from
     *
     * @param _from The address of sender
     * @param _to The address of the recipient
     * @param _value The amount to send
     *
     */
    function transferFrom(
        address _from,
        address _to,
        uint256 _value
    ) public returns (bool) {
        require(_value <= allowance[_from][msg.sender]);
        allowance[_from][msg.sender] -= _value;
        transfer(_from, _to, _value);
        return true;
    }

    // Other Functions
}
```

#### OpenZeppelin

* Take boilerplate code from OpenZeppelin

```sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";

contract MyToken is ERC20 {
    constructor(uint256 initialSupply) ERC20("MyToken", "MT") {
        _mint(msg.sender, initialSupply);
    }
}
```

***


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://notes.nomanaziz.me/development/blockchain/freecodecamp-course/10.-erc20s.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
