Fix: the validation of collectibles should not be dependent on capitalization (#4917)

This commit is contained in:
Mikhail Rogachev 2024-03-13 15:19:33 +01:00 committed by GitHub
parent 9db149d4f6
commit b987e8d6f5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 3 deletions

View File

@ -9,6 +9,7 @@ import (
"math/big"
"reflect"
"sort"
"strings"
"github.com/golang/protobuf/proto"
"go.uber.org/zap"
@ -73,10 +74,11 @@ func (m *Messenger) validateCollectiblesOwnership(accounts []*identity.ProfileSh
accountsMap := make(map[string]identity.ProfileShowcaseVisibility)
for _, accountProfile := range accounts {
if _, ok := accountsMap[accountProfile.Address]; ok {
addressCapitalized := strings.ToUpper(accountProfile.Address)
if _, ok := accountsMap[addressCapitalized]; ok {
return errorDublicateAccountAddress
}
accountsMap[accountProfile.Address] = accountProfile.ShowcaseVisibility
accountsMap[addressCapitalized] = accountProfile.ShowcaseVisibility
}
for _, collectibleProfile := range collectibles {
@ -90,7 +92,8 @@ func (m *Messenger) validateCollectiblesOwnership(accounts []*identity.ProfileSh
// but ERC1155 which can be supported later can have more than one holder and balances > 1
found := false
for _, balance := range balances {
if accountShowcaseVisibility, ok := accountsMap[balance.Address.String()]; ok {
addressCapitalized := strings.ToUpper(balance.Address.String())
if accountShowcaseVisibility, ok := accountsMap[addressCapitalized]; ok {
if accountShowcaseVisibility < collectibleProfile.ShowcaseVisibility {
return errorAccountVisibilityLowerThanCollectible
}