Skip to content

Commit dd663ba

Browse files
Merge branch 'master' into cel2
2 parents 9d36e91 + 5cf5f98 commit dd663ba

1 file changed

Lines changed: 20 additions & 3 deletions

File tree

internal/cache/bootstrap.go

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@ func bootstrapCache(
2222
lo *slog.Logger,
2323
) error {
2424
var (
25-
tokenRegistryGetter = w3.MustNewFunc("tokenRegistry()", "address")
26-
quoterGetter = w3.MustNewFunc("quoter()", "address")
25+
tokenRegistryGetter = w3.MustNewFunc("tokenRegistry()", "address")
26+
quoterGetter = w3.MustNewFunc("quoter()", "address")
27+
systemAcccountGetter = w3.MustNewFunc("systemAccount()", "address")
2728
)
2829

2930
ctx, cancel := context.WithTimeout(context.Background(), time.Minute*5)
@@ -46,6 +47,23 @@ func bootstrapCache(
4647
}
4748
}
4849

50+
if custodialRegistrationProxy := registryMap[ethutils.CustodialProxy]; custodialRegistrationProxy != ethutils.ZeroAddress {
51+
var systemAccount common.Address
52+
err := chain.Provider().Client.CallCtx(
53+
ctx,
54+
eth.CallFunc(custodialRegistrationProxy, systemAcccountGetter).Returns(&systemAccount),
55+
)
56+
if err != nil {
57+
return err
58+
}
59+
if systemAccount != ethutils.ZeroAddress {
60+
if err := cache.Add(ctx, systemAccount.Hex()); err != nil {
61+
return err
62+
}
63+
lo.Debug("cached custodial system account", "address", systemAccount.Hex())
64+
}
65+
}
66+
4967
if accountIndex := registryMap[ethutils.AccountIndex]; accountIndex != ethutils.ZeroAddress {
5068
if err := cache.Add(ctx, accountIndex.Hex()); err != nil {
5169
return err
@@ -103,7 +121,6 @@ func bootstrapCache(
103121
if err := cache.Add(ctx, address.Hex()); err != nil {
104122
return err
105123
}
106-
107124
}
108125
}
109126
lo.Debug("cached token index batch", "batch_size", len(tokenIndexBatch))

0 commit comments

Comments
 (0)