Contract con_random_allocator

Created On
229 days ago - 10/26/2020, 8:18:08 AM UTC+0


Contract Code
1 import currency
2 S = Hash(default_value='', contract='con_random_allocator', name='S')
3
4
5 def ():
6 S['name'] = 'Random Dropper'
7 S['description'] = 'Send Random Tau'
8
9
10 @export('con_random_allocator')
11 def random_transfer(amount: int, receivers: list):
12 random.seed()
13 sender = ctx.caller
14 assert_balance(amount)
15 r_rec = str(random.choice(receivers))
16 currency.transfer_from(amount=amount, to=r_rec, main_account=sender)
17
18
19 def assert_balance(balance: int):
20 sender = ctx.caller
21 sender_balance = currency.balance_of(sender)
22 assert sender_balance >= balance, 'Transfer amount exceeds available token balance'
23

Byte Code
e300000000000000000000000005000000400000007348000000640064016c005a00650164026403640464058d035a026406640784005a036504640383016505650664089c026409640a840483015a076505640b9c01640c640d84045a0864015300290ee9000000004eda00da14636f6e5f72616e646f6d5f616c6c6f6361746f72da01532903da0d64656661756c745f76616c7565da08636f6e7472616374da046e616d6563000000000000000000000000030000004300000073140000006401740064023c006403740064043c006400530029054e7a0e52616e646f6d2044726f7070657272070000007a0f53656e642052616e646f6d20546175da0b6465736372697074696f6e2901da035f5f53a900720a000000720a0000007202000000da045f5f5f5f05000000730400000000010801720b0000002902da06616d6f756e74da09726563656976657273630200000000000000040000000500000043000000733800000074006a018300010074026a037d0274047c0083010100740574006a067c01830183017d0374076a087c007c037c0264018d0301006400530029024e2903720c000000da02746fda0c6d61696e5f6163636f756e742909da0672616e646f6dda0473656564da03637478da0663616c6c6572da105f5f6173736572745f62616c616e6365da03737472da0663686f696365da0863757272656e6379da0d7472616e736665725f66726f6d2904720c000000720d000000da0673656e646572da05725f726563720a000000720a0000007202000000da0f72616e646f6d5f7472616e736665720a000000730a00000000020801060108010e01721b0000002901da0762616c616e6365630100000000000000030000000200000043000000732400000074006a017d0174026a037c0183017d027c027c006b05732074046401830182016400530029024e7a2f5472616e7366657220616d6f756e74206578636565647320617661696c61626c6520746f6b656e2062616c616e63652905721200000072130000007217000000da0a62616c616e63655f6f66da0e417373657274696f6e4572726f722903721c0000007219000000da0e73656e6465725f62616c616e6365720a000000720a00000072020000007214000000130000007306000000000106010a01721400000029097217000000da04486173687209000000720b000000da085f5f6578706f7274da03696e74da046c697374721b0000007214000000720a000000720a000000720a0000007202000000da083c6d6f64756c653e01000000730a00000008010e03080506011208
Twitter @tauhq_com