forked from cerc-io/ipld-eth-server
6decf0b54b
* Rename geth package structs to not be prefaced with package name * No longer need to dump schema since Travis uses migrate * Rearrange history package * Removed double request for receipt from block rewards * Remove Listener + Observers and Replace w/ Polling Head * Potential Short term Issue w/ Infura (ignore these tests for now)
34 lines
773 B
Go
34 lines
773 B
Go
package geth
|
|
|
|
import (
|
|
"github.com/8thlight/vulcanizedb/pkg/core"
|
|
"github.com/ethereum/go-ethereum/common/hexutil"
|
|
"github.com/ethereum/go-ethereum/core/types"
|
|
)
|
|
|
|
func LogToCoreLog(gethLog types.Log) core.Log {
|
|
topics := gethLog.Topics
|
|
var hexTopics = make(map[int]string)
|
|
for i, topic := range topics {
|
|
hexTopics[i] = topic.Hex()
|
|
}
|
|
return core.Log{
|
|
Address: gethLog.Address.Hex(),
|
|
|
|
BlockNumber: int64(gethLog.BlockNumber),
|
|
Topics: hexTopics,
|
|
TxHash: gethLog.TxHash.Hex(),
|
|
Index: int64(gethLog.Index),
|
|
Data: hexutil.Encode(gethLog.Data),
|
|
}
|
|
}
|
|
|
|
func GethLogsToCoreLogs(gethLogs []types.Log) []core.Log {
|
|
var logs []core.Log
|
|
for _, log := range gethLogs {
|
|
log := LogToCoreLog(log)
|
|
logs = append(logs, log)
|
|
}
|
|
return logs
|
|
}
|