diff --git a/contracts/feature-tests/basic-features/src/managed_vec_features.rs b/contracts/feature-tests/basic-features/src/managed_vec_features.rs index 196c211cf4..7b396e0044 100644 --- a/contracts/feature-tests/basic-features/src/managed_vec_features.rs +++ b/contracts/feature-tests/basic-features/src/managed_vec_features.rs @@ -76,4 +76,11 @@ pub trait ManagedVecFeatures { mv.push(item); mv } + + #[endpoint] + fn managed_ref_explicit(&self, mv: ManagedVec, index: usize) -> BigUint { + let value: ManagedRef = mv.get(index); + let with_explicit_lifetime: ManagedRef<'_, BigUint> = value; + (*with_explicit_lifetime).clone() + } } diff --git a/elrond-wasm-derive/src/preprocessing/substitution_list.rs b/elrond-wasm-derive/src/preprocessing/substitution_list.rs index 0090cb96ab..13eb215272 100644 --- a/elrond-wasm-derive/src/preprocessing/substitution_list.rs +++ b/elrond-wasm-derive/src/preprocessing/substitution_list.rs @@ -36,32 +36,51 @@ fn add_managed_type_with_generics( } fn add_managed_types(substitutions: &mut SubstitutionsMap) { + // types::io + add_managed_type(substitutions, "e!(ManagedSCError)); + + // types::interaction + add_managed_type(substitutions, "e!(AsyncCall)); + + // types::managed::basic + add_managed_type(substitutions, "e!(BigFloat)); add_managed_type(substitutions, "e!(BigInt)); add_managed_type(substitutions, "e!(BigUint)); - add_managed_type(substitutions, "e!(BigFloat)); - add_managed_type(substitutions, "e!(ManagedBuffer)); + add_managed_type(substitutions, "e!(EllipticCurveComponents)); add_managed_type(substitutions, "e!(EllipticCurve)); - add_managed_type(substitutions, "e!(ManagedAddress)); - add_managed_type(substitutions, "e!(TokenIdentifier)); - add_managed_type(substitutions, "e!(EgldOrEsdtTokenIdentifier)); - add_managed_type(substitutions, "e!(ManagedSCError)); - add_managed_type(substitutions, "e!(AsyncCall)); + add_managed_type(substitutions, "e!(ManagedBuffer)); + + // types::managed::multi-value add_managed_type(substitutions, "e!(ManagedAsyncCallError)); - add_managed_type(substitutions, "e!(EsdtTokenPayment)); + add_managed_type_with_generics(substitutions, "e!(ManagedAsyncCallResult)); + add_managed_type(substitutions, "e!(EsdtTokenPaymentMultiArg)); add_managed_type(substitutions, "e!(EsdtTokenPaymentMultiValue)); - - add_managed_type_with_generics(substitutions, "e!(ManagedOption)); - add_managed_type_with_generics(substitutions, "e!(ManagedVec)); - add_managed_type_with_generics(substitutions, "e!(ManagedVecOwnedIterator)); - add_managed_type_with_generics(substitutions, "e!(ManagedMultiValue)); + add_managed_type_with_generics(substitutions, "e!(MultiValueEncodedIterator)); + add_managed_type_with_generics(substitutions, "e!(MultiValueEncoded)); add_managed_type_with_generics(substitutions, "e!(ManagedVarArgs)); add_managed_type_with_generics(substitutions, "e!(ManagedMultiResultVec)); - add_managed_type_with_generics(substitutions, "e!(ManagedAsyncCallResult)); - add_managed_type_with_generics(substitutions, "e!(MultiValueEncoded)); - add_managed_type_with_generics(substitutions, "e!(MultiValueManagedVec)); add_managed_type_with_generics(substitutions, "e!(MultiValueManagedVecCounted)); add_managed_type_with_generics(substitutions, "e!(ManagedCountedVarArgs)); add_managed_type_with_generics(substitutions, "e!(ManagedCountedMultiResultVec)); + add_managed_type_with_generics(substitutions, "e!(MultiValueManagedVec)); + + // types::managed::wrapped + add_managed_type(substitutions, "e!(EgldOrEsdtTokenIdentifier)); + add_managed_type(substitutions, "e!(EgldOrEsdtTokenPayment)); + add_managed_type(substitutions, "e!(EsdtTokenData)); + add_managed_type(substitutions, "e!(EsdtTokenPayment)); + add_managed_type(substitutions, "e!(ManagedAddress)); + add_managed_type(substitutions, "e!(ManagedBufferCachedBuilder)); + add_managed_type_with_generics(substitutions, "e!(ManagedByteArray)); + add_managed_type_with_generics(substitutions, "e!(ManagedOption)); + add_managed_type_with_generics(substitutions, "e!(ManagedRef)); + add_managed_type_with_generics(substitutions, "e!(ManagedVecOwnedIterator)); + add_managed_type_with_generics(substitutions, "e!(ManagedVecRefIterator)); + add_managed_type_with_generics(substitutions, "e!(ManagedVecRef)); + add_managed_type_with_generics(substitutions, "e!(ManagedVec)); + add_managed_type_with_generics(substitutions, "e!(PreloadedManagedBuffer)); + add_managed_type_with_generics(substitutions, "e!(RandomnessSource)); + add_managed_type(substitutions, "e!(TokenIdentifier)); } fn add_storage_mapper_single_generic_arg( diff --git a/elrond-wasm/src/types/managed/multi_value/multi_value_managed_vec_counted.rs b/elrond-wasm/src/types/managed/multi_value/multi_value_managed_vec_counted.rs index 5d13ac3772..8f0b7bf5e8 100644 --- a/elrond-wasm/src/types/managed/multi_value/multi_value_managed_vec_counted.rs +++ b/elrond-wasm/src/types/managed/multi_value/multi_value_managed_vec_counted.rs @@ -10,7 +10,7 @@ use elrond_codec::{ /// Argument or result that is made up of the argument count, followed by the arguments themselves. /// Think of it as a `VarArgs` preceded by the count. -/// Unlike `ManagedMultiValue` it deserializes eagerly. +/// Unlike `MultiValueManagedVec` it deserializes eagerly. #[derive(Clone, Default)] pub struct MultiValueManagedVecCounted where