Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 11b1585913 | |||
| b6f041b5af | |||
| c0bd9eedf5 |
@@ -0,0 +1,79 @@
|
|||||||
|
package types
|
||||||
|
|
||||||
|
import "encoding/json"
|
||||||
|
|
||||||
|
const (
|
||||||
|
ModuleName = "mesh"
|
||||||
|
StoreKey = ModuleName
|
||||||
|
RouterKey = ModuleName
|
||||||
|
QuerierRoute = ModuleName
|
||||||
|
)
|
||||||
|
|
||||||
|
// Four Faces of the mesh experience (§8)
|
||||||
|
// Reach (who you are), Standing (who you can trust),
|
||||||
|
// Maps (where you are), Pay (how value flows)
|
||||||
|
type MeshFace string
|
||||||
|
|
||||||
|
const (
|
||||||
|
FaceReach MeshFace = "Reach"
|
||||||
|
FaceStanding MeshFace = "Standing"
|
||||||
|
FaceMaps MeshFace = "Maps"
|
||||||
|
FacePay MeshFace = "Pay"
|
||||||
|
)
|
||||||
|
|
||||||
|
// AllFaces returns the four mesh faces (§8)
|
||||||
|
func AllFaces() []MeshFace {
|
||||||
|
return []MeshFace{FaceReach, FaceStanding, FaceMaps, FacePay}
|
||||||
|
}
|
||||||
|
|
||||||
|
// MapEntry is a discovery entry (§8: Maps — where you are, what's around)
|
||||||
|
type MapEntry struct {
|
||||||
|
EntryID string `json:"entry_id" yaml:"entry_id"`
|
||||||
|
Name string `json:"name" yaml:"name"`
|
||||||
|
Latitude float64 `json:"latitude" yaml:"latitude"`
|
||||||
|
Longitude float64 `json:"longitude" yaml:"longitude"`
|
||||||
|
Category string `json:"category" yaml:"category"` // Op, Pier, service
|
||||||
|
HolderID string `json:"holder_id" yaml:"holder_id"`
|
||||||
|
IsOp bool `json:"is_op" yaml:"is_op"`
|
||||||
|
IsPier bool `json:"is_pier" yaml:"is_pier"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// PayAct represents a Pass-Act (value flow, §8: Pay)
|
||||||
|
type PayAct struct {
|
||||||
|
PassID string `json:"pass_id" yaml:"pass_id"`
|
||||||
|
FromStashID string `json:"from_stash_id" yaml:"from_stash_id"`
|
||||||
|
ToStashID string `json:"to_stash_id" yaml:"to_stash_id"`
|
||||||
|
AmountGrain int64 `json:"amount_grain" yaml:"amount_grain"`
|
||||||
|
FeeGrain int64 `json:"fee_grain" yaml:"fee_grain"`
|
||||||
|
IsLongPass bool `json:"is_long_pass" yaml:"is_long_pass"` // remittance
|
||||||
|
Timestamp int64 `json:"timestamp" yaml:"timestamp"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// ExitLayerType defines Layer 3 exit methods (§7)
|
||||||
|
type ExitLayerType string
|
||||||
|
|
||||||
|
const (
|
||||||
|
ExitDEX ExitLayerType = "DEX"
|
||||||
|
ExitBridge ExitLayerType = "Bridge"
|
||||||
|
ExitOffMesh ExitLayerType = "OffMesh"
|
||||||
|
)
|
||||||
|
|
||||||
|
// MayasDayPlaceholder — full narrative deferred to component doc (§8, Q1)
|
||||||
|
// The mesh is one environment with four invisible primitives
|
||||||
|
// activating simultaneously. A Holder doesn't open apps — they live in the mesh.
|
||||||
|
const MayasDayPlaceholder = "Maya's Day narrative deferred to Mesh Experience component doc (Architecture Q1)"
|
||||||
|
|
||||||
|
type Params struct{}
|
||||||
|
|
||||||
|
func DefaultParams() Params { return Params{} }
|
||||||
|
|
||||||
|
type GenesisState struct {
|
||||||
|
Params Params `json:"params" yaml:"params"`
|
||||||
|
MapEntries []MapEntry `json:"map_entries" yaml:"map_entries"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func DefaultGenesisState() *GenesisState {
|
||||||
|
return &GenesisState{Params: DefaultParams(), MapEntries: []MapEntry{}}
|
||||||
|
}
|
||||||
|
|
||||||
|
func ValidateGenesis(bz json.RawMessage) error { return nil }
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
package types_test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"github.com/oy/openyield/x/mesh/types"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestFourFaces(t *testing.T) {
|
||||||
|
faces := types.AllFaces()
|
||||||
|
if len(faces) != 4 {
|
||||||
|
t.Errorf("Expected 4 mesh faces (§8), got %d", len(faces))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestFaceNames(t *testing.T) {
|
||||||
|
expected := map[types.MeshFace]bool{
|
||||||
|
types.FaceReach: true, types.FaceStanding: true,
|
||||||
|
types.FaceMaps: true, types.FacePay: true,
|
||||||
|
}
|
||||||
|
for _, f := range types.AllFaces() {
|
||||||
|
if !expected[f] {
|
||||||
|
t.Errorf("Unexpected face: %s", f)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestExitLayerTypes(t *testing.T) {
|
||||||
|
exits := []types.ExitLayerType{types.ExitDEX, types.ExitBridge, types.ExitOffMesh}
|
||||||
|
if len(exits) != 3 {
|
||||||
|
t.Errorf("Expected 3 exit layer types (§7), got %d", len(exits))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestMayasDayPlaceholder(t *testing.T) {
|
||||||
|
if types.MayasDayPlaceholder == "" {
|
||||||
|
t.Error("Maya's Day placeholder should note deferral (§8, Q1)")
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user