Transaction #1065029

Hash b22700d5b0439a0d3e3bc4d9dac74d3848715b1ab6a2e584da42c701e4d2d484
Status Success
Timestamp 616 days ago - 9/12/2022, 8:47:36 AM UTC+0
Block 1016493
Stamps Used 324
Burned Fee 0.01917160 TAU
From ff61544ea94eaaeb5df08ed863c4a938e9129aba6ceee5f31b6681bdede11b89 
Contract Name submission
Function Name submit_contract

Additional Info
SubBlock Number 0
Nonce 1856
Processor 5b09493df6c18d17cc883ebce54fcb1f5afbd507533417fe32c006009a9c3c4a
Signature 4fce993ec782450cecf1eeb0e94dea3c628dd3812496d00ae58f86f29fd21f99755b4aaad76830f2e97815e4b2e3df8c4a1f0fd30b3eb1e6fcef4725908c300b
Stamps Supplied 845
Stamps per TAU 169

Kwargs

code #royalties update I = importlib allowed_currency = Variable() operator = Variable() market = Hash(default_value=0) # Stores NFTs up for sale treasury = Variable() royalty_receivers = Hash(default_value=False) forced_collection_interface = [I.Func('transfer', args=('name', 'amount', 'to')), I.Func( 'approve', args=('amount', 'name', 'to')), I.Func('transfer_from', args=( 'name', 'amount', 'to', 'main_account'))] @construct def seed(): allowed_currency.set("con_reflecttau_v2") operator.set("ff61544ea94eaaeb5df08ed863c4a938e9129aba6ceee5f31b6681bdede11b89") treasury.set("con_reflecttau_v2_treasury") @export def sell_nft(name_of_nft: str, collection_contract: str, amount: int, currency_price: float, royalty_percentage: float): assert amount > 0, 'Cannot sell negative NFT amount' assert currency_price > 0, 'Cannot sell for negative balances!' collection = I.import_module(collection_contract) assert I.enforce_interface(collection, forced_collection_interface ), 'Invalid collection interface!' collection.transfer_from(name=name_of_nft, amount=amount, to=ctx.this, main_account=ctx.caller) market[ctx.caller, collection_contract, name_of_nft] = {"amount": amount, "price": currency_price} if royalty_receivers[collection_contract, name_of_nft] == False: if(royalty_percentage == None): royalty_percentage = 0.0 assert royalty_percentage <= 50, "Over 50% royalty is not allowed" assert royalty_percentage >= 0, "Under 0% royalty is not allowed" royalty_receivers[collection_contract, name_of_nft] = {"receiver": ctx.caller, "royalty_percentage": royalty_percentage} @export def refund_nft(name_of_nft: str, collection_contract: str): market_entry = market[ctx.caller, collection_contract, name_of_nft] collection = I.import_module(collection_contract) collection.transfer(name=name_of_nft, amount=market_entry["amount"], to=ctx.caller) market[ctx.caller, collection_contract, name_of_nft] = {"amount":0, "price":market_entry["price"]} @export def buy_nft(name: str, collection_contract: str, seller: str, amount:int): assert amount > 0, 'Cannot buy negative NFT amount' assert market[seller, collection_contract, name]["amount"] >= amount, 'Not enough for sale' collection = I.import_module(collection_contract) currency = I.import_module(allowed_currency.get()) assert I.enforce_interface(collection, forced_collection_interface ), 'Invalid collection interface!' fee = ((market[seller, collection_contract, name]["price"] * amount)/100*2) royalty = ((market[seller, collection_contract, name]["price"] * amount)/100*royalty_receivers[collection_contract, name]["royalty_percentage"]) currency.transfer_from(amount=(market[seller, collection_contract, name]["price"] * amount) - fee - royalty, to=seller, main_account=ctx.caller) currency.transfer_from(amount=fee, to=treasury.get(), main_account=ctx.caller) currency.transfer_from(amount=royalty, to=royalty_receivers[collection_contract, name]["receiver"], main_account=ctx.caller) old_market_entry = market[seller, collection_contract, name] market[seller, collection_contract, name] = {"amount": old_market_entry["amount"] - amount, "price": old_market_entry["price"]} collection.transfer(name=name, amount=amount, to=ctx.caller) @export def change_allowed_currency(contract: str): assert ctx.caller == operator.get(), "Only the operator can do this" allowed_currency.set(contract) @export def change_treasury(address: str): assert ctx.caller == operator.get(), "Only the operator can do this" treasury.set(address) @export def change_operator(address: str): assert ctx.caller == operator.get(), "Only the operator can do this" operator.set(address)
name con_nft_marketplace_v4

