Transaction #7106

Hash b51ade5bb5f9090ebcaeffdf0a7ae84d3438351fa75a0f2ecfd8c566db0da452
Status Success
Timestamp 433 days ago - 2/26/2023, 5:19:23 PM UTC+0
Block 7106
Stamps Used 410
Burned Fee 0.02426036 TAU
From ff61544ea94eaaeb5df08ed863c4a938e9129aba6ceee5f31b6681bdede11b89 
Contract Name submission
Function Name submit_contract

Additional Info
Nonce 43
Processor a04b5891ef8cd27095373a4f75b899ec2bc0883c02e506a6a5b55b491998cc3f
Signature 19406a8535730600082854cdf4166aa1a74d00d8ae0ff893ab318a63fdecdf92c7b7511cad0ba7ec0ee7bdac5783b16e8daea8bded671cd5cdf4f175da4b3d0e
Stamps Supplied 845
Stamps per TAU 169

Kwargs

code import currency collection_interface = [ importlib.Func('mint_nft', args=('name', 'description', 'ipfs_image_url', 'metadata', 'amount')), ] drops = Hash(default_value=False) drops_nfts = Hash(default_value=False) drop_count = Variable() fee = Variable() operator = Variable() @construct def seed(): fee.set(5) operator.set(ctx.caller) drop_count.set(0) @export def create_drop(name: str, description: str, collection_contract:str, image_url: str, start_date: datetime.datetime, end_date: datetime.datetime, price: float): assert start_date < end_date, 'Start must be before end' assert price > 0, 'Price must be greater than 0' assert name != '', 'Name cannot be empty' assert description != '', 'Description cannot be empty' assert start_date > now, 'Start date must be in the future' assert end_date > start_date, 'End date must be after start date' assert collection_contract != '', 'Collection contract cannot be empty' collection = importlib.import_module(collection_contract) assert importlib.enforce_interface(collection, collection_interface ), 'Invalid collection interface!' drop_id = drop_count.get() drops[drop_id] = { 'name': name, 'description': description, 'collection_contract': collection_contract, 'image_url': image_url or '', 'start_date': start_date, 'end_date': end_date, 'price': price, 'owner': ctx.caller, 'total_nfts': 0, 'bought_nfts': 0, } drop_count.set(drop_id + 1) return f'Drop {name} created with id {drop_id}' @export def add_nft_to_drop(drop_id: int, nft_name: str, nft_description:str, nft_ipfs_image_url: str, nft_metadata: dict): assert drops[drop_id], 'Drop does not exist' assert drops[drop_id]['owner'] == ctx.caller, 'Only the owner can add NFTs to the drop' assert drops[drop_id]['start_date'] > now, 'Drop has already started' assert nft_name != '', 'NFT name cannot be empty' assert nft_description != '', 'NFT description cannot be empty' assert nft_ipfs_image_url != '', 'NFT IPFS image URL cannot be empty' collection_owner = ForeignVariable(foreign_contract=drops[drop_id]['collection_contract'], foreign_name='collection_owner') assert collection_owner.get() == ctx.caller, 'Only the owner of the collection can add NFTs to the drop' drop = drops[drop_id] current_total = drop['total_nfts'] drops_nfts[drop_id, current_total] = { 'name': nft_name, 'description': nft_description, 'ipfs_image_url': nft_ipfs_image_url, 'metadata': nft_metadata or {}, 'amount': 1, } drop['total_nfts'] = current_total + 1 drops[drop_id] = drop return f'NFT {nft_name} added to drop {drop_id}' @export def buy_nft(drop_id: int): assert drops[drop_id], 'Drop does not exist' assert drops[drop_id]['start_date'] < now, f'Drop has not started yet (starts at {drops[drop_id]["start_date"]}), current time is {now}' assert drops[drop_id]['end_date'] > now, f'Drop has already ended (ended at {drops[drop_id]["end_date"]}), current time is {now}' assert drops[drop_id]['bought_nfts'] < drops[drop_id]['total_nfts'], f'Drop is sold out. {drops[drop_id]["bought_nfts"]} / {drops[drop_id]["total_nfts"]} minted' collection_contract = drops[drop_id]['collection_contract'] collection = importlib.import_module(collection_contract) drop = drops[drop_id] nft = drops_nfts[drop_id, drop['bought_nfts']] price = drop['price'] tau_fee = price / 100 * fee.get() to_drop_creator = price - tau_fee to_operator = tau_fee currency.transfer_from(amount=to_drop_creator, to=drop['owner'], main_account=ctx.caller) currency.transfer_from(amount=to_operator, to=operator.get(), main_account=ctx.caller) collection.mint_nft(name=nft['name'], description=nft['description'], ipfs_image_url=nft['ipfs_image_url'], metadata=nft['metadata'], amount=nft['amount']) collection.transfer(name=nft['name'], to=ctx.caller, amount=nft['amount']) drop['bought_nfts'] = drop['bought_nfts'] + 1 drops[drop_id] = drop return f'NFT {nft["name"]} minted from drop {drop_id}' @export def set_fee(amount: float): assert ctx.caller == operator.get(), 'Only the operator can set the fee' fee.set(amount) @export def set_operator(address: str): assert ctx.caller == operator.get(), 'Only the operator can set the operator' operator.set(address) #for testing purposes @export def get_drop(drop_id: int): assert drops[drop_id], 'Drop does not exist' return drops[drop_id] @export def get_drop_nft(drop_id: int, nft_id: int): assert drops[drop_id], 'Drop does not exist' assert drops_nfts[drop_id, nft_id], 'NFT does not exist' return drops_nfts[drop_id, nft_id]
name con_nftdrop

