1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/// Money matters.
pub mod currency {
  use crate::Balance;

  pub const UNITS: Balance = 100_000_000_000;
  pub const DOLLARS: Balance = UNITS; // 100_000_000_000
  pub const CENTS: Balance = DOLLARS / 100; // 1_000_000_000
  pub const MILLICENTS: Balance = CENTS / 1_000; // 1_000_000

  pub const fn deposit(items: u32, bytes: u32) -> Balance {
    items as Balance * 15 * CENTS + (bytes as Balance) * 6 * CENTS
  }
}

/// Time and blocks.
pub mod time {
  use crate::{BlockNumber, Moment};

  /// This determines the average expected block time that we are targeting.
  /// Change this to adjust the block time.
  pub const MILLISECS_PER_BLOCK: Moment = 6000;

  // NOTE: Currently it is not possible to change the slot duration after the chain has started.
  // Attempting to do so will brick block production.
  pub const SLOT_DURATION: Moment = MILLISECS_PER_BLOCK;

  // These time units are defined in number of blocks.
  pub const MINUTES: BlockNumber = 60_000 / (MILLISECS_PER_BLOCK as BlockNumber);
  pub const HOURS: BlockNumber = MINUTES * 60;
  pub const DAYS: BlockNumber = HOURS * 24;
  pub const WEEKS: BlockNumber = DAYS * 7;
}