Transaction #13065

Hash 30eea070f9f2b0af47828c97ff66e29b18cc135ec8f95a20b00091c1181f9c46
Status Success
Timestamp 406 days ago - 4/7/2023, 5:07:12 PM UTC+0
Block 13065
Stamps Used 209
Burned Fee 0.01236686 TAU
From ff61544ea94eaaeb5df08ed863c4a938e9129aba6ceee5f31b6681bdede11b89 
Contract Name submission
Function Name submit_contract

Additional Info
Nonce 101
Processor a04b5891ef8cd27095373a4f75b899ec2bc0883c02e506a6a5b55b491998cc3f
Signature d73f4890d3923c5069a5d141a4de62c85ee855893244c57523d1099ed72b7c1151cf32f389ee7027b8082fcb2e542e04778d0d85bab7f53c0a51a30b51f1240e
Stamps Supplied 845
Stamps per TAU 169

Kwargs

code I = importlib random.seed() nft_collection_contract = Variable() owner = Variable() craftable_things = Hash(default_value=0) amount_crafted = Hash(default_value=0) currency_contract = Variable() @construct def seed(): nft_collection_contract.set("con_lamden_realm_v2") currency_contract.set("con_trt") owner.set(ctx.caller) @export def craft(item_type: str): assert craftable_things[item_type] != 0, "This item type is not craftable" cost = craftable_things[item_type]["cost"] I.import_module(currency_contract.get()).transfer_from(amount=cost, to="Burned", main_account=ctx.caller) attributes = craftable_things[item_type]["attributes"] final_metadata = {} for attribute in attributes: if isinstance(attributes[attribute], dict): # take into account the preferred attribute and weight it based on if the min or max is preferred without using uniform min_value = attributes[attribute]["min"] max_value = attributes[attribute]["max"] res = random.randint(min_value * 10, max_value * 10) / 10 if(min_value < 1): res = round(res,1) else: res = round(res) final_metadata[attribute] = res elif isinstance(attributes[attribute], list): final_metadata[attribute] = random.choice(attributes[attribute]) image = random.choice(craftable_things[item_type]["images"]) final_metadata["type"] = item_type amount_crafted[item_type] += 1 # Name will be the item type, but uppercase first letter + the amount crafted name = item_type.capitalize() + " #" + str(amount_crafted[item_type]) I.import_module(nft_collection_contract.get()).mint_nft(name=name, description="Item crafted by {}".format(ctx.caller), ipfs_image_url=image, metadata=final_metadata, amount=1) I.import_module(nft_collection_contract.get()).transfer(amount=1, to=ctx.caller, name=name) @export def set_nft_collection_contract(contract: str): assert ctx.caller == owner.get(), "Only the owner can set the NFT collection contract" nft_collection_contract.set(contract) @export def modify_craftable_things(item_type: str, cost: float, attributes: dict, images: list): assert ctx.caller == owner.get(), "Only the owner can modify the craftable things" # ex item_type = "weapon" # ex attributes = { # "cooldown": {"min": 0.1, "max": 2, "preferred": "min"}, # "damage" : {"min": 1, "max": 80, "preferred": "max"}, # "effect" : ["cosmicball", "natureball", "fireball"], # "max_distance" : {"min": 100, "max": 1000, "preferred": "max"} # } # ex images = ["https://nftstorage.link/ipfs/bafybeihpmoirvpgnt7m6lytm5xarhxncbugorg43pvmvgf5o7z3vegelbi/file", "https://nftstorage.link/ipfs/bafybeiaputppri6gm676y75kjtgd2we4sbm2dl2rmcshafc5shmfpgekmy/file", "https://nftstorage.link/ipfs/bafybeiez5v3zs2fcctzytchlwcgryu2k342sz2txypwunzgb7jdqtykwx4/file"] craftable_things[item_type] = {"attributes": attributes, "cost": cost, "images": images}
name con_crafter_v9

State Changes

