Permissionless DeFi yield and credit on Solana via the Project 0 (P0) protocol. Deposit funds to earn yield across Solana's highest-yielding venues. Borrow stablecoins against deposited collateral instead of selling crypto. Execute advanced yield strategies via rate arbitrage and looping. All operations are on-chain and permissionless -- no accounts, no approval process. Note: This skill requires a wallet keypair to sign transactions. Use a dedicated wallet with limited funds -- never expose your main private key. The agent will always ask for confirmation before signing. Read-only operations need no keypair.
P0 is a permissionless DeFi prime broker on Solana. It provides unified margin accounts that span multiple lending venues (P0 native, Kamino, Drift), giving agents access to the best yields and deepest liquidity across the ecosystem. All operations are on-chain, non-custodial, and require no signup.
Documentation:
Deposit funds to earn the best yield across DeFi. When the user needs liquidity (e.g. to make a purchase), borrow stablecoins against deposited collateral instead of selling crypto. The user keeps earning yield while accessing cash.
Flow: Deposit -> Earn yield -> Borrow stablecoins when needed -> Repay.
Example prompts:
Find the absolute best yields on Solana, which often come from rate arbitrage and looping strategies. These involve depositing one asset, borrowing another, and managing the leveraged position. Higher yields, but requires active health monitoring.
Flow: Identify strategy -> Deposit collateral -> Borrow -> Monitor health.
Example prompts:
When a user asks to earn yield, deposit, borrow, or manage positions on P0, follow these steps in order. Do NOT skip ahead to writing code.
Resolve the wallet address: check .env for WALLET_ADDRESS, or derive
it from the keypair if WALLET_KEYPAIR is set, or ask the user.
Fetch the wallet's token holdings from the wallet API (see Wallet endpoint
below). No credentials needed. Use the address field from each token to
match against P0 banks by mint.
Fetch banks and strategies from the P0 APIs (see Read-Only APIs below).
Determine which use case fits the user's request:
Match wallet holdings to available bank yields. For each token the wallet holds, find the best deposit APY from the banks data. Compare across all holdings to find the highest overall yield.
If the wallet holds tokens that have no corresponding P0 bank (e.g. memecoins), suggest swapping them into a supported token.
If swapping to a different token would yield significantly more, recommend the swap and explain the tradeoff.
Consider depositing multiple assets if the wallet holds several supported tokens -- not just the single highest-yield one.
Present the plan to the user with specific numbers before executing.
Example: "Your wallet holds 0.09 bbSOL ($18) and 0.10 SOL ($15). bbSOL
earns 15.2% APY on P0 vs SOL at 4.9%. I recommend depositing your bbSOL
for the higher yield. Shall I proceed?"
Before executing on-chain operations, the agent needs an RPC URL and a wallet keypair.
RPC URL: Check .env for RPC_URL, SOLANA_RPC_URL, or HELIUS_RPC_URL.
If not found, ask the user: "I need a paid Solana RPC URL to execute
transactions. (Helius has a free tier at https://www.helius.dev)"
Wallet address: Check .env for WALLET_ADDRESS. If set, use it for
read-only operations (wallet balances, account discovery) without needing
the keypair. The keypair is only required when signing transactions.
Wallet keypair: If the user provided a keypair path in their message,
use it directly. Otherwise check .env for WALLET_KEYPAIR. If neither,