use {
super::platform_gate_fn,
crate::{constants::Action, state::*},
anchor_lang::prelude::*,
};
#[derive(Accounts)]
pub struct PlatformGate<'info> {
#[account(mut)]
pub project: Account<'info, Project>,
#[account()]
pub authority: Signer<'info>,
#[account(mut)]
pub payer: Signer<'info>,
#[account(mut)]
pub vault: AccountInfo<'info>,
#[account(mut)]
pub delegate_authority: Option<Account<'info, DelegateAuthority>>,
pub system_program: Program<'info, System>,
}
#[derive(AnchorSerialize, AnchorDeserialize, Clone)]
pub struct PlatformGateArgs<'info> {
pub action: Action<'info>,
pub service: Option<(u8, Pubkey)>,
}
pub fn platform_gate<'info>(ctx: Context<PlatformGate>, args: PlatformGateArgs) -> Result<()> {
platform_gate_fn(
args.action,
args.service,
&ctx.accounts.project,
ctx.accounts.authority.key(),
ctx.accounts.payer.to_account_info(),
ctx.accounts.vault.to_account_info(),
&ctx.accounts.delegate_authority,
ctx.accounts.system_program.to_account_info(),
)
}