forked from sei-protocol/sei-chain
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove token factory config (sei-protocol#1971)
* remove token factory config * move DenomAllowListMaxSize to params * formatting * add more tests * formatting * address review comments
- Loading branch information
Showing
15 changed files
with
303 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,46 @@ | ||
package types | ||
|
||
import ( | ||
"fmt" | ||
|
||
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" | ||
) | ||
|
||
// ParamTable for tokenfactory module. | ||
// DefaultDenomAllowListMaxSize default denom allowlist max size and can be overridden by governance proposal. | ||
const DefaultDenomAllowListMaxSize = 2000 | ||
|
||
// ParamKeyTable ParamTable for tokenfactory module. | ||
func ParamKeyTable() paramtypes.KeyTable { | ||
return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) | ||
} | ||
|
||
// default tokenfactory module parameters. | ||
// DefaultParams default tokenfactory module parameters. | ||
func DefaultParams() Params { | ||
return Params{} | ||
return Params{ | ||
DenomAllowlistMaxSize: DefaultDenomAllowListMaxSize, | ||
} | ||
} | ||
|
||
// validate params. | ||
// Validate validate params. | ||
func (p Params) Validate() error { | ||
if err := validateDenomAllowListMaxSize(p.DenomAllowlistMaxSize); err != nil { | ||
return err | ||
} | ||
return nil | ||
} | ||
|
||
// Implements params.ParamSet. | ||
// ParamSetPairs Implements params.ParamSet. | ||
func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { | ||
return paramtypes.ParamSetPairs{} | ||
return paramtypes.ParamSetPairs{ | ||
paramtypes.NewParamSetPair(DenomAllowListMaxSizeKey, &p.DenomAllowlistMaxSize, validateDenomAllowListMaxSize), | ||
} | ||
} | ||
|
||
// validateDenomAllowListMaxSize validates a parameter value is within a valid range. | ||
func validateDenomAllowListMaxSize(i interface{}) error { | ||
_, ok := i.(uint32) | ||
if !ok { | ||
return fmt.Errorf("invalid parameter type: %T", i) | ||
} | ||
return nil | ||
} |
Oops, something went wrong.