-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
45 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// Package legacy contains types and interfaces that have support removed, but may need to be exported for legacy | ||
// and migration purposes. | ||
package legacy | ||
|
||
import ( | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
) | ||
|
||
// The following types are from the removed x/params modules and can be used to satisfy | ||
// legacy interfaces that may use these. | ||
|
||
type ( | ||
ValueValidatorFn func(value interface{}) error | ||
|
||
// ParamSetPair is used for associating paramsubspace key and field of param | ||
// structs. | ||
ParamSetPair struct { | ||
Key []byte | ||
Value interface{} | ||
ValidatorFn ValueValidatorFn | ||
} | ||
) | ||
|
||
// NewParamSetPair creates a new ParamSetPair instance. | ||
func NewParamSetPair(key []byte, value interface{}, vfn ValueValidatorFn) ParamSetPair { | ||
return ParamSetPair{key, value, vfn} | ||
} | ||
|
||
// ParamSetPairs Slice of KeyFieldPair | ||
type ParamSetPairs []ParamSetPair | ||
|
||
// ParamSet defines an interface for structs containing parameters for a module | ||
type ParamSet interface { | ||
ParamSetPairs() ParamSetPairs | ||
} | ||
|
||
type ( | ||
// Subspace defines an interface that implements the legacy x/params Subspace | ||
// type. | ||
// | ||
// NOTE: This is used solely for migration of x/params managed parameters. | ||
Subspace interface { | ||
GetParamSet(ctx sdk.Context, ps ParamSet) | ||
} | ||
) |