5ee988ccd8
* Add common message types and update proto gen script * Update proto gen script to generate pulsar proto code * Upgrade direct deps * Populate params and genesis files * Setup keeper files * Setup module files with depinject and autocli * Add placeholder keeper methods * Integrate bond module into the chain
66 lines
1.4 KiB
Go
66 lines
1.4 KiB
Go
package keeper
|
|
|
|
import (
|
|
storetypes "cosmossdk.io/store/types"
|
|
"git.vdb.to/cerc-io/laconic2d/x/bond"
|
|
"github.com/cosmos/cosmos-sdk/codec"
|
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
)
|
|
|
|
// TODO: Add genesis.go?
|
|
|
|
type Keeper struct {
|
|
// Store keys
|
|
storeKey storetypes.StoreKey
|
|
|
|
// Codecs
|
|
cdc codec.BinaryCodec
|
|
|
|
// External keepers
|
|
// accountKeeper auth.AccountKeeper
|
|
// bankKeeper bank.Keeper
|
|
|
|
// Track bond usage in other cosmos-sdk modules (more like a usage tracker).
|
|
// usageKeepers []types.BondUsageKeeper
|
|
|
|
// paramSubspace paramtypes.Subspace
|
|
}
|
|
|
|
// NewKeeper creates new instances of the bond Keeper
|
|
func NewKeeper(
|
|
cdc codec.BinaryCodec,
|
|
// accountKeeper auth.AccountKeeper,
|
|
// bankKeeper bank.Keeper,
|
|
// usageKeepers []types.BondUsageKeeper,
|
|
storeKey storetypes.StoreKey,
|
|
// ps paramtypes.Subspace,
|
|
) Keeper {
|
|
// set KeyTable if it has not already been set
|
|
// if !ps.HasKeyTable() {
|
|
// ps = ps.WithKeyTable(types.ParamKeyTable())
|
|
// }
|
|
|
|
return Keeper{
|
|
// accountKeeper: accountKeeper,
|
|
// bankKeeper: bankKeeper,
|
|
storeKey: storeKey,
|
|
cdc: cdc,
|
|
// usageKeepers: usageKeepers,
|
|
// paramSubspace: ps,
|
|
}
|
|
}
|
|
|
|
// TODO: Add keeper methods
|
|
|
|
// SaveBond - saves a bond to the store.
|
|
func (k Keeper) SaveBond(ctx sdk.Context, bond *bond.Bond) {
|
|
// TODO: Implement
|
|
}
|
|
|
|
// ListBonds - get all bonds.
|
|
func (k Keeper) ListBonds(ctx sdk.Context) []*bond.Bond {
|
|
// TODO: Implement
|
|
var bonds []*bond.Bond
|
|
return bonds
|
|
}
|