pub fn static_encode_size<T: AbiEncoding>(types: Vec<T>) -> Result<yul::Expression, String> {
    let mut static_size = 0;

    for typ in types {
        match typ.abi_type() {
            AbiType::Uint { .. } => static_size += 32,
            AbiType::Array { inner, size } => {
                let inner_size = match *inner {
                    AbiType::Uint {
                        size: AbiUintSize { padded_size, .. },
                    } => padded_size,
                    AbiType::Array { .. } => todo!(),
                    AbiType::Tuple { .. } => todo!(),
                };
                match size {
                    AbiArraySize::Static { size } => {
                        static_size += utils::ceil_32(inner_size * size)
                    }
                    AbiArraySize::Dynamic => {
                        return Err(
                            "tried to get the static encoding size of dynamically sized value"
                                .to_string(),
                        )
                    }
                }
            }
            AbiType::Tuple { elems } => static_size += elems.len() * 32,
        }
    }

    Ok(literal_expression! { (static_size) })
}
/// Returns an expression that gives the max size of the encoded values.
Returns an expression that gives the max size of the encoded values.
Returns an expression that gives the max size of the encoded values .
pub fn static_encode_size<T: AbiEncoding>(types: Vec<T>) -> Result<yul::Expression, String> {
    let mut static_size = 0;
    for typ in types {
        match typ.abi_type() {
            AbiType::Uint { .. } => static_size += 32,
            AbiType::Array { inner, size } => {
                let inner_size = match *inner {
                    AbiType::Uint {
                        size: AbiUintSize { padded_size, .. },
                    } => padded_size,
                    AbiType::Array { .. } => todo!(),
                    AbiType::Tuple { .. } => todo!(),
                };
                match size {
                    AbiArraySize::Static { size } => {
                        static_size += utils::ceil_32(inner_size * size)
                    }
                    AbiArraySize::Dynamic => {
                        return Err(
                            "tried to get the static encoding size of dynamically sized value"
                                .to_string(),
                        )
                    }
                }
            }
            AbiType::Tuple { elems } => static_size += elems.len() * 32,
        }
    }
    Ok(literal_expression! { (static_size) })
}
pub fn static_encode_size < T : AbiEncoding > ( types : Vec < T > ) -> Result < yul :: Expression , String > { let mut static_size = 0 ; for typ in types { match typ . abi_type ( ) { AbiType :: Uint { .. } => static_size += 32 , AbiType :: Array { inner , size } => { let inner_size = match * inner { AbiType :: Uint { size : AbiUintSize { padded_size , .. } , } => padded_size , AbiType :: Array { .. } => todo ! ( ) , AbiType :: Tuple { .. } => todo ! ( ) , } ; match size { AbiArraySize :: Static { size } => { static_size += utils :: ceil_32 ( inner_size * size ) } AbiArraySize :: Dynamic => { return Err ( " " . to_string ( ) , ) } } } AbiType :: Tuple { elems } => static_size += elems . len ( ) * 32 , } } Ok ( literal_expression ! { ( static_size ) } ) }
Returns an expression that gives the max size of the encoded values.
Returns an expression that gives the max size of the encoded values .
types
Vec<T>
types
Vec<T>