* private-key option update * ppy marketplace 1 - add evaluators and objects * NFT object and basic operations * ci: update .gitlab-ci.yml * ci: update .gitlab-ci.yml * NFT evaluators and basic tests, no evaluator checks * Evaluator checks in place * ppy marketplace 2 - batch sale, offer_object escrow * Database API * Wallet API * NFT metadata implemented * Fix NFT tests * Database API for NFT metadata and enumerables * ppy marketplace 4 - Add tests NFT+Marketplace * ppy marketplace 5 - Add revenue split * ppy marketplace 6 - Remove unnecessary files * ppy marketplace 7 - Add db, wallet changes and some NFT fixes * ppy marketplace 8 - Add pagination for list APIs * ci: update .gitlab-ci.yml * New DB API, list all NFTs, list NFTs by owner * Marketplace + NFT + RBAC (#368) * rbac1 - evaluators and op validators added * rbac2 - op_type hf checks * rbac3 - tx auth verify changes * Update .gitlab-ci.yml * rbac4 - basic op tests * rbac5 - clear expired and deleted permission linked auths * rbac6 - more tests * rbac7 - more tests * rbac8 - more tests * rbac9 - wallet and db api changes * rbac10 - db api changes for required signature fetch * rbac11 - add db_api tests * rbac12 - add missing code for key auths Co-authored-by: Roshan Syed <roshan.syed.rs@gmail.com> Co-authored-by: sierra19XX <15652887+sierra19XX@users.noreply.github.com> * Fix nft_get_token_uri returning empty string * Fix nft_mint_evaluator to save token_uri * Fix cli_wallet to properly pass metadata id for nft_create * ppy marketplace 9 - FC_REFLECT offer create op * Add stricter checks to NFTs * GPOS2 HF - Handle rolling period on missing blocks (#369) * Mainnet chain halt 5050 Issue (#370) * Unlisting offers, add result in offer history object * Reverting genesis.json wrong commit * Add non-transferable non-sellable properties to NFTs * Review comments - change variable names, use scoped enums * nft_metadata_update changes * NFT HF checks and op fee addition changes * NFT make revenue_split integer from double * revenue_split condition check allow zero or above * Peerplays Marketplace + NFT (#367) * ppy marketplace 1 - add evaluators and objects * NFT object and basic operations * ci: update .gitlab-ci.yml * ci: update .gitlab-ci.yml * NFT evaluators and basic tests, no evaluator checks * Evaluator checks in place * ppy marketplace 2 - batch sale, offer_object escrow * Database API * Wallet API * NFT metadata implemented * Fix NFT tests * Database API for NFT metadata and enumerables * ppy marketplace 4 - Add tests NFT+Marketplace * ppy marketplace 5 - Add revenue split * ppy marketplace 6 - Remove unnecessary files * ppy marketplace 7 - Add db, wallet changes and some NFT fixes * ppy marketplace 8 - Add pagination for list APIs * New DB API, list all NFTs, list NFTs by owner * Marketplace + NFT + RBAC (#368) * rbac1 - evaluators and op validators added * rbac2 - op_type hf checks * rbac3 - tx auth verify changes * Update .gitlab-ci.yml * rbac4 - basic op tests * rbac5 - clear expired and deleted permission linked auths * rbac6 - more tests * rbac7 - more tests * rbac8 - more tests * rbac9 - wallet and db api changes * rbac10 - db api changes for required signature fetch * rbac11 - add db_api tests * rbac12 - add missing code for key auths Co-authored-by: Roshan Syed <roshan.syed.rs@gmail.com> Co-authored-by: sierra19XX <15652887+sierra19XX@users.noreply.github.com> * Fix nft_get_token_uri returning empty string * Fix nft_mint_evaluator to save token_uri * Fix cli_wallet to properly pass metadata id for nft_create * ppy marketplace 9 - FC_REFLECT offer create op * Add stricter checks to NFTs * Unlisting offers, add result in offer history object * Reverting genesis.json wrong commit * Add non-transferable non-sellable properties to NFTs * Review comments - change variable names, use scoped enums * nft_metadata_update changes * NFT HF checks and op fee addition changes * NFT make revenue_split integer from double * revenue_split condition check allow zero or above Co-authored-by: Srdjan Obucina <obucinac@gmail.com> Co-authored-by: Roshan Syed <roshan.syed.rs@gmail.com> Co-authored-by: obucina <11353193+obucina@users.noreply.github.com> * Beatrice NFT HF Co-authored-by: pbattu123 <43043205+pbattu123@users.noreply.github.com> Co-authored-by: pbattu123 <p.battu@pbsa.info> Co-authored-by: Srdjan Obucina <obucinac@gmail.com> Co-authored-by: Roshan Syed <roshan.syed.rs@gmail.com> Co-authored-by: obucina <11353193+obucina@users.noreply.github.com>
143 lines
4.4 KiB
C++
143 lines
4.4 KiB
C++
#pragma once
|
|
#include <graphene/chain/protocol/base.hpp>
|
|
#include <graphene/chain/protocol/memo.hpp>
|
|
|
|
namespace graphene
|
|
{
|
|
namespace chain
|
|
{
|
|
|
|
/*
|
|
* @class offer_operation
|
|
* @brief To place an offer to buy or sell an item, a user broadcasts a
|
|
* proposed transaction
|
|
* @ingroup operations
|
|
* operation
|
|
*/
|
|
struct offer_operation : public base_operation
|
|
{
|
|
struct fee_parameters_type
|
|
{
|
|
uint64_t fee = GRAPHENE_BLOCKCHAIN_PRECISION;
|
|
uint32_t price_per_kbyte = GRAPHENE_BLOCKCHAIN_PRECISION; /// only required for large memos.
|
|
};
|
|
asset fee;
|
|
set<nft_id_type> item_ids;
|
|
// /**
|
|
// * minimum_price.asset_id == maximum_price.asset_id.
|
|
// * to set fixed price without auction minimum_price == maximum_price
|
|
// * If buying_item is true, and minimum_price != maximum_price, the user is
|
|
// proposing a “reverse auction”
|
|
// * where bidders can offer to sell the item for progressively lower prices.
|
|
// * In this case, minimum_price functions as the sell-it-now price for the
|
|
// reverse auction
|
|
// */
|
|
account_id_type issuer;
|
|
/// minimum_price is minimum bid price. 0 if no minimum_price required
|
|
asset minimum_price;
|
|
/// buy_it_now price. 0 if no maximum price
|
|
asset maximum_price;
|
|
/// true means user wants to buy item, false mean user is selling item
|
|
bool buying_item;
|
|
/// not transaction expiration date
|
|
fc::time_point_sec offer_expiration_date;
|
|
|
|
/// User provided data encrypted to the memo key of the "to" account
|
|
optional<memo_data> memo;
|
|
extensions_type extensions;
|
|
|
|
account_id_type fee_payer() const { return issuer; }
|
|
void validate() const;
|
|
share_type calculate_fee(const fee_parameters_type &k) const;
|
|
};
|
|
|
|
struct bid_operation : public base_operation
|
|
{
|
|
struct fee_parameters_type
|
|
{
|
|
uint64_t fee = GRAPHENE_BLOCKCHAIN_PRECISION;
|
|
};
|
|
|
|
asset fee;
|
|
account_id_type bidder;
|
|
|
|
asset bid_price;
|
|
offer_id_type offer_id;
|
|
|
|
extensions_type extensions;
|
|
|
|
account_id_type fee_payer() const { return bidder; }
|
|
void validate() const;
|
|
share_type calculate_fee(const fee_parameters_type &k) const;
|
|
};
|
|
|
|
struct cancel_offer_operation : public base_operation
|
|
{
|
|
struct fee_parameters_type
|
|
{
|
|
uint64_t fee = GRAPHENE_BLOCKCHAIN_PRECISION;
|
|
};
|
|
|
|
asset fee;
|
|
|
|
account_id_type issuer;
|
|
offer_id_type offer_id;
|
|
|
|
extensions_type extensions;
|
|
|
|
account_id_type fee_payer() const { return issuer; }
|
|
void validate() const;
|
|
share_type calculate_fee(const fee_parameters_type &k) const;
|
|
};
|
|
|
|
enum class result_type
|
|
{
|
|
Expired = 0,
|
|
ExpiredNoBid = 1,
|
|
Cancelled = 2
|
|
};
|
|
|
|
struct finalize_offer_operation : public base_operation
|
|
{
|
|
struct fee_parameters_type
|
|
{
|
|
uint64_t fee = 0;
|
|
};
|
|
|
|
asset fee;
|
|
account_id_type fee_paying_account;
|
|
|
|
offer_id_type offer_id;
|
|
|
|
result_type result;
|
|
|
|
extensions_type extensions;
|
|
|
|
account_id_type fee_payer() const { return fee_paying_account; }
|
|
void validate() const;
|
|
share_type calculate_fee(const fee_parameters_type &k) const;
|
|
};
|
|
|
|
} // namespace chain
|
|
} // namespace graphene
|
|
|
|
FC_REFLECT(graphene::chain::offer_operation::fee_parameters_type,
|
|
(fee)(price_per_kbyte));
|
|
FC_REFLECT(graphene::chain::offer_operation,
|
|
(fee)(item_ids)(issuer)(minimum_price)(maximum_price)(buying_item)(offer_expiration_date)(memo)(extensions));
|
|
|
|
FC_REFLECT(graphene::chain::bid_operation::fee_parameters_type,
|
|
(fee));
|
|
FC_REFLECT(graphene::chain::bid_operation,
|
|
(fee)(bidder)(bid_price)(offer_id)(extensions));
|
|
|
|
FC_REFLECT(graphene::chain::cancel_offer_operation::fee_parameters_type,
|
|
(fee));
|
|
FC_REFLECT(graphene::chain::cancel_offer_operation,
|
|
(fee)(issuer)(offer_id)(extensions));
|
|
|
|
FC_REFLECT_ENUM(graphene::chain::result_type, (Expired)(ExpiredNoBid)(Cancelled));
|
|
FC_REFLECT(graphene::chain::finalize_offer_operation::fee_parameters_type,
|
|
(fee));
|
|
FC_REFLECT(graphene::chain::finalize_offer_operation,
|
|
(fee)(fee_paying_account)(offer_id)(result)(extensions));
|