From aee26b27371f40d4453679a070a243dac072ceaf Mon Sep 17 00:00:00 2001 From: Nguyen Thuy Linh Date: Tue, 5 Nov 2024 10:31:39 +0700 Subject: [PATCH 1/2] refactor log order --- internal/worker/worker.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/worker/worker.go b/internal/worker/worker.go index 99b5256..d3d9622 100644 --- a/internal/worker/worker.go +++ b/internal/worker/worker.go @@ -101,10 +101,10 @@ func (w *Worker) processMessages(m []evmlistenerclient.Message) error { } order, err := ps.Parse(ethLog, block.Timestamp) if err != nil { + w.l.Errorw("error when parse log", "log", log, "order", order, "err", err) if err = metrics.RecordCounter(context.Background(), ParsingErrorMetricName, 1); err != nil { w.l.Errorw("error when record parsing error", "err", err) } - w.l.Errorw("error when parse log", "log", log, "order", order, "err", err) if err := w.s.InsertErrorLog(storage.EVMLog{ Address: log.Address, Topics: strings.Join(log.Topics, ","), @@ -168,10 +168,10 @@ func (w *Worker) retryParseLog() error { } order, err := ps.Parse(ethLog, l.Time) if err != nil { + w.l.Errorw("error when retry log", "log", l, "err", err) if err := metrics.RecordCounter(context.Background(), ParsingErrorMetricName, 1); err != nil { w.l.Errorw("error when record parsing error", "err", err) } - w.l.Errorw("error when retry log", "log", l, "err", err) continue } From 0d70d6dc832714dd95510b2ff3bc28cfe842e48a Mon Sep 17 00:00:00 2001 From: "minhthanh.vu" Date: Tue, 5 Nov 2024 10:42:56 +0700 Subject: [PATCH 2/2] fix spelling --- pkg/parser/pancakeswap/parser.go | 6 +++--- pkg/parser/parser.go | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/parser/pancakeswap/parser.go b/pkg/parser/pancakeswap/parser.go index 0952be4..7749012 100644 --- a/pkg/parser/pancakeswap/parser.go +++ b/pkg/parser/pancakeswap/parser.go @@ -286,7 +286,7 @@ func hasFillingRights(exclusive, sender common.Address, exclusivityEndTime, bloc } func (p *Parser) Exchange() string { - return parser.ExPancackeSwap + return parser.ExPancakeSwap } func (p *Parser) UseTraceCall() bool { @@ -306,11 +306,11 @@ func (p *Parser) ParseWithCallFrame(callFrame types.CallFrame, log ethereumTypes } func (p *Parser) LogFromExchange(log ethereumTypes.Log) bool { - return strings.EqualFold(log.Address.String(), parser.AddrPancakewap) && + return strings.EqualFold(log.Address.String(), parser.AddrPancakeswap) && len(log.Topics) > 0 && strings.EqualFold(log.Topics[0].String(), p.eventHash) } func (p *Parser) Address() string { - return parser.AddrPancakewap + return parser.AddrPancakeswap } diff --git a/pkg/parser/parser.go b/pkg/parser/parser.go index 86b8d97..d83e2c8 100644 --- a/pkg/parser/parser.go +++ b/pkg/parser/parser.go @@ -25,7 +25,7 @@ const ( ExNative = "native" ExBebop = "bebop" ExUniswapXV1 = "uniswapxV1" - ExPancackeSwap = "pancakeswap" + ExPancakeSwap = "pancakeswap" Addr1InchV6 = "0x111111125421cA6dc452d289314280a0f8842A65" AddrBebop = "0xbbbbbBB520d69a9775E85b458C58c648259FAD5F" @@ -37,7 +37,7 @@ const ( AddrUniswapXV1 = "0x6000da47483062A0D734Ba3dc7576Ce6A0B645C4" Addr0x = "0xDef1C0ded9bec7F1a1670819833240f027b25EfF" Deployer0xV3 = "0x00000000000004533Fe15556B1E086BB1A72cEae" - AddrPancakewap = "0x35db01D1425685789dCc9228d47C7A5C049388d8" + AddrPancakeswap = "0x35db01D1425685789dCc9228d47C7A5C049388d8" AddrParaswapTaker = "0xDEF171Fe48CF0115B1d80b88dc8eAB59176FEe57" )