Contract
Create a contract calledUnburnableToken
. Add the following in storage:
- A public mapping called
balances
to store how many tokens are owned by each address - A
public uint
to holdtotalSupply
- A
public uint
to holdtotalClaimed
- Other variables as necessary to complete the task
Constructor
Add a constructor that sets the total supply of tokens to 100,000,000.Claim
Add apublic
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!)
Safe Transfer
Implement apublic
function called safeTransfer
that accepts an address _to
and an _amount
. It should transfer tokens from the sender to the _to
address, only if:
- That address is not the zero address
- That address has a balance of greater than zero Base Sepolia Eth
UnsafeTransfer
error, containing the address.
Submit your Contract and Earn an NFT Badge! (BETA)
Hey, where’d my NFT go!?
Testnets are not permanent! Base Goerli will soon be sunset, in favor of Base Sepolia.As these are separate networks with separate data, your NFTs will not transfer over.Don’t worry! We’ve captured the addresses of all NFT owners on Base Goerli and will include them when we release the mechanism to transfer these NFTs to mainnet later this year! You can also redeploy on Sepolia and resubmit if you’d like!The contract specification contains actions that can only be performed once by a given address. As a result, the unit tests for a passing contract will only be successful the first time you test.You may need to submit a fresh deployment to pass