Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add log to debug can't parse issue #65

Merged
merged 1 commit into from
Aug 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading