From 3fb8e13979240791bf9488e0dcb4fa9cc7a97c9e Mon Sep 17 00:00:00 2001 From: Elizabeth Engelman Date: Fri, 9 Aug 2019 15:20:03 -0400 Subject: [PATCH] Update Mappings interface to take a diff as an argument to Lookup --- libraries/shared/factories/storage/transformer.go | 2 +- libraries/shared/mocks/storage_mappings.go | 4 +--- libraries/shared/storage/mappings.go | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/libraries/shared/factories/storage/transformer.go b/libraries/shared/factories/storage/transformer.go index 240924bd..f38b06f2 100644 --- a/libraries/shared/factories/storage/transformer.go +++ b/libraries/shared/factories/storage/transformer.go @@ -42,7 +42,7 @@ func (transformer Transformer) ContractAddress() common.Address { } func (transformer Transformer) Execute(diff utils.StorageDiff) error { - metadata, lookupErr := transformer.Mappings.Lookup(diff.StorageKey) + metadata, lookupErr := transformer.Mappings.Lookup(diff) if lookupErr != nil { return lookupErr } diff --git a/libraries/shared/mocks/storage_mappings.go b/libraries/shared/mocks/storage_mappings.go index d2f681bb..b44620ad 100644 --- a/libraries/shared/mocks/storage_mappings.go +++ b/libraries/shared/mocks/storage_mappings.go @@ -17,8 +17,6 @@ package mocks import ( - "github.com/ethereum/go-ethereum/common" - "github.com/vulcanize/vulcanizedb/libraries/shared/storage/utils" "github.com/vulcanize/vulcanizedb/pkg/datastore/postgres" ) @@ -29,7 +27,7 @@ type MockMappings struct { LookupErr error } -func (mappings *MockMappings) Lookup(key common.Hash) (utils.StorageValueMetadata, error) { +func (mappings *MockMappings) Lookup(diff utils.StorageDiff) (utils.StorageValueMetadata, error) { mappings.LookupCalled = true return mappings.Metadata, mappings.LookupErr } diff --git a/libraries/shared/storage/mappings.go b/libraries/shared/storage/mappings.go index 18878683..0c8abc37 100644 --- a/libraries/shared/storage/mappings.go +++ b/libraries/shared/storage/mappings.go @@ -27,7 +27,7 @@ import ( ) type Mappings interface { - Lookup(key common.Hash) (utils.StorageValueMetadata, error) + Lookup(diff utils.StorageDiff) (utils.StorageValueMetadata, error) SetDB(db *postgres.DB) }