spl_token_2022_interface/extension/confidential_mint_burn/
mod.rs1use {
2 crate::{
3 error::TokenError,
4 extension::{Extension, ExtensionType},
5 },
6 bytemuck::{Pod, Zeroable},
7 solana_program_error::ProgramResult,
8 solana_zk_sdk_pod::encryption::{
9 auth_encryption::PodAeCiphertext,
10 elgamal::{PodElGamalCiphertext, PodElGamalPubkey},
11 },
12};
13
14pub mod instruction;
16
17#[derive(Clone, Copy, Debug, Default, PartialEq, Pod, Zeroable)]
19#[repr(C)]
20pub struct ConfidentialMintBurn {
21 pub confidential_supply: PodElGamalCiphertext,
23 pub decryptable_supply: PodAeCiphertext,
25 pub supply_elgamal_pubkey: PodElGamalPubkey,
27 pub pending_burn: PodElGamalCiphertext,
29}
30
31impl Extension for ConfidentialMintBurn {
32 const TYPE: ExtensionType = ExtensionType::ConfidentialMintBurn;
33}
34
35impl ConfidentialMintBurn {
36 pub fn closable(&self) -> ProgramResult {
44 if self.confidential_supply == PodElGamalCiphertext::default() {
45 Ok(())
46 } else {
47 Err(TokenError::MintHasSupply.into())
48 }
49 }
50}