diff --git a/src/index.rs b/src/index.rs index 99b214b8d9..093404a75a 100644 --- a/src/index.rs +++ b/src/index.rs @@ -48,7 +48,7 @@ mod updater; #[cfg(test)] pub(crate) mod testing; -const SCHEMA_VERSION: u64 = 20; +const SCHEMA_VERSION: u64 = 21; macro_rules! define_table { ($name:ident, $key:ty, $value:ty) => { diff --git a/src/index/entry.rs b/src/index/entry.rs index de0669d31b..33a84dce57 100644 --- a/src/index/entry.rs +++ b/src/index/entry.rs @@ -56,6 +56,7 @@ pub struct RuneEntry { pub mint: Option, pub mints: u64, pub number: u64, + pub premine: u128, pub rune: Rune, pub spacers: u32, pub supply: u128, @@ -92,6 +93,7 @@ pub(super) type RuneEntryValue = ( Option, // mint parameters u64, // mints u64, // number + u128, // premine u128, // rune u32, // spacers u128, // supply @@ -130,6 +132,7 @@ impl Default for RuneEntry { mint: None, mints: 0, number: 0, + premine: 0, rune: Rune(0), spacers: 0, supply: 0, @@ -150,6 +153,7 @@ impl Entry for RuneEntry { mint, mints, number, + premine, rune, spacers, supply, @@ -177,6 +181,7 @@ impl Entry for RuneEntry { }), mints, number, + premine, rune: Rune(rune), spacers, supply, @@ -211,6 +216,7 @@ impl Entry for RuneEntry { ), self.mints, self.number, + self.premine, self.rune.0, self.spacers, self.supply, @@ -524,6 +530,7 @@ mod tests { }), mints: 11, number: 6, + premine: 12, rune: Rune(7), spacers: 8, supply: 9, @@ -541,6 +548,7 @@ mod tests { Some((Some(2), Some(4), Some(5))), 11, 6, + 12, 7, 8, 9, diff --git a/src/index/updater/rune_updater.rs b/src/index/updater/rune_updater.rs index 5fe414ab57..1ced08b1e1 100644 --- a/src/index/updater/rune_updater.rs +++ b/src/index/updater/rune_updater.rs @@ -281,11 +281,16 @@ impl<'a, 'db, 'tx> RuneUpdater<'a, 'db, 'tx> { self.rune_to_id.insert(rune.0, id.store())?; self.transaction_id_to_rune.insert(&txid.store(), rune.0)?; + let number = self.runes; self.runes += 1; + + let premine = u128::MAX - balance; + self .statistic_to_count .insert(&Statistic::Runes.into(), self.runes)?; + self.id_to_entry.insert( id.store(), RuneEntry { @@ -293,11 +298,12 @@ impl<'a, 'db, 'tx> RuneUpdater<'a, 'db, 'tx> { divisibility, etching: txid, mints: 0, - number, mint: mint.and_then(|mint| (!burn).then_some(mint)), + number, + premine, rune, spacers, - supply: u128::MAX - balance, + supply: premine, symbol, timestamp: self.block_time, } diff --git a/src/runes.rs b/src/runes.rs index c198105ec5..d95a6f0903 100644 --- a/src/runes.rs +++ b/src/runes.rs @@ -153,6 +153,7 @@ mod tests { RuneEntry { etching: txid, rune: Rune(RUNE), + premine: u128::MAX, supply: u128::MAX, timestamp: id.block, ..Default::default() @@ -219,6 +220,7 @@ mod tests { RuneEntry { etching: txid, rune: Rune(minimum), + premine: u128::MAX, supply: u128::MAX, timestamp: id.block, ..Default::default() @@ -278,6 +280,7 @@ mod tests { RuneEntry { etching: txid, rune: Rune(RESERVED - 1), + premine: u128::MAX, supply: u128::MAX, timestamp: id.block, ..Default::default() @@ -325,6 +328,7 @@ mod tests { RuneEntry { etching: txid0, rune: Rune(RESERVED), + premine: u128::MAX, supply: u128::MAX, timestamp: 2, ..Default::default() @@ -372,6 +376,7 @@ mod tests { RuneEntry { etching: txid0, rune: Rune(RESERVED), + premine: u128::MAX, supply: u128::MAX, timestamp: 2, ..Default::default() @@ -382,6 +387,7 @@ mod tests { RuneEntry { etching: txid1, rune: Rune(RESERVED + 1), + premine: u128::MAX, supply: u128::MAX, timestamp: 4, number: 1, @@ -438,6 +444,7 @@ mod tests { rune: Rune(RUNE), etching: txid, divisibility: 1, + premine: u128::MAX, supply: u128::MAX, timestamp: id.block, ..Default::default() @@ -480,6 +487,7 @@ mod tests { RuneEntry { etching: txid, rune: Rune(RUNE), + premine: u128::MAX, supply: u128::MAX, timestamp: id.block, ..Default::default() @@ -522,6 +530,7 @@ mod tests { RuneEntry { etching: txid, rune: Rune(RUNE), + premine: u128::MAX, supply: u128::MAX, symbol: None, timestamp: id.block, @@ -560,6 +569,7 @@ mod tests { RuneEntry { etching: txid, rune: Rune(RUNE), + premine: 100, supply: 100, timestamp: id.block, ..Default::default() @@ -603,6 +613,7 @@ mod tests { burned: 100, etching: txid, rune: Rune(RUNE), + premine: 200, supply: 200, timestamp: id.block, ..Default::default() @@ -645,6 +656,7 @@ mod tests { RuneEntry { etching: txid, rune: Rune(RUNE), + premine: 0, supply: 0, timestamp: id.block, ..Default::default() @@ -680,6 +692,7 @@ mod tests { RuneEntry { etching: txid0, rune: Rune(RUNE), + premine: u128::MAX, supply: u128::MAX, timestamp: id.block, ..Default::default() @@ -718,6 +731,7 @@ mod tests { RuneEntry { etching: txid0, rune: Rune(RUNE), + premine: u128::MAX, supply: u128::MAX, timestamp: id.block, ..Default::default() @@ -807,6 +821,7 @@ mod tests { mint: None, mints: 0, number: 0, + premine: 0, rune: Rune(RUNE), spacers: 1, supply: 0, @@ -886,6 +901,7 @@ mod tests { RuneEntry { etching: txid0, rune: Rune(RUNE), + premine: u128::MAX, supply: u128::MAX, timestamp: id.block, ..Default::default() @@ -921,6 +937,7 @@ mod tests { burned: u128::MAX, etching: txid0, rune: Rune(RUNE), + premine: u128::MAX, supply: u128::MAX, timestamp: id.block, ..Default::default() @@ -956,6 +973,7 @@ mod tests { RuneEntry { etching: txid0, rune: Rune(RUNE), + premine: u128::MAX, supply: u128::MAX, timestamp: id.block, ..Default::default() @@ -984,6 +1002,7 @@ mod tests { RuneEntry { etching: txid0, rune: Rune(RUNE), + premine: u128::MAX, supply: u128::MAX, timestamp: id.block, ..Default::default() @@ -1025,6 +1044,7 @@ mod tests { RuneEntry { etching: txid0, rune: Rune(RUNE), + premine: u128::MAX, supply: u128::MAX, timestamp: id.block, ..Default::default() @@ -1054,6 +1074,7 @@ mod tests { RuneEntry { etching: txid0, rune: Rune(RUNE), + premine: u128::MAX, supply: u128::MAX, timestamp: id.block, burned: u128::MAX, @@ -1090,6 +1111,7 @@ mod tests { RuneEntry { etching: txid0, rune: Rune(RUNE), + premine: u128::MAX, supply: u128::MAX, timestamp: id.block, ..Default::default() @@ -1125,6 +1147,7 @@ mod tests { RuneEntry { etching: txid0, rune: Rune(RUNE), + premine: u128::MAX, supply: u128::MAX, timestamp: id.block, ..Default::default() @@ -1166,6 +1189,7 @@ mod tests { RuneEntry { etching: txid0, rune: Rune(RUNE), + premine: u128::MAX, supply: u128::MAX, timestamp: id.block, ..Default::default() @@ -1201,6 +1225,7 @@ mod tests { RuneEntry { etching: txid0, rune: Rune(RUNE), + premine: u128::MAX, supply: u128::MAX, timestamp: id.block, ..Default::default() @@ -1242,6 +1267,7 @@ mod tests { RuneEntry { etching: txid0, rune: Rune(RUNE), + premine: u128::MAX, supply: u128::MAX, timestamp: id.block, ..Default::default() @@ -1277,6 +1303,7 @@ mod tests { RuneEntry { etching: txid0, rune: Rune(RUNE), + premine: u128::MAX, supply: u128::MAX, burned: u128::MAX, timestamp: id.block, @@ -1314,6 +1341,7 @@ mod tests { RuneEntry { etching: txid0, rune: Rune(RUNE), + premine: u128::MAX, supply: u128::MAX, timestamp: id.block, ..Default::default() @@ -1342,6 +1370,7 @@ mod tests { RuneEntry { etching: txid0, rune: Rune(RUNE), + premine: u128::MAX, supply: u128::MAX, timestamp: id.block, ..Default::default() @@ -1383,6 +1412,7 @@ mod tests { RuneEntry { etching: txid, rune: Rune(RUNE), + premine: u128::MAX, supply: u128::MAX, timestamp: id.block, ..Default::default() @@ -1415,6 +1445,7 @@ mod tests { RuneEntry { etching: txid, rune: Rune(RUNE), + premine: u128::MAX, supply: u128::MAX, timestamp: id.block, ..Default::default() @@ -1450,6 +1481,7 @@ mod tests { RuneEntry { etching: txid0, rune: Rune(RUNE), + premine: u128::MAX, supply: u128::MAX, timestamp: id0.block, ..Default::default() @@ -1487,6 +1519,7 @@ mod tests { RuneEntry { etching: txid0, rune: Rune(RUNE), + premine: u128::MAX, supply: u128::MAX, timestamp: id0.block, ..Default::default() @@ -1497,6 +1530,7 @@ mod tests { RuneEntry { etching: txid1, rune: Rune(RUNE + 1), + premine: u128::MAX, supply: u128::MAX, timestamp: id1.block, number: 1, @@ -1539,6 +1573,7 @@ mod tests { RuneEntry { etching: txid0, rune: Rune(RUNE), + premine: u128::MAX, supply: u128::MAX, timestamp: id0.block, ..Default::default() @@ -1549,6 +1584,7 @@ mod tests { RuneEntry { etching: txid1, rune: Rune(RUNE + 1), + premine: u128::MAX, supply: u128::MAX, timestamp: id1.block, number: 1, @@ -1592,6 +1628,7 @@ mod tests { RuneEntry { etching: txid0, rune: Rune(RUNE), + premine: u128::MAX, supply: u128::MAX, timestamp: id0.block, ..Default::default() @@ -1629,6 +1666,7 @@ mod tests { RuneEntry { etching: txid0, rune: Rune(RUNE), + premine: u128::MAX, supply: u128::MAX, timestamp: id0.block, ..Default::default() @@ -1639,6 +1677,7 @@ mod tests { RuneEntry { etching: txid1, rune: Rune(RUNE + 1), + premine: u128::MAX, supply: u128::MAX, timestamp: id1.block, number: 1, @@ -1681,6 +1720,7 @@ mod tests { RuneEntry { etching: txid0, rune: Rune(RUNE), + premine: u128::MAX, supply: u128::MAX, timestamp: id0.block, ..Default::default() @@ -1691,6 +1731,7 @@ mod tests { RuneEntry { etching: txid1, rune: Rune(RUNE + 1), + premine: u128::MAX, supply: u128::MAX, timestamp: id1.block, number: 1, @@ -1740,6 +1781,7 @@ mod tests { RuneEntry { etching: txid0, rune: Rune(RUNE), + premine: u128::MAX, supply: u128::MAX, timestamp: id0.block, ..Default::default() @@ -1750,6 +1792,7 @@ mod tests { RuneEntry { etching: txid1, rune: Rune(RUNE + 1), + premine: u128::MAX, supply: u128::MAX, timestamp: id1.block, number: 1, @@ -1802,6 +1845,7 @@ mod tests { RuneEntry { etching: txid0, rune: Rune(RUNE), + premine: u128::MAX, supply: u128::MAX, timestamp: id0.block, ..Default::default() @@ -1839,6 +1883,7 @@ mod tests { RuneEntry { etching: txid0, rune: Rune(RUNE), + premine: u128::MAX, supply: u128::MAX, timestamp: id0.block, ..Default::default() @@ -1849,6 +1894,7 @@ mod tests { RuneEntry { etching: txid1, rune: Rune(RUNE + 1), + premine: u128::MAX, supply: u128::MAX, timestamp: id1.block, number: 1, @@ -1909,6 +1955,7 @@ mod tests { RuneEntry { etching: txid0, rune: Rune(RUNE), + premine: u128::MAX, supply: u128::MAX, timestamp: id0.block, ..Default::default() @@ -1919,6 +1966,7 @@ mod tests { RuneEntry { etching: txid1, rune: Rune(RUNE + 1), + premine: u128::MAX, supply: u128::MAX, timestamp: id1.block, number: 1, @@ -1963,6 +2011,7 @@ mod tests { RuneEntry { etching: txid0, rune: Rune(RUNE), + premine: u128::MAX, supply: u128::MAX, timestamp: id.block, ..Default::default() @@ -1996,6 +2045,7 @@ mod tests { RuneEntry { etching: txid0, rune: Rune(RUNE), + premine: u128::MAX, supply: u128::MAX, timestamp: id.block, ..Default::default() @@ -2048,6 +2098,7 @@ mod tests { RuneEntry { etching: txid0, rune: Rune(RUNE), + premine: u128::MAX, supply: u128::MAX, timestamp: id0.block, ..Default::default() @@ -2058,6 +2109,7 @@ mod tests { RuneEntry { etching: txid1, rune: Rune(RUNE + 1), + premine: u128::MAX, supply: u128::MAX, timestamp: id1.block, number: 1, @@ -2112,6 +2164,7 @@ mod tests { RuneEntry { etching: txid0, rune: Rune(RUNE), + premine: u128::MAX, supply: u128::MAX, timestamp: id.block, ..Default::default() @@ -2157,6 +2210,7 @@ mod tests { RuneEntry { etching: txid0, rune: Rune(RUNE), + premine: u128::MAX, supply: u128::MAX, timestamp: id.block, ..Default::default() @@ -2198,6 +2252,7 @@ mod tests { RuneEntry { etching: txid0, rune: Rune(RUNE), + premine: u128::MAX, supply: u128::MAX, timestamp: id0.block, ..Default::default() @@ -2235,6 +2290,7 @@ mod tests { RuneEntry { etching: txid0, rune: Rune(RUNE), + premine: u128::MAX, supply: u128::MAX, timestamp: id0.block, ..Default::default() @@ -2245,6 +2301,7 @@ mod tests { RuneEntry { etching: txid1, rune: Rune(RUNE + 1), + premine: u128::MAX, supply: u128::MAX, timestamp: id1.block, number: 1, @@ -2302,6 +2359,7 @@ mod tests { RuneEntry { etching: txid0, rune: Rune(RUNE), + premine: u128::MAX, supply: u128::MAX, timestamp: id0.block, ..Default::default() @@ -2312,6 +2370,7 @@ mod tests { RuneEntry { etching: txid1, rune: Rune(RUNE + 1), + premine: u128::MAX, supply: u128::MAX, timestamp: id1.block, number: 1, @@ -2364,6 +2423,7 @@ mod tests { RuneEntry { etching: txid0, rune: Rune(RUNE), + premine: u128::MAX / 2, supply: u128::MAX / 2, timestamp: id.block, ..Default::default() @@ -2402,6 +2462,7 @@ mod tests { RuneEntry { etching: txid0, rune: Rune(RUNE), + premine: u128::MAX / 2, supply: u128::MAX / 2, timestamp: id.block, ..Default::default() @@ -2444,6 +2505,7 @@ mod tests { burned: u128::MAX, etching: txid, rune: Rune(RUNE), + premine: u128::MAX, supply: u128::MAX, timestamp: id.block, ..Default::default() @@ -2479,6 +2541,7 @@ mod tests { RuneEntry { etching: txid, rune: Rune(RUNE), + premine: u128::MAX, supply: u128::MAX, timestamp: id.block, ..Default::default() @@ -2521,6 +2584,7 @@ mod tests { RuneEntry { etching: txid, rune: Rune(RUNE), + premine: u128::MAX, supply: u128::MAX, timestamp: id.block, ..Default::default() @@ -2556,6 +2620,7 @@ mod tests { RuneEntry { etching: txid, rune: Rune(RUNE), + premine: u128::MAX, supply: u128::MAX, timestamp: id.block, ..Default::default() @@ -2603,6 +2668,7 @@ mod tests { RuneEntry { etching: txid, rune: Rune(RUNE), + premine: u128::MAX, supply: u128::MAX, timestamp: id.block, ..Default::default() @@ -2662,6 +2728,7 @@ mod tests { RuneEntry { etching: txid, rune: Rune(RUNE), + premine: u128::MAX, supply: u128::MAX, timestamp: id.block, ..Default::default() @@ -2702,6 +2769,7 @@ mod tests { RuneEntry { etching: txid, rune: Rune(RUNE), + premine: 4000, supply: 4000, timestamp: id.block, ..Default::default() @@ -2749,6 +2817,7 @@ mod tests { RuneEntry { etching: txid, rune: Rune(RUNE), + premine: u128::MAX, supply: u128::MAX, timestamp: id.block, ..Default::default() @@ -2795,6 +2864,7 @@ mod tests { RuneEntry { etching: txid, rune: Rune(RUNE), + premine: u128::MAX, supply: u128::MAX, timestamp: id.block, ..Default::default() @@ -2838,6 +2908,7 @@ mod tests { RuneEntry { etching: txid0, rune: Rune(RUNE), + premine: u128::MAX, supply: u128::MAX, timestamp: id.block, ..Default::default() @@ -2877,6 +2948,7 @@ mod tests { RuneEntry { etching: txid0, rune: Rune(RUNE), + premine: u128::MAX, supply: u128::MAX, timestamp: id.block, ..Default::default() @@ -2927,6 +2999,7 @@ mod tests { RuneEntry { etching: txid0, rune: Rune(RUNE), + premine: u128::MAX, supply: u128::MAX, timestamp: id.block, ..Default::default() @@ -2973,6 +3046,7 @@ mod tests { RuneEntry { etching: txid0, rune: Rune(RUNE), + premine: u128::MAX, supply: u128::MAX, timestamp: id.block, ..Default::default() @@ -3023,6 +3097,7 @@ mod tests { RuneEntry { etching: txid0, rune: Rune(RUNE), + premine: u128::MAX, supply: u128::MAX, timestamp: id.block, ..Default::default() @@ -3069,6 +3144,7 @@ mod tests { RuneEntry { etching: txid0, rune: Rune(RUNE), + premine: u128::MAX, supply: u128::MAX, timestamp: id.block, ..Default::default() @@ -3119,6 +3195,7 @@ mod tests { RuneEntry { etching: txid0, rune: Rune(RUNE), + premine: u128::MAX, supply: u128::MAX, timestamp: id.block, ..Default::default() @@ -3158,6 +3235,7 @@ mod tests { RuneEntry { etching: txid0, rune: Rune(RUNE), + premine: u128::MAX, supply: u128::MAX, timestamp: id.block, ..Default::default() @@ -3208,6 +3286,7 @@ mod tests { RuneEntry { etching: txid0, rune: Rune(RUNE), + premine: u128::MAX, supply: u128::MAX, timestamp: id.block, ..Default::default() @@ -3254,6 +3333,7 @@ mod tests { RuneEntry { etching: txid0, rune: Rune(RUNE), + premine: u128::MAX, supply: u128::MAX, timestamp: id.block, ..Default::default() @@ -3304,6 +3384,7 @@ mod tests { RuneEntry { etching: txid0, rune: Rune(RUNE), + premine: u128::MAX, supply: u128::MAX, timestamp: id.block, ..Default::default() @@ -3350,6 +3431,7 @@ mod tests { RuneEntry { etching: txid0, rune: Rune(RUNE), + premine: u128::MAX, supply: u128::MAX, timestamp: id.block, ..Default::default() @@ -3415,6 +3497,7 @@ mod tests { RuneEntry { etching: txid, rune: Rune(RUNE), + premine: u128::MAX, supply: u128::MAX, symbol: Some('$'), timestamp: id.block, @@ -3451,6 +3534,7 @@ mod tests { RuneEntry { etching: txid, rune: Rune(RUNE), + premine: u128::MAX, supply: u128::MAX, timestamp: id.block, ..Default::default() @@ -3486,6 +3570,7 @@ mod tests { RuneEntry { etching: txid0, rune: Rune(RUNE), + premine: u128::MAX, supply: u128::MAX, timestamp: id.block, ..Default::default() @@ -3525,6 +3610,7 @@ mod tests { RuneEntry { etching: txid0, rune: Rune(RUNE), + premine: u128::MAX, supply: u128::MAX, timestamp: id.block, ..Default::default() @@ -3551,7 +3637,6 @@ mod tests { fn rune_can_be_minted_without_edict() { let context = Context::builder().arg("--index-runes").build(); - // etch the rune let (txid0, id) = context.etch( Runestone { etching: Some(Etching { @@ -3585,7 +3670,6 @@ mod tests { [], ); - // claim the rune let txid1 = context.rpc_server.broadcast_tx(TransactionTemplate { inputs: &[(2, 0, 0, Witness::new())], op_return: Some( @@ -3611,6 +3695,7 @@ mod tests { }), mints: 1, rune: Rune(RUNE), + premine: 0, supply: 1000, timestamp: id.block, ..Default::default() @@ -3652,6 +3737,8 @@ mod tests { etching: txid0, rune: Rune(RUNE), timestamp: id.block, + premine: 0, + supply: 0, mints: 0, mint: Some(MintEntry { limit: Some(1000), @@ -3663,7 +3750,6 @@ mod tests { [], ); - // claim the rune let txid1 = context.rpc_server.broadcast_tx(TransactionTemplate { inputs: &[(3, 0, 0, Witness::new())], op_return: Some( @@ -3694,6 +3780,7 @@ mod tests { }), mints: 1, rune: Rune(RUNE), + premine: 0, supply: 1000, timestamp: id.block, ..Default::default() @@ -3739,6 +3826,7 @@ mod tests { }), mints: 2, rune: Rune(RUNE), + premine: 0, supply: 2000, timestamp: id.block, ..Default::default() @@ -3795,6 +3883,7 @@ mod tests { }), mints: 3, rune: Rune(RUNE), + premine: 0, supply: 3000, timestamp: id.block, ..Default::default() @@ -3887,6 +3976,7 @@ mod tests { end: Some(id.block + 2), ..Default::default() }), + premine: 0, supply: 1000, timestamp: id.block, mints: 1, @@ -3927,6 +4017,7 @@ mod tests { RuneEntry { etching: txid0, rune: Rune(RUNE), + premine: 0, supply: 1000, timestamp: id.block, mint: Some(MintEntry { @@ -3985,6 +4076,7 @@ mod tests { ..Default::default() }), timestamp: id.block, + premine: 1111, supply: 1111, ..Default::default() }, @@ -4019,6 +4111,7 @@ mod tests { end: Some(id.block), ..Default::default() }), + premine: 1111, supply: 1111, ..Default::default() }, @@ -4086,6 +4179,7 @@ mod tests { id, RuneEntry { rune: Rune(RUNE), + premine: 0, supply: 1000, timestamp: 9, mints: 1, @@ -4127,6 +4221,7 @@ mod tests { RuneEntry { etching: txid0, rune: Rune(RUNE), + premine: 0, supply: 1000, timestamp: 9, mint: Some(MintEntry { @@ -4207,6 +4302,7 @@ mod tests { id, RuneEntry { rune: Rune(RUNE), + premine: 0, supply: 1000, timestamp: id.block, mints: 1, @@ -4248,6 +4344,7 @@ mod tests { RuneEntry { etching: txid0, rune: Rune(RUNE), + premine: 0, supply: 1000, timestamp: id.block, mint: Some(MintEntry { @@ -4524,6 +4621,7 @@ mod tests { ..Default::default() }), timestamp: id.block, + premine: 2000, supply: 2000, ..Default::default() }, @@ -4688,6 +4786,7 @@ mod tests { ..Default::default() }), timestamp: rune_id.block, + premine: 2000, supply: 2000, mints: 0, ..Default::default() diff --git a/src/subcommand/runes.rs b/src/subcommand/runes.rs index 9770078192..ed48753193 100644 --- a/src/subcommand/runes.rs +++ b/src/subcommand/runes.rs @@ -15,6 +15,7 @@ pub struct RuneInfo { pub mint: Option, pub mints: u64, pub number: u64, + pub premine: u128, pub rune: Rune, pub spacers: u32, pub supply: u128, @@ -47,6 +48,7 @@ pub(crate) fn run(settings: Settings) -> SubcommandResult { mint, mints, number, + premine, rune, spacers, supply, @@ -65,6 +67,7 @@ pub(crate) fn run(settings: Settings) -> SubcommandResult { mint, mints, number, + premine, rune, spacers, supply, diff --git a/src/subcommand/server.rs b/src/subcommand/server.rs index a7248c520f..76d0a4b3d0 100644 --- a/src/subcommand/server.rs +++ b/src/subcommand/server.rs @@ -2683,6 +2683,7 @@ mod tests { RuneEntry { etching: txid, rune: Rune(RUNE), + premine: u128::MAX, supply: u128::MAX, timestamp: id.block, symbol: Some('%'), @@ -2753,6 +2754,7 @@ mod tests { RuneEntry { etching: txid, rune, + premine: u128::MAX, supply: u128::MAX, symbol: Some('%'), timestamp: id.block, @@ -2788,6 +2790,8 @@ mod tests {
no
supply
340282366920938463463374607431768211455\u{00A0}%
+
premine
+
340282366920938463463374607431768211455\u{00A0}%
burned
0\u{00A0}%
divisibility
@@ -2863,6 +2867,7 @@ mod tests { RuneEntry { etching: txid, rune, + premine: u128::MAX, supply: u128::MAX, symbol: Some('%'), timestamp: id.block, @@ -2953,6 +2958,7 @@ mod tests { RuneEntry { etching: txid, rune: Rune(RUNE), + premine: u128::MAX, supply: u128::MAX, timestamp: id.block, ..Default::default() @@ -3014,6 +3020,7 @@ mod tests { divisibility: 1, etching: txid, rune, + premine: u128::MAX, supply: u128::MAX, timestamp: id.block, ..Default::default() diff --git a/src/templates/rune.rs b/src/templates/rune.rs index cab1a80c3f..50c452fcd9 100644 --- a/src/templates/rune.rs +++ b/src/templates/rune.rs @@ -26,12 +26,13 @@ mod tests { divisibility: 9, etching: Txid::all_zeros(), mints: 100, - number: 25, mint: Some(MintEntry { end: Some(11), limit: Some(1000000001), deadline: Some(7), }), + number: 25, + premine: 123456789, rune: Rune(u128::MAX), spacers: 1, supply: 123456789123456789, @@ -72,6 +73,8 @@ mod tests {
supply
123456789.123456789\u{00A0}%
+
premine
+
0.123456789\u{00A0}%
burned
123456789.123456789\u{00A0}%
divisibility
@@ -98,6 +101,7 @@ mod tests { etching: Txid::all_zeros(), mints: 0, number: 25, + premine: 0, rune: Rune(u128::MAX), spacers: 1, supply: 123456789123456789, @@ -123,6 +127,8 @@ mod tests {
no
supply
123456789.123456789\u{00A0}%
+
premine
+
0\u{00A0}%
burned
123456789.123456789\u{00A0}%
divisibility
@@ -150,6 +156,7 @@ mod tests { divisibility: 9, etching: Txid::all_zeros(), mints: 0, + premine: 0, number: 25, rune: Rune(u128::MAX), spacers: 1, @@ -187,6 +194,8 @@ mod tests {
supply
123456789.123456789\u{00A0}%
+
premine
+
0\u{00A0}%
burned
123456789.123456789\u{00A0}%
divisibility
diff --git a/templates/rune.html b/templates/rune.html index 4e3022fba7..38e249af0f 100644 --- a/templates/rune.html +++ b/templates/rune.html @@ -44,6 +44,8 @@

{{ self.entry.spaced_rune() }}

%% }
supply
{{ Pile{ amount: self.entry.supply, divisibility: self.entry.divisibility, symbol: self.entry.symbol } }}
+
premine
+
{{ Pile{ amount: self.entry.premine, divisibility: self.entry.divisibility, symbol: self.entry.symbol } }}
burned
{{ Pile{ amount: self.entry.burned, divisibility: self.entry.divisibility, symbol: self.entry.symbol } }}
divisibility
diff --git a/tests/json_api.rs b/tests/json_api.rs index c1f6c40656..c8675c4640 100644 --- a/tests/json_api.rs +++ b/tests/json_api.rs @@ -549,6 +549,7 @@ fn get_runes() { etching: a.inscribe.reveal, mints: 0, number: 0, + premine: 1000, rune: Rune(RUNE), spacers: 0, supply: 1000, @@ -582,6 +583,7 @@ fn get_runes() { etching: a.inscribe.reveal, mints: 0, number: 0, + premine: 1000, rune: Rune(RUNE), spacers: 0, supply: 1000, @@ -598,6 +600,7 @@ fn get_runes() { etching: b.inscribe.reveal, mints: 0, number: 1, + premine: 1000, rune: Rune(RUNE + 1), spacers: 0, supply: 1000, @@ -614,6 +617,7 @@ fn get_runes() { etching: c.inscribe.reveal, mints: 0, number: 2, + premine: 1000, rune: Rune(RUNE + 2), spacers: 0, supply: 1000, diff --git a/tests/lib.rs b/tests/lib.rs index 51ea4289ff..45c681ae2b 100644 --- a/tests/lib.rs +++ b/tests/lib.rs @@ -304,6 +304,8 @@ fn batch( {}
supply
{premine} {symbol}
+
premine
+
{premine} {symbol}
burned
0 {symbol}
divisibility
diff --git a/tests/runes.rs b/tests/runes.rs index 21861463c3..cfd179ba4c 100644 --- a/tests/runes.rs +++ b/tests/runes.rs @@ -61,6 +61,7 @@ fn one_rune() { mint: None, mints: 0, number: 0, + premine: 1000, rune: Rune(RUNE), spacers: 0, supply: 1000, @@ -106,6 +107,7 @@ fn two_runes() { mint: None, mints: 0, number: 0, + premine: 1000, rune: Rune(RUNE), spacers: 0, supply: 1000, @@ -125,6 +127,7 @@ fn two_runes() { mint: None, mints: 0, number: 1, + premine: 1000, rune: Rune(RUNE + 1), spacers: 0, supply: 1000,