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

Optimize Velar exchange scraper transaction fetching #1160

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
12 changes: 11 additions & 1 deletion pkg/dia/scraper/exchange-scrapers/VelarScraper.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,17 @@ func (s *VelarScraper) Update() error {
}

if swapInfo.TokenIn == "" || swapInfo.TokenOut == "" {
for _, arg := range tx.ContractCall.FunctionArgs {
// This is a temporary workaround introduced due to a bug in hiro stacks API.
// Results returned from /blocks/{block_height}/transactions route have empty
// `name` field in `contract_call.function_args` list.
// TODO: remove this as soon as the issue is fixed.
normalizedTx, err := s.api.GetTransactionAt(tx.TxID)
if err != nil {
s.logger.WithError(err).Error("failed to GetTransactionAt")
continue
}

for _, arg := range normalizedTx.ContractCall.FunctionArgs {
switch arg.Name {
case "token-in":
swapInfo.TokenIn = arg.Repr[1:]
Expand Down