Skip to content

Commit

Permalink
fix missing tokens from es
Browse files Browse the repository at this point in the history
  • Loading branch information
miiu96 committed Dec 27, 2024
1 parent 54bce4b commit 6e5bcf5
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 1 deletion.
2 changes: 1 addition & 1 deletion outport/process/alteredaccounts/tokensProcessor.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ func (tp *tokensProcessor) processMultiTransferEvent(event data.EventHandler, ma

if string(tokenID) == vmcommon.EGLDIdentifier {
tp.processNativeEGLDTransferWithMultiTransfer(destinationAddress, markedAlteredAccounts)
return
continue
}

// process event for the sender address
Expand Down
43 changes: 43 additions & 0 deletions outport/process/alteredaccounts/tokensProcessor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,46 @@ func TestTokenProcessorProcessEventMultiTransferV2WithEGLD(t *testing.T) {
}
require.Equal(t, markedAccount2, markedAccounts["receiver"])
}

func TestTokenProcessorProcessEventMultiTransferV2WithEGLDAndMoreTokens(t *testing.T) {
t.Parallel()

tp := newTokensProcessor(&mock.ShardCoordinatorStub{})

markedAccounts := make(map[string]*markedAlteredAccount)
tp.processEvent(&transaction.Event{
Identifier: []byte(core.BuiltInFunctionMultiESDTNFTTransfer),
Address: []byte("addr"),
Topics: [][]byte{[]byte("token1"), big.NewInt(0).Bytes(), []byte("2"), []byte(vmcommon.EGLDIdentifier), big.NewInt(0).Bytes(), []byte("3"), []byte("token2"), big.NewInt(0).Bytes(), []byte("2"), []byte("receiver")},
}, markedAccounts)

require.Equal(t, 2, len(markedAccounts))
markedAccount1 := &markedAlteredAccount{
tokens: map[string]*markedAlteredAccountToken{
"token1": {
identifier: "token1",
nonce: 0,
},
"token2": {
identifier: "token2",
nonce: 0,
},
},
}
require.Equal(t, markedAccount1, markedAccounts["addr"])

markedAccount2 := &markedAlteredAccount{
balanceChanged: true,
tokens: map[string]*markedAlteredAccountToken{
"token1": {
identifier: "token1",
nonce: 0,
},
"token2": {
identifier: "token2",
nonce: 0,
},
},
}
require.Equal(t, markedAccount2, markedAccounts["receiver"])
}

0 comments on commit 6e5bcf5

Please sign in to comment.