Official Go implementation of the Ethereum protocol
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
go-ethereum/core/state/log.go

44 lines
860 B

10 years ago
package state
10 years ago
import (
"fmt"
10 years ago
"io"
10 years ago
"github.com/ethereum/go-ethereum/common"
10 years ago
"github.com/ethereum/go-ethereum/rlp"
10 years ago
)
type Log struct {
Address common.Address
Topics []common.Hash
Data []byte
Number uint64
TxHash common.Hash
TxIndex uint
BlockHash common.Hash
Index uint
}
func NewLog(address common.Address, topics []common.Hash, data []byte, number uint64) *Log {
return &Log{Address: address, Topics: topics, Data: data, Number: number}
}
func (self *Log) EncodeRLP(w io.Writer) error {
return rlp.Encode(w, []interface{}{self.Address, self.Topics, self.Data})
}
func (self *Log) String() string {
return fmt.Sprintf(`log: %x %x %x`, self.Address, self.Topics, self.Data)
}
type Logs []*Log
10 years ago
func (self Logs) String() (ret string) {
10 years ago
for _, log := range self {
ret += fmt.Sprintf("%v", log)
10 years ago
}
return "[" + ret + "]"
10 years ago
}