difftreelog
doc: Fix docs
in: master
2 files changed
pallets/common/src/erc.rsdiffbeforeafterboth313132use crate::{Pallet, CollectionHandle, Config, CollectionProperties};32use crate::{Pallet, CollectionHandle, Config, CollectionProperties};333334/// Events for etherium collection helper.34/// Events for ethereum collection helper.35#[derive(ToLog)]35#[derive(ToLog)]36pub enum CollectionHelpersEvents {36pub enum CollectionHelpersEvents {37 /// The collection has been created.37 /// The collection has been created.pallets/common/src/eth.rsdiffbeforeafterboth25 0x17, 0xc4, 0xe6, 0x45, 0x3c, 0xc4, 0x9a, 0xaa, 0xae, 0xac, 0xa8, 0x94, 0xe6, 0xd9, 0x68, 0x3e,25 0x17, 0xc4, 0xe6, 0x45, 0x3c, 0xc4, 0x9a, 0xaa, 0xae, 0xac, 0xa8, 0x94, 0xe6, 0xd9, 0x68, 0x3e,26];26];272728/// Maps the etherium address of the collection in substrate.28/// Maps the ethereum address of the collection in substrate.29pub fn map_eth_to_id(eth: &H160) -> Option<CollectionId> {29pub fn map_eth_to_id(eth: &H160) -> Option<CollectionId> {30 if eth[0..16] != ETH_COLLECTION_PREFIX {30 if eth[0..16] != ETH_COLLECTION_PREFIX {31 return None;31 return None;35 Some(CollectionId(u32::from_be_bytes(id_bytes)))35 Some(CollectionId(u32::from_be_bytes(id_bytes)))36}36}373738/// Maps the substrate collection id in etherium.38/// Maps the substrate collection id in ethereum.39pub fn collection_id_to_address(id: CollectionId) -> H160 {39pub fn collection_id_to_address(id: CollectionId) -> H160 {40 let mut out = [0; 20];40 let mut out = [0; 20];41 out[0..16].copy_from_slice(Ð_COLLECTION_PREFIX);41 out[0..16].copy_from_slice(Ð_COLLECTION_PREFIX);42 out[16..20].copy_from_slice(&u32::to_be_bytes(id.0));42 out[16..20].copy_from_slice(&u32::to_be_bytes(id.0));43 H160(out)43 H160(out)44}44}454546/// Check if the etherium address is a collection.46/// Check if the ethereum address is a collection.47pub fn is_collection(address: &H160) -> bool {47pub fn is_collection(address: &H160) -> bool {48 address[0..16] == ETH_COLLECTION_PREFIX48 address[0..16] == ETH_COLLECTION_PREFIX49}49}