mirror of
https://github.com/grassrootseconomics/eth-tracker.git
synced 2025-07-04 21:52:50 +02:00
feat: cache systemSigner account to index custodial contract deployments
This commit is contained in:
parent
20ba62f313
commit
5cf5f9894c
23
internal/cache/bootstrap.go
vendored
23
internal/cache/bootstrap.go
vendored
@ -22,8 +22,9 @@ func bootstrapCache(
|
||||
lo *slog.Logger,
|
||||
) error {
|
||||
var (
|
||||
tokenRegistryGetter = w3.MustNewFunc("tokenRegistry()", "address")
|
||||
quoterGetter = w3.MustNewFunc("quoter()", "address")
|
||||
tokenRegistryGetter = w3.MustNewFunc("tokenRegistry()", "address")
|
||||
quoterGetter = w3.MustNewFunc("quoter()", "address")
|
||||
systemAcccountGetter = w3.MustNewFunc("systemAccount()", "address")
|
||||
)
|
||||
|
||||
ctx, cancel := context.WithTimeout(context.Background(), time.Minute*5)
|
||||
@ -46,6 +47,23 @@ func bootstrapCache(
|
||||
}
|
||||
}
|
||||
|
||||
if custodialRegistrationProxy := registryMap[ethutils.CustodialProxy]; custodialRegistrationProxy != ethutils.ZeroAddress {
|
||||
var systemAccount common.Address
|
||||
err := chain.Provider().Client.CallCtx(
|
||||
ctx,
|
||||
eth.CallFunc(custodialRegistrationProxy, systemAcccountGetter).Returns(&systemAccount),
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if systemAccount != ethutils.ZeroAddress {
|
||||
if err := cache.Add(ctx, systemAccount.Hex()); err != nil {
|
||||
return err
|
||||
}
|
||||
lo.Debug("cached custodial system account", "address", systemAccount.Hex())
|
||||
}
|
||||
}
|
||||
|
||||
if accountIndex := registryMap[ethutils.AccountIndex]; accountIndex != ethutils.ZeroAddress {
|
||||
if err := cache.Add(ctx, accountIndex.Hex()); err != nil {
|
||||
return err
|
||||
@ -103,7 +121,6 @@ func bootstrapCache(
|
||||
if err := cache.Add(ctx, address.Hex()); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
lo.Debug("cached token index batch", "batch_size", len(tokenIndexBatch))
|
||||
|
Loading…
Reference in New Issue
Block a user