Smart Contracts
The core logic of KalshChain is secured by three primary Solana programs (smart contracts).
Program Overview
Each program handles a distinct, critical function to ensure security and modularity.
Market Program
Handles market creation, resolution, and lifecycle management. It defines the event, expiry, and outcome.
Address: KaLsH...MkT1AMM Program
Automated Market Maker for liquidity pools and trade execution, implementing the CPMM formula.
Address: KaLsH...AMM2Position Program
Manages user positions, claims, and profit/loss calculations post-settlement.
Address: KaLsH...POS3Account Structure
The following structure defines the data accounts used by the programs:
MarketAccount.rs
#[account]
pub struct MarketAccount {
pub creator: Pubkey,
pub token_mint: Pubkey,
pub yes_vault: Pubkey,
pub no_vault: Pubkey,
pub title: String,
pub expiration_date: i64,
pub is_resolved: bool,
pub winning_outcome: u8, // 1 for YES, 0 for NO
}AMM Implementation
KalshChain uses a Constant Product Market Maker (CPMM) with the formula x * y = k where:
x= YES share reservesy= NO share reservesk= constant product (derived from initial liquidity)