How It Works: A Practical Example
User Story: Alex Wants to Earn Yield
The Code Behind the Click (Pseudo-code)
// A single transaction built by the internet.fund router
let transaction = Transaction::new_with_payer(
&[
// Instruction 1: If needed, create the user's USDC associated account
create_associated_token_account_if_needed(&payer, &usdc_mint),
// Instruction 2: Wrap a portion of the user's SOL into wSOL
wrap_sol(&payer, amount_sol),
// Instruction 3: Call our core contract to execute a "smart deposit"
internet_fund::instruction::smart_deposit(
&payer,
&pool_state,
amount_sol_in,
amount_usdc_in,
),
// Instruction 4 (Optional): Auto-stake the resulting LP token into a yield aggregator
internet_fund::instruction::auto_stake_lp(&payer, &pool_state),
],
Some(&payer.pubkey()),
);PreviousTechnical Architecture: The "Magic" Behind the ScenesNextThe Social Layer: DeFi's Social Feed
Last updated