State Changes

Contract con_nftdrop
Variable fee
New Value 5
 
Contract con_nftdrop
Variable operator
New Value ff61544ea94eaaeb5df08ed863c4a938e9129aba6ceee5f31b6681bdede11b89
 
Contract con_nftdrop
Variable drop_count
New Value 0
 
Contract con_nftdrop
Variable __code__
New Value import currency collection_interface = [importlib.Func('mint_nft', args=('name', 'description', 'ipfs_image_url', 'metadata', 'amount'))] __drops = Hash(default_value=False, contract='con_nftdrop', name='drops') __drops_nfts = Hash(default_value=False, contract='con_nftdrop', name= 'drops_nfts') __drop_count = Variable(contract='con_nftdrop', name='drop_count') __fee = Variable(contract='con_nftdrop', name='fee') __operator = Variable(contract='con_nftdrop', name='operator') def ____(): __fee.set(5) __operator.set(ctx.caller) __drop_count.set(0) @__export('con_nftdrop') def create_drop(name: str, description: str, collection_contract: str, image_url: str, start_date: datetime.datetime, end_date: datetime. datetime, price: float): assert start_date < end_date, 'Start must be before end' assert price > 0, 'Price must be greater than 0' assert name != '', 'Name cannot be empty' assert description != '', 'Description cannot be empty' assert start_date > now, 'Start date must be in the future' assert end_date > start_date, 'End date must be after start date' assert collection_contract != '', 'Collection contract cannot be empty' collection = importlib.import_module(collection_contract) assert importlib.enforce_interface(collection, collection_interface ), 'Invalid collection interface!' drop_id = __drop_count.get() __drops[drop_id] = {'name': name, 'description': description, 'collection_contract': collection_contract, 'image_url': image_url or '', 'start_date': start_date, 'end_date': end_date, 'price': price, 'owner': ctx.caller, 'total_nfts': 0, 'bought_nfts': 0} __drop_count.set(drop_id + 1) return f'Drop {name} created with id {drop_id}' @__export('con_nftdrop') def add_nft_to_drop(drop_id: int, nft_name: str, nft_description: str, nft_ipfs_image_url: str, nft_metadata: dict): assert __drops[drop_id], 'Drop does not exist' assert __drops[drop_id]['owner' ] == ctx.caller, 'Only the owner can add NFTs to the drop' assert __drops[drop_id]['start_date'] > now, 'Drop has already started' assert nft_name != '', 'NFT name cannot be empty' assert nft_description != '', 'NFT description cannot be empty' assert nft_ipfs_image_url != '', 'NFT IPFS image URL cannot be empty' __collection_owner = ForeignVariable(foreign_contract=__drops[drop_id][ 'collection_contract'], foreign_name='collection_owner', contract= 'con_nftdrop', name='collection_owner') assert __collection_owner.get( ) == ctx.caller, 'Only the owner of the collection can add NFTs to the drop' drop = __drops[drop_id] current_total = drop['total_nfts'] __drops_nfts[drop_id, current_total] = {'name': nft_name, 'description': nft_description, 'ipfs_image_url': nft_ipfs_image_url, 'metadata': nft_metadata or {}, 'amount': 1} drop['total_nfts'] = current_total + 1 __drops[drop_id] = drop return f'NFT {nft_name} added to drop {drop_id}' @__export('con_nftdrop') def buy_nft(drop_id: int): assert __drops[drop_id], 'Drop does not exist' assert __drops[drop_id]['start_date' ] < now, f"Drop has not started yet (starts at {__drops[drop_id]['start_date']}), current time is {now}" assert __drops[drop_id]['end_date' ] > now, f"Drop has already ended (ended at {__drops[drop_id]['end_date']}), current time is {now}" assert __drops[drop_id]['bought_nfts'] < __drops[drop_id]['total_nfts' ], f"Drop is sold out. {__drops[drop_id]['bought_nfts']} / {__drops[drop_id]['total_nfts']} minted" collection_contract = __drops[drop_id]['collection_contract'] collection = importlib.import_module(collection_contract) drop = __drops[drop_id] nft = __drops_nfts[drop_id, drop['bought_nfts']] price = drop['price'] tau_fee = price / 100 * __fee.get() to_drop_creator = price - tau_fee to_operator = tau_fee currency.transfer_from(amount=to_drop_creator, to=drop['owner'], main_account=ctx.caller) currency.transfer_from(amount=to_operator, to=__operator.get(), main_account=ctx.caller) collection.mint_nft(name=nft['name'], description=nft['description'], ipfs_image_url=nft['ipfs_image_url'], metadata=nft['metadata'], amount=nft['amount']) collection.transfer(name=nft['name'], to=ctx.caller, amount=nft['amount']) drop['bought_nfts'] = drop['bought_nfts'] + 1 __drops[drop_id] = drop return f"NFT {nft['name']} minted from drop {drop_id}" @__export('con_nftdrop') def set_fee(amount: float): assert ctx.caller == __operator.get(), 'Only the operator can set the fee' __fee.set(amount) @__export('con_nftdrop') def set_operator(address: str): assert ctx.caller == __operator.get( ), 'Only the operator can set the operator' __operator.set(address) @__export('con_nftdrop') def get_drop(drop_id: int): assert __drops[drop_id], 'Drop does not exist' return __drops[drop_id] @__export('con_nftdrop') def get_drop_nft(drop_id: int, nft_id: int): assert __drops[drop_id], 'Drop does not exist' assert __drops_nfts[drop_id, nft_id], 'NFT does not exist' return __drops_nfts[drop_id, nft_id]
 
