-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #141 from realiotech/staking
add main bond denom
- Loading branch information
Showing
12 changed files
with
1,072 additions
and
5 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,9 @@ | ||
syntax = "proto3"; | ||
package multistaking.v1; | ||
|
||
import "gogoproto/gogo.proto"; | ||
|
||
option go_package = "github.com/realiotech/multi-staking/x/multi-staking/types"; | ||
|
||
// Params defines the incentives module params | ||
message Params { string main_bond_denom = 1; } |
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,28 @@ | ||
syntax = "proto3"; | ||
package multistaking.v1; | ||
|
||
import "gogoproto/gogo.proto"; | ||
import "google/api/annotations.proto"; | ||
import "multistaking/v1/params.proto"; | ||
import "cosmos/msg/v1/msg.proto"; | ||
import "cosmos_proto/cosmos.proto"; | ||
|
||
option go_package = "github.com/realiotech/multi-staking/x/multi-staking/types"; | ||
|
||
service Msg { | ||
rpc UpdateMultiStakingParams(MsgUpdateMultiStakingParams) | ||
returns (MsgUpdateMultiStakingParamsResponse); | ||
} | ||
|
||
message MsgUpdateMultiStakingParams { | ||
option (cosmos.msg.v1.signer) = "authority"; | ||
|
||
// authority is the address of the governance account. | ||
string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; | ||
|
||
// params defines the x/evm parameters to update. | ||
// NOTE: All parameters must be supplied. | ||
Params params = 2 [ (gogoproto.nullable) = false ]; | ||
} | ||
|
||
message MsgUpdateMultiStakingParamsResponse {} |
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,30 @@ | ||
package keeper | ||
|
||
import ( | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
Check failure on line 4 in x/multi-staking/keeper/params.go
|
||
"github.com/realio-tech/multi-staking-module/x/multi-staking/types" | ||
Check failure on line 5 in x/multi-staking/keeper/params.go
|
||
) | ||
|
||
// SetParams sets the x/staking module parameters. | ||
func (k Keeper) SetParams(ctx sdk.Context, params types.Params) error { | ||
store := ctx.KVStore(k.storeKey) | ||
bz, err := k.cdc.Marshal(¶ms) | ||
if err != nil { | ||
return err | ||
} | ||
store.Set(types.ParamsKey, bz) | ||
|
||
return nil | ||
} | ||
|
||
// GetParams sets the x/staking module parameters. | ||
func (k Keeper) GetParams(ctx sdk.Context) (params types.Params) { | ||
store := ctx.KVStore(k.storeKey) | ||
bz := store.Get(types.ParamsKey) | ||
if bz == nil { | ||
return params | ||
} | ||
|
||
k.cdc.MustUnmarshal(bz, ¶ms) | ||
return params | ||
} |
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,36 @@ | ||
package types | ||
|
||
import ( | ||
sdkerrors "cosmossdk.io/errors" | ||
Check failure on line 4 in x/multi-staking/types/msg.go
|
||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
) | ||
|
||
// staking message types | ||
const ( | ||
TypeMsgUpdateMultiStakingParams = "update_multistaking_params" | ||
) | ||
|
||
var ( | ||
_ sdk.Msg = &MsgUpdateMultiStakingParams{} | ||
) | ||
|
||
// GetSignBytes returns the raw bytes for a MsgUpdateParams message that | ||
// the expected signer needs to sign. | ||
func (m *MsgUpdateMultiStakingParams) GetSignBytes() []byte { | ||
bz := AminoCdc.MustMarshalJSON(m) | ||
return sdk.MustSortJSON(bz) | ||
} | ||
|
||
// ValidateBasic executes sanity validation on the provided data | ||
func (m *MsgUpdateMultiStakingParams) ValidateBasic() error { | ||
if _, err := sdk.AccAddressFromBech32(m.Authority); err != nil { | ||
return sdkerrors.Wrap(err, "invalid authority address") | ||
} | ||
return nil | ||
} | ||
|
||
// GetSigners returns the expected signers for a MsgUpdateParams message | ||
func (m *MsgUpdateMultiStakingParams) GetSigners() []sdk.AccAddress { | ||
addr, _ := sdk.AccAddressFromBech32(m.Authority) | ||
return []sdk.AccAddress{addr} | ||
} |
Oops, something went wrong.