Skip to content

Feature/on chain position storage#13

Merged
aayusha59 merged 3 commits into
mainfrom
feature/on-chain-position-storage
Jan 18, 2026
Merged

Feature/on chain position storage#13
aayusha59 merged 3 commits into
mainfrom
feature/on-chain-position-storage

Conversation

@aayusha59
Copy link
Copy Markdown
Owner

@aayusha59 aayusha59 commented Jan 18, 2026

updating

Summary by CodeRabbit

  • Refactor
    • Simplified deposit process with reduced parameter requirements for improved usability
    • Optimized position loading mechanism using local storage for faster performance and responsiveness

✏️ 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:53am

@aayusha59 aayusha59 merged commit a59e908 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

The changes shift position data storage from blockchain queries to localStorage and simplify the deposit flow by removing marketQuestion and expiry parameters. On-chain memo-based data persistence is removed, with the deposit interface reduced to accept only amount, marketId, and position.

Changes

Cohort / File(s) Summary
Deposit Function Simplification
hooks/use-deposit.ts, lib/solana/deposit.ts
Removed marketQuestion and expiry parameters from deposit function signature and DepositParams interface. Eliminated MEMO_PROGRAM_ID constant and all memo instruction generation logic. Updated buildDepositTransaction call site to omit removed fields.
Position Management Architecture Shift
hooks/use-positions.ts
Refactored from blockchain-based position loading (using signatures, transactions, memo parsing) to localStorage-based loading. Removed on-chain dependencies (useConnection, getSignaturesForAddress, getParsedTransactions). Added storage event listener for localStorage changes. Positions now persisted locally under polyield_positions_<pubkey> key. Public API signature unchanged.

Sequence Diagram(s)

sequenceDiagram
    participant Component
    participant usePositions Hook
    participant localStorage
    participant Browser Event
    
    Component->>usePositions Hook: Invoke hook
    usePositions Hook->>localStorage: Read polyield_positions_<pubkey>
    localStorage-->>usePositions Hook: Return stored positions
    usePositions Hook->>usePositions Hook: Initialize state
    usePositions Hook-->>Component: Return positions
    
    Browser Event->>usePositions Hook: storage event (on change)
    usePositions Hook->>localStorage: Refresh positions from storage
    localStorage-->>usePositions Hook: Updated position data
    usePositions Hook->>Component: Trigger re-render with new positions
    
    Component->>usePositions Hook: Call addPosition()
    usePositions Hook->>usePositions Hook: Update state
    usePositions Hook->>localStorage: Write updated positions
    localStorage-->>Browser Event: Emit storage event
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 No more memos floating on-chain so high,
We store our positions where browsers apply!
localStorage whispers when data takes flight,
Simpler deposits, and local feels right.
From blockchain to browser, a hop and a bound! 🌿

✨ Finishing touches
  • 📝 Generate docstrings

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

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