Skip to content

Commit

Permalink
fix: bundle fees
Browse files Browse the repository at this point in the history
  • Loading branch information
Vid201 committed Oct 31, 2024
1 parent ba4e44a commit 386997a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
13 changes: 9 additions & 4 deletions crates/bundler/src/bundler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,16 +122,21 @@ where
};
let estimated_gas = self.eth_client.estimate_gas(&tx, None).await?;

let (max_fee_per_gas, max_priority_fee) =
self.eth_client.estimate_eip1559_fees(None).await?;
let mut max_fee_per_gas: U256 = U256::zero();
let mut max_priority_fee_per_gas: U256 = U256::zero();

for uo in uos {
max_fee_per_gas += uo.max_fee_per_gas;
max_priority_fee_per_gas += uo.max_priority_fee_per_gas;
}

tx = TypedTransaction::Eip1559(Eip1559TransactionRequest {
to: tx.to().cloned(),
from: Some(self.wallet.signer.address()),
data: tx.data().cloned(),
chain_id: Some(U64::from(self.chain.id())),
max_priority_fee_per_gas: Some(max_priority_fee),
max_fee_per_gas: Some(max_fee_per_gas),
max_priority_fee_per_gas: Some(max_priority_fee_per_gas / uos.len()),
max_fee_per_gas: Some(max_fee_per_gas / uos.len()),
gas: Some(estimated_gas),
nonce: Some(nonce),
value: None,
Expand Down
4 changes: 2 additions & 2 deletions crates/grpc/src/proto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -413,11 +413,11 @@ pub mod types {
Self {
root_hashes: root_hashes
.into_iter()
.map(|(k, v)| (format!("{:?}", k), format!("{:?}", v)))
.map(|(k, v)| (format!("{k:?}"), format!("{v:?}")))
.collect(),
slots: slots
.into_iter()
.map(|(k, v)| (format!("{:?}", k), StorageSlots { slots: v }))
.map(|(k, v)| (format!("{k:?}"), StorageSlots { slots: v }))
.collect(),
}
}
Expand Down

0 comments on commit 386997a

Please sign in to comment.