-
Notifications
You must be signed in to change notification settings - Fork 3
/
builtInFunctionStub.go
40 lines (34 loc) · 1.12 KB
/
builtInFunctionStub.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
package mock
import (
vmcommon "github.com/multiversx/mx-chain-vm-common-go"
)
// BuiltInFunctionStub -
type BuiltInFunctionStub struct {
ProcessBuiltinFunctionCalled func(acntSnd, acntDst vmcommon.UserAccountHandler, vmInput *vmcommon.ContractCallInput) (*vmcommon.VMOutput, error)
SetNewGasConfigCalled func(gasCost *vmcommon.GasCost)
IsActiveCalled func() bool
}
// ProcessBuiltinFunction -
func (b *BuiltInFunctionStub) ProcessBuiltinFunction(acntSnd, acntDst vmcommon.UserAccountHandler, vmInput *vmcommon.ContractCallInput) (*vmcommon.VMOutput, error) {
if b.ProcessBuiltinFunctionCalled != nil {
return b.ProcessBuiltinFunctionCalled(acntSnd, acntDst, vmInput)
}
return &vmcommon.VMOutput{}, nil
}
// SetNewGasConfig -
func (b *BuiltInFunctionStub) SetNewGasConfig(gasCost *vmcommon.GasCost) {
if b.SetNewGasConfigCalled != nil {
b.SetNewGasConfigCalled(gasCost)
}
}
// IsActive -
func (b *BuiltInFunctionStub) IsActive() bool {
if b.IsActiveCalled != nil {
return b.IsActiveCalled()
}
return true
}
// IsInterfaceNil -
func (b *BuiltInFunctionStub) IsInterfaceNil() bool {
return b == nil
}