fixed circulating supply calculation; more rebranding; bumped version number to v0.3.0
This commit is contained in:
@@ -3006,20 +3006,44 @@ namespace cryptonote
|
||||
return true;
|
||||
}
|
||||
// Iterate over the cache, supplying the data in a more accessible format
|
||||
res.total_burnt = res.total_staked = res.total_yield = res.yield_per_stake = 0;
|
||||
res.yield_data.clear();
|
||||
for (const auto& entry: ybi_cache) {
|
||||
// Skip this entry if out-of=range
|
||||
|
||||
// Check for last entry
|
||||
if (entry.first == height - 1) {
|
||||
res.total_staked = entry.second.locked_coins_tally;
|
||||
if (entry.second.locked_coins_tally > 0) {
|
||||
boost::multiprecision::uint128_t yield_per_stake = entry.second.slippage_total_this_block;
|
||||
yield_per_stake *= COIN;
|
||||
yield_per_stake /= entry.second.locked_coins_tally;
|
||||
res.yield_per_stake = yield_per_stake.convert_to<uint64_t>();
|
||||
}
|
||||
}
|
||||
|
||||
// Skip this entry if out-of-range
|
||||
if (req.from_height > 0 and entry.first < req.from_height) continue;
|
||||
if (req.to_height > 0 and entry.first > req.to_height) continue;
|
||||
|
||||
// Clone the data into the response
|
||||
COMMAND_RPC_GET_YIELD_INFO::yield_data_t yd;
|
||||
yd.block_height = entry.second.block_height;
|
||||
yd.slippage_total_this_block = entry.second.slippage_total_this_block;
|
||||
yd.locked_coins_this_block = entry.second.locked_coins_this_block;
|
||||
yd.locked_coins_tally = entry.second.locked_coins_tally;
|
||||
yd.network_health_percentage = entry.second.network_health_percentage;
|
||||
res.yield_data.push_back(yd);
|
||||
// Do we need to include raw data?
|
||||
if (req.include_raw_data) {
|
||||
|
||||
// Clone the data into the response
|
||||
COMMAND_RPC_GET_YIELD_INFO::yield_data_t yd;
|
||||
yd.block_height = entry.second.block_height;
|
||||
yd.slippage_total_this_block = entry.second.slippage_total_this_block;
|
||||
yd.locked_coins_this_block = entry.second.locked_coins_this_block;
|
||||
yd.locked_coins_tally = entry.second.locked_coins_tally;
|
||||
yd.network_health_percentage = entry.second.network_health_percentage;
|
||||
res.yield_data.push_back(yd);
|
||||
}
|
||||
|
||||
// Perform the aggregation
|
||||
if (entry.second.locked_coins_tally == 0) {
|
||||
res.total_burnt += entry.second.slippage_total_this_block;
|
||||
} else {
|
||||
res.total_yield += entry.second.slippage_total_this_block;
|
||||
}
|
||||
}
|
||||
res.status = CORE_RPC_STATUS_OK;
|
||||
return true;
|
||||
|
||||
@@ -1294,10 +1294,12 @@ namespace cryptonote
|
||||
|
||||
struct request_t
|
||||
{
|
||||
bool include_raw_data;
|
||||
uint64_t from_height;
|
||||
uint64_t to_height;
|
||||
|
||||
BEGIN_KV_SERIALIZE_MAP()
|
||||
KV_SERIALIZE_OPT(include_raw_data, false)
|
||||
KV_SERIALIZE_OPT(from_height, (uint64_t)0)
|
||||
KV_SERIALIZE_OPT(to_height, (uint64_t)0)
|
||||
END_KV_SERIALIZE_MAP()
|
||||
@@ -1308,9 +1310,17 @@ namespace cryptonote
|
||||
struct response_t
|
||||
{
|
||||
std::string status;
|
||||
uint64_t total_burnt;
|
||||
uint64_t total_staked;
|
||||
uint64_t total_yield;
|
||||
uint64_t yield_per_stake;
|
||||
std::vector<COMMAND_RPC_GET_YIELD_INFO::yield_data_t> yield_data;
|
||||
BEGIN_KV_SERIALIZE_MAP()
|
||||
KV_SERIALIZE(status)
|
||||
KV_SERIALIZE(total_burnt)
|
||||
KV_SERIALIZE(total_staked)
|
||||
KV_SERIALIZE(total_yield)
|
||||
KV_SERIALIZE(yield_per_stake)
|
||||
KV_SERIALIZE(yield_data)
|
||||
END_KV_SERIALIZE_MAP()
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user