diff --git a/cmd/indexer/indexer/indexer.go b/cmd/indexer/indexer/indexer.go index 6eeed46da..b615d1ef1 100644 --- a/cmd/indexer/indexer/indexer.go +++ b/cmd/indexer/indexer/indexer.go @@ -460,7 +460,7 @@ func (bi *BlockchainIndexer) implicitMigration(ctx context.Context, block *Block return err } - implicitParser, err := migrations.NewImplicitParser(bi.Context, bi.RPC, specific.ContractParser, protocol) + implicitParser, err := migrations.NewImplicitParser(bi.Context, bi.RPC, specific.ContractParser, protocol, bi.Contracts) if err != nil { return err } diff --git a/internal/parsers/migrations/implicit.go b/internal/parsers/migrations/implicit.go index ee9d1d814..453871255 100644 --- a/internal/parsers/migrations/implicit.go +++ b/internal/parsers/migrations/implicit.go @@ -7,6 +7,7 @@ import ( "github.com/baking-bad/bcdhub/internal/config" "github.com/baking-bad/bcdhub/internal/logger" "github.com/baking-bad/bcdhub/internal/models/account" + contracts "github.com/baking-bad/bcdhub/internal/models/contract" "github.com/baking-bad/bcdhub/internal/models/migration" "github.com/baking-bad/bcdhub/internal/models/operation" "github.com/baking-bad/bcdhub/internal/models/protocol" @@ -23,11 +24,16 @@ type ImplicitParser struct { rpc noderpc.INode contractParser contract.Parser protocol protocol.Protocol + contractsRepo contracts.Repository } // NewImplicitParser - -func NewImplicitParser(ctx *config.Context, rpc noderpc.INode, contractParser contract.Parser, protocol protocol.Protocol) (*ImplicitParser, error) { - return &ImplicitParser{ctx, rpc, contractParser, protocol}, nil +func NewImplicitParser(ctx *config.Context, + rpc noderpc.INode, + contractParser contract.Parser, + protocol protocol.Protocol, + contractsRepo contracts.Repository) (*ImplicitParser, error) { + return &ImplicitParser{ctx, rpc, contractParser, protocol, contractsRepo}, nil } // Parse - @@ -57,6 +63,9 @@ func (p *ImplicitParser) IsMigratable(address string) bool { } func (p *ImplicitParser) origination(ctx context.Context, implicit noderpc.ImplicitOperationsResult, head noderpc.Header, store parsers.Store) error { + if _, err := p.contractsRepo.Get(implicit.OriginatedContracts[0]); err == nil { + return nil + } origination := operation.Operation{ ProtocolID: p.protocol.ID, Level: head.Level, diff --git a/internal/parsers/migrations/jakarta.go b/internal/parsers/migrations/jakarta.go index f3a5b7118..de9d389c7 100644 --- a/internal/parsers/migrations/jakarta.go +++ b/internal/parsers/migrations/jakarta.go @@ -71,6 +71,7 @@ func NewJakarta() *Jakarta { "KT1QwBaLj5TRaGU3qkU4ZKKQ5mvNvyyzGBFv": {}, "KT1TxqZ8QtKvLu3V3JH7Gx58n7Co8pgtpQU5": {}, "KT1VqarPDicMFn1ejmQqqshUkUXTCTXwmkCN": {}, + "KT1AafHA1C1vk959wvHWBispY9Y2f3fxBUUo": {}, }, } }