1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
use anchor_lang::{prelude::*, solana_program::pubkey::Pubkey};

use crate::GroupAuthority;

#[derive(Accounts)]
pub struct UpdateGroupAuthority<'info> {
    #[account(mut)]
    pub authority: Signer<'info>,
    #[account(
        mut,
       constraint = group_authority.authority == *authority.key,
    )]
    pub group_authority: Account<'info, GroupAuthority>,
}

pub fn set_group_authority(
    group_authority: &mut Account<'_, GroupAuthority>,
    authority: Pubkey,
) -> Result<()> {
    group_authority.authority = authority;
    Ok(())
}