Skip to content

Commit

Permalink
Merge pull request #26 from ton-blockchain/unpredictable_payouts
Browse files Browse the repository at this point in the history
Make payout contract address unpredictable in advance
  • Loading branch information
EmelyanenkoK authored Aug 13, 2023
2 parents d1eb3ba + 34da2c4 commit 35d676f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions contracts/address_calculations.func
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ cell calculate_payout_state_init(slice pool_address, int round_id, int distribut
content_dict~udict_set_ref(256, "uri"H, pack_metadata_value("my-custom-stake-address.ton"));
content_dict~udict_set_ref(256, "image"H, pack_metadata_value("my-custom-stake-address.ton/icon.img"));
content_dict~udict_set_ref(256, "render_type"H, pack_metadata_value("hidden"));
;; To make payout address unpredictable we use two sources of difficult to know in advance data:
;; Hash of contract storage and block random seed
randomize_lt();
content_dict~udict_set_ref(256, "random_seed"H, begin_cell().store_uint(random() >> 8, 256).store_uint(get_data().cell_hash(), 256).end_cell());
cell onchain_content = begin_cell().store_uint(0, 8).store_dict(content_dict).end_cell();


Expand Down

1 comment on commit 35d676f

@AbdurehmanKimoWabe
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi

Please sign in to comment.