gmsol_store/instructions/
feature.rs1use anchor_lang::prelude::*;
2
3use crate::{
4 states::{
5 feature::{ActionDisabledFlag, DomainDisabledFlag},
6 Store,
7 },
8 utils::internal,
9};
10
11#[derive(Accounts)]
13pub struct ToggleFeature<'info> {
14 pub authority: Signer<'info>,
16 #[account(mut)]
18 pub store: AccountLoader<'info, Store>,
19}
20
21pub(crate) fn unchecked_toggle_feature(
24 ctx: Context<ToggleFeature>,
25 domain: DomainDisabledFlag,
26 action: ActionDisabledFlag,
27 enable: bool,
28) -> Result<()> {
29 ctx.accounts
30 .store
31 .load_mut()?
32 .set_feature_disabled(domain, action, !enable);
33 Ok(())
34}
35
36impl<'info> internal::Authentication<'info> for ToggleFeature<'info> {
37 fn authority(&self) -> &Signer<'info> {
38 &self.authority
39 }
40
41 fn store(&self) -> &AccountLoader<'info, Store> {
42 &self.store
43 }
44}