git.delta.rocks / unique-network / refs/commits / f37009b7df18

difftreelog

doc: Fix docs

Trubnikov Sergey2022-07-18parent: #31c5482.patch.diff
in: master

2 files changed

modifiedpallets/common/src/erc.rsdiffbeforeafterboth
3131
32use crate::{Pallet, CollectionHandle, Config, CollectionProperties};32use crate::{Pallet, CollectionHandle, Config, CollectionProperties};
3333
34/// 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.
modifiedpallets/common/src/eth.rsdiffbeforeafterboth
25 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];
2727
28/// 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}
3737
38/// 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(&ETH_COLLECTION_PREFIX);41 out[0..16].copy_from_slice(&ETH_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}
4545
46/// 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_PREFIX
49}49}