Skip to content

Commit 28d8c73

Browse files
authored
feat(governor955): add x/governor955/types — params, ratio records, BankKeeper interface
Defines data structures and parameters for the governor955 module, including targets for truth verification and humanitarian access, as well as records for spending and ratios.
1 parent 849d400 commit 28d8c73

1 file changed

Lines changed: 74 additions & 0 deletions

File tree

x/governor955/types/types.go

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
// Package types defines the data structures for the x/governor955 module.
2+
// Implements the 955 Operational Split Enforcer per CHAIN-SPEC-v1.5.1 Section 6.2.
3+
package types
4+
5+
import (
6+
sdkmath "cosmossdk.io/math"
7+
sdk "github.com/cosmos/cosmos-sdk/types"
8+
)
9+
10+
const (
11+
ModuleName = "governor955"
12+
StoreKey = ModuleName
13+
14+
// TruthVerificationTarget is the target allocation for truth verification operations (95%).
15+
TruthVerificationTarget = "0.95"
16+
// HumanitarianTarget is the target allocation for humanitarian access operations (5%).
17+
HumanitarianTarget = "0.05"
18+
// DriftThreshold is the minimum truth verification allocation before review is triggered (90%).
19+
DriftThreshold = "0.90"
20+
// ReviewTriggerMonths is the number of months of drift before mandatory governance review.
21+
ReviewTriggerMonths = 18
22+
)
23+
24+
// BankKeeper defines the expected bank module keeper interface for governor955.
25+
type BankKeeper interface {
26+
GetBalance(ctx sdk.Context, addr sdk.AccAddress, denom string) sdk.Coin
27+
SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error
28+
}
29+
30+
// Params defines the configurable parameters for x/governor955.
31+
type Params struct {
32+
// TruthVerificationTarget is the target ratio for truth verification (default: 0.95).
33+
TruthVerificationTarget sdkmath.LegacyDec `json:"truth_verification_target"`
34+
// HumanitarianTarget is the target ratio for humanitarian access (default: 0.05).
35+
HumanitarianTarget sdkmath.LegacyDec `json:"humanitarian_target"`
36+
// ReviewTriggerMonths is how many months of drift triggers mandatory governance review.
37+
ReviewTriggerMonths int32 `json:"review_trigger_months"`
38+
// LegalDefenseFundAddress is the bech32 address of the ring-fenced Legal Defense Fund.
39+
LegalDefenseFundAddress string `json:"legal_defense_fund_address"`
40+
}
41+
42+
// DefaultParams returns the default 955 governor parameters per Constitution Art. VI.
43+
func DefaultParams() Params {
44+
return Params{
45+
TruthVerificationTarget: sdkmath.LegacyMustNewDecFromStr(TruthVerificationTarget),
46+
HumanitarianTarget: sdkmath.LegacyMustNewDecFromStr(HumanitarianTarget),
47+
ReviewTriggerMonths: ReviewTriggerMonths,
48+
LegalDefenseFundAddress: "", // Set at genesis
49+
}
50+
}
51+
52+
// RatioRecord is an on-chain snapshot of the 955 ratio at a given block.
53+
type RatioRecord struct {
54+
// BlockHeight is when the snapshot was taken.
55+
BlockHeight int64 `json:"block_height"`
56+
// TruthVerificationPct is the truth verification spend ratio at this block.
57+
TruthVerificationPct sdkmath.LegacyDec `json:"truth_verification_pct"`
58+
// HumanitarianPct is the humanitarian spend ratio at this block.
59+
HumanitarianPct sdkmath.LegacyDec `json:"humanitarian_pct"`
60+
// IsDrifting indicates whether the ratio is below the 90% drift threshold.
61+
IsDrifting bool `json:"is_drifting"`
62+
}
63+
64+
// SpendRecord tracks an individual treasury outflow.
65+
type SpendRecord struct {
66+
// Amount is the quantity of urpm spent.
67+
Amount sdkmath.Int `json:"amount"`
68+
// Category is the classification of the spend (TRUTH_VERIFICATION or HUMANITARIAN).
69+
Category string `json:"category"`
70+
// BlockHeight is the block at which the spend occurred.
71+
BlockHeight int64 `json:"block_height"`
72+
// Memo is an optional human-readable description of the expenditure.
73+
Memo string `json:"memo"`
74+
}

0 commit comments

Comments
 (0)