Skip to content

Commit

Permalink
Merge pull request #2145 from ttrowell/patch-1
Browse files Browse the repository at this point in the history
Update index.md
  • Loading branch information
samajammin committed Dec 21, 2020
2 parents 1d143dc + 6803743 commit 98b141a
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,19 +45,19 @@ Here is a line-by-line explainer of what every function is for. After this we’
function totalSupply() external view returns (uint256);
```

Returns the amount of tokens in existence. This function is a getter and soes not modify the state of the contract. Keep in mind that there is no floats in Solidity. Therefore most tokens adopt 18 decimals and wil return the total supply and other results as followed 1000000000000000000 for 1 token. Not every tokens has 18 decimals and this is something you really need to watch for when dealing with tokens.
Returns the amount of tokens in existence. This function is a getter and does not modify the state of the contract. Keep in mind that there is no floats in Solidity. Therefore most tokens adopt 18 decimals and will return the total supply and other results as followed 1000000000000000000 for 1 token. Not every tokens has 18 decimals and this is something you really need to watch for when dealing with tokens.

```solidity
function balanceOf(address account) external view returns (uint256);
```

Returns the amount of tokens owned by an address (`account`). This function is a getter and soes not modify the state of the contract.
Returns the amount of tokens owned by an address (`account`). This function is a getter and does not modify the state of the contract.

```solidity
function allowance(address owner, address spender) external view returns (uint256);
```

The ERC-20 standard allow an address to give an alowance to another address to be able to retrieve tokens from it. This getter returns the remaining number of tokens that the `spender` will be allowed to spend on behalf of `owner`. This function is a getter and soes not modify the state of the contract and should return 0 by default.
The ERC-20 standard allow an address to give an allowance to another address to be able to retrieve tokens from it. This getter returns the remaining number of tokens that the `spender` will be allowed to spend on behalf of `owner`. This function is a getter and does not modify the state of the contract and should return 0 by default.

## Functions {#functions}

Expand All @@ -71,7 +71,7 @@ Moves the `amount` of tokens from the function caller address (`msg.sender`) to
function approve(address spender, uint256 amount) external returns (bool);
```

Set the amount of `allowance` the `spender` is allowed to transfer from the function caller (`msg.sender`) balance. This function emits the Approval event. The function returns wether the allowance was successfuly set.
Set the amount of `allowance` the `spender` is allowed to transfer from the function caller (`msg.sender`) balance. This function emits the Approval event. The function returns whether the allowance was successfully set.

```solidity
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
Expand All @@ -85,7 +85,7 @@ Moves the `amount` of tokens from `sender` to `recipient` using the allowance me
event Transfer(address indexed from, address indexed to, uint256 value);
```

This event is emitted when the amount of tokens (value) is sent from the from address to the to address.
This event is emitted when the amount of tokens (value) is sent from the `from` address to the `to` address.

In the case of minting new tokens, the transfer is usually `from` the 0x00..0000 address while in the case of buning tokens the transfer is `to` 0x00..0000.

Expand Down Expand Up @@ -195,6 +195,6 @@ library SafeMath {
}
```

This implementation uses the SafeMath library, read our tutorial about it if you’d like to learn [how the library helps you with handling overflows and underflows in your smart contracts](https://ethereumdev.io/using-safe-math-library-to-prevent-from-overflows/).
This implementation uses the SafeMath library. Read our tutorial about it if you’d like to learn [how the library helps you with handling overflows and underflows in your smart contracts](https://ethereumdev.io/using-safe-math-library-to-prevent-from-overflows/).

Another excellent implementation of the ERC-20 token standard is the [OpenZeppelin ERC-20 implementation](https://github.com/OpenZeppelin/openzeppelin-contracts/tree/master/contracts/token/ERC20).

0 comments on commit 98b141a

Please sign in to comment.