foundry-rs / foundry

Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.
https://getfoundry.sh
Apache License 2.0
7.91k stars 1.6k forks source link

`cast send` 0x prefixed calldata #4111

Open tynes opened 1 year ago

tynes commented 1 year ago

Component

Cast

Describe the feature you would like

I'd like to be able to send transactions, make eth_calls or do gas estimation with calldata directly instead of passing in a function selector + args. This is useful when handling data that has already been ABI encoded or if the calldata is not following ABI.

seth does have this feature, it would require some refactoring to allow cast to do so but it should definitely be possible.

Additional context

No response

DaniPopes commented 1 year ago

cast call has a --data flag which is mutually exclusive with selector/args, so this should be trivial to add to cast send too

mattsse commented 1 year ago

closing as this appears to be solved via --data flag

XD-OK commented 1 year ago

I don't think this has been resolved, send/estimate has no --data flag

"make eth_calls or do gas estimation with calldata directly instead of passing in a function selector + args" it's useful

XD-OK commented 1 year ago

I don't think this has been resolved, send/estimate has no --data flag

"make eth_calls or do gas estimation with calldata directly instead of passing in a function selector + args" it's useful

Sorry, I found "sig" has already support calldata: The signature (sig) can be:

A fragment: someFunction(uint256,bytes32) A selector and encoded calldata: 0xcdba2fd40000000000000000000000000000000000000000000000000000000000007a69 Only the function name: in this case Cast will try to fetch the function signature from Etherscan

mattsse commented 1 year ago

sorry confused send with call

@DaniPopes we should mirror cast call --data to send|estimate

DaniPopes commented 1 year ago

Actually I think it should be the other way around. Since the sig argument can also be raw calldata, --data is redundant