debpf
pump.fun / instructions

Instruction

collect_creator_fee

Proven

Sweeps the accumulated SOL creator fees from a coin creator's `creator-vault` PDA to the creator wallet, leaving only the rent-exempt minimum for an empty account (currently 650,240 lamports) in the vault. Anyone can call it because the creator does not have to sign, but the money can only go to the creator whose key derives the vault. The call fails if the vault holds nothing above the rent minimum, if the creator account is executable, if the creator would still not be rent-exempt after receiving the fees, or if the creator's owner equals a fixed constant (error 6050; I did not resolve which program that constant is). It emits a CollectCreatorFeeEvent with the timestamp, the creator and the amount.

Discriminator
0x1416567bc61cdb84
Calls in the sample
1
Reproduced, seen by the agent
1 / 1
Reproduced, never shown to the agent
—

1 of 1 real mainnet calls reproduced exactly. Every SOL and token movement the model predicted matched the chain to the last unit. Unseen calls were never shown to the agent.

Bytecodefn_24c26
24c26mov64 r8, r4
24c27mov64 r9, r3
24c28mov64 r7, r2
24c29stxdw [r10-448], r1
24c2alddw r1, 0x1ae4f6 ; "Instruction: CollectCreatorFee"
24c2cmov64 r2, 0x1e
24c2dcall sol_log_
24c2esth [r10-418], 0xffff
24c2fstxdw [r10-408], r8
24c30stxdw [r10-416], r9
24c31mov64 r1, r10
24c32add64 r1, -0x1a2
24c33stxdw [r10-4088], r1
24c34mov64 r1, r10
24c35add64 r1, -0xc8
24c36mov64 r3, r10
24c37add64 r3, -0x1a0
24c38mov64 r5, r10
24c39mov64 r2, r7
24c3acall fn_16bef
24c3bldxdw r9, [r10-192]
24c3cldxdw r8, [r10-200]
24c3dldxb r6, [r10-6]
24c3ejeq r6, 0x2, +42 ; -> 24c69
24c3fmov64 r1, r10
24c40add64 r1, -0x180
24c41mov64 r2, r10
24c42add64 r2, -0xb8
24c43mov64 r3, 0xb2
24c44call fn_35367
24c45ldxw r1, [r10-5]
24c46stxw [r10-205], r1
24c47ldxb r1, [r10-1]
24c48stxb [r10-201], r1
24c49stxb [r10-206], r6
24c4astxdw [r10-392], r9
24c4bstxdw [r10-400], r8
24c4cldxb r1, [r10-417]
24c4dstxb [r10-167], r1
24c4eldxb r1, [r10-418]
24c4fstxb [r10-168], r1
24c50ldxdw r1, [r10-408]
24c51stxdw [r10-176], r1
24c52ldxdw r1, [r10-416]
24c53stxdw [r10-184], r1
24c54mov64 r1, r10
24c55add64 r1, -0x190
24c56stxdw [r10-192], r1
24c57stxdw [r10-200], r7
24c58mov64 r1, r10
24c59add64 r1, -0x1b8
24c5amov64 r2, r10
24c5badd64 r2, -0xc8
24c5ccall fn_05056
24c5dldxdw r8, [r10-440]
24c5ejeq r8, 0x2, +1 ; -> 24c60
24c5fja +5 ; -> 24c65
24c60mov64 r1, r10
24c61add64 r1, -0x190
24c62call fn_0171f
24c63mov64 r8, 0x2
24c64ja +4 ; -> 24c69
24c65ldxdw r9, [r10-432]
24c66mov64 r1, r10
24c67add64 r1, -0x190
24c68call fn_0171f
24c69ldxdw r1, [r10-448]
24c6astxdw [r1+8], r9
24c6bstxdw [r1+0], r8
24c6cexit
Reconstructedcollect_creator_fee
// discriminator 1416567bc61cdb84, no args
#[derive(Accounts)]
pub struct CollectCreatorFee<'info> {
#[account(mut)]
pub creator: AccountInfo<'info>, // NOT required to sign (per IDL / validation)
#[account(mut, seeds = [b"creator-vault", creator.key().as_ref()], bump)] // ConstraintSeeds (2006), pc 16d02
pub creator_vault: AccountInfo<'info>,
pub system_program: Program<'info, System>,
/// CHECK: #[event_cpi]
pub event_authority: AccountInfo<'info>, // PDA ["__event_authority"]
pub program: AccountInfo<'info>,
}
pub fn collect_creator_fee(ctx: Context<CollectCreatorFee>) -> Result<()> {
msg!("Instruction: CollectCreatorFee");
let creator = &ctx.accounts.creator;
// pc 05059: compare creator.owner with a 32-byte constant at 0x1ae07b;
// if they are EQUAL -> formatted log + error 6050 (0x17a2), collect_creator_fee.rs:103
require!(creator.owner != CONST_1ae07b, PumpError::Code6050);
// pc 05083
if creator.executable {
msg!("Creator account is executable, so it cannot receive lamports");
return Err(..);
}
let rent = Rent::get()?; // fn_32de9
let vault_lamports = ctx.accounts.creator_vault.lamports();
let vault_min = rent.minimum_balance(0); // (128+0)*5080*1.0 = 650_240 today
let amount = vault_lamports.saturating_sub(vault_min);
if vault_lamports <= vault_min { // pc 050d2
msg!("No creator fee to collect");
return Err(..);
}
// pc 050d4: creator must end up rent-exempt for its own size
let after = creator.lamports().saturating_add(amount);
if after < rent.minimum_balance(creator.data_len()) { // pc 050e8
msg!("Creator account does not have enough rent-exemption lamports");
return Err(..);
}
// pc 0519d: system transfer vault -> creator, signed by vault PDA
system_program::transfer(
CpiContext::new_with_signer(system_program, Transfer { from: creator_vault, to: creator },
&[&[b"creator-vault", creator.key().as_ref(), &[bump]]]),
amount)?;
// pc 051bc..0521f: emit_cpi! via self-CPI signed by "__event_authority"
emit_cpi!(CollectCreatorFeeEvent {
timestamp: Clock::get()?.unix_timestamp,
creator: creator.key(),
creator_fee: amount,
});
Ok(())
}

Replay model

The executable model the agent wrote. Every tally above comes from running it against mainnet.

function model(ctx){
// Rent sysvar (read on-chain): lamports_per_byte_year=5080, exemption_threshold=1.0
const LPBY = 5080n, THRESH_NUM = 1n; // threshold 1.0
const minVault = (128n + 0n) * LPBY * THRESH_NUM; // Rent::minimum_balance(0)
const vault = ctx.accounts[1].lamports;
if (vault <= minVault) return { lamports: {}, tokens: {} }; // "No creator fee to collect" -> tx fails
const amount = vault - minVault;
return { lamports: { 0: amount, 1: -amount }, tokens: {} };
}

Accounts

  1. 0creatorwritten
  2. 1creator_vaultwritten
  3. 2system_program
  4. 3event_authority
  5. 4program

program 6EF8rr…BEwF6P