Skip to content

Commit

Permalink
Merge pull request ton-community#629 from pixelplex/storage_fee_example
Browse files Browse the repository at this point in the history
update fee calculation example
  • Loading branch information
reveloper authored Jun 19, 2024
2 parents a9a5a2a + 08f374f commit f13a069
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions docs/develop/smart-contracts/fee-calculation.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ const int RESERVE_AT_MOST = 2;
;;; 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
const int RESERVE_BOUNCE_ON_ACTION_FAIL = 16;
() calculate_and_reserve_storage_fee(int balance, int msg_value, int workchain, int seconds, int bits, int cells) inline {
int to_leave_on_balance = my_ton_balance - msg_value + my_storage_due();
() calculate_and_reserve_at_most_storage_fee(int balance, int msg_value, int workchain, int seconds, int bits, int cells) inline {
int on_balance_before_msg = my_ton_balance - msg_value;
int min_storage_fee = get_storage_fee(workchain, seconds, bits, cells); ;; can be hardcoded IF CODE OF THE CONTRACT WILL NOT BE UPDATED
raw_reserve(max(to_leave_on_balance, min_storage_fee), RESERVE_AT_MOST);
raw_reserve(max(on_balance_before_msg, min_storage_fee + my_storage_due()), RESERVE_AT_MOST);
}
```

Expand Down

0 comments on commit f13a069

Please sign in to comment.