Core Components Implementation
Core Components Guide
Required Instructions
1. Initialize Instruction
pub struct Initialize<'info> {
/// The payer for account creation
#[account(mut)]
pub payer: Signer<'info>,
/// Vault's strategy authority
#[account(mut)]
pub vault_strategy_auth: Signer<'info>,
/// The strategy account
#[account(
seeds = [constants::STRATEGY_SEED, strategy.load()?.counterparty_asset_ta.key().as_ref()],
bump = strategy.load()?.bump
)]
pub strategy: AccountLoader<'info, Strategy>,
pub system_program: Program<'info, System>,
/// The protocol's program ID
/// CHECK: Validated in handler
#[account(constraint = protocol_program.key() == strategy.load()?.protocol_program)]
pub protocol_program: AccountInfo<'info>,
}2. Deposit Instruction
3. Withdraw Instruction
State Management
Strategy Account
Strategy Type Definition
Position Value Calculation
Error Handling
Account Validation Patterns
Token Account Validation
Protocol Account Validation
Implementation Checklist
Security Requirements
Last updated