Skip to main content

Questions tagged [foundry]

Questions about Foundry, the blazing fast smart contract toolchain

Filter by
Sorted by
Tagged with
0 votes
1 answer
31 views

How to increase gas limit for transactions in Foundry?

Is there a way to do it in the script file itself or through terminal command? Currently making transactions using the command: forge script script/Counter.s.sol:CounterScript --rpc-url $...
Surya M D G's user avatar
0 votes
1 answer
4 views

How to use Bulloak in Github CI workflow?

I am using Bulloak to write integration tests for my smart contracts using Foundry. The integration tests use BTT technique. Bulloak helps me to automatically create test contract based on the tree ...
smol-ninja's user avatar
0 votes
1 answer
18 views

Failure to decode JSON

I'm trying to decode the following ZK proof, that lives in a JSON file, into a Solidity struct, using the Foundry book guide for JSON, but I'm getting continuous either errors or the wrong values: ...
dNyrM's user avatar
  • 928
0 votes
0 answers
18 views

Deploy script to anvil node foundry

Is it possible to simulate a contract deployment, using a script, to an anvil node but by specifying the localhost in the script itself instead of a flag on the CLI command? Instead of this: forge ...
dNyrM's user avatar
  • 928
1 vote
1 answer
14 views

TransferFrom Reverted on Foundry Test

I'm trying to create a test for TradingPairExchange contract where the liquidity provider provide his liquidity tokens by using transferFrom and transfer the tokens to the contract. The next step ...
0xhaz's user avatar
  • 15
0 votes
1 answer
39 views

Foundry tests fail with `[NotActivated] EvmError: NotActivated` while fork test

The fork tests works perfectly well with Hardhat. But when I tried with Foundry using different evm_version in foundry.toml file and also tried compiling with different versions solc = "0.8.18&...
Pankaj Jagtap's user avatar
0 votes
0 answers
32 views

How to use Forge remappings when the complete backend is in its own folder

I am making a project in Solidity using Foundry for backend and Typescript for frontend. I decided to put the complete backend part in a backend folder and frontend part in frontend folder. The ...
Solblaze's user avatar
1 vote
1 answer
95 views

Mastering Foundry Basics

I'm interested in learning Foundry. What are the most effective resources and strategies you recommend for getting started with Foundry?
serpent0x's user avatar
0 votes
0 answers
14 views

Can you Fuzz test with random parameters in the setUp() function in Forge?

Context After looking at this documentation about fuzz testing, I tried to apply it to the setUp() function in my test. However, that throws an error. I would like to test that the random stuff that I ...
a.t.'s user avatar
  • 79
0 votes
0 answers
31 views

I have a problem with calling a function from another contract. I don't know why it is not working

I'm trying to solve a CTF challenge and can't seems to call the claim function from the vuln contract. I must use my "EOA" address to solve task to mark it solved, because my "EOA" ...
jose celis's user avatar
0 votes
0 answers
20 views

Mock unit tests

For a "professional" project that's created to look for funding, are mocks from unit tests recommended to be the old fashion way by creating each mock from scratch or is it ok with just ...
dNyrM's user avatar
  • 928
1 vote
1 answer
34 views

Foundry error on CLI command

forge create --rpc-url $QUICKNODE_RPC_URL --private-key $PRIVATE_KEY --etherscan-api-key $ETHERSCAN_API_KEY --verify src/Token.sol:Token [⠒] Compiling... No files changed, compilation skipped The ...
Flegi's user avatar
  • 13
1 vote
1 answer
30 views

Foundry: Member "getBlockTimestamp" not found

I'm trying to use a method from foundry which is located here in the documentation When I try to call it like so: uint256 timestamp = vm.getBlockTimestamp(); I'm getting an error: Member "...
RitzyDevUk's user avatar
0 votes
1 answer
103 views

How to verify a contract on foundry on Polygon Amoy chain

I tried to verify my contract that has been deployed on Polygon Amoy. But all it does is verifies another contract on polygon mainnet. Submitted contract for verification: Response: `OK` ...
eik's user avatar
  • 3
0 votes
1 answer
10 views

What happens to opcodes during fork tests in foundry?

When you fork a chain in foundry, does it also copy the chain opcodes and the associated gas?
smol-ninja's user avatar
0 votes
1 answer
30 views

Error in Fork Testing

I ran the test: forge test --fork-url $SEPOLIA_RPC_URL and this error was returned: error: a value is required for '--fork-url <URL>' but none was supplied. // SPDX-License-Identifier: MIT /...
Kwesili Okafor's user avatar
0 votes
1 answer
51 views

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

This is my Foundry Script: // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "forge-std/Script.sol"; import {SendaTokens} from "../SendaTokens.sol"; contract ...
Nasser el bacha's user avatar
0 votes
1 answer
26 views

Foundry Compile Error [duplicate]

