6,610 questions
0
votes
0
answers
34
views
Why am I getting a decode error when calling a function in my Hardhat smart contract?
I’m building a simple Voting DApp using Solidity and Hardhat.
The contract deploys successfully, and I can start and end voting without issues.
However, when I try to call the getWinner() function ...
0
votes
1
answer
70
views
Why can't Hardhat test my typescript test file?
I am new to programming and Web3. I am building an NFT Staking project using TypeScript and Solidity.
I already created my contract and wrote both Solidity and TypeScript tests. However, when I run:
...
1
vote
1
answer
37
views
Why does my ERC20 contract revert when calling transferFrom?
I'm writing an ERC20-based contract in Solidity 0.8.21.
When I call transferFrom, the transaction reverts even though the allowance and balance are sufficient.
Here’s a simplified example:
function ...
0
votes
1
answer
45
views
Chainlink function callback failing but computation is passing
Im working on a smart contract in solidity and im having issues with Chainlink function execution.
I have this source code for the function:
string private functionCode = "return Functions....
0
votes
0
answers
48
views
Forge test fails with --match-test(Fork mainnet) but passes with forge test(anvil)
I’m running into an issue with my Foundry tests and can’t figure out what’s going wrong.
When I run on a local Anvil fork, everything passes just fine. But when I switch to a mainnet fork, I keep ...
0
votes
0
answers
28
views
Forge build Compilation Error. Contract not compiling despite correct remappings. Returning 'Access is denied. (os error 5).'
I have been getting this error whenever I try to run 'forge build.' I don't think there is anything wrong with my remappings because this is exactly how it is in Patrick's course.
I also keep getting '...
0
votes
1
answer
83
views
How to correctly ABI-decode multicall results (ERC-20 decimals + symbol) in tests?
I’m trying to understand ABI decoding of multicall RPC calls so I can create stubbed tests using WireMock for my Rust EVM application.
The multicall function signature is:
function aggregate(Call[] ...
0
votes
1
answer
63
views
Contract deployed successfully on Hedera Testnet, but has no code. Script works for anvil
I have the following deploment script:
require('dotenv').config();
const { ethers } = require("ethers");
const fs = require("fs");
const path = require("path");
const ...
2
votes
1
answer
75
views
How to find proper address to use AggregatorV3Interface?
I am using hardhat and metamask on a local blockchain and I have imported AggregatorV3Interface and am trying to get the latest price of USDT in my contract to exchange Ethereuem to USDT.
Here is the ...
-3
votes
2
answers
127
views
How do I send Ethereum from a MetaMask wallet to a smart contract?
I've connected my MetaMask to a local blockchain and got the 10k fake Ethereum in my wallet. I want to use this to buy some tokens from a self defined contract. I assume the procedure is:
Send ...
0
votes
1
answer
82
views
How to transfer tokens from one contract to another contract
I have two contracts, A and B. Contract A defines my token. I want to transfer some of these tokens to Contract B.
If I understood correctly:
First, contract A should have some tokens to be able to ...
2
votes
1
answer
119
views
Uniswap swapping tokens issue
I am trying to swap two tokens A and B for which I have created the pool on the Uniswap testnet Sepolia. But in Remix, when I try to execute the swap, it gives an error.
Everything else is working ...
0
votes
1
answer
34
views
"Token Purchase Failing with 'Insufficient Reserve' Error in Solidity Smart Contract"
I’ve deployed two contracts for a token sale system on BSC Testnet:
TestUSDT: https://testnet.bscscan.com/address/0xD93221735d2323a7ddca9e82d0EF44040C570848#readContract (Mock USDT)
APTToken: https://...
1
vote
0
answers
126
views
Base Sepolia API key invalid
Using an API key from Etherscan to verify a contract on sepolia Base , i always receive the message that my API key is invalid. I have already checked the status on etherscan and API key is up and ...
-1
votes
1
answer
87
views
How to call name and Symbol of an XRC-20 (ERC-20) token on XDC/Ethereum?
I'm trying to interact with a deployed XRC-20 token contract on the XDC Network (EVM-compatible) using Rust and the alloy crate.
I have already deployed my token using MetaMask and Remix IDE, and I ...
1
vote
0
answers
30
views
Experiencing error when Testing Raffle smart Contract
I'm working on testing a Chainlink VRF-based Raffle contract using Foundry, but I’m encountering a EvmError: Revert when running the test that checks whether the raffle correctly blocks entries while ...
1
vote
1
answer
66
views
Failed: gas limit set too low" after increasing gas limits multiple times and even setting gas limit to 1300000 in my vrf contract
Hello here i have issues in my project where VRF is suppose to call the chainlink functions, but i keep getting the error " Failed: gas limit set too low" after increasing gas limits ...
1
vote
0
answers
62
views
Why does my Hardhat test fail with Transaction reverted after using evm_increaseTime?
I’m testing a Solidity smart contract for a project. A user buys a short-term policy that expires in 5 seconds. After advancing blockchain time by 10 seconds, I try to call claim(), but the ...
0
votes
0
answers
70
views
Gnosis Safe - Enable module during safe creation
Here is my contracts:
// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity ^0.8.20;
import "hardhat/console.sol";
// import console.log;
interface ISafe {
...
0
votes
2
answers
74
views
Contract Deployment Size Limit [closed]
I have a question regarding contract size limits on Ethereum. Suppose I have a smart contract whose size has increased by 24,945 bytes — does that mean it can no longer be deployed on the Ethereum ...
0
votes
0
answers
122
views
I'm getting "502 Bad Gateway" and "Subgraph not found" errors when deploying to The Graph Studio
I'm trying to deploy my subgraph to The Graph Studio using the following command:
graph deploy my-subgraph-name
I tried many time but still I'm getting this message:
Failed to deploy to Graph node ...
1
vote
0
answers
47
views
Hardhat ethers.getContract("VRFCoordinatorV2Mock") returns undefined even though contract is compiled and deployed
I'm working on a Lottery Project (Raffle) in solidity using hardhat. For now it has two contracts as :
Raffle.sol
VRFCoordinatorV2Mock.sol
I created deployment scripts as :
00-deploy-raffle.js
01-...
0
votes
0
answers
44
views
Counter and Number are returning undefined in React with wagmi in Next.js from Smart contract Web3
I’m working on a Next.js application and using Wagmi to interact with a smart contract. The issue I'm facing is that when I call the getDoubledNumber() and number() functions from the frontend using ...
-2
votes
1
answer
78
views
Are public and private variables different?
In Solidity, public state variables automatically generate getter functions, while private variables do not. However, both are stored on-chain, meaning private variables can still be extracted. Does ...
0
votes
0
answers
37
views
AbiError: Parameter decoding error: Returned values aren't valid, did it run Out of Gas?
I'm trying to test my smart contract using ganache provider and mocha but seeing this error.
AbiError: Parameter decoding error: Returned values aren't valid, did it run Out of Gas? You might also see ...
0
votes
0
answers
17
views
Hardhat Deploy Script Error: "Cannot Read 'wait' Property of Undefined" During Contract Deployment
I'm working on deploying two contracts using Hardhat on the Sepolia test network: PhilosophyNFT (an ERC721 token contract) and PhilosophyMarketplace (a marketplace contract). The deployment of the ...
0
votes
0
answers
81
views
Is it secure to store only the aggregated BLS public key in a smart contract for signature verification?
I have a question regarding BLS signatures and aggregate signature verification in smart contracts.
Let’s say I have 3 honest signers, each with their own private key. They all sign the same message, ...
0
votes
0
answers
64
views
Error: cannot estimate gas; transaction may fail or may require manual gas limit [See: https://links.ethers.org/v5-errors-UNPREDICTABLE_GAS_LIMIT]
I have written test cases for the Bridge smart contract, which uses LayerZero for cross-chain communication. However, when I set up the Hardhat project and attempted to run the test cases, I ...
0
votes
0
answers
109
views
MetaMask Returns ‘-32603 Internal JSON-RPC error’ with No Revert Reason on Polygon Testnet
I’m building a DApp on the Polygon testnet (the new Amoy network) using MetaMask, ethers.js, and a Solidity smart contract. Whenever I try to call my startMaintenance() function (or several others) ...
0
votes
1
answer
60
views
Chainlink VRF: Created Subscription ID Mismatch Between On-Chain and Dashboard
I'm encountering an issue where the subscription ID returned by my script is different from the one shown on vrf.chain.link for the Sepolia network, which when i try to fund to the subid from my ...
0
votes
0
answers
43
views
Can I implement a tax deduction feature in an ERC20 contract where the tax is deducted in BNB or ETH when a user swaps tokens on PancakeSwap?
The _transfer() function only handles ERC20 token transfers, so I can't implement any logic for ETH or BNB within it.
I integrated some functions, but they were not callable on PancakeSwap. When I ...
1
vote
0
answers
17
views
Error in adding a struct containing a mapping in an array in solidity
I am new to Solidity and am trying to add a struct containing a mapping to an array. However, this fails. When I run this on Remix I get a message transact to CampaignFactory.createCampaign pending ......
1
vote
0
answers
52
views
Uniswap V3: Unable to Add Liquidity After Deploying ERC20 Token with Tax Mechanism
I am trying to add liquidity to Uniswap V3 for my ERC20 token, which has a 4% tax deduction on transfers. The tax mechanism ensures that whenever users transfer tokens, 4% is sent to the owner's ...
0
votes
1
answer
35
views
Hardhat error: Cannot find module '@nomicfoundation/hardhat-etherscan'
Error with Hardhat Clean: Cannot find module '@nomicfoundation/hardhat-etherscan'
I'm encountering an error when trying to clean my Hardhat project workspace:
npx hardhat clean
An unexpected error ...
0
votes
1
answer
72
views
I am unable to swap the token after adding liquidity to Uniswap V2
I have deployed an ERC20 contract on the Sepolia chain and added liquidity on Uniswap V2. However, when I tried to swap the token with ETH, the token price was not being calculated, and I was unable ...
0
votes
1
answer
66
views
How to forge test an Array in SOLIDITY?
i wrote this code but i am confuse how to make a test script for it. because how do i input an array into the parameter? when i try to run the test script it says undeclared identifier names, uris, ...
0
votes
0
answers
28
views
The Zokrates CDN is not loading
I was working in a project and ussing zokrates cdn inside my webview. It was working right . But when I started the project I am getting error zokrates is not defined .
Below is a simple Html code ...
0
votes
0
answers
18
views
Solidity Contract Call Reverting with No Reason via Web3.py – How Can I Diagnose This?
I’m developing a blockchain-based forensic evidence system using Solidity (deployed via Hardhat/Ganache), a Python Flask backend, and Web3.py. My smart contract is designed to store evidence details (...
0
votes
1
answer
48
views
Pitfalls in small smart contract
Here is a question from a coding interview. I am just wondering what would be the major pitfall in this small smart contract in your opinion:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
...
0
votes
1
answer
171
views
Chainlink VRF Subscription ID Issue with Foundry Deployment on Sepolia [closed]
I'm deploying a smart contract on the Ethereum Sepolia testnet that integrates Chainlink VRF v2.5 using Foundry. However, I encountered an issue where Foundry provided an invalid Subscription ID that ...
0
votes
0
answers
191
views
PancakeSwap universal router usage. Web3, PancakeSwap, Bsc testnet
I'm working on an integration with PancakeSwap using Java and Web3J. All my tests were conducted on BSC Testnet.
After conducting some research, I used the UI to perform a transaction that went ...
0
votes
0
answers
25
views
Optimize Gaz passing a large UINT8Array as a parameter
I have a very simple smart contract that stores data.
The data has already been binary encoded in Javascript,
const data: UInt8Array = await compress(customBinaryEncoder(userData));
With an array size ...
-2
votes
2
answers
60
views
Why it is taking high cause fee
https://bscscan.com/address/0x1732b451aa189832109e8715b9ae0563bab7c2bc#writeContract
I have deployed this contract on BSC, can someone guide why it is taking some much gas fee.
If you have any ...
0
votes
0
answers
37
views
I am currently working on a project and encountered a persistent issue with deploying smart contracts on the Hardhat local blockchain
Issue Summary:
Problem:
When deploying two smart contracts (DonorRegistration.sol and DonationRecords.sol), they were both getting the same address on the Hardhat network, which should not happen.
...
1
vote
0
answers
38
views
How to Deploy a Smart Contract and Have Someone Else Sign the Transaction? Polygon
I'm trying to deploy a Smart Contract on the Polygon mainnet, but I need the deployment transaction to be signed by someone else's wallet (so they become the contract owner and receive the tokens).
I’...
0
votes
1
answer
101
views
Problem with transfering ERC-721 token in an external contract
I’m building an NFT-based game where two users receive random numbers via Chainlink VRF. The user with the higher number wins and receives the opponent’s NFT from another contract.
The contract ...
0
votes
1
answer
32
views
why when i use "token URIs" error, error says "do you mean token URI or _tokenURI"
guys can you help me? there is an error when I declare "_tokenURIs", the error is something like this:
"Undeclared identifier. Did you mean "_tokenURI" or "tokenURI"?...
0
votes
0
answers
35
views
Failed to deploy contract to amoy test chain in VS code
When I enter this command to deploy:
truffle migrate --network amoy
I get this error:
This version of µWS is not compatible with your Node.js build:
Error: The specified module could not be found.
\?...
0
votes
0
answers
58
views
Adding Ignition module in HardhatUserConfig
I'm creating my first project for etherum tokens. This project was initialized with Typescript+Viem+Hardhat.
After creating some contracts, I wrote an Ignition module. Then, I was about writing the ...
-1
votes
1
answer
233
views
Why are the NFT images not visible?
I created a ERC721 type smart contract to mint 8 NFT's to the Polygon blockchain. The NFT images are stored on my own server (for this project I don't use IPFS). I also created the corresponding json ...