DEV Community

Cover image for Ethereum Dapp Crash Course: Make an ERC20 token faucet + Frontend

Ethereum Dapp Crash Course: Make an ERC20 token faucet + Frontend

Richard Melkonian on June 01, 2021

Find all the source code for this project here Link Ethereum smart contract development has been possible to learn since 2016 or so. But how to ...
Collapse
 
tssandor profile image
TSS • Edited

Great stuff!

There is one important step missing before deploying the contract to the local blockchain: compiling it! You need an npx hardhat compile. It took me AGES to figure out why it refused to compile the file. Turned out that it couldn't recognize .Sol, only .sol - maybe useful for someone struggling with the same :)

Collapse
 
richardmelko profile image
Richard Melkonian

Thank you so much for this, I must have missed this command, I'm going to edit the post now. Well done for figuring it out. And glad you got something from this.

Collapse
 
senorgeno profile image
Gene

Thanks for this!

You might want to also change the name here too
'.Sol' - "In your project in the /contracts folder delete any contracts there and create a new contract called FCTToken.Sol with the following code, the code we just tested."

Thread Thread
 
richardmelko profile image
Richard Melkonian

will update, thanks

Collapse
 
syfqbs profile image
. • Edited

Need help troubleshooting right after running local blockchain. Here is what i did

  1. Initiate new terminal in touch .env directory
  2. Run npx hardhat node in terminal
  3. Got the following error:

Error HH12: Trying to use a non-local installation of Hardhat, which is not supported. Please install Hardhat locally using npm or Yarn, and try again.

Collapse
 
samsafi profile image
Sam-Safi

Hi Richard,
First of all thank you for this crash course.
I followed your code and when I click on “check my balance” button I got this error

Unhandled Rejection (Error): network does not support ENS (operation="ENS", network="unknown", code=UNSUPPORTED_OPERATION, version=providers/5.3.0)

Collapse
 
drdarian profile image
drdarian

I had the same issue. I fixed it by changing the 'tokenAddress' variable in Faucet.js.

I had originally put in the address for my Metamask wallet which caused the error. You should use the contract address given to you by your Hardhat terminal which you should receive after you call 'npx hardhat node'. It will be located after your hardhat_addCompilationResult

Collapse
 
adouch9 profile image
adouch9

Me too I have the same problem

Collapse
 
senorgeno profile image
Gene

Hey, I am getting "Error: Expected private key to be an Uint8Array with length 32" when trying to deploy to Goreli. Any ideas?

Collapse
 
klaudioz profile image
Claudio Canales

You're using Account #0 address instead the Private Key address.

Collapse
 
richardmelko profile image
Richard Melkonian

not sure.. make sure your storing your private key as the correct variable type in your .env file

Collapse
 
anusrinivasan profile image
Anu-srinivasan

Hi
I am getting the error "Failed to load config prettier to extend from. Installed all dependencies using yarn install. Please suggest solution

Collapse
 
markwu_crypto profile image
Mark🐸

Thanks a lot. I am a newbie and it helps.

Collapse
 
mrifai profile image
Muhamad Rifai

when the faucet button claims, the total max supply keeps increasing, why is that?