Add raw log to Frob record in DB
- Enables parsing additional values off the log if necessary - Also update Frob to reflect DSS changes (lad => urn) - Move Frob constants to shared directory
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
package test_data
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
"github.com/ethereum/go-ethereum/core/types"
|
||||
@@ -59,21 +60,26 @@ var EthFrobLog = types.Log{
|
||||
}
|
||||
|
||||
var FrobEntity = frob.FrobEntity{
|
||||
Ilk: ilk,
|
||||
Lad: frobLad,
|
||||
Dink: dink,
|
||||
Dart: dart,
|
||||
Ink: ink,
|
||||
Art: art,
|
||||
IArt: iArt,
|
||||
Ilk: ilk,
|
||||
Urn: frobLad,
|
||||
Ink: ink,
|
||||
Art: art,
|
||||
Dink: dink,
|
||||
Dart: dart,
|
||||
IArt: iArt,
|
||||
TransactionIndex: EthFrobLog.TxIndex,
|
||||
Raw: EthFrobLog,
|
||||
}
|
||||
|
||||
var rawFrobLog, _ = json.Marshal(EthFrobLog)
|
||||
var FrobModel = frob.FrobModel{
|
||||
Ilk: ilk[:],
|
||||
Lad: frobLad[:],
|
||||
Dink: dink.String(),
|
||||
Dart: dart.String(),
|
||||
Ink: ink.String(),
|
||||
Art: art.String(),
|
||||
IArt: iArt.String(),
|
||||
Ilk: ilk[:],
|
||||
Urn: frobLad[:],
|
||||
Ink: ink.String(),
|
||||
Art: art.String(),
|
||||
Dink: dink.String(),
|
||||
Dart: dart.String(),
|
||||
IArt: iArt.String(),
|
||||
TransactionIndex: EthFrobLog.TxIndex,
|
||||
Raw: rawFrobLog,
|
||||
}
|
||||
|
||||
@@ -25,21 +25,26 @@ type MockFrobConverter struct {
|
||||
PassedContractABI string
|
||||
PassedLog types.Log
|
||||
PassedEntity frob.FrobEntity
|
||||
converterError error
|
||||
toEntityError error
|
||||
toModelError error
|
||||
}
|
||||
|
||||
func (converter *MockFrobConverter) SetConverterError(err error) {
|
||||
converter.converterError = err
|
||||
func (converter *MockFrobConverter) SetToEntityError(err error) {
|
||||
converter.toEntityError = err
|
||||
}
|
||||
|
||||
func (converter *MockFrobConverter) SetToModelError(err error) {
|
||||
converter.toModelError = err
|
||||
}
|
||||
|
||||
func (converter *MockFrobConverter) ToEntity(contractAddress string, contractAbi string, ethLog types.Log) (frob.FrobEntity, error) {
|
||||
converter.PassedContractAddress = contractAddress
|
||||
converter.PassedContractABI = contractAbi
|
||||
converter.PassedLog = ethLog
|
||||
return test_data.FrobEntity, converter.converterError
|
||||
return test_data.FrobEntity, converter.toEntityError
|
||||
}
|
||||
|
||||
func (converter *MockFrobConverter) ToModel(frobEntity frob.FrobEntity) frob.FrobModel {
|
||||
func (converter *MockFrobConverter) ToModel(frobEntity frob.FrobEntity) (frob.FrobModel, error) {
|
||||
converter.PassedEntity = frobEntity
|
||||
return test_data.FrobModel
|
||||
return test_data.FrobModel, converter.toModelError
|
||||
}
|
||||
|
||||
@@ -25,7 +25,6 @@ type MockFrobRepository struct {
|
||||
PassedFrobModel frob.FrobModel
|
||||
PassedHeaderID int64
|
||||
PassedStartingBlockNumber int64
|
||||
PassedTransactionIndex uint
|
||||
missingHeaders []core.Header
|
||||
missingHeadersErr error
|
||||
}
|
||||
@@ -42,9 +41,8 @@ func (repository *MockFrobRepository) SetMissingHeaders(headers []core.Header) {
|
||||
repository.missingHeaders = headers
|
||||
}
|
||||
|
||||
func (repository *MockFrobRepository) Create(headerID int64, transactionIndex uint, model frob.FrobModel) error {
|
||||
func (repository *MockFrobRepository) Create(headerID int64, model frob.FrobModel) error {
|
||||
repository.PassedHeaderID = headerID
|
||||
repository.PassedTransactionIndex = transactionIndex
|
||||
repository.PassedFrobModel = model
|
||||
return repository.createError
|
||||
}
|
||||
|
||||
@@ -30,12 +30,11 @@ var EthPitFileLog = types.Log{
|
||||
Removed: false,
|
||||
}
|
||||
|
||||
var raw, _ = json.Marshal(EthPitFileLog)
|
||||
|
||||
var rawPitFileLog, _ = json.Marshal(EthPitFileLog)
|
||||
var PitFileModel = pit_file.PitFileModel{
|
||||
Ilk: "fake ilk",
|
||||
What: "spot",
|
||||
Risk: big.NewInt(123).String(),
|
||||
TransactionIndex: EthPitFileLog.TxIndex,
|
||||
Raw: raw,
|
||||
Raw: rawPitFileLog,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user