-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
26 changed files
with
581 additions
and
208 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package types | ||
|
||
import "context" | ||
|
||
// Opt is an option for a gas estimator | ||
type Opt int | ||
|
||
const ( | ||
// OptForceRefetch forces the estimator to bust a cache if necessary | ||
OptForceRefetch Opt = iota | ||
) | ||
|
||
// PriorAttempt provides a generic interface for reading tx data to be used in the fee esimators | ||
type PriorAttempt[FEE any, HASH any] interface { | ||
Fee() FEE | ||
GetChainSpecificGasLimit() uint32 | ||
GetBroadcastBeforeBlockNum() *int64 | ||
GetHash() HASH | ||
GetTxType() int | ||
} | ||
|
||
// FeeEstimator provides a generic interface for fee estimation | ||
// | ||
//go:generate mockery --quiet --name FeeEstimator --output ./mocks/ --case=underscore | ||
type FeeEstimator[HEAD any, FEE any, MAXPRICE any, HASH any] interface { | ||
OnNewLongestChain(context.Context, HEAD) | ||
Start(context.Context) error | ||
Close() error | ||
|
||
GetFee(ctx context.Context, calldata []byte, feeLimit uint32, maxFeePrice MAXPRICE, opts ...Opt) (fee FEE, chainSpecificFeeLimit uint32, err error) | ||
BumpFee(ctx context.Context, originalFee FEE, feeLimit uint32, maxFeePrice MAXPRICE, attempts []PriorAttempt[FEE, HASH]) (bumpedFee FEE, chainSpecificFeeLimit uint32, err error) | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.