Skip to content
This repository was archived by the owner on May 1, 2025. It is now read-only.

Commit 2781f2d

Browse files
committed
First pre-auditing pass
1 parent c386962 commit 2781f2d

File tree

4 files changed

+33
-5
lines changed

4 files changed

+33
-5
lines changed

factory/src/lib.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ impl Default for MintbaseStoreFactory {
6565

6666
#[near_bindgen]
6767
impl MintbaseStoreFactory {
68-
pub fn assert_only_owner(&self) {
68+
/// Panics if not called by the factory owner
69+
fn assert_only_owner(&self) {
6970
assert_one_yocto();
7071
assert_eq!(
7172
env::predecessor_account_id(),
@@ -76,7 +77,7 @@ impl MintbaseStoreFactory {
7677

7778
/// Sufficient attached deposit is defined as enough to deploy a `Store`,
7879
/// plus enough left over for the mintbase deployment cost.
79-
pub fn assert_sufficient_attached_deposit(&self) {
80+
fn assert_sufficient_attached_deposit(&self) {
8081
let min = storage_bytes::STORE as u128 * self.storage_price_per_byte + self.mintbase_fee;
8182
assert!(
8283
env::attached_deposit() >= min,
@@ -86,6 +87,7 @@ impl MintbaseStoreFactory {
8687
);
8788
}
8889

90+
/// Panics if a store with the requested ID already exists
8991
pub fn assert_no_store_with_id(
9092
&self,
9193
store_id: String,
@@ -119,7 +121,7 @@ impl MintbaseStoreFactory {
119121
(storage_bytes::STORE as u128 * self.storage_price_per_byte + self.mintbase_fee).into()
120122
}
121123

122-
/// The sum of `mintbase_fee` and `STORE_STORAGE`.
124+
/// Public key that will be attached to any created store.
123125
pub fn get_admin_public_key(&self) -> &PublicKey {
124126
&self.admin_public_key
125127
}
@@ -213,6 +215,7 @@ impl MintbaseStoreFactory {
213215
}
214216
}
215217

218+
/// Initialization
216219
#[init(ignore_state)]
217220
pub fn new() -> Self {
218221
assert!(!env::state_exists());

simple-market-contract

store/src/burning.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ impl MintbaseStore {
8383
log_nft_batch_burn(&token_ids, account_id.to_string());
8484
}
8585

86-
/// Get info about the store.
86+
/// Log store info.
8787
pub fn get_info(&self) {
8888
let s = format!("owner: {}", self.owner_id);
8989
env::log_str(s.as_str());

store/src/lib.rs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,25 @@ impl MintbaseStore {
208208
Self { metadata, ..old }
209209
}
210210

211+
/// Intended to introduce a consistent storage scheme to all stores.
212+
/// This migration is currently paused because of problems with
213+
/// MyNearWallet.
214+
///
215+
/// Pros for the migration:
216+
///
217+
/// - More flexibility
218+
/// - Enables usage of multiple storage providers
219+
/// - Reduces dependence on arweave
220+
/// - Current inconsistency causes a lot of confusion, but all of the NEAR
221+
/// NFT ecosystem is already fragmented in their usage of `base_uri`
222+
///
223+
/// Cons for the migration:
224+
///
225+
/// - Gas costs
226+
/// - Permanently increased storage costs
227+
/// - Very slim probability for data corruption (worked fine on testnet),
228+
/// which should also be reversible
229+
/// - Will require partial reindexing
211230
#[private]
212231
pub fn prepend_base_uri(
213232
&mut self,
@@ -231,6 +250,12 @@ impl MintbaseStore {
231250
self.metadata.base_uri = None;
232251
}
233252

253+
#[private]
254+
pub fn repair_reference(&mut self) {
255+
// FIXME: repair nearcon2demo1.minstpace2.testnet -> remove `nan/` prefixes on reference
256+
self.metadata.base_uri = None;
257+
}
258+
234259
// -------------------------- internal methods -------------------------
235260

236261
/// If allow_moves is false, disallow token owners from calling

0 commit comments

Comments
 (0)