global: snapshot

This commit is contained in:
nym21
2026-03-09 15:38:23 +01:00
parent cc51cc81f9
commit 961dea6934
16 changed files with 51 additions and 65 deletions

View File

@@ -14,30 +14,27 @@ impl Vecs {
activity: &activity::Vecs,
exit: &Exit,
) -> Result<()> {
self.cointime_adj_inflation_rate
.bps
.height
.compute_transform2(
starting_indexes.height,
&activity.liveliness.height,
&supply.inflation_rate.bps.height,
|(h, liveliness, inflation, ..)| {
(
h,
BasisPointsSigned32::from(f64::from(liveliness) * f64::from(inflation)),
)
},
exit,
)?;
self.adj_inflation_rate.bps.height.compute_transform2(
starting_indexes.height,
&activity.liveliness.height,
&supply.inflation_rate.bps.height,
|(h, liveliness, inflation, ..)| {
(
h,
BasisPointsSigned32::from(f64::from(liveliness) * f64::from(inflation)),
)
},
exit,
)?;
self.cointime_adj_tx_velocity_btc.height.compute_multiply(
self.adj_tx_velocity_btc.height.compute_multiply(
starting_indexes.height,
&activity.activity_to_vaultedness_ratio.height,
&supply.velocity.btc.height,
exit,
)?;
self.cointime_adj_tx_velocity_usd.height.compute_multiply(
self.adj_tx_velocity_usd.height.compute_multiply(
starting_indexes.height,
&activity.activity_to_vaultedness_ratio.height,
&supply.velocity.usd.height,

View File

@@ -15,19 +15,19 @@ impl Vecs {
indexes: &indexes::Vecs,
) -> Result<Self> {
Ok(Self {
cointime_adj_inflation_rate: PercentPerBlock::forced_import(
adj_inflation_rate: PercentPerBlock::forced_import(
db,
"cointime_adj_inflation_rate",
version,
indexes,
)?,
cointime_adj_tx_velocity_btc: ComputedPerBlock::forced_import(
adj_tx_velocity_btc: ComputedPerBlock::forced_import(
db,
"cointime_adj_tx_velocity_btc",
version,
indexes,
)?,
cointime_adj_tx_velocity_usd: ComputedPerBlock::forced_import(
adj_tx_velocity_usd: ComputedPerBlock::forced_import(
db,
"cointime_adj_tx_velocity_usd",
version,

View File

@@ -6,7 +6,7 @@ use crate::internal::{ComputedPerBlock, PercentPerBlock};
#[derive(Traversable)]
pub struct Vecs<M: StorageMode = Rw> {
pub cointime_adj_inflation_rate: PercentPerBlock<BasisPointsSigned32, M>,
pub cointime_adj_tx_velocity_btc: ComputedPerBlock<StoredF64, M>,
pub cointime_adj_tx_velocity_usd: ComputedPerBlock<StoredF64, M>,
pub adj_inflation_rate: PercentPerBlock<BasisPointsSigned32, M>,
pub adj_tx_velocity_btc: ComputedPerBlock<StoredF64, M>,
pub adj_tx_velocity_usd: ComputedPerBlock<StoredF64, M>,
}

View File

@@ -52,7 +52,7 @@ impl Vecs {
// cointime_cap = (cointime_value_destroyed_cumulative * circulating_supply) / coinblocks_stored_cumulative
self.cointime_cap.cents.height.compute_transform3(
starting_indexes.height,
&value.cointime_value_destroyed.cumulative.height,
&value.value_destroyed.cumulative.height,
circulating_supply,
&activity.coinblocks_stored.cumulative.height,
|(i, destroyed, supply, stored, ..)| {

View File

@@ -23,11 +23,8 @@ impl Vecs {
let coindays_destroyed = &all_metrics.activity.coindays_destroyed;
let circulating_supply = &all_metrics.supply.total.btc.height;
self.cointime_value_destroyed.compute(
starting_indexes.height,
&window_starts,
exit,
|vec| {
self.value_destroyed
.compute(starting_indexes.height, &window_starts, exit, |vec| {
vec.compute_multiply(
starting_indexes.height,
&prices.price.usd.height,
@@ -35,14 +32,10 @@ impl Vecs {
exit,
)?;
Ok(())
},
)?;
})?;
self.cointime_value_created.compute(
starting_indexes.height,
&window_starts,
exit,
|vec| {
self.value_created
.compute(starting_indexes.height, &window_starts, exit, |vec| {
vec.compute_multiply(
starting_indexes.height,
&prices.price.usd.height,
@@ -50,14 +43,10 @@ impl Vecs {
exit,
)?;
Ok(())
},
)?;
})?;
self.cointime_value_stored.compute(
starting_indexes.height,
&window_starts,
exit,
|vec| {
self.value_stored
.compute(starting_indexes.height, &window_starts, exit, |vec| {
vec.compute_multiply(
starting_indexes.height,
&prices.price.usd.height,
@@ -65,8 +54,7 @@ impl Vecs {
exit,
)?;
Ok(())
},
)?;
})?;
// VOCDD: Value of Coin Days Destroyed = price × (CDD / circulating_supply)
// Supply-adjusted to account for growing supply over time

View File

@@ -12,19 +12,19 @@ impl Vecs {
indexes: &indexes::Vecs,
) -> Result<Self> {
Ok(Self {
cointime_value_destroyed: ComputedPerBlockCumulativeSum::forced_import(
value_destroyed: ComputedPerBlockCumulativeSum::forced_import(
db,
"cointime_value_destroyed",
version,
indexes,
)?,
cointime_value_created: ComputedPerBlockCumulativeSum::forced_import(
value_created: ComputedPerBlockCumulativeSum::forced_import(
db,
"cointime_value_created",
version,
indexes,
)?,
cointime_value_stored: ComputedPerBlockCumulativeSum::forced_import(
value_stored: ComputedPerBlockCumulativeSum::forced_import(
db,
"cointime_value_stored",
version,

View File

@@ -6,8 +6,8 @@ use crate::internal::ComputedPerBlockCumulativeSum;
#[derive(Traversable)]
pub struct Vecs<M: StorageMode = Rw> {
pub cointime_value_destroyed: ComputedPerBlockCumulativeSum<StoredF64, M>,
pub cointime_value_created: ComputedPerBlockCumulativeSum<StoredF64, M>,
pub cointime_value_stored: ComputedPerBlockCumulativeSum<StoredF64, M>,
pub value_destroyed: ComputedPerBlockCumulativeSum<StoredF64, M>,
pub value_created: ComputedPerBlockCumulativeSum<StoredF64, M>,
pub value_stored: ComputedPerBlockCumulativeSum<StoredF64, M>,
pub vocdd: ComputedPerBlockCumulativeSum<StoredF64, M>,
}