Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
trajan0x committed Jun 9, 2024
1 parent 65d2116 commit f3f4dd6
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions ethergo/util/converter.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,24 @@ func TxToCall(transaction *types.Transaction) (*ethereum.CallMsg, error) {
return nil, errors.Wrap(err, "could not convert to call")
}

return &ethereum.CallMsg{
callMessage := ethereum.CallMsg{
From: rawMsg.From,
To: transaction.To(),
Gas: transaction.Gas(),
GasPrice: transaction.GasPrice(),
GasFeeCap: transaction.GasTipCap(),
GasTipCap: transaction.GasFeeCap(),
GasFeeCap: transaction.GasFeeCap(),
GasTipCap: transaction.GasTipCap(),
Value: transaction.Value(),
Data: transaction.Data(),
}, nil
}

// gas price will getset to gastipcap + gas fee cap to account for legacy behavior so if
// tip/fee cap are set we need to make sure we nil gas price
if transaction.Type() == types.LegacyTxType {
callMessage.GasTipCap = nil
callMessage.GasFeeCap = nil
} else {
callMessage.GasPrice = nil
}
return &callMessage, nil
}

0 comments on commit f3f4dd6

Please sign in to comment.