Fix: the validation of collectibles should not be dependent on capitalization (#4917)
This commit is contained in:
parent
9db149d4f6
commit
b987e8d6f5
|
@ -9,6 +9,7 @@ import (
|
||||||
"math/big"
|
"math/big"
|
||||||
"reflect"
|
"reflect"
|
||||||
"sort"
|
"sort"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/golang/protobuf/proto"
|
"github.com/golang/protobuf/proto"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
|
@ -73,10 +74,11 @@ func (m *Messenger) validateCollectiblesOwnership(accounts []*identity.ProfileSh
|
||||||
accountsMap := make(map[string]identity.ProfileShowcaseVisibility)
|
accountsMap := make(map[string]identity.ProfileShowcaseVisibility)
|
||||||
|
|
||||||
for _, accountProfile := range accounts {
|
for _, accountProfile := range accounts {
|
||||||
if _, ok := accountsMap[accountProfile.Address]; ok {
|
addressCapitalized := strings.ToUpper(accountProfile.Address)
|
||||||
|
if _, ok := accountsMap[addressCapitalized]; ok {
|
||||||
return errorDublicateAccountAddress
|
return errorDublicateAccountAddress
|
||||||
}
|
}
|
||||||
accountsMap[accountProfile.Address] = accountProfile.ShowcaseVisibility
|
accountsMap[addressCapitalized] = accountProfile.ShowcaseVisibility
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, collectibleProfile := range collectibles {
|
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
|
// but ERC1155 which can be supported later can have more than one holder and balances > 1
|
||||||
found := false
|
found := false
|
||||||
for _, balance := range balances {
|
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 {
|
if accountShowcaseVisibility < collectibleProfile.ShowcaseVisibility {
|
||||||
return errorAccountVisibilityLowerThanCollectible
|
return errorAccountVisibilityLowerThanCollectible
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue