Skip to content

Commit

Permalink
fix: Do not require initialized token account if no mobile burn (#542)
Browse files Browse the repository at this point in the history
  • Loading branch information
ChewingGlass authored Jan 19, 2024
1 parent 61ecc44 commit a7334ed
Showing 1 changed file with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use std::str::FromStr;

use anchor_spl::{
associated_token::AssociatedToken,
token::{burn, Burn, Mint, Token, TokenAccount},
token::{burn, Burn, Mint, Token},
};
use data_credits::{
cpi::{
Expand Down Expand Up @@ -63,12 +63,9 @@ pub struct OnboardMobileHotspotV0<'info> {
/// CHECK: Only loaded if location is being asserted
#[account(mut)]
pub dc_burner: UncheckedAccount<'info>,
#[account(
mut,
associated_token::authority = payer,
associated_token::mint = dnt_mint
)]
pub dnt_burner: Account<'info, TokenAccount>,
/// CHECK: Checked by spl token when the burn command is issued (which it may not be)
#[account(mut)]
pub dnt_burner: UncheckedAccount<'info>,

#[account(
has_one = sub_dao,
Expand Down Expand Up @@ -248,7 +245,9 @@ pub fn handler<'info>(
.unwrap()
.checked_div(mobile_price)
.unwrap();
burn(ctx.accounts.mobile_burn_ctx(), mobile_fee)?;
if mobile_fee > 0 {
burn(ctx.accounts.mobile_burn_ctx(), mobile_fee)?;
}

Ok(())
}

0 comments on commit a7334ed

Please sign in to comment.