Solidity Code Snippets


Remember to use audited code whenever you can, like OpenZeppelin's contracts, for example. If you want a quick IDE that you can use right now for developing, testing, and / or deploying, use Remix! Tutorialspoint has a great lesson in Solidity for beginners with some prior coding experience.

For contracts where certain addresses have privileges, consider using OZ's AccessControl contract.

Hi-Voltage Token v1

The source code for $HV1, my first personal token.

Simple ERC1155 Token

A simple contract for quickly creating a fungible data token that follows the ERC1155 standard. It makes 1018 Health Boost tokens and 1027 Elite Skin tokens that can be used in video games. Metadata about each of these tokens can be found at https://example.com/item/{id}.json, where{id} is the ID number of the token for which metadata is being requested.

Simple ERC20 Token

A simple contract for quickly creating a fungible token that follows the ERC20 standard. It makes 1,000,000 tokens with up to 18 decimal places, token name "MyToken", and symbol "TKN". Upon creation / deployment, it grants the deploying wallet the entire supply.