Skip to content

Commit

Permalink
Fix: bridge unlock balance updates
Browse files Browse the repository at this point in the history
  • Loading branch information
aopoltorzhicky committed Sep 21, 2024
1 parent f5a7eb6 commit dd515f1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions pkg/indexer/decode/actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -677,13 +677,13 @@ func parseBridgeUnlock(body *astria.Action_BridgeUnlockAction, from string, heig
}

decAmount := decimal.RequireFromString(amount)
toAddr := ctx.Addresses.Set(toAddress, height, decAmount, "", 1, 0)
toAddr := ctx.Addresses.Set(toAddress, height, decAmount, feeAsset, 1, 0)

var fromAddr *storage.Address
if bridge == "" {
fromAddr = ctx.Addresses.Set(from, height, decAmount.Neg(), "", 1, 0)
fromAddr = ctx.Addresses.Set(from, height, decAmount.Neg(), feeAsset, 1, 0)
} else {
fromAddr = ctx.Addresses.Set(bridge, height, decAmount.Neg(), "", 1, 0)
fromAddr = ctx.Addresses.Set(bridge, height, decAmount.Neg(), feeAsset, 1, 0)
}

action.Addresses = append(action.Addresses,
Expand Down
4 changes: 2 additions & 2 deletions pkg/indexer/decode/actions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,7 @@ func TestDecodeActions(t *testing.T) {
SignedTxCount: 0,
Balance: []*storage.Balance{
{
Currency: currency.DefaultCurrency,
Currency: feeAssetId,
Total: decimal.RequireFromString("10"),
},
},
Expand All @@ -697,7 +697,7 @@ func TestDecodeActions(t *testing.T) {
SignedTxCount: 0,
Balance: []*storage.Balance{
{
Currency: currency.DefaultCurrency,
Currency: feeAssetId,
Total: decimal.RequireFromString("-10"),
},
},
Expand Down

0 comments on commit dd515f1

Please sign in to comment.