---
source: crates/sdk-derive/derive-core/src/codec.rs
expression: formatted
---
pub type ComplexOpCallArgs = (Vec<u8>, Vec<(u64, String)>);
#[derive(Debug, Clone, PartialEq)]
pub struct ComplexOpCall(pub ComplexOpCallArgs);
pub type ComplexOpReturnArgs = (u64, String, Vec<u8>);
#[derive(Debug, Clone, PartialEq)]
pub struct ComplexOpReturn(pub ComplexOpReturnArgs);
const _: () = {
    impl ComplexOpCall {
        pub const SELECTOR: [u8; 4] = [167u8, 195u8, 200u8, 15u8];
        pub const SIGNATURE: &'static str = "complexOp(uint8[],(uint64,string)[])";
        /// Creates a new call instance from arguments
        pub fn new(args: ComplexOpCallArgs) -> Self {
            Self(args)
        }
        /// Encodes with selector
        pub fn encode(&self) -> fluentbase_sdk::codec::bytes::Bytes {
            let mut args_buf = fluentbase_sdk::codec::bytes::BytesMut::new();
            fluentbase_sdk::codec::encoder::SolidityABI::encode_function_args(
                    &self.0,
                    &mut args_buf,
                )
                .expect("Failed to encode values");
            let mut buf = fluentbase_sdk::codec::bytes::BytesMut::new();
            buf.extend_from_slice(&Self::SELECTOR);
            buf.extend_from_slice(&args_buf);
            buf.freeze()
        }
        /// Decodes call arguments from bytes
        pub fn decode(
            buf: &impl fluentbase_sdk::codec::bytes::Buf,
        ) -> Result<Self, fluentbase_sdk::codec::CodecError> {
            let args = fluentbase_sdk::codec::encoder::SolidityABI::<
                ComplexOpCallArgs,
            >::decode_function_args(buf)?;
            Ok(Self(args))
        }
    }
    impl ::core::ops::Deref for ComplexOpCall {
        type Target = ComplexOpCallArgs;
        fn deref(&self) -> &Self::Target {
            &self.0
        }
    }
    impl ComplexOpReturn {
        /// Creates a new return instance from values
        pub fn new(args: ComplexOpReturnArgs) -> Self {
            Self(args)
        }
        /// Encodes the return values to bytes
        pub fn encode(&self) -> fluentbase_sdk::codec::bytes::Bytes {
            let mut buf = fluentbase_sdk::codec::bytes::BytesMut::new();
            fluentbase_sdk::codec::encoder::SolidityABI::encode_function_args(
                    &self.0,
                    &mut buf,
                )
                .expect("Failed to encode values");
            buf.freeze()
        }
        /// Decodes return values from bytes
        pub fn decode(
            buf: &impl fluentbase_sdk::codec::bytes::Buf,
        ) -> Result<Self, fluentbase_sdk::codec::CodecError> {
            let args = fluentbase_sdk::codec::encoder::SolidityABI::<
                ComplexOpReturnArgs,
            >::decode_function_args(buf)?;
            Ok(Self(args))
        }
    }
    impl ::core::ops::Deref for ComplexOpReturn {
        type Target = ComplexOpReturnArgs;
        fn deref(&self) -> &Self::Target {
            &self.0
        }
    }
};
