Skip to main content
Share Your Experience: Take the 2024 Developer Survey

New answers tagged

2 votes
Accepted

Slither: .. uses dangerous strict equality

That makes me wonder, is it possible to have this contract receive currency while this triggerReturnAll() function is being executed? I assume it is not possible, as I would expect the incoming ...
Ismael's user avatar
  • 30.6k
0 votes

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

It should be accessed using the ethers library of hardhat runtime environment (hre) like: const hre = require("hardhat"); async function main() { const signer = await hre.ethers....
SYED ASAD KAZMI's user avatar
0 votes
Accepted

Contract verify

Probably your contract is greater than the maximum size, which is around 24 kb — 25 kb. You can run forge build --sizes To verify the sizes If that's the case, head over to this article. Or try to ...
Ryan Holanda's user avatar
1 vote

Can I Recover a Smart Contract Written On Remix

To bring back a previously deployed instance is only possible if you have deployed on a testnet or mainnet or if the localnet that you were using at that time is still the same and was not cleared.If ...
Torof's user avatar
  • 783
0 votes

Issue with msg.sender. Calling contract B from contract A

It is as you said. The msg.sender is the caller of a transaction (/function call). If a contract B is the caller of a function in an other contract A then this contract B will of course be the msg....
Torof's user avatar
  • 783
-1 votes

Can I Recover a Smart Contract Written On Remix

If your contract is verified and published on the testnet/mainnet explorer, you can get the code from there. But if you accidentally delete the code, you can't recover it. It's best to code in VS Code ...
Awais Ahmad'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

print out your "address" type variables that you are passing to contract calls, as stated either it's malformed or undefined.
Piyush Chittara's user avatar
1 vote
Accepted

Want to redirect to react component based on metamask address

Instead of defining and calling your redirectBasedOnAccount function inside useEffect. You need to define it outside its scope, and call the same inside the return of your App.jsx. Also, you need to ...
SYED ASAD KAZMI's user avatar
1 vote

"message":"execution reverted: arithmetic underflow or overflow"

With only this piece of code and without more details it's hard to say. What function did you call? with what arguments ? An overflow or underflow happens when a calculation result is either less or ...
Torof's user avatar
  • 783
0 votes

What exactly is a proxy contract and why is there a security vulnerability involved in it?

Proxy, ERC1967Proxy, Transparent and UUPS in-depth explanation PS: This is more like a detailed explanation of https://docs.openzeppelin.com/contracts/5.x/api/proxy with multiple examples and ...
pv0's user avatar
  • 21
1 vote

I can't deploy my Token because of EVM version (?)

For compiler version 0.5.16, any EVM version from berlin and below should work. Make sure to check and align with the compiler versions used by the imported contracts and libraries.
SYED ASAD KAZMI's user avatar
0 votes

How to use `MCOPY`?

If you don't need the original path after modifying it, then the most efficient solution is to overwrite it. Like this: function convert() public pure returns (bytes memory)...
0xSanson's user avatar
  • 3,249
0 votes

What does add(source, 32) do in solidity?

With an example: function myfunc(bytes[] calldata data) public view { bytes memory _data = data[0]; bytes32 dat1; bytes32 dat2; assembly { dat1 := mload(...
pv0's user avatar
  • 21
0 votes
Accepted

Error while calling "requestRandomWords" function while implementing Chainlink VRF mock contract on local Remix environment

You might be deploying the VRFCoordinatorV2Mock and RandomNumberConsumerV2 on different instances of Remix IDE (i.e., on different tabs). So, they're not having the context of each other due to the ...
SYED ASAD KAZMI's user avatar
0 votes
Accepted

Foundry error on CLI command

Make sure that you've assigned the private key to the PRIVATE_KEY environment variable, because the error is suggesting that you've assigned the wallet address instead of private key. You can follow ...
SYED ASAD KAZMI's user avatar
1 vote
Accepted

Why is my _transfer function transfering all my tokens to the deadWallet?

You have to be careful with the message.sender: message.sender is the entity that makes the last function call. For example if you call a function A (of a contract C) that internally calls a ...
Torof's user avatar
  • 783
0 votes

Unknown Selector Error (0x98296c54) in BIGTTokenTest.t.sol

Run foundryup command to update your foundry
Milos Djurica's user avatar
0 votes

invalid opcode: opcode 0x5f not defined

I was faced with this issue, because ERC721URIStorage.sol from openzeppelin requires solidity 0.8.20+, but truffle build don't work with 0.8.20 by default. So you need set evmVersion as @SKYBITDEV3 ...
Albert Aleksieiev's user avatar
0 votes

Error value out of bounds for callbackgasLimit

Scott's answer is correct - it worked for me as well - kudos to him! However, you don't have to use uint256. You use uint64 and it will still work. uint64 private immutable i_callbackGasLimit; And you ...
Daniel Vichinyan's user avatar
0 votes

Need help to understand storage costs

The second version costs more because you have more storage variables defined and you also are updating them more times than in the first version of the contract.
Falcon Stakepool's user avatar
0 votes

Gas estimation errored with the following message (see below) - Solidity Study

I remove onlyOwner and the error continue. The code: //SPDX-License-Identifier: MIT pragma solidity ^0.8.8; import "./PriceConverter.sol"; contract FundMe{ using PriceConverter for ...
user2238658's user avatar
1 vote

Gas estimation errored with the following message (see below) - Solidity Study

Since, withdraw() function is having onlyOwner modifier attached to it, so it can only be called using the wallet using which you've deployed the contract, otherwise it would just revert with NotOwner(...
SYED ASAD KAZMI's user avatar
0 votes

I can't deploy my coin on Remix IDE

This error means that there are functions that are not implemented in your smart contract. In Solidity you can inherit an other smart Contract, meaning another smart contract is written with functions ...
Torof's user avatar
  • 783
0 votes

I can't deploy my coin on Remix IDE

I tried to deploy the contract at my side it's working fine. Just make sure to select the AkalinsToken - Abstract.sol contract before clicking on deploy button as in this picture: After setting that ...
Awais Ahmad's user avatar
2 votes

Get specific token TRADING HISTORY BSC

You should try Bitquery DexTradesByTokens API to get the trading history. Try this API, which gives you trading history for ETH-WBNB pair - https://ide.bitquery.io/Retrieve-price-data-from-PancakeSwap-...
Akshat Meena's user avatar
0 votes

Unit test error: "AccessManagedUnauthorized" when minting ERC-20 token in a DAO project

You may do the following to get it right: import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol"; Use this above import instead of Access Managed. In place of Ownable(...
harika w's user avatar
0 votes

An ERC1155 token metadata is not visible in polygonscan and etherscan

Any block explorer or OpenSea does not support this URI format: https://beige-top-pelican-586.mypinata.cloud/ipfs/QmQP6RzFRCqm8PeJoZSPgM8mohyAgrtuWdy2ZqyAcKUNtx/{id}.json So, you need to override the ...
SYED ASAD KAZMI's user avatar
0 votes

How do you implement diamond proxy fallback function?

Apparently there is a default storage slot but not sure why that fallback section is not utilizing it: function diamondStorage() internal pure returns (DiamondStorage storage ds) { bytes32 ...
anonauditor's user avatar
0 votes

JsonRpcProvider not Found in ethers.js

Make sure your local Ethereum node (like Geth or Ganache) is running and listening on port 7545 as you are specifying the URL of your local Ethereum node in your program as "http://127.0.0.1:...
Harigovind M G 's user avatar
0 votes

JsonRpcProvider not Found in ethers.js

Since you’re using ethers.js v6 (6.12.1), you’ve to access it like: const provider = new ethers.JsonRpcProvider("http://127.0.0.1:7545"); P.S., The way you’re currently doing is applicable ...
SYED ASAD KAZMI's user avatar
1 vote
Accepted

What happens to opcodes during fork tests in foundry?

No, the opcodes and the associated gas are determined by the evm_version set in the foundry profile, regardless of the forked state.
smol-ninja's user avatar
0 votes

Error in Fork Testing

Make sure that you've defined the environment variable named as SEPOLIA_RPC_URL in your .env file. Then, run this command to load environment variables from .env file into the current shell session: ...
SYED ASAD KAZMI's user avatar
0 votes

Contract verify

can you please send the code snippet , I also faced the same issue; in my case, i had used more than 10 parameters when this error occured. AfterI removed/optimised it , it worked for me. Can you ...
AIT DEV's user avatar
  • 15
6 votes

How to use anvil accounts in the Foundry Test

When you run the anvil command, you can use the exact same mnemonic (secret phrase) to generate the keys & addresses. anvil -m 'test test test test test test test test test test test junk' When ...
Patrick Collins's user avatar
1 vote

How to use anvil accounts in the Foundry Test

When you run the anvil command you get some mock accounts with a constant set of addresses and private keys, you can use that directly from your forge tests. You could create a helper contract / just ...
Josep Bové's user avatar
1 vote
Accepted

Can't get the stored data from blockchain

The ABI that you're using, is having an address input field in the corresponding getUser() function: { "inputs": [ { "internalType": "address", ...
SYED ASAD KAZMI's user avatar
0 votes
Accepted

Best Practices for Gas Optimization in Ethereum Smart Contracts

This has indeed been answered in depth before as @Zartaj said it. Gas optimisation is a very wide subject, with hundreds of ways to do so! Knowing the opcodes and the EVM will generally lead to have ...
Torof's user avatar
  • 783
0 votes

Is there Uniswap V2/V3 function to get initial token supply amount in pool?

Because the data is public, everything is possible. Is there a function? No. You can create a custom per-transaction indexer that walks through all transactions within a block and maintains a state ...
Mikko Ohtamaa's user avatar
1 vote

Safe Wallet: "Solidity Compiler Bugs"

These warnings are relative to the Solidity compiler used in Safe contracts, and does not imply any critical vulnerabilities in the code. You should be able to use your Safe in all security :) Best, ...
Louis - Safe Core Team's user avatar
0 votes

Testnet USDC from https://staging.aave.com/faucet/ not showing on Metamask

You need to add the token you want to display and transfer to Metamask. https://support.metamask.io/managing-my-tokens/custom-tokens/how-to-display-tokens-in-metamask/#how-to-add-a-custom-token
Torof's user avatar
  • 783
0 votes

How to enable multi-payment in the NFT marketplace like ETH, USDT, MATIC, DAI, etc?

When you mean any payments, do you mean only other ERC20,or also other cryptocurrencies, or even other Layers of blockchain (L2, L3) ? The three have 3 different answers. If you mean other ERC20, ...
Torof's user avatar
  • 783
0 votes

Check if a function selector exists in a contract

To my knowledge no. If you want to check for a view function it may be possible to use staticcall(abi.encodeWithSelector(selector)) statticcall() ensures that an external function calls will not write ...
Torof's user avatar
  • 783
1 vote

How to use `MCOPY`?

One way to achieve this is by categorising the input and output in the form of the respective prefix and suffix. Input prefix: address that you're replacing (i.e., ...
SYED ASAD KAZMI's user avatar
0 votes
Accepted

Abi Encode with Signature - String memory as parameter to function

You don’t need to add memory keyword. Also, you’ve to remove any spaces. So, it should be: abi.encodeWithSignature( "mint(address,string)", receiverAddress, ...
SYED ASAD KAZMI's user avatar
0 votes

Renouncing a contract that contains a chainlink upkeep

The idea is great, however i'd keep a level of action even restricted. What if in the future one address, a service or else just stops working ? Then you cannot do anything about it. But if you have ...
Torof's user avatar
  • 783
0 votes
Accepted

"message": "Error: Transaction reverted: function returned an unexpected amount of data", ""message": "Error: Transaction reverted: funct

i found a solution to my problem. i was testing with the usdt token in my smart contract and was getting this error as per suggetions from the above responses the error was definitely related to the ...
Anwar's user avatar
  • 51
0 votes

How to add a NFT to metamask wallet with a RPC method

A bit late, but watch asset now supports both ERC721 (NFTs) and ERC1155. Here's the link: https://docs.metamask.io/wallet/reference/wallet_watchasset/ In params, just specify the type and tokenId: { ...
Aleksa Milosevic's user avatar
2 votes

Renouncing a contract that contains a chainlink upkeep

You can use Forwarder to authorise the function to be called only by the Chainlink Automation/Upkeep.
SYED ASAD KAZMI's user avatar
0 votes

Foundry: script failed: cannot `prank` for a broadcasted transaction; pass the desired `tx.origin` into the `broadcast` cheatcode call

It's happening because the prank is getting started within the broadcasting of a transaction. Since, the transaction is already being broadcasted, so it's unable to override the sender while attemping ...
SYED ASAD KAZMI's user avatar
0 votes
Accepted

Facing the "factory runner does not support sending transactions" error while executing deploy script of Hardhat

In your hardhat.config.js file, inside the sepolia object of networks, it should be accounts instead of account , like: sepolia: { url: process.env.SEPOLIA_RPC_URL, accounts: [process.env....
SYED ASAD KAZMI's user avatar

Top 50 recent answers are included