Skip to content

Commit 188dda7

Browse files
author
Solandy
committed
remove attempt1
1 parent c017dbb commit 188dda7

File tree

1 file changed

+3
-24
lines changed
  • compression/cnft-vault/anchor/programs/cnft-vault/src

1 file changed

+3
-24
lines changed

compression/cnft-vault/anchor/programs/cnft-vault/src/lib.rs

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -33,24 +33,6 @@ pub mod cnft_vault {
3333
index: u32,) -> Result<()> {
3434
msg!("attempting to send nft {} from tree {}", index, ctx.accounts.merkle_tree.key());
3535

36-
// CPI to bubblegum
37-
// //attempt 1
38-
// mpl_bubblegum::cpi::transfer(
39-
// CpiContext::new_with_signer(
40-
// ctx.accounts.bubblegum_program.to_account_info(),
41-
// mpl_bubblegum::cpi::accounts::Transfer{
42-
// tree_authority: ctx.accounts.tree_authority.to_account_info(),
43-
// leaf_owner: ctx.accounts.leaf_owner.to_account_info(),
44-
// leaf_delegate: ctx.accounts.leaf_owner.to_account_info(),
45-
// new_leaf_owner: ctx.accounts.new_leaf_owner.to_account_info(),
46-
// merkle_tree: ctx.accounts.merkle_tree.to_account_info(),
47-
// log_wrapper: ctx.accounts.log_wrapper.to_account_info(),
48-
// compression_program: ctx.accounts.compression_program.to_account_info(),
49-
// system_program: ctx.accounts.system_program.to_account_info(),
50-
// }, &[&[b"cNFT-vault", &[*ctx.bumps.get("vault").unwrap()]]]),
51-
// root, data_hash, creator_hash, nonce, index)
52-
53-
//attempt 2
5436
let mut accounts: Vec<solana_program::instruction::AccountMeta> = vec![
5537
AccountMeta::new_readonly(ctx.accounts.tree_authority.key(), false),
5638
AccountMeta::new_readonly(ctx.accounts.leaf_owner.key(), true),
@@ -98,10 +80,8 @@ pub mod cnft_vault {
9880
&[&[b"cNFT-vault", &[*ctx.bumps.get("leaf_owner").unwrap()]]])
9981
.map_err(Into::into)
10082

101-
10283
}
10384

104-
10585
pub fn withdraw_two_cnfts<'info>(ctx: Context<'_, '_, '_, 'info, WithdrawTwo<'info>>,
10686
root1: [u8; 32],
10787
data_hash1: [u8; 32],
@@ -120,8 +100,9 @@ pub mod cnft_vault {
120100
let merkle_tree2 = ctx.accounts.merkle_tree2.key();
121101
msg!("attempting to send nfts from trees {} and {}", merkle_tree1, merkle_tree2);
122102

123-
// TODO check if nft transfers are even valid (correct NFT, correct authority)
124-
// in this example anyone can withdraw any NFT from the vault
103+
104+
// Note: in this example anyone can withdraw any NFT from the vault
105+
// in productions you should check if nft transfers are valid (correct NFT, correct authority)
125106

126107
let mut accounts1: Vec<solana_program::instruction::AccountMeta> = vec![
127108
AccountMeta::new_readonly(ctx.accounts.tree_authority1.key(), false),
@@ -181,7 +162,6 @@ pub mod cnft_vault {
181162
ctx.accounts.system_program.to_account_info(),
182163
];
183164

184-
// add "accounts" (hashes) that make up the merkle proof
185165
let mut i = 0u8;
186166
for acc in ctx.remaining_accounts.iter() {
187167
if i < proof_1_length {
@@ -217,7 +197,6 @@ pub mod cnft_vault {
217197
msg!("successfully sent cNFTs");
218198
Ok(())
219199

220-
221200
}
222201

223202
}

0 commit comments

Comments
 (0)