diff --git a/CHANGELOG.md b/CHANGELOG.md index 7388e1d724..f3d06ba05c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,10 @@ incremented for features. ## [Unreleased] +### Breaking + +* spl: Change "to" to "from" in `token::burn` ([#1080](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/Makefile b/Makefile index dd6c12b60c..3d88ae96dc 100644 --- a/Makefile +++ b/Makefile @@ -3,47 +3,56 @@ build-cli: cargo build -p anchor-cli --release cp target/release/anchor cli/npm-package/anchor +.PHONY: build-tests-bpf-% +build-tests-bpf-%: export NAME=$(subst _,/,$($(strip @):build-tests-bpf-%=%)) +build-tests-bpf-%: + cd tests/${NAME} && cargo build-bpf + .PHONY: build-example-bpf-% build-example-bpf-%: export NAME=$(subst _,/,$($(strip @):build-example-bpf-%=%)) build-example-bpf-%: - cd examples/${NAME} && cargo build-bpf + cd examples/tutorial/${NAME} && cargo build-bpf .PHONY: build-example-bpf-permissioned-markets -build-example-bpf-permissioned-markets: - cd examples/permissioned-markets/deps/serum-dex/dex && cargo build-bpf - cd examples/permissioned-markets && cargo build-bpf +build-tests-bpf-permissioned-markets: + cd tests/permissioned-markets/deps/serum-dex/dex && cargo build-bpf + cd tests/permissioned-markets && cargo build-bpf .PHONY: build-example-bpf-swap -build-example-bpf-swap: - cd examples/swap/deps/serum-dex/dex && cargo build-bpf - cd examples/swap && cargo build-bpf +build-tests-bpf-swap: + cd tests/swap/deps/serum-dex/dex && cargo build-bpf + cd tests/swap && cargo build-bpf + +.PHONY: build-tests-bpf-all +build-tests-bpf-all: build-tests-bpf-cashiers-check +build-tests-bpf-all: build-tests-bpf-cfo +build-tests-bpf-all: build-tests-bpf-chat +build-tests-bpf-all: build-tests-bpf-composite +build-tests-bpf-all: build-tests-bpf-errors +build-tests-bpf-all: build-tests-bpf-escrow +build-tests-bpf-all: build-tests-bpf-events +build-tests-bpf-all: build-tests-bpf-ido-pool +build-tests-bpf-all: build-tests-bpf-interface +build-tests-bpf-all: build-tests-bpf-lockup +build-tests-bpf-all: build-tests-bpf-misc +build-tests-bpf-all: build-tests-bpf-multisig +build-tests-bpf-all: build-tests-bpf-permissioned-markets +build-tests-bpf-all: build-tests-bpf-pyth +build-tests-bpf-all: build-tests-bpf-spl_token-proxy +build-tests-bpf-all: build-tests-bpf-swap +build-tests-bpf-all: build-tests-bpf-sysvars +build-tests-bpf-all: build-tests-bpf-typescript +build-tests-bpf-all: build-tests-bpf-zero-copy .PHONY: build-example-bpf-all -build-example-bpf-all: build-example-bpf-cashiers-check -build-example-bpf-all: build-example-bpf-cfo -build-example-bpf-all: build-example-bpf-chat -build-example-bpf-all: build-example-bpf-composite -build-example-bpf-all: build-example-bpf-errors -build-example-bpf-all: build-example-bpf-escrow -build-example-bpf-all: build-example-bpf-events -build-example-bpf-all: build-example-bpf-ido-pool -build-example-bpf-all: build-example-bpf-interface -build-example-bpf-all: build-example-bpf-lockup -build-example-bpf-all: build-example-bpf-misc -build-example-bpf-all: build-example-bpf-multisig -build-example-bpf-all: build-example-bpf-permissioned-markets -build-example-bpf-all: build-example-bpf-pyth -build-example-bpf-all: build-example-bpf-spl_token-proxy -build-example-bpf-all: build-example-bpf-swap -build-example-bpf-all: build-example-bpf-sysvars build-example-bpf-all: build-example-bpf-tutorial_basic-0 build-example-bpf-all: build-example-bpf-tutorial_basic-1 build-example-bpf-all: build-example-bpf-tutorial_basic-2 build-example-bpf-all: build-example-bpf-tutorial_basic-3 build-example-bpf-all: build-example-bpf-tutorial_basic-4 -build-example-bpf-all: build-example-bpf-tutorial_basic-5 -build-example-bpf-all: build-example-bpf-typescript -build-example-bpf-all: build-example-bpf-zero-copy + +.PHONY: build-all +build-all: build-tests-bpf-all build-example-bpf-all .PHONY: clean clean: 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/lockup/programs/registry/src/lib.rs b/tests/lockup/programs/registry/src/lib.rs index 46a7b6ed4d..1816ad095c 100644 --- a/tests/lockup/programs/registry/src/lib.rs +++ b/tests/lockup/programs/registry/src/lib.rs @@ -236,7 +236,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, 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();