use crate::state::FiberState;
use anchor_lang::prelude::*;
#[derive(Accounts)]
pub struct Swap<'info> {
#[account(mut)]
pub thread: Signer<'info>,
#[account(mut, has_one = thread)]
pub target: Account<'info, FiberState>,
#[account(mut, has_one = thread, close = thread)]
pub source: Account<'info, FiberState>,
}
pub fn swap(ctx: Context<Swap>) -> Result<()> {
let target = &mut ctx.accounts.target;
let source = &ctx.accounts.source;
target.compiled_instruction = source.compiled_instruction.clone();
target.priority_fee = source.priority_fee;
target.last_executed = 0;
target.exec_count = 0;
Ok(())
}