Skip to content

Commit abf2e83

Browse files
committed
refactor(anvil): use from_recovered_tx for deposit tx type
1 parent e651d20 commit abf2e83

File tree

1 file changed

+1
-25
lines changed
  • crates/anvil/core/src/eth/transaction

1 file changed

+1
-25
lines changed

crates/anvil/core/src/eth/transaction/mod.rs

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1348,13 +1348,6 @@ pub fn convert_to_anvil_receipt(receipt: AnyTransactionReceipt) -> Option<Receip
13481348

13491349
impl FromRecoveredTx<TypedTransaction> for TxEnv {
13501350
fn from_recovered_tx(tx: &TypedTransaction, caller: Address) -> Self {
1351-
fn transact_to(kind: &TxKind) -> TxKind {
1352-
match kind {
1353-
TxKind::Call(c) => TxKind::Call(*c),
1354-
TxKind::Create => TxKind::Create,
1355-
}
1356-
}
1357-
13581351
match tx {
13591352
TypedTransaction::Legacy(signed_tx) => Self::from_recovered_tx(signed_tx.tx(), caller),
13601353
TypedTransaction::EIP2930(signed_tx) => Self::from_recovered_tx(signed_tx.tx(), caller),
@@ -1363,24 +1356,7 @@ impl FromRecoveredTx<TypedTransaction> for TxEnv {
13631356
Self::from_recovered_tx(signed_tx.tx().tx(), caller)
13641357
}
13651358
TypedTransaction::EIP7702(signed_tx) => Self::from_recovered_tx(signed_tx.tx(), caller),
1366-
TypedTransaction::Deposit(tx) => {
1367-
let TxDeposit { to, value, gas_limit, input, .. } = tx;
1368-
1369-
Self {
1370-
caller,
1371-
kind: transact_to(to),
1372-
data: input.clone(),
1373-
chain_id: tx.chain_id(),
1374-
nonce: 0,
1375-
value: *value,
1376-
gas_price: 0,
1377-
gas_priority_fee: None,
1378-
gas_limit: *gas_limit,
1379-
access_list: vec![].into(),
1380-
tx_type: DEPOSIT_TX_TYPE_ID,
1381-
..Default::default()
1382-
}
1383-
}
1359+
TypedTransaction::Deposit(tx) => Self::from_recovered_tx(tx, caller),
13841360
}
13851361
}
13861362
}

0 commit comments

Comments
 (0)