State Changes

Contract con_nft_marketplace_v4
Variable allowed_currency
New Value con_reflecttau_v2
 
Contract con_nft_marketplace_v4
Variable operator
New Value ff61544ea94eaaeb5df08ed863c4a938e9129aba6ceee5f31b6681bdede11b89
 
Contract con_nft_marketplace_v4
Variable treasury
New Value con_reflecttau_v2_treasury
 
Contract con_nft_marketplace_v4
Variable __code__
New Value I = importlib __allowed_currency = Variable(contract='con_nft_marketplace_v4', name= 'allowed_currency') __operator = Variable(contract='con_nft_marketplace_v4', name='operator') __market = Hash(default_value=0, contract='con_nft_marketplace_v4', name= 'market') __treasury = Variable(contract='con_nft_marketplace_v4', name='treasury') __royalty_receivers = Hash(default_value=False, contract= 'con_nft_marketplace_v4', name='royalty_receivers') forced_collection_interface = [I.Func('transfer', args=('name', 'amount', 'to')), I.Func('approve', args=('amount', 'name', 'to')), I.Func( 'transfer_from', args=('name', 'amount', 'to', 'main_account'))] def ____(): __allowed_currency.set('con_reflecttau_v2') __operator.set( 'ff61544ea94eaaeb5df08ed863c4a938e9129aba6ceee5f31b6681bdede11b89') __treasury.set('con_reflecttau_v2_treasury') @__export('con_nft_marketplace_v4') def sell_nft(name_of_nft: str, collection_contract: str, amount: int, currency_price: float, royalty_percentage: float): assert amount > 0, 'Cannot sell negative NFT amount' assert currency_price > 0, 'Cannot sell for negative balances!' collection = I.import_module(collection_contract) assert I.enforce_interface(collection, forced_collection_interface ), 'Invalid collection interface!' collection.transfer_from(name=name_of_nft, amount=amount, to=ctx.this, main_account=ctx.caller) __market[ctx.caller, collection_contract, name_of_nft] = {'amount': amount, 'price': currency_price} if __royalty_receivers[collection_contract, name_of_nft] == False: if royalty_percentage == None: royalty_percentage = decimal('0.0') assert royalty_percentage <= 50, 'Over 50% royalty is not allowed' assert royalty_percentage >= 0, 'Under 0% royalty is not allowed' __royalty_receivers[collection_contract, name_of_nft] = {'receiver': ctx.caller, 'royalty_percentage': royalty_percentage} @__export('con_nft_marketplace_v4') def refund_nft(name_of_nft: str, collection_contract: str): market_entry = __market[ctx.caller, collection_contract, name_of_nft] collection = I.import_module(collection_contract) collection.transfer(name=name_of_nft, amount=market_entry['amount'], to =ctx.caller) __market[ctx.caller, collection_contract, name_of_nft] = {'amount': 0, 'price': market_entry['price']} @__export('con_nft_marketplace_v4') def buy_nft(name: str, collection_contract: str, seller: str, amount: int): assert amount > 0, 'Cannot buy negative NFT amount' assert __market[seller, collection_contract, name]['amount' ] >= amount, 'Not enough for sale' collection = I.import_module(collection_contract) currency = I.import_module(__allowed_currency.get()) assert I.enforce_interface(collection, forced_collection_interface ), 'Invalid collection interface!' fee = __market[seller, collection_contract, name]['price' ] * amount / 100 * 2 royalty = __market[seller, collection_contract, name]['price' ] * amount / 100 * __royalty_receivers[collection_contract, name][ 'royalty_percentage'] currency.transfer_from(amount=__market[seller, collection_contract, name]['price'] * amount - fee - royalty, to=seller, main_account= ctx.caller) currency.transfer_from(amount=fee, to=__treasury.get(), main_account= ctx.caller) currency.transfer_from(amount=royalty, to=__royalty_receivers[ collection_contract, name]['receiver'], main_account=ctx.caller) old_market_entry = __market[seller, collection_contract, name] __market[seller, collection_contract, name] = {'amount': old_market_entry['amount'] - amount, 'price': old_market_entry['price'] } collection.transfer(name=name, amount=amount, to=ctx.caller) @__export('con_nft_marketplace_v4') def change_allowed_currency(contract: str): assert ctx.caller == __operator.get(), 'Only the operator can do this' __allowed_currency.set(contract) @__export('con_nft_marketplace_v4') def change_treasury(address: str): assert ctx.caller == __operator.get(), 'Only the operator can do this' __treasury.set(address) @__export('con_nft_marketplace_v4') def change_operator(address: str): assert ctx.caller == __operator.get(), 'Only the operator can do this' __operator.set(address)
 
