ton-blockchain / stablecoin-contract

Sample code for centralised stablecoin jetton. TEP-74 and TEP-89 compatible

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

No way to do "delta" update

nns2009 opened this issue · comments

Update code overwrites the current state entirely:

set_data(new_data);
set_code(new_code);

This might become a problem with burn notifications after another issue (#19) is fixed: the admin must prepare the exact "new_data" taking into account the current "total_supply", but it might change after the update with "new_data" was sent to the network and before it was processed. Thus leading to inaccurate "total_supply" value on the master.

Possible solutions:

  1. Allow to submit custom data migration code
  2. Allow to pause burning functionality on master (bounce burn_notifications for the time of the update)
  3. (partial solution) Allow to skip data update (ifnot (null?(new_data)) set_data(new_data);)

Tidak mengerti

Since the mint, burn, and update function can only be called by an administrator - this avoids a race condition.