Skip to content

Commit b5a7d8b

Browse files
committed
Signed-off-by: zhoufanjin <[email protected]>
refactor: using slices.Contains to simplify the code Signed-off-by: zhoufanjin <[email protected]>
1 parent 49af443 commit b5a7d8b

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

Diff for: protocol/get_events.go

+2-6
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"encoding/json"
55
"errors"
66
"fmt"
7+
"slices"
78
"strings"
89

910
"github.com/stellar/go/strkey"
@@ -212,12 +213,7 @@ func (e *EventFilter) matchesContractIDs(event xdr.ContractEvent) bool {
212213
return false
213214
}
214215
needle := strkey.MustEncode(strkey.VersionByteContract, (*event.ContractId)[:])
215-
for _, id := range e.ContractIDs {
216-
if id == needle {
217-
return true
218-
}
219-
}
220-
return false
216+
return slices.Contains(e.ContractIDs, needle)
221217
}
222218

223219
func (e *EventFilter) matchesTopics(event xdr.ContractEvent) bool {

0 commit comments

Comments
 (0)