import { Card } from '@/libs/frontend-ui-primitives' import { DetailRow } from '@/components/common/DetailRow' import EntityBadge from '@/components/common/EntityBadge' import type { GruStandardsProfile } from '@/services/api/gru' import Link from 'next/link' const STANDARD_EXPLANATIONS: Record = { 'ERC-20': 'Base fungible-token surface for wallets, DEXs, explorers, and accounting systems.', AccessControl: 'Role-governed administration for mint, burn, pause, and supervised operations.', Pausable: 'Emergency intervention surface for freezing activity during incidents or policy actions.', 'EIP-712': 'Typed signing domain for structured off-chain approvals and payment flows.', 'ERC-2612': 'Permit support for signature-based approvals without a separate on-chain approve transaction.', 'ERC-3009': 'Authorization-based transfer model for signed payment flows without prior allowances.', 'ERC-5267': 'Discoverable EIP-712 domain introspection so wallets and relayers can inspect the signing domain cleanly.', IeMoneyToken: 'Repo-native eMoney token methodology for issuance and redemption semantics.', DeterministicStorageNamespace: 'Stable namespace for upgrade-aware policy, registry, and audit resolution.', JurisdictionAndSupervisionMetadata: 'Governance, supervisory, disclosure, and reporting metadata required by the GRU operating model.', } function formatDuration(seconds: number | null): string | null { if (seconds == null || !Number.isFinite(seconds) || seconds <= 0) return null const units = [ { label: 'day', value: 86400 }, { label: 'hour', value: 3600 }, { label: 'minute', value: 60 }, ] const parts: string[] = [] let remaining = Math.floor(seconds) for (const unit of units) { if (remaining >= unit.value) { const count = Math.floor(remaining / unit.value) remaining -= count * unit.value parts.push(`${count} ${unit.label}${count === 1 ? '' : 's'}`) } if (parts.length === 2) break } if (parts.length === 0) { return `${remaining} second${remaining === 1 ? '' : 's'}` } return parts.join(' ') } export default function GruStandardsCard({ profile, title = 'GRU v2 Standards', }: { profile: GruStandardsProfile title?: string }) { const detectedCount = profile.standards.filter((standard) => standard.detected).length const requiredCount = profile.standards.filter((standard) => standard.required).length const missingRequired = profile.standards.filter((standard) => standard.required && !standard.detected) const noticePeriod = formatDuration(profile.minimumUpgradeNoticePeriodSeconds) const recommendations = [ missingRequired.length > 0 ? `Review the live contract ABI and deployment against the GRU v2 base-token matrix before treating this asset as fully canonical.` : `The live contract exposes the full required GRU v2 base-token surface currently checked by the explorer.`, profile.wrappedTransport ? 'This looks like a wrapped transport asset, so confirm the corresponding bridge lane and reserve-verifier posture in addition to the token ABI.' : 'This looks like a canonical GRU asset, so the next meaningful checks are reserve, governance, and transport activation beyond the token interface itself.', profile.x402Ready ? 'This contract appears ready for x402-style payment flows because the explorer can see the required signature and domain surfaces.' : 'This contract does not currently look x402-ready from the live explorer surface; verify EIP-712, ERC-5267, and permit or authorization flow exposure before using it as a payment rail.', profile.forwardCanonical === true ? 'This version is marked forward-canonical, so it should be treated as the preferred successor surface even if older liquidity or transport versions still coexist.' : profile.forwardCanonical === false ? 'This version is not forward-canonical, which usually means it is legacy, staged, or transport-only relative to the intended primary canonical surface.' : 'Forward-canonical posture is not directly detectable on this contract, so rely on the transport overlay and deployment records before making promotion assumptions.', profile.legacyAliasSupport ? 'Legacy alias support is exposed, which is useful during version cutovers and explorer/search reconciliation.' : 'Legacy alias support is not visible from the current explorer contract surface, so name/version migration may need registry or deployment-record cross-checks.', 'Use the repo standards references to reconcile any missing surface with the intended GRU profile and rollout phase.', ] return (
{detectedCount} of {requiredCount} required base-token standards are currently detectable from the live contract surface.
{profile.standards.map((standard) => ( ))}
Settlement posture
{profile.wrappedTransport ? 'This contract presents itself like a wrapped public-transport asset instead of the canonical Chain 138 money surface.' : 'This contract presents itself like the canonical Chain 138 GRU money surface instead of a wrapped transport mirror.'}
Upgrade notice
{noticePeriod ? `${noticePeriod} (${profile.minimumUpgradeNoticePeriodSeconds} seconds)` : 'No readable minimum upgrade notice period was detected from the current explorer surface.'}
Version posture
{profile.activeVersion || profile.forwardVersion ? `Active liquidity/transport version: ${profile.activeVersion || 'unknown'}; preferred forward version: ${profile.forwardVersion || 'unknown'}.` : 'No explicit active-versus-forward version posture is available from the local GRU catalog yet.'}
{profile.standards.map((standard) => (
{standard.id}
{STANDARD_EXPLANATIONS[standard.id] || 'GRU-specific standard surfaced by the repo standards profile.'}
))}
{profile.metadata.length > 0 ? (
{profile.metadata.map((field) => (
{field.label}
{field.value}
))}
) : null}
Explorer GRU guide
Canonical profile: {profile.profileId}
Repo standards matrix: docs/04-configuration/GRU_C_STAR_V2_STANDARDS_MATRIX_AND_IMPLEMENTATION_PLAN.md
Machine-readable profile: config/gru-standards-profile.json
Transport overlay: config/gru-transport-active.json
x402 support note: docs/04-configuration/CHAIN138_X402_TOKEN_SUPPORT.md
Chain 138 readiness guide: docs/04-configuration/GRU_V2_CHAIN138_READINESS.md
{recommendations.map((item) => (
{item}
))}
) }