-
Notifications
You must be signed in to change notification settings - Fork 106
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
36 changed files
with
2,914 additions
and
12 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 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,12 @@ | ||
syntax = "proto3"; | ||
package neutron.freelane; | ||
|
||
import "gogoproto/gogo.proto"; | ||
import "neutron/freelane/params.proto"; | ||
|
||
option go_package = "github.com/neutron-org/neutron/v5/x/freelane/types"; | ||
|
||
// Defines the freelane module's genesis state. | ||
message GenesisState { | ||
Params params = 1 [(gogoproto.nullable) = false]; | ||
} |
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,15 @@ | ||
syntax = "proto3"; | ||
package neutron.freelane; | ||
|
||
import "gogoproto/gogo.proto"; | ||
|
||
option go_package = "github.com/neutron-org/neutron/v5/x/freelane/types"; | ||
|
||
// Defines the parameters for the module. | ||
message Params { | ||
option (gogoproto.goproto_stringer) = false; | ||
// Relative percentage of block space that can be used by the lane | ||
double block_space = 1; | ||
// Limit of gasless transactions | ||
uint64 sequence_number = 2; | ||
} |
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 @@ | ||
syntax = "proto3"; | ||
package neutron.freelane; | ||
|
||
import "gogoproto/gogo.proto"; | ||
import "google/api/annotations.proto"; | ||
import "neutron/freelane/params.proto"; | ||
|
||
option go_package = "github.com/neutron-org/neutron/v5/x/freelane/types"; | ||
|
||
// Defines the gRPC querier service. | ||
service Query { | ||
// Queries the parameters of the module. | ||
rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { | ||
option (google.api.http).get = "/neutron/freelane/params"; | ||
} | ||
} | ||
|
||
// The request type for the Query/Params RPC method. | ||
message QueryParamsRequest {} | ||
|
||
// The response type for the Query/Params RPC method. | ||
message QueryParamsResponse { | ||
// Holds all the parameters of this module. | ||
Params params = 1 [(gogoproto.nullable) = false]; | ||
} |
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,38 @@ | ||
syntax = "proto3"; | ||
package neutron.freelane; | ||
|
||
import "amino/amino.proto"; | ||
import "cosmos/msg/v1/msg.proto"; | ||
import "cosmos_proto/cosmos.proto"; | ||
import "gogoproto/gogo.proto"; | ||
import "neutron/freelane/params.proto"; | ||
|
||
option go_package = "github.com/neutron-org/neutron/v5/x/freelane/types"; | ||
|
||
// Defines the Msg service. | ||
service Msg { | ||
option (cosmos.msg.v1.service) = true; | ||
|
||
// Updates the module parameters. | ||
rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); | ||
} | ||
|
||
// The MsgUpdateParams request type. | ||
message MsgUpdateParams { | ||
option (amino.name) = "freelane/MsgUpdateParams"; | ||
option (cosmos.msg.v1.signer) = "authority"; | ||
|
||
// The address of the governance account. | ||
string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; | ||
|
||
// Defines the x/freelane parameters to update. | ||
// | ||
// NOTE: All parameters must be supplied. | ||
Params params = 2 [ | ||
(gogoproto.nullable) = false, | ||
(amino.dont_omitempty) = true | ||
]; | ||
} | ||
|
||
// Defines the response structure for executing a MsgUpdateParams message. | ||
message MsgUpdateParamsResponse {} |
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,48 @@ | ||
package keeper | ||
|
||
import ( | ||
"testing" | ||
|
||
"cosmossdk.io/log" | ||
"cosmossdk.io/store/metrics" | ||
adminmoduletypes "github.com/cosmos/admin-module/v2/x/adminmodule/types" | ||
cosmosdb "github.com/cosmos/cosmos-db" | ||
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" | ||
|
||
"cosmossdk.io/store" | ||
storetypes "cosmossdk.io/store/types" | ||
tmproto "github.com/cometbft/cometbft/proto/tendermint/types" | ||
"github.com/cosmos/cosmos-sdk/codec" | ||
codectypes "github.com/cosmos/cosmos-sdk/codec/types" | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
"github.com/stretchr/testify/require" | ||
|
||
"github.com/neutron-org/neutron/v5/x/freelane/keeper" | ||
"github.com/neutron-org/neutron/v5/x/freelane/types" | ||
) | ||
|
||
func FreeLaneKeeper(t testing.TB) (*keeper.Keeper, sdk.Context) { | ||
storeKey := storetypes.NewKVStoreKey(types.StoreKey) | ||
|
||
db := cosmosdb.NewMemDB() | ||
stateStore := store.NewCommitMultiStore(db, log.NewNopLogger(), metrics.NewNoOpMetrics()) | ||
stateStore.MountStoreWithDB(storeKey, storetypes.StoreTypeIAVL, db) | ||
require.NoError(t, stateStore.LoadLatestVersion()) | ||
|
||
registry := codectypes.NewInterfaceRegistry() | ||
cdc := codec.NewProtoCodec(registry) | ||
|
||
k := keeper.NewKeeper( | ||
cdc, | ||
storeKey, | ||
authtypes.NewModuleAddress(adminmoduletypes.ModuleName).String(), | ||
) | ||
|
||
ctx := sdk.NewContext(stateStore, tmproto.Header{}, false, log.NewNopLogger()) | ||
|
||
// Initialize params | ||
err := k.SetParams(ctx, types.DefaultParams()) | ||
require.NoError(t, err) | ||
|
||
return k, ctx | ||
} |
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,27 @@ | ||
package cli | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/spf13/cobra" | ||
|
||
"github.com/cosmos/cosmos-sdk/client" | ||
|
||
"github.com/neutron-org/neutron/v5/x/freelane/types" | ||
) | ||
|
||
// GetQueryCmd returns the cli query commands for this module | ||
func GetQueryCmd(_ string) *cobra.Command { | ||
// Group freelane queries under a subcommand | ||
cmd := &cobra.Command{ | ||
Use: types.ModuleName, | ||
Short: fmt.Sprintf("Querying commands for the %s module", types.ModuleName), | ||
DisableFlagParsing: true, | ||
SuggestionsMinimumDistance: 2, | ||
RunE: client.ValidateCmd, | ||
} | ||
|
||
cmd.AddCommand(CmdQueryParams()) | ||
|
||
return cmd | ||
} |
Oops, something went wrong.