Skip to content

Commit 74259c6

Browse files
committed
add allow deprecated attribute to token anchor examples
1 parent ed6aa77 commit 74259c6

File tree

58 files changed

+271
-3850
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+271
-3850
lines changed

tokens/create-token/anchor/programs/create-token/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
#![allow(clippy::result_large_err)]
2+
#![allow(unexpected_cfgs)]
3+
#![allow(deprecated)]
24

35
use {
46
anchor_lang::prelude::*,

tokens/escrow/anchor/programs/escrow/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,3 @@ idl-build = ["anchor-lang/idl-build", "anchor-spl/idl-build"]
1919
[dependencies]
2020
anchor-lang = { version = "0.31.1", features = ["init-if-needed"]}
2121
anchor-spl = "0.31.1"
22-
solana-program = "=2.0.3"

tokens/escrow/anchor/programs/escrow/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
#![allow(deprecated)]
2+
#![allow(unexpected_cfgs)]
3+
14
pub mod constants;
25
pub mod error;
36
pub mod instructions;

tokens/external-delegate-token-master/anchor/programs/external-delegate-token-master/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,3 @@ idl-build = ["anchor-lang/idl-build", "anchor-spl/idl-build"]
2020
anchor-lang = { version = "0.31.1", features = ["init-if-needed"] }
2121
anchor-spl = { version = "0.31.1", features = ["metadata"] }
2222
sha3 = "0.10.8"
23-
solana-program = "2.2.1"

tokens/external-delegate-token-master/anchor/programs/external-delegate-token-master/src/lib.rs

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1+
#![allow(deprecated)]
2+
#![allow(unexpected_cfgs)]
3+
14
use anchor_lang::prelude::*;
25
use anchor_spl::token;
36
use anchor_spl::token::{Token, TokenAccount, Transfer};
4-
use solana_program::secp256k1_recover::secp256k1_recover;
57
use sha3::{Digest, Keccak256};
8+
use solana_program::secp256k1_recover::secp256k1_recover;
69

710
declare_id!("FYPkt5VWMvtyWZDMGCwoKFkE3wXTzphicTpnNGuHWVbD");
811

@@ -17,13 +20,21 @@ pub mod external_delegate_token_master {
1720
Ok(())
1821
}
1922

20-
pub fn set_ethereum_address(ctx: Context<SetEthereumAddress>, ethereum_address: [u8; 20]) -> Result<()> {
23+
pub fn set_ethereum_address(
24+
ctx: Context<SetEthereumAddress>,
25+
ethereum_address: [u8; 20],
26+
) -> Result<()> {
2127
let user_account = &mut ctx.accounts.user_account;
2228
user_account.ethereum_address = ethereum_address;
2329
Ok(())
2430
}
2531

26-
pub fn transfer_tokens(ctx: Context<TransferTokens>, amount: u64, signature: [u8; 65], message: [u8; 32]) -> Result<()> {
32+
pub fn transfer_tokens(
33+
ctx: Context<TransferTokens>,
34+
amount: u64,
35+
signature: [u8; 65],
36+
message: [u8; 32],
37+
) -> Result<()> {
2738
let user_account = &ctx.accounts.user_account;
2839

2940
if !verify_ethereum_signature(&user_account.ethereum_address, &message, &signature) {
@@ -41,10 +52,7 @@ pub mod external_delegate_token_master {
4152
CpiContext::new_with_signer(
4253
ctx.accounts.token_program.to_account_info(),
4354
transfer_instruction,
44-
&[&[
45-
user_account.key().as_ref(),
46-
&[ctx.bumps.user_pda],
47-
]],
55+
&[&[user_account.key().as_ref(), &[ctx.bumps.user_pda]]],
4856
),
4957
amount,
5058
)?;
@@ -78,7 +86,8 @@ pub mod external_delegate_token_master {
7886

7987
#[derive(Accounts)]
8088
pub struct Initialize<'info> {
81-
#[account(init, payer = authority, space = 8 + 32 + 20)] // Ensure this is only for user_account
89+
#[account(init, payer = authority, space = 8 + 32 + 20)]
90+
// Ensure this is only for user_account
8291
pub user_account: Account<'info, UserAccount>,
8392
#[account(mut)]
8493
pub authority: Signer<'info>, // This should remain as a signer
@@ -138,7 +147,11 @@ pub enum ErrorCode {
138147
InvalidSignature,
139148
}
140149

141-
fn verify_ethereum_signature(ethereum_address: &[u8; 20], message: &[u8; 32], signature: &[u8; 65]) -> bool {
150+
fn verify_ethereum_signature(
151+
ethereum_address: &[u8; 20],
152+
message: &[u8; 32],
153+
signature: &[u8; 65],
154+
) -> bool {
142155
let recovery_id = signature[64];
143156
let mut sig = [0u8; 64];
144157
sig.copy_from_slice(&signature[..64]);

tokens/nft-minter/anchor/programs/nft-minter/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
#![allow(clippy::result_large_err)]
2+
#![allow(deprecated)]
3+
#![allow(unexpected_cfgs)]
24

35
use {
46
anchor_lang::prelude::*,

tokens/nft-operations/anchor/programs/mint-nft/src/lib.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
#![allow(deprecated)]
2+
#![allow(unexpected_cfgs)]
3+
14
use anchor_lang::prelude::*;
25

36
declare_id!("3EMcczaGi9ivdLxvvFwRbGYeEUEHpGwabXegARw4jLxa");
@@ -13,7 +16,7 @@ pub mod mint_nft {
1316
pub fn create_collection(ctx: Context<CreateCollection>) -> Result<()> {
1417
ctx.accounts.create_collection(&ctx.bumps)
1518
}
16-
19+
1720
pub fn mint_nft(ctx: Context<MintNFT>) -> Result<()> {
1821
ctx.accounts.mint_nft(&ctx.bumps)
1922
}

tokens/pda-mint-authority/anchor/programs/token-minter/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
#![allow(clippy::result_large_err)]
2+
#![allow(deprecated)]
3+
#![allow(unexpected_cfgs)]
24

35
use anchor_lang::prelude::*;
46
use instructions::*;

tokens/spl-token-minter/anchor/programs/spl-token-minter/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
#![allow(clippy::result_large_err)]
2+
#![allow(deprecated)]
3+
#![allow(unexpected_cfgs)]
24

35
use anchor_lang::prelude::*;
46

tokens/token-2022/basics/anchor/programs/basics/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
#![allow(clippy::result_large_err)]
2+
#![allow(deprecated)]
3+
#![allow(unexpected_cfgs)]
24

35
use anchor_lang::prelude::*;
46
use anchor_spl::associated_token::AssociatedToken;

0 commit comments

Comments
 (0)