Skip to content

Commit

Permalink
add log to debug can't parse issue (#65)
Browse files Browse the repository at this point in the history
  • Loading branch information
ngocthanh1389 authored Aug 19, 2024
1 parent 023f5df commit 31e8a90
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion internal/app/rpcnode.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ var (
Name: RPCUrlFlagName,
EnvVar: "RPC_URL",
Usage: "RPC node url",
Value: "https://ethereum.kyberengineering.io/trading-ethereum",
Value: "https://ethereum.kyberengineering.io/trading-tokyo",
}
)

Expand Down
16 changes: 8 additions & 8 deletions pkg/parser/oneinchv6/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func (p *Parser) buildOrderByLog(log ethereumTypes.Log) (storage.TradeLog, error
}
e, err := p.ps.ParseOrderFilled(log)
if err != nil {
return storage.TradeLog{}, err
return storage.TradeLog{}, fmt.Errorf("error when parse log %w", err)
}
order := storage.TradeLog{
OrderHash: common.Hash(e.OrderHash).String(),
Expand All @@ -116,7 +116,7 @@ func (p *Parser) ParseFromInternalCall(order storage.TradeLog, internalCall type
}
filledMakingAmount, filledTakingAmount, orderHash, err := p.decodeOutput(output)
if err != nil {
return order, err
return order, fmt.Errorf("error when decode output %w", err)
}

order.OrderHash = orderHash
Expand All @@ -126,12 +126,12 @@ func (p *Parser) ParseFromInternalCall(order storage.TradeLog, internalCall type

contractCall, err := decoder.Decode(p.abi, internalCall.Input)
if err != nil {
return order, err
return order, fmt.Errorf("error when decode input %w", err)
}

order, err = ToTradeLog(order, contractCall)
if err != nil {
return order, err
return order, fmt.Errorf("error when parse contract call to order %w", err)
}

return order, nil
Expand All @@ -145,13 +145,14 @@ func (p *Parser) detectOneInchRfqTrade(order storage.TradeLog) (storage.TradeLog

traceCall, err = p.traceCalls.GetTraceCall(order.TxHash)
if err != nil {
return order, err
return order, fmt.Errorf("error when get tracecall %w", err)
}

count := 0
order, err = p.recursiveDetectOneInchRFQTrades(order, traceCall, &count)
if err != nil {
return order, err
traceData, _ := json.Marshal(traceCall)
return order, fmt.Errorf("error when parse tracecall %s %w", string(traceData), err)
}

return order, nil
Expand All @@ -172,8 +173,7 @@ func (p *Parser) recursiveDetectOneInchRFQTrades(tradeLog storage.TradeLog, trac
}
}

traceData, _ := json.Marshal(traceCall)
return tradeLog, fmt.Errorf("%w %s", parser.ErrNotFoundTrade, string(traceData))
return tradeLog, parser.ErrNotFoundTrade
}

func (p *Parser) isOneInchRFQTrades(txHash, orderHash string, traceCall types.CallFrame, count *int) bool {
Expand Down

0 comments on commit 31e8a90

Please sign in to comment.