Skip to content

Commit

Permalink
Identity contract: Rename Network to Chain
Browse files Browse the repository at this point in the history
  • Loading branch information
Szegoo committed Aug 26, 2023
1 parent 337fdf6 commit 42386f7
Show file tree
Hide file tree
Showing 4 changed files with 230 additions and 230 deletions.
14 changes: 7 additions & 7 deletions common/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ pub type IdentityNo = u32;
/// We want to keep the address type very generic since we want to support any
/// address format. We won't actually keep the addresses in the contract itself.
/// Before storing them, we'll encrypt them to ensure privacy.
pub type NetworkAddress = Vec<u8>;
pub type ChainAddress = Vec<u8>;

/// Used to represent any blockchain in the Polkadot, Kusama or Rococo network.
pub type NetworkId = u32;
/// Used to represent any blockchain in the Polkadot, Kusama or Rococo chain.
pub type ChainId = u32;

/// We currently support these two address types since XCM is also supporting
/// only these ones.
Expand All @@ -27,16 +27,16 @@ pub enum AccountType {

#[derive(scale::Encode, scale::Decode, Debug, PartialEq, Clone)]
#[cfg_attr(feature = "std", derive(scale_info::TypeInfo, StorageLayout))]
pub struct NetworkInfo {
/// We need to know the rpc url of each network otherwise we won't know how
pub struct ChainInfo {
/// We need to know the rpc url of each chain otherwise we won't know how
/// to communicate with it.
pub rpc_urls: Vec<String>,
/// We need to know the address type when making XCM transfers.
pub account_type: AccountType,
}

impl NetworkInfo {
// Makes sure none of the network's urls exceed the size limit.
impl ChainInfo {
// Makes sure none of the chain's urls exceed the size limit.
pub fn ensure_rpc_url_size_limit(&self, limit: usize) -> bool {
self.rpc_urls.iter().all(|url| url.len() <= limit)
}
Expand Down
Loading

0 comments on commit 42386f7

Please sign in to comment.