Skip to content

Commit

Permalink
spl: change "to" to "from" in token::burn
Browse files Browse the repository at this point in the history
fix makefile
  • Loading branch information
inso- committed Dec 1, 2021
1 parent 926c024 commit e1ce4fc
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 36 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)).
Expand Down
63 changes: 36 additions & 27 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 3 additions & 3 deletions spl/src/token.rs
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
2 changes: 1 addition & 1 deletion tests/lockup/programs/registry/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions tests/spl/token-proxy/programs/token-proxy/src/lib.rs
Original file line number Diff line number Diff line change
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 e1ce4fc

Please sign in to comment.