Skip to main content
10 votes

Ethers 6 transaction receipt events information

Transaction Receipt events in ethers.js v6 available at .logs getter. You could miss it because you can't see it while logging whole transaction receipt object, but you can see it by calling "...
Microwave Dev's user avatar
8 votes

ParseEther is getting undefined

function "parseEther" have been migrated from ethers.utils to ethers . So when you want to use that in version 6, just use ethers.parseEther("0.05") or, you can downgrade your ...
yu liang's user avatar
6 votes

Hardhat vs foundry, which to use for testing?

I agree with other answers about foundry's speed, it is incredible, as is its reandomization testing and its debugging options. So, if you need fast tests or are stuck on an error, quickly (and easily)...
kuco 23's user avatar
  • 278
6 votes

Error HH19: Your project is an ESM project (you have "type": "module" set in your package.json) but your Hardhat config file uses the .js extension

Downgrading "chai" from 5.00 to 4.3.7 helped solve the error, i had dependencies that require ES modules and thats why i got the error.
Plair's user avatar
  • 71
5 votes
Accepted

How to configure custom ethereum node in foundry project?

Yes, Foundry allows users to configure custom Ethereum nodes. RPC-Endpoints settings Custom RPC endpoints can be defined in the foundry.toml under [rpc_endpoints] as follows: # foundry.toml [...
MShakeG's user avatar
  • 1,723
5 votes
Accepted

Ethers 6 transaction receipt events information

I was having the exact same problem with v6 of ethers. In v5, the events were part of the transaction receipt, but not in v6. In looking at the "Getting Started" section of the docs for ...
ScottW3's user avatar
  • 66
4 votes
Accepted

How to get deployed contract address with ethers?

The answer by @AlexanderHerranz is for ethers v5, for newer versions of hardhat that use ethers v6 you can get the deployed address using the async getAddress() method as shown below: const ...
MShakeG's user avatar
  • 1,723
4 votes

Unable to verify contracts on polygon Amoy testnet

