Skip to content

Commit

Permalink
spl: change "to" to "from" in token::burn
Browse files Browse the repository at this point in the history
  • Loading branch information
inso- committed Nov 30, 2021
1 parent 926c024 commit 09cc6b9
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 8 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Expand Up @@ -11,6 +11,10 @@ incremented for features.

## [Unreleased]

### Breaking

* spl: Change "to" to "from" in `token::burn` ([#161](https://github.com/project-serum/anchor/pull/1080)).

### Fixes

* lang: Add `deprecated` attribute to `ProgramAccount` ([#1014](https://github.com/project-serum/anchor/pull/1014)).
Expand Down
6 changes: 3 additions & 3 deletions spl/src/token.rs
Expand Up @@ -64,7 +64,7 @@ pub fn burn<'a, 'b, 'c, 'info>(
) -> ProgramResult {
let ix = spl_token::instruction::burn(
&spl_token::ID,
ctx.accounts.to.key,
ctx.accounts.from.key,
ctx.accounts.mint.key,
ctx.accounts.authority.key,
&[],
Expand All @@ -73,7 +73,7 @@ pub fn burn<'a, 'b, 'c, 'info>(
solana_program::program::invoke_signed(
&ix,
&[
ctx.accounts.to.clone(),
ctx.accounts.from.clone(),
ctx.accounts.mint.clone(),
ctx.accounts.authority.clone(),
ctx.program.clone(),
Expand Down Expand Up @@ -261,7 +261,7 @@ pub struct MintTo<'info> {
#[derive(Accounts)]
pub struct Burn<'info> {
pub mint: AccountInfo<'info>,
pub to: AccountInfo<'info>,
pub from: AccountInfo<'info>,
pub authority: AccountInfo<'info>,
}

Expand Down
2 changes: 1 addition & 1 deletion tests/cfo/programs/cfo/src/lib.rs
Expand Up @@ -817,7 +817,7 @@ impl<'info> Distribute<'info> {
let program = self.token_program.to_account_info();
let accounts = token::Burn {
mint: self.srm_mint.to_account_info(),
to: self.srm_vault.to_account_info(),
from: self.srm_vault.to_account_info(),
authority: self.officer.to_account_info(),
};
CpiContext::new(program, accounts)
Expand Down
4 changes: 2 additions & 2 deletions tests/ido-pool/programs/ido-pool/src/lib.rs
Expand Up @@ -130,7 +130,7 @@ pub mod ido_pool {
// Burn the user's redeemable tokens.
let cpi_accounts = Burn {
mint: ctx.accounts.redeemable_mint.to_account_info(),
to: ctx.accounts.user_redeemable.to_account_info(),
from: ctx.accounts.user_redeemable.to_account_info(),
authority: ctx.accounts.ido_account.to_account_info(),
};
let cpi_program = ctx.accounts.token_program.to_account_info();
Expand Down Expand Up @@ -178,7 +178,7 @@ pub mod ido_pool {
// Burn the user's redeemable tokens.
let cpi_accounts = Burn {
mint: ctx.accounts.redeemable_mint.to_account_info(),
to: ctx.accounts.user_redeemable.to_account_info(),
from: ctx.accounts.user_redeemable.to_account_info(),
authority: ctx.accounts.ido_account.to_account_info(),
};
let cpi_program = ctx.accounts.token_program.to_account_info();
Expand Down
4 changes: 2 additions & 2 deletions tests/spl/token-proxy/programs/token-proxy/src/lib.rs
Expand Up @@ -71,7 +71,7 @@ pub struct ProxyBurn<'info> {
#[account(mut)]
pub mint: AccountInfo<'info>,
#[account(mut)]
pub to: AccountInfo<'info>,
pub from: AccountInfo<'info>,
pub token_program: AccountInfo<'info>,
}

Expand Down Expand Up @@ -116,7 +116,7 @@ impl<'a, 'b, 'c, 'info> From<&mut ProxyBurn<'info>> for CpiContext<'a, 'b, 'c, '
fn from(accounts: &mut ProxyBurn<'info>) -> CpiContext<'a, 'b, 'c, 'info, Burn<'info>> {
let cpi_accounts = Burn {
mint: accounts.mint.clone(),
to: accounts.to.clone(),
from: accounts.from.clone(),
authority: accounts.authority.clone(),
};
let cpi_program = accounts.token_program.clone();
Expand Down

0 comments on commit 09cc6b9

Please sign in to comment.