Skip to content

Commit

Permalink
Cleaning mintbase-deps
Browse files Browse the repository at this point in the history
  • Loading branch information
tifrel committed Jan 18, 2023
1 parent 2f533eb commit dba768f
Show file tree
Hide file tree
Showing 11 changed files with 1 addition and 221 deletions.
2 changes: 0 additions & 2 deletions mintbase-deps/src/asserts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ macro_rules! near_assert_ne {
};
}

// TODO: near_assert_range

// ------------- specific asserts for mintbase smart contracts -------------- //

// Theoretically a duplicate for `near_sdk::assert_one_yocto`, but this version
Expand Down
11 changes: 0 additions & 11 deletions mintbase-deps/src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ pub mod token_listing;
pub mod token_metadata;
pub mod token_offer;

// pub use loan::Loan;
// pub use owner::Owner;
pub use payouts::{
OwnershipFractions,
Payout,
Expand All @@ -29,10 +27,6 @@ pub use safe_fraction::{
SafeFraction,
};
pub use sale_args::SaleArgs;
// pub use storage::{
// StorageCosts,
// StorageCostsMarket,
// };
pub use store_init_args::StoreInitArgs;
pub use store_metadata::{
NFTContractMetadata,
Expand All @@ -42,15 +36,10 @@ pub use time::{
NearTime,
TimeUnit,
};
// pub use token::{
// Token,
// TokenCompliant,
// };
pub use token_key::TokenKey;
pub use token_listing::TokenListing;
pub use token_metadata::{
TokenMetadata,
TokenMetadataCompliant,
};
pub use token_offer::TokenOffer;
// pub use store_metadata::{};
28 changes: 0 additions & 28 deletions mintbase-deps/src/common/token_metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,34 +40,6 @@ pub struct TokenMetadata {
pub reference_hash: Option<Base64VecU8>,
}

// impl TokenMetadata {
// /// Get the metadata and its size in bytes.
// pub fn from_with_size(
// mut metadata: TokenMetadata,
// copies: u64,
// ) -> (Self, u64) {
// // if args.media.is_some() {
// // crate::near_assert!(
// // args.media_hash.is_some(),
// // "Cannot specificy metadata.media without metadata.media_hash"
// // );
// // }

// // if args.reference.is_some() {
// // crate::near_assert!(
// // args.reference_hash.is_some(),
// // "Cannot specificy metadata.reference without metadata.reference_hash"
// // );
// // }

// // If `metadata.copies` isn't supplied, use computed copies
// metadata.copies.or(Some(copies));
// let size = borsh::to_vec(&metadata).unwrap().len();

// (metadata, size as u64)
// }
// }

// NON-COMPLIANT https://github.com/near/NEPs/blob/master/specs/Standards/NonFungibleToken/Metadata.md
/// ref:
/// https://github.com/near/NEPs/blob/master/specs/Standards/NonFungibleToken/Metadata.md
Expand Down
3 changes: 0 additions & 3 deletions mintbase-deps/src/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ pub mod gas {
pub const PAYOUT_RESOLVE: Gas = tgas(30);

/// Gas requirements for transferring an NFT and obtaining the payout.
// TODO: Check back with Amber for requirements
pub const NFT_TRANSFER_PAYOUT: Gas = tgas(15);

/// Gas requirements for creating a store.
Expand Down Expand Up @@ -187,5 +186,3 @@ impl StorageCostsMarket {
}
}
}

// TODO: StorageCosts for Factory?
27 changes: 0 additions & 27 deletions mintbase-deps/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,30 +12,3 @@ pub use near_sdk::{
serde,
serde_json,
};

// // TODO: move module resolution to indexer
// #[cfg(feature = "all")]
// pub use crate::logging::{
// NearJsonEvent,
// // Nep171Event,
// // Nep171EventLog,
// NftApproveLog,
// NftBurnLog,
// NftComposeLog,
// NftListLog,
// NftLoanSetLog,
// NftMakeOfferLog,
// NftMintLog,
// NftMintLogMemo,
// NftOptionStringLog,
// NftRevokeLog,
// NftSaleData,
// NftSetSplitOwnerLog,
// NftStoreCreateLog,
// NftStringLog,
// NftTransferLog,
// NftUpdateListLog,
// NftUpdateOfferData,
// UpdateAllowlistData,
// UpdateBanlistData,
// };
31 changes: 0 additions & 31 deletions mintbase-deps/src/logging.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
use near_sdk::serde::{
Deserialize,
Serialize,
};

mod market;
mod mb_store_settings;
mod nft_approvals;
Expand All @@ -13,29 +8,3 @@ pub use mb_store_settings::*;
pub use nft_approvals::*;
pub use nft_core::*;
pub use nft_payouts::*;

// TODO: probably unused -> deprecate?
mod nft_composition;
mod nft_loan;
mod nft_move;
pub use nft_composition::*;
pub use nft_loan::*;
pub use nft_move::*;

// ------------------ general event according to standard ------------------- //

// TODO: deprecate this abomination
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct NearJsonEvent {
pub standard: String,
pub version: String,
pub event: String,
pub data: String,
}

impl NearJsonEvent {
pub fn near_json_event(&self) -> String {
let json = serde_json::to_string(&self).unwrap();
format!("EVENT_JSON: {}", &json)
}
}
14 changes: 0 additions & 14 deletions mintbase-deps/src/logging/mb_store_settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,6 @@ pub fn log_transfer_store(account_id: &AccountId) {
}

pub fn log_set_icon_base64(base64: &Option<String>) {
// this will not take care of icon deletion -> no accessible via UI
// TODO: document for coders that deletion will happen e.g. by inserting
// empty icon
env::log_str(
&MbStoreChangeSettingData {
new_icon_base64: base64.clone(),
Expand All @@ -80,14 +77,3 @@ pub fn log_set_icon_base64(base64: &Option<String>) {
.serialize_event(),
);
}

pub fn log_set_base_uri(base_uri: &str) {
// TODO: disallow this setting anyhow -> configurable on deploy only
env::log_str(
&MbStoreChangeSettingData {
new_base_uri: Some(base_uri.to_string()),
..MbStoreChangeSettingData::empty()
}
.serialize_event(),
);
}
33 changes: 0 additions & 33 deletions mintbase-deps/src/logging/nft_loan.rs

This file was deleted.

54 changes: 0 additions & 54 deletions mintbase-deps/src/logging/nft_move.rs

This file was deleted.

18 changes: 0 additions & 18 deletions mintbase-deps/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,3 @@ pub const fn ntot(near_amount: Gas) -> Gas {
pub const fn ntoy(near_amount: Balance) -> Balance {
near_amount * 10u128.pow(24)
}

// // TODO: unused, deprecated?
// pub fn to_yocto(value: &str) -> u128 {
// let vals: Vec<_> = value.split('.').collect();
// let part1 = vals[0].parse::<u128>().unwrap() * 10u128.pow(24);
// if vals.len() > 1 {
// let power = vals[1].len() as u32;
// let part2 = vals[1].parse::<u128>().unwrap() * 10u128.pow(24 - power);
// part1 + part2
// } else {
// part1
// }
// }

// // TODO: unused, deprecated?
// pub fn to_near(n: u128) -> u128 {
// n * 10u128.pow(24)
// }
1 change: 1 addition & 0 deletions store/src/minting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ impl MintbaseStore {
pub fn nft_batch_mint(
&mut self,
owner_id: AccountId,
#[allow(unused_mut)] // cargo complains, but it's required
mut metadata: TokenMetadata,
num_to_mint: u64,
royalty_args: Option<RoyaltyArgs>,
Expand Down

0 comments on commit dba768f

Please sign in to comment.