System Architecture

A verified overview of the Starc Protocol infrastructure, highlighting the integration between Circle Programmable Wallets and the StarcVaultV2 smart contracts on Arc Testnet.

Client Side
Server Side / API
Unification Layer
Settlement Layer
User Browser
Next.js Frontend
React 19, Tailwind 4
Circle W3S SDK
@circle-fin/w3s-pw-web-sdk
• Handles PIN/Biometrics
• Executes Challenges
Next.js API Routes
/api/circle/wallet
POST /execute
1. Construct Tx Payload
2. Call W3S Execution
3. Return Challenge
Circle Infrastructure
Programmable Wallets API
Smart Contract Accounts (SCA)
Starc Router
StarcRouter.sol
Aggregation Logic
1. Receive: Any Asset (mARS, nARS)
2. Swap: Convert to Base Asset
3. Deposit: Call Vault.deposit()
Arc Testnet (5042002)
StarcVaultV2.sol
ERC4626 Compliant
Single Asset: 1:1 Backing
Fee Mechanism: Mint-on-Top
Security: Pausable, AccessControl

Circle Programmable Wallets

The application leverages Circle's Web3 Services (W3S) to provide users with non-custodial, programmable wallets.

  • SDK Integration: The @circle-fin/w3s-pw-web-sdk handles sensitive user interactions (PIN entry, challenge execution) directly in the browser.
  • Contract Execution: The new /execute endpoint facilitates interaction with the StarcRouter by encoding function calls and relaying them to Circle's SCA infrastructure.

Starc Router (Unification)

The Unification Layer ensuring all roads lead to the Unified Vault.

  • Asset Swapping: Accepts non-native assets (e.g., nARS) and atomically swaps them to the Vault's base asset (USDC/mARS).
  • Atomic Deposit: Performs swap and deposit in a single transaction, minting shares directly to the merchant.

StarcVaultV2 Architecture

The core protocol logic resides in StarcVaultV2.sol, a robust implementation of the ERC4626 Tokenized Vault Standard.

  • Single-Asset Design: Eliminates oracle dependency risks and prevents "death spiral" scenarios.
  • Share-Based Fees: Fees are calculated and taken in shares, ensuring capital efficiency.

Vault Mechanics & Economics

Deposit & Fee Logic

graph TD
    User[User] -->|Deposit 100 USDC| Vault[StarcVaultV2]
    Vault -->|Mint 100 Shares| User
    Vault -->|Mint 0.1 Share (Fee)| Treasury[Treasury/RiskFund]
    
    subgraph "Dilution Effect"
    Assets[Total Assets: 100 USDC]
    Shares[Total Shares: 100.1]
    Price[Share Price: ~0.999 USDC]
    end

Fee Mechanism: The vault mints fee shares on top of user shares. This immediately dilutes the share price for all holders (including the depositor). While this avoids withdrawing assets for fees (keeping capital efficient), it creates an immediate "paper loss" for depositors.

Unified Payment Flow

✅ Solution: The Starc Router

The Starc Router bridges the gap between diverse payment tokens and the unified treasury.

The Flow:

  • Merchant Requests Payment (e.g., $50).
  • User pays with Any Asset (e.g., nARS).
  • Router Swaps nARS -> Base Asset (USDC).
  • Router Deposits Base Asset to Vault.
  • Vault Mints StarcShares to Merchant.

Target Architecture: The Unifying Router

graph LR
    User[User] -->|Pays ARS/EURC| Router[Starc Router]
    
    subgraph "Aggregation Layer"
    Router -->|Swap ARS->USDC| AMM[DEX / Curve]
    AMM -->|USDC| Router
    end
    
    Router -->|Deposit USDC| Vault[StarcVaultV2]
    Vault -->|Mint Shares| Merchant[Merchant Treasury]
    
    style Router fill:#4f46e5,stroke:#312e81,color:#fff
    style AMM fill:#db2777,stroke:#831843,color:#fff