New answers tagged

0 votes

When I try to deploy my smart contract with ganache and try yo conect to the virtual blockchain, this message pop up in the terminal of visual studio

I've never seen anyone use the IP address 0.0.0.0. Probably you meant to use localhost 127.0.0.1. Also check that the port is the correct one. Unless you changed it, the default should be 8545. Lastly,...
0xSanson's user avatar
  • 3,129
0 votes

What is the difference (in terms of calculation) between tokens pricing while swapping vs while adding liquidity in Uniswap V3?

Replace sqrtRatioX96 with this: const sqrtPriceX96 = JSBI.BigInt(slot0.sqrtPriceX96); Explanation: your code is correct except in one minor detail: it computes the price ratio (sqrtRatioX96) from the ...
kfx's user avatar
  • 1,516
0 votes

A public variable when called returns an object instead of an address in solidity

While you're generating the ABI using solc in Javascript and then logging it, it's wrapping up all the Object types when using console.log(). In order to ensure unlimited recursion while logging the ...
SYED ASAD KAZMI's user avatar
0 votes
Accepted

A public variable when called returns an object instead of an address in solidity

There is no problem with your solidity code. I think problem from your js code. Please try this abi, it's from remix when you compile your code [ { "inputs": [], "...
0xcuonghx's user avatar
  • 166
0 votes

A public variable when called returns an object instead of an address in solidity

In constructor, you did set the manager as the deployer. Hence will return the deployer address. constructor () { manager = msg.sender; //deployer }
anonauditor's user avatar
0 votes

A public variable when called returns an object instead of an address in solidity

I changed the ABI from { inputs: [], name: 'manager', outputs: [ [Object] ], stateMutability: 'view', type: 'function' } to { inputs: [], name: "manager", ...
DarkL's user avatar
  • 3
0 votes

key representation and format, conversion to string, JS

You can use the ethereumjs-util library of Javascript, and import the same in your JS code: const ethUtil = require('ethereumjs-util'); If you just want to halve the private key (or any key in hex ...
SYED ASAD KAZMI's user avatar
0 votes

Layer2: Revert Execution Error when Calling exactInputSingle in Uniswap V3

I have never used the sdk, but here is a direct example of using Uniswap Universal Router, encoding the calldata manually: We can look at the commands contract, to get the list of steps we want to ...
Maka's user avatar
  • 860
1 vote

Viem wallet client method does not exist / is not available

check your ts version in my case I used [email protected] and when I checked its peer deps it showed [email protected] so updating ts version solved it.
Mohammed Mamoun's user avatar
1 vote
Accepted

Capture emitted event with web3 v4.7.0

In your event listener, you've to specify fromBlock and toBlock values. As, you've only specified the fromBlock as latest without any info regarding the toBlock, therefore it's not capturing anything. ...
SYED ASAD KAZMI's user avatar
0 votes

web3.js methods call producing error Web3 validator found 1 error[s]: value "0" at "/1" must pass "address" validation

I suspect this might be an issue in the web3.js library, potentially related to overloaded functions. I just commented out the following piece of code in the _createContractMethod function, and the ...
bender's user avatar
  • 1
0 votes

contract.events

I will close this question since I used an old example using v 1.3.0, not knowing that there is a current version 4.7.0.
pigfox's user avatar
  • 51
1 vote

contract.events

Your log output seems to be correct. You might need to parse or decode it, like: const parsedLog = contractInterface.parseLog(log) To get the details regarding a particular event being triggered ...
SYED ASAD KAZMI's user avatar
1 vote

TypeError: Cannot read properties of undefined (reading 'JsonRpcProvider')

With ethers@v5 const provider = new ethers.providers.JsonRpcProvider(RPC_URL); With ethers@v6 const provider = new ethers.JsonRpcProvider(RPC_URL);
0xcuonghx's user avatar
  • 166
1 vote
Accepted

Fetch special position in JSON FORMAT

You can format your JSON data from an array of objects to a nested object. You can achieve the same using Javascript, like this: const result = [ { asset: 'USDT', free: '35.00', locked: '0' }, ...
SYED ASAD KAZMI's user avatar
0 votes

TypeError: Cannot destructure property 'interface' of 'require(...)' as it is undefined

You should give solc.compile a JSON input as in the github documentation for solcjs v0.8.10. Also solc.version() will give you your version of solcjs in the node runtime to make sure.
Aimane Harrak's user avatar
0 votes
Accepted

The error message "TypeError: unsupported addressable value (argument="target", value=null, code=INVALID_ARGUMENT, version=6.11.1)" when run locally

You need to pass the signer instead of deployer in the getContractAt() function, because the transaction corresponding to the deposit() function needs to be signed. The signer can be created from the ...
SYED ASAD KAZMI's user avatar
1 vote

TypeError: Cannot read properties of undefined (reading 'JsonRpcProvider')

npm install [email protected] const provider = new thers.providers.JsonRpcProvider("http://127.0.0.1:7545" ); option 2. Have latest version and in use const { ethers, JsonRpcProvider } = require(...
Devloper's user avatar

Top 50 recent answers are included