New answers tagged

2 votes

Foundry script: balance mismatch of tx caller

Remove --private-key flag to view the original balance. Balance: 25476025062017363181 Actually, by default when the same caller is used with private key, foundry somehow adds more gas coin to the ...
abhi3700's user avatar
  • 219
1 vote

Deployment Issues with BasicNFT on Sepolia Network Using Foundry: Mismatched Bytecode and Successful Deployment

I have changed my compiler version to 0.8.21 and it worked for me . I don't Know how , if you are still facing same issue try it out once . If you have another solution please share with me , i don't ...
hoBabu's user avatar
  • 11
1 vote
Accepted

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

You should update your --priority-gas-price. Usually something small like 1 works fine. For example: forge script script/yourScript.s.sol --priority-gas-price 1
Patrick Collins's user avatar
0 votes

Foundry: skip specifics tests

If you want to skip tests programmatically, add a custom function at the top of your test that returns nothing when a condition is met. This would act like a skip. Something like: enum Network { ...
dNyrM's user avatar
  • 936
1 vote
Accepted

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

You can do multichain deployment using foundry as below You can set up your foundry.toml file as below [rpc_endpoints] optimism = "https://opt-goerli.g.alchemy.com/v2/<api key>" goerli ...
Talha Sajid Chaudhary's user avatar
2 votes
Accepted

No tests to run

I've executed your code. Running tests via --match-path to filter test files on forge test are working fine. Here's the output: forge test --match-path test/DonutBurger.t.sol forge test --match-path ...
SYED ASAD KAZMI's user avatar
0 votes

Estimating Gas Cost for Smart Contract Deployment Using Foundry

To estimate the gas cost for deploying a smart contract using Foundry, you can follow these steps: Enable Gas Reports in Foundry Configuration: First, you need to enable gas reports in your Foundry ...
SYED ASAD KAZMI's user avatar
2 votes
Accepted

Foundry scripts read deployed contract addresses

Storing and reading as environment variables: One way is to store the details corresponding to a particular contract in .env file as environment variables, and later access them in other scripts. Here’...
SYED ASAD KAZMI's user avatar
1 vote

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

Solved: I had to add a function in the main contract to return the msg.sender first. It appears the vm.prank only sets the address over in the contract and not inside the testing test. I pranked the ...
turnwol7's user avatar
0 votes

How to trigger a payable function using call function while testing in Foundary

f.func1{value: 1000000 ether}(_name, _phone_no);
taofeek's user avatar
0 votes

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

When you're calling the send_ransom() function of Ursurpur contract by passing the address of the King contract, then this line is executed: (bool success, bytes memory err) = payable(_king).call{...
SYED ASAD KAZMI's user avatar
0 votes

Getting started with a project

For testing how the frontend corresponding to a contract's function call looks and to simulate how you'll be interacting with the contracts on a frontend, you can use something like: Thirdweb: You ...
SYED ASAD KAZMI's user avatar
0 votes

Getting started with a project

I'm not familiar with front-end, but you can use hardhat to develop, test, deploy, etc... with your smart-contract. Unit-test can be written by javascript or typescript, so I think it will be easy for ...
CT95's user avatar
  • 396
0 votes
Accepted

Received `NotActivated` error when debugging my foundry test

This is likely due to you not using the correct evm_version. Some versions of the EVM only support certain opcodes. Be sure you set the correct version in your foundry.toml. For PUSH0, you'd need to ...
Patrick Collins's user avatar

Top 50 recent answers are included