Contract con_uw_evolve


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 balances = Hash(default_value=0)
8 wp = ForeignHash(foreign_contract='con_uwarriors_lst001', foreign_name='balances')
9
10 @construct
11 def seed():
12 metadata['operator'] = ctx.caller
13 metadata['cost_1'] = 30
14
15 @export
16 def operator_transfer_thing(uid: str, new_owner: str, contract: str, item_contract: str):
17 assert ctx.caller == metadata['operator'], 'Only auction operator can transfer things from contract.'
18 thing_master_contract = I.import_module(contract)
19 thing_master_contract.transfer(uid=uid, new_owner=new_owner, contract=item_contract)
20 S[uid] = False
21
22 @export
23 def operator_transfer_currency(amount: str, to: float):
24 assert ctx.caller == metadata['operator'], 'Only auction operator can transfer currency from contract.'
25 con_uwarriors_lst001.transfer(amount=amount, to=to)
26
27
28 @export
29 def consume_crystal(contract: str, item_contract: str, uid: str, character: str):
30 sender = ctx.caller
31 amount = metadata['cost_1']
32 operator = metadata['operator']
33 assert wp[sender] >= amount , 'Not enough coins to send!'
34
35 con_uwarriors_lst001.transfer_from(amount, metadata['operator'], sender)
36
37 thing_master_contract = I.import_module(contract)
38 thing_master_contract.transfer_from(
39 uid=uid,
40 to=ctx.this,
41 main_account=ctx.caller,
42 contract=item_contract)

Byte Code

e3000000000000000000000000060000004000000073aa000000640064016c005a00640064016c015a0165025a03650464016402640364048d035a05650464006402640564048d035a06650464006402640664048d035a076508640764066402640864098d045a09640a640b84005a0a650b64028301650c650c650c650c640c9c04640d640e840483015a0d650b64028301650c650e640f9c0264106411840483015a0f650b64028301650c650c650c650c64129c0464136414840483015a10640153002915e9000000004eda0d636f6e5f75775f65766f6c7665da01532903da0d64656661756c745f76616c7565da08636f6e7472616374da046e616d65da086d65746164617461da0862616c616e636573da14636f6e5f7577617272696f72735f6c7374303031da0277702904da10666f726569676e5f636f6e7472616374da0c666f726569676e5f6e616d6572050000007206000000630000000000000000000000000300000043000000731600000074006a01740264013c006402740264033c006400530029044eda086f70657261746f72e91e000000da06636f73745f312903da03637478da0663616c6c6572da0a5f5f6d65746164617461a90072130000007213000000da00da045f5f5f5f0b000000730400000000010a0172150000002904da03756964da096e65775f6f776e65727205000000da0d6974656d5f636f6e7472616374630400000000000000050000000500000043000000733c00000074006a017402640119006b027316740364028301820174046a057c0283017d047c046a067c007c017c0364038d030100640474077c003c006400530029054e720d0000007a384f6e6c792061756374696f6e206f70657261746f722063616e207472616e73666572207468696e67732066726f6d20636f6e74726163742e2903721600000072170000007205000000462908721000000072110000007212000000da0e417373657274696f6e4572726f72da0149da0d696d706f72745f6d6f64756c65da087472616e73666572da035f5f5329057216000000721700000072050000007218000000da157468696e675f6d61737465725f636f6e7472616374721300000072130000007214000000da176f70657261746f725f7472616e736665725f7468696e6710000000730c0000000003100106010a0108010801721f0000002902da06616d6f756e74da02746f630200000000000000020000000400000043000000732800000074006a017402640119006b027316740364028301820174046a057c007c0164038d0201006400530029044e720d0000007a3a4f6e6c792061756374696f6e206f70657261746f722063616e207472616e736665722063757272656e63792066726f6d20636f6e74726163742e290272200000007221000000290672100000007211000000721200000072190000007209000000721c000000290272200000007221000000721300000072130000007214000000da1a6f70657261746f725f7472616e736665725f63757272656e63791b000000730600000000021001060172220000002904720500000072180000007216000000da09636861726163746572630400000000000000080000000600000043000000736000000074006a017d047402640119007d057402640219007d0674037c0419007c056b05732a740464038301820174056a067c057402640219007c048303010074076a087c0083017d077c076a067c0274006a0974006a017c0164048d0401006400530029054e720f000000720d0000007a194e6f7420656e6f75676820636f696e7320746f2073656e6421290472160000007221000000da0c6d61696e5f6163636f756e747205000000290a721000000072110000007212000000da045f5f777072190000007209000000da0d7472616e736665725f66726f6d721a000000721b000000da047468697329087205000000721800000072160000007223000000da0673656e6465727220000000720d000000721e000000721300000072130000007214000000da0f636f6e73756d655f6372797374616c2200000073100000000003060108010801140112010a010a0172290000002911da0863757272656e63797209000000da09696d706f72746c6962721a000000da0448617368721d0000007212000000da0a5f5f62616c616e636573da0b466f726569676e4861736872250000007215000000da085f5f6578706f7274da03737472721f000000da05666c6f6174722200000072290000007213000000721300000072130000007214000000da083c6d6f64756c653e01000000731e0000000801080104010e010e010e0104010c030805060106011009060112060601