Skip to content

Commit

Permalink
custom
Browse files Browse the repository at this point in the history
  • Loading branch information
rauljordan committed Jul 2, 2024
1 parent 7364a48 commit 86ca070
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 7 deletions.
10 changes: 9 additions & 1 deletion check/src/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,15 @@ pub async fn cache_program(cfg: &CacheConfig) -> Result<()> {
}
}
let verbose = cfg.common_cfg.verbose;
let receipt = run_tx("cache", tx, None, &client, verbose).await?;
let receipt = run_tx(
"cache",
tx,
None,
cfg.common_cfg.max_fee_per_gas_gwei,
&client,
verbose,
)
.await?;

let address = cfg.program_address.debug_lavender();

Expand Down
12 changes: 9 additions & 3 deletions check/src/deploy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ impl DeployConfig {
"deploy",
tx,
Some(gas),
self.check_config.common_cfg.max_fee_per_gas_gwei,
client,
self.check_config.common_cfg.verbose,
)
Expand Down Expand Up @@ -181,6 +182,7 @@ impl DeployConfig {
"activate",
tx,
Some(gas),
self.check_config.common_cfg.max_fee_per_gas_gwei,
client,
self.check_config.common_cfg.verbose,
)
Expand All @@ -202,14 +204,18 @@ pub async fn run_tx(
name: &str,
tx: Eip1559TransactionRequest,
gas: Option<U256>,
max_fee_per_gas_gwei: Option<U256>,
client: &SignerClient,
verbose: bool,
) -> Result<TransactionReceipt> {
let mut tx = TypedTransaction::Eip1559(tx);
let mut tx = tx;
if let Some(gas) = gas {
tx.set_gas(gas);
tx.gas = Some(gas);
}

if let Some(max_fee) = max_fee_per_gas_gwei {
tx.max_fee_per_gas = Some(gwei_to_wei(max_fee)?);
}
let tx = TypedTransaction::Eip1559(tx);
let tx = client.send_transaction(tx, None).await?;
let tx_hash = tx.tx_hash();
if verbose {
Expand Down
6 changes: 3 additions & 3 deletions check/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ struct CommonConfig {
/// in project's directory tree are included.
#[arg(long)]
source_files_for_project_hash: Vec<String>,
#[arg(long)]
/// Optional max fee per gas in gwei units.
max_fee_per_gas_gwei: Option<U256>,
}

#[derive(Args, Clone, Debug)]
Expand Down Expand Up @@ -132,9 +135,6 @@ struct DeployConfig {
/// Only perform gas estimation.
#[arg(long)]
estimate_gas: bool,
#[arg(long)]
/// Optional max fee per gas in gwei units.
max_fee_per_gas_gwei: Option<U256>,
}

#[derive(Args, Clone, Debug)]
Expand Down

0 comments on commit 86ca070

Please sign in to comment.