mirror of
https://github.com/grassrootseconomics/eth-tracker.git
synced 2026-05-15 17:57:11 +02:00
feat: add contract creation handler
This commit is contained in:
27
internal/handler/contract_creation.go
Normal file
27
internal/handler/contract_creation.go
Normal file
@@ -0,0 +1,27 @@
|
||||
package handler
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/grassrootseconomics/eth-tracker/pkg/event"
|
||||
"github.com/grassrootseconomics/eth-tracker/pkg/router"
|
||||
)
|
||||
|
||||
const contractCreationEventName = "CONTRACT_CREATION"
|
||||
|
||||
func HandleContractCreation() router.ContractCreationHandlerFunc {
|
||||
return func(ctx context.Context, ccp router.ContractCreationPayload, c router.Callback) error {
|
||||
contractCreationEvent := event.Event{
|
||||
Block: ccp.Block,
|
||||
ContractAddress: ccp.ContractAddress,
|
||||
Success: ccp.Success,
|
||||
Timestamp: ccp.Timestamp,
|
||||
TxHash: ccp.TxHash,
|
||||
Payload: map[string]any{
|
||||
"from": ccp.From,
|
||||
},
|
||||
}
|
||||
|
||||
return c(ctx, contractCreationEvent)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user