6,612 questions
0
votes
1
answer
36
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
23
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
40
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
46
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
25
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
74
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
57
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
70
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
110
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
78
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
105
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
31
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
109
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
81
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
29
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 ...