Hi @pkr,
A good place to start is the ERC20 API documentation
If I was creating an ERC20 token then I would use ERC20Detailed
for name
, symbol
and decimals
. As a side note, I would use decimals of 18 (unless I had a really good reason not to), see decimals documentation.
https://docs.openzeppelin.com/contracts/2.x/api/token/erc20
Whether you use a fixed supply or mint tokens (with or without a cap) depends on your intended tokenomics (including how you are distributing your tokens). You can also look at the Creating ERC20 Supply documentation.
For simple tokens (with no intended value), I tend to use a fixed supply to keep things simple, as there is no need for any roles.
For tokens used in the equivalent of a digital laundromat, you may want a mintable token (you may also want it to be burnable). Though it really depends on your use case.
https://docs.openzeppelin.com/contracts/2.x/api/token/erc20
Additionally there are multiple custom extensions, including:
- designation of addresses that can create token supply (
ERC20Mintable
), with an optional maximum cap ( ERC20Capped
)
- destruction of own tokens (
ERC20Burnable
)
- designation of addresses that can pause token operations for all users (
ERC20Pausable
).
For simple locking, I would use TokenTimelock
though for vesting e.g. for project team tokens, then you could look at TokenVesting. For a crowdsale you may use both for different recipients.
https://docs.openzeppelin.com/contracts/2.x/api/token/erc20
Finally, there are some utilities to interact with ERC20 contracts in various ways.
-
SafeERC20
is a wrapper around the interface that eliminates the need to handle boolean return values.
-
TokenTimelock
can hold tokens for a beneficiary until a specified time.
If you are considering a crowdsale, the suggest looking at the Crowdsale documentation.
You may also need to consider regulatory requirements in jurisdictions that you and your users are, and obtain appropriate advice on this.
You could also look at creating ERC777 tokens (no need to do approve and transferFrom in two separate transactions). See the ERC777 documentation for details. ERC777 also has the concept of operators, which depending on requirements may be needed.
Finally, for digitizing a physical asset you may want to consider using a non-fungible token if your physical assets are potentially unique.
See the ERC721 documentation.