aboutsummaryrefslogtreecommitdiffstats
path: root/vm/log.go
diff options
context:
space:
mode:
Diffstat (limited to 'vm/log.go')
-rw-r--r--vm/log.go33
1 files changed, 31 insertions, 2 deletions
diff --git a/vm/log.go b/vm/log.go
index 954d2ec91..bc72a0423 100644
--- a/vm/log.go
+++ b/vm/log.go
@@ -1,9 +1,38 @@
package vm
-import "math/big"
+import "github.com/ethereum/go-ethereum/ethutil"
type Log struct {
Address []byte
- Topics []*big.Int
+ Topics [][]byte
Data []byte
}
+
+func NewLogFromValue(decoder *ethutil.Value) Log {
+ log := Log{
+ Address: decoder.Get(0).Bytes(),
+ Data: decoder.Get(2).Bytes(),
+ }
+
+ it := decoder.Get(1).NewIterator()
+ for it.Next() {
+ log.Topics = append(log.Topics, it.Value().Bytes())
+ }
+
+ return log
+}
+
+func (self Log) RlpData() interface{} {
+ return []interface{}{self.Address, ethutil.ByteSliceToInterface(self.Topics), self.Data}
+}
+
+type Logs []Log
+
+func (self Logs) RlpData() interface{} {
+ data := make([]interface{}, len(self))
+ for i, log := range self {
+ data[i] = log.RlpData()
+ }
+
+ return data
+}