Skip to content

Commit c99b21a

Browse files
committed
Merged main and updated with fmt and clippy
1 parent 4ba942b commit c99b21a

File tree

9 files changed

+29
-29
lines changed

9 files changed

+29
-29
lines changed

tokens/transfer-hook-transfer-switch/anchor/programs/transfer-hook-transfer-switch/src/constants.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ pub const ERROR_INVALID_AUTHORITY: &str = "Invalid authority for operation";
88
pub const ERROR_WALLET_FROZEN: &str = "Wallet is frozen and cannot perform transfers";
99
pub const ERROR_INVALID_MINT: &str = "Invalid token mint";
1010
pub const TOKEN_DECIMALS: u8 = 9;
11-
pub const INITIAL_MINT_AMOUNT: u64 = 1_000_000_000;
11+
pub const INITIAL_MINT_AMOUNT: u64 = 1_000_000_000;

tokens/transfer-hook-transfer-switch/anchor/programs/transfer-hook-transfer-switch/src/error.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ use anchor_lang::prelude::*;
44
pub enum TransferHookError {
55
#[msg(ERROR_INSUFFICIENT_FUNDS)]
66
InsufficientFunds,
7-
7+
88
#[msg(ERROR_INVALID_AUTHORITY)]
99
InvalidAuthority,
10-
10+
1111
#[msg(ERROR_WALLET_FROZEN)]
1212
WalletFrozen,
1313

1414
#[msg(ERROR_INVALID_MINT)]
1515
InvalidMint,
16-
}
16+
}

tokens/transfer-hook-transfer-switch/anchor/programs/transfer-hook-transfer-switch/src/events.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ pub struct TransferProcessed {
1515
pub destination: Pubkey,
1616
pub amount: u64,
1717
pub mint: Pubkey,
18-
}
18+
}

tokens/transfer-hook-transfer-switch/anchor/programs/transfer-hook-transfer-switch/src/instructions/create_mint.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1+
use crate::{constants::*, error::*, state::*};
12
use {
23
anchor_lang::prelude::*,
34
anchor_spl::{
45
associated_token::AssociatedToken,
56
token::{mint_to, Mint, MintTo, Token, TokenAccount},
67
},
78
};
8-
use crate::{state::*, constants::*, error::*};
99

1010
#[derive(Accounts)]
1111
pub struct CreateMint<'info> {
@@ -46,7 +46,10 @@ pub fn create_mint(ctx: Context<CreateMint>) -> Result<()> {
4646
msg!("Creating new mint...");
4747
msg!("Mint address: {}", ctx.accounts.mint.key());
4848
msg!("Authority: {}", ctx.accounts.authority.key());
49-
msg!("Authority token account: {}", ctx.accounts.authority_token.key());
49+
msg!(
50+
"Authority token account: {}",
51+
ctx.accounts.authority_token.key()
52+
);
5053

5154
// Mint initial supply to authority
5255
mint_to(

tokens/transfer-hook-transfer-switch/anchor/programs/transfer-hook-transfer-switch/src/instructions/initialize.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
use crate::{constants::*, state::*};
12
use anchor_lang::prelude::*;
2-
use crate::{state::*, constants::*};
33

44
#[derive(Accounts)]
55
pub struct Initialize<'info> {
@@ -22,7 +22,10 @@ pub fn initialize(ctx: Context<Initialize>) -> Result<()> {
2222
let state = &mut ctx.accounts.state;
2323
state.authority = ctx.accounts.authority.key();
2424
state.bump = ctx.bumps.state;
25-
26-
msg!("Transfer hook state initialized with authority: {}", state.authority);
25+
26+
msg!(
27+
"Transfer hook state initialized with authority: {}",
28+
state.authority
29+
);
2730
Ok(())
2831
}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
pub mod initialize;
21
pub mod create_mint;
2+
pub mod initialize;
33
pub mod set_wallet_state;
44
pub mod transfer;
55

6-
pub use initialize::*;
76
pub use create_mint::*;
7+
pub use initialize::*;
88
pub use set_wallet_state::*;
9-
pub use transfer::*;
9+
pub use transfer::*;

tokens/transfer-hook-transfer-switch/anchor/programs/transfer-hook-transfer-switch/src/instructions/set_wallet_state.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
use crate::{constants::*, error::*, events::*, state::*};
12
use anchor_lang::prelude::*;
2-
use anchor_spl::token::{Token, Mint};
3-
use crate::{state::*, constants::*, error::*, events::*};
3+
use anchor_spl::token::{Mint, Token};
44

55
#[derive(Accounts)]
66
pub struct SetWalletState<'info> {
@@ -46,9 +46,9 @@ pub fn set_wallet_state(ctx: Context<SetWalletState>, is_frozen: bool) -> Result
4646
});
4747

4848
msg!(
49-
"Wallet state updated for {}: frozen = {}",
50-
ctx.accounts.wallet.key(),
49+
"Wallet state updated for {}: frozen = {}",
50+
ctx.accounts.wallet.key(),
5151
is_frozen
5252
);
5353
Ok(())
54-
}
54+
}

tokens/transfer-hook-transfer-switch/anchor/programs/transfer-hook-transfer-switch/src/lib.rs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ use anchor_lang::prelude::*;
33
pub mod constants;
44
pub mod error;
55
pub mod events;
6-
pub mod state;
76
pub mod instructions;
7+
pub mod state;
88

99
use instructions::*;
1010

@@ -24,19 +24,13 @@ pub mod transfer_hook {
2424
instructions::create_mint::create_mint(ctx)
2525
}
2626

27-
pub fn set_wallet_state(
28-
ctx: Context<SetWalletState>,
29-
is_frozen: bool,
30-
) -> Result<()> {
27+
pub fn set_wallet_state(ctx: Context<SetWalletState>, is_frozen: bool) -> Result<()> {
3128
msg!("Setting wallet state: frozen = {}", is_frozen);
3229
instructions::set_wallet_state::set_wallet_state(ctx, is_frozen)
3330
}
3431

35-
pub fn transfer(
36-
ctx: Context<TransferTokens>,
37-
amount: u64,
38-
) -> Result<()> {
32+
pub fn transfer(ctx: Context<TransferTokens>, amount: u64) -> Result<()> {
3933
msg!("Processing transfer of {} tokens", amount);
4034
instructions::transfer::transfer_tokens(ctx, amount)
4135
}
42-
}
36+
}

tokens/transfer-hook-transfer-switch/anchor/programs/transfer-hook-transfer-switch/src/state.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@ pub struct WalletState {
1414
pub bump: u8,
1515
pub mint: Pubkey,
1616
pub owner: Pubkey,
17-
}
17+
}

0 commit comments

Comments
 (0)