Contract con_crafter_v9
Variable __code__
New Value I = importlib random.seed() __nft_collection_contract = Variable(contract='con_crafter_v9', name= 'nft_collection_contract') __owner = Variable(contract='con_crafter_v9', name='owner') __craftable_things = Hash(default_value=0, contract='con_crafter_v9', name= 'craftable_things') __amount_crafted = Hash(default_value=0, contract='con_crafter_v9', name= 'amount_crafted') __currency_contract = Variable(contract='con_crafter_v9', name= 'currency_contract') def ____(): __nft_collection_contract.set('con_lamden_realm_v2') __currency_contract.set('con_trt') __owner.set(ctx.caller) @__export('con_crafter_v9') def craft(item_type: str): assert __craftable_things[item_type ] != 0, 'This item type is not craftable' cost = __craftable_things[item_type]['cost'] I.import_module(__currency_contract.get()).transfer_from(amount=cost, to='Burned', main_account=ctx.caller) attributes = __craftable_things[item_type]['attributes'] final_metadata = {} for attribute in attributes: if isinstance(attributes[attribute], dict): min_value = attributes[attribute]['min'] max_value = attributes[attribute]['max'] res = random.randint(min_value * 10, max_value * 10) / 10 if min_value < 1: res = round(res, 1) else: res = round(res) final_metadata[attribute] = res elif isinstance(attributes[attribute], list): final_metadata[attribute] = random.choice(attributes[attribute]) image = random.choice(__craftable_things[item_type]['images']) final_metadata['type'] = item_type __amount_crafted[item_type] += 1 name = item_type.capitalize() + ' #' + str(__amount_crafted[item_type]) I.import_module(__nft_collection_contract.get()).mint_nft(name=name, description='Item crafted by {}'.format(ctx.caller), ipfs_image_url =image, metadata=final_metadata, amount=1) I.import_module(__nft_collection_contract.get()).transfer(amount=1, to= ctx.caller, name=name) @__export('con_crafter_v9') def set_nft_collection_contract(contract: str): assert ctx.caller == __owner.get( ), 'Only the owner can set the NFT collection contract' __nft_collection_contract.set(contract) @__export('con_crafter_v9') def modify_craftable_things(item_type: str, cost: float, attributes: dict, images: list): assert ctx.caller == __owner.get( ), 'Only the owner can modify the craftable things' __craftable_things[item_type] = {'attributes': attributes, 'cost': cost, 'images': images}
 
