Skip to content

Commit

Permalink
Revert "Remove interface"
Browse files Browse the repository at this point in the history
This reverts commit 8dd124d.
  • Loading branch information
0Tech committed Mar 17, 2023
1 parent 8dd124d commit 2629fcc
Showing 1 changed file with 26 additions and 12 deletions.
38 changes: 26 additions & 12 deletions x/foundation/keeper/exported.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,15 @@ import (
govtypes "github.com/line/lbm-sdk/x/gov/types"
)

type Keeper struct {
type Keeper interface {
GetAuthority() string
Accept(ctx sdk.Context, grantee sdk.AccAddress, msg sdk.Msg) error

InitGenesis(ctx sdk.Context, gs *foundation.GenesisState) error
ExportGenesis(ctx sdk.Context) *foundation.GenesisState
}

type keeper struct {
impl internal.Keeper
}

Expand All @@ -23,7 +31,7 @@ func NewKeeper(
config foundation.Config,
authority string,
) Keeper {
return Keeper{
return &keeper{
impl: internal.NewKeeper(
cdc,
key,
Expand All @@ -38,42 +46,48 @@ func NewKeeper(
}

// GetAuthority returns the x/foundation module's authority.
func (k Keeper) GetAuthority() string {
func (k keeper) GetAuthority() string {
return k.impl.GetAuthority()
}

func (k Keeper) Accept(ctx sdk.Context, grantee sdk.AccAddress, msg sdk.Msg) error {
func (k keeper) Accept(ctx sdk.Context, grantee sdk.AccAddress, msg sdk.Msg) error {
return k.impl.Accept(ctx, grantee, msg)
}

func (k Keeper) InitGenesis(ctx sdk.Context, gs *foundation.GenesisState) error {
func (k keeper) InitGenesis(ctx sdk.Context, gs *foundation.GenesisState) error {
return k.impl.InitGenesis(ctx, gs)
}

func (k Keeper) ExportGenesis(ctx sdk.Context) *foundation.GenesisState {
func (k keeper) ExportGenesis(ctx sdk.Context) *foundation.GenesisState {
return k.impl.ExportGenesis(ctx)
}

func NewMsgServer(k Keeper) foundation.MsgServer {
return internal.NewMsgServer(k.impl)
impl := k.(*keeper).impl
return internal.NewMsgServer(impl)
}

func NewQueryServer(k Keeper) foundation.QueryServer {
return internal.NewQueryServer(k.impl)
impl := k.(*keeper).impl
return internal.NewQueryServer(impl)
}

func RegisterInvariants(ir sdk.InvariantRegistry, k Keeper) {
internal.RegisterInvariants(ir, k.impl)
impl := k.(*keeper).impl
internal.RegisterInvariants(ir, impl)
}

func BeginBlocker(ctx sdk.Context, k Keeper) {
internal.BeginBlocker(ctx, k.impl)
impl := k.(*keeper).impl
internal.BeginBlocker(ctx, impl)
}

func EndBlocker(ctx sdk.Context, k Keeper) {
internal.EndBlocker(ctx, k.impl)
impl := k.(*keeper).impl
internal.EndBlocker(ctx, impl)
}

func NewFoundationProposalsHandler(k Keeper) govtypes.Handler {
return internal.NewFoundationProposalsHandler(k.impl)
impl := k.(*keeper).impl
return internal.NewFoundationProposalsHandler(impl)
}

0 comments on commit 2629fcc

Please sign in to comment.