Contract con_blacktau

Lamden BlackJack 21


Txn 24h/Total
0
13461
Users 24h/Total
0
85
Stamps 24h/Total
0
768030

Created On
159 days ago - 9/30/2020, 6:23:55 AM UTC+0


Contract Code
1 import currency
2 balances = Hash(default_value=0, contract='con_blacktau', name='balances')
3 operator = Variable(contract='con_blacktau', name='operator')
4 distributionAmount = Variable(contract='con_blacktau', name=
5 'distributionAmount')
6 chipsValue = Variable(contract='con_blacktau', name='chipsValue')
7 symbol = Variable(contract='con_blacktau', name='symbol')
8
9
10 def (vk: str, chips_value: int):
11 balances[vk] = 10000000000
12 symbol.set('GIFI')
13 chipsValue.set(chips_value)
14 balances['chips_in_table'] = 0
15 balances['last_withdraw'] = 0
16 balances['big_win'] = 0
17 operator.set(vk)
18 distributionAmount.set(0)
19
20
21 @export('con_blacktau')
22 def buy_chips(amount: float):
23 assert amount > 0, 'Cannot send negative balances!'
24 account = ctx.caller
25 pool = operator.get()
26 new_amount = amount * chipsValue.get()
27 assert balances[pool] >= new_amount, 'Not enough chips to send!'
28 currency.transfer_from(amount, pool, account)
29 balances[pool] -= new_amount
30 balances[account] += new_amount
31 balances['chips_in_table'] += new_amount
32
33
34 @export('con_blacktau')
35 def set_winner_hand(amount: float, account: str, blackjack: bool):
36 assert_owner()
37 assert amount > 0, 'Cannot send negative balances!'
38 pool = operator.get()
39 assert balances[pool] >= amount, 'Not enough chips to send!'
40 balances[pool] -= amount
41 balances[account] += amount
42 balances['chips_in_table'] += amount
43 if blackjack is True:
44 balances[account, 'blackjack_hands'] += 1
45 balances[account, 'winner_hands'] += 1
46 if balances[account, 'plays_count'] is not None:
47 winratio = balances[account, 'winner_hands'] * 100 / balances[
48 account, 'plays_count']
49 else:
50 winratio = '0'
51 winratio = '{:.2f}'.format(winratio)
52 balances[account, 'win_ratio'] = winratio
53
54
55 @export('con_blacktau')
56 def tie_hand(amount: float, account: str):
57 assert_owner()
58 assert amount > 0, 'Cannot send negative balances!'
59 pool = operator.get()
60 assert balances[pool] >= amount, 'Not enough chips to send!'
61 balances[pool] -= amount
62 balances[account] += amount
63 balances['chips_in_table'] += amount
64
65
66 @export('con_blacktau')
67 def set_loser_hand(account: str):
68 assert_owner()
69 if balances[account, 'plays_count'] is not None:
70 winratio = balances[account, 'winner_hands'] * 100 / balances[
71 account, 'plays_count']
72 else:
73 winratio = '0'
74 winratio = '{:.2f}'.format(winratio)
75 balances[account, 'win_ratio'] = winratio
76
77
78 @export('con_blacktau')
79 def bet(amount: float, account: str):
80 assert_owner()
81 assert amount > 0, 'Cannot send negative balances!'
82 pool = operator.get()
83 assert balances[account] >= amount, 'Not enough chips to send!'
84 balances[account] -= amount
85 balances[pool] += amount
86 balances['chips_in_table'] -= amount
87 balances[account, 'plays_count'] += 1
88
89
90 @export('con_blacktau')
91 def bet_self(amount: float):
92 assert amount > 0, 'Cannot send negative balances!'
93 sender = ctx.caller
94 pool = operator.get()
95 assert balances[sender] >= amount, 'Not enough chips to send!'
96 balances[sender] -= amount
97 balances[pool] += amount
98 balances['chips_in_table'] -= amount
99 balances[sender, 'plays_count'] += 1
100
101
102 @export('con_blacktau')
103 def pay(amount: float, account: str):
104 assert_owner()
105 assert amount > 0, 'Cannot send negative balances!'
106 sender = operator.get()
107 assert balances[account] >= amount, 'Not enough chips to send!'
108 total_balance = amount / chipsValue.get()
109 currency.transfer_from(total_balance * decimal('0.98'), account, sender)
110 balances[account] -= amount
111 balances[sender] += amount
112 balances['chips_in_table'] -= amount
113 balances['last_withdraw'] = total_balance
114 distributionAmount.set(distributionAmount.get() + total_balance)
115
116
117 @export('con_blacktau')
118 def pay_self(porcent: float):
119 assert porcent > 0, 'Cannot send negative balances!'
120 assert porcent <= 100, 'Max send 100% of your balances!'
121 account = ctx.caller
122 sender = operator.get()
123 amount = balances[account] * (porcent / 100)
124 assert balances[account] >= amount, 'Not enough chips to send!'
125 total_balance = amount / chipsValue.get()
126 currency.transfer_from(total_balance * decimal('0.98'), account, sender)
127 balances[account] -= amount
128 balances[sender] += amount
129 balances['chips_in_table'] -= amount
130 balances['last_withdraw'] = total_balance
131 distributionAmount.set(distributionAmount.get() + total_balance)
132
133
134 @export('con_blacktau')
135 def transfer(amount: float, to: str):
136 sender = ctx.caller
137 assert amount > 0, 'Cannot send negative balances!'
138 assert balances[sender] >= amount, 'Not enough coins to send!'
139 balances[sender] -= amount
140 balances[to] += amount
141
142
143 @export('con_blacktau')
144 def withdrawFees(receiver: str):
145 assert_owner()
146 BASE = 80
147 sender = operator.get()
148 in_table = balances['chips_in_table'] / chipsValue.get()
149 availableToWithdraw = currency.balance_of(sender) - (in_table + BASE)
150 assert availableToWithdraw > 0, 'Not enough funds for fee withdrawal. Available Fees ' + availableToWithdraw
151 currency.transfer_from(availableToWithdraw * decimal('0.98'), receiver,
152 sender)
153
154
155 @export('con_blacktau')
156 def balance_of(account: str):
157 return balances[account]
158
159
160 @export('con_blacktau')
161 def allowance(owner: str, spender: str):
162 return balances[owner, spender]
163
164
165 @export('con_blacktau')
166 def approve(amount: float, to: str):
167 assert amount > 0, 'Cannot send negative balances!'
168 sender = ctx.caller
169 balances[sender, to] += amount
170 return balances[sender, to]
171
172
173 @export('con_blacktau')
174 def change_value(value: float):
175 assert_owner()
176 assert value > 0, 'Cannot send negative value!'
177 chipsValue.set(value)
178
179
180 def assert_owner():
181 assert ctx.caller == operator.get(), 'Only operator can call!'
182

