Skip to content
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

Submitter: add gas price multiplier #2464

Open
dwasse opened this issue Apr 5, 2024 · 1 comment
Open

Submitter: add gas price multiplier #2464

dwasse opened this issue Apr 5, 2024 · 1 comment

Comments

@dwasse
Copy link
Collaborator

dwasse commented Apr 5, 2024

See #2462 (comment)

Copy link

greptile-apps bot commented Jun 24, 2024

To add a gas price multiplier to the SubmitTransaction method in submitter.go, follow these steps:

  1. Locate setGasPrice Method: Open ethergo/submitter/submitter.go and find the setGasPrice method.

  2. Add Multiplier Parameter: Modify the setGasPrice method to accept a multiplier parameter.

func (t *txSubmitterImpl) setGasPrice(ctx context.Context, client client.EVM, transactor *bind.TransactOpts, bigChainID *big.Int, prevTx *types.Transaction, multiplier float64) (err error) {
  1. Apply Multiplier: Apply the multiplier to the gas price calculations within the setGasPrice method.
transactor.GasPrice = gas.BumpByPercent(core.CopyBigInt(prevTx.GasPrice()), bumpPct)
transactor.GasPrice = new(big.Int).Mul(transactor.GasPrice, big.NewInt(int64(multiplier * 100)))
transactor.GasPrice = new(big.Int).Div(transactor.GasPrice, big.NewInt(100))
  1. Update Calls to setGasPrice: Ensure all calls to setGasPrice pass the multiplier parameter. For example, in the SubmitTransaction method:
err = t.setGasPrice(ctx, chainClient, transactor, chainID, nil, 1.2) // Example multiplier of 1.2

This will apply the gas price multiplier to the transaction submission process.

References

/ethergo/submitter/submitter.go
/ethergo/submitter/README.md

Ask Greptile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants