mirror of https://github.com/ethereum/go-ethereum
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.
67 lines
1.8 KiB
67 lines
1.8 KiB
9 years ago
|
// Copyright 2014 The go-ethereum Authors
|
||
9 years ago
|
// This file is part of the go-ethereum library.
|
||
9 years ago
|
//
|
||
9 years ago
|
// The go-ethereum library is free software: you can redistribute it and/or modify
|
||
9 years ago
|
// it under the terms of the GNU Lesser General Public License as published by
|
||
|
// the Free Software Foundation, either version 3 of the License, or
|
||
|
// (at your option) any later version.
|
||
|
//
|
||
9 years ago
|
// The go-ethereum library is distributed in the hope that it will be useful,
|
||
9 years ago
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
9 years ago
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
9 years ago
|
// GNU Lesser General Public License for more details.
|
||
|
//
|
||
|
// You should have received a copy of the GNU Lesser General Public License
|
||
9 years ago
|
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
|
||
9 years ago
|
|
||
9 years ago
|
package vm
|
||
10 years ago
|
|
||
10 years ago
|
import (
|
||
|
"fmt"
|
||
10 years ago
|
"io"
|
||
10 years ago
|
|
||
10 years ago
|
"github.com/ethereum/go-ethereum/common"
|
||
10 years ago
|
"github.com/ethereum/go-ethereum/rlp"
|
||
10 years ago
|
)
|
||
10 years ago
|
|
||
10 years ago
|
type Log struct {
|
||
|
Address common.Address
|
||
|
Topics []common.Hash
|
||
|
Data []byte
|
||
|
Number uint64
|
||
10 years ago
|
|
||
10 years ago
|
TxHash common.Hash
|
||
|
TxIndex uint
|
||
|
BlockHash common.Hash
|
||
|
Index uint
|
||
10 years ago
|
}
|
||
|
|
||
10 years ago
|
func NewLog(address common.Address, topics []common.Hash, data []byte, number uint64) *Log {
|
||
|
return &Log{Address: address, Topics: topics, Data: data, Number: number}
|
||
10 years ago
|
}
|
||
|
|
||
10 years ago
|
func (self *Log) EncodeRLP(w io.Writer) error {
|
||
|
return rlp.Encode(w, []interface{}{self.Address, self.Topics, self.Data})
|
||
10 years ago
|
}
|
||
|
|
||
10 years ago
|
func (self *Log) String() string {
|
||
10 years ago
|
return fmt.Sprintf(`log: %x %x %x %x %d %x %d`, self.Address, self.Topics, self.Data, self.TxHash, self.TxIndex, self.BlockHash, self.Index)
|
||
10 years ago
|
}
|
||
|
|
||
10 years ago
|
type Logs []*Log
|
||
10 years ago
|
|
||
10 years ago
|
type LogForStorage Log
|
||
|
|
||
|
func (self *LogForStorage) EncodeRLP(w io.Writer) error {
|
||
|
return rlp.Encode(w, []interface{}{
|
||
|
self.Address,
|
||
|
self.Topics,
|
||
|
self.Data,
|
||
|
self.Number,
|
||
|
self.TxHash,
|
||
|
self.TxIndex,
|
||
|
self.BlockHash,
|
||
|
self.Index,
|
||
|
})
|
||
10 years ago
|
}
|