1 |
import currency
|
2 |
import con_uwarriors_lst001
|
3 |
|
4 |
metadata = Hash(default_value=0)
|
5 |
balances = Hash(default_value=0)
|
6 |
wp = ForeignHash(foreign_contract='con_uwarriors_lst001', foreign_name='balances')
|
7 |
|
8 |
@construct
|
9 |
def seed():
|
10 |
metadata['operator'] = ctx.caller
|
11 |
metadata['cost'] = 500
|
12 |
|
13 |
|
14 |
@export
|
15 |
def change_metadata(key: str, value: int):
|
16 |
assert ctx.caller == metadata['operator'], 'Only operator can set metadata!'
|
17 |
metadata[key] = value
|
18 |
|
19 |
@export
|
20 |
def buy_box():
|
21 |
caller = ctx.caller
|
22 |
amount = metadata['cost']
|
23 |
assert wp[caller] >= amount , 'Not enough coins to send!'
|
24 |
con_uwarriors_lst001.transfer_from(amount, metadata['operator'], caller)
|
25 |
balances['counter'] += 1
|
26 |
return True
|
27 |
|
28 |
@export
|
29 |
def open_box():
|
30 |
caller = ctx.caller
|
31 |
return True
|
32 |
|
33 |
|
e300000000000000000000000006000000400000007380000000640064016c005a00640064016c015a01650264006402640364048d035a03650264006402640564048d035a046505640664056402640764088d045a066409640a84005a076508640283016509650a640b9c02640c640d840483015a0b650864028301640e640f840083015a0c65086402830164106411840083015a0d640153002912e9000000004eda10636f6e5f75775f626f785f6576656e74da086d657461646174612903da0d64656661756c745f76616c7565da08636f6e7472616374da046e616d65da0862616c616e636573da14636f6e5f7577617272696f72735f6c7374303031da0277702904da10666f726569676e5f636f6e7472616374da0c666f726569676e5f6e616d6572050000007206000000630000000000000000000000000300000043000000731600000074006a01740264013c006402740264033c006400530029044eda086f70657261746f7269f4010000da04636f73742903da03637478da0663616c6c6572da0a5f5f6d65746164617461a90072110000007211000000da00da045f5f5f5f0b000000730400000000010a0172130000002902da036b6579da0576616c7565630200000000000000020000000300000043000000732200000074006a017402640119006b02731674036402830182017c0174027c003c006400530029034e720c0000007a1f4f6e6c79206f70657261746f722063616e20736574206d65746164617461212904720e000000720f0000007210000000da0e417373657274696f6e4572726f72290272140000007215000000721100000072110000007212000000da0f6368616e67655f6d657461646174611000000073060000000002100106017217000000630000000000000000020000000400000043000000734800000074006a017d007402640119007d0174037c0019007c016b057322740464028301820174056a067c017402640319007c008303010074076404050019006405370003003c006406530029074e720d0000007a194e6f7420656e6f75676820636f696e7320746f2073656e6421720c000000da07636f756e746572e901000000542908720e000000720f0000007210000000da045f5f777072160000007208000000da0d7472616e736665725f66726f6dda0a5f5f62616c616e6365732902720f000000da06616d6f756e74721100000072110000007212000000da076275795f626f7817000000730c000000000206010801140112011001721e000000630000000000000000010000000100000043000000730a00000074006a017d006401530029024e542902720e000000720f0000002901720f000000721100000072110000007212000000da086f70656e5f626f7821000000730400000000020601721f000000290eda0863757272656e63797208000000da04486173687210000000721c000000da0b466f726569676e48617368721a0000007213000000da085f5f6578706f7274da03737472da03696e747217000000721e000000721f0000007211000000721100000072110000007212000000da083c6d6f64756c653e010000007314000000080108010e020e0204010c03080506011206100a