-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add pool/operator/service params
- Loading branch information
1 parent
dae139e
commit f72ddb9
Showing
43 changed files
with
4,874 additions
and
373 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
syntax = "proto3"; | ||
package milkyway.pools.v1; | ||
|
||
import "gogoproto/gogo.proto"; | ||
import "cosmos_proto/cosmos.proto"; | ||
import "cosmos/base/v1beta1/coin.proto"; | ||
|
||
option go_package = "github.com/milkyway-labs/milkyway/x/pools/types"; | ||
|
||
// Params defines the parameters for the pools module. | ||
message Params { | ||
// AllowedServiceIDs defines the list of service IDs that the module allows | ||
// to join by pools. | ||
repeated uint32 allowed_service_ids = 1 | ||
[ (gogoproto.customname) = "AllowedServiceIDs" ]; | ||
} |
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package utils | ||
|
||
import ( | ||
"bytes" | ||
"encoding/binary" | ||
) | ||
|
||
func CompositeKey(parts ...[]byte) []byte { | ||
return bytes.Join(parts, nil) | ||
} | ||
|
||
// Uint32ToBigEndian marshals uint32 to a bigendian byte slice so it can be sorted | ||
func Uint32ToBigEndian(i uint32) []byte { | ||
b := make([]byte, 4) | ||
binary.BigEndian.PutUint32(b, i) | ||
return b | ||
} | ||
|
||
// BigEndianToUint32 returns an uint32 from big endian encoded bytes. If encoding | ||
// is empty, zero is returned. | ||
func BigEndianToUint32(bz []byte) uint32 { | ||
if len(bz) == 0 { | ||
return 0 | ||
} | ||
return binary.BigEndian.Uint32(bz) | ||
} |
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package keeper | ||
|
||
import ( | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
|
||
"github.com/milkyway-labs/milkyway/x/pools/types" | ||
) | ||
|
||
// SetParams sets module parameters | ||
func (k *Keeper) SetParams(ctx sdk.Context, params types.Params) { | ||
store := ctx.KVStore(k.storeKey) | ||
bz := k.cdc.MustMarshal(¶ms) | ||
store.Set(types.ParamsKey, bz) | ||
} | ||
|
||
// GetParams returns the module parameters | ||
func (k *Keeper) GetParams(ctx sdk.Context) (p types.Params) { | ||
store := ctx.KVStore(k.storeKey) | ||
bz := store.Get(types.ParamsKey) | ||
if bz == nil { | ||
return p | ||
} | ||
k.cdc.MustUnmarshal(bz, &p) | ||
return p | ||
} |
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
Oops, something went wrong.