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

fix: fee suggestion #33

Merged
merged 2 commits into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions pkg/node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -292,19 +292,20 @@ func setBuilderMapping(
return err
}
auth.Nonce = big.NewInt(int64(nonce))

// Returns priority fee per gas
gasTip, err := client.SuggestGasTipCap(ctx)
if err != nil {
return err
}

// Returns priority fee per gas + base fee per gas
gasPrice, err := client.SuggestGasPrice(ctx)
if err != nil {
return err
}

gasFeeCap := new(big.Int).Add(gasTip, gasPrice)

auth.GasFeeCap = gasFeeCap
auth.GasFeeCap = gasPrice
auth.GasTipCap = gasTip

txn, err := rc.AddBuilderAddress(auth, builderName, common.HexToAddress(builderAddress))
Expand Down
6 changes: 3 additions & 3 deletions pkg/settler/settler.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,19 +110,19 @@ func (s *Settler) getTransactOpts(ctx context.Context) (*bind.TransactOpts, erro
}
auth.Nonce = big.NewInt(int64(nonce))

// Returns priority fee per gas
gasTip, err := s.client.SuggestGasTipCap(ctx)
if err != nil {
return nil, err
}

// Returns priority fee per gas + base fee per gas
gasPrice, err := s.client.SuggestGasPrice(ctx)
if err != nil {
return nil, err
}

gasFeeCap := new(big.Int).Add(gasTip, gasPrice)

auth.GasFeeCap = gasFeeCap
auth.GasFeeCap = gasPrice
auth.GasTipCap = gasTip

return auth, nil
Expand Down
Loading