New answers tagged

1 vote

Insufficient Liquidity after adding liquidity on Sepolia Uniswap V2

I didn't think the front end was connected to the smart contracts on the test net. You can still use the router to test, just swap via the explorer: - https://scrollscan.com/address/...
Maka's user avatar
  • 895
0 votes

Hardhat doesn't recognize custom errors from inherited Contracts

The message is thrown at chai-matchers validation and it means, that the expected error is not found in the contracts interface: https://github.com/NomicFoundation/hardhat/blob/...
tenbits's user avatar
  • 2,323
1 vote
Accepted

Insufficient Allowance ERC20 when adding liquidity to Uniswap V2 Pool

The error is quite clear, you'll need to approve the contract before calling a transferFrom function. So before you call the addLiquidity function (which has the call to transferFrom), add this line. ...
Zartaj Afser's user avatar
  • 3,754
0 votes

hardhat verify ConnectTimeoutError: Connect Timeout Error

I have solved this issue by setting mocha timeout in hardhat.config.js module.exports = { ... mocha: { timeout: 100000000 // or any time value that suits your project }, ... }
Sham Gir's user avatar
  • 101
0 votes

Why the method _castToPure in hardhat/console.sol can convert a view method to a pure one?

This function is called to avoid having solc throwing when trying to cast a view function into a pure one (doing it in assembly bypass the compiler check) Without the assembly block (ie just assigning ...
DrGorilla.eth's user avatar
0 votes

Hardhat is not generating private keys when I run `npx hardhat node`

i tweaked the node_modules and found this at node_modules/hardhat/src/builtin-tasks/node.ts there is check that to output the private keys only if you have the default configuration in your hardhat....
Hemram Kumarapu's user avatar
0 votes

How to get the ETH balance after calling getSigners()

To get the balance of WETH token on the Arbitrum network, you can call the balanceOf() function of the corresponding token contract: const { ethers } = require("ethers"); const provider = ...
SYED ASAD KAZMI's user avatar
1 vote

how to access to a public mapping from test script

If you are accessing a mapping that is some type to an array type, you need to pass the array index that you'd like to access as well. For example: access first element in the returned list console....
Rumbledore's user avatar
-1 votes

Are the Hardhat provided accounts' public keys as accessible as their private keys?

import { call } from '@wagmi/core' import { config } from './config' await call(config, { account: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266', data: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', to: ...
Anuwat Sriwongsa's user avatar
0 votes

How to check if a token was approved?

Had similar issue when I met error STF despite the approve going through beforehand. Turns out I forgot to parse the amountIn with the correct number of decimal as DAI and other stable coin have only ...
codekoriko's user avatar
0 votes

Large price discrepancy between swapExactTokensForTokens and official swap

The price you get depends on the available liquidity and path. It is likely that your code and Hardhat fork took a different path, or does not have direct liquidity available, different what Quickswap ...
Mikko Ohtamaa'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
0 votes
Accepted

Hardhat Errors: Invalid value null supplied to : QUANTITY

I commented out the forking url that I had pasted in the Hardhat.config.ts file. The test cases run easily. Looks like the mainnet rpc url used in forking was not working at times
Pankaj Jagtap's user avatar
0 votes
Accepted

Hardhat: Get contract address and pass as param to another contract to deploy

Hardhat Ignition doesn't seem to provide a way (yet) to retrieve the contract addresses directly after deployment, particularly because it creates Future artifacts corresponding to the contracts ...
SYED ASAD KAZMI's user avatar
1 vote

How is hardhat a dev dependency?

Installing Hardhat as a dev dependency means that it’s only required for development purposes, such as compiling, testing, and deploying contracts. Once the development process is complete and you ...
SYED ASAD KAZMI's user avatar
0 votes

Error: Transaction reverted: function selector was not recognized and there's no fallback nor receive function

Update the smart contract address after deployment in your tests. It seems like the contract address is hardcoded.
gigs's user avatar
  • 103
0 votes
Accepted

Full node on sepolia

As far as I have experienced you will need a consensus client, as execution client will only start syncing when it connects to a beacon node and will need to be synced before you can compute the ...
Maka's user avatar
  • 895
0 votes

Reading Events from Implementation contract

The test case is actually failing when tested using to.emit() in Hardhat test. However, when you check the logs, you can find the event being emitted from the proxy contract function call (i.e., ...
SYED ASAD KAZMI's user avatar
0 votes

I can't verify a proxy contract on polygon amoy testnet with Hardhat

I would take another look at the hardhat-oklink-verify plugin docs. In your hardhat.config.js, you should rename etherscan to oklink. Also you should use the oklink-verify command like in this example:...
simonDos's user avatar
  • 366
0 votes

evm_increaseTime in hardhat

hre.ethers.provider.send("evm_increaseTime", [864005]); //replace 864005 with the time in seconds you wish to increase.
user133823's user avatar
1 vote

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
0 votes

HardhatError: HH101: Hardhat was set to use chain id 11155111, but connected to a chain with id 1

Make sure to use the right RPC url for your sepolia network. For example, An Ethereum mainnet rpc URL from alchemy is not going to work on the sepolia network. I encountered this issue too but I ...
Snoep's user avatar
  • 3
1 vote

ethers.utils.solidityKeccak256 in hardhat test file

If you are on ethers v6, try this: const message = ethers.solidityPackedKeccak256( ['address', 'bytes32', 'uint256'], [userAddr, nonce, ammount] );
user133751's user avatar
2 votes
Accepted

Execution Reverted due to UniswapV2-Pair creation in constructor

The UniswapV2Router02 address you're using is not available for the Sepolia testnet. Instead, the corresponding address for the Sepolia testnet is 0xC532a74256D3Db42D0Bf7a0400fEFDbad7694008. ...
SYED ASAD KAZMI's user avatar
0 votes

How do I get Wagmi useWaitForTransaction to wait for Metamask (running on Hardhat)?

Try to increase the confirmation blocks, I don't figure out yet how to sync them with the metamask ones, but go around 3 blocks. const { data: approveTx, isError, isLoading } = useWaitForTransaction({ ...
Jonathz's user avatar
0 votes

Unable to verify contracts on polygon Amoy testnet

You'd need to implementation with a combination of these two resources: https://hardhat.org/hardhat-runner/plugins/nomicfoundation-hardhat-verify#adding-support-for-other-networks https://www.oklink....
Roberto's user avatar
  • 63
0 votes

Hardhat Tasks - How to import an account with a private key as signer

Update your hardhat.config.js module.exports = { ... networks: { sepolia: { url: "https://sepolia.infura.io/v3/<key>", accounts: [private_key, private_key,...] // ...
0xcuonghx's user avatar
  • 166
0 votes

Contract deployed to address: undefined. How do I find the contract address after deployment?

Maybe you are using ethers V6, in that case you need to change .address to .target to make it work: genTest1.address becomes: genTest1.target
jcckk1's user avatar
  • 1
0 votes
Accepted

uniswapRouter.getAmountsOut returns less value of token B than present in reverses when provide full amounts of token A

That's just how math works. Let's call the reserves values x and y. In your example x = 36851089197799104779745113323n y = 281312509765248795074n Before and after the swap, the value of their product ...
0xSanson's user avatar
  • 3,154
0 votes

uniswapRouter.getAmountsOut returns less value of token B than present in reverses when provide full amounts of token A

It seems like there might be a misunderstanding of how the getAmountsOut() function works in Uniswap. Let's break down the code and clarify the behavior: getReserves() -> retrieves the current ...
SYED ASAD KAZMI's user avatar

Top 50 recent answers are included