type Event struct {
Header *Header `protobuf:"bytes,1,opt,name=Header,proto3" json:"Header,omitempty"`
Input *InputEvent `protobuf:"bytes,2,opt,name=Input,proto3" json:"Input,omitempty"`
Output *OutputEvent `protobuf:"bytes,3,opt,name=Output,proto3" json:"Output,omitempty"`
Call *CallEvent `protobuf:"bytes,4,opt,name=Call,proto3" json:"Call,omitempty"`
Log *LogEvent `protobuf:"bytes,5,opt,name=Log,proto3" json:"Log,omitempty"`
GovernAccount *GovernAccountEvent `protobuf:"bytes,6,opt,name=GovernAccount,proto3" json:"GovernAccount,omitempty"`
}
type InputEvent struct {
Address github_com_hyperledger_burrow_crypto.Address `protobuf:"bytes,1,opt,name=Address,proto3,customtype=github.com/hyperledger/burrow/crypto.Address" json:"Address"`
}
type OutputEvent struct {
Address github_com_hyperledger_burrow_crypto.Address `protobuf:"bytes,1,opt,name=Address,proto3,customtype=github.com/hyperledger/burrow/crypto.Address" json:"Address"`
}
type Header struct {
// Transaction type
TxType github_com_hyperledger_burrow_txs_payload.Type `protobuf:"varint,1,opt,name=TxType,proto3,casttype=github.com/hyperledger/burrow/txs/payload.Type" json:"TxType,omitempty"`
// The hash of the transaction that caused this event to be generated
TxHash github_com_hyperledger_burrow_binary.HexBytes `protobuf:"bytes,2,opt,name=TxHash,proto3,customtype=github.com/hyperledger/burrow/binary.HexBytes" json:"TxHash"`
// The type of event
EventType EventType `protobuf:"varint,3,opt,name=EventType,proto3,casttype=EventType" json:"EventType,omitempty"`
// EventID published with event
EventID string `protobuf:"bytes,4,opt,name=EventID,proto3" json:"EventID,omitempty"`
// The block height at which this event was emitted
Height uint64 `protobuf:"varint,5,opt,name=Height,proto3" json:"Height,omitempty"`
// The index of this event relative to other events generated by the same transaction
Index uint64 `protobuf:"varint,6,opt,name=Index,proto3" json:"Index,omitempty"`
// If event is exception
Exception *errors.Exception `protobuf:"bytes,7,opt,name=Exception,proto3" json:"Exception,omitempty"`
}
TypeBeginBlock ~ TypeEndBlock is used by stream event to mark the border of data stream. We will discuss it in burrow stream event
// Execution event types
const (
TypeUnknown EventType = iota
TypeCall
TypeLog
TypeAccountInput
TypeAccountOutput
TypeTxExecution
TypeBlockExecution
TypeGovernAccount
TypeBeginBlock
TypeBeginTx
TypeEnvelope
TypeEndTx
TypeEndBlock
)
func EventStringAccountInput(addr crypto.Address) string { return fmt.Sprintf("Acc/%s/Input", addr) }
func EventStringAccountOutput(addr crypto.Address) string { return fmt.Sprintf("Acc/%s/Output", addr) }
func EventStringAccountCall(addr crypto.Address) string { return fmt.Sprintf("Acc/%s/Call", addr) }
func EventStringLogEvent(addr crypto.Address) string { return fmt.Sprintf("Log/%s", addr) }
func EventStringTxExecution(txHash []byte) string { return fmt.Sprintf("Execution/Tx/%X", txHash) }
func EventStringGovernAccount(addr *crypto.Address) string { return fmt.Sprintf("Govern/Acc/%v", addr) }
type CallEvent struct {
CallType CallType `protobuf:"varint,5,opt,name=CallType,proto3,casttype=CallType" json:"CallType,omitempty"`
CallData *CallData `protobuf:"bytes,1,opt,name=CallData,proto3" json:"CallData,omitempty"`
Origin github_com_hyperledger_burrow_crypto.Address `protobuf:"bytes,2,opt,name=Origin,proto3,customtype=github.com/hyperledger/burrow/crypto.Address" json:"Origin"`
StackDepth uint64 `protobuf:"varint,3,opt,name=StackDepth,proto3" json:"StackDepth,omitempty"`
Return github_com_hyperledger_burrow_binary.HexBytes `protobuf:"bytes,4,opt,name=Return,proto3,customtype=github.com/hyperledger/burrow/binary.HexBytes" json:"Return"`
}
type CallType uint32
const (
CallTypeCall = CallType(0x00)
CallTypeCode = CallType(0x01)
CallTypeDelegate = CallType(0x02)
CallTypeStatic = CallType(0x03)
)
type CallData struct {
Caller github_com_hyperledger_burrow_crypto.Address `protobuf:"bytes,1,opt,name=Caller,proto3,customtype=github.com/hyperledger/burrow/crypto.Address" json:"Caller"`
Callee github_com_hyperledger_burrow_crypto.Address `protobuf:"bytes,2,opt,name=Callee,proto3,customtype=github.com/hyperledger/burrow/crypto.Address" json:"Callee"`
Data github_com_hyperledger_burrow_binary.HexBytes `protobuf:"bytes,3,opt,name=Data,proto3,customtype=github.com/hyperledger/burrow/binary.HexBytes" json:"Data"`
Value uint64 `protobuf:"varint,4,opt,name=Value,proto3" json:"Value,omitempty"`
Gas uint64 `protobuf:"varint,5,opt,name=Gas,proto3" json:"Gas,omitempty"`
}
Log event is used to log in smart contract.
event Transfer(address indexed _from, address indexed _to, uint256 _value);
The number of indexed param is is corresponding to n of LOG(n+1) (underlying EVM opcode). which means that the opcode of Transfer event is LOG3
type LogEvent struct {
Address github_com_hyperledger_burrow_crypto.Address `protobuf:"bytes,1,opt,name=Address,proto3,customtype=github.com/hyperledger/burrow/crypto.Address" json:"Address"`
Data github_com_hyperledger_burrow_binary.HexBytes `protobuf:"bytes,2,opt,name=Data,proto3,customtype=github.com/hyperledger/burrow/binary.HexBytes" json:"Data"`
Topics []github_com_hyperledger_burrow_binary.Word256 `protobuf:"bytes,3,rep,name=Topics,proto3,customtype=github.com/hyperledger/burrow/binary.Word256" json:"Topics"`
Data store (abi encoded) data of unIndexed params.
Generally, The length of Topics is corresponding to n of LOGn (underlying EVM opcode), It means that the max length of Topics is 5 and the min is 0.
Topics[0] store the keccak256-hash of this event’s signature If this event is not anonymous.
Others store data of indexed param.
Note:
If indexed param type is all “complex” types or types of dynamic length, including all arrays, string, bytes and structs, Topic store its keccak256-hash of abi encoded value
type GovernAccountEvent struct {
AccountUpdate *spec.TemplateAccount `protobuf:"bytes,1,opt,name=AccountUpdate,proto3" json:"AccountUpdate,omitempty"`
}
type TemplateAccount struct {
Name string `protobuf:"bytes,1,opt,name=Name,proto3" json:"Name,omitempty"`
Address *github_com_hyperledger_burrow_crypto.Address `protobuf:"bytes,2,opt,name=Address,proto3,customtype=github.com/hyperledger/burrow/crypto.Address" json:",omitempty" toml:",omitempty"`
PublicKey *crypto.PublicKey `protobuf:"bytes,3,opt,name=PublicKey,proto3" json:",omitempty" toml:",omitempty"`
Amounts []balance.Balance `protobuf:"bytes,4,rep,name=Amounts,proto3" json:",omitempty" toml:",omitempty"`
Permissions []string `protobuf:"bytes,5,rep,name=Permissions,proto3" json:",omitempty" toml:",omitempty"`
Roles []string `protobuf:"bytes,6,rep,name=Roles,proto3" json:",omitempty" toml:",omitempty"`
Code *github_com_hyperledger_burrow_acm.Bytecode `protobuf:"bytes,7,opt,name=Code,proto3,customtype=github.com/hyperledger/burrow/acm.Bytecode" json:"Code,omitempty"`
XXX_unrecognized []byte `json:"-"`
}