-
Notifications
You must be signed in to change notification settings - Fork 197
/
scQueryStub.go
34 lines (29 loc) · 928 Bytes
/
scQueryStub.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
package mock
import (
"github.com/ElrondNetwork/elrond-go-core/data/transaction"
"github.com/ElrondNetwork/elrond-go/process"
vmcommon "github.com/ElrondNetwork/elrond-vm-common"
)
// ScQueryStub -
type ScQueryStub struct {
ExecuteQueryCalled func(query *process.SCQuery) (*vmcommon.VMOutput, error)
ComputeScCallGasLimitCalled func(tx *transaction.Transaction) (uint64, error)
}
// ExecuteQuery -
func (s *ScQueryStub) ExecuteQuery(query *process.SCQuery) (*vmcommon.VMOutput, error) {
if s.ExecuteQueryCalled != nil {
return s.ExecuteQueryCalled(query)
}
return &vmcommon.VMOutput{}, nil
}
// ComputeScCallGasLimit --
func (s *ScQueryStub) ComputeScCallGasLimit(tx *transaction.Transaction) (uint64, error) {
if s.ComputeScCallGasLimitCalled != nil {
return s.ComputeScCallGasLimitCalled(tx)
}
return 100, nil
}
// IsInterfaceNil -
func (s *ScQueryStub) IsInterfaceNil() bool {
return s == nil
}