ソースを参照

spl: change "to" to "from" in token::burn (#1729)

Co-authored-by: Thomas Moussajee <thomas.moussajee@gmail.com>
Paul 3 年 前
コミット
4d9bd6adc6

+ 1 - 0
CHANGELOG.md

@@ -35,6 +35,7 @@ The minor version will be incremented upon a breaking change and the patch versi
 * spl: Re-export the `spl_token` crate ([#1665](https://github.com/project-serum/anchor/pull/1665)).
 * lang, cli, spl: Update solana toolchain to v1.9.13 ([#1653](https://github.com/project-serum/anchor/pull/1653) and [#1751](https://github.com/project-serum/anchor/pull/1751)).
 * lang: `Program` type now deserializes `programdata_address` only on demand ([#1723](https://github.com/project-serum/anchor/pull/1723)).
+* spl: Change "to" to "from" in `token::burn` ([#1080](https://github.com/project-serum/anchor/pull/1080)).
 
 ## [0.23.0] - 2022-03-20
 

+ 3 - 3
spl/src/token.rs

@@ -63,7 +63,7 @@ pub fn burn<'a, 'b, 'c, 'info>(
 ) -> Result<()> {
     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,
         &[],
@@ -72,7 +72,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(),
         ],
@@ -275,7 +275,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>,
 }
 

+ 1 - 1
tests/cfo/deps/stake

@@ -1 +1 @@
-Subproject commit 6a1c128e859b13b39812c0c75d202b2bf9ee1e8c
+Subproject commit 9c41642dffbb334e1e39c616cd6a645d91768d3e

+ 1 - 1
tests/cfo/programs/cfo/src/lib.rs

@@ -835,7 +835,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)

+ 2 - 2
tests/ido-pool/programs/ido-pool/src/lib.rs

@@ -135,7 +135,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();
@@ -183,7 +183,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();

+ 1 - 1
tests/lockup/programs/registry/src/lib.rs

@@ -237,7 +237,7 @@ mod registry {
                 ctx.accounts.token_program.clone(),
                 token::Burn {
                     mint: ctx.accounts.pool_mint.to_account_info(),
-                    to: balances.spt.to_account_info(),
+                    from: balances.spt.to_account_info(),
                     authority: ctx.accounts.member_signer.to_account_info(),
                 },
                 member_signer,

+ 2 - 2
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();

+ 1 - 1
tests/spl/token-proxy/tests/token-proxy.js

@@ -56,7 +56,7 @@ describe("token", () => {
       accounts: {
         authority: provider.wallet.publicKey,
         mint,
-        to,
+        from: to,
         tokenProgram: TokenInstructions.TOKEN_PROGRAM_ID,
       },
     });