-
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.
- Loading branch information
1 parent
16f5d9e
commit 686436f
Showing
58 changed files
with
10,491 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
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,15 @@ | ||
syntax = "proto3"; | ||
package webtree.story.story; | ||
|
||
import "gogoproto/gogo.proto"; | ||
import "story/params.proto"; | ||
// this line is used by starport scaffolding # genesis/proto/import | ||
|
||
option go_package = "github.com/web-tree/story/x/story/types"; | ||
|
||
// GenesisState defines the story module's genesis state. | ||
message GenesisState { | ||
Params params = 1 [(gogoproto.nullable) = false]; | ||
string port_id = 2; | ||
// this line is used by starport scaffolding # genesis/proto/state | ||
} |
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,18 @@ | ||
syntax = "proto3"; | ||
package webtree.story.story; | ||
|
||
// this line is used by starport scaffolding # proto/packet/import | ||
|
||
option go_package = "github.com/web-tree/story/x/story/types"; | ||
|
||
message StoryPacketData { | ||
oneof packet { | ||
NoData noData = 1; | ||
// this line is used by starport scaffolding # ibc/packet/proto/field | ||
} | ||
} | ||
|
||
message NoData { | ||
} | ||
|
||
// this line is used by starport scaffolding # ibc/packet/proto/message |
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 webtree.story.story; | ||
|
||
import "gogoproto/gogo.proto"; | ||
|
||
option go_package = "github.com/web-tree/story/x/story/types"; | ||
|
||
// Params defines the parameters for the module. | ||
message Params { | ||
option (gogoproto.goproto_stringer) = 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,30 @@ | ||
syntax = "proto3"; | ||
package webtree.story.story; | ||
|
||
import "gogoproto/gogo.proto"; | ||
import "google/api/annotations.proto"; | ||
import "cosmos/base/query/v1beta1/pagination.proto"; | ||
import "story/params.proto"; | ||
// this line is used by starport scaffolding # 1 | ||
|
||
option go_package = "github.com/web-tree/story/x/story/types"; | ||
|
||
// Query defines the gRPC querier service. | ||
service Query { | ||
// Parameters queries the parameters of the module. | ||
rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { | ||
option (google.api.http).get = "/webtree/story/story/params"; | ||
} | ||
// this line is used by starport scaffolding # 2 | ||
} | ||
|
||
// QueryParamsRequest is request type for the Query/Params RPC method. | ||
message QueryParamsRequest {} | ||
|
||
// QueryParamsResponse is response type for the Query/Params RPC method. | ||
message QueryParamsResponse { | ||
// params holds all the parameters of this module. | ||
Params params = 1 [(gogoproto.nullable) = false]; | ||
} | ||
|
||
// this line is used by starport scaffolding # 3 |
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,13 @@ | ||
syntax = "proto3"; | ||
package webtree.story.story; | ||
|
||
// this line is used by starport scaffolding # proto/tx/import | ||
|
||
option go_package = "github.com/web-tree/story/x/story/types"; | ||
|
||
// Msg defines the Msg service. | ||
service Msg { | ||
// this line is used by starport scaffolding # proto/tx/rpc | ||
} | ||
|
||
// this line is used by starport scaffolding # proto/tx/message |
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,75 @@ | ||
package keeper | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/cosmos/cosmos-sdk/codec" | ||
codectypes "github.com/cosmos/cosmos-sdk/codec/types" | ||
"github.com/cosmos/cosmos-sdk/store" | ||
storetypes "github.com/cosmos/cosmos-sdk/store/types" | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
capabilitykeeper "github.com/cosmos/cosmos-sdk/x/capability/keeper" | ||
typesparams "github.com/cosmos/cosmos-sdk/x/params/types" | ||
ibckeeper "github.com/cosmos/ibc-go/v2/modules/core/keeper" | ||
"github.com/stretchr/testify/require" | ||
"github.com/tendermint/tendermint/libs/log" | ||
tmproto "github.com/tendermint/tendermint/proto/tendermint/types" | ||
tmdb "github.com/tendermint/tm-db" | ||
"github.com/web-tree/story/x/story/keeper" | ||
"github.com/web-tree/story/x/story/types" | ||
) | ||
|
||
func StoryKeeper(t testing.TB) (*keeper.Keeper, sdk.Context) { | ||
logger := log.NewNopLogger() | ||
|
||
storeKey := sdk.NewKVStoreKey(types.StoreKey) | ||
memStoreKey := storetypes.NewMemoryStoreKey(types.MemStoreKey) | ||
|
||
db := tmdb.NewMemDB() | ||
stateStore := store.NewCommitMultiStore(db) | ||
stateStore.MountStoreWithDB(storeKey, sdk.StoreTypeIAVL, db) | ||
stateStore.MountStoreWithDB(memStoreKey, sdk.StoreTypeMemory, nil) | ||
require.NoError(t, stateStore.LoadLatestVersion()) | ||
|
||
registry := codectypes.NewInterfaceRegistry() | ||
appCodec := codec.NewProtoCodec(registry) | ||
capabilityKeeper := capabilitykeeper.NewKeeper(appCodec, storeKey, memStoreKey) | ||
|
||
ss := typesparams.NewSubspace(appCodec, | ||
types.Amino, | ||
storeKey, | ||
memStoreKey, | ||
"StorySubSpace", | ||
) | ||
IBCKeeper := ibckeeper.NewKeeper( | ||
appCodec, | ||
storeKey, | ||
ss, | ||
nil, | ||
nil, | ||
capabilityKeeper.ScopeToModule("StoryIBCKeeper"), | ||
) | ||
|
||
paramsSubspace := typesparams.NewSubspace(appCodec, | ||
types.Amino, | ||
storeKey, | ||
memStoreKey, | ||
"StoryParams", | ||
) | ||
k := keeper.NewKeeper( | ||
appCodec, | ||
storeKey, | ||
memStoreKey, | ||
paramsSubspace, | ||
IBCKeeper.ChannelKeeper, | ||
&IBCKeeper.PortKeeper, | ||
capabilityKeeper.ScopeToModule("StoryScopedKeeper"), | ||
) | ||
|
||
ctx := sdk.NewContext(stateStore, tmproto.Header{}, false, logger) | ||
|
||
// Initialize params | ||
k.SetParams(ctx, types.DefaultParams()) | ||
|
||
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
Oops, something went wrong.