Transaction #1269216

Hash 82b99cc6c2d0c4e1b79259960a52ca913e9717cbcaa74175fa44566d7158398d
Status Success
Timestamp 467 days ago - 1/17/2023, 8:13:26 PM UTC+0
Block 1219549
Stamps Used 364
Burned Fee 0.02153846 TAU
From ff61544ea94eaaeb5df08ed863c4a938e9129aba6ceee5f31b6681bdede11b89 
Contract Name submission
Function Name submit_contract

Additional Info
SubBlock Number 0
Nonce 2746
Processor 5b09493df6c18d17cc883ebce54fcb1f5afbd507533417fe32c006009a9c3c4a
Signature 33a8153039029c132e99df843b083f554d873d3a5e86228c329d0a11049560ece7cbcabae5279e58e845524de82aa6c8be9aebb5296ffa5ec18b22a55a9b2305
Stamps Supplied 845
Stamps per TAU 169

Kwargs

code # Unique NFTs with examples for other devs I = importlib random.seed() import currency collection_name = Variable() collection_owner = Variable() collection_nfts = Hash(default_value=0) collection_balances = Hash(default_value=0) collection_balances_approvals = Hash(default_value=0) last_mint_id = Variable() NFT_DESCRIPTION = "A MERGEN NFT which is either a result of combining, slashing or minting using the contract" NFT_DEFAULT_IMG = "https://nftstorage.link/ipfs/bafybeid2msdduqifbcvhrteumzmwtwtsll534rl35o2auiroe45z4vzvke/file" @construct def seed(): collection_name.set("MERGEN") collection_owner.set(ctx.caller) last_mint_id.set(0) @export def transfer(name: str, amount:int, to: str): assert amount > 0, "You cannot transfer negative amounts" assert name != "", "Please specify the name of the NFT you want to transfer" assert collection_balances[ctx.caller, name] >= amount, "You dont have enough NFTs to send" collection_balances[ctx.caller, name] -= amount collection_balances[to, name] += amount # Adds amount to receiver @export def approve(amount: int, name: str, to: str): assert amount > 0, "Cannot approve negative amounts" collection_balances_approvals[ctx.caller, to, name] += amount @export def transfer_from(name:str, amount:int, to: str, main_account: str): assert amount > 0, "Cannot send negative balances!" assert collection_balances_approvals[main_account, to, name] >= amount, "Not enough NFTs approved to send! You have {} and are trying to spend {}".format(collection_balances_approvals[main_account, to, name], amount) assert collection_balances[main_account, name] >= amount, "Not enough NFTs to send!" collection_balances_approvals[main_account, to, name] -= amount collection_balances[main_account, name] -= amount collection_balances[to, name] += amount @export def mint_nft(): # Minting 1 NFTs creates a starter with a random value from 0, 100 for 5 TAU base price. currency.transfer_from(amount=5, to=collection_owner.get(), main_account=ctx.caller) new_id = last_mint_id.get() + 1 name = f"MERGEN #{new_id}" last_mint_id.set(new_id) metadata = { "value": random.randint(1, 100) } collection_nfts[name] = {"description": NFT_DESCRIPTION, "ipfs_image_url": NFT_DEFAULT_IMG, "metadata": metadata, "amount": 1} collection_balances[ctx.caller, name] = 1 @export def combine_nft(nft_name_1: str, nft_name_2:str): # Combing 2 NFTs creates 1 NFT with it's values combined assert collection_balances[ctx.caller, nft_name_1] >= 1, "Not enough NFTs to send!" assert collection_balances[ctx.caller, nft_name_2] >= 1, "Not enough NFTs to send!" collection_balances[ctx.caller, nft_name_1] -= 1 collection_balances[ctx.caller, nft_name_2] -= 1 transfer_from(name=nft_name_1, amount=1, to="BURN", main_account=ctx.caller) transfer_from(name=nft_name_2, amount=1, to="BURN", main_account=ctx.caller) first_nft_metadata = collection_nfts[nft_name_1]["metadata"] second_nft_metadata = collection_nfts[nft_name_2]["metadata"] for key in second_nft_metadata: second_nft_metadata[key] = second_nft_metadata[key] + first_nft_metadata[key] result_nft_metadata = {**a, **b} new_id = last_mint_id.get() + 1 name = f"MERGEN #{new_id}" last_mint_id.set(new_id) collection_nfts[name] = {"description": NFT_DESCRIPTION, "ipfs_image_url": NFT_DEFAULT_IMG, "metadata": result_nft_metadata, "amount": 1} collection_balances[ctx.caller, name] = 1 @export def slash_nft(nft_name: str): # Slashing 1 NFT creates 2 NFTs with each having half it's value assert collection_balances[ctx.caller, nft_name] >= 1, "Not enough NFTs to send!" collection_balances[ctx.caller, nft_name] -= 1 nft_metadata = collection_nfts[nft_name]["metadata"] new_nft_metadata = {} for key in new_nft_metadata: new_nft_metadata[key] = nft_metadata[key] / 2 new_id = last_mint_id.get() + 1 name = f"MERGEN #{new_id}" last_mint_id.set(new_id) collection_nfts[name] = {"description": NFT_DESCRIPTION, "ipfs_image_url": NFT_DEFAULT_IMG, "metadata": new_nft_metadata, "amount": 1} collection_balances[ctx.caller, name] = 1 new_id = last_mint_id.get() + 1 name = f"MERGEN #{new_id}" last_mint_id.set(new_id) collection_nfts[name] = {"description": NFT_DESCRIPTION, "ipfs_image_url": NFT_DEFAULT_IMG, "metadata": new_nft_metadata, "amount": 1} collection_balances[ctx.caller, name] = 1
name con_mergen_nfts_v2

