-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: clean up x/foundation api (#933)
* Hide unnecessary apis * Use x/foundation mocks * Lint * Update CHANGELOG.md * Remove interface * Revert "Remove interface" This reverts commit 8dd124d.
- Loading branch information
Showing
37 changed files
with
363 additions
and
149 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
package keeper | ||
|
||
import ( | ||
"github.com/line/lbm-sdk/baseapp" | ||
"github.com/line/lbm-sdk/codec" | ||
sdk "github.com/line/lbm-sdk/types" | ||
"github.com/line/lbm-sdk/x/foundation" | ||
"github.com/line/lbm-sdk/x/foundation/keeper/internal" | ||
govtypes "github.com/line/lbm-sdk/x/gov/types" | ||
) | ||
|
||
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 | ||
} | ||
|
||
func NewKeeper( | ||
cdc codec.Codec, | ||
key sdk.StoreKey, | ||
router *baseapp.MsgServiceRouter, | ||
authKeeper foundation.AuthKeeper, | ||
bankKeeper foundation.BankKeeper, | ||
feeCollectorName string, | ||
config foundation.Config, | ||
authority string, | ||
) Keeper { | ||
return &keeper{ | ||
impl: internal.NewKeeper( | ||
cdc, | ||
key, | ||
router, | ||
authKeeper, | ||
bankKeeper, | ||
feeCollectorName, | ||
config, | ||
authority, | ||
), | ||
} | ||
} | ||
|
||
// GetAuthority returns the x/foundation module's authority. | ||
func (k keeper) GetAuthority() string { | ||
return k.impl.GetAuthority() | ||
} | ||
|
||
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 { | ||
return k.impl.InitGenesis(ctx, gs) | ||
} | ||
|
||
func (k keeper) ExportGenesis(ctx sdk.Context) *foundation.GenesisState { | ||
return k.impl.ExportGenesis(ctx) | ||
} | ||
|
||
func NewMsgServer(k Keeper) foundation.MsgServer { | ||
impl := k.(*keeper).impl | ||
return internal.NewMsgServer(impl) | ||
} | ||
|
||
func NewQueryServer(k Keeper) foundation.QueryServer { | ||
impl := k.(*keeper).impl | ||
return internal.NewQueryServer(impl) | ||
} | ||
|
||
func RegisterInvariants(ir sdk.InvariantRegistry, k Keeper) { | ||
impl := k.(*keeper).impl | ||
internal.RegisterInvariants(ir, impl) | ||
} | ||
|
||
func BeginBlocker(ctx sdk.Context, k Keeper) { | ||
impl := k.(*keeper).impl | ||
internal.BeginBlocker(ctx, impl) | ||
} | ||
|
||
func EndBlocker(ctx sdk.Context, k Keeper) { | ||
impl := k.(*keeper).impl | ||
internal.EndBlocker(ctx, impl) | ||
} | ||
|
||
func NewFoundationProposalsHandler(k Keeper) govtypes.Handler { | ||
impl := k.(*keeper).impl | ||
return internal.NewFoundationProposalsHandler(impl) | ||
} |
2 changes: 1 addition & 1 deletion
2
x/foundation/keeper/abci.go → x/foundation/keeper/internal/abci.go
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package keeper | ||
package internal | ||
|
||
import ( | ||
"time" | ||
|
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
2 changes: 1 addition & 1 deletion
2
x/foundation/keeper/censorship.go → x/foundation/keeper/internal/censorship.go
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package keeper | ||
package internal | ||
|
||
import ( | ||
sdk "github.com/line/lbm-sdk/types" | ||
|
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
2 changes: 1 addition & 1 deletion
2
x/foundation/keeper/exec.go → x/foundation/keeper/internal/exec.go
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package keeper | ||
package internal | ||
|
||
import ( | ||
"fmt" | ||
|
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
2 changes: 1 addition & 1 deletion
2
x/foundation/keeper/genesis.go → x/foundation/keeper/internal/genesis.go
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package keeper | ||
package internal | ||
|
||
import ( | ||
sdk "github.com/line/lbm-sdk/types" | ||
|
2 changes: 1 addition & 1 deletion
2
x/foundation/keeper/genesis_test.go → x/foundation/keeper/internal/genesis_test.go
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package keeper_test | ||
package internal_test | ||
|
||
import ( | ||
"testing" | ||
|
2 changes: 1 addition & 1 deletion
2
x/foundation/keeper/grpc_query.go → x/foundation/keeper/internal/grpc_query.go
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package keeper | ||
package internal | ||
|
||
import ( | ||
"context" | ||
|
Oops, something went wrong.