diff --git a/factory/src/lib.rs b/factory/src/lib.rs index 356f67a..5cf9774 100644 --- a/factory/src/lib.rs +++ b/factory/src/lib.rs @@ -9,7 +9,6 @@ use mintbase_deps::constants::{ gas, storage_bytes, storage_stake, - NO_DEPOSIT, YOCTO_PER_BYTE, }; use mintbase_deps::interfaces::factory_self; diff --git a/simple-market-contract b/simple-market-contract index 965faee..6294d11 160000 --- a/simple-market-contract +++ b/simple-market-contract @@ -1 +1 @@ -Subproject commit 965faee2cfce5073062347b81928cfe5cd087362 +Subproject commit 6294d11f31cfe195d7c080e5342aca4fa5b081a1 diff --git a/store/src/lib.rs b/store/src/lib.rs index 1b611e4..0c64781 100644 --- a/store/src/lib.rs +++ b/store/src/lib.rs @@ -216,19 +216,19 @@ impl MintbaseStore { /// which should also be reversible /// - Will require partial reindexing #[private] - pub fn prepend_base_uri( + pub fn set_reference_media( &mut self, - base_uri: String, - token_ids_with_media: Vec<(String, Option)>, + specs: Vec<(String, Option, Option)>, ) { - for (token_id, media) in token_ids_with_media - .iter() - .map(|(id, media)| (id.parse::().unwrap(), media)) - { - let metadata_id = self.tokens.get(&token_id).unwrap().metadata_id; + for (token_id, reference, media) in specs { + let metadata_id = self + .tokens + .get(&token_id.parse().unwrap()) + .unwrap() + .metadata_id; let (n, mut metadata) = self.token_metadata.get(&metadata_id).unwrap(); - metadata.reference = concat_uri(&base_uri, &metadata.reference); - metadata.media = concat_uri(&base_uri, &media); + metadata.reference = reference; + metadata.media = media; self.token_metadata.insert(&metadata_id, &(n, metadata)); } } @@ -236,17 +236,11 @@ impl MintbaseStore { /// Drops the base_uri after successfully migration all tokens with /// `prepend_base_uri` #[private] - pub fn drop_base_uri(&mut self) { - self.metadata.base_uri = None; - } - - /// While prepending and dropping base_uri, I destroyed - /// nearcon2demo1.mintspace2.testnet, and one day I might wish to repair it - /// using this method. - #[private] - pub fn repair_reference(&mut self) { - // FIXME: repair nearcon2demo1.minstpace2.testnet -> remove `nan/` prefixes on reference - self.metadata.base_uri = None; + pub fn set_base_uri( + &mut self, + base_uri: Option, + ) { + self.metadata.base_uri = base_uri; } // -------------------------- internal methods ------------------------- @@ -339,15 +333,3 @@ pub trait NonFungibleResolveTransfer { approved_account_ids: Option>, ); } - -fn concat_uri( - base: &str, - uri: &Option, -) -> Option { - match uri { - None => None, - Some(uri) if uri.starts_with(base) => Some(uri.to_string()), - Some(uri) if base.ends_with('/') => Some(format!("{}{}", base, uri)), - Some(uri) => Some(format!("{}/{}", base, uri)), - } -}