Skip to content

[SC] Score Gatekeeper PoC: enforce min tier in lending txs #28

Description

@Cbiux

Summary

Score Gatekeeper PoC: Soroban contract or middleware that reads ZCore on-chain tier via get_score and rejects transactions below a minimum tier (e.g. Blend borrow requires Tier B+).

Proves portable credit gating for #18 Blend integration.


Background


Proposed PoC

Option A — Soroban gatekeeper contract:

  • require_min_tier(wallet, min_tier_code) → panic if get_score(wallet).tier < min
  • Invoked as sub-call from lending pool adapter

Option B — Server-side pre-check (faster PoC):

  • POST /api/user/request already evaluates lender eligibility
  • Extend with public GET /api/user/{wallet}/tier for protocols

Start with Option B if #16 not deployed; add Option A when contract ID is live.


Deliverables

Path Action
Docs/integrations/score-gatekeeper.md Tier gating flow, tier codes 0–3
Server/src/controllers/user.controller.ts Optional GET .../tier if needed
Contracts/gatekeeper/ Optional Soroban PoC

Acceptance criteria

  • Documented flow: wallet below min tier → rejected with clear error
  • Test wallet above tier → allowed
  • Uses tierCodeToLabel / on-chain read — no duplicate scoring logic
  • Works with mock contract in CI (withMockContractId)

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    GrantFox OSSPart of the GrantFox OSS programMaybe RewardedThis issue may receive a reward or bountyOfficial CampaignPart of an official ZCore campaignenhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions