Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#86dtu93df - Include how to write token contracts (NEP-17) to the doc… #1269

Merged
merged 1 commit into from
Jun 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions docs/source/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,19 @@ def set_message(new_message: str): # now this method will overwrite a new strin
storage.put_str(b"second script", new_message)
```

### How to make a Token smart contract
For a smart contract to be a fungible token on the Neo blockchain, it needs to adhere to the [NEP-17](https://docs.neo.org/docs/en-us/develop/write/nep17.html) standard, which requires the implementation of a few specific methods:
- `symbol` - Returns the symbol of the token.
- `decimals` - Returns the number of decimals used by the token.
- `totalSupply` - Returns the total supply of the token.
- `balanceOf` - Returns the balance of the specified account.
- `transfer` - Transfers tokens from one account to another.

And must also implement and trigger a `Transfer` event whenever tokens are transferred, minted or burned.

Here's a [simple example](https://github.com/CityOfZion/neo3-boa/blob/development/boa3_test/examples/simple_nep17.py) of a Token contract following the NEP-17 standard.
>Note: The NEP-17 standard also has requirements on how each method must be implemented. Be sure to check the [full documentation](https://docs.neo.org/docs/en-us/develop/write/nep17.html) on the NEP-17 standard to ensure the implementation is correct.

## Compiling your Smart Contract

### Using CLI
Expand Down
Loading