-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(deps): Move to Alloy ABI encoding/decoding & alloy types #5986
Changes from 52 commits
ee18e87
6c6aa4e
f33e414
a8bb5b0
adc2786
8bc67d2
65f0918
a54005a
2c70bd9
55ad9bf
94fb974
b3935cc
8737a52
988e756
5b8c207
bd2fbb3
3c3b35c
7484d3b
3adebd5
c44e796
b51f741
bb68371
079c879
d9207b2
efd0323
de459d4
8356303
bcb57a2
4d4255b
5f145b7
90d5b05
3ea011c
48832e5
2cefb6f
6bef6ad
170f5e6
d8e54b9
5b404e0
2dbe680
ea9b980
a1b7442
23e281d
bdc95bb
8507f92
e42aeba
dc05ee5
944174a
4b2f0ea
f297ace
403de57
ffcb558
2c64c3d
ef21ace
99c228d
ebf9523
92c6b5a
e3dfa8b
da9b483
adc940a
b1f5ff7
0dbcf71
0e2c954
4d9ea34
9b5c45c
1d1dc01
e50cc48
5ce86fe
5c37c4b
30b2295
cd25d3b
6c88473
fb7bd39
5500c14
e4e347a
823a6e3
27f107a
cf7fdce
371e817
4e4e4c1
bcd565f
bd3e506
f958758
963234d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,21 @@ | ||
use alloy_primitives::{Address, U256}; | ||
use cast::{Cast, TxBuilder}; | ||
use clap::Parser; | ||
use ethers::types::{NameOrAddress, U256}; | ||
use eyre::Result; | ||
use foundry_cli::{ | ||
opts::{EtherscanOpts, RpcOpts}, | ||
utils::{self, parse_ether_value}, | ||
}; | ||
use foundry_config::{figment::Figment, Config}; | ||
use foundry_utils::types::ToEthers; | ||
use std::str::FromStr; | ||
|
||
/// CLI arguments for `cast estimate`. | ||
#[derive(Debug, Parser)] | ||
pub struct EstimateArgs { | ||
/// The destination of the transaction. | ||
#[clap(value_parser = NameOrAddress::from_str)] | ||
to: Option<NameOrAddress>, | ||
#[clap(value_parser = Address::from_str)] | ||
to: Option<Address>, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This removes ENS functionality, I think it's fine for now if we keep it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @gakonst def wants to jettison this though—i'm up for either, but There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We could make a local |
||
|
||
/// The signature of the function to call. | ||
sig: Option<String>, | ||
|
@@ -26,11 +27,11 @@ pub struct EstimateArgs { | |
#[clap( | ||
short, | ||
long, | ||
value_parser = NameOrAddress::from_str, | ||
value_parser = Address::from_str, | ||
default_value = "0x0000000000000000000000000000000000000000", | ||
env = "ETH_FROM", | ||
)] | ||
from: NameOrAddress, | ||
from: Address, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this should also remain nameoraddress -- maybe i didn't communicate this appropriately, my thought was that we pull in |
||
|
||
/// Ether to send in the transaction. | ||
/// | ||
|
@@ -85,7 +86,9 @@ impl EstimateArgs { | |
let chain = utils::get_chain(config.chain_id, &provider).await?; | ||
let api_key = config.get_etherscan_api_key(Some(chain)); | ||
|
||
let mut builder = TxBuilder::new(&provider, from, to, chain, false).await?; | ||
let mut builder = | ||
TxBuilder::new(&provider, from.to_ethers(), to.map(|t| t.to_ethers()), chain, false) | ||
.await?; | ||
builder.etherscan_api_key(api_key); | ||
|
||
match command { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we get rid of this function
SimpleCast::to_checksum_address
? It's justaddress.to_string()
orto_checksum(None)
orformat!("{address}")
.In general I think SimpleCast was a mistake to begin with. I get the initial reason of having both a program and CLI Cast interface, but in practice it's only used for one or two functions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah definitely. This was migrated mainly to made the code compile, but it's completely redundant now
Also agree about SimpleCast, it could just be a CLI
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree supportive of combining the two if the functions are simple enough.