Contract con_uw_master_energy


Contract Code

1 import currency
2 import con_uwarriors_lst001
3 I = importlib
4
5 S = Hash(default_value=None)
6 metadata = Hash(default_value=0)
7 wp = ForeignHash(foreign_contract='con_uwarriors_lst001', foreign_name='balances')
8
9 @construct
10 def seed():
11 metadata['operator'] = ctx.caller
12 metadata['cost_1'] = 30
13 metadata['cost_2'] = 20
14
15
16 @export
17 def operator_transfer_thing(uid: str, new_owner: str, contract: str, item_contract: str):
18 assert ctx.caller == metadata['operator'], 'Only auction operator can transfer things from contract.'
19 thing_master_contract = I.import_module(contract)
20 thing_master_contract.transfer(uid=uid, new_owner=new_owner, contract=item_contract)
21 S[uid] = False
22
23 @export
24 def operator_transfer_currency(amount: str, to: float):
25 assert ctx.caller == metadata['operator'], 'Only auction operator can transfer currency from contract.'
26 con_uwarriors_lst001.transfer(amount=amount, to=to)
27
28
29 @export
30 def buy_drink_full():
31 sender = ctx.caller
32 amount = metadata['cost_1']
33 operator = metadata['operator']
34 assert wp[sender] >= amount , 'Not enough coins to send!'
35 con_uwarriors_lst001.transfer_from(amount, metadata['operator'], sender)
36
37
38 @export
39 def buy_drink_half():
40 sender = ctx.caller
41 amount = metadata['cost_2']
42 operator = metadata['operator']
43 assert wp[sender] >= amount , 'Not enough coins to send!'
44 con_uwarriors_lst001.transfer_from(amount, metadata['operator'], sender)
45
46
47 @export
48 def consume_drink(contract: str, item_contract: str, uid: str, character: str):
49 thing_master_contract = I.import_module(contract)
50 thing_master_contract.transfer_from(
51 uid=uid,
52 to=ctx.this,
53 main_account=ctx.caller,
54 contract=item_contract)

Byte Code

e3000000000000000000000000060000004000000073bc000000640064016c005a00640064016c015a0165025a03650464016402640364048d035a05650464006402640564048d035a066507640664076402640864098d045a08640a640b84005a09650a64028301650b650b650b650b640c9c04640d640e840483015a0c650a64028301650b650d640f9c0264106411840483015a0e650a6402830164126413840083015a0f650a6402830164146415840083015a10650a64028301650b650b650b650b64169c0464176418840483015a11640153002919e9000000004eda14636f6e5f75775f6d61737465725f656e65726779da01532903da0d64656661756c745f76616c7565da08636f6e7472616374da046e616d65da086d65746164617461da14636f6e5f7577617272696f72735f6c7374303031da0862616c616e636573da0277702904da10666f726569676e5f636f6e7472616374da0c666f726569676e5f6e616d6572050000007206000000630000000000000000000000000300000043000000731e00000074006a01740264013c006402740264033c006404740264053c006400530029064eda086f70657261746f72e91e000000da06636f73745f31e914000000da06636f73745f322903da03637478da0663616c6c6572da0a5f5f6d65746164617461a90072150000007215000000da00da045f5f5f5f0b000000730600000000010a01080172170000002904da03756964da096e65775f6f776e65727205000000da0d6974656d5f636f6e7472616374630400000000000000050000000500000043000000733c00000074006a017402640119006b027316740364028301820174046a057c0283017d047c046a067c007c017c0364038d030100640474077c003c006400530029054e720d0000007a384f6e6c792061756374696f6e206f70657261746f722063616e207472616e73666572207468696e67732066726f6d20636f6e74726163742e2903721800000072190000007205000000462908721200000072130000007214000000da0e417373657274696f6e4572726f72da0149da0d696d706f72745f6d6f64756c65da087472616e73666572da035f5f532905721800000072190000007205000000721a000000da157468696e675f6d61737465725f636f6e7472616374721500000072150000007216000000da176f70657261746f725f7472616e736665725f7468696e6711000000730c0000000003100106010a010801080172210000002902da06616d6f756e74da02746f630200000000000000020000000400000043000000732800000074006a017402640119006b027316740364028301820174046a057c007c0164038d0201006400530029044e720d0000007a3a4f6e6c792061756374696f6e206f70657261746f722063616e207472616e736665722063757272656e63792066726f6d20636f6e74726163742e2902722200000072230000002906721200000072130000007214000000721b0000007208000000721e000000290272220000007223000000721500000072150000007216000000da1a6f70657261746f725f7472616e736665725f63757272656e63791c00000073060000000002100106017224000000630000000000000000030000000400000043000000734000000074006a017d007402640119007d017402640219007d0274037c0019007c016b05732a740464038301820174056a067c017402640219007c00830301006400530029044e720f000000720d0000007a194e6f7420656e6f75676820636f696e7320746f2073656e64212907721200000072130000007214000000da045f5f7770721b0000007208000000da0d7472616e736665725f66726f6d2903da0673656e6465727222000000720d000000721500000072150000007216000000da0e6275795f6472696e6b5f66756c6c23000000730a000000000206010801080114017228000000630000000000000000030000000400000043000000734000000074006a017d007402640119007d017402640219007d0274037c0019007c016b05732a740464038301820174056a067c017402640219007c00830301006400530029044e7211000000720d0000007a194e6f7420656e6f75676820636f696e7320746f2073656e642129077212000000721300000072140000007225000000721b00000072080000007226000000290372270000007222000000720d000000721500000072150000007216000000da0e6275795f6472696e6b5f68616c662c000000730a00000000020601080108011401722900000029047205000000721a0000007218000000da09636861726163746572630400000000000000050000000600000043000000732400000074006a017c0083017d047c046a027c0274036a0474036a057c0164018d0401006400530029024e290472180000007223000000da0c6d61696e5f6163636f756e7472050000002906721c000000721d00000072260000007212000000da0474686973721300000029057205000000721a0000007218000000722a0000007220000000721500000072150000007216000000da0d636f6e73756d655f6472696e6b35000000730600000000020a010a01722d0000002912da0863757272656e63797208000000da09696d706f72746c6962721c000000da0448617368721f0000007214000000da0b466f726569676e4861736872250000007217000000da085f5f6578706f7274da037374727221000000da05666c6f6174722400000072280000007229000000722d0000007215000000721500000072150000007216000000da083c6d6f64756c653e0100000073220000000801080104010e010601080104010c03080606010601100906011206100910090601