Back to All

Navigating Deprecated Syntax: Building the 'Buy Me a Coffee' DeFi App Tutorial, Please update the syntax and usages of Hardhat.

I was following the tutorial to build a DeFi app called "Buy Me a Coffee" (link: 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.

  1. The command npx hardhat will be deprecated; please use npx hardhat init instead.
  2. In the scripts/buy-coffee.js file, await buyMeACoffee.deployed() has been deprecated. Please use await buyMeACoffee.waitForDeployment() instead.
  3. In the scripts/buy-coffee.js file, buyMeACoffee.address has been deprecated. Please use await buyMeACoffee.getAddress() instead.
  4. In the scripts/buy-coffee.js file, the statement hre.ethers.utils.formatEther(balanceBigInt) encounters an error. To resolve this, use ethers directly by adding const { ethers } = hre; and then use ethers.formatEther(balanceBigInt).

Thank you for your attention.