Skip to main content
Share Your Experience: Take the 2024 Developer Survey

Questions tagged [cast]

Swiss army knife for interacting with EVM smart contracts, sending transactions and getting chain data

Filter by
Sorted by
Tagged with
1 vote
1 answer

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
0 answers

I got an error when I make cast send command

When I try to make this command cast send --rpc-url "" --private-key 0x*****b5f312b946890bc3256199b2570dded16e18a8336eeef3cfae0f8a***** ...
miy33t's user avatar
  • 1
0 votes
2 answers

How two different functions name can have same function signature?

This is the below code cast sig "workMyDirefulOwner(uint256,uint256)" 0xa9059cbb ...
MD AZAD's user avatar
  • 60
0 votes
1 answer

Download smartcontract's bytecode

Is there a way to download a smartcontract's bytecode with foundry and inject this bytecode into a local Anvil blockchain (at a given address) ? Thanks
Bob5421's user avatar
  • 1,477
1 vote
0 answers

Foundry : cast storage command storage slot argument posing length issue

When I try to get the private variable stored at storage slot 0 of the contract storage using the cast storage command, cast storage <my-contract-address> 0 --rpc-url <my-rpc-url> I get ...
h4mster's user avatar
  • 11
0 votes
0 answers

Transaction not found using `cast publish` of Foundry

I wrote this function in go-ethereum to return a raw transaction: func createTx(c *ethclient.Client) (rawTxnHex string) { from := common.HexToAddress("...
Ahmed Rami Berrahal's user avatar
2 votes
2 answers

How to check state value by using cast in Foundry?

I'm a beginner in develop solidity and using Foundry. I've created a contract which is include some state value as below address[] public owners; mapping(address => bool) public isOwner; ...
Jung's user avatar
  • 31
2 votes
1 answer

How to call a contract method that accepts Enums as input with cast send

I have the following deploy method: function deploy(address admin, uint256 _salt, Type _type) public { bytes32 salt = keccak256(abi.encodePacked(bytes32(_salt), admin)); address myContract; ...
peso's user avatar
  • 21
4 votes
2 answers

How to use foundry cast call when the method returns a struct?

In a deployed contract (in sepolia) there is a method readTimelock(address,uint256) that returns a TimeLock, which is a struct like the following: struct TimeLock{ uint160 amount, uint64 ...
Jacobo Lansac's user avatar
3 votes
1 answer

How can I decode the emitted event data field using Foundry Cast in Ethereum?

I'm trying to extract relevant information from the event but I'm not sure how to decode the emitted event data using cast. Any tips or resources would be greatly appreciated. Thank you!" E.g for ...
Surbhi Audichya's user avatar
3 votes
1 answer

How to calculate the 4byte selector using Cast?

I am using Foundry, and I need to calculate the 4-byte selector of a custom error. How can I do this with the cast CLI?
Paul Razvan Berg's user avatar
2 votes
3 answers

Foundry scripts run with an unknown tx.origin address. How do I change it?

I am running a foundry script that deploys some contracts and calls them. I start my run function with function run() public { uint256 deployerPrivateKey = vm.envUint("...
Yan Digilov's user avatar
1 vote
1 answer

What is Cast (part of Foundry)?

I saw that Foundry has a CLI tool called Cast. What is it useful for?
Paul Razvan Berg's user avatar