Skip to content

Commit

Permalink
feat: add a default gas calculator (#96)
Browse files Browse the repository at this point in the history
  • Loading branch information
owen-reorg authored Feb 10, 2023
1 parent 5a119ca commit 9e761ce
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion x/gashub/types/gas_calculator.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,14 @@ func RegisterCalculatorGen(msgType string, feeCalcGen GasCalculatorGenerator) {
}

func GetGasCalculatorGen(msgType string) GasCalculatorGenerator {
return calculatorsGen[msgType]
res, ok := calculatorsGen[msgType]
// todo: this is a temporary default fee, remove this after all msg types are registered
if !ok {
res = func(params Params) GasCalculator {
return FixedGasCalculator(1e5)
}
}
return res
}

func FixedGasCalculator(amount uint64) GasCalculator {
Expand Down

0 comments on commit 9e761ce

Please sign in to comment.