MrBoec/core-primitives/src/lib.rs
Uncle Stretch 66719626bb
inital commit, which is clearly not initial
Signed-off-by: Uncle Stretch <uncle.stretch@ghostchain.io>
2024-10-03 15:38:52 +03:00

59 lines
1.7 KiB
Rust
Executable File

#![cfg_attr(not(feature = "std"), no_std)]
use sp_runtime::{
generic,
traits::{BlakeTwo256, IdentifyAccount, Verify},
MultiSignature, OpaqueExtrinsic as UncheckedExtrinsic,
};
/// The block number type used by GHOST/
/// 32-bits will allow for 136 years of blocks assuming 1 block per second.
pub type BlockNumber = u32;
/// An instant or duration time.
pub type Moment = u64;
/// Alias to 512-bit hash when used in the context of a transaction signature
/// on the chain.
pub type Signature = MultiSignature;
/// Alias to public key used for GHOST chain, actually a 'MultiSigner'. Like
/// the signature, this also isn't a fixed size when encoded, as different
/// cryptos have different size public key.
pub type AccountPublic = <Signature as Verify>::Signer;
/// Alias to public key used for this chain, actually a `AccountId32`. This is
/// always 32 bytes.
pub type AccountId = <AccountPublic as IdentifyAccount>::AccountId;
/// The type for looking up accounts. We don't expect more than 4 billion of them.
pub type AccountIndex = u32;
/// Identifier for a chain. 32-bit should be plenty.
pub type ChainId = u32;
/// A hash of some data used by the relay chain.
pub type Hash = sp_core::H256;
/// Index of transaction in the chain.
pub type Nonce = u32;
/// The balance of an account.
pub type Balance = u128;
/// Amount type.
pub type Amount = i128;
/// Header type.
pub type Header = generic::Header<BlockNumber, BlakeTwo256>;
/// Block type.
pub type Block = generic::Block<Header, UncheckedExtrinsic>;
/// Block ID.
pub type BlockId = generic::BlockId<Block>;
/// Type for identifier for the named reserve.
pub type ReserveIdentifier = [u8; 8];
pub type FreezeIdentifier = [u8; 8];