feat: cache contracts created by other cached accounts for instant indexing

This commit is contained in:
2025-07-03 11:52:35 +03:00
parent ef28ec1298
commit 679d7f9927
2 changed files with 6 additions and 2 deletions

View File

@@ -9,7 +9,7 @@ import (
const contractCreationEventName = "CONTRACT_CREATION"
func HandleContractCreation() router.ContractCreationHandlerFunc {
func HandleContractCreation(hc *HandlerContainer) router.ContractCreationHandlerFunc {
return func(ctx context.Context, ccp router.ContractCreationPayload, c router.Callback) error {
contractCreationEvent := event.Event{
Block: ccp.Block,
@@ -23,6 +23,10 @@ func HandleContractCreation() router.ContractCreationHandlerFunc {
},
}
if err := hc.cache.Add(ctx, ccp.ContractAddress); err != nil {
return err
}
return c(ctx, contractCreationEvent)
}
}