From 9791f335d34958df557aa51bc64095bf23c9c4b3 Mon Sep 17 00:00:00 2001 From: Ion V Date: Sun, 11 Jun 2023 15:28:13 +0300 Subject: [PATCH] Replaced `elrond_codec` import with `multiversx_sc::codec` --- .../developer-reference/upgrading-smart-contracts.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/developers/developer-reference/upgrading-smart-contracts.md b/docs/developers/developer-reference/upgrading-smart-contracts.md index ab36ec9f1..0f0832a73 100644 --- a/docs/developers/developer-reference/upgrading-smart-contracts.md +++ b/docs/developers/developer-reference/upgrading-smart-contracts.md @@ -72,6 +72,8 @@ You always need to add new fields at the end of the struct, otherwise, this appr To fix this, we need to manually implement the decoding traits, which were previously automatically added through the derives. ```rust +use multiversx_sc::codec::{NestedDecodeInput, TopDecodeInput}; + #[derive(TypeAbi, TopEncode, NestedEncode)] pub struct UserData { pub stake_amount: BigUint, @@ -82,7 +84,7 @@ pub struct UserData { impl TopDecode for UserData { fn top_decode(input: I) -> Result where - I: elrond_codec::TopDecodeInput, + I: TopDecodeInput, { let mut buffer = input.into_nested_buffer(); Self::dep_decode(&mut buffer) @@ -126,6 +128,8 @@ Unless you want to remove the very last field of the struct, and change nothing Assuming you simply want to remove `last_update_block` for the example above, the implementation would be as follows: ```rust +use multiversx_sc::codec::{NestedDecodeInput, TopDecodeInput}; + #[derive(TypeAbi, TopEncode, NestedEncode)] pub struct UserData { pub stake_amount: BigUint, @@ -134,7 +138,7 @@ pub struct UserData { impl TopDecode for UserData { fn top_decode(input: I) -> Result where - I: elrond_codec::TopDecodeInput, + I: TopDecodeInput, { let mut buffer = input.into_nested_buffer(); Self::dep_decode(&mut buffer)