Hi @PreciousChicken,
Thanks for sharing your blog post. I think writing a blog post is a great way to learn, I seeing tutorials from the community.
Sorry for the delay in responding, I was on vacation last week
I had a look through the post and had the following feedback:
I noticed that you installed truffle globally, my personal preference is Installing packages locally rather than globally (npx)
I would keep any non-core functionality separate from the token (such as purchasing). The token should ideally just be the functionality to use the token. If you have purchasing functionality you can put this in a separate contract.
You could also transfer an amount of tokens to the purchasing functionality contract rather than having to set an allowance for the token contract to be able to use some of the deployer of the token contracts tokens.
The pragma could be ^0.6.2 as 0.6.2 is the minimum compiler version that we can use due to dependencies in OpenZeppelin Contracts.
There is a typo in the SPDX license: The Unlicense (MIT is a great license to use).
I know that you are aware that you didn't handle decimals. The token has 18 decimals. You could change this to have 0 decimals.
By default,
ERC20
uses a value of18
fordecimals
. To use a different value, you will need to call _setupDecimals in your constructor.
The total supply is 1000/(10^18) so in MetaMask when added as a custom token will show as 0.000 PCT
For information on decimals see: https://docs.openzeppelin.com/contracts/3.x/erc20#a-note-on-decimals
Rather than changing the build artifacts to client/src/contracts
you could create a soft link. (ln -s ../../build/contracts/ contracts
)
Well done on creating a guide that can be followed and a nice demo app.