Error: Compiler error (C:\Users\circleci\project\libsolidity\codegen\CompilerUtils.cpp:1459):Stack too deep. Try compiling with --via-ir (cli) or the equivalent viaIR: true (standard JSON) while ...
seojunchian's user avatar
1 vote
1 answer
29 views

How do forks in Foundry work?

What you fork a chain in foundry, what chain data does it copy? Does it copy OPCODEs and their gas as well?
smol-ninja's user avatar
0 votes
2 answers
32 views

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

I'm relatively new to Solidity and currently working on building a DAO using the OpenZeppelin contract wizard. I've generated ERC-20 token and governor contracts using the wizard to kickstart my ...
Hessamedean Aghajanlou's user avatar
0 votes
1 answer
32 views

Importing Script.sol in Foundry

Why doesn't this import need the full path? import {Script} from "forge-std/src/Script.sol"; Something like: import {Script} from "../lib/forge-std/src/Script.sol"; How does ...
Ougi's user avatar
  • 320
1 vote
1 answer
29 views

Storage ops / gas spent

Is it possible to know the amount of storage operations (or gas spent) that are between, let's say 4 functions, or a full contract? Is foundry capable of this? Thanks!
dNyrM's user avatar
  • 928
0 votes
1 answer
17 views

How to set custom header using foundry?

