diff --git a/programs/mpl-asset/src/plugins/collection.rs b/programs/mpl-asset/src/plugins/collection.rs index 65738a41..35298700 100644 --- a/programs/mpl-asset/src/plugins/collection.rs +++ b/programs/mpl-asset/src/plugins/collection.rs @@ -4,13 +4,5 @@ use solana_program::pubkey::Pubkey; #[derive(Clone, BorshSerialize, BorshDeserialize, Debug)] pub struct Collection { collection_address: Pubkey, -} - -#[derive(Clone, BorshSerialize, BorshDeserialize, Debug, ShankAccount)] -pub struct CollectionData { - pub key: Key, //2 - pub update_authority: Pubkey, //32 - pub owner: Pubkey, //32 - pub name: String, //4 - pub uri: String, //4 + required: bool, } diff --git a/programs/mpl-asset/src/plugins/mod.rs b/programs/mpl-asset/src/plugins/mod.rs index 7f3e3c85..387a3e47 100644 --- a/programs/mpl-asset/src/plugins/mod.rs +++ b/programs/mpl-asset/src/plugins/mod.rs @@ -1,7 +1,4 @@ -mod asset; mod royalties; - -pub use asset::*; pub use royalties::*; use borsh::{BorshDeserialize, BorshSerialize}; @@ -52,10 +49,6 @@ pub trait DataStorage { fn load_mut(&self, data: &mut [u8]); } -pub trait Compressible { - fn hash(&self) -> Result<[u8; 32], ProgramError>; -} - // pub trait PluginTrait // where // Self: BorshSerialize + BorshDeserialize + Clone + std::fmt::Debug + Sized, diff --git a/programs/mpl-asset/src/processor/create.rs b/programs/mpl-asset/src/processor/create.rs index efcdc1ca..248c0076 100644 --- a/programs/mpl-asset/src/processor/create.rs +++ b/programs/mpl-asset/src/processor/create.rs @@ -8,8 +8,7 @@ use solana_program::{ use crate::{ error::MplAssetError, instruction::{accounts::CreateAccounts, CreateArgs}, - plugins::{Asset, Compressible, HashedAsset, Key}, - state::DataState, + state::{Asset, Compressible, DataState, HashedAsset, Key}, }; pub(crate) fn create<'a>(accounts: &'a [AccountInfo<'a>], args: CreateArgs) -> ProgramResult { diff --git a/programs/mpl-asset/src/plugins/asset.rs b/programs/mpl-asset/src/state/asset.rs similarity index 73% rename from programs/mpl-asset/src/plugins/asset.rs rename to programs/mpl-asset/src/state/asset.rs index 09d7c050..92a4d60d 100644 --- a/programs/mpl-asset/src/plugins/asset.rs +++ b/programs/mpl-asset/src/state/asset.rs @@ -2,20 +2,11 @@ use borsh::{BorshDeserialize, BorshSerialize}; use shank::ShankAccount; use solana_program::{keccak, program_error::ProgramError, pubkey::Pubkey}; -use super::Compressible; - -#[derive(Clone, BorshSerialize, BorshDeserialize, Debug, PartialEq, Eq)] -pub enum Key { - Uninitialized, - Asset, - HashedAsset, - Collection, - HashedCollection, -} +use super::{Compressible, Key}; #[derive(Clone, BorshSerialize, BorshDeserialize, Debug, ShankAccount)] pub struct Asset { - pub key: Key, //2 + pub key: Key, //1 pub update_authority: Pubkey, //32 pub owner: Pubkey, //32 pub name: String, //4 @@ -32,7 +23,7 @@ impl Compressible for Asset { #[derive(Clone, BorshSerialize, BorshDeserialize, Debug, ShankAccount)] pub struct HashedAsset { - pub key: Key, //2 + pub key: Key, //1 pub hash: [u8; 32], //32 pub watermark_slot: Option, //1 | 9 } diff --git a/programs/mpl-asset/src/state/collection.rs b/programs/mpl-asset/src/state/collection.rs new file mode 100644 index 00000000..52ac4752 --- /dev/null +++ b/programs/mpl-asset/src/state/collection.rs @@ -0,0 +1,11 @@ +use borsh::{BorshDeserialize, BorshSerialize}; +use solana_program::pubkey::Pubkey; + +#[derive(Clone, BorshSerialize, BorshDeserialize, Debug, ShankAccount)] +pub struct CollectionData { + pub key: Key, //1 + pub update_authority: Pubkey, //32 + pub owner: Pubkey, //32 + pub name: String, //4 + pub uri: String, //4 +} diff --git a/programs/mpl-asset/src/state/mod.rs b/programs/mpl-asset/src/state/mod.rs index 9c92ffbf..1de949ad 100644 --- a/programs/mpl-asset/src/state/mod.rs +++ b/programs/mpl-asset/src/state/mod.rs @@ -1,3 +1,6 @@ +mod asset; +pub use asset::*; + use borsh::{BorshDeserialize, BorshSerialize}; use solana_program::account_info::AccountInfo; use solana_program::entrypoint::ProgramResult; @@ -46,3 +49,16 @@ pub enum Authority { Permanent { address: Pubkey }, SameAs { plugin: Plugin }, } + +pub trait Compressible { + fn hash(&self) -> Result<[u8; 32], ProgramError>; +} + +#[derive(Clone, BorshSerialize, BorshDeserialize, Debug, PartialEq, Eq)] +pub enum Key { + Uninitialized, + Asset, + HashedAsset, + Collection, + HashedCollection, +}