Navigating Deprecated Syntax: Building the 'Buy Me a Coffee' DeFi App Tutorial, Please update the syntax and usages of Hardhat.
about 1 month ago by Jill Chang
I was following the tutorial to build a DeFi app called "Buy Me a Coffee" (link: https://docs.alchemy.com/docs/how-to-build-buy-me-a-coffee-defi-dapp). However, I encountered some deprecated syntax, which caused me to get stuck at certain steps before deploying it to Ethereum Goerli testnet. I am currently trying to find the correct way to complete the dApp.
- The command
npx hardhat
will be deprecated; please usenpx hardhat init
instead. - In the scripts/buy-coffee.js file,
await buyMeACoffee.deployed()
has been deprecated. Please useawait buyMeACoffee.waitForDeployment()
instead. - In the scripts/buy-coffee.js file,
buyMeACoffee.address
has been deprecated. Please use awaitbuyMeACoffee.getAddress()
instead. - In the scripts/buy-coffee.js file, the statement
hre.ethers.utils.formatEther(balanceBigInt)
encounters an error. To resolve this, use ethers directly by addingconst { ethers } = hre;
and then useethers.formatEther(balanceBigInt)
.
Thank you for your attention.