Hi guys
I am trying to update the code of my contract using set_code, but nothing happens. I have some fundamental questions
1. Does it change the address of the current contract
2. Does the set_code primitive give me access to new code functions, ... ?
3. I already have the function "A" inside my contract. I was wondering what would happen after calling set_c3.

Updates the current value of c3. Usually, it is used for updating smart contract codes in runtime. Note that after execution of this primitive, the current code (and the stack of recursive function calls) won't change, but any other function call will use a function from the new code.

If the new code has function A, is it possible to call the new code's function A?

And if there is another function, let's say B, in the new code, how to call this new function?



4. I have seen some other examples referenced in docs. They call send_message_back after set_code. Why is that for?

Dec 26, 2023, 7:51 PM
1- No.

2- Not in the current transaction.

3- The map of function ids to their code will be updated. If you have changed the number or order of functions, you may call a wrong function. To fix this, use method_id to fix the id of the function even after update.
Dec 27, 2023, 6:22 AM
So, there is no way to access a new function after changing the code? We have to make a new transaction to my_address() and continue the process from where we left off?
Dec 27, 2023, 9:00 AM
You have to use set_c3 in addition to set_code.
Dec 27, 2023, 9:02 AM
Thank you so much
Dec 27, 2023, 9:03 AM

© 2024 Draquery.com All rights reserved.