6,605 questions
1 vote
0 answers
41 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
78 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
42 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
50 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
54 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
33 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
87 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
76 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
137 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
83 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
122 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
40 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
130 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
90 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 ...