State Changes

Contract con_mergen_nfts_v2
Variable collection_name
New Value MERGEN
 
Contract con_mergen_nfts_v2
Variable collection_owner
New Value ff61544ea94eaaeb5df08ed863c4a938e9129aba6ceee5f31b6681bdede11b89
 
Contract con_mergen_nfts_v2
Variable last_mint_id
New Value 0
 
Contract con_mergen_nfts_v2
Variable __code__
New Value I = importlib random.seed() import currency __collection_name = Variable(contract='con_mergen_nfts_v2', name= 'collection_name') __collection_owner = Variable(contract='con_mergen_nfts_v2', name= 'collection_owner') __collection_nfts = Hash(default_value=0, contract='con_mergen_nfts_v2', name='collection_nfts') __collection_balances = Hash(default_value=0, contract='con_mergen_nfts_v2', name='collection_balances') __collection_balances_approvals = Hash(default_value=0, contract= 'con_mergen_nfts_v2', name='collection_balances_approvals') __last_mint_id = Variable(contract='con_mergen_nfts_v2', name='last_mint_id') NFT_DESCRIPTION = ( 'A MERGEN NFT which is either a result of combining, slashing or minting using the contract' ) NFT_DEFAULT_IMG = ( 'https://nftstorage.link/ipfs/bafybeid2msdduqifbcvhrteumzmwtwtsll534rl35o2auiroe45z4vzvke/file' ) def ____(): __collection_name.set('MERGEN') __collection_owner.set(ctx.caller) __last_mint_id.set(0) @__export('con_mergen_nfts_v2') def transfer(name: str, amount: int, to: str): assert amount > 0, 'You cannot transfer negative amounts' assert name != '', 'Please specify the name of the NFT you want to transfer' assert __collection_balances[ctx.caller, name ] >= amount, 'You dont have enough NFTs to send' __collection_balances[ctx.caller, name] -= amount __collection_balances[to, name] += amount @__export('con_mergen_nfts_v2') def approve(amount: int, name: str, to: str): assert amount > 0, 'Cannot approve negative amounts' __collection_balances_approvals[ctx.caller, to, name] += amount @__export('con_mergen_nfts_v2') def transfer_from(name: str, amount: int, to: str, main_account: str): assert amount > 0, 'Cannot send negative balances!' assert __collection_balances_approvals[main_account, to, name ] >= amount, 'Not enough NFTs approved to send! You have {} and are trying to spend {}'.format( __collection_balances_approvals[main_account, to, name], amount) assert __collection_balances[main_account, name ] >= amount, 'Not enough NFTs to send!' __collection_balances_approvals[main_account, to, name] -= amount __collection_balances[main_account, name] -= amount __collection_balances[to, name] += amount @__export('con_mergen_nfts_v2') def mint_nft(): currency.transfer_from(amount=5, to=__collection_owner.get(), main_account=ctx.caller) new_id = __last_mint_id.get() + 1 name = f'MERGEN #{new_id}' __last_mint_id.set(new_id) metadata = {'value': random.randint(1, 100)} __collection_nfts[name] = {'description': NFT_DESCRIPTION, 'ipfs_image_url': NFT_DEFAULT_IMG, 'metadata': metadata, 'amount': 1} __collection_balances[ctx.caller, name] = 1 @__export('con_mergen_nfts_v2') def combine_nft(nft_name_1: str, nft_name_2: str): assert __collection_balances[ctx.caller, nft_name_1 ] >= 1, 'Not enough NFTs to send!' assert __collection_balances[ctx.caller, nft_name_2 ] >= 1, 'Not enough NFTs to send!' __collection_balances[ctx.caller, nft_name_1] -= 1 __collection_balances[ctx.caller, nft_name_2] -= 1 transfer_from(name=nft_name_1, amount=1, to='BURN', main_account=ctx.caller ) transfer_from(name=nft_name_2, amount=1, to='BURN', main_account=ctx.caller ) first_nft_metadata = __collection_nfts[nft_name_1]['metadata'] second_nft_metadata = __collection_nfts[nft_name_2]['metadata'] for key in second_nft_metadata: second_nft_metadata[key] = second_nft_metadata[key ] + first_nft_metadata[key] result_nft_metadata = {**a, **b} new_id = __last_mint_id.get() + 1 name = f'MERGEN #{new_id}' __last_mint_id.set(new_id) __collection_nfts[name] = {'description': NFT_DESCRIPTION, 'ipfs_image_url': NFT_DEFAULT_IMG, 'metadata': result_nft_metadata, 'amount': 1} __collection_balances[ctx.caller, name] = 1 @__export('con_mergen_nfts_v2') def slash_nft(nft_name: str): assert __collection_balances[ctx.caller, nft_name ] >= 1, 'Not enough NFTs to send!' __collection_balances[ctx.caller, nft_name] -= 1 nft_metadata = __collection_nfts[nft_name]['metadata'] new_nft_metadata = {} for key in new_nft_metadata: new_nft_metadata[key] = nft_metadata[key] / 2 new_id = __last_mint_id.get() + 1 name = f'MERGEN #{new_id}' __last_mint_id.set(new_id) __collection_nfts[name] = {'description': NFT_DESCRIPTION, 'ipfs_image_url': NFT_DEFAULT_IMG, 'metadata': new_nft_metadata, 'amount': 1} __collection_balances[ctx.caller, name] = 1 new_id = __last_mint_id.get() + 1 name = f'MERGEN #{new_id}' __last_mint_id.set(new_id) __collection_nfts[name] = {'description': NFT_DESCRIPTION, 'ipfs_image_url': NFT_DEFAULT_IMG, 'metadata': new_nft_metadata, 'amount': 1} __collection_balances[ctx.caller, name] = 1
 
