1
0
Fork 0
forked from lthn/blockchain

inital code for submiting asset descriptor

This commit is contained in:
cryptozoidberg 2022-09-26 21:57:24 +02:00
parent 213cb4f85c
commit 43c0c7944d
No known key found for this signature in database
GPG key ID: 22DEB97A54C6FDEC
3 changed files with 63 additions and 3 deletions

View file

@ -703,10 +703,48 @@ namespace currency
FIELD(ticker)
FIELD(full_name)
FIELD(owner)
END_SERIALIZE()
END_SERIALIZE()
BEGIN_BOOST_SERIALIZATION()
BOOST_SERIALIZE(total_max_supply)
BOOST_SERIALIZE(current_supply)
BOOST_SERIALIZE(decimal_point)
BOOST_SERIALIZE(ticker)
BOOST_SERIALIZE(full_name)
BOOST_SERIALIZE(owner)
END_BOOST_SERIALIZATION()
};
#define ASSET_DESCRIPTOR_OPERATION_UNDEFINED 0
#define ASSET_DESCRIPTOR_OPERATION_REGISTER 1
#define ASSET_DESCRIPTOR_OPERATION_UPDATE 2
struct asset_descriptor_operation
{
uint8_t operation_type = ASSET_DESCRIPTOR_OPERATION_UNDEFINED;
std::vector<crypto::signature> proof;
asset_descriptor_base descriptor;
BEGIN_VERSIONED_SERIALIZE()
FIELD(operation_type)
FIELD(proof)
FIELD(descriptor)
END_SERIALIZE()
BEGIN_BOOST_SERIALIZATION()
BOOST_SERIALIZE(operation_type)
BOOST_SERIALIZE(proof)
BOOST_SERIALIZE(descriptor)
END_BOOST_SERIALIZATION()
};
struct extra_padding
{
@ -775,7 +813,7 @@ namespace currency
typedef boost::mpl::vector24<
tx_service_attachment, tx_comment, tx_payer_old, tx_receiver_old, tx_derivation_hint, std::string, tx_crypto_checksum, etc_tx_time, etc_tx_details_unlock_time, etc_tx_details_expiration_time,
etc_tx_details_flags, crypto::public_key, extra_attachment_info, extra_alias_entry_old, extra_user_data, extra_padding, etc_tx_flags16_t, etc_tx_details_unlock_time2,
tx_payer, tx_receiver, extra_alias_entry, zarcanum_tx_data_v1, zarcanum_outs_range_proof, zc_balance_proof
tx_payer, tx_receiver, extra_alias_entry, zarcanum_tx_data_v1, zarcanum_outs_range_proof, zc_balance_proof, asset_descriptor_operation
> all_payload_types;
typedef boost::make_variant_over<all_payload_types>::type payload_items_v;
@ -1102,6 +1140,9 @@ SET_VARIANT_TAGS(currency::zc_balance_proof, 46, "zc_balance_proof");
SET_VARIANT_TAGS(currency::open_asset_id, 47, "asset_id");
SET_VARIANT_TAGS(currency::asset_descriptor_operation, 48, "asset_descriptor_base");
#undef SET_VARIANT_TAGS

View file

@ -4121,6 +4121,24 @@ void wallet2::request_alias_registration(currency::extra_alias_entry& ai, curren
destinations.push_back(tx_dest_alias_reward);
transfer(destinations, 0, 0, fee, extra, attachments, get_current_split_strategy(), tx_dust_policy(DEFAULT_DUST_THRESHOLD), res_tx, CURRENCY_TO_KEY_OUT_RELAXED, false);
}
//----------------------------------------------------------------------------------------------------
void wallet2::publish_new_asset(const asset_descriptor_base& asset_info, const std::vector<currency::tx_destination_entry>& destinations)
{
asset_descriptor_operation asset_reg_info = AUTO_VAL_INIT(asset_reg_info);
asset_reg_info.descriptor = asset_info;
asset_reg_info.operation_type = ASSET_DESCRIPTOR_OPERATION_REGISTER;
std::vector<currency::tx_destination_entry> destinations_local = destinations;
std::vector<currency::extra_v> extra;
std::vector<currency::attachment_v> attachments;
extra.push_back(asset_reg_info);
transfer(destinations, 0, 0, fee, extra, attachments, get_current_split_strategy(), tx_dust_policy(DEFAULT_DUST_THRESHOLD), res_tx, CURRENCY_TO_KEY_OUT_RELAXED, false);
}
//----------------------------------------------------------------------------------------------------
void wallet2::request_alias_update(currency::extra_alias_entry& ai, currency::transaction& res_tx, uint64_t fee, uint64_t reward)

View file

@ -551,7 +551,8 @@ namespace tools
void request_alias_registration(currency::extra_alias_entry& ai, currency::transaction& res_tx, uint64_t fee, uint64_t reward, const crypto::secret_key& authority_key = currency::null_skey);
void request_alias_update(currency::extra_alias_entry& ai, currency::transaction& res_tx, uint64_t fee, uint64_t reward);
bool check_available_sources(std::list<uint64_t>& amounts);
void publish_new_asset(const asset_descriptor_base& asset_info, const std::vector<currency::tx_destination_entry>& destinations);
bool set_core_proxy(const std::shared_ptr<i_core_proxy>& proxy);
void set_pos_mint_packing_size(uint64_t new_size);