Contract con_nft_marketplace_v4
Variable __compiled__
New Value e30000000000000000000000000800000040000000730c01000065005a0165026400640164028d025a0365026400640364028d025a04650564046400640564068d035a0665026400640764028d025a07650564086400640964068d035a0865016a09640a6426640e8d0265016a09640f6427640e8d0265016a0964106428640e8d0267035a0a6412641384005a0b650c64008301650d650d650e650f650f64149c0564156416840483015a10650c64008301650d650d64179c0264186419840483015a11650c64008301650d650d650d650e641a9c04641b641c840483015a12650c64008301650d641d9c01641e641f840483015a13650c64008301650d64209c0164216422840483015a14650c64008301650d64209c0164236424840483015a15642553002929da16636f6e5f6e66745f6d61726b6574706c6163655f7634da10616c6c6f7765645f63757272656e63792902da08636f6e7472616374da046e616d65da086f70657261746f72e900000000da066d61726b65742903da0d64656661756c745f76616c756572030000007204000000da08747265617375727946da11726f79616c74795f726563656976657273da087472616e736665727204000000da06616d6f756e74da02746f2901da0461726773da07617070726f7665da0d7472616e736665725f66726f6dda0c6d61696e5f6163636f756e74630000000000000000000000000200000043000000732200000074006a0164018301010074026a0164028301010074036a016403830101006400530029044eda11636f6e5f7265666c6563747461755f7632da4066663631353434656139346561616562356466303865643836336334613933386539313239616261366365656535663331623636383162646564653131623839da1a636f6e5f7265666c6563747461755f76325f74726561737572792904da125f5f616c6c6f7765645f63757272656e6379da03736574da0a5f5f6f70657261746f72da0a5f5f7472656173757279a90072190000007219000000da00da045f5f5f5f0f000000730800000000010a0104010601721b0000002905da0b6e616d655f6f665f6e6674da13636f6c6c656374696f6e5f636f6e7472616374720c000000da0e63757272656e63795f7072696365da12726f79616c74795f70657263656e7461676563050000000000000006000000060000004300000073c20000007c0264016b04731074006402830182017c0364016b047320740064038301820174016a027c0183017d0574016a037c0574048302733e74006404830182017c056a057c007c0274066a0774066a0864058d0401007c027c0364069c02740974066a087c017c0066033c00740a7c017c006602190064076b0272be7c0464006b02728a740b640883017d047c0464096b01739a7400640a830182017c0464016b0573aa7400640b8301820174066a087c04640c9c02740a7c017c0066023c0064005300290d4e72060000007a1f43616e6e6f742073656c6c206e65676174697665204e465420616d6f756e747a2243616e6e6f742073656c6c20666f72206e656761746976652062616c616e636573217a1d496e76616c696420636f6c6c656374696f6e20696e746572666163652129047204000000720c000000720d00000072110000002902720c000000da057072696365467a03302e30e9320000007a1f4f7665722035302520726f79616c7479206973206e6f7420616c6c6f7765647a1f556e64657220302520726f79616c7479206973206e6f7420616c6c6f7765642902da087265636569766572721f000000290cda0e417373657274696f6e4572726f72da0149da0d696d706f72745f6d6f64756c65da11656e666f7263655f696e74657266616365da1b666f726365645f636f6c6c656374696f6e5f696e746572666163657210000000da03637478da0474686973da0663616c6c6572da085f5f6d61726b6574da135f5f726f79616c74795f726563656976657273da07646563696d616c2906721c000000721d000000720c000000721e000000721f000000da0a636f6c6c656374696f6e72190000007219000000721a000000da0873656c6c5f6e667416000000731c0000000003100110010a010e0106010c010a02160110010801080110011002722f0000002902721c000000721d000000630200000000000000040000000500000043000000734e000000740074016a027c017c00660319007d0274036a047c0183017d037c036a057c007c026401190074016a0264028d03010064037c026404190064059c02740074016a027c017c0066033c006400530029064e720c00000029037204000000720c000000720d000000720600000072200000002902720c00000072200000002906722b0000007228000000722a00000072240000007225000000720b0000002904721c000000721d000000da0c6d61726b65745f656e747279722e00000072190000007219000000721a000000da0a726566756e645f6e66742b000000730c000000000210010a010c010a010201723100000029047204000000721d000000da0673656c6c6572720c00000063040000000000000009000000050000004300000073460100007c0364016b047310740064028301820174017c027c017c0066031900640319007c036b05732e740064048301820174026a037c0183017d0474026a0374046a05830083017d0574026a067c0474078302735a740064058301820174017c027c017c0066031900640619007c03140064071b00640814007d0674017c027c017c0066031900640619007c03140064071b0074087c017c00660219006409190014007d077c056a0974017c027c017c0066031900640619007c0314007c0618007c0718007c02740a6a0b640a8d0301007c056a097c06740c6a058300740a6a0b640a8d0301007c056a097c0774087c017c0066021900640b1900740a6a0b640a8d03010074017c027c017c00660319007d087c08640319007c0318007c0864061900640c9c0274017c027c017c0066033c007c046a0d7c007c03740a6a0b640d8d03010064005300290e4e72060000007a1e43616e6e6f7420627579206e65676174697665204e465420616d6f756e74720c0000007a134e6f7420656e6f75676820666f722073616c657a1d496e76616c696420636f6c6c656374696f6e20696e74657266616365217220000000e964000000e902000000721f0000002903720c000000720d000000721100000072220000002902720c000000722000000029037204000000720c000000720d000000290e7223000000722b000000722400000072250000007215000000da0367657472260000007227000000722c00000072100000007228000000722a0000007218000000720b00000029097204000000721d0000007232000000720c000000722e000000da0863757272656e6379da03666565da07726f79616c7479da106f6c645f6d61726b65745f656e74727972190000007219000000721a000000da076275795f6e66743500000073280000000002100110010e010a010e010e0106021e022201080104011e010a010c010a01080116010e022002723a00000029017203000000630100000000000000010000000200000043000000732400000074006a0174026a0383006b027316740464018301820174056a067c00830101006400530029024e7a1d4f6e6c7920746865206f70657261746f722063616e20646f207468697329077228000000722a000000721700000072350000007223000000721500000072160000002901720300000072190000007219000000721a000000da176368616e67655f616c6c6f7765645f63757272656e637951000000730400000000021601723b0000002901da0761646472657373630100000000000000010000000200000043000000732400000074006a0174026a0383006b027316740464018301820174056a067c00830101006400530029024e7a1d4f6e6c7920746865206f70657261746f722063616e20646f207468697329077228000000722a000000721700000072350000007223000000721800000072160000002901723c00000072190000007219000000721a000000da0f6368616e67655f747265617375727957000000730400000000021601723d000000630100000000000000010000000200000043000000732400000074006a0174026a0383006b027316740464018301820174026a057c00830101006400530029024e7a1d4f6e6c7920746865206f70657261746f722063616e20646f207468697329067228000000722a00000072170000007235000000722300000072160000002901723c00000072190000007219000000721a000000da0f6368616e67655f6f70657261746f725d000000730400000000021601723e0000004e29037204000000720c000000720d0000002903720c0000007204000000720d00000029047204000000720c000000720d00000072110000002916da09696d706f72746c69627224000000da085661726961626c6572150000007217000000da0448617368722b0000007218000000722c000000da0446756e637227000000721b000000da085f5f6578706f7274da03737472da03696e74da05666c6f6174722f0000007231000000723a000000723b000000723d000000723e000000721900000072190000007219000000721a000000da083c6d6f64756c653e0100000073320000000401040108010c01060108010c0104010a01060116010c030807060106011213060112090601161b06011005060110050601
 
Contract con_nft_marketplace_v4
Variable __owner__
New Value null
 
Contract con_nft_marketplace_v4
Variable __submitted__
New Value 2022,9,12,8,47,22,0
 
Contract con_nft_marketplace_v4
Variable __developer__
New Value ff61544ea94eaaeb5df08ed863c4a938e9129aba6ceee5f31b6681bdede11b89
 
Contract currency
Variable balances
Key ff61544ea94eaaeb5df08ed863c4a938e9129aba6ceee5f31b6681bdede11b89
New Value 117.529539126772835915023478666868