Skip to content

Commit

Permalink
Fix: counter in transfers
Browse files Browse the repository at this point in the history
  • Loading branch information
aopoltorzhicky authored and m-kus committed Oct 13, 2020
1 parent 1d57bee commit 95f59bc
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 16 deletions.
10 changes: 5 additions & 5 deletions cmd/indexer/config.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ indexer:
networks:
mainnet:
boost: tzkt
carthagenet:
boost: tzkt
delphinet:
boost: tzkt
dalphanet:
# carthagenet:
# boost: tzkt
# delphinet:
# boost: tzkt
# dalphanet:
23 changes: 16 additions & 7 deletions internal/parsers/opg.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,14 @@ func (p *OPGParser) Parse(opg gjson.Result, network string, head noderpc.Header)
return nil, err
}

transfers, err := p.transferParser.Parse(mainOperation)
if err != nil {
return nil, err
}
for i := range transfers {
resultModels = append(resultModels, transfers[i])
}

if len(resultModels) > 0 {
parsedModels = append(parsedModels, resultModels...)
}
Expand Down Expand Up @@ -147,13 +155,6 @@ func (p *OPGParser) parseTransaction(data gjson.Result, network, hash string, he
if err := p.tagOperation(&op); err != nil {
return nil, op, err
}
transfers, err := p.transferParser.Parse(op)
if err != nil {
return nil, op, err
}
for i := range transfers {
transactionModels = append(transactionModels, transfers[i])
}
return transactionModels, op, nil
}

Expand Down Expand Up @@ -381,6 +382,14 @@ func (p *OPGParser) parseInternalOperations(item gjson.Result, main models.Opera

nonce := op.Get("nonce").Int()
internalOperation.Nonce = &nonce

transfers, err := p.transferParser.Parse(*internalOperation)
if err != nil {
return nil, err
}
for i := range transfers {
internalModels = append(internalModels, transfers[i])
}
}

internalModels = append(internalModels, parsedModels[j])
Expand Down
4 changes: 0 additions & 4 deletions internal/parsers/transfer/transfer.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@ func (p Parser) makeFA12Transfers(operation models.Operation, parameters gjson.R
}
transfer.From = fromAddr
transfer.To = toAddr
transfer.Nonce = operation.Nonce
transfer.Counter = operation.Counter
transfer.Amount = parameters.Get("args.1.args.1.int").Float()
return []*models.Transfer{transfer}, nil
}
Expand All @@ -83,8 +81,6 @@ func (p Parser) makeFA2Transfers(operation models.Operation, parameters gjson.Re
transfer.To = toAddr
transfer.Amount = to.Get("args.1.args.1.int").Float()
transfer.TokenID = to.Get("args.1.args.0.int").Int()
transfer.Nonce = operation.Nonce
transfer.Counter = operation.Counter
transfers = append(transfers, transfer)
}
}
Expand Down

0 comments on commit 95f59bc

Please sign in to comment.