Skip to content

Commit

Permalink
puh
Browse files Browse the repository at this point in the history
  • Loading branch information
Skydev0h committed Dec 26, 2023
1 parent 15b7033 commit 9f56e6e
Showing 1 changed file with 1 addition and 20 deletions.
21 changes: 1 addition & 20 deletions contracts/task3.fc
Original file line number Diff line number Diff line change
@@ -1,19 +1,5 @@
#include "imports/stdlib.fc";

;; All the code in recv_internal, get_storage, wrap_storage, and version
;; serves as an example of the intended structure.

;; The provided code is an "empty wrapper." It:
;; + Parses "wrapped" incoming messages (discards versioning information)
;; + "Wraps" the call to the version-specific process_message
;; + Implements "get_storage" for version-specific get-methods
;; However, it does not yet implement any upgrade logic, which is your task.

;; The empty wrapper is provided to demonstrate
;; how version-specific code is intended to be "wrapped" and interacted with.
;; You may delete and rewrite as needed,
;; but the final implementation must adhere to the same structure

cell get_storage() inline {
return get_data().begin_parse().preload_ref();
}
Expand Down Expand Up @@ -51,14 +37,9 @@ cell migrate_one(cell old_storage) { ;; it's just a placeholder that is required
;; Custom version-specific code ends >>>>>

() recv_internal(int msg_value, int balance, cell in_msg_full, slice in_msg_body) impure {
if (in_msg_body.slice_bits() < 32) { return(); }
if (in_msg_body.slice_bits() < 32) { return(); } ;; deploy / ordinary
int expected_version = in_msg_body~load_uint(32);

;; ---
;; here you should check if it's the first call or not based on `expected_version` as stated in the task
;; if it is the first call, wrap the storage and finish execution by returning from the function
;; ---

if (expected_version == 0) {
set_data(begin_cell()
.store_uint(1, 32)
Expand Down

0 comments on commit 9f56e6e

Please sign in to comment.