Skip to content

Commit f13a069

Browse files
authored
Merge pull request #629 from pixelplex/storage_fee_example
update fee calculation example
2 parents a9a5a2a + 08f374f commit f13a069

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

docs/develop/smart-contracts/fee-calculation.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,10 @@ const int RESERVE_AT_MOST = 2;
5454
;;; in the case of action fail - bounce transaction. No effect if RESERVE_AT_MOST (+2) is used. TVM UPGRADE 2023-07. https://docs.ton.org/learn/tvm-instructions/tvm-upgrade-2023-07#sending-messages
5555
const int RESERVE_BOUNCE_ON_ACTION_FAIL = 16;
5656
57-
() calculate_and_reserve_storage_fee(int balance, int msg_value, int workchain, int seconds, int bits, int cells) inline {
58-
int to_leave_on_balance = my_ton_balance - msg_value + my_storage_due();
57+
() calculate_and_reserve_at_most_storage_fee(int balance, int msg_value, int workchain, int seconds, int bits, int cells) inline {
58+
int on_balance_before_msg = my_ton_balance - msg_value;
5959
int min_storage_fee = get_storage_fee(workchain, seconds, bits, cells); ;; can be hardcoded IF CODE OF THE CONTRACT WILL NOT BE UPDATED
60-
raw_reserve(max(to_leave_on_balance, min_storage_fee), RESERVE_AT_MOST);
60+
raw_reserve(max(on_balance_before_msg, min_storage_fee + my_storage_due()), RESERVE_AT_MOST);
6161
}
6262
```
6363

0 commit comments

Comments
 (0)