From 90e65b0ac49dad4a5b2d8b5d9406f612c99bbb4f Mon Sep 17 00:00:00 2001 From: Daniil Sedov <42098239+Gusarich@users.noreply.github.com> Date: Fri, 17 Nov 2023 13:34:08 +0300 Subject: [PATCH 1/4] Update fees-low-level.md --- docs/develop/howto/fees-low-level.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/develop/howto/fees-low-level.md b/docs/develop/howto/fees-low-level.md index 5478e6e440..a49859dae0 100644 --- a/docs/develop/howto/fees-low-level.md +++ b/docs/develop/howto/fees-low-level.md @@ -79,7 +79,7 @@ slice payload_encoding(int a, int b, int c) { .store_uint(0x18, 6) .store_slice(destination) .store_coins(0) - .store_uint(0, 1 + 4 + 4 + 64 + 32 + 1 + 1) ;; some flags related to message header + .store_uint(0, 1 + 4 + 4 + 64 + 32 + 1 + 1) ;; message flags (see sending messages page) .store_uint(0x33bbff77, 32) ;; op-code (see smart-contract guidelines) .store_uint(cur_lt(), 64) ;; query_id (see smart-contract guidelines) .store_slice(payload) @@ -107,7 +107,7 @@ builder payload_encoding(int a, int b, int c) { .store_uint(0x18, 6) .store_slice(destination) .store_coins(0) - .store_uint(0, 1 + 4 + 4 + 64 + 32 + 1 + 1) ;; some flags related to message header + .store_uint(0, 1 + 4 + 4 + 64 + 32 + 1 + 1) ;; message flags (see sending messages page) .store_uint(0x33bbff77, 32) ;; op-code (see smart-contract guidelines) .store_uint(cur_lt(), 64) ;; query_id (see smart-contract guidelines) .store_builder(payload) From 3019f0f0b0c671e13e1be6dccca1974f4ba25478 Mon Sep 17 00:00:00 2001 From: Gusarich Date: Fri, 17 Nov 2023 13:47:14 +0300 Subject: [PATCH 2/4] add explanations for 106 default zero bits in messages --- docs/develop/dapps/asset-processing/nfts.md | 2 +- docs/develop/func/cookbook.md | 14 +++++++------- .../guidelines/random-number-generation.md | 6 +++--- docs/develop/smart-contracts/tutorials/wallet.md | 4 ++-- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/docs/develop/dapps/asset-processing/nfts.md b/docs/develop/dapps/asset-processing/nfts.md index a0a626b0a0..1e999e8440 100644 --- a/docs/develop/dapps/asset-processing/nfts.md +++ b/docs/develop/dapps/asset-processing/nfts.md @@ -187,7 +187,7 @@ var nft_msg = begin_cell() .store_uint(0x18, 6) .store_slice(nft_address) .store_coins(0) - .store_uint(0, 1 + 4 + 4 + 64 + 32 + 1 + 1) + .store_uint(0, 1 + 4 + 4 + 64 + 32 + 1 + 1) ;; message flags (see sending messages page) .store_uint(op::transfer(), 32) .store_uint(query_id, 64) .store_slice(sender_address) ;; new_owner_address diff --git a/docs/develop/func/cookbook.md b/docs/develop/func/cookbook.md index 05af6b9462..577dce2558 100644 --- a/docs/develop/func/cookbook.md +++ b/docs/develop/func/cookbook.md @@ -402,7 +402,7 @@ cell msg = begin_cell() .store_uint(0x18, 6) .store_slice(addr) .store_coins(amount) - .store_uint(0, 1 + 4 + 4 + 64 + 32 + 1 + 1) + .store_uint(0, 1 + 4 + 4 + 64 + 32 + 1 + 1) ;; message flags (see sending messages page) .store_uint(op, 32) .end_cell(); @@ -451,7 +451,7 @@ cell msg = begin_cell() .store_uint(0x18, 6) .store_slice(addr) .store_coins(amount) - .store_uint(0, 1 + 4 + 4 + 64 + 32 + 1) + .store_uint(0, 1 + 4 + 4 + 64 + 32 + 1) ;; message flags (see sending messages page) .store_uint(1, 1) ;; set bit to 1 to indicate that the cell will go on .store_ref(message_body) .end_cell(); @@ -500,7 +500,7 @@ cell msg = begin_cell() .store_uint(0x18, 6) .store_slice(addr) .store_coins(amount) - .store_uint(0, 1 + 4 + 4 + 64 + 32 + 1 + 1) + .store_uint(0, 1 + 4 + 4 + 64 + 32 + 1 + 1) ;; message flags (see sending messages page) .store_uint(op, 32) .store_slice(message_body) .end_cell(); @@ -1081,7 +1081,7 @@ cell msg = begin_cell() .store_uint(0x18, 6) ;; flags .store_slice("EQBIhPuWmjT7fP-VomuTWseE8JNWv2q7QYfsVQ1IZwnMk8wL"a) ;; destination address .store_coins(100) ;; amount of nanoTons to send - .store_uint(0, 1 + 4 + 4 + 64 + 32 + 1 + 1) ;; 107 zero-bits + .store_uint(0, 1 + 4 + 4 + 64 + 32 + 1 + 1) ;; message flags (see sending messages page) .store_uint(0, 32) ;; zero opcode - means simple transfer message with comment .store_slice("Hello from FunC!") ;; comment .end_cell(); @@ -1111,7 +1111,7 @@ The contract example below is useful to us if we need to perform any actions bet .store_uint(0x18, 6) .store_slice(addr) .store_coins(100) ;; just for example - .store_uint(0, 1 + 4 + 4 + 64 + 32 + 1 + 1) + .store_uint(0, 1 + 4 + 4 + 64 + 32 + 1 + 1) ;; message flags (see sending messages page) .store_slice(body) .end_cell(); send_raw_message(msg, mode); @@ -1133,7 +1133,7 @@ cell msg = begin_cell() .store_uint(0x18, 6) ;; flags .store_slice("EQBIhPuWmjT7fP-VomuTWseE8JNWv2q7QYfsVQ1IZwnMk8wL"a) ;; destination address .store_coins(0) ;; we don't care about this value right now - .store_uint(0, 1 + 4 + 4 + 64 + 32 + 1 + 1) ;; 107 zero-bits + .store_uint(0, 1 + 4 + 4 + 64 + 32 + 1 + 1) ;; message flags (see sending messages page) .store_uint(0, 32) ;; zero opcode - means simple transfer message with comment .store_slice("Hello from FunC!") ;; comment .end_cell(); @@ -1173,7 +1173,7 @@ cell msg = begin_cell() ;; We use literal `a` to get valid address inside slice from string containing address .store_slice("EQBIhPuWmjT7fP-VomuTWseE8JNWv2q7QYfsVQ1IZwnMk8wL"a) ;; destination address .store_coins(100) ;; amount of nanoTons to send - .store_uint(0, 1 + 4 + 4 + 64 + 32 + 1) ;; 106 zero-bits, necessary for internal messages + .store_uint(0, 1 + 4 + 4 + 64 + 32 + 1) ;; message flags (see sending messages page) .store_uint(1, 1) ;; we want to store body as a ref .store_ref(body) .end_cell(); diff --git a/docs/develop/smart-contracts/guidelines/random-number-generation.md b/docs/develop/smart-contracts/guidelines/random-number-generation.md index 89d955ac8b..bc20d821e8 100644 --- a/docs/develop/smart-contracts/guidelines/random-number-generation.md +++ b/docs/develop/smart-contracts/guidelines/random-number-generation.md @@ -52,7 +52,7 @@ The purpose of this contract is just to forward the message back to the sender. .store_uint(0x18, 6) .store_slice(sender) .store_coins(0) - .store_uint(0, 1 + 4 + 4 + 64 + 32 + 1 + 1) + .store_uint(0, 1 + 4 + 4 + 64 + 32 + 1 + 1) ;; message flags (see sending messages page) .store_slice(in_msg_body) .end_cell(), 64 + 2 ;; send the remaining value of an incoming msg & ignore errors @@ -87,7 +87,7 @@ const echo_address = "Ef8Nb7157K5bVxNKAvIWreRcF0RcUlzcCA7lwmewWVNtqM3s"a; .store_uint(0x18, 6) .store_slice(echo_address) .store_coins(0) - .store_uint(0, 1 + 4 + 4 + 64 + 32 + 1 + 1) + .store_uint(0, 1 + 4 + 4 + 64 + 32 + 1 + 1) ;; message flags (see sending messages page) .store_uint(1, 32) ;; let 1 be echo opcode in our contract .store_slice(sender) ;; forward user address .end_cell(), @@ -111,7 +111,7 @@ const echo_address = "Ef8Nb7157K5bVxNKAvIWreRcF0RcUlzcCA7lwmewWVNtqM3s"a; .store_uint(0x18, 6) .store_slice(user) .store_coins(2000000000) ;; 2 TON - .store_uint(0, 1 + 4 + 4 + 64 + 32 + 1 + 1) + .store_uint(0, 1 + 4 + 4 + 64 + 32 + 1 + 1) ;; message flags (see sending messages page) .end_cell(), 3 ;; ignore errors & pay fees separately ); diff --git a/docs/develop/smart-contracts/tutorials/wallet.md b/docs/develop/smart-contracts/tutorials/wallet.md index a247909643..a99db7d126 100644 --- a/docs/develop/smart-contracts/tutorials/wallet.md +++ b/docs/develop/smart-contracts/tutorials/wallet.md @@ -342,7 +342,7 @@ var msg = begin_cell() .store_uint(0x18, 6) ;; or 0x10 for non-bounce .store_slice(to_address) .store_coins(amount) - .store_uint(0, 1 + 4 + 4 + 64 + 32 + 1 + 1) + .store_uint(0, 1 + 4 + 4 + 64 + 32 + 1 + 1) ;; message flags (see sending messages page) ;; store something as a body ``` @@ -357,7 +357,7 @@ var msg = begin_cell() .store_uint(0, 2) ;; src -> two zero bits for addr_none .store_slice(to_address) .store_coins(amount) - .store_uint(0, 1 + 4 + 4 + 64 + 32 + 1 + 1) + .store_uint(0, 1 + 4 + 4 + 64 + 32 + 1 + 1) ;; message flags (see sending messages page) ;; store something as a body ``` Now let’s go through each option in detail: From b6d4cb6ccad15a27743b42bf44d979cfc755ae8c Mon Sep 17 00:00:00 2001 From: Gusarich Date: Fri, 17 Nov 2023 13:50:13 +0300 Subject: [PATCH 3/4] fix --- docs/develop/dapps/asset-processing/nfts.md | 2 +- docs/develop/func/cookbook.md | 14 +++++++------- docs/develop/howto/fees-low-level.md | 4 ++-- .../guidelines/random-number-generation.md | 6 +++--- docs/develop/smart-contracts/tutorials/wallet.md | 4 ++-- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/docs/develop/dapps/asset-processing/nfts.md b/docs/develop/dapps/asset-processing/nfts.md index 1e999e8440..323162d517 100644 --- a/docs/develop/dapps/asset-processing/nfts.md +++ b/docs/develop/dapps/asset-processing/nfts.md @@ -187,7 +187,7 @@ var nft_msg = begin_cell() .store_uint(0x18, 6) .store_slice(nft_address) .store_coins(0) - .store_uint(0, 1 + 4 + 4 + 64 + 32 + 1 + 1) ;; message flags (see sending messages page) + .store_uint(0, 1 + 4 + 4 + 64 + 32 + 1 + 1) ;; default message headers (see sending messages page) .store_uint(op::transfer(), 32) .store_uint(query_id, 64) .store_slice(sender_address) ;; new_owner_address diff --git a/docs/develop/func/cookbook.md b/docs/develop/func/cookbook.md index 577dce2558..c568549ce5 100644 --- a/docs/develop/func/cookbook.md +++ b/docs/develop/func/cookbook.md @@ -402,7 +402,7 @@ cell msg = begin_cell() .store_uint(0x18, 6) .store_slice(addr) .store_coins(amount) - .store_uint(0, 1 + 4 + 4 + 64 + 32 + 1 + 1) ;; message flags (see sending messages page) + .store_uint(0, 1 + 4 + 4 + 64 + 32 + 1 + 1) ;; default message headers (see sending messages page) .store_uint(op, 32) .end_cell(); @@ -451,7 +451,7 @@ cell msg = begin_cell() .store_uint(0x18, 6) .store_slice(addr) .store_coins(amount) - .store_uint(0, 1 + 4 + 4 + 64 + 32 + 1) ;; message flags (see sending messages page) + .store_uint(0, 1 + 4 + 4 + 64 + 32 + 1) ;; default message headers (see sending messages page) .store_uint(1, 1) ;; set bit to 1 to indicate that the cell will go on .store_ref(message_body) .end_cell(); @@ -500,7 +500,7 @@ cell msg = begin_cell() .store_uint(0x18, 6) .store_slice(addr) .store_coins(amount) - .store_uint(0, 1 + 4 + 4 + 64 + 32 + 1 + 1) ;; message flags (see sending messages page) + .store_uint(0, 1 + 4 + 4 + 64 + 32 + 1 + 1) ;; default message headers (see sending messages page) .store_uint(op, 32) .store_slice(message_body) .end_cell(); @@ -1081,7 +1081,7 @@ cell msg = begin_cell() .store_uint(0x18, 6) ;; flags .store_slice("EQBIhPuWmjT7fP-VomuTWseE8JNWv2q7QYfsVQ1IZwnMk8wL"a) ;; destination address .store_coins(100) ;; amount of nanoTons to send - .store_uint(0, 1 + 4 + 4 + 64 + 32 + 1 + 1) ;; message flags (see sending messages page) + .store_uint(0, 1 + 4 + 4 + 64 + 32 + 1 + 1) ;; default message headers (see sending messages page) .store_uint(0, 32) ;; zero opcode - means simple transfer message with comment .store_slice("Hello from FunC!") ;; comment .end_cell(); @@ -1111,7 +1111,7 @@ The contract example below is useful to us if we need to perform any actions bet .store_uint(0x18, 6) .store_slice(addr) .store_coins(100) ;; just for example - .store_uint(0, 1 + 4 + 4 + 64 + 32 + 1 + 1) ;; message flags (see sending messages page) + .store_uint(0, 1 + 4 + 4 + 64 + 32 + 1 + 1) ;; default message headers (see sending messages page) .store_slice(body) .end_cell(); send_raw_message(msg, mode); @@ -1133,7 +1133,7 @@ cell msg = begin_cell() .store_uint(0x18, 6) ;; flags .store_slice("EQBIhPuWmjT7fP-VomuTWseE8JNWv2q7QYfsVQ1IZwnMk8wL"a) ;; destination address .store_coins(0) ;; we don't care about this value right now - .store_uint(0, 1 + 4 + 4 + 64 + 32 + 1 + 1) ;; message flags (see sending messages page) + .store_uint(0, 1 + 4 + 4 + 64 + 32 + 1 + 1) ;; default message headers (see sending messages page) .store_uint(0, 32) ;; zero opcode - means simple transfer message with comment .store_slice("Hello from FunC!") ;; comment .end_cell(); @@ -1173,7 +1173,7 @@ cell msg = begin_cell() ;; We use literal `a` to get valid address inside slice from string containing address .store_slice("EQBIhPuWmjT7fP-VomuTWseE8JNWv2q7QYfsVQ1IZwnMk8wL"a) ;; destination address .store_coins(100) ;; amount of nanoTons to send - .store_uint(0, 1 + 4 + 4 + 64 + 32 + 1) ;; message flags (see sending messages page) + .store_uint(0, 1 + 4 + 4 + 64 + 32 + 1) ;; default message headers (see sending messages page) .store_uint(1, 1) ;; we want to store body as a ref .store_ref(body) .end_cell(); diff --git a/docs/develop/howto/fees-low-level.md b/docs/develop/howto/fees-low-level.md index a49859dae0..283936f4ed 100644 --- a/docs/develop/howto/fees-low-level.md +++ b/docs/develop/howto/fees-low-level.md @@ -79,7 +79,7 @@ slice payload_encoding(int a, int b, int c) { .store_uint(0x18, 6) .store_slice(destination) .store_coins(0) - .store_uint(0, 1 + 4 + 4 + 64 + 32 + 1 + 1) ;; message flags (see sending messages page) + .store_uint(0, 1 + 4 + 4 + 64 + 32 + 1 + 1) ;; default message headers (see sending messages page) .store_uint(0x33bbff77, 32) ;; op-code (see smart-contract guidelines) .store_uint(cur_lt(), 64) ;; query_id (see smart-contract guidelines) .store_slice(payload) @@ -107,7 +107,7 @@ builder payload_encoding(int a, int b, int c) { .store_uint(0x18, 6) .store_slice(destination) .store_coins(0) - .store_uint(0, 1 + 4 + 4 + 64 + 32 + 1 + 1) ;; message flags (see sending messages page) + .store_uint(0, 1 + 4 + 4 + 64 + 32 + 1 + 1) ;; default message headers (see sending messages page) .store_uint(0x33bbff77, 32) ;; op-code (see smart-contract guidelines) .store_uint(cur_lt(), 64) ;; query_id (see smart-contract guidelines) .store_builder(payload) diff --git a/docs/develop/smart-contracts/guidelines/random-number-generation.md b/docs/develop/smart-contracts/guidelines/random-number-generation.md index bc20d821e8..557d50ed6b 100644 --- a/docs/develop/smart-contracts/guidelines/random-number-generation.md +++ b/docs/develop/smart-contracts/guidelines/random-number-generation.md @@ -52,7 +52,7 @@ The purpose of this contract is just to forward the message back to the sender. .store_uint(0x18, 6) .store_slice(sender) .store_coins(0) - .store_uint(0, 1 + 4 + 4 + 64 + 32 + 1 + 1) ;; message flags (see sending messages page) + .store_uint(0, 1 + 4 + 4 + 64 + 32 + 1 + 1) ;; default message headers (see sending messages page) .store_slice(in_msg_body) .end_cell(), 64 + 2 ;; send the remaining value of an incoming msg & ignore errors @@ -87,7 +87,7 @@ const echo_address = "Ef8Nb7157K5bVxNKAvIWreRcF0RcUlzcCA7lwmewWVNtqM3s"a; .store_uint(0x18, 6) .store_slice(echo_address) .store_coins(0) - .store_uint(0, 1 + 4 + 4 + 64 + 32 + 1 + 1) ;; message flags (see sending messages page) + .store_uint(0, 1 + 4 + 4 + 64 + 32 + 1 + 1) ;; default message headers (see sending messages page) .store_uint(1, 32) ;; let 1 be echo opcode in our contract .store_slice(sender) ;; forward user address .end_cell(), @@ -111,7 +111,7 @@ const echo_address = "Ef8Nb7157K5bVxNKAvIWreRcF0RcUlzcCA7lwmewWVNtqM3s"a; .store_uint(0x18, 6) .store_slice(user) .store_coins(2000000000) ;; 2 TON - .store_uint(0, 1 + 4 + 4 + 64 + 32 + 1 + 1) ;; message flags (see sending messages page) + .store_uint(0, 1 + 4 + 4 + 64 + 32 + 1 + 1) ;; default message headers (see sending messages page) .end_cell(), 3 ;; ignore errors & pay fees separately ); diff --git a/docs/develop/smart-contracts/tutorials/wallet.md b/docs/develop/smart-contracts/tutorials/wallet.md index a99db7d126..e83a270a34 100644 --- a/docs/develop/smart-contracts/tutorials/wallet.md +++ b/docs/develop/smart-contracts/tutorials/wallet.md @@ -342,7 +342,7 @@ var msg = begin_cell() .store_uint(0x18, 6) ;; or 0x10 for non-bounce .store_slice(to_address) .store_coins(amount) - .store_uint(0, 1 + 4 + 4 + 64 + 32 + 1 + 1) ;; message flags (see sending messages page) + .store_uint(0, 1 + 4 + 4 + 64 + 32 + 1 + 1) ;; default message headers (see sending messages page) ;; store something as a body ``` @@ -357,7 +357,7 @@ var msg = begin_cell() .store_uint(0, 2) ;; src -> two zero bits for addr_none .store_slice(to_address) .store_coins(amount) - .store_uint(0, 1 + 4 + 4 + 64 + 32 + 1 + 1) ;; message flags (see sending messages page) + .store_uint(0, 1 + 4 + 4 + 64 + 32 + 1 + 1) ;; default message headers (see sending messages page) ;; store something as a body ``` Now let’s go through each option in detail: From c46640f7e950a21a6b07663864940b91e6a515b0 Mon Sep 17 00:00:00 2001 From: Gusarich Date: Fri, 17 Nov 2023 13:53:08 +0300 Subject: [PATCH 4/4] add one last comment --- docs/develop/smart-contracts/guidelines/get-methods.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/develop/smart-contracts/guidelines/get-methods.md b/docs/develop/smart-contracts/guidelines/get-methods.md index f7df215b25..6967ab5b99 100644 --- a/docs/develop/smart-contracts/guidelines/get-methods.md +++ b/docs/develop/smart-contracts/guidelines/get-methods.md @@ -340,7 +340,7 @@ int get_total() method_id { .store_uint(0x18, 6) .store_slice(sender) .store_coins(0) - .store_uint(0, 107) + .store_uint(0, 107) ;; default message headers (see sending messages page) .store_uint(3, 32) ;; response operation code .store_uint(total, 32) ;; the requested number .end_cell(), 64);