-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
78 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 4 additions & 4 deletions
8
extensions/puppet/programs/puppet/src/instructions/check_bound_by_device.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
use crate::errors::ErrorCode; | ||
use crate::state::{DeviceBinding, NFTBinding}; | ||
use crate::state::{DeviceBinding, MplBinding}; | ||
use anchor_lang::prelude::*; | ||
|
||
#[derive(Accounts)] | ||
pub struct Bound<'info> { | ||
pub device_binding: Account<'info, DeviceBinding>, | ||
pub nft_binding: Account<'info, NFTBinding>, | ||
pub mpl_binding: Account<'info, MplBinding>, | ||
} | ||
|
||
pub fn check_bound_by_device(ctx: Context<Bound>, device: Pubkey) -> Result<bool> { | ||
if ctx.accounts.nft_binding.device != device { | ||
if ctx.accounts.mpl_binding.device_ata != device { | ||
return Err(ErrorCode::DeviceDoesNotMatch.into()); | ||
} | ||
Ok(ctx.accounts.device_binding.nft != Pubkey::default()) | ||
Ok(ctx.accounts.device_binding.mpl_ata != Pubkey::default()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
pub mod device_collection_binding; | ||
pub mod nft_collection_binding; | ||
pub mod mpl_collection_binding; | ||
pub mod device_binding; | ||
pub mod nft_binding; | ||
pub mod mpl_binding; | ||
|
||
pub use device_collection_binding::*; | ||
pub use nft_collection_binding::*; | ||
pub use mpl_collection_binding::*; | ||
pub use device_binding::*; | ||
pub use nft_binding::*; | ||
pub use mpl_binding::*; |
4 changes: 2 additions & 2 deletions
4
.../programs/puppet/src/state/nft_binding.rs → .../programs/puppet/src/state/mpl_binding.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
use anchor_lang::prelude::*; | ||
|
||
#[account] | ||
pub struct NFTBinding { | ||
pub device: Pubkey, | ||
pub struct MplBinding { | ||
pub device_ata: Pubkey, | ||
pub bump: u8, | ||
} |
2 changes: 1 addition & 1 deletion
2
...uppet/src/state/nft_collection_binding.rs → ...uppet/src/state/mpl_collection_binding.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
use anchor_lang::prelude::*; | ||
|
||
#[account] | ||
pub struct NFTCollectionBinding { | ||
pub struct MplCollectionBinding { | ||
pub device_collection: Pubkey, | ||
pub bump: u8, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters