-
Notifications
You must be signed in to change notification settings - Fork 199
/
txFeeHandlerStub.go
81 lines (68 loc) · 2.44 KB
/
txFeeHandlerStub.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
package mock
import (
"math/big"
"github.com/ElrondNetwork/elrond-go/process"
)
// FeeHandlerStub -
type FeeHandlerStub struct {
MaxGasLimitPerBlockCalled func() uint64
SetMinGasPriceCalled func(minasPrice uint64)
SetMinGasLimitCalled func(minGasLimit uint64)
ComputeGasLimitCalled func(tx process.TransactionWithFeeHandler) uint64
ComputeMoveBalanceFeeCalled func(tx process.TransactionWithFeeHandler) *big.Int
ComputeTxFeeCalled func(tx process.TransactionWithFeeHandler) *big.Int
CheckValidityTxValuesCalled func(tx process.TransactionWithFeeHandler) error
DeveloperPercentageCalled func() float64
MinGasPriceCalled func() uint64
GasPriceModifierCalled func() float64
ComputeFeeForProcessingCalled func(tx process.TransactionWithFeeHandler, gasToUse uint64) *big.Int
}
// ComputeFeeForProcessing -
func (fhs *FeeHandlerStub) ComputeFeeForProcessing(tx process.TransactionWithFeeHandler, gasToUse uint64) *big.Int {
if fhs.ComputeFeeForProcessingCalled != nil {
return fhs.ComputeFeeForProcessingCalled(tx, gasToUse)
}
return big.NewInt(0)
}
// GasPriceModifier -
func (fhs *FeeHandlerStub) GasPriceModifier() float64 {
if fhs.GasPriceModifierCalled != nil {
return fhs.GasPriceModifierCalled()
}
return 1.0
}
// MinGasPrice -
func (fhs *FeeHandlerStub) MinGasPrice() uint64 {
if fhs.MinGasPriceCalled != nil {
return fhs.MinGasPriceCalled()
}
return 0
}
// DeveloperPercentage -
func (fhs *FeeHandlerStub) DeveloperPercentage() float64 {
return fhs.DeveloperPercentageCalled()
}
// MaxGasLimitPerBlock -
func (fhs *FeeHandlerStub) MaxGasLimitPerBlock(uint32) uint64 {
return fhs.MaxGasLimitPerBlockCalled()
}
// ComputeGasLimit -
func (fhs *FeeHandlerStub) ComputeGasLimit(tx process.TransactionWithFeeHandler) uint64 {
return fhs.ComputeGasLimitCalled(tx)
}
// ComputeMoveBalanceFee -
func (fhs *FeeHandlerStub) ComputeMoveBalanceFee(tx process.TransactionWithFeeHandler) *big.Int {
return fhs.ComputeMoveBalanceFeeCalled(tx)
}
// ComputeTxFee -
func (fhs *FeeHandlerStub) ComputeTxFee(tx process.TransactionWithFeeHandler) *big.Int {
return fhs.ComputeTxFeeCalled(tx)
}
// CheckValidityTxValues -
func (fhs *FeeHandlerStub) CheckValidityTxValues(tx process.TransactionWithFeeHandler) error {
return fhs.CheckValidityTxValuesCalled(tx)
}
// IsInterfaceNil returns true if there is no value under the interface
func (fhs *FeeHandlerStub) IsInterfaceNil() bool {
return fhs == nil
}