mirror of
https://github.com/grassrootseconomics/eth-tracker.git
synced 2026-05-16 18:05:20 +02:00
feat: cache contracts created by other cached accounts for instant indexing
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user