diff --git a/mintbase-deps/src/asserts.rs b/mintbase-deps/src/asserts.rs index 0b97598..0599991 100644 --- a/mintbase-deps/src/asserts.rs +++ b/mintbase-deps/src/asserts.rs @@ -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 diff --git a/mintbase-deps/src/common.rs b/mintbase-deps/src/common.rs index 4156abd..e882e41 100644 --- a/mintbase-deps/src/common.rs +++ b/mintbase-deps/src/common.rs @@ -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, @@ -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, @@ -42,10 +36,6 @@ pub use time::{ NearTime, TimeUnit, }; -// pub use token::{ -// Token, -// TokenCompliant, -// }; pub use token_key::TokenKey; pub use token_listing::TokenListing; pub use token_metadata::{ @@ -53,4 +43,3 @@ pub use token_metadata::{ TokenMetadataCompliant, }; pub use token_offer::TokenOffer; -// pub use store_metadata::{}; diff --git a/mintbase-deps/src/common/token_metadata.rs b/mintbase-deps/src/common/token_metadata.rs index 9659206..f11848f 100644 --- a/mintbase-deps/src/common/token_metadata.rs +++ b/mintbase-deps/src/common/token_metadata.rs @@ -40,34 +40,6 @@ pub struct TokenMetadata { pub reference_hash: Option, } -// 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 diff --git a/mintbase-deps/src/constants.rs b/mintbase-deps/src/constants.rs index a9cb2ee..3886312 100644 --- a/mintbase-deps/src/constants.rs +++ b/mintbase-deps/src/constants.rs @@ -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. @@ -187,5 +186,3 @@ impl StorageCostsMarket { } } } - -// TODO: StorageCosts for Factory? diff --git a/mintbase-deps/src/lib.rs b/mintbase-deps/src/lib.rs index 996966f..39bdd42 100644 --- a/mintbase-deps/src/lib.rs +++ b/mintbase-deps/src/lib.rs @@ -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, -// }; diff --git a/mintbase-deps/src/logging.rs b/mintbase-deps/src/logging.rs index a6e05fa..8d09282 100644 --- a/mintbase-deps/src/logging.rs +++ b/mintbase-deps/src/logging.rs @@ -1,8 +1,3 @@ -use near_sdk::serde::{ - Deserialize, - Serialize, -}; - mod market; mod mb_store_settings; mod nft_approvals; @@ -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) - } -} diff --git a/mintbase-deps/src/logging/mb_store_settings.rs b/mintbase-deps/src/logging/mb_store_settings.rs index 7c1610f..5da83a9 100644 --- a/mintbase-deps/src/logging/mb_store_settings.rs +++ b/mintbase-deps/src/logging/mb_store_settings.rs @@ -69,9 +69,6 @@ pub fn log_transfer_store(account_id: &AccountId) { } pub fn log_set_icon_base64(base64: &Option) { - // 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(), @@ -80,14 +77,3 @@ pub fn log_set_icon_base64(base64: &Option) { .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(), - ); -} diff --git a/mintbase-deps/src/logging/nft_loan.rs b/mintbase-deps/src/logging/nft_loan.rs deleted file mode 100644 index 66b5b7a..0000000 --- a/mintbase-deps/src/logging/nft_loan.rs +++ /dev/null @@ -1,33 +0,0 @@ -use near_sdk::serde::{ - Deserialize, - Serialize, -}; -use near_sdk::{ - env, - AccountId, -}; - -use crate::logging::NearJsonEvent; - -#[derive(Clone, Debug, Deserialize, Serialize)] -pub struct NftLoanSetLog { - pub account_id: Option, - pub token_id: u64, -} - -pub fn log_nft_loan_set( - token_id: u64, - account_id: &Option, -) { - let log = NftLoanSetLog { - account_id: account_id.as_ref().map(|x| x.to_string()), - token_id, - }; - let event = NearJsonEvent { - standard: "nep171".to_string(), - version: "1.0.0".to_string(), - event: "nft_loan_set".to_string(), - data: serde_json::to_string(&log).unwrap(), - }; - env::log_str(event.near_json_event().as_str()); -} diff --git a/mintbase-deps/src/logging/nft_move.rs b/mintbase-deps/src/logging/nft_move.rs deleted file mode 100644 index f82f7bc..0000000 --- a/mintbase-deps/src/logging/nft_move.rs +++ /dev/null @@ -1,54 +0,0 @@ -use near_sdk::env; -use near_sdk::json_types::U64; -use near_sdk::serde::{ - Deserialize, - Serialize, -}; - -use crate::logging::NearJsonEvent; - -#[derive(Clone, Debug, Deserialize, Serialize)] -pub struct NftMovedLog { - pub token_id: U64, - pub contract_id: String, -} - -#[derive(Clone, Debug, Deserialize, Serialize)] -pub struct NftOnMoveLog { - pub token_id: U64, - pub origin_key: String, -} - -pub fn log_on_move( - token_id: U64, - origin_key: &str, -) { - let log = NftOnMoveLog { - token_id, - origin_key: origin_key.to_string(), - }; - let event = NearJsonEvent { - standard: "nep171".to_string(), - version: "1.0.0".to_string(), - event: "nft_on_move".to_string(), - data: serde_json::to_string(&log).unwrap(), - }; - env::log_str(event.near_json_event().as_str()); -} - -pub fn log_nft_moved( - token_id: U64, - contract_id: String, -) { - let log = NftMovedLog { - token_id, - contract_id, - }; - let event = NearJsonEvent { - standard: "nep171".to_string(), - version: "1.0.0".to_string(), - event: "nft_moved".to_string(), - data: serde_json::to_string(&log).unwrap(), - }; - env::log_str(event.near_json_event().as_str()); -} diff --git a/mintbase-deps/src/utils.rs b/mintbase-deps/src/utils.rs index d241a32..cd6d978 100644 --- a/mintbase-deps/src/utils.rs +++ b/mintbase-deps/src/utils.rs @@ -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::().unwrap() * 10u128.pow(24); -// if vals.len() > 1 { -// let power = vals[1].len() as u32; -// let part2 = vals[1].parse::().unwrap() * 10u128.pow(24 - power); -// part1 + part2 -// } else { -// part1 -// } -// } - -// // TODO: unused, deprecated? -// pub fn to_near(n: u128) -> u128 { -// n * 10u128.pow(24) -// } diff --git a/store/src/minting.rs b/store/src/minting.rs index e124723..f415413 100644 --- a/store/src/minting.rs +++ b/store/src/minting.rs @@ -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,