Skip to content

transactions working for vault + portfolio#7

Merged
aayusha59 merged 1 commit into
mainfrom
solana-devnet
Jan 18, 2026
Merged

transactions working for vault + portfolio#7
aayusha59 merged 1 commit into
mainfrom
solana-devnet

Conversation

@aayusha59
Copy link
Copy Markdown
Owner

@aayusha59 aayusha59 commented Jan 18, 2026

Summary by CodeRabbit

  • New Features

    • Added Positions page to view portfolio overview, total protected value, accrued yield, and active positions
    • Enhanced deposit flow with No-Loss protection indicators and principal protection guarantees
    • Implemented position tracking with yield calculations and APY displays
    • Updated market cards with Stake buttons and No-Loss badges in the navigation
  • Chores

    • Updated program configuration for devnet deployment

✏️ Tip: You can customize this high-level summary in your review settings.

@vercel
Copy link
Copy Markdown

vercel Bot commented Jan 18, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
v0-skal-ventures-template-hm Building Building Preview, Comment Jan 18, 2026 2:08am

@aayusha59 aayusha59 merged commit 916c5bc into main Jan 18, 2026
1 of 2 checks passed
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jan 18, 2026

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

Adds a new positions tracking and display feature to the frontend, including a dedicated positions page, a React hook for localStorage-persisted position management with yield calculations, and enhanced deposit flow with market expiry awareness. Also updates deployment configuration with actual program IDs and adds a build script for environment setup.

Changes

Cohort / File(s) Summary
New Positions Page & Navigation
app/positions/page.tsx, components/header.tsx
Introduces new /positions page route with header styling and adds "Positions" navigation link in header alongside "Markets".
Position Management Hook
hooks/use-positions.ts
Implements new usePositions hook with localStorage-persisted position data, continuous APY yield calculations (0.12 mock rate), position creation via addPosition, and wallet-aware state management. Exports UserPosition interface with metadata fields.
Position Listing Component
components/positions-list.tsx
Creates new PositionsList component displaying positions summary (total protected value, accrued yield, active count), empty state redirect, per-position details (market question, principal, yield duration), expiry status, and claim payout button for expired positions.
Deposit Modal & Market Card Updates
components/deposit-modal.tsx, components/market-card.tsx
Adds marketExpiry prop to DepositModal, introduces "No-Loss" concept with shields/badges, updates success state messaging ("Position Secured!"), enhances outcome breakdown with principal protection details, and passes expiry to position creation. Market card updated to show "Stake on Yes/No" button with No-Loss badge and pass market.endDate as marketExpiry.
Solana Configuration & Program ID Updates
Anchor.toml, lib/solana/constants.ts, programs/polyield_vault/src/lib.rs, programs/polyield_vault/Cargo.toml
Replaces placeholder program ID "111...111" with deployed devnet address "FWGiD7WhXu8k7eDtEwr3ZbXbvqwL7kdJgNfugrSVJ7F3" across config and Rust program declaration. Adds [toolchain] section with anchor_version = "0.30.1" to Anchor.toml. Minor formatting adjustment in Cargo.toml dependency.
Deposit Transaction Logic
lib/solana/deposit.ts
Temporarily replaces on-chain Anchor deposit instruction with direct USDC transfer to vault ATA, including ATA creation logic. Original Anchor instruction path commented out for future deployment.
Build Script & Artifacts
build.sh, target/.rustc_info.json, target/deploy/polyield_vault-keypair.json
Adds build script for Rust/Anchor environment setup (PATH augmentation, version printing, anchor build invocation). Includes generated rustc metadata and keypair file artifacts.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant UI as MarketCard / DepositModal
    participant Hook as usePositions Hook
    participant Storage as localStorage
    
    User->>UI: Click "Stake on Yes/No"
    UI->>UI: Open DepositModal with marketExpiry
    User->>UI: Confirm deposit amount
    UI->>Hook: Call addPosition(marketId, marketQuestion,<br/>position, amount, expiryTimestamp)
    Hook->>Storage: Persist new UserPosition
    Storage-->>Hook: Position saved
    Hook-->>UI: Return void
    UI->>User: Display "Position Secured!" success
    Note over Storage: Position tracked with<br/>timestamp & expiry
    
    par Continuous Tracking
        Hook->>Hook: Calculate yield on mount & storage events<br/>using MOCK_APY (0.12) & elapsed time
        Hook->>Storage: Load & sync positions from storage
    end
    
    User->>User: Navigate to /positions
    UI->>Hook: usePositions() → fetch all positions
    Hook->>Storage: Read polyield_positions_<publicKey>
    Storage-->>Hook: Return positions array
    Hook->>Hook: Compute totalYield, totalValue<br/>via APY formula
    Hook-->>UI: Return positions, totalYield, totalValue, apy
    UI->>User: Render PositionsList with<br/>summary & position details
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~70 minutes

Poem

🐰 Positions now tracked with shield so bright,
LocalStorage keeps yields in sight,
From market to stake to claim at last,
No-Loss protection holds steadfast!
A positions page to view them all—
Hop along, your yields won't fall! 🛡️✨

✨ Finishing touches
  • 📝 Generate docstrings

Comment @coderabbitai help to get the list of available commands and usage tips.

This was referenced Jan 18, 2026
Merged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant