/
result.go
54 lines (42 loc) · 888 Bytes
/
result.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
package ride
import "github.com/wavesplatform/gowaves/pkg/proto"
type Result interface {
Result() bool
ScriptActions() []proto.ScriptAction
Complexity() int
userResult() rideType
}
type ScriptResult struct {
res bool
param rideType
complexity int
}
func (r ScriptResult) Result() bool {
return r.res
}
func (r ScriptResult) userResult() rideType {
return r.param
}
func (r ScriptResult) ScriptActions() []proto.ScriptAction {
return nil
}
func (r ScriptResult) Complexity() int {
return r.complexity
}
type DAppResult struct {
actions []proto.ScriptAction
param rideType
complexity int
}
func (r DAppResult) Result() bool {
return true
}
func (r DAppResult) userResult() rideType {
return r.param
}
func (r DAppResult) ScriptActions() []proto.ScriptAction {
return r.actions
}
func (r DAppResult) Complexity() int {
return r.complexity
}