Skip to content

Commit

Permalink
Merge pull request #33 from primevprotocol/fix-fee-suggestion
Browse files Browse the repository at this point in the history
fix: fee suggestion
  • Loading branch information
shaspitz authored Feb 29, 2024
2 parents c9791bc + b63e192 commit f6d9ca6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
7 changes: 4 additions & 3 deletions pkg/node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -281,19 +281,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 @@ -130,19 +130,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

0 comments on commit f6d9ca6

Please sign in to comment.