New answers tagged

0 votes

Unit testing a Solidity Library function with a struct memory argument

What about a simple approach? // SPDX-License-Identifier: MIT pragma solidity 0.8.17; import "hardhat/console.sol"; library BrickLib { struct ECSignature { uint8 v; } ...
Rob Hitchens's user avatar
  • 54.3k
1 vote

web3.js how to call receive() external payable?

The receive() function does not exist but the fallback function exists, it will be triggered when a contract is sent Ether without any data. To interact with this receive() function in web3.js, you ...
Saxtheowl's user avatar
  • 638
1 vote
Accepted

adding BigNumbers with ethers

On ethers V5 the output is usually a object with two fields, isBignumber (boolean) and _hex field with a string representing the hexadecimal value of that number. So you need to pass inside Number(...
Rodrigo Burgos's user avatar
0 votes

Does using a very high gas limit somehow get your transactions executed slower?

Common advice would be to choose a comfortable gas limit to ensure your transaction doesn't revert, but don't overdo it. It is rare that you will have a transaction that consumes gas for a whole ...
eth's user avatar
  • 83.3k
0 votes

How get network ID with ethers.js?

This is a solution for ^6.3.0 version of ethers.js: let userProvider = new ethers.BrowserProvider(provider); let objectNetwork = await userProvider.getNetwork(); // returns a bigint let chainId = ...
Fernando López's user avatar
-1 votes

Why web3 and not just call JSON RPC API

Wow, I feel much smarter and way dumber after reading the content and then scrolling back up to the time stamp. Looks like Im about 4 years late to the game but all good! Ya'll take care, be well and ...
21JoeKellyFightClub's user avatar
1 vote
Accepted

How to read all Transfers on blockchain

Hope I understood correctly the question. You will see something like this as result for e in events. I leave comments in this code to explain each part. AttributeDict({'address': '...
valentinmk's user avatar
0 votes

Web3py - Getting pending TX's?

The filter method you are trying to use there is actually to filter for event logs; that's why is returning already validated information. You can learn more about event filters here. To get ...
David Chainstack Dev Advocate's user avatar
0 votes

How would I be able to set slippage for exactInputSingle on Uniswap v3 and Pancakeswap v3?

I somehow found a way to do this by using the sqrtPriceX96 in the token's pool address by querying slot0. The documentation for this is gone but I've searched and saw other people using this formula: ...
Austin's user avatar
  • 123
0 votes

Contract.methods.transfer is a not a function error using web3

Why are we still dealing with answers to a problem that is still occuring but the answer is four years and four months old. Unfortunately the error is still occuring so there is a flaw some where. ...
Stephen's user avatar
1 vote

web3 python - AttributeError: 'Eth' object has no attribute 'abi'

You can use a call to Web3.keccak instead. The error shows up because the relavant Python modules do not have any function named encodeEventSignature. This is a npm module (JavaScript) function. ...
kfx's user avatar
  • 977
0 votes

Ethernaut Level 24 - Puzzle Wallet

Or you can setup like this by downloading the UpgradeableProxy-08.sol contract from OpenZeppelin github repo. // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; pragma experimental ABIEncoderV2; ...
Saikat Karmakar's user avatar
2 votes
Accepted

How to know token transfered in pending status from memepool

You need to decode input params. You can do this if you know ABI of the smart-contract address. In your case it is not hard. Smart contract address: 0xEf1c6E67703c7BD7107eed8303Fbe6EC2554BF6B ABI (go ...
valentinmk's user avatar
0 votes

Error: network does not support ENS (operation=“ENS”, network=“maticmum”, code=UNSUPPORTED_OPERATION, version=providers/5.5.3 Network doesnot support

The error message you encountered suggests that the address you provided is invalid. This could happen if there are unintended characters such as spaces or numbers included in the address. In your ...
DevCrypto's user avatar
0 votes

Buy token just after the pair deployment?

If the deployment transaction is in the public mempool, you can analyse the to and data parameters to check what it's about, or even simulate the transaction and check the events it generates. So, ...
0xSanson's user avatar
  • 2,265
1 vote

How do I deposit and restore my Ethereum to my wallet?

You need to import your account into MetaMask. Read this guide on how to.
Gabriel Stoica's user avatar
0 votes

How can I remove custom spending cap on Metamask?

Simple answer, you cannot for good reason. Find your answer here. We designed this interface to give you more control and visibility over your token allowances, since you'll be prompted to always ...
norym's user avatar
  • 141
1 vote

Solidity's keccak256 hash doesn't match WEB3 keccak hash

I found a way in Python to do this in case you are still looking for the answer. Here is the code below. Here is how you can do this in Python. I'm using the web3.keccak method of brownie which is ...
Saikat Karmakar's user avatar
0 votes

Can't catch all the events using ethers

When I have needed to listen to events in the past, I don’t need to instantiate the contract each time like this. To be clear, im not sure why the method you’re using doesn’t work consistently - ...
immaxkent's user avatar
  • 440
0 votes

What exactly does the 'ethereum' keyword in 'window.ethereum' referring to?

You can think of window.ethereum as an object that let you communicate with a browser extension(in most cases Metamask). Actually, it literally is an object. The browser extension(let's say Metamask) ...
hyunchel's user avatar
1 vote

How does one create and send TXs on L2 - Arbitrum and others?

The algorithm should be the same because every L2 Ethereum chain works with the EVM (Ethereum VIrtual Machine). It is the algorithm every L2 ethereum chain uses
ShadowOfSights's user avatar
1 vote
Accepted

ethers js listening to events doesn't work

Use a targeted listener like 'Transfer', 'Approval', etc. Also, use a different RPC; Chainstack offers free elastic BSC RPCs that worked perfectly for me here. After changing these two things, this ...
TABASCOweb3's user avatar
0 votes

types/value length mismatch (argument="tuple", value='myAddress'

The issue seems to be related to passing the argument to the giveRightToVote function. The error message suggests that the value being passed as an argument is of the wrong type or length, and that it ...
thisisujjawal's user avatar
0 votes

Default account is not reflected in Web3 instance created from injected current provider

you can use the following code to get an instance of web3. import Web3 from "web3"; const getWeb3 = async () => { let web3Instance; let accounts; if (window.ethereum) { ...
Ishmam Tasin's user avatar
1 vote

Is it possibleimpersonate an account using only ethers.js without using Hardhat

here is the solution to impersonate account when we forked the mainnet using foundry. then we can use ether js to transfer eth from any whale account. why is it important because we always have ...
DEEPAK Kumar's user avatar
0 votes

Unhandled Exception: Connection refused - Truffle Ganache Connection with Flutter

Add final String _rpcUrl = Platform.isAndroid ? 'http://10.0.2.2:7545' : 'http://127.0.0.1:7545'; final String _wsUrl = Platform.isAndroid ? 'http://10.0.2.2:7545' : 'ws://127.0.0.1:...
Shaikh Faizan's user avatar
0 votes

How to detect if the user cancels a transaction in Metamask?

This migbt be the solution you looked for(Tested with Metamask and Ether.js): .... }else if(err.code.toString()==='ACTION_REJECTED'){ //Ignore User rejected } .... I Know alittle bit dirty, ...
Stefan P's user avatar

Top 50 recent answers are included