|
@@ -5,7 +5,6 @@ use anchor_lang::solana_program::program_error::ProgramError;
|
|
|
use anchor_lang::solana_program::program_pack::Pack;
|
|
|
use anchor_lang::solana_program::pubkey::Pubkey;
|
|
|
use anchor_lang::{Accounts, CpiContext};
|
|
|
-use std::io::Write;
|
|
|
use std::ops::Deref;
|
|
|
|
|
|
pub use spl_token::ID;
|
|
@@ -311,21 +310,12 @@ impl TokenAccount {
|
|
|
}
|
|
|
|
|
|
impl anchor_lang::AccountDeserialize for TokenAccount {
|
|
|
- fn try_deserialize(buf: &mut &[u8]) -> Result<Self, ProgramError> {
|
|
|
- TokenAccount::try_deserialize_unchecked(buf)
|
|
|
- }
|
|
|
-
|
|
|
fn try_deserialize_unchecked(buf: &mut &[u8]) -> Result<Self, ProgramError> {
|
|
|
spl_token::state::Account::unpack(buf).map(TokenAccount)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-impl anchor_lang::AccountSerialize for TokenAccount {
|
|
|
- fn try_serialize<W: Write>(&self, _writer: &mut W) -> Result<(), ProgramError> {
|
|
|
- // no-op
|
|
|
- Ok(())
|
|
|
- }
|
|
|
-}
|
|
|
+impl anchor_lang::AccountSerialize for TokenAccount {}
|
|
|
|
|
|
impl anchor_lang::Owner for TokenAccount {
|
|
|
fn owner() -> Pubkey {
|
|
@@ -349,21 +339,12 @@ impl Mint {
|
|
|
}
|
|
|
|
|
|
impl anchor_lang::AccountDeserialize for Mint {
|
|
|
- fn try_deserialize(buf: &mut &[u8]) -> Result<Self, ProgramError> {
|
|
|
- Mint::try_deserialize_unchecked(buf)
|
|
|
- }
|
|
|
-
|
|
|
fn try_deserialize_unchecked(buf: &mut &[u8]) -> Result<Self, ProgramError> {
|
|
|
spl_token::state::Mint::unpack(buf).map(Mint)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-impl anchor_lang::AccountSerialize for Mint {
|
|
|
- fn try_serialize<W: Write>(&self, _writer: &mut W) -> Result<(), ProgramError> {
|
|
|
- // no-op
|
|
|
- Ok(())
|
|
|
- }
|
|
|
-}
|
|
|
+impl anchor_lang::AccountSerialize for Mint {}
|
|
|
|
|
|
impl anchor_lang::Owner for Mint {
|
|
|
fn owner() -> Pubkey {
|
|
@@ -383,10 +364,6 @@ impl Deref for Mint {
|
|
|
pub struct Token;
|
|
|
|
|
|
impl anchor_lang::AccountDeserialize for Token {
|
|
|
- fn try_deserialize(buf: &mut &[u8]) -> Result<Self, ProgramError> {
|
|
|
- Token::try_deserialize_unchecked(buf)
|
|
|
- }
|
|
|
-
|
|
|
fn try_deserialize_unchecked(_buf: &mut &[u8]) -> Result<Self, ProgramError> {
|
|
|
Ok(Token)
|
|
|
}
|