diff --git a/libraries/chain/include/graphene/chain/nft_object.hpp b/libraries/chain/include/graphene/chain/nft_object.hpp index 458a3ce1..163adbde 100644 --- a/libraries/chain/include/graphene/chain/nft_object.hpp +++ b/libraries/chain/include/graphene/chain/nft_object.hpp @@ -18,8 +18,8 @@ namespace graphene { namespace chain { std::string base_uri; optional revenue_partner; optional revenue_split; - bool isTransferable = false; - bool isSellable = true; + bool is_transferable = false; + bool is_sellable = true; }; class nft_object : public abstract_object @@ -94,8 +94,8 @@ FC_REFLECT_DERIVED( graphene::chain::nft_metadata_object, (graphene::db::object) (base_uri) (revenue_partner) (revenue_split) - (isTransferable) - (isSellable) ) + (is_transferable) + (is_sellable) ) FC_REFLECT_DERIVED( graphene::chain::nft_object, (graphene::db::object), (nft_metadata_id) diff --git a/libraries/chain/include/graphene/chain/protocol/nft_ops.hpp b/libraries/chain/include/graphene/chain/protocol/nft_ops.hpp index 06869d44..465ed987 100644 --- a/libraries/chain/include/graphene/chain/protocol/nft_ops.hpp +++ b/libraries/chain/include/graphene/chain/protocol/nft_ops.hpp @@ -15,8 +15,8 @@ namespace graphene { namespace chain { std::string base_uri; optional revenue_partner; optional revenue_split; - bool isTransferable = false; - bool isSellable = true; + bool is_transferable = false; + bool is_sellable = true; account_id_type fee_payer()const { return owner; } void validate() const; @@ -34,8 +34,8 @@ namespace graphene { namespace chain { optional base_uri; optional revenue_partner; optional revenue_split; - optional isTransferable; - optional isSellable; + optional is_transferable; + optional is_sellable; account_id_type fee_payer()const { return owner; } void validate() const; @@ -108,8 +108,8 @@ FC_REFLECT( graphene::chain::nft_safe_transfer_from_operation::fee_parameters_ty FC_REFLECT( graphene::chain::nft_approve_operation::fee_parameters_type, (fee) ) FC_REFLECT( graphene::chain::nft_set_approval_for_all_operation::fee_parameters_type, (fee) ) -FC_REFLECT( graphene::chain::nft_metadata_create_operation, (fee) (owner) (name) (symbol) (base_uri) (revenue_partner) (revenue_split) (isTransferable) (isSellable) ) -FC_REFLECT( graphene::chain::nft_metadata_update_operation, (fee) (owner) (nft_metadata_id) (name) (symbol) (base_uri) (revenue_partner) (revenue_split) (isTransferable) (isSellable) ) +FC_REFLECT( graphene::chain::nft_metadata_create_operation, (fee) (owner) (name) (symbol) (base_uri) (revenue_partner) (revenue_split) (is_transferable) (is_sellable) ) +FC_REFLECT( graphene::chain::nft_metadata_update_operation, (fee) (owner) (nft_metadata_id) (name) (symbol) (base_uri) (revenue_partner) (revenue_split) (is_transferable) (is_sellable) ) FC_REFLECT( graphene::chain::nft_mint_operation, (fee) (payer) (nft_metadata_id) (owner) (approved) (approved_operators) (token_uri) ) FC_REFLECT( graphene::chain::nft_safe_transfer_from_operation, (fee) (operator_) (from) (to) (token_id) (data) ) FC_REFLECT( graphene::chain::nft_approve_operation, (fee) (operator_) (approved) (token_id) ) diff --git a/libraries/chain/include/graphene/chain/protocol/offer.hpp b/libraries/chain/include/graphene/chain/protocol/offer.hpp index fcd0ab75..e1dbb082 100644 --- a/libraries/chain/include/graphene/chain/protocol/offer.hpp +++ b/libraries/chain/include/graphene/chain/protocol/offer.hpp @@ -114,7 +114,7 @@ namespace graphene offer_id_type offer_id; - fc::enum_type result; + result_type result; extensions_type extensions; diff --git a/libraries/chain/nft_evaluator.cpp b/libraries/chain/nft_evaluator.cpp index ab859a23..c72be81e 100644 --- a/libraries/chain/nft_evaluator.cpp +++ b/libraries/chain/nft_evaluator.cpp @@ -27,8 +27,8 @@ object_id_type nft_metadata_create_evaluator::do_apply( const nft_metadata_creat obj.base_uri = op.base_uri; obj.revenue_partner = op.revenue_partner; obj.revenue_split = op.revenue_split; - obj.isTransferable = op.isTransferable; - obj.isSellable = op.isSellable; + obj.is_transferable = op.is_transferable; + obj.is_sellable = op.is_sellable; }); return new_nft_metadata_object.id; } FC_CAPTURE_AND_RETHROW( (op) ) } @@ -62,10 +62,10 @@ void_result nft_metadata_update_evaluator::do_apply( const nft_metadata_update_o obj.revenue_partner = op.revenue_partner; if( op.revenue_split.valid() ) obj.revenue_split = op.revenue_split; - if( op.isTransferable.valid() ) - obj.isTransferable = *op.isTransferable; - if( op.isSellable.valid() ) - obj.isSellable = *op.isSellable; + if( op.is_transferable.valid() ) + obj.is_transferable = *op.is_transferable; + if( op.is_sellable.valid() ) + obj.is_sellable = *op.is_sellable; }); return void_result(); } FC_CAPTURE_AND_RETHROW( (op) ) } @@ -127,7 +127,7 @@ void_result nft_safe_transfer_from_evaluator::do_evaluate( const nft_safe_transf FC_ASSERT( (itr_nft->owner == op.operator_) || (itr_nft->approved == itr_operator->id) || (itr_approved_op != itr_nft->approved_operators.end()), "Operator is not NFT owner or approved operator" ); const auto& nft_meta_obj = itr_nft->nft_metadata_id(db()); - FC_ASSERT( nft_meta_obj.isTransferable == true, "NFT is not transferable"); + FC_ASSERT( nft_meta_obj.is_transferable == true, "NFT is not transferable"); return void_result(); } FC_CAPTURE_AND_RETHROW( (op) ) } diff --git a/libraries/chain/offer_evaluator.cpp b/libraries/chain/offer_evaluator.cpp index ac7f00f5..47b5397f 100644 --- a/libraries/chain/offer_evaluator.cpp +++ b/libraries/chain/offer_evaluator.cpp @@ -34,8 +34,8 @@ namespace graphene { FC_ASSERT(is_owner, "Issuer has no authority to sell the item"); } - const auto& nft_meta_obj = nft_obj.nft_metadata_id(d); - FC_ASSERT( nft_meta_obj.isSellable == true, "NFT is not sellable"); + const auto &nft_meta_obj = nft_obj.nft_metadata_id(d); + FC_ASSERT(nft_meta_obj.is_sellable == true, "NFT is not sellable"); } FC_ASSERT(op.offer_expiration_date > d.head_block_time(), "Expiration should be in future"); FC_ASSERT(op.fee.amount >= 0, "Invalid fee"); @@ -160,7 +160,7 @@ namespace graphene database &d = db(); const auto &offer = op.offer_id(d); - if(offer.buying_item) + if (offer.buying_item) { // Refund the max price to issuer d.adjust_balance(offer.issuer, offer.maximum_price); @@ -243,9 +243,10 @@ namespace graphene const auto &rev_partner = *nft_meta_obj.revenue_partner; const auto &rev_split = *nft_meta_obj.revenue_split; int64_t item_fee = static_cast((rev_split * (*offer.bid_price).amount.value) / offer.item_ids.size()); - const auto& fee_asset = asset(item_fee, (*offer.bid_price).asset_id); + const auto &fee_asset = asset(item_fee, (*offer.bid_price).asset_id); auto ret_val = fee_map.insert({rev_partner, fee_asset}); - if ( ret_val.second == false ) { + if (ret_val.second == false) + { fee_map[rev_partner] += fee_asset; } tot_fees += item_fee; diff --git a/libraries/wallet/include/graphene/wallet/wallet.hpp b/libraries/wallet/include/graphene/wallet/wallet.hpp index 8929a36f..100b71e1 100644 --- a/libraries/wallet/include/graphene/wallet/wallet.hpp +++ b/libraries/wallet/include/graphene/wallet/wallet.hpp @@ -1937,8 +1937,8 @@ class wallet_api * @param base_uri Base URI for token URI * @param revenue_partner revenue partner for this type of Token * @param revenue_split revenue split for the sale - * @param isTransferable can transfer the NFT or not - * @param isSellable can sell NFT or not + * @param is_transferable can transfer the NFT or not + * @param is_sellable can sell NFT or not * @param broadcast true to broadcast transaction to the network * @return Signed transaction transfering the funds */ @@ -1948,8 +1948,8 @@ class wallet_api string base_uri, optional revenue_partner, optional revenue_split, - bool isTransferable, - bool isSellable, + bool is_transferable, + bool is_sellable, bool broadcast); /** @@ -1960,8 +1960,8 @@ class wallet_api * @param base_uri Base URI for token URI * @param revenue_partner revenue partner for this type of Token * @param revenue_split revenue split for the sale - * @param isTransferable can transfer the NFT or not - * @param isSellable can sell NFT or not + * @param is_transferable can transfer the NFT or not + * @param is_sellable can sell NFT or not * @param broadcast true to broadcast transaction to the network * @return Signed transaction transfering the funds */ @@ -1971,8 +1971,8 @@ class wallet_api string base_uri, optional revenue_partner, optional revenue_split, - optional isTransferable, - optional isSellable, + optional is_transferable, + optional is_sellable, bool broadcast); /** diff --git a/libraries/wallet/wallet.cpp b/libraries/wallet/wallet.cpp index 517a3e70..e35b2a4e 100644 --- a/libraries/wallet/wallet.cpp +++ b/libraries/wallet/wallet.cpp @@ -6373,8 +6373,8 @@ signed_transaction wallet_api::nft_metadata_create(string owner_account_id_or_na string base_uri, optional revenue_partner, optional revenue_split, - bool isTransferable, - bool isSellable, + bool is_transferable, + bool is_sellable, bool broadcast) { account_object owner_account = my->get_account(owner_account_id_or_name); @@ -6395,8 +6395,8 @@ signed_transaction wallet_api::nft_metadata_create(string owner_account_id_or_na } op.revenue_split = rev_split; } - op.isTransferable = isTransferable; - op.isSellable = isSellable; + op.is_transferable = is_transferable; + op.is_sellable = is_sellable; signed_transaction trx; trx.operations.push_back(op); @@ -6412,8 +6412,8 @@ signed_transaction wallet_api::nft_metadata_update(string owner_account_id_or_na string base_uri, optional revenue_partner, optional revenue_split, - optional isTransferable, - optional isSellable, + optional is_transferable, + optional is_sellable, bool broadcast) { account_object owner_account = my->get_account(owner_account_id_or_name); @@ -6434,8 +6434,8 @@ signed_transaction wallet_api::nft_metadata_update(string owner_account_id_or_na } op.revenue_split = rev_split; } - op.isTransferable = isTransferable; - op.isSellable = isSellable; + op.is_transferable = is_transferable; + op.is_sellable = is_sellable; signed_transaction trx; trx.operations.push_back(op); diff --git a/tests/tests/nft_tests.cpp b/tests/tests/nft_tests.cpp index 8e8eef41..8cd5abed 100644 --- a/tests/tests/nft_tests.cpp +++ b/tests/tests/nft_tests.cpp @@ -30,7 +30,7 @@ BOOST_AUTO_TEST_CASE( nft_metadata_create_test ) { op.symbol = "NFT"; op.base_uri = "http://nft.example.com"; op.name = "123"; - op.isTransferable = true; + op.is_transferable = true; BOOST_CHECK_THROW(op.validate(), fc::exception); op.name = ""; BOOST_CHECK_THROW(op.validate(), fc::exception);