Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion incubator/reseeding/alias.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,24 @@ import (
)

type (
Keeper = keeper.Keeper
Keeper = keeper.Keeper
GenesisState = types.GenesisState
)

const (
DefaultCodespace = types.DefaultCodespace
ModuleName = types.ModuleName
StoreKey = types.StoreKey
RouterKey = types.RouterKey
QuerierRoute = types.QuerierRoute
)

var (
NewQuerier = keeper.NewQuerier
RegisterInvariants = keeper.RegisterInvariants
NewGenesisState = types.NewGenesisState
DefaultGenesisState = types.DefaultGenesisState
ValidateGenesis = types.ValidateGenesis
RegisterCodec = types.RegisterCodec
ModuleCdc = types.ModuleCdc
)
1 change: 1 addition & 0 deletions incubator/reseeding/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ func GenericHandler(k Keeper, stakingKeeper staking.Keeper) sdk.Handler {
errMsg := fmt.Sprintf("unrecognized reseeding message type: %T", msg)
return sdk.ErrUnknownRequest(errMsg).Result()
}
return sdk.Result{}
}
}

Expand Down
30 changes: 30 additions & 0 deletions incubator/reseeding/internal/keeper/invariants.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package keeper

// DONTCOVER

import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/modules/incubator/reseeding/internal/types"
)

// RegisterInvariants registers all supply invariants
func RegisterInvariants(ir sdk.InvariantRegistry, k Keeper) {
ir.RegisterRoute(
types.ModuleName, "supply",
SupplyInvariant(k),
)
}

// AllInvariants runs all invariants of the nfts module.
func AllInvariants(k Keeper) sdk.Invariant {
return func(ctx sdk.Context) (string, bool) {
return SupplyInvariant(k)(ctx)
}
}

// SupplyInvariant checks that the total amount of nfts on collections matches the total amount owned by addresses
func SupplyInvariant(k Keeper) sdk.Invariant {
return func(ctx sdk.Context) (string, bool) {
return "", false
}
}
8 changes: 8 additions & 0 deletions incubator/reseeding/internal/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import (
"encoding/json"
"fmt"

abci "github.com/tendermint/tendermint/abci/types"

"github.com/tendermint/tendermint/libs/log"

"github.com/cosmos/cosmos-sdk/codec"
Expand Down Expand Up @@ -80,3 +82,9 @@ func (k Keeper) GetCurrentSeed(ctx sdk.Context) []byte {
func (k Keeper) Logger(ctx sdk.Context) log.Logger {
return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName))
}

func NewQuerier(k Keeper) sdk.Querier {
return func(ctx sdk.Context, path []string, req abci.RequestQuery) (res []byte, err sdk.Error) {
return nil, nil
}
}
6 changes: 6 additions & 0 deletions incubator/reseeding/internal/types/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,10 @@ const (
DefaultCodespace sdk.CodespaceType = ModuleName
StoreKey = ModuleName
RouterKey = ModuleName
QuerierRoute = ModuleName
)

var (
CollectionsKeyPrefix = []byte{0x00} // key for reseeding collections
OwnersKeyPrefix = []byte{0x01} // key for balance of NFTs held by an address
)
7 changes: 5 additions & 2 deletions incubator/reseeding/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import (
"encoding/json"
"math/rand"

"github.com/cosmos/cosmos-sdk/x/staking"

"github.com/cosmos/cosmos-sdk/client/context"
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
Expand Down Expand Up @@ -97,7 +99,8 @@ type AppModule struct {
AppModuleBasic
AppModuleSimulation

keeper Keeper
stakingKeeper staking.Keeper
keeper Keeper
}

// NewAppModule creates a new AppModule object
Expand Down Expand Up @@ -126,7 +129,7 @@ func (AppModule) Route() string {

// NewHandler module handler
func (am AppModule) NewHandler() sdk.Handler {
return GenericHandler(am.keeper)
return GenericHandler(am.keeper, am.stakingKeeper)
}

// QuerierRoute module querier route name
Expand Down
11 changes: 11 additions & 0 deletions incubator/reseeding/simulation/decoder.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package simulation

import (
"github.com/cosmos/cosmos-sdk/codec"
cmn "github.com/tendermint/tendermint/libs/common"
)

// DecodeStore unmarshals the KVPair's Value to the corresponding gov type
func DecodeStore(cdc *codec.Codec, kvA, kvB cmn.KVPair) string {
return ""
}
10 changes: 10 additions & 0 deletions incubator/reseeding/simulation/genesis.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package simulation

import (
"github.com/cosmos/cosmos-sdk/types/module"
)

// RandomizedGenState generates a random GenesisState for nft
func RandomizedGenState(simState *module.SimulationState) {

}