I've asked regarding this issue on OKLink Discord channel, and they've responded. So, the correct configuration to be used in the hardhat.config.js would be: etherscan: { apiKey: { ...
SYED ASAD KAZMI's user avatar
3 votes
Accepted

1155URIStorage not available in npm package but is available on OpenZeppelin Github

What version are you using? Coz I can see this file on my computer, I have version 4.8.0.
Zartaj Afser's user avatar
  • 4,416
3 votes

Cannot read properties of undefined (reading 'formatEther')

If you are using version 6 or higher of ethers, you no longer need the "utils" keyword. const val = hre.ethers.utils.formatEther(100000000000000) console.log("val:", val) Check ...
Rohan Nero's user avatar
  • 1,607
3 votes
Accepted

nothing to compile in hardhat(yarn)

If you compile your contracts once and then try compiling them again without making any changes to the source code, then you will see nothing to compile. To see that your compiled contracts, you can ...
Soham Zemse's user avatar
  • 2,061
2 votes

How to catch multiple events from a single function in the hardhat framework?

In my case, it didn't work. The event expected first wasn't correctly tested, I can put any value, and it returns always true. I change it like this: const tx = contract.claimTokens(busd....
Noel Nathan Planell Bosch's user avatar
2 votes

How can I create the typechain directory in my hardhat project?

You can do npx hardhat typechain and it will regenerate the folder for you.
Iaroslav Titov's user avatar
2 votes

solidity-coverage giving wrong report

Try to run : npx hardhat clean before running coverage.
Marius's user avatar
  • 121
2 votes

How to mimic abi.encodePacked in ethers?

A little snippet i made for ethers.js v6 import {ethers} from "ethers" function encodePacked(params = []){ let types = [] let values = [] params.forEach(...
Big Zak's user avatar
  • 121
2 votes

Wait X block confirmations ethers contract deployment

Note that on recent versions of Hardhat, the deployTransaction attribute has been replaced in favor of a new function called deploymentTransaction. So you would need to do instead: await simpleStorage....
10xTeam.dev's user avatar
2 votes

How can I test sending Ether to a contract with a `payable` receive function?

Here's a workaround for this issue, based on Ether's version 6: import { ethers } from "hardhat"; import { expect } from "chai"; import { parseEther } from "...
jsina's user avatar
  • 121
2 votes

Hardhat Etherscan Unsupported Network Sepolia chain Id: 11155111

I faced the same issue while verifying my contract using [hardhat-etherscan] so I updated the package using this command in the console >>> npm update @nomiclabs/hardhat-etherscan This worked ...
Rohit Roy's user avatar
2 votes
Accepted

Why dynamic arrays seem to be empty when they are part of an event?

The indexed parameters of events are not stored directly in the event logs. Instead, the Keccak-256 hashes of these parameters are stored. This is particularly relevant for dynamic types like arrays. ...
ali konuk's user avatar
2 votes

Provider error: transaction would cause overdraft: I got this error when deploying to sepolia testnet

This is usually the time when your wallet has low funds, meaning that the transaction fees will cause your wallet balance to go below 0. Make sure to fund your wallet before deploying. Let me know if ...
Zartaj Afser's user avatar
  • 4,416
2 votes
Accepted

How can I inheritance an interface without abstract?

The error you get if you try to compile without the abstract keyword actually tells you exactly what you need to do: you can't have a non-abstract contract which doesn't implement all of the function ...
Lauri Peltonen's user avatar
2 votes

TypeError: receipt.gasUsed.mul is not a function

Things have changed in ethers v6 as compared to ethers v5. In ethers version 5, we have to use these functions such as add() , mul(),div() etc , but in ethers version 6, javascript takes cares of all ...
MD AZAD's user avatar
  • 60
2 votes
Accepted

Property 'address' does not exist on type 'BaseContract'

Try using contract.target or await contract.getAddress() instead. Ethers v6 has different interfaces to Ethers v5. https://docs.ethers.org/v6/api/contract/#BaseContract-target It's possible you have ...
Milk's user avatar
  • 463
2 votes

Hardhat compile code on file change (like remix)

I don't think that's needed. Because every time we run any command in hardhat like run, test etc. the hardhat automatically matches the contract files with the already compiled artifacts, if there is ...
Zartaj Afser's user avatar
  • 4,416
2 votes
Accepted

Hardhat - Interacting with deployed contract

While you say you run the script using this command npx hardhat run scripts/setter.js This means the command is being run locally and not on the testnet network. For that, you would need to add the ...
Zartaj Afser's user avatar
  • 4,416
2 votes
Accepted

Argument of type 'HardhatEthersSigner' is not assignable to parameter of type 'string | Signer | undefined'

Ran into this and then another issue related to the v6 migration. Once I installed ethers as a dependency (yarn add -D ethers), I was able to get this to work.
Jack Gilcrest's user avatar
2 votes

Calling smart contract function from frontend is not working

So by digging a lot, I finally found the reason for the error. The issue is with the ethers version 6. I think this version of ethers is still unstable. That's why I couldn't able to find the cause ...
Santhosh's user avatar
2 votes
Accepted

How to deploy a Safe on Hardhat

We run some Safe tests using Hardhat Network in our project. Here is the example: safe.spec.ts#L212 You have to deploy 3 contracts: GnosisSafeProxyFactory.sol GnosisSafe.sol MultiSend.sol Then you ...
tenbits's user avatar
  • 2,428
2 votes

Unknown key "viaIR"

viaIR: true may require version 0.8.13 and higher.
EthanOK's user avatar
  • 451
2 votes

Foundry or Hardhat: I'm really confused about which one should I use?

Solidity is a language for smart contract development while javascript/typescript these days, is used for frontend, backend and basically everything. by sure, it always depends on what you want to do ...
armin's user avatar
  • 21

Only top scored, non community-wiki answers of a minimum length are eligible