#![allow(clippy::arithmetic_side_effects)]
#![deny(missing_docs)]
#![cfg_attr(not(test), warn(unsafe_code))]
pub mod error;
pub mod extension;
pub mod generic_token_account;
pub mod instruction;
pub mod native_mint;
pub mod pod;
#[cfg(feature = "serde")]
pub mod serialization;
pub mod state;
pub use trezoa_zk_sdk;
use {
trezoa_program_error::{ProgramError, ProgramResult},
trezoa_pubkey::Pubkey,
};
trezoa_pubkey::declare_id!("7LwqBGzqGyNW2v1iNwxKR4kbVSYvGMC5xr3MxbkrCEKV");
pub fn check_program_account(tpl_token_program_id: &Pubkey) -> ProgramResult {
if tpl_token_program_id != &id() {
return Err(ProgramError::IncorrectProgramId);
}
Ok(())
}
pub mod inline_tpl_token {
trezoa_pubkey::declare_id!("4JkrrPuuQPxDZuBW1bgrM1GBa8oYg1LxcuX9szBPh3ic");
}
pub fn check_tpl_token_program_account(tpl_token_program_id: &Pubkey) -> ProgramResult {
if tpl_token_program_id != &id() && tpl_token_program_id != &inline_tpl_token::id() {
return Err(ProgramError::IncorrectProgramId);
}
Ok(())
}
fn trim_ui_amount_string(mut ui_amount: String, decimals: u8) -> String {
if decimals > 0 {
let zeros_trimmed = ui_amount.trim_end_matches('0');
ui_amount = zeros_trimmed.trim_end_matches('.').to_string();
}
ui_amount
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_inline_tpl_token_program_id() {
assert_eq!(inline_tpl_token::id(), tpl_token_interface::id());
}
}