From 09cc6b9cf8237b26a832a0a6eca87a0024643ba9 Mon Sep 17 00:00:00 2001 From: Thomas Moussajee Date: Mon, 29 Nov 2021 23:19:06 +0000 Subject: [PATCH] spl: change "to" to "from" in token::burn --- CHANGELOG.md | 4 ++++ spl/src/token.rs | 6 +++--- tests/cfo/programs/cfo/src/lib.rs | 2 +- tests/ido-pool/programs/ido-pool/src/lib.rs | 4 ++-- tests/spl/token-proxy/programs/token-proxy/src/lib.rs | 4 ++-- 5 files changed, 12 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7388e1d724..90a1eae88a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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)). diff --git a/spl/src/token.rs b/spl/src/token.rs index 8655321cf0..38af37c76c 100644 --- a/spl/src/token.rs +++ b/spl/src/token.rs @@ -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, &[], @@ -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(), @@ -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>, } diff --git a/tests/cfo/programs/cfo/src/lib.rs b/tests/cfo/programs/cfo/src/lib.rs index 53ed6cb440..e5e74af8e2 100644 --- a/tests/cfo/programs/cfo/src/lib.rs +++ b/tests/cfo/programs/cfo/src/lib.rs @@ -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) diff --git a/tests/ido-pool/programs/ido-pool/src/lib.rs b/tests/ido-pool/programs/ido-pool/src/lib.rs index b5a164d24f..041443bac4 100644 --- a/tests/ido-pool/programs/ido-pool/src/lib.rs +++ b/tests/ido-pool/programs/ido-pool/src/lib.rs @@ -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(); @@ -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(); diff --git a/tests/spl/token-proxy/programs/token-proxy/src/lib.rs b/tests/spl/token-proxy/programs/token-proxy/src/lib.rs index acb78fb567..349423e567 100644 --- a/tests/spl/token-proxy/programs/token-proxy/src/lib.rs +++ b/tests/spl/token-proxy/programs/token-proxy/src/lib.rs @@ -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>, } @@ -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();