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:
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).
Incentive Deployment: A new
MasterChefpool is created on CogniFi. This pool accepts the Rival's LP Tokens (e.g.,RAY-LP-RIVAL-SOL) as deposits.Yield Farming: Users who deposit their
RAY-LPtokens into the CogniFiMasterChefcontract start earning $COGNI (or the Agent's token) at an aggressive Annual Percentage Yield (APY).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.
Withdraw: The
MasterChefcontract programmatically interacts with the RaydiumRemoveLiquidityinstruction. It burns theRAY-LPtokens it holds.Unwrap: This action returns the underlying assets (e.g., $RIVAL and $SOL) to the
MasterChefcontract.Reseed: The contract immediately executes an
AddLiquidityinstruction on the CogniFi AMM (or PumpSwap), depositing the $RIVAL and $SOL.Remint: New
COGNI-LPtokens 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
