From 75534a911d56535e0b977a46e89ef21ad3b93574 Mon Sep 17 00:00:00 2001
From: bt3gl <1130416+bt3gl@users.noreply.github.com>
Date: Wed, 21 Sep 2022 18:40:45 -0700
Subject: [PATCH] =?UTF-8?q?=F0=9F=A5=96=20add=20some=20erc20=20info?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Smart-Contract-Security/erc20-things.md | 13 ----
.../token-standards/erc20.md | 73 +++++++++++++++++++
2 files changed, 73 insertions(+), 13 deletions(-)
delete mode 100644 Smart-Contract-Security/erc20-things.md
create mode 100644 Smart-Contract-Security/token-standards/erc20.md
diff --git a/Smart-Contract-Security/erc20-things.md b/Smart-Contract-Security/erc20-things.md
deleted file mode 100644
index 927b635..0000000
--- a/Smart-Contract-Security/erc20-things.md
+++ /dev/null
@@ -1,13 +0,0 @@
-## ERC20 Things
-
-
-
-### [What the ERC!?](https://medium.com/@adrianhetman/what-the-erc-d31bc3b3470a)
-
-* ERC stands for Ethereum request for comments.
-* These are technical documents written by Ethereum developers for Ethereum community.
-* Each such document contains a set of rules required to implement tokens for the Ethereum ecosystem.
-* You can say ERC is a specific type of EIP.
-
-
-
diff --git a/Smart-Contract-Security/token-standards/erc20.md b/Smart-Contract-Security/token-standards/erc20.md
new file mode 100644
index 0000000..45bcff2
--- /dev/null
+++ b/Smart-Contract-Security/token-standards/erc20.md
@@ -0,0 +1,73 @@
+## ERC20
+
+
+
+* The ERC20 standard defines a common interface for contracts implementing this token, such that any compatible token can be accessed and used in the same way.
+
+
+
+### ERC20-compliant token contract
+
+* totalSupply
+Returns the total units of this token that currently exist. ERC20 tokens can have a fixed or a variable supply.
+
+* balanceOf
+Given an address, returns the token balance of that address.
+
+* transfer
+Given an address and amount, transfers that amount of tokens to that address, from the balance of the address that executed the transfer.
+
+* transferFrom
+Given a sender, recipient, and amount, transfers tokens from one account to another. Used in combination with approve.
+
+* approve
+Given a recipient address and amount, authorizes that address to execute several transfers up to that amount, from the account that issued the approval.
+
+* allowance
+Given an owner address and a spender address, returns the remaining amount that the spender is approved to withdraw from the owner.
+
+* Transfer
+Event triggered upon a successful transfer (call to transfer or transferFrom) (even for zero-value transfers).
+
+* Approval
+Event logged upon a successful call to approve.
+
+
+
+---
+
+### ERC20 optional functions
+
+In addition to the required functions listed in the previous section, the following optional functions are also defined by the standard:
+
+* name
+Returns the human-readable name (e.g., "US Dollars") of the token.
+
+* symbol
+Returns a human-readable symbol (e.g., "USD") for the token.
+
+* decimals
+Returns the number of decimals used to divide token amounts. For example, if decimals is 2, then the token amount is divided by 100 to get its user representation.
+
+
+
+---
+
+### The ERC20 interface defined in Solidity
+
+
+```
+contract ERC20 {
+ function totalSupply() constant returns (uint theTotalSupply);
+ function balanceOf(address _owner) constant returns (uint balance);
+ function transfer(address _to, uint _value) returns (bool success);
+ function transferFrom(address _from, address _to, uint _value) returns
+ (bool success);
+ function approve(address _spender, uint _value) returns (bool success);
+ function allowance(address _owner, address _spender) constant returns
+ (uint remaining);
+ event Transfer(address indexed _from, address indexed _to, uint _value);
+ event Approval(address indexed _owner, address indexed _spender, uint _value);
+}
+```
+