1k-defi-module-integration_skill

This skill guides you step-by-step to integrate new DeFi modules into OneKey, covering Earn, Borrow, and New Module scenarios.
  • TypeScript

2.3k

GitHub Stars

1

Bundled Files

2 months ago

Catalog Refreshed

4 months ago

First Indexed

Readme & install

Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.

Installation

Preview and clipboard use veilstrat where the catalogue uses aiagentskills.

npx veilstrat add skill onekeyhq/app-monorepo --skill 1k-defi-module-integration

  • SKILL.md10.5 KB

Overview

This skill guides engineers through integrating new DeFi modules or protocols (staking, lending, time-based yields, or entirely new categories) into OneKey. It defines required UI layers, state management recommendations, and decision points so integrations are consistent, safe, and testable. Use it to plan, implement, and verify Earn, Borrow, or custom DeFi modules across platforms.

How this skill works

The guide breaks a DeFi integration into four layers: Home (required), Operation Modals (required), Details (optional) and Protocol List (optional). It walks through scenario identification (Earn, Borrow, New Module, Time-Based), operation types, UI/UX patterns, and key code locations. It also prescribes state patterns (Jotai vs React Context), common components, and testing checklist items to validate pending states and responsive behavior.

When to use it

  • Adding a staking or yield protocol (e.g., Lido, Rocket Pool) under Earn
  • Adding a lending market with Supply/Withdraw/Borrow/Repay operations (e.g., Aave)
  • Creating a new DeFi category that needs its own tab or unique UI (e.g., Pendle, GMX)
  • Integrating time-based or fixed-rate assets that require maturity-aware flows
  • When you need guidance on state persistence, pending tx handling, or standard UI components

Best practices

  • Implement Home and Operation Modals first; add Details and List only if needed
  • Decide state persistence early: use Jotai for cross-navigation persistence and React Context for page-scoped state
  • Follow standardized operation counts: 2–3 ops for Earn, 4 for Borrow; adapt only when protocol requires it
  • Use existing components (StakingAmountInput, ManagePosition) and the routing structure to keep UX consistent
  • Always use i18n for user-facing strings and register new keys in the shared ETranslations enum

Example use cases

  • Integrate Lido staking: implement Home overview, Stake/Unstake/Claim modals, persist portfolio data with Jotai
  • Add a new Aave-like market: wire Supply/Withdraw/Borrow/Repay flows, show health factor, reuse ManagePosition component
  • Add a time-based product (Pendle PT): model maturity state, conditional Buy/Sell/Redeem operations, surface implied APY and maturity date
  • Create a new platform tab (GMX): design independent tab, custom modals, and multi-variant asset listing
  • Add repay-with-collateral: implement swap integration, slippage controls, and dual-amount input with bidirectional sync

FAQ

If data must persist when navigating away (cached portfolio, investment snapshots) use Jotai atoms. If state is page-scoped or should reset on exit (form inputs, temporary UI state) use React Context.

Is Earn always separate from Borrow?

Not always. Ask whether operations and data map to staking/yield patterns or lending/health-factor patterns. If ambiguous, clarify operation types and required UI before choosing Earn vs Borrow or a new module.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational
1k-defi-module-integration skill by onekeyhq/app-monorepo | VeilStrat