CtrlK
BlogDocsLog inGet started
Tessl Logo

1k-defi-module-integration

OneKey App Earn, Borrow, Staking, and DeFi Portfolio implementation or debugging. Use for protocol data, action visibility, claim/withdraw/repay, transactions, pending/history, refresh, and Earn routes.

75

Quality

92%

Does it follow best practices?

Run evals on this skill

Adds up to 20 points to the overall score

View guide

SecuritybySnyk

Medium

Suggest reviewing before use

SKILL.md
Quality
Evals
Security

Earn / DeFi Domain Guide

Use this skill as an owner and contract router. Ground every decision in the current code, payload, and owning service; do not treat an old issue or implementation snapshot as product truth.

Working Loop

  1. Observe the failing or requested user path. If the user names an issue, thread, PR, payload, or server contract, inspect its current state.
  2. Locate the first wrong owner: entry/route, UI state, portfolio data, supported action, transaction builder, order/status, or refresh.
  3. Write down the stable identity and sequence before editing: account, network, provider, position, action, amount units, setup, business action, terminal state, and refresh target.
  4. Find the closest current implementation with rg; reuse it only where its identity and operation semantics match.
  5. Change the smallest stable owner and protect the nearest sibling protocols, actions, routes, and platforms.
  6. Run focused tests and exercise the real owning route. If the fix fails, revisit the owner and contract instead of adding another local exception.

Owner Router

Symptom or changeStart withLoad
Earn home, list, recommendation, or detailEarn view/state owner and its service requestapp-architecture.md, code-map.md
Borrow market, reserve, collateral, or health factorBorrow view/hooks plus current lending contractoperation-flow.md
Portfolio action missing or failingPosition metadata, supported actions, then transaction builderportfolio-actions-guide.md
Claim, withdraw, repay, approval, permit, or order statusOperation sequence and terminal ownershipoperation-flow.md
Native route, modal, restart, event, or account switchPlatform host and runtime ownershipapp-architecture.md
External protocol websiteDiscovery/browser until a chain RPC enters the Appapp-architecture.md
Funding or conversion after a handoff to SwapDeFi owns the prefill; Swap owns execution after quoting starts$1k-trade-swap-market

Stable Contracts

  • Trace the full path from entry and data through action, setup, business transaction, status, and refresh. A successful build response is not a completed action.
  • Preserve account, network, provider, position, action, token, and route identity across modal params, background calls, pending rows, and events.
  • Treat portfolio positions, supported actions, and transaction building as separate contracts. Never infer all three from one response.
  • Derive claim/config token and vault identity from current service data; never infer either from provider identity.
  • Keep approval/permit/setup separate from the business transaction. Every success, failure, and cancel terminal must release duplicate-submit state.
  • Refresh only the affected account/network after a successful position-changing outcome; reject stale results after owner changes.
  • Native Earn is hosted by Discovery. AssetDetails modal routes must carry their own account context rather than assuming a Home provider is mounted.

Reference Routing

Load only what the task needs:

Hard Stops

  • Do not invent product behavior or request fields when client, server, or runtime evidence is missing or contradictory.
  • Do not hide a portfolio position merely because it has no executable action.
  • Do not create an internal DeFi action for an external DApp before an App-owned RPC or operation contract exists.
  • Do not broaden shared Staking/Borrow utilities without sibling-protocol regression reasoning.
  • Do not claim runtime success from a static diff, a passing utility test, or the existence of a rendered element.
  • Do not edit generated locale files; use $1k-i18n.

Done When

The owner and contract are explicit, the change is scoped to that owner, focused tests pass, the affected route/platform demonstrates the intended terminal state, and any unverified runtime or server dependency is disclosed.

Related Skills

  • $1k-trade-swap-market for Swap execution after a DeFi handoff.
  • $1k-state-management for Jotai ownership.
  • $1k-cross-platform for platform-specific UI and routing.
  • $1k-coding-patterns for TypeScript, React, and error handling.
Repository
OneKeyHQ/app-monorepo
Last updated
First committed

Is this your skill?

If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.