2018-10-25 01:37:12 +00:00
|
|
|
package mocks
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/ethereum/go-ethereum/core/types"
|
|
|
|
)
|
|
|
|
|
|
|
|
type MockConverter struct {
|
2018-10-26 18:26:10 +00:00
|
|
|
ToEntitiesError error
|
|
|
|
ToModelsError error
|
|
|
|
ContractAbi string
|
|
|
|
LogsToConvert []types.Log
|
|
|
|
EntitiesToConvert []interface{}
|
|
|
|
EntitiesToReturn []interface{}
|
|
|
|
ModelsToReturn []interface{}
|
2018-10-25 01:37:12 +00:00
|
|
|
}
|
|
|
|
|
2018-10-26 18:26:10 +00:00
|
|
|
func (converter *MockConverter) ToEntities(contractAbi string, ethLogs []types.Log) ([]interface{}, error) {
|
|
|
|
converter.ContractAbi = contractAbi
|
|
|
|
converter.LogsToConvert = ethLogs
|
|
|
|
return converter.EntitiesToReturn, converter.ToEntitiesError
|
2018-10-25 01:37:12 +00:00
|
|
|
}
|
|
|
|
|
2018-10-26 18:26:10 +00:00
|
|
|
func (converter *MockConverter) ToModels(entities []interface{}) ([]interface{}, error) {
|
|
|
|
converter.EntitiesToConvert = entities
|
|
|
|
return converter.ModelsToReturn, converter.ToModelsError
|
2018-10-25 01:37:12 +00:00
|
|
|
}
|