Smart Contracts (Solana/Anchor)
LazarusWrapper: The Vault & Minting Logic
The LazarusWrapper is the on-chain Anchor program responsible for the custody of dead assets. Security is paramount here, as this contract will eventually hold a large percentage of the supply of various meme coins.
PDA Vault Architecture:
Instead of a single central vault, the program derives a unique vault for each token type. This isolates risk. If one underlying token contract is compromised, it does not affect others.
Key Instruction: execute_wrap
pub fn execute_wrap(ctx: Context<ExecuteWrap>, amount: u64) -> Result<()> {
// 1. Transfer original tokens from User to Vault
let cpi_accounts = Transfer {
from: ctx.accounts.user_token_account.to_account_info(),
to: ctx.accounts.lazarus_vault.to_account_info(),
authority: ctx.accounts.user.to_account_info(),
};
let cpi_program = ctx.accounts.token_program.to_account_info();
token::transfer(CpiContext::new(cpi_program, cpi_accounts), amount)?;
// 2. Mint wLA tokens to User
let seeds = &[
b"lazarus_mint_authority",
ctx.accounts.original_mint.key().as_ref(),
&[ctx.bumps.mint_authority];
let signer = &[&seeds[..]];
let mint_cpi = MintTo {
mint: ctx.accounts.wla_mint.to_account_info(),
to: ctx.accounts.user_wla_account.to_account_info(),
authority: ctx.accounts.mint_authority.to_account_info(),
};
token::mint_to(CpiContext::new_with_signer(
ctx.accounts.token_program.to_account_info(),
mint_cpi,
signer
), amount)?;
Ok(())
}wLA Standard: Token Extension Specifications
CogniFi utilizes the Token-2022 program (Solana's new standard) to enforce protocol-level rules on wLA assets.
Transfer Hooks: Every transfer of a
wLAtoken triggers a hook that sends a small fee (e.g., 0.1%) to the Agent Treasury. This ensures that the AI agent always has operating capital (SOL) to pay for server costs.Metadata Pointer: The metadata is stored directly on the mint account, reducing lookup times and preventing external metadata tampering.
Borsh Schemas: Decoding Vault State
Developers integrating with CogniFi will need to decode the state of a Lazarus Vault to display data on a frontend. We use the Borsh serialization format.
Vault Account Structure:
Last updated
