When you go through the openbrush smart contract library. You will notice they are using upgradeable smart contract storage and while defining storage they are using some empty struct as key of similar lib name and using pub _reserved: Option<()>, in data struct.

 pub const STORAGE_KEY: u32 = openbrush::storage_unique_key!(Data)
    #[derive(Default, Debug)]
    pub struct Data {
        pub attributes: Mapping<(Id, String), String, AttributesKey>,
        pub _reserved: Option<()>,
    pub token_owner: Mapping<Id, Owner>,
    pub struct AttributesKey;
    impl<'a> TypeGuard<'a> for AttributesKey {
        type Type = &'a (&'a Id, &'a String);

Why we use pub struct AttributesKey and pub _reserved: Option<()> here ?



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.