mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2025-05-03 01:41:48 +00:00
smartcontract: turn trigger types into Type
1) Turn trigger types from byte constants into Type 2) Add auto-generated stringer for future purposes
This commit is contained in:
parent
b3621d4a86
commit
7d46404e2d
6 changed files with 98 additions and 11 deletions
|
@ -2,6 +2,7 @@ package state
|
|||
|
||||
import (
|
||||
"github.com/CityOfZion/neo-go/pkg/io"
|
||||
"github.com/CityOfZion/neo-go/pkg/smartcontract/trigger"
|
||||
"github.com/CityOfZion/neo-go/pkg/util"
|
||||
"github.com/CityOfZion/neo-go/pkg/vm"
|
||||
)
|
||||
|
@ -17,7 +18,7 @@ type NotificationEvent struct {
|
|||
// all resulting notifications, state, stack and other metadata.
|
||||
type AppExecResult struct {
|
||||
TxHash util.Uint256
|
||||
Trigger byte
|
||||
Trigger trigger.Type
|
||||
VMState string
|
||||
GasConsumed util.Fixed8
|
||||
Stack string // JSON
|
||||
|
@ -39,7 +40,7 @@ func (ne *NotificationEvent) DecodeBinary(r *io.BinReader) {
|
|||
// EncodeBinary implements the Serializable interface.
|
||||
func (aer *AppExecResult) EncodeBinary(w *io.BinWriter) {
|
||||
w.WriteBytes(aer.TxHash[:])
|
||||
w.WriteB(aer.Trigger)
|
||||
w.WriteB(byte(aer.Trigger))
|
||||
w.WriteString(aer.VMState)
|
||||
aer.GasConsumed.EncodeBinary(w)
|
||||
w.WriteString(aer.Stack)
|
||||
|
@ -49,7 +50,7 @@ func (aer *AppExecResult) EncodeBinary(w *io.BinWriter) {
|
|||
// DecodeBinary implements the Serializable interface.
|
||||
func (aer *AppExecResult) DecodeBinary(r *io.BinReader) {
|
||||
r.ReadBytes(aer.TxHash[:])
|
||||
aer.Trigger = r.ReadB()
|
||||
aer.Trigger = trigger.Type(r.ReadB())
|
||||
aer.VMState = r.ReadString()
|
||||
aer.GasConsumed.DecodeBinary(r)
|
||||
aer.Stack = r.ReadString()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue