Skip to content

Commit

Permalink
update validations and restrictions (#165)
Browse files Browse the repository at this point in the history
  • Loading branch information
harish551 authored Mar 9, 2024
1 parent ec86b0e commit f63d350
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 14 deletions.
7 changes: 3 additions & 4 deletions x/marketplace/types/constants.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
package types

const (
MinListingIdLength = 4
MaxListingIdLength = 64
MaxSplits = 5
MaxWhitelistAccounts = 10
MinListingIdLength = 4
MaxListingIdLength = 64
MaxSplits = 5
)
4 changes: 0 additions & 4 deletions x/marketplace/types/validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,6 @@ func ValidateSplitShares(splitShares []WeightedAddress) error {
}

func ValidateWhiteListAccounts(whitelistAccounts []string) error {
if len(whitelistAccounts) > MaxWhitelistAccounts {
return errorsmod.Wrapf(ErrInvalidWhitelistAccounts,
"number of whitelist accounts are more than the limit, len must be less than or equal to %d ", MaxWhitelistAccounts)
}
for _, address := range whitelistAccounts {
_, err := sdk.AccAddressFromBech32(address)
if err != nil {
Expand Down
9 changes: 3 additions & 6 deletions x/onft/types/validations.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,9 @@ func ValidateWeightedAddresses(i interface{}) error {

weightSum := sdk.NewDec(0)
for i, w := range v {
// we allow address to be "" to go to community pool
if w.Address != "" {
_, err := sdk.AccAddressFromBech32(w.Address)
if err != nil {
return fmt.Errorf("invalid address at %dth", i)
}
_, err := sdk.AccAddressFromBech32(w.Address)
if err != nil {
return fmt.Errorf("invalid address at %dth", i)
}
if !w.Weight.IsPositive() {
return fmt.Errorf("non-positive weight at %dth", i)
Expand Down

0 comments on commit f63d350

Please sign in to comment.