Contract con_nftdrop
Variable __compiled__
New Value e300000000000000000000000009000000400000007318010000640064016c005a0065016a026402642864088d0267015a0365046409640a640b640c8d035a0565046409640a640d640c8d035a066507640a640e640f8d025a086507640a6410640f8d025a096507640a6411640f8d025a0a6412641384005a0b650c640a8301650d650d650d650d650e6a0e650e6a0e650f64149c0764156416840483015a10650c640a83016511650d650d650d651264179c0564186419840483015a13650c640a83016511641a9c01641b641c840483015a14650c640a8301650f641d9c01641e641f840483015a15650c640a8301650d64209c0164216422840483015a16650c640a83016511641a9c0164236424840483015a17650c640a83016511651164259c0264266427840483015a18640153002929e9000000004eda086d696e745f6e6674da046e616d65da0b6465736372697074696f6eda0e697066735f696d6167655f75726cda086d65746164617461da06616d6f756e742901da046172677346da0b636f6e5f6e667464726f70da0564726f70732903da0d64656661756c745f76616c7565da08636f6e74726163747203000000da0a64726f70735f6e667473da0a64726f705f636f756e742902720c0000007203000000da03666565da086f70657261746f72630000000000000000000000000200000043000000732400000074006a0164018301010074026a0174036a048301010074056a016402830101006400530029034ee90500000072010000002906da055f5f666565da03736574da0a5f5f6f70657261746f72da03637478da0663616c6c6572da0c5f5f64726f705f636f756e74a90072180000007218000000da00da045f5f5f5f0c000000730600000000010a010c01721a000000290772030000007204000000da13636f6c6c656374696f6e5f636f6e7472616374da09696d6167655f75726cda0a73746172745f64617465da08656e645f64617465da057072696365630700000000000000090000000b0000004300000073d80000007c047c056b00731074006401830182017c0664026b04732074006403830182017c0064046b03733074006405830182017c0164046b03734074006406830182017c0474016b04735074006407830182017c057c046b04736074006408830182017c0264046b037370740064098301820174026a037c0283017d0774026a047c0774058302738e7400640a8301820174066a0783007d087c007c017c027c0370a264047c047c057c0674086a0964026402640b9c0a740a7c083c0074066a0b7c08640c170083010100640d7c009b00640e7c089b009d045300290f4e7a185374617274206d757374206265206265666f726520656e6472010000007a1c5072696365206d7573742062652067726561746572207468616e203072190000007a144e616d652063616e6e6f7420626520656d7074797a1b4465736372697074696f6e2063616e6e6f7420626520656d7074797a2053746172742064617465206d75737420626520696e20746865206675747572657a21456e642064617465206d75737420626520616674657220737461727420646174657a23436f6c6c656374696f6e20636f6e74726163742063616e6e6f7420626520656d7074797a1d496e76616c696420636f6c6c656374696f6e20696e7465726661636521290a72030000007204000000721b000000721c000000721d000000721e000000721f000000da056f776e6572da0a746f74616c5f6e667473da0b626f756768745f6e667473e9010000007a0544726f70207a112063726561746564207769746820696420290cda0e417373657274696f6e4572726f72da036e6f77da09696d706f72746c6962da0d696d706f72745f6d6f64756c65da11656e666f7263655f696e74657266616365da14636f6c6c656374696f6e5f696e746572666163657217000000da0367657472150000007216000000da075f5f64726f70737213000000290972030000007204000000721b000000721c000000721d000000721e000000721f000000da0a636f6c6c656374696f6eda0764726f705f6964721800000072180000007219000000da0b6372656174655f64726f70120000007322000000000410011001100110011001100110010a010e010601080104010601080112010e01722e0000002905722d000000da086e66745f6e616d65da0f6e66745f6465736372697074696f6eda126e66745f697066735f696d6167655f75726cda0c6e66745f6d6574616461746163050000000000000008000000060000004300000073f000000074007c0019007310740164018301820174007c0019006402190074026a036b02732a740164038301820174007c0019006404190074046b04734274016405830182017c0164066b03735274016407830182017c0264066b03736274016408830182017c0364066b0373727401640983018201740574007c001900640a1900640b640c640b640d8d047d057c056a06830074026a036b0273a07401640e8301820174007c0019007d067c06640f19007d077c017c027c037c0470bc6900641064119c0574077c007c0766023c007c07641017007c06640f3c007c0674007c003c0064127c019b0064137c009b009d04530029144e7a1344726f7020646f6573206e6f7420657869737472200000007a274f6e6c7920746865206f776e65722063616e20616464204e46547320746f207468652064726f70721d0000007a1844726f702068617320616c7265616479207374617274656472190000007a184e4654206e616d652063616e6e6f7420626520656d7074797a1f4e4654206465736372697074696f6e2063616e6e6f7420626520656d7074797a224e4654204950465320696d6167652055524c2063616e6e6f7420626520656d707479721b000000da10636f6c6c656374696f6e5f6f776e657272090000002904da10666f726569676e5f636f6e7472616374da0c666f726569676e5f6e616d65720c00000072030000007a394f6e6c7920746865206f776e6572206f662074686520636f6c6c656374696f6e2063616e20616464204e46547320746f207468652064726f70722100000072230000002905720300000072040000007205000000720600000072070000007a044e4654207a0f20616464656420746f2064726f70202908722b0000007224000000721500000072160000007225000000da0f466f726569676e5661726961626c65722a000000da0c5f5f64726f70735f6e6674732908722d000000722f000000723000000072310000007232000000da125f5f636f6c6c656374696f6e5f6f776e6572da0464726f70da0d63757272656e745f746f74616c721800000072180000007219000000da0f6164645f6e66745f746f5f64726f70290000007328000000000310010a0110011801100110011001080106010a0106011001080108010201040116010c010801723b0000002901722d000000630100000000000000090000000700000043000000739201000074007c0019007310740164018301820174007c0019006402190074026b00733c7401640374007c001900640219009b00640474029b009d048301820174007c0019006405190074026b0473687401640674007c001900640519009b00640474029b009d048301820174007c0019006407190074007c001900640819006b0073a67401640974007c001900640719009b00640a74007c001900640819009b00640b9d058301820174007c001900640c19007d0174036a047c0183017d0274007c0019007d0374057c007c0364071900660219007d047c03640d19007d057c05640e1b0074066a07830014007d067c057c0618007d077c067d0874086a097c077c03640f1900740a6a0b64108d03010074086a097c08740c6a078300740a6a0b64108d0301007c026a0d7c04641119007c04641219007c04641319007c04641419007c046415190064168d0501007c026a0e7c0464111900740a6a0b7c046415190064178d0301007c0364071900641817007c0364073c007c0374007c003c0064197c04641119009b00641a7c009b009d045300291b4e7a1344726f7020646f6573206e6f74206578697374721d0000007a2444726f7020686173206e6f742073746172746564207965742028737461727473206174207a13292c2063757272656e742074696d6520697320721e0000007a2144726f702068617320616c726561647920656e6465642028656e64656420617420722200000072210000007a1244726f7020697320736f6c64206f75742e207a03202f207a07206d696e746564721b000000721f000000e964000000722000000029037207000000da02746fda0c6d61696e5f6163636f756e747203000000720400000072050000007206000000720700000029057203000000720400000072050000007206000000720700000029037203000000723d000000720700000072230000007a044e4654207a12206d696e7465642066726f6d2064726f7020290f722b000000722400000072250000007226000000722700000072370000007212000000722a000000da0863757272656e6379da0d7472616e736665725f66726f6d7215000000721600000072140000007202000000da087472616e736665722909722d000000721b000000722c0000007239000000da036e6674721f000000da077461755f666565da0f746f5f64726f705f63726561746f72da0b746f5f6f70657261746f72721800000072180000007219000000da076275795f6e6674420000007334000000000210010a0122010a0122011a0124010c010a010801100108011001080104010c010a010c010a0110010c010c011a0110010801724600000029017207000000630100000000000000010000000200000043000000732400000074006a0174026a0383006b027316740464018301820174056a067c00830101006400530029024e7a214f6e6c7920746865206f70657261746f722063616e2073657420746865206665652907721500000072160000007214000000722a00000072240000007212000000721300000029017207000000721800000072180000007219000000da077365745f6665656000000073040000000002160172470000002901da0761646472657373630100000000000000010000000200000043000000732400000074006a0174026a0383006b027316740464018301820174026a057c00830101006400530029024e7a264f6e6c7920746865206f70657261746f722063616e2073657420746865206f70657261746f722906721500000072160000007214000000722a0000007224000000721300000029017248000000721800000072180000007219000000da0c7365745f6f70657261746f726600000073060000000002100106017249000000630100000000000000010000000200000043000000731800000074007c0019007310740164018301820174007c001900530029024e7a1344726f7020646f6573206e6f742065786973742902722b00000072240000002901722d000000721800000072180000007219000000da086765745f64726f706d000000730400000000021001724a0000002902722d000000da066e66745f6964630200000000000000020000000300000043000000733000000074007c0019007310740164018301820174027c007c01660219007324740164028301820174027c007c0166021900530029034e7a1344726f7020646f6573206e6f742065786973747a124e465420646f6573206e6f742065786973742903722b000000722400000072370000002902722d000000724b000000721800000072180000007219000000da0c6765745f64726f705f6e6674730000007306000000000210011401724c0000002905720300000072040000007205000000720600000072070000002919723f0000007226000000da0446756e637229000000da0448617368722b0000007237000000da085661726961626c65721700000072120000007214000000721a000000da085f5f6578706f7274da03737472da086461746574696d65da05666c6f6174722e000000da03696e74da0464696374723b000000724600000072470000007249000000724a000000724c0000007218000000721800000072180000007219000000da083c6d6f64756c653e010000007334000000080106010a010e01060108010c010c010c030806060106010a0110140601060112170601101d0601100506011006060110050601
 
Contract con_nftdrop
Variable __owner__
New Value null
 
Contract con_nftdrop
Variable __submitted__
New Value 2023,2,26,17,19,24,0
 
Contract con_nftdrop
Variable __developer__
New Value ff61544ea94eaaeb5df08ed863c4a938e9129aba6ceee5f31b6681bdede11b89
 
Contract currency
Variable balances
Key ff61544ea94eaaeb5df08ed863c4a938e9129aba6ceee5f31b6681bdede11b89
New Value 3746.440024969182347418796565306654