diff --git a/factory/src/lib.rs b/factory/src/lib.rs index 9963a3d..a995ed5 100644 --- a/factory/src/lib.rs +++ b/factory/src/lib.rs @@ -65,7 +65,8 @@ impl Default for MintbaseStoreFactory { #[near_bindgen] impl MintbaseStoreFactory { - pub fn assert_only_owner(&self) { + /// Panics if not called by the factory owner + fn assert_only_owner(&self) { assert_one_yocto(); assert_eq!( env::predecessor_account_id(), @@ -76,7 +77,7 @@ impl MintbaseStoreFactory { /// Sufficient attached deposit is defined as enough to deploy a `Store`, /// plus enough left over for the mintbase deployment cost. - pub fn assert_sufficient_attached_deposit(&self) { + fn assert_sufficient_attached_deposit(&self) { let min = storage_bytes::STORE as u128 * self.storage_price_per_byte + self.mintbase_fee; assert!( env::attached_deposit() >= min, @@ -86,6 +87,7 @@ impl MintbaseStoreFactory { ); } + /// Panics if a store with the requested ID already exists pub fn assert_no_store_with_id( &self, store_id: String, @@ -119,7 +121,7 @@ impl MintbaseStoreFactory { (storage_bytes::STORE as u128 * self.storage_price_per_byte + self.mintbase_fee).into() } - /// The sum of `mintbase_fee` and `STORE_STORAGE`. + /// Public key that will be attached to any created store. pub fn get_admin_public_key(&self) -> &PublicKey { &self.admin_public_key } @@ -213,6 +215,7 @@ impl MintbaseStoreFactory { } } + /// Initialization #[init(ignore_state)] pub fn new() -> Self { assert!(!env::state_exists()); diff --git a/simple-market-contract b/simple-market-contract index a2c84ad..84f0925 160000 --- a/simple-market-contract +++ b/simple-market-contract @@ -1 +1 @@ -Subproject commit a2c84ad35254e1d427e3bad6eb3aab3cffb29683 +Subproject commit 84f0925dadc1c2aa2a1f1360b192a4d523b01197 diff --git a/store/src/burning.rs b/store/src/burning.rs index 6c989bf..9669a40 100644 --- a/store/src/burning.rs +++ b/store/src/burning.rs @@ -83,7 +83,7 @@ impl MintbaseStore { log_nft_batch_burn(&token_ids, account_id.to_string()); } - /// Get info about the store. + /// Log store info. pub fn get_info(&self) { let s = format!("owner: {}", self.owner_id); env::log_str(s.as_str()); diff --git a/store/src/lib.rs b/store/src/lib.rs index c159707..d4ab99f 100644 --- a/store/src/lib.rs +++ b/store/src/lib.rs @@ -208,6 +208,25 @@ impl MintbaseStore { Self { metadata, ..old } } + /// Intended to introduce a consistent storage scheme to all stores. + /// This migration is currently paused because of problems with + /// MyNearWallet. + /// + /// Pros for the migration: + /// + /// - More flexibility + /// - Enables usage of multiple storage providers + /// - Reduces dependence on arweave + /// - Current inconsistency causes a lot of confusion, but all of the NEAR + /// NFT ecosystem is already fragmented in their usage of `base_uri` + /// + /// Cons for the migration: + /// + /// - Gas costs + /// - Permanently increased storage costs + /// - Very slim probability for data corruption (worked fine on testnet), + /// which should also be reversible + /// - Will require partial reindexing #[private] pub fn prepend_base_uri( &mut self, @@ -231,6 +250,12 @@ impl MintbaseStore { self.metadata.base_uri = None; } + #[private] + pub fn repair_reference(&mut self) { + // FIXME: repair nearcon2demo1.minstpace2.testnet -> remove `nan/` prefixes on reference + self.metadata.base_uri = None; + } + // -------------------------- internal methods ------------------------- /// If allow_moves is false, disallow token owners from calling