Skip to content

feat: Sponsor Portal — deposit USDC, receive GOV tokens, participate in governance #1017

Description

@Anuoluwapo25

Summary

The Sponsor Portal (/sponsor) is currently a placeholder. This issue is to implement the full sponsor/donor workflow: connect wallet → deposit USDC to the treasury → receive GOV governance tokens → vote on scholarship proposals.

User flow

Sponsor connects Freighter wallet
  → Sees their USDC balance and current GOV holdings
  → Enters deposit amount
  → Approves USDC transfer (Freighter signs)
  → Calls scholarship_treasury.deposit(donor, amount, usdc_token_address)
  → Receives GOV tokens at 100:1 rate (100 USDC = 1 GOV, each GOV = 10,000 atomic units)
  → Can now vote on active scholarship proposals
  → Can delegate voting power to another address

What to build

Frontend (src/pages/SponsorPortal.tsx)

  • Wallet connection gate (redirect if not connected)
  • USDC balance display (query Stellar horizon or SAC balance)
  • GOV token balance and voting power display (use GET /api/governance/voting-power/:address)
  • Deposit form: amount input → calls POST /api/treasury/deposit
  • Delegation panel: delegate GOV voting power (calls governance token delegate())
  • List of active proposals the sponsor can vote on (links to /dao/proposals)
  • Transaction history: past deposits and votes

Backend (POST /api/treasury/deposit)

New endpoint:

POST /api/treasury/deposit
Body: { donor_address: string, amount: number, tx_hash: string }
  • Verifies the Stellar transaction (horizon lookup by tx_hash)
  • Confirms deposit() was called on the treasury contract with correct args
  • Records contribution in a treasury_deposits table
  • Returns updated GOV balance

Database migration

CREATE TABLE IF NOT EXISTS treasury_deposits (
  id             SERIAL PRIMARY KEY,
  donor_address  TEXT NOT NULL,
  amount_usdc    NUMERIC NOT NULL,
  gov_issued     NUMERIC NOT NULL,
  tx_hash        TEXT NOT NULL UNIQUE,
  created_at     TIMESTAMPTZ DEFAULT NOW()
);

Contract interface

// contracts/scholarship_treasury/src/lib.rs
pub fn deposit(env: Env, donor: Address, amount: i128, asset: Address)
// Mints GOV tokens at 100:1 rate to the donor

Relevant existing code

File Notes
GET /api/treasury/stats Already queries on-chain events for total deposited
GET /api/governance/voting-power/:address Already returns GOV balance + voting power
GET /api/governance/delegation/:address Already returns current delegate
contracts/scholarship_treasury/src/lib.rs deposit() is fully implemented

Acceptance criteria

  • Sponsor can connect wallet and see their USDC and GOV balances
  • Deposit form submits a real Soroban transaction (signed by Freighter)
  • GOV tokens appear in the sponsor's balance after deposit
  • Sponsor can delegate their voting power
  • Deposit is recorded in DB for audit trail
  • No hardcoded or simulated data in the UI

Metadata

Metadata

Assignees

No one assigned

    Labels

    GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial Campaign | FWC26Campaign: Official Campaign | FWC26backendAPI/database/infrastructureenhancementNew feature or requestfrontendReact/TypeScript UI worksmart-contractSoroban/Rust contract work

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions