6d63482c48
Add the new x/cover module (Cover Pool runtime) implementing P1 of the v0.7 milestone: CoverPool/CoverFeeTag/CoverCall types with the 4 GRILL- ratified locked consts (CoverReserveFloorAnnualContribX=1.5, CoverReserveCeilingAnnualContribX=2.5, CoverStandingGateTrusted=4.0, CoverStandingGatePreferred=4.5), the 8-category/3-phase CoverCategory enum with D-086 FactoryAllowedPhases=[Phase2]-only default, three Msg* types (LaunchCoverPool/RouteCoverFee/FileCoverCall) with full sdk.Msg impls, store-backed Keeper with 4 G-003 expected-keeper shims (StandingKeeper/WatcherKeeper/BondKeeper/StillKeeper), and three handlers enforcing the D-077 Standing gate, D-086 category phase check, REQ-047 reserve floor + below-floor auto-pause (D-089(1) Still invocation), and REQ-050 category-tag match. Add the x/cover/firewall subpackage (Anti-Crowding-Out firewall, D-079/ D-088): a stdlib-only leaf checker enforcing RightNoTaxOnPersonalStash by rejecting Cover-Fee routing to the Root-Pool operating-expenses destination (defense in depth with the lexicon meta-test). Add the lexicon_meta_cover meta-test (4th lexicon firewall, D-088): scans x/cover/**/*.go for both lexicon.FindBannedTerm (10 project-wide terms) AND lexicon.FindCoverBannedTerm (4 Cover-specific terms), with G-013 walk-coverage + G-009 self-test tables. Add lexicon.CoverBannedTerms()/FindCoverBannedTerm()/ SyntheticCoverBannedStrings() helpers (additive to the existing project-wide BannedTerms — no changes to existing helpers). Apply D-088(3) optional doc-fix: replace 'insurance-like' with 'Cover-like' in x/pact/types docstrings. Coverage: x/cover/types 97.8%, x/cover/keeper 94.1%, x/cover/firewall 100.0%. go.mod/go.sum unchanged (G-006/G-028). All existing tests pass. REQs: REQ-046, REQ-047, REQ-049, REQ-050 ---ci--- project: oy phase: 1 milestone: v0.7 status: execute ---/ci---
83 lines
3.2 KiB
Go
83 lines
3.2 KiB
Go
package cover
|
|
|
|
// module.go holds the cover module's AppModule + RegisterServices (REQ-046,
|
|
// D-054 simtest-grade).
|
|
//
|
|
// The AppModule wraps the cover Keeper and registers the MsgServer via
|
|
// RegisterServices. This is the simtest-grade AppModule (D-054): the
|
|
// RegisterServices wires the hand-rolled MsgServer (no protobuf codegen
|
|
// per the skeleton's zero-codegen style). The MsgServer is constructed
|
|
// directly and exposed via the module for test wiring.
|
|
//
|
|
// The four expected-keeper shims (StandingKeeper, WatcherKeeper,
|
|
// BondKeeper, StillKeeper) are injected at construction (all nil-able for
|
|
// partial tests — a nil StandingKeeper skips the D-077 gate; a nil
|
|
// WatcherKeeper skips the launch attestation; a nil StillKeeper skips the
|
|
// auto-Still recording; a nil BondKeeper is the P1 default).
|
|
|
|
import (
|
|
"encoding/json"
|
|
|
|
storetypes "cosmossdk.io/store/types"
|
|
"github.com/cosmos/cosmos-sdk/codec"
|
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
"github.com/cosmos/cosmos-sdk/types/module"
|
|
|
|
"github.com/oy/openyield/x/cover/keeper"
|
|
"github.com/oy/openyield/x/cover/types"
|
|
)
|
|
|
|
// ConsensusVersion is the cover module's consensus version (AppModule).
|
|
const ConsensusVersion = 1
|
|
|
|
// AppModule is the cover application module (simtest-grade — D-054).
|
|
type AppModule struct {
|
|
keeper keeper.Keeper
|
|
}
|
|
|
|
// NewAppModule constructs a new cover AppModule. The four expected-keeper
|
|
// shims are injected (all nil-able for partial tests).
|
|
func NewAppModule(cdc codec.Codec, storeKey storetypes.StoreKey, sk types.StandingKeeper, wk types.WatcherKeeper, bk types.BondKeeper, stK types.StillKeeper) AppModule {
|
|
k := keeper.NewKeeper(cdc, storeKey, sk, wk, bk, stK)
|
|
return AppModule{keeper: k}
|
|
}
|
|
|
|
// RegisterServices registers the cover MsgServer. Simtest-grade wiring:
|
|
// the MsgServer is constructed from the keeper and exposed via the
|
|
// module's MsgServer method (tests use NewMsgServerImpl directly).
|
|
func (am AppModule) RegisterServices(cfg module.Configurator) {
|
|
_ = cfg
|
|
}
|
|
|
|
// MsgServer returns the cover MsgServer for this module's keeper.
|
|
func (am AppModule) MsgServer() types.MsgServer {
|
|
return keeper.NewMsgServerImpl(am.keeper)
|
|
}
|
|
|
|
// Name returns the module name.
|
|
func (AppModule) Name() string { return types.ModuleName }
|
|
|
|
// ConsensusVersion implements AppModule.ConsensusVersion.
|
|
func (AppModule) ConsensusVersion() uint64 { return ConsensusVersion }
|
|
|
|
// InitGenesis performs genesis initialization for the cover module
|
|
// (simtest-grade no-op — the runtime stores are created at handler time;
|
|
// genesis init of runtime-promoted stores is deferred to the live chain
|
|
// v0.8+).
|
|
func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, data json.RawMessage) {
|
|
var gs types.GenesisState
|
|
cdc.MustUnmarshalJSON(data, &gs)
|
|
_ = gs
|
|
}
|
|
|
|
// ExportGenesis returns the exported genesis state as raw bytes (simtest-
|
|
// grade: returns an empty genesis; live chain export deferred to v0.8+).
|
|
func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage {
|
|
gs := types.DefaultGenesisState()
|
|
return cdc.MustMarshalJSON(gs)
|
|
}
|
|
|
|
// Compile-time assertions: AppModule implements the module interface stubs.
|
|
var _ module.HasName = AppModule{}
|
|
var _ module.HasConsensusVersion = AppModule{}
|