diff --git a/src/storage.rs b/src/storage.rs index cdd867b..b51053f 100644 --- a/src/storage.rs +++ b/src/storage.rs @@ -73,50 +73,23 @@ impl TopDecode for DataNftAttributes { impl NestedDecode for DataNftAttributes { fn dep_decode(input: &mut I) -> Result { - let data_stream_url: Result, _> = ManagedBuffer::dep_decode(input); - let creator: Result, _> = ManagedAddress::dep_decode(input); - - let mut data_stream_url_value = None; - let mut creator_value = None; - - // Assign the decoded values if successful - if let Ok(value) = data_stream_url.into() { - data_stream_url_value = Some(value); - } - - if let Ok(value) = creator.into() { - creator_value = Some(value); - } - - if data_stream_url_value.is_some() && creator_value.is_some() { - return Result::Ok(DataNftAttributes { - data_stream_url: data_stream_url_value.unwrap(), - data_preview_url: ManagedBuffer::from(""), - data_marshal_url: ManagedBuffer::from(""), - creator: creator_value.unwrap(), - creation_time: u64::from(0u8), - title: ManagedBuffer::from(""), - description: ManagedBuffer::from(""), - }); - } else { - let data_stream_url = ManagedBuffer::dep_decode(input)?; - let data_preview_url = ManagedBuffer::dep_decode(input)?; - let data_marshal_url = ManagedBuffer::dep_decode(input)?; - let creator = ManagedAddress::dep_decode(input)?; - let creation_time = u64::dep_decode(input)?; - let title = ManagedBuffer::dep_decode(input)?; - let description = ManagedBuffer::dep_decode(input)?; - - Result::Ok(DataNftAttributes { - data_stream_url, - data_preview_url, - data_marshal_url, - creator, - creation_time, - title, - description, - }) - } + let data_stream_url = ManagedBuffer::dep_decode(input)?; + let data_preview_url = ManagedBuffer::dep_decode(input)?; + let data_marshal_url = ManagedBuffer::dep_decode(input)?; + let creator = ManagedAddress::dep_decode(input)?; + let creation_time = u64::dep_decode(input)?; + let title = ManagedBuffer::dep_decode(input)?; + let description = ManagedBuffer::dep_decode(input)?; + + Result::Ok(DataNftAttributes { + data_stream_url, + data_preview_url, + data_marshal_url, + creator, + creation_time, + title, + description, + }) } } #[multiversx_sc::module]