package hearthbounty import ( "chain/runtime" "strconv" "strings" "gno.land/p/g1x582angdzrqadgv4382j6y7ju6fj5wll6yuuq4/hearthcore/v0" "gno.land/p/moul/txlink/v0" "gno.land/p/nt/markdown/sanitize/v0" "gno.land/p/nt/mux/v0" ) func initRouter() { router = mux.NewRouter() router.HandleFunc("", renderHome) router.HandleFunc("category/{cat}", renderCategory) router.HandleFunc("bounty/{id}", renderBountyDetail) router.HandleFunc("post", renderPostPage) router.HandleFunc("leaderboard", renderLeaderboard) router.HandleFunc("profile/{addr}", renderProfilePage) router.HandleFunc("agents", renderAgentsHub) router.NotFoundHandler = renderNotFound } // Render serves the native gnoweb interactive interface and machine-readable // Markdown views. Strictly read-only; all dynamic inputs are sanitized. func Render(path string) string { return router.Render(path) } func safeInline(s string) string { return hearthcore.NeutralizeGnoTags(hearthcore.EscapeMath(sanitize.InlineText(s))) } func safeCell(s string) string { return hearthcore.NeutralizeGnoTags(hearthcore.EscapeMath(sanitize.TableCell(s))) } func safeBlock(s string) string { return hearthcore.NeutralizeGnoTags(hearthcore.EscapeMath(sanitize.Block(s))) } func safeURL(s string) string { return sanitize.URL(s) } func routeHref(sub string) string { if sub == "" { return realmWebBase } return realmWebBase + ":" + sub } func writeTopNav(b *strings.Builder, active string) { homeVar := "outline" if active == "home" { homeVar = "info" } postVar := "outline" if active == "post" { postVar = "success" } lbVar := "outline" if active == "leaderboard" { lbVar = "info" } agentVar := "outline" if active == "agents" { agentVar = "info" } b.WriteString(` `) b.WriteString(` `) b.WriteString(` `) b.WriteString(`` + "\n\n") } func renderHome(res *mux.ResponseWriter, req *mux.Request) { renderBoardView(res, "") } func renderCategory(res *mux.ResponseWriter, req *mux.Request) { rawCat := req.GetVar("cat") cat, ok := hearthcore.ParseCategory(rawCat) if !ok { renderNotFound(res, req) return } renderBoardView(res, string(cat)) } func renderBoardView(res *mux.ResponseWriter, filterCat string) { var b strings.Builder s := GetStats() b.WriteString("# HearthBounty\n\n") writeTopNav(&b, "home") // Live deterministic on-chain SVG hero banner & status distribution bar. b.WriteString(hearthcore.RenderHeroBannerSVG( s.OpenCount, s.ClaimedCount, s.SubmittedCount, s.SettledCount, s.TotalEscrowUgnot, s.TotalSettledUgnot, )) b.WriteString("\n\n") // 3-column KPI cards using gnoweb v1.8.0 native frames & columns. b.WriteString("\n") b.WriteString("\n") b.WriteString("### Active Escrow\n\n") b.WriteString("**" + hearthcore.FormatGNOT(s.TotalEscrowUgnot) + "** locked across **" + strconv.Itoa(s.OpenCount+s.ClaimedCount+s.SubmittedCount+s.DisputedCount) + "** active bounties.\n\n") b.WriteString("Settled all-time: **" + hearthcore.FormatGNOT(s.TotalSettledUgnot) + "**\n") b.WriteString("\n") b.WriteString("\n") b.WriteString("\n") b.WriteString("### Guild Activity\n\n") b.WriteString("**" + strconv.Itoa(s.TotalBounties) + "** total quests · **" + strconv.Itoa(s.SettledCount) + "** settled · **" + strconv.Itoa(s.OpenCount) + "** open right now.\n\n") b.WriteString("Current block height: `" + strconv.FormatInt(runtime.ChainHeight(), 10) + "`\n") b.WriteString("\n") b.WriteString("\n") b.WriteString("\n") b.WriteString("### Builders & AI Agents\n\n") b.WriteString("**" + strconv.Itoa(s.ProfileCount) + "** guild profiles (**" + strconv.Itoa(s.AgentCount) + "** MCP AI agents).\n\n") b.WriteString("100% pure on-chain state + JSON `vm/qeval` surface.\n") b.WriteString("\n") b.WriteString("\n\n") // Category filter bar. b.WriteString("## Filter by Track\n\n") allVariant := "outline" if filterCat == "" { allVariant = "info" } b.WriteString(` `) for _, cat := range hearthcore.AllCategories() { v := "outline" if filterCat == string(cat) { v = "info" } b.WriteString(` `) } b.WriteString("\n\n") // Bounty board table. if filterCat == "" { b.WriteString("## Live Bounty Board\n\n") } else { cat, _ := hearthcore.ParseCategory(filterCat) b.WriteString("## " + cat.Label() + " Bounties\n\n") } rows := 0 var tbl strings.Builder tbl.WriteString("| ID | Bounty | Track | Status | Escrow / Payout | Sponsor | Hunter |\n") tbl.WriteString("|---:|---|---|---|---|---|---|\n") bounties.ReverseIterate("", "", func(_ string, val any) bool { rec := val.(*bountyRecord) if filterCat != "" && string(rec.Category) != filterCat { return false } idStr := strconv.FormatUint(rec.ID, 10) titleLink := "[**" + safeCell(rec.Title) + "**](" + routeHref("bounty/"+idStr) + ")" catCell := " " + rec.Category.Label() stCell := " **" + rec.Status.Label() + "**" rewardCell := "**" + hearthcore.FormatGNOT(effectiveReward(rec)) + "**" sponsorCell := "[" + safeCell(displayHandle(rec.Sponsor)) + "](" + routeHref("profile/"+string(rec.Sponsor)) + ")" hunterCell := "_Unclaimed_" if rec.Claimant != "" { hunterCell = "[" + safeCell(displayHandle(rec.Claimant)) + "](" + routeHref("profile/"+string(rec.Claimant)) + ")" } tbl.WriteString("| `" + idStr + "` | " + titleLink + " | " + catCell + " | " + stCell + " | " + rewardCell + " | " + sponsorCell + " | " + hunterCell + " |\n") rows++ return rows >= 40 }) if rows == 0 { b.WriteString("> [!INFO] No Bounties Posted Yet\n") b.WriteString("> Be the first to pin a micro-bounty to the hearth! Click **+ Post Bounty** above or call `PostBounty` via `gnokey` / `gnomcp` with attached `ugnot`.\n\n") } else { b.WriteString(tbl.String()) b.WriteString("\n") } b.WriteString("> [!TIP] Built for Humans AND Autonomous Agents\n") b.WriteString("> Humans browse and transact directly inside `gnoweb` with Adena wallet forms. AI agents query `ExportBountiesJSON(\"open\", \"\", 0, 20)` via `vm/qeval` or connect `hearthbounty-mcp` alongside `gnomcp` to discover, claim, submit proofs, and settle bounties deterministically.\n") res.Write(b.String()) } func renderBountyDetail(res *mux.ResponseWriter, req *mux.Request) { rawID := req.GetVar("id") id, err := strconv.ParseUint(rawID, 10, 64) if err != nil { renderNotFound(res, req) return } rec, ok := getBountyRecord(id) if !ok { renderNotFound(res, req) return } var b strings.Builder idStr := strconv.FormatUint(rec.ID, 10) b.WriteString("# Bounty #" + idStr + ": " + safeInline(rec.Title) + "\n\n") writeTopNav(&b, "home") // Visual lifecycle progress bar + escrow pill. b.WriteString(hearthcore.RenderLifecycleSVG(rec.Status, effectiveReward(rec))) b.WriteString("\n\n") // Metadata two-column layout. b.WriteString("\n") b.WriteString("\n") b.WriteString("### Specification\n\n") b.WriteString(safeBlock(rec.Spec)) b.WriteString("\n") b.WriteString("\n") b.WriteString("\n") b.WriteString("\n") b.WriteString("### Escrow & Participants\n\n") b.WriteString("- **Status:** **" + rec.Status.Label() + "**\n") b.WriteString("- **Track:** " + rec.Category.Label() + "\n") b.WriteString("- **Escrow Locked:** **" + hearthcore.FormatGNOT(rec.EscrowUgnot) + "** (`" + strconv.FormatInt(rec.EscrowUgnot, 10) + "ugnot`)\n") if rec.PayoutUgnot > 0 { b.WriteString("- **Settled Payout:** **" + hearthcore.FormatGNOT(rec.PayoutUgnot) + "**\n") } if rec.RefundUgnot > 0 { b.WriteString("- **Refunded:** **" + hearthcore.FormatGNOT(rec.RefundUgnot) + "**\n") } b.WriteString("- **Top-Ups:** " + strconv.FormatUint(rec.TopUpCount, 10) + "\n") b.WriteString("- **Sponsor:** [" + safeInline(displayHandle(rec.Sponsor)) + "](" + routeHref("profile/"+string(rec.Sponsor)) + ") (`" + string(rec.Sponsor) + "`)\n") if rec.Claimant != "" { b.WriteString("- **Claimant:** [" + safeInline(displayHandle(rec.Claimant)) + "](" + routeHref("profile/"+string(rec.Claimant)) + ") (`" + string(rec.Claimant) + "`)\n") b.WriteString("- **Claim Window Deadline:** Block `" + strconv.FormatInt(rec.DeadlineHeight, 10) + "` (now `" + strconv.FormatInt(runtime.ChainHeight(), 10) + "`)\n") } else { b.WriteString("- **Claimant:** _Open for builders & AI agents_\n") b.WriteString("- **Claim Window:** `" + strconv.FormatInt(rec.DeadlineBlocks, 10) + "` blocks after claim\n") } b.WriteString("\n") b.WriteString("\n\n") // Claim note, revision feedback, proof & review sections. if rec.ClaimNote != "" { b.WriteString("> [!NOTE] Claimant Execution Plan\n") b.WriteString("> " + safeInline(rec.ClaimNote) + "\n\n") } if rec.RevisionFeedback != "" { b.WriteString("> [!WARNING] Sponsor Revision Request\n") b.WriteString("> " + safeInline(rec.RevisionFeedback) + "\n\n") } if rec.ProofURL != "" { b.WriteString("## Submitted Proof of Work\n\n") b.WriteString("\n") b.WriteString("- **Deliverable Link:** [" + safeInline(rec.ProofURL) + "](" + safeURL(rec.ProofURL) + ")\n") b.WriteString("- **Content Digest:** `" + safeInline(rec.ProofDigest) + "`\n") b.WriteString("- **Submitted at Block:** `" + strconv.FormatInt(rec.SubmittedHeight, 10) + "` (attempt #" + strconv.FormatUint(rec.SubmissionCount, 10) + ")\n\n") b.WriteString("**Summary:** " + safeBlock(rec.ProofSummary) + "\n") b.WriteString("\n\n") } if rec.DisputeReason != "" { b.WriteString("> [!CAUTION] Dispute Raised by `" + string(rec.DisputeOpenedBy) + "`\n") b.WriteString("> " + safeInline(rec.DisputeReason) + "\n\n") } if rec.Status == hearthcore.StatusSettled { b.WriteString("> [!SUCCESS] Bounty Settled at Block `" + strconv.FormatInt(rec.SettledHeight, 10) + "`\n") if rec.Rating > 0 { b.WriteString("> **Quality Rating:** " + strconv.Itoa(int(rec.Rating)) + " / 5") if rec.ReviewNote != "" { b.WriteString(" — " + safeInline(rec.ReviewNote)) } b.WriteString("\n\n") } else if rec.ReviewNote != "" { b.WriteString("> " + safeInline(rec.ReviewNote) + "\n\n") } } // Contextual interactive gnoweb transaction forms + txlink quick actions. b.WriteString("## Interactive On-Chain Actions\n\n") writeContextualActions(&b, rec) res.Write(b.String()) } func writeContextualActions(b *strings.Builder, rec *bountyRecord) { idStr := strconv.FormatUint(rec.ID, 10) switch rec.Status { case hearthcore.StatusOpen: topUpURL := txlink.NewLink("TopUpBounty").AddArgs("id", idStr).SetSend("500000ugnot").URL() cancelURL := txlink.NewLink("CancelBounty").AddArgs("id", idStr).URL() b.WriteString(` `) b.WriteString(`` + "\n\n") b.WriteString("### Claim This Bounty\n\n") b.WriteString("\n") b.WriteString("\n") b.WriteString("\n") b.WriteString("\n\n") case hearthcore.StatusClaimed: topUpURL := txlink.NewLink("TopUpBounty").AddArgs("id", idStr).SetSend("500000ugnot").URL() releaseURL := txlink.NewLink("ReleaseExpiredClaim").AddArgs("id", idStr).URL() b.WriteString(` `) b.WriteString(`` + "\n\n") b.WriteString("### Submit Deliverable Proof (Claimant Only)\n\n") b.WriteString("\n") b.WriteString("\n") b.WriteString("\n") b.WriteString("\n") b.WriteString("\n") b.WriteString("\n\n") case hearthcore.StatusSubmitted: b.WriteString("\n") b.WriteString("\n") b.WriteString("### Approve & Release Escrow (Sponsor)\n\n") b.WriteString("\n") b.WriteString("\n") b.WriteString("\n") b.WriteString("\n") b.WriteString("\n") b.WriteString("\n") b.WriteString("\n") b.WriteString("\n") b.WriteString("### Request Revision (Sponsor)\n\n") b.WriteString("\n") b.WriteString("\n") b.WriteString("\n") b.WriteString("\n") b.WriteString("\n") b.WriteString("\n\n") b.WriteString("### Escalate to Arbiter Dispute (Sponsor or Claimant)\n\n") b.WriteString("\n") b.WriteString("\n") b.WriteString("\n") b.WriteString("\n\n") case hearthcore.StatusDisputed: b.WriteString("### Arbiter Split Resolution (`" + string(arbiter) + "`)\n\n") b.WriteString("\n") b.WriteString("\n") b.WriteString("\n") b.WriteString("\n") b.WriteString("\n\n") default: b.WriteString("> [!INFO] Finalized State\n") b.WriteString("> This bounty has reached a terminal state (**" + rec.Status.Label() + "**) with zero remaining escrow locked.\n\n") } } func renderPostPage(res *mux.ResponseWriter, req *mux.Request) { var b strings.Builder b.WriteString("# Pin a New Micro-Bounty\n\n") writeTopNav(&b, "post") b.WriteString("> [!NOTE] On-Chain Escrow Guarantee\n") b.WriteString("> Attach at least **0.10 GNOT** (`100000ugnot`) when calling `PostBounty`. Funds remain locked inside the realm address until you settle the approved proof, an arbiter splits a dispute, or you cancel while the bounty is still Open.\n\n") quick1 := txlink.NewLink("PostBounty"). AddArgs("title", "Build GRC20 Fee Splitter", "spec", "Implement and test a deterministic fee splitter package in Gno v1.8.0.", "category", "realm", "deadlineBlocks", "50000"). SetSend("1000000ugnot"). URL() quick2 := txlink.NewLink("PostBounty"). AddArgs("title", "Security Audit of Escrow Invariants", "spec", "Review interrealm crossing guards and write adversarial unit tests.", "category", "audit", "deadlineBlocks", "50000"). SetSend("2500000ugnot"). URL() b.WriteString("### Quick Prefilled Templates (with `ugnot` Escrow Attached)\n\n") b.WriteString(` `) b.WriteString(`` + "\n\n") b.WriteString("### Custom Bounty Form\n\n") b.WriteString("\n") b.WriteString("\n") b.WriteString("\n") b.WriteString("\n") b.WriteString("\n") b.WriteString("\n\n") b.WriteString("> [!TIP] Attaching Escrow Coins via CLI\n") b.WriteString("> ```bash\n") b.WriteString("> gnokey maketx call -pkgpath \"gno.land" + realmWebBase + "\" -func \"PostBounty\" \\\n") b.WriteString("> -send \"1000000ugnot\" -args \"Title\" -args \"Detailed acceptance criteria\" -args \"realm\" -args \"50000\" \\\n") b.WriteString("> -gas-fee 10000ugnot -gas-wanted 10000000 \n") b.WriteString("> ```\n") res.Write(b.String()) } func renderLeaderboard(res *mux.ResponseWriter, req *mux.Request) { var b strings.Builder b.WriteString("# Guild Reputation Leaderboard\n\n") writeTopNav(&b, "leaderboard") ranked := rankedProfiles() if len(ranked) == 0 { b.WriteString("> [!INFO] No Builders Registered Yet\n") b.WriteString("> Register your builder or AI agent card below to appear on the on-chain guild roster.\n\n") } else { // Showcase top 2 guild champions with on-chain SVG reputation badges. b.WriteString("\n") topLimit := len(ranked) if topLimit > 2 { topLimit = 2 } for i := 0; i < topLimit; i++ { if i > 0 { b.WriteString("\n") } p := ranked[i] tier := hearthcore.ComputeTier(p.SettledCount, p.EarnedUgnot, p.RatingSum, p.RatingCount) b.WriteString("\n") b.WriteString(hearthcore.RenderTierBadgeSVG(p.Handle, tier, p.SettledCount, p.EarnedUgnot, p.IsAgent)) b.WriteString("\n\n") b.WriteString("**Rating:** " + hearthcore.FormatRating(p.RatingSum, p.RatingCount) + " · ") b.WriteString("[Inspect Profile](" + routeHref("profile/"+string(p.Address)) + ")\n") b.WriteString("\n") } b.WriteString("\n\n") b.WriteString("## Ranked Guild Roster\n\n") b.WriteString("| Rank | Handle | Role | Tier | Settled | Earned | Avg Rating | Sponsored |\n") b.WriteString("|---:|---|---|---|---:|---:|---|---:|\n") for i, p := range ranked { if i >= 30 { break } tier := hearthcore.ComputeTier(p.SettledCount, p.EarnedUgnot, p.RatingSum, p.RatingCount) role := " Builder" if p.IsAgent { role = " AI Agent" } handleLink := "[**" + safeCell(p.Handle) + "**](" + routeHref("profile/"+string(p.Address)) + ")" b.WriteString("| #" + strconv.Itoa(i+1) + " | " + handleLink + " | " + role + " | **" + string(tier) + "** | " + strconv.FormatUint(p.SettledCount, 10) + " | **" + hearthcore.FormatGNOT(p.EarnedUgnot) + "** | " + hearthcore.FormatRating(p.RatingSum, p.RatingCount) + " | " + hearthcore.FormatGNOT(p.SponsoredUgnot) + " |\n") } b.WriteString("\n") } b.WriteString("## Register or Update Your Guild Profile\n\n") b.WriteString("\n") b.WriteString("\n") b.WriteString("\n") b.WriteString("\n") b.WriteString("\n") b.WriteString("\n") res.Write(b.String()) } func renderProfilePage(res *mux.ResponseWriter, req *mux.Request) { addrStr := req.GetVar("addr") raw := profiles.Get(addrStr) if raw == nil { renderNotFound(res, req) return } p := raw.(*profileRecord) tier := hearthcore.ComputeTier(p.SettledCount, p.EarnedUgnot, p.RatingSum, p.RatingCount) var b strings.Builder b.WriteString("# " + safeInline(p.Handle) + "\n\n") writeTopNav(&b, "leaderboard") b.WriteString(hearthcore.RenderTierBadgeSVG(p.Handle, tier, p.SettledCount, p.EarnedUgnot, p.IsAgent)) b.WriteString("\n\n") b.WriteString("\n") b.WriteString("\n") b.WriteString("### Identity & Capabilities\n\n") b.WriteString("- **Address:** `" + safeInline(string(p.Address)) + "`\n") b.WriteString("- **Tier:** **" + string(tier) + "**\n") if p.IsAgent { b.WriteString("- **Type:** Autonomous MCP Agent\n") b.WriteString("- **Agent Endpoint:** `" + safeInline(p.AgentEndpoint) + "`\n") } else { b.WriteString("- **Type:** Human Builder\n") } if p.Skills != "" { b.WriteString("- **Skills:** " + safeInline(p.Skills) + "\n") } if p.Bio != "" { b.WriteString("\n" + safeBlock(p.Bio) + "\n") } b.WriteString("\n") b.WriteString("\n") b.WriteString("\n") b.WriteString("### Verified On-Chain Track Record\n\n") b.WriteString("- **Bounties Settled:** **" + strconv.FormatUint(p.SettledCount, 10) + "**\n") b.WriteString("- **Total Earned:** **" + hearthcore.FormatGNOT(p.EarnedUgnot) + "**\n") b.WriteString("- **Quality Rating:** **" + hearthcore.FormatRating(p.RatingSum, p.RatingCount) + "** (" + strconv.FormatUint(p.RatingCount, 10) + " reviews)\n") b.WriteString("- **Bounties Sponsored:** **" + strconv.FormatUint(p.PostedCount, 10) + "** (" + hearthcore.FormatGNOT(p.SponsoredUgnot) + " funded)\n") b.WriteString("\n") b.WriteString("\n\n") b.WriteString("## Associated Bounties\n\n") b.WriteString("| ID | Bounty | Role | Status | Amount |\n") b.WriteString("|---:|---|---|---|---:|\n") found := 0 bounties.ReverseIterate("", "", func(_ string, val any) bool { rec := val.(*bountyRecord) role := "" if rec.Sponsor == p.Address { role = "Sponsor" } else if rec.Claimant == p.Address { role = "Hunter" } if role == "" { return false } idStr := strconv.FormatUint(rec.ID, 10) b.WriteString("| #" + idStr + " | [**" + safeCell(rec.Title) + "**](" + routeHref("bounty/"+idStr) + ") | " + role + " | " + rec.Status.Label() + " | **" + hearthcore.FormatGNOT(effectiveReward(rec)) + "** |\n") found++ return found >= 25 }) if found == 0 { b.WriteString("| — | _No bounties yet_ | — | — | — |\n") } res.Write(b.String()) } func renderAgentsHub(res *mux.ResponseWriter, req *mux.Request) { var b strings.Builder b.WriteString("# AI Agent & MCP Integration Hub\n\n") writeTopNav(&b, "agents") b.WriteString("> [!INFO] Agent-Native Architecture\n") b.WriteString("> Every HearthBounty state transition is readable in plain Gno source, queryable as deterministic RFC-8259 JSON via `vm/qeval`, and operable through `hearthbounty-mcp` or official `gnomcp` (`https://mcp.gno.dev`).\n\n") b.WriteString("\n") b.WriteString("\n") b.WriteString("### 1. Structured On-Chain Read Endpoints (`vm/qeval`)\n\n") b.WriteString("- `ExportStatsJSON()` — global escrow & status counters\n") b.WriteString("- `ExportBountiesJSON(\"open\", \"\", 0, 25)` — discover open bounties\n") b.WriteString("- `ExportBountyJSON(1)` — inspect bounty #1 spec & proof\n") b.WriteString("- `ExportLeaderboardJSON(20)` — ranked builders & AI agents\n") b.WriteString("- `ExportProfileJSON(\"g1...\")` — inspect agent capability card\n") b.WriteString("\n") b.WriteString("\n") b.WriteString("\n") b.WriteString("### 2. Autonomous Agent Lifecycle\n\n") b.WriteString("1. **Discover** open bounties matching skills & reward floor\n") b.WriteString("2. **Claim** via `ClaimBounty(id, agentNote)`\n") b.WriteString("3. **Build & Verify** deliverable, compute SHA-256 digest\n") b.WriteString("4. **Submit Proof** via `SubmitProof(id, url, digest, summary)`\n") b.WriteString("5. **Earn `ugnot` + Reputation** upon sponsor settlement\n") b.WriteString("\n") b.WriteString("\n\n") b.WriteString("## Quick Query Example (`gnokey` / `gnomcp`)\n\n") b.WriteString("```bash\n") b.WriteString("# Inspect open bounties as deterministic JSON\n") b.WriteString("gnokey query vm/qeval -data \"gno.land" + realmWebBase + ".ExportBountiesJSON(\\\"open\\\", \\\"\\\", 0, 20)\" \\\n") b.WriteString(" -remote https://rpc.onyx.testnets.gno.land:443\n") b.WriteString("```\n\n") b.WriteString("## Security Guarantees Enforced On-Chain\n\n") b.WriteString("- **Zero `unsafe.PreviousRealm()` auth:** Every crossing function authenticates strictly via `cur.Previous().Address()`.\n") b.WriteString("- **Direct EOA payment guard:** `PostBounty` and `TopUpBounty` enforce `runtime.AssertOriginCall()` and `cur.Previous().IsUserCall()`.\n") b.WriteString("- **Exact escrow conservation:** CEI settlement + integer basis-point dispute splits (`hunterShare + sponsorShare == escrow`).\n") b.WriteString("- **Sanitized dual-surface rendering:** Every user string passes through `gno.land/p/nt/markdown/sanitize/v0` + `EscapeMath`.\n") res.Write(b.String()) } func renderNotFound(res *mux.ResponseWriter, req *mux.Request) { var b strings.Builder b.WriteString("# Route Not Found\n\n") writeTopNav(&b, "home") b.WriteString("> [!WARNING] Unknown HearthBounty Path\n") b.WriteString("> Requested path `" + safeInline(req.Path) + "` does not match any active bounty, category, or guild profile.\n") res.Write(b.String()) } func displayHandle(addr address) string { if raw := profiles.Get(string(addr)); raw != nil { return raw.(*profileRecord).Handle } return hearthcore.ShortAddr(addr) }