Skip to content

Commit

Permalink
test working
Browse files Browse the repository at this point in the history
  • Loading branch information
serichoi65 committed Feb 12, 2025
1 parent 2453fb0 commit 3f86293
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 61 deletions.
61 changes: 0 additions & 61 deletions pkg/contractManager/contractManager.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,64 +43,3 @@ func (cm *ContractManager) GetContractWithProxy(

return contract, nil
}

func (cm *ContractManager) CreateProxyContract(
contractAddress string,
proxyContractAddress string,
blockNumber uint64,
reindexContract bool,
) (*contractStore.ProxyContract, error) {
proxyContract, found, err := cm.ContractStore.FindOrCreateProxyContract(blockNumber, contractAddress, proxyContractAddress)
if err != nil {
cm.Logger.Sugar().Errorw("Failed to create proxy contract",
zap.Error(err),
zap.String("contractAddress", contractAddress),
zap.String("proxyContractAddress", proxyContractAddress),
)
} else {
if found {
cm.Logger.Sugar().Debugw("Found existing proxy contract",
zap.String("contractAddress", contractAddress),
zap.String("proxyContractAddress", proxyContractAddress),
)
} else {
cm.Logger.Sugar().Debugw("Created proxy contract",
zap.String("contractAddress", contractAddress),
zap.String("proxyContractAddress", proxyContractAddress),
)
}
}
// Check to see if the contract we're proxying to is already in the database
proxiedContract, err := cm.ContractStore.GetContractForAddress(proxyContractAddress)
if err != nil {
cm.Logger.Sugar().Errorw("Failed to get contract for address",
zap.Error(err),
zap.String("contractAddress", proxyContractAddress),
)
}
if proxiedContract != nil {
cm.Logger.Sugar().Debugw("Found proxied contract",
zap.String("contractAddress", proxyContractAddress),
zap.String("proxiedContractAddress", proxiedContract.ContractAddress),
)
if proxiedContract.ContractAbi == "" {
updatedContract := cm.FindAndSetContractAbi(proxyContractAddress)
if updatedContract != nil {
proxiedContract = updatedContract
}
}
} else {
_, err := cm.CreateContract(proxyContractAddress, "", reindexContract)
if err != nil {
cm.Logger.Sugar().Errorw("Failed to create contract",
zap.Error(err),
zap.String("contractAddress", proxyContractAddress),
)
} else {
cm.Logger.Sugar().Debugw("Created contract",
zap.String("contractAddress", proxyContractAddress),
)
}
}
return proxyContract, nil
}
1 change: 1 addition & 0 deletions pkg/fetcher/fetcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"github.com/Layr-Labs/sidecar/internal/config"
"github.com/Layr-Labs/sidecar/pkg/clients/ethereum"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/pkg/errors"
"go.uber.org/zap"
"slices"
Expand Down

0 comments on commit 3f86293

Please sign in to comment.