Exercise - Create your own token!
UnburnableToken
. Add the following in storage:
balances
to store how many tokens are owned by each addresspublic uint
to hold totalSupply
public uint
to hold totalClaimed
public
function called claim
. When called, so long as a number of tokens equalling the totalSupply
have not yet been distributed, any wallet that has not made a claim previously should be able to claim 1000 tokens. If a wallet tries to claim a second time, it should revert with TokensClaimed
.
The totalClaimed
should be incremented by the claim amount.
Once all tokens have been claimed, this function should revert with the error AllTokensClaimed
. (We won’t be able to test this, but you’ll know if it’s there!)
public
function called safeTransfer
that accepts an address _to
and an _amount
. It should transfer tokens from the sender to the _to
address, only if:
UnsafeTransfer
error, containing the address.