add token reservation
This commit is contained in:
parent
bf67aecc88
commit
0d7fa7e2a8
4 changed files with 27 additions and 4 deletions
|
|
@ -42,8 +42,7 @@ void_result asset_create_evaluator::do_evaluate( const asset_create_operation& o
|
||||||
|
|
||||||
database& d = db();
|
database& d = db();
|
||||||
|
|
||||||
if (d.head_block_time() < HARDFORK_SON_TIME)
|
FC_ASSERT(d.is_asset_creation_allowed(op.symbol), "Asset creation not allowed at current time");
|
||||||
FC_ASSERT(op.symbol != "BTC", "BTC asset creation before SON hardfork");
|
|
||||||
|
|
||||||
const auto& chain_parameters = d.get_global_properties().parameters;
|
const auto& chain_parameters = d.get_global_properties().parameters;
|
||||||
FC_ASSERT( op.common_options.whitelist_authorities.size() <= chain_parameters.maximum_asset_whitelist_authorities );
|
FC_ASSERT( op.common_options.whitelist_authorities.size() <= chain_parameters.maximum_asset_whitelist_authorities );
|
||||||
|
|
@ -191,6 +190,8 @@ void_result lottery_asset_create_evaluator::do_evaluate( const lottery_asset_cre
|
||||||
|
|
||||||
database& d = db();
|
database& d = db();
|
||||||
|
|
||||||
|
FC_ASSERT(d.is_asset_creation_allowed(op.symbol), "Lottery asset creation not allowed at current time");
|
||||||
|
|
||||||
const auto& chain_parameters = d.get_global_properties().parameters;
|
const auto& chain_parameters = d.get_global_properties().parameters;
|
||||||
FC_ASSERT( op.common_options.whitelist_authorities.size() <= chain_parameters.maximum_asset_whitelist_authorities );
|
FC_ASSERT( op.common_options.whitelist_authorities.size() <= chain_parameters.maximum_asset_whitelist_authorities );
|
||||||
FC_ASSERT( op.common_options.blacklist_authorities.size() <= chain_parameters.maximum_asset_whitelist_authorities );
|
FC_ASSERT( op.common_options.blacklist_authorities.size() <= chain_parameters.maximum_asset_whitelist_authorities );
|
||||||
|
|
|
||||||
|
|
@ -315,6 +315,27 @@ bool database::is_son_active( son_id_type son_id )
|
||||||
return (it_son != active_son_ids.end());
|
return (it_son != active_son_ids.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool database::is_asset_creation_allowed(const string &symbol)
|
||||||
|
{
|
||||||
|
time_point_sec now = head_block_time();
|
||||||
|
std::unordered_set<std::string> post_son_hf_symbols = {"ETH", "USDT", "BNB", "ADA", "DOGE", "XRP", "USDC", "DOT", "UNI", "BUSD", "BCH", "LTC", "SOL", "LINK", "MATIC", "THETA",
|
||||||
|
"WBTC", "XLM", "ICP", "DAI", "VET", "ETC", "TRX", "FIL", "XMR", "EGR", "EOS", "SHIB", "AAVE", "CRO", "ALGO", "AMP", "BTCB",
|
||||||
|
"BSV", "KLAY", "CAKE", "FTT", "LEO", "XTZ", "TFUEL", "MIOTA", "LUNA", "NEO", "ATOM", "MKR", "FEI", "WBNB", "UST", "AVAX",
|
||||||
|
"STEEM", "HIVE", "HBD", "SBD", "BTS"};
|
||||||
|
if (symbol == "BTC")
|
||||||
|
{
|
||||||
|
if (now < HARDFORK_SON_TIME)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (post_son_hf_symbols.find(symbol) != post_son_hf_symbols.end())
|
||||||
|
{
|
||||||
|
if (now >= HARDFORK_SON_TIME)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
vector<uint64_t> database::get_random_numbers(uint64_t minimum, uint64_t maximum, uint64_t selections, bool duplicates)
|
vector<uint64_t> database::get_random_numbers(uint64_t minimum, uint64_t maximum, uint64_t selections, bool duplicates)
|
||||||
{
|
{
|
||||||
FC_ASSERT( selections <= 100000 );
|
FC_ASSERT( selections <= 100000 );
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// SON2 HARDFORK Friday, June 11, 2021 00:00:00 GMT
|
// SON2 HARDFORK Thursday, 22 July 2021 09:00:00 GMT
|
||||||
#ifndef HARDFORK_SON2_TIME
|
#ifndef HARDFORK_SON2_TIME
|
||||||
#define HARDFORK_SON2_TIME (fc::time_point_sec( 1623369600 ))
|
#define HARDFORK_SON2_TIME (fc::time_point_sec( 1626944400 ))
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -312,6 +312,7 @@ namespace graphene { namespace chain {
|
||||||
signed_transaction create_signed_transaction( const fc::ecc::private_key& signing_private_key, const operation& op );
|
signed_transaction create_signed_transaction( const fc::ecc::private_key& signing_private_key, const operation& op );
|
||||||
bool is_son_dereg_valid( son_id_type son_id );
|
bool is_son_dereg_valid( son_id_type son_id );
|
||||||
bool is_son_active( son_id_type son_id );
|
bool is_son_active( son_id_type son_id );
|
||||||
|
bool is_asset_creation_allowed(const string& symbol);
|
||||||
|
|
||||||
time_point_sec head_block_time()const;
|
time_point_sec head_block_time()const;
|
||||||
uint32_t head_block_num()const;
|
uint32_t head_block_num()const;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue