Warfare Mechanics

The MasterChef Contract: Incentivized Staking

The core engine of a Liquidity War is the MasterChef contract (a pattern popularized by SushiSwap but adapted here for Solana's architecture). This smart contract serves as a "Honey Pot" designed to attract liquidity providers (LPs) from rival protocols.

Mechanism:

  1. Target Selection: The CogniFi DAO (or an autonomous Agent) identifies a target token (e.g., $RIVAL) that trades on a competitor's DEX (e.g., Raydium).

  2. Incentive Deployment: A new MasterChef pool is created on CogniFi. This pool accepts the Rival's LP Tokens (e.g., RAY-LP-RIVAL-SOL) as deposits.

  3. Yield Farming: Users who deposit their RAY-LP tokens into the CogniFi MasterChef contract start earning $COGNI (or the Agent's token) at an aggressive Annual Percentage Yield (APY).

  4. Lockup: The contract holds these LP tokens in custody. While the user earns rewards, the liquidity is effectively "captured" by CogniFi.

Code Logic (Conceptual Rust/Anchor):

pub fn deposit_rival_lp(ctx: Context<DepositLP>, amount: u64) -> Result<()> {
    // 1. Transfer LP tokens from user to MasterChef vault
    token::transfer(
        ctx.accounts.transfer_ctx(),
        amount
    )?;
    
    // 2. Update user's 'userInfo' struct to track deposit
    let user_info = &mut ctx.accounts.user_info;
    user_info.amount += amount;
    user_info.reward_debt =...; // Calculate accumulated rewards
    
    Ok(())
}

Migration Logic: Moving LP tokens from Raydium to CogniFi

Once a critical mass of liquidity (e.g., >51% of the rival's pool) is staked in the MasterChef contract, the "Vampire Attack" enters its execution phase.

The migrate() Function: This is a privileged instruction callable only by the Agent (running in a TEE) or the DAO Governance.

  1. Withdraw: The MasterChef contract programmatically interacts with the Raydium RemoveLiquidity instruction. It burns the RAY-LP tokens it holds.

  2. Unwrap: This action returns the underlying assets (e.g., $RIVAL and $SOL) to the MasterChef contract.

  3. Reseed: The contract immediately executes an AddLiquidity instruction on the CogniFi AMM (or PumpSwap), depositing the $RIVAL and $SOL.

  4. Remint: New COGNI-LP tokens are minted and credited to the original users.

Result: The liquidity has physically moved from Raydium to CogniFi. The user still owns their share, but the trading venue has changed without them lifting a finger.

Last updated