Contract con_crafter_v9
Variable __compiled__
New Value e3000000000000000000000000060000004000000073a000000065005a0165026a038300010065046400640164028d025a0565046400640364028d025a06650764046400640564068d035a08650764046400640764068d035a0965046400640864028d025a0a6409640a84005a0b650c64008301650d640b9c01640c640d840483015a0e650c64008301650d640e9c01640f6410840483015a0f650c64008301650d65106511651264119c0464126413840483015a13641453002915da0e636f6e5f637261667465725f7639da176e66745f636f6c6c656374696f6e5f636f6e74726163742902da08636f6e7472616374da046e616d65da056f776e6572e900000000da10637261667461626c655f7468696e67732903da0d64656661756c745f76616c756572030000007204000000da0e616d6f756e745f63726166746564da1163757272656e63795f636f6e7472616374630000000000000000000000000200000043000000732400000074006a0164018301010074026a0164028301010074036a0174046a05830101006400530029034eda13636f6e5f6c616d64656e5f7265616c6d5f7632da07636f6e5f7472742906da195f5f6e66745f636f6c6c656374696f6e5f636f6e7472616374da03736574da135f5f63757272656e63795f636f6e7472616374da075f5f6f776e6572da03637478da0663616c6c6572a90072130000007213000000da00da045f5f5f5f0e000000730600000000010a010a0172150000002901da096974656d5f747970656301000000000000000a0000000700000043000000736601000074007c00190064016b037314740164028301820174007c001900640319007d0174026a0374046a05830083016a067c01640474076a0864058d03010074007c001900640619007d0269007d0378907c0244005d887d0474097c027c041900740a830272ba7c027c041900640719007d057c027c041900640819007d06740b6a0c7c05640914007c0664091400830264091b007d077c05640a6b0072a8740d7c07640a83027d076e08740d7c0783017d077c077c037c043c00715274097c027c041900740e83027252740b6a0f7c027c04190083017c037c043c0071525700740b6a0f74007c001900640b190083017d087c007c03640c3c0074107c0005001900640a370003003c007c006a118300640d1700741274107c001900830117007d0974026a0374136a05830083016a147c09640e6a1574076a0883017c087c03640a640f8d05010074026a0374136a05830083016a16640a74076a087c0964108d0301006400530029114e72060000007a1f54686973206974656d2074797065206973206e6f7420637261667461626c65da04636f7374da064275726e65642903da06616d6f756e74da02746fda0c6d61696e5f6163636f756e74da0a61747472696275746573da036d696eda036d6178e90a000000e901000000da06696d61676573da04747970657a0220237a124974656d2063726166746564206279207b7d29057204000000da0b6465736372697074696f6eda0e697066735f696d6167655f75726cda086d65746164617461721900000029037219000000721a00000072040000002917da125f5f637261667461626c655f7468696e6773da0e417373657274696f6e4572726f72da0149da0d696d706f72745f6d6f64756c65720f000000da03676574da0d7472616e736665725f66726f6d72110000007212000000da0a6973696e7374616e6365da0464696374da0672616e646f6dda0772616e64696e74da05726f756e64da046c697374da0663686f696365da105f5f616d6f756e745f63726166746564da0a6361706974616c697a65da03737472720d000000da086d696e745f6e6674da06666f726d6174da087472616e73666572290a72160000007217000000721c000000da0e66696e616c5f6d65746164617461da09617474726962757465da096d696e5f76616c7565da096d61785f76616c7565da03726573da05696d6167657204000000721300000072130000007214000000da056372616674140000007336000000000206010e010c0110010c010c0104010a010e010c010c01180108010c0208010a010e011601120108011001180110010a010c011001723f00000029017203000000630100000000000000010000000200000043000000732400000074006a0174026a0383006b027316740464018301820174056a067c00830101006400530029024e7a324f6e6c7920746865206f776e65722063616e2073657420746865204e465420636f6c6c656374696f6e20636f6e74726163742907721100000072120000007210000000722a0000007227000000720d000000720e00000029017203000000721300000072130000007214000000da1b7365745f6e66745f636f6c6c656374696f6e5f636f6e74726163743400000073060000000002100106017240000000290472160000007217000000721c0000007221000000630400000000000000040000000400000043000000732a00000074006a0174026a0383006b02731674046401830182017c027c017c0364029c0374057c003c006400530029034e7a2e4f6e6c7920746865206f776e65722063616e206d6f646966792074686520637261667461626c65207468696e67732903721c000000721700000072210000002906721100000072120000007210000000722a00000072270000007226000000290472160000007217000000721c0000007221000000721300000072130000007214000000da176d6f646966795f637261667461626c655f7468696e67733b0000007308000000000310010601040172410000004e2914da09696d706f72746c69627228000000722e000000da0473656564da085661726961626c65720d0000007210000000da044861736872260000007233000000720f0000007215000000da085f5f6578706f72747235000000723f0000007240000000da05666c6f6174722d000000723100000072410000007213000000721300000072130000007214000000da083c6d6f64756c653e01000000732400000004010801040108010c0106010801060108010401080308060601101f0601100606010601
 
Contract con_crafter_v9
Variable __developer__
New Value ff61544ea94eaaeb5df08ed863c4a938e9129aba6ceee5f31b6681bdede11b89
 
Contract con_crafter_v9
Variable __owner__
New Value null
 
Contract con_crafter_v9
Variable __submitted__
New Value 2023,4,7,17,7,13,0
 
Contract con_crafter_v9
Variable currency_contract
New Value con_trt
 
Contract con_crafter_v9
Variable nft_collection_contract
New Value con_lamden_realm_v2
 
Contract con_crafter_v9
Variable owner
New Value ff61544ea94eaaeb5df08ed863c4a938e9129aba6ceee5f31b6681bdede11b89
 
Contract currency
Variable balances
Key ff61544ea94eaaeb5df08ed863c4a938e9129aba6ceee5f31b6681bdede11b89
New Value 1691.941341119549551635153044345387