On etherjs you can send a custom header as follows. import { ethers } from "ethers"; const connection = { url: "https://custom.rpc.url.com", headers: [ "Authorization&...
Irshad's user avatar
  • 1
0 votes
0 answers
25 views

Ethernaut level 3 CoinFlip consecutiveWins keep resetting

I am currently running Foundry on VS code on the Sepolia test net and I am on level 3 of Ethernaut's CoinFlip challenge. I already have a working exploit and I am trying to deploy it 10 times. I am ...
0xLasadie's user avatar
1 vote
0 answers
38 views

Unable to update forge on windows

I am trying to run foundryup on windows to update foundry. Tried with git bash, it gives me this error : foundryup: installing foundry (version nightly, tag nightly) foundryup: downloading latest ...
RajaSolidity's user avatar
0 votes
1 answer
66 views

Foundry Solidity Error: panic: array out-of-bounds access (0x32) while testing a batch mint function

I'm writing foundry tests for a function which batch mints erc1155 tokens for the users, but I'm getting a panic revert. The function I'm testing: function mintBatch( address to_, ...
DevABDee's user avatar
  • 473
1 vote
0 answers
25 views

How to foundry test a function which uses 1Inch Swapping functionality?

I'm working on a protocol's Adapter contract. The Adapter contract have a function, which let users sell their PortalEnergy (assume tokens) to get ETH. They use 1Inch Swapping functionality to get ...
DevABDee's user avatar
  • 473
1 vote
1 answer
47 views

Foundry script: balance mismatch of tx caller

Found a balance mismatch (between actual & shown) for the caller's address when used as vm.startBroadcast(caller) in foundry script: You can reproduce the error using this foundry script: contract ...
abhi3700's user avatar
  • 219
0 votes
1 answer
90 views

queued transactions stuck on metamask on connection to anvil ( foundry )

I created and deployed a contract through foundry, setup the front end and stuff using ethers used anvil to spin up a chain and used the private key given by anvil to import account on metamask. ...
rsai's user avatar
  • 1
1 vote
0 answers
43 views

Contract bytecode generated by Hardhat is two times larger than generated by Foundry

I'm developing a contract using both hardhat and foundry. For some reason hardhat generates bytecode that is two times larger than the one generated in foundry. Why may it happen? Source code: // SPDX-...
Sergey Makovkin's user avatar
0 votes
0 answers
43 views

I got an error when I make cast send command

When I try to make this command cast send --rpc-url "http://94.237.62.195:44737/rpc" --private-key 0x*****b5f312b946890bc3256199b2570dded16e18a8336eeef3cfae0f8a***** ...
miy33t's user avatar
  • 1
1 vote
1 answer
188 views

Foundry script not deploying: "max priority fee per gas higher than max fee per gas"

I'm trying to deploy a smart contract, that deploys fine in remix, but in foundry I keep getting: server returned an error response: error code -32000: max priority fee per gas higher than max fee per ...
Patrick Collins's user avatar
0 votes
2 answers
106 views

How do you deploy to two chains in a foundry script?

I have two contracts that I want to deploy to two different EVM chains, how do I do that in a foundry script? vm.startBroadcast(chainA); contractA.deploy(); vm.stopBroadcast(); vm.startBroadcast(...
Patrick Collins's user avatar
1 vote
1 answer
65 views

No tests to run

I am attempting to run a test on one file with forge test --match-path test/DonutBurger.t.sol but I get No tests to run despite being able to run forge test successfully. Any ideas? $ forge test [⠊] ...
pigfox's user avatar
  • 71
0 votes
1 answer
108 views

Estimating Gas Cost for Smart Contract Deployment Using Foundry

I'm trying to estimate the gas cost for deploying a smart contract using Foundry. Can someone provide guidance on how to do this accurately?
adam mr's user avatar
  • 131
1 vote
1 answer
137 views

Foundry scripts read deployed contract addresses

I deployed with one script contract and I wonder there is a way to read that deployment from foundry env and its data like contract address to use it in another script? I managed to do below with this ...
Blissful's user avatar
  • 382
0 votes
1 answer
47 views

Foundry ERC721A NFT MerkleTree Whitelist Mint Test: Prank won't change the msg.sender? DefaultSender doesn't change?

this is my first post here. error (see how the prank "...cb2", is not setting the msg.sender?) I am making a Solidity NFT Whitelist mint project using Merkle Tree hashing. I generate Merkle ...
turnwol7's user avatar
1 vote
1 answer
43 views

payable(address).transfer(value) runs out of gas

I am playing the openzeppelin Ethernaut challenges. The king challenge, requires to become king and not let the other contract reclaim kingship: // SPDX-License-Identifier: MIT pragma solidity ^0.8.0;...
Cesar Garcia's user avatar
0 votes
2 answers
25 views

Getting started with a project

I'm new to smart contract and eth development but I have a project I'm planning to start and wanted to get a guide on the tools and framework I should be using. I'm gonna be writing smart contracts in ...
Dhruv Pareek's user avatar
0 votes
1 answer
170 views

Received `NotActivated` error when debugging my foundry test

I have hand-written a smart contract in opcodes. The first few opcodes are as such: PUSH1 0x20 CALLDATALOAD CALLER PUSH0 SLOAD ADD However, all my tests for this contract keep breaking at PUSH0. When ...
Patrick Collins's user avatar
0 votes
1 answer
24 views

Type address is not implicitly convertible to expected type struct HelperConfig.NetworkConfig memory

Why even if I am returning a struct from a function then if I initialize another variable with the struct type it is showing me the following error: Type address is not implicitly convertible to ...
Nirban Chakraborty's user avatar
2 votes
1 answer
73 views

Foundry interact with deployed contract

I have my Contract A which creates an ERC20 in the constructor. In the ContractA.t.sol I want to get the ERC20 to interact with it (I have a public method inside Contract A to get the ERC20 address). ...
Facundo Moreno's user avatar
0 votes
0 answers
128 views

Chain doesn't support EPI-3855 and broke front end?

I'm trying for 3 days now to make this work, but i'm always getting these errors: Deploying to local: EIP-3855 is not supported in one or more of the RPCs used. Unsupported Chain IDs: 31337. Contracts ...
Patok's user avatar
  • 1
0 votes
0 answers
15 views

Deployment ERC-6551 registry fails on OP sepolia: contract not recognised. With named imports it does deploy, but with incorrect address

I am trying to deploy the ERC-6551 registry (v0.2.0) on the OP sepolia testnet using forge (0.2.0), following the exact steps as described at the tokenbound.org website: https://docs.tokenbound.org/...
7Cedars's user avatar
1 vote
1 answer
62 views

Foundtry cast: (code: -32000, message: replacement transaction underpriced, data: None

Broadcasting a transaction with Foundry cast command fails with: (code: -32000, message: replacement transaction underpriced, data: None How to fix?
Mikko Ohtamaa's user avatar
0 votes
0 answers
16 views

Solidity inline assembly custom error revert foundry testing

I have written test cases for the original high level code to test the reverting case of a custome error - ERC20InsufficientBalance(address,uint256,uint256) with the following code: function ...
Xenox's user avatar
  • 1
0 votes
0 answers
32 views

How to set different etherscan api for different networks in foundry

I'm in the process of deploying the same contract across two different blockchains, with the intention of verifying them once deployed. I have obtained the API keys from Etherscan for both networks. ...
Emrah's user avatar
  • 1,664
1 vote
0 answers
28 views

Chainlink VRF on Arbitrum Sepolia fork: requestRandomWords Failing

I am going through the Foundry Course by Patrick Collins (@Big Shoutout) and I have just completed the section on creating the Raffle. I deployed the Raffle successfully on Eth Sepolia and created the ...
Charlie Mack's user avatar
2 votes
0 answers
17 views

How to Estimate Deployment of a Contract on Mainnet Using Foundry

I'm trying to estimate the deployment cost of a smart contract on the Ethereum Mainnet using Foundry. Can anyone provide guidance or a step-by-step process for making this estimation accurately?
adam mr's user avatar
  • 131
0 votes
1 answer
27 views

How to fix? warning (2018) function state mutability can be restricted to view

function withdraw() external onlyOwner { if(block.timestamp < end || totalCollected < goal) { revert CollectNotFinished(); } }
ansoiri98's user avatar

1
2 3 4 5
7