Byte Code
e3000000000000000000000000050000004000000073a6010000640064016c005a00650164006402640364048d035a0265036402640564068d025a0465036402640764068d025a0565036402640864068d025a0665036402640964068d025a0765086509640a9c02640b640c84045a0a650b64028301650c640d9c01640e640f840483015a0d650b64028301650c6508650e64109c0364116412840483015a0f650b64028301650c650864139c0264146415840483015a10650b64028301650864169c0164176418840483015a11650b64028301650c650864139c026419641a840483015a12650b64028301650c640d9c01641b641c840483015a13650b64028301650c650864139c02641d641e840483015a14650b64028301650c641f9c0164206421840483015a15650b64028301650c650864229c0264236424840483015a16650b64028301650864259c0164266427840483015a17650b64028301650864169c0164286429840483015a18650b6402830165086508642a9c02642b642c840483015a19650b64028301650c650864229c02642d642e840483015a1a650b64028301650c642f9c0164306431840483015a1b6432643384005a1c640153002934e9000000004eda0c636f6e5f626c61636b746175da0862616c616e6365732903da0d64656661756c745f76616c7565da08636f6e7472616374da046e616d65da086f70657261746f72290272050000007206000000da12646973747269627574696f6e416d6f756e74da0a636869707356616c7565da0673796d626f6c2902da02766bda0b63686970735f76616c7565630200000000000000020000000300000043000000734c000000640174007c003c0074016a0264028301010074036a027c01830101006403740064043c006403740064053c006403740064063c0074046a027c008301010074056a026403830101006400530029074e6c03000000006417280900da04474946497201000000da0e63686970735f696e5f7461626c65da0d6c6173745f7769746864726177da076269675f77696e2906da0a5f5f62616c616e636573da085f5f73796d626f6cda03736574da0c5f5f636869707356616c7565da0a5f5f6f70657261746f72da145f5f646973747269627574696f6e416d6f756e742902720b000000720c000000a9007217000000da00da045f5f5f5f0a0000007310000000000108010a010a010801080108010a0172190000002901da06616d6f756e7463010000000000000004000000040000004300000073800000007c0064016b047310740064028301820174016a027d0174036a0483007d027c0074056a04830014007d0374067c0219007c036b05733e740064038301820174076a087c007c027c018303010074067c02050019007c03380003003c0074067c01050019007c03370003003c0074066404050019007c03370003003c006400530029054e72010000007a1e43616e6e6f742073656e64206e656761746976652062616c616e636573217a194e6f7420656e6f75676820636869707320746f2073656e6421720e0000002909da0e417373657274696f6e4572726f72da03637478da0663616c6c65727215000000da0367657472140000007211000000da0863757272656e6379da0d7472616e736665725f66726f6d2904721a000000da076163636f756e74da04706f6f6cda0a6e65775f616d6f756e74721700000072170000007218000000da096275795f636869707315000000731200000000021001060108010c0114010e011001100172240000002903721a0000007221000000da09626c61636b6a61636b63030000000000000005000000040000004300000073de0000007400830001007c0064016b047316740164028301820174026a0383007d0374047c0319007c006b057332740164038301820174047c03050019007c00380003003c0074047c01050019007c00370003003c0074046404050019007c00370003003c007c0264056b08727e74047c0164066602050019006407370003003c0074047c0164086602050019006407370003003c0074047c0164096602190064006b0972c074047c01640866021900640a140074047c016409660219001b007d046e04640b7d04640c6a057c0483017d047c0474047c01640d66023c0064005300290e4e72010000007a1e43616e6e6f742073656e64206e656761746976652062616c616e636573217a194e6f7420656e6f75676820636869707320746f2073656e6421720e00000054da0f626c61636b6a61636b5f68616e6473e901000000da0c77696e6e65725f68616e6473da0b706c6179735f636f756e74e964000000da01307a067b3a2e32667dda0977696e5f726174696f2906da0e5f5f6173736572745f6f776e6572721b0000007215000000721e0000007211000000da06666f726d61742905721a000000722100000072250000007222000000da0877696e726174696f721700000072170000007218000000da0f7365745f77696e6e65725f68616e6422000000732000000000020601100108011401100110011001080114011401100110010e0204010a0172300000002902721a000000722100000063020000000000000003000000040000004300000073660000007400830001007c0064016b047316740164028301820174026a0383007d0274047c0219007c006b057332740164038301820174047c02050019007c00380003003c0074047c01050019007c00370003003c0074046404050019007c00370003003c006400530029054e72010000007a1e43616e6e6f742073656e64206e656761746976652062616c616e636573217a194e6f7420656e6f75676820636869707320746f2073656e6421720e0000002905722d000000721b0000007215000000721e00000072110000002903721a00000072210000007222000000721700000072170000007218000000da087469655f68616e6437000000730e0000000002060110010801140110011001723100000029017221000000630100000000000000020000000400000043000000735200000074008300010074017c0064016602190064006b09723474017c006402660219006403140074017c006401660219001b007d016e0464047d0164056a027c0183017d017c0174017c00640666023c006400530029074e72290000007228000000722a000000722b0000007a067b3a2e32667d722c0000002903722d0000007211000000722e00000029027221000000722f000000721700000072170000007218000000da0e7365745f6c6f7365725f68616e6442000000730e00000000020601100110010e0204010a017232000000630200000000000000030000000400000043000000737a0000007400830001007c0064016b047316740164028301820174026a0383007d0274047c0119007c006b057332740164038301820174047c01050019007c00380003003c0074047c02050019007c00370003003c0074046404050019007c00380003003c0074047c0164056602050019006406370003003c006400530029074e72010000007a1e43616e6e6f742073656e64206e656761746976652062616c616e636573217a194e6f7420656e6f75676820636869707320746f2073656e6421720e000000722900000072270000002905722d000000721b0000007215000000721e00000072110000002903721a00000072210000007222000000721700000072170000007218000000da036265744e0000007310000000000206011001080114011001100110017233000000630100000000000000030000000400000043000000737a0000007c0064016b047310740064028301820174016a027d0174036a0483007d0274057c0119007c006b057332740064038301820174057c01050019007c00380003003c0074057c02050019007c00370003003c0074056404050019007c00380003003c0074057c0164056602050019006406370003003c006400530029074e72010000007a1e43616e6e6f742073656e64206e656761746976652062616c616e636573217a194e6f7420656e6f75676820636869707320746f2073656e6421720e000000722900000072270000002906721b000000721c000000721d0000007215000000721e00000072110000002903721a000000da0673656e6465727222000000721700000072170000007218000000da086265745f73656c665a000000731000000000021001060108011401100110011001723500000063020000000000000004000000040000004300000073a20000007400830001007c0064016b047316740164028301820174026a0383007d0274047c0119007c006b05733274016403830182017c0074056a0383001b007d0374066a077c0374086404830114007c017c028303010074047c01050019007c00380003003c0074047c02050019007c00370003003c0074046405050019007c00380003003c007c03740464063c0074096a0a74096a0383007c031700830101006400530029074e72010000007a1e43616e6e6f742073656e64206e656761746976652062616c616e636573217a194e6f7420656e6f75676820636869707320746f2073656e64217a04302e3938720e000000720f000000290b722d000000721b0000007215000000721e00000072110000007214000000721f0000007220000000da07646563696d616c721600000072130000002904721a00000072210000007234000000da0d746f74616c5f62616c616e6365721700000072170000007218000000da03706179660000007316000000000206011001080114010c011601100110011001080172380000002901da07706f7263656e7463010000000000000005000000040000004300000073c20000007c0064016b04731074006402830182017c0064036b017320740064048301820174016a027d0174036a0483007d0274057c0119007c0064031b0014007d0374057c0119007c036b05735274006405830182017c0374066a0483001b007d0474076a087c0474096406830114007c017c028303010074057c01050019007c03380003003c0074057c02050019007c03370003003c0074056407050019007c03380003003c007c04740564083c00740a6a0b740a6a0483007c041700830101006400530029094e72010000007a1e43616e6e6f742073656e64206e656761746976652062616c616e63657321722a0000007a1f4d61782073656e642031303025206f6620796f75722062616c616e636573217a194e6f7420656e6f75676820636869707320746f2073656e64217a04302e3938720e000000720f000000290c721b000000721c000000721d0000007215000000721e00000072110000007214000000721f00000072200000007236000000721600000072130000002905723900000072210000007234000000721a0000007237000000721700000072170000007218000000da087061795f73656c6675000000731a00000000021001100106010801100114010c0116011001100110010801723a0000002902721a000000da02746f630200000000000000030000000400000043000000734e00000074006a017d027c0064016b047316740264028301820174037c0219007c006b05732a740264038301820174037c02050019007c00380003003c0074037c01050019007c00370003003c006400530029044e72010000007a1e43616e6e6f742073656e64206e656761746976652062616c616e636573217a194e6f7420656e6f75676820636f696e7320746f2073656e64212904721c000000721d000000721b00000072110000002903721a000000723b0000007234000000721700000072170000007218000000da087472616e7366657286000000730a00000000020601100114011001723c0000002901da087265636569766572630100000000000000050000000400000043000000736200000074008300010064017d0174016a0283007d0274036402190074046a0283001b007d0374056a067c0283017c037c01170018007d047c0464036b047348740764047c0417008301820174056a087c0474096405830114007c007c02830301006400530029064ee950000000720e00000072010000007a344e6f7420656e6f7567682066756e647320666f7220666565207769746864726177616c2e20417661696c61626c652046656573207a04302e3938290a722d0000007215000000721e00000072110000007214000000721f000000da0a62616c616e63655f6f66721b000000722000000072360000002905723d000000da04424153457234000000da08696e5f7461626c65da13617661696c61626c65546f5769746864726177721700000072170000007218000000da0c7769746864726177466565738f0000007310000000000206010401080110011201140110017243000000630100000000000000010000000200000043000000730800000074007c001900530029014e2901721100000029017221000000721700000072170000007218000000723f0000009b00000073020000000002723f0000002902da056f776e6572da077370656e646572630200000000000000020000000300000043000000730c00000074007c007c0166021900530029014e29017211000000290272440000007245000000721700000072170000007218000000da09616c6c6f77616e6365a000000073020000000002724600000063020000000000000003000000040000004300000073360000007c0064016b047310740064028301820174016a027d0274037c027c016602050019007c00370003003c0074037c027c0166021900530029034e72010000007a1e43616e6e6f742073656e64206e656761746976652062616c616e636573212904721b000000721c000000721d00000072110000002903721a000000723b0000007234000000721700000072170000007218000000da07617070726f7665a50000007308000000000210010601140172470000002901da0576616c756563010000000000000001000000020000004300000073240000007400830001007c0064016b047316740164028301820174026a037c00830101006400530029034e72010000007a1b43616e6e6f742073656e64206e656761746976652076616c7565212904722d000000721b0000007214000000721300000029017248000000721700000072170000007218000000da0c6368616e67655f76616c7565ad00000073060000000002060110017249000000630000000000000000000000000200000043000000731a00000074006a0174026a0383006b02731674046401830182016400530029024e7a174f6e6c79206f70657261746f722063616e2063616c6c212905721c000000721d0000007215000000721e000000721b0000007217000000721700000072170000007218000000722d000000b400000073020000000001722d000000291d721f000000da04486173687211000000da085661726961626c657215000000721600000072140000007212000000da03737472da03696e747219000000da085f5f6578706f7274da05666c6f61747224000000da04626f6f6c723000000072310000007232000000723300000072350000007238000000723a000000723c0000007243000000723f000000724600000072470000007249000000722d0000007217000000721700000072170000007218000000da083c6d6f64756c653e01000000734800000008010e010c01040108010c010c03100b0601100c060114140601120a0601100b0601120b0601100b0601120e06011010060112080601100b06011004060112040601120706011006
Twitter @tauhq_com