Contract con_mergen_nfts_v2
Variable __compiled__
New Value e30000000000000000000000000600000040000000730401000065005a0165026a0383000100640064016c045a0465056402640364048d025a0665056402640564048d025a07650864006402640664078d035a09650864006402640864078d035a0a650864006402640964078d035a0b65056402640a64048d025a0c640b5a0d640c5a0e640d640e84005a0f651064028301651165126511640f9c0364106411840483015a1365106402830165126511651164129c0364136414840483015a14651064028301651165126511651164159c0464166417840483015a1565106402830164186419840083015a1665106402830165116511641a9c02641b641c840483015a176510640283016511641d9c01641e641f840483015a18640153002920e9000000004eda12636f6e5f6d657267656e5f6e6674735f7632da0f636f6c6c656374696f6e5f6e616d652902da08636f6e7472616374da046e616d65da10636f6c6c656374696f6e5f6f776e6572da0f636f6c6c656374696f6e5f6e6674732903da0d64656661756c745f76616c756572040000007205000000da13636f6c6c656374696f6e5f62616c616e636573da1d636f6c6c656374696f6e5f62616c616e6365735f617070726f76616c73da0c6c6173745f6d696e745f69647a5a41204d455247454e204e465420776869636820697320656974686572206120726573756c74206f6620636f6d62696e696e672c20736c617368696e67206f72206d696e74696e67207573696e672074686520636f6e74726163747a5d68747470733a2f2f6e667473746f726167652e6c696e6b2f697066732f6261667962656964326d7364647571696662637668727465756d7a6d77747774736c6c353334726c33356f32617569726f6534357a34767a766b652f66696c65630000000000000000000000000200000043000000732400000074006a0164018301010074026a0174036a048301010074056a016402830101006400530029034eda064d455247454e72010000002906da115f5f636f6c6c656374696f6e5f6e616d65da03736574da125f5f636f6c6c656374696f6e5f6f776e6572da03637478da0663616c6c6572da0e5f5f6c6173745f6d696e745f6964a90072130000007213000000da00da045f5f5f5f17000000730600000000010a010c01721500000029037205000000da06616d6f756e74da02746f63030000000000000003000000040000004300000073680000007c0164016b04731074006402830182017c0064036b0373207400640483018201740174026a037c00660219007c016b05733a7400640583018201740174026a037c006602050019007c01380003003c0074017c027c006602050019007c01370003003c006400530029064e72010000007a24596f752063616e6e6f74207472616e73666572206e6567617469766520616d6f756e747372140000007a37506c65617365207370656369667920746865206e616d65206f6620746865204e465420796f752077616e7420746f207472616e736665727a21596f7520646f6e74206861766520656e6f756768204e46547320746f2073656e642904da0e417373657274696f6e4572726f72da155f5f636f6c6c656374696f6e5f62616c616e636573721000000072110000002903720500000072160000007217000000721300000072130000007214000000da087472616e736665721d000000730c0000000002100110010c010e011601721a0000002903721600000072050000007217000000630300000000000000030000000400000043000000732c0000007c0064016b0473107400640283018201740174026a037c027c016603050019007c00370003003c006400530029034e72010000007a1f43616e6e6f7420617070726f7665206e6567617469766520616d6f756e747329047218000000da1f5f5f636f6c6c656374696f6e5f62616c616e6365735f617070726f76616c73721000000072110000002903721600000072050000007217000000721300000072130000007214000000da07617070726f766527000000730400000000021001721c0000002904720500000072160000007217000000da0c6d61696e5f6163636f756e7463040000000000000004000000060000004300000073960000007c0164016b047310740064028301820174017c037c027c00660319007c016b05733c740064036a0274017c037c027c00660319007c0183028301820174037c037c00660219007c016b057354740064048301820174017c037c027c006603050019007c01380003003c0074037c037c006602050019007c01380003003c0074037c027c006602050019007c01370003003c006400530029054e72010000007a1e43616e6e6f742073656e64206e656761746976652062616c616e636573217a484e6f7420656e6f756768204e46547320617070726f76656420746f2073656e642120596f752068617665207b7d20616e642061726520747279696e6720746f207370656e64207b7d7a184e6f7420656e6f756768204e46547320746f2073656e642129047218000000721b000000da06666f726d617472190000002904720500000072160000007217000000721d000000721300000072130000007214000000da0d7472616e736665725f66726f6d2d0000007312000000000210010c010c0114010a010e0116011401721f000000630000000000000000030000000500000043000000736a00000074006a01640174026a03830074046a0564028d03010074066a038300640317007d0064047c009b009d027d0174066a077c0083010100640574086a0964036406830269017d02740a740b7c02640364079c04740c7c013c006403740d74046a057c0166023c006400530029084ee905000000290372160000007217000000721d000000e9010000007a084d455247454e2023da0576616c7565e9640000002904da0b6465736372697074696f6eda0e697066735f696d6167655f75726cda086d657461646174617216000000290eda0863757272656e6379721f000000720f000000da03676574721000000072110000007212000000720e000000da0672616e646f6dda0772616e64696e74da0f4e46545f4445534352495054494f4eda0f4e46545f44454641554c545f494d47da115f5f636f6c6c656374696f6e5f6e66747372190000002903da066e65775f696472050000007226000000721300000072130000007214000000da086d696e745f6e66743a000000731200000000020c010a010c010a010a01100102011001722f0000002902da0a6e66745f6e616d655f31da0a6e66745f6e616d655f32630200000000000000080000000600000043000000730a010000740074016a027c006602190064016b05731a7403640283018201740074016a027c016602190064016b0573347403640283018201740074016a027c006602050019006401380003003c00740074016a027c016602050019006401380003003c0074047c006401640374016a0264048d04010074047c016401640374016a0264048d04010074057c001900640519007d0274057c011900640519007d0378207c0344005d187d047c037c0419007c027c04190017007c037c043c0071a257007406740796027d0574086a098300640117007d0664067c069b009d027d0774086a0a7c0683010100740b740c7c05640164079c0474057c073c006401740074016a027c0766023c006400530029084e72210000007a184e6f7420656e6f756768204e46547320746f2073656e6421da044255524e2904720500000072160000007217000000721d00000072260000007a084d455247454e202329047224000000722500000072260000007216000000290d7219000000721000000072110000007218000000721f000000722d000000da0161da016272120000007228000000720e000000722b000000722c000000290872300000007231000000da1266697273745f6e66745f6d65746164617461da137365636f6e645f6e66745f6d65746164617461da036b6579da13726573756c745f6e66745f6d65746164617461722e0000007205000000721300000072130000007214000000da0b636f6d62696e655f6e667447000000732a00000000020c010e010c010e0116011601120212020c010c010a010601120108010c010a010a01020104010c0172390000002901da086e66745f6e616d6563010000000000000006000000050000004300000073e2000000740074016a027c006602190064016b05731a7403640283018201740074016a027c006602050019006401380003003c0074047c001900640319007d0169007d02781c7c0244005d147d037c017c03190064041b007c027c033c007146570074056a068300640117007d0464057c049b009d027d0574056a077c0483010100740874097c02640164069c0474047c053c006401740074016a027c0566023c0074056a068300640117007d0464057c049b009d027d0574056a077c0483010100740874097c02640164069c0474047c053c006401740074016a027c0566023c006400530029074e72210000007a184e6f7420656e6f756768204e46547320746f2073656e64217226000000e9020000007a084d455247454e202329047224000000722500000072260000007216000000290a7219000000721000000072110000007218000000722d00000072120000007228000000720e000000722b000000722c0000002906723a000000da0c6e66745f6d65746164617461da106e65775f6e66745f6d657461646174617237000000722e0000007205000000721300000072130000007214000000da09736c6173685f6e667462000000732a00000000020c010e0116010c0104010a0114010c010a010a01020104010c010e010c010a010a01020104010c01723e0000002919da09696d706f72746c6962da01497229000000da04736565647227000000da085661726961626c65720d000000720f000000da0448617368722d0000007219000000721b0000007212000000722b000000722c0000007215000000da085f5f6578706f7274da03737472da03696e74721a000000721c000000721f000000722f0000007239000000723e0000007213000000721300000072130000007214000000da083c6d6f64756c653e0100000073360000000401080108010401080104010801060108010601080104010a010c0204030404080606011409060114050601160c100d0601121a0601
 
Contract con_mergen_nfts_v2
Variable __owner__
New Value null
 
Contract con_mergen_nfts_v2
Variable __submitted__
New Value 2023,1,17,20,13,28,0
 
Contract con_mergen_nfts_v2
Variable __developer__
New Value ff61544ea94eaaeb5df08ed863c4a938e9129aba6ceee5f31b6681bdede11b89
 
Contract currency
Variable balances
Key ff61544ea94eaaeb5df08ed863c4a938e9129aba6ceee5f31b6681bdede11b89
New Value 52.411322986851998213199409379739