time_primitives/
network.rs

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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
use crate::{Address32, BatchGasParams};
use polkadot_sdk::{sp_core::ConstU32, sp_runtime::BoundedVec};
use scale_codec::{Decode, DecodeWithMemTracking, Encode};
use scale_info::TypeInfo;
use serde::{Deserialize, Serialize};

pub const CHAIN_NAME_LEN: u32 = 50;

pub type NetworkId = u16;

#[derive(
	Encode,
	Decode,
	DecodeWithMemTracking,
	TypeInfo,
	PartialEq,
	Eq,
	Clone,
	Debug,
	Serialize,
	Deserialize,
)]
pub struct ChainName(pub BoundedVec<u8, ConstU32<CHAIN_NAME_LEN>>);

#[derive(
	Clone,
	Debug,
	Eq,
	PartialEq,
	Encode,
	Decode,
	DecodeWithMemTracking,
	TypeInfo,
	Serialize,
	Deserialize,
)]
pub struct Network {
	pub id: NetworkId,
	pub chain_name: ChainName,
	pub gateway: Address32,
	pub gateway_block: u64,
	pub config: NetworkConfig,
}

#[derive(
	Clone,
	Copy,
	Debug,
	Eq,
	PartialEq,
	Encode,
	Decode,
	DecodeWithMemTracking,
	TypeInfo,
	Serialize,
	Deserialize,
)]
pub struct NetworkConfig {
	pub batch_size: u32,
	pub batch_offset: u32,
	pub shard_task_limit: u32,
	pub shard_size: u16,
	pub shard_threshold: u16,
	pub batch_gas_params: BatchGasParams,
	pub max_gas_price: u128,
}