registry_v8.rs (1065B)
1 //! Immutable explicit registry v8: unchanged v7 contracts plus complete-profile edit. 2 3 use super::{EventContract, all_event_contracts_registry_v7}; 4 5 pub const PROFILE_METADATA_EDIT_CONTRACT_ID: &str = "radroots.profile.metadata_edit.v1"; 6 7 const COUNT: usize = all_event_contracts_registry_v7().len() + 1; 8 static CONTRACTS: [EventContract; COUNT] = { 9 let inherited = all_event_contracts_registry_v7(); 10 let mut contracts = [inherited[0]; COUNT]; 11 let mut index = 0; 12 while index < inherited.len() { 13 contracts[index] = inherited[index]; 14 index += 1; 15 } 16 let mut edit = inherited[0]; 17 edit.id = PROFILE_METADATA_EDIT_CONTRACT_ID; 18 edit.name = "Complete Profile Metadata Edit"; 19 edit.payload_type = "ProfileEdit / RadrootsAdmittedProfileEvent"; 20 contracts[index] = edit; 21 contracts 22 }; 23 24 pub const fn all_event_contracts_registry_v8() -> &'static [EventContract] { 25 &CONTRACTS 26 } 27 28 pub fn event_contract_registry_v8(id: &str) -> Option<&'static EventContract> { 29 CONTRACTS.iter().find(|contract| contract.id == id) 30 }