You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: lib.rs
    path of file: ./repos/namada/crates/macros/src
    
    the code of the file until where you have to start completion: //! Namada macros for generating WASM binding code for transactions and validity
//! predicates.

#![doc(html_favicon_url = "https://dev.namada.net/master/favicon.png")]
#![doc(html_logo_url = "https://dev.namada.net/master/rustdoc-logo.png")]
#![deny(rustdoc::broken_intra_doc_links)]
#![deny(rustdoc::private_intra_doc_links)]

use proc_macro::TokenStream;
use proc_macro2::{Span as Span2, TokenStream as TokenStream2};
use quote::{quote, ToTokens};
use syn::punctuated::Punctuated;
use syn::{parse_macro_input, ExprAssign, FnArg, ItemFn, ItemStruct, Pat};

/// Generate WASM binding for a transaction main entrypoint function.
///
/// It expects an attribute in the form: `gas = u64`, so that a call to the gas
/// meter can be injected as the first instruction of the transaction to account
/// for the whitelisted gas amount.
///
/// This macro expects a function with signature:
///
/// ```c
    
fn derive_storage_keys_inner(struct_def: TokenStream2) -> TokenStream2 {
    let struct_def: ItemStruct = syn::parse2(struct_def)
        .expect("Expected a struct in the StorageKeys derive");

    // type check the struct - all fields must be of type `&'static str`
    let fields = match &struct_def.fields {
        syn::Fields::Named(fields) => &fields.named,
        _ => panic!(
            "Only named struct fields are accepted in StorageKeys derives"
        ),
    };

    let mut idents = vec![];

    for field in fields {
        let field_type = field.ty.to_token_stream().to_string();
        if field_type != "& 'static str" {
            panic!(
                "Expected `&'static str` field type in StorageKeys derive, \
                 but got `{field_type}` instead"
            );
        }
        idents.push(field.ident.clone().expect("Expected a named field"));
    }

    idents.sort();

    let ident_list = create_punctuated(&idents, |ident| ident.clone());
    let values_list = create_punctuated(&idents, |ident| {
        let storage_key = ident.to_token_stream().to_string();
        syn::FieldValue {
            attrs: vec![],
            member: syn::Member::Named(ident.clone()),
            colon_token: Some(syn::token::Colon {
                spans: [Span2::call_site()],
            }),
            expr: syn::Expr::Lit(syn::ExprLit {
                attrs: vec![],
                lit: syn::Lit::Str(syn::LitStr::new(
                    storage_key.as_str(),
                    Span2::call_site(),
                )),
            }),
        }
    });

    let struct_def_ident = &struct_def.ident;

    let helper_fns = idents
        .iter()
        .fold(vec![], |mut accum, ident| {
            let is_fn = {
                let id = format!("is_{ident}_key_at_addr");
                let id = syn::Ident::new(&id, ident.span());
                quote! {
                    #[allow(missing_docs)]
                    pub fn #id(key: &namada_core::storage::Key, address: &Address) -> bool {
                        matches!(&key.segments[..], [
                            namada_core::storage::DbKeySeg::AddressSeg(a),
                            namada_core::storage::DbKeySeg::StringSeg(#ident),
                        ] if a == address && #ident == #struct_def_ident::VALUES.#ident)
                    }
                }
            };
            let get_fn = {
                let id = format!("get_{ident}_key_at_addr");
                let id = syn::Ident::new(&id, ident.span());
                quote! {
                    #[allow(missing_docs)]
                    pub fn #id(address: Address) -> namada_core::storage::Key {
                        namada_core::storage::Key {
                            segments: vec![
                                namada_core::storage::DbKeySeg::AddressSeg(address),
                                namada_core::storage::DbKeySeg::StringSeg(#struct_def_ident::VALUES.#ident.to_string()),
                            ],
                        }
                    }
                }
            };
            accum.push(is_fn);
            accum.push(get_fn);
            accum
        });

    quote! {
        impl #struct_def_ident {
            /// A list of all storage keys
            pub const ALL: &'static [&'static str] = {
                let #struct_def_ident {
                    #ident_list
                } = Self::VALUES;

                &[ #ident_list ]
            };

            /// Storage keys values
            pub const VALUES: #struct_def_ident = Self {
                #values_list
            };
        }

        #(#helper_fns)*
    }
}