Skip to content

Commit 2453fb0

Browse files
committed
fix
1 parent bfeb579 commit 2453fb0

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

pkg/indexer/indexer.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"github.com/Layr-Labs/sidecar/pkg/fetcher"
1111
"github.com/Layr-Labs/sidecar/pkg/parser"
1212
"github.com/Layr-Labs/sidecar/pkg/storage"
13+
"github.com/ethereum/go-ethereum/common"
1314
"gorm.io/gorm"
1415
"slices"
1516
"strings"
@@ -156,7 +157,7 @@ func (idx *Indexer) ParseInterestingTransactionsAndLogs(ctx context.Context, fet
156157
return parsedTransactions, nil
157158
}
158159

159-
func (idx *Indexer) IndexContractUpgrade(ctx context.Context, blockNumber uint64, upgradedLog *storage.TransactionLog) error {
160+
func (idx *Indexer) IndexContractUpgrade(ctx context.Context, blockNumber uint64, upgradedLog *parser.DecodedLog) error {
160161
// the new address that the contract points to
161162
newProxiedAddress := ""
162163

@@ -175,17 +176,18 @@ func (idx *Indexer) IndexContractUpgrade(ctx context.Context, blockNumber uint64
175176
idx.Logger.Sugar().Errorw("Failed to get storage value",
176177
zap.Error(err),
177178
zap.Uint64("block", blockNumber),
178-
zap.String("upgradedLogAddress", upgradedLog.Address)
179+
zap.String("upgradedLogAddress", upgradedLog.Address),
179180
)
180181
return err
182+
}
181183
if len(storageValue) != 66 {
182184
idx.Logger.Sugar().Errorw("Invalid storage value",
183185
zap.Uint64("block", blockNumber),
184-
zap.String("storageValue", storageValue)
186+
zap.String("storageValue", storageValue),
185187
)
186188
return err
187189
}
188-
190+
189191
newProxiedAddress = storageValue[26:]
190192
}
191193

@@ -194,7 +196,7 @@ func (idx *Indexer) IndexContractUpgrade(ctx context.Context, blockNumber uint64
194196
return nil
195197
}
196198

197-
_, err := idx.ContractManager.CreateProxyContract(upgradedLog.Address, newProxiedAddress, blockNumber, reindexContract)
199+
_, _, err := idx.ContractStore.FindOrCreateProxyContract(blockNumber, upgradedLog.Address, newProxiedAddress)
198200
if err != nil {
199201
idx.Logger.Sugar().Errorw("Failed to create proxy contract", zap.Error(err))
200202
return err

0 commit comments

Comments
 (0)