diff --git a/contracts/programs/ocr2/src/context.rs b/contracts/programs/ocr2/src/context.rs index 917f47aeb..95edfc652 100644 --- a/contracts/programs/ocr2/src/context.rs +++ b/contracts/programs/ocr2/src/context.rs @@ -42,6 +42,17 @@ pub struct Initialize<'info> { pub associated_token_program: Program<'info, AssociatedToken>, } +#[derive(Accounts)] +pub struct Close<'info> { + #[account(mut, close = receiver)] + pub state: AccountLoader<'info, State>, + #[account(mut, close = receiver)] + pub transmissions: AccountLoader<'info, Transmissions>, + #[account(mut)] + pub receiver: SystemAccount<'info>, + pub authority: Signer<'info>, +} + #[derive(Accounts)] pub struct TransferOwnership<'info> { #[account(mut)] diff --git a/contracts/programs/ocr2/src/lib.rs b/contracts/programs/ocr2/src/lib.rs index 95551163f..8eb8e0759 100644 --- a/contracts/programs/ocr2/src/lib.rs +++ b/contracts/programs/ocr2/src/lib.rs @@ -72,6 +72,12 @@ pub mod ocr2 { Ok(()) } + #[access_control(owner(&ctx.accounts.state, &ctx.accounts.authority))] + pub fn close(ctx: Context) -> ProgramResult { + // NOTE: Close is handled by anchor on exit due to the `close` attribute + Ok(()) + } + #[access_control(owner(&ctx.accounts.state, &ctx.accounts.authority))] pub fn transfer_ownership( ctx: Context,