refactor: Change supply return type from f64 to i32
On the request of some aggregator that allegedly wanted the number in total number of coins, not in the atomic units.
This commit is contained in:
parent
349f0705d3
commit
ec6d99e9d0
@ -10,11 +10,11 @@ use crate::http_util::rpc_method_err;
|
|||||||
use crate::model::app_state::AppState;
|
use crate::model::app_state::AppState;
|
||||||
use crate::shared::monetary_supplies;
|
use crate::shared::monetary_supplies;
|
||||||
|
|
||||||
/// Return the monetary amount that is liquid, assuming all redemptions on the
|
/// Return the current monetary amount that is liquid, assuming all redemptions
|
||||||
/// old chain have successfully been made. Returned unit is nau, Neptune Atomic
|
/// on the old chain have successfully been made. Returned unit is in number of
|
||||||
/// Units. To convert to number of coins, divide by $4*10^{30}$.
|
/// coins. To convert to number of nau, multiply by $4*10^{30}$/
|
||||||
#[axum::debug_handler]
|
#[axum::debug_handler]
|
||||||
pub async fn circulating_supply(State(state): State<Arc<AppState>>) -> Result<Json<f64>, Response> {
|
pub async fn circulating_supply(State(state): State<Arc<AppState>>) -> Result<Json<i32>, Response> {
|
||||||
let s = state.load();
|
let s = state.load();
|
||||||
|
|
||||||
let block_height = s
|
let block_height = s
|
||||||
@ -26,5 +26,5 @@ pub async fn circulating_supply(State(state): State<Arc<AppState>>) -> Result<Js
|
|||||||
|
|
||||||
let (liquid_supply, _) = monetary_supplies(block_height);
|
let (liquid_supply, _) = monetary_supplies(block_height);
|
||||||
|
|
||||||
Ok(Json(liquid_supply.to_nau_f64()))
|
Ok(Json(liquid_supply.ceil_num_whole_coins()))
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,12 +10,12 @@ use crate::http_util::rpc_method_err;
|
|||||||
use crate::model::app_state::AppState;
|
use crate::model::app_state::AppState;
|
||||||
use crate::shared::monetary_supplies;
|
use crate::shared::monetary_supplies;
|
||||||
|
|
||||||
/// Return the total monetary supply, the sum of the timeloced and liquid
|
/// Return the current total monetary supply, the sum of the timeloced and
|
||||||
/// supply. Assumes all redemptions on the old chain have successfully been
|
/// liquid supply. Assumes all redemptions on the old chain have successfully
|
||||||
/// made. Returned unit is nau, Neptune Atomic Units. To convert to number of
|
/// been made. Returned unit is in number of coins. To convert to number of
|
||||||
/// coins, divide by $4*10^{30}$.
|
/// nau, multiply by $4*10^{30}$.
|
||||||
#[axum::debug_handler]
|
#[axum::debug_handler]
|
||||||
pub async fn total_supply(State(state): State<Arc<AppState>>) -> Result<Json<f64>, Response> {
|
pub async fn total_supply(State(state): State<Arc<AppState>>) -> Result<Json<i32>, Response> {
|
||||||
let s = state.load();
|
let s = state.load();
|
||||||
|
|
||||||
let block_height = s
|
let block_height = s
|
||||||
@ -27,5 +27,5 @@ pub async fn total_supply(State(state): State<Arc<AppState>>) -> Result<Json<f64
|
|||||||
|
|
||||||
let (_, total_supply) = monetary_supplies(block_height);
|
let (_, total_supply) = monetary_supplies(block_height);
|
||||||
|
|
||||||
Ok(Json(total_supply.to_nau_f64()))
|
Ok(Json(total_supply.ceil_num_whole_coins()))
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user