Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TestNet] Non Fungible Ticket #92

Merged
merged 7 commits into from
Mar 15, 2023

Conversation

madrazzl3
Copy link
Contributor

@madrazzl3 madrazzl3 commented Mar 6, 2023

Description:

Extends the NonFungibleToken contract with methods for preventing transfer of used tickets:

  • bool IsUsed(UInt256 tokenId)
  • void MarkAsUsed(UInt256 tokenId)

It's different from #82

Compiler Version

v2.0.0

Contract Hash

0a42a2b8a47e1aaac340e141700d146043e3e0d4bcceb9160994b962f4831ca2

Contract Byte Code

4D5A90000300000004000000FFFF0000B800000000000000400000000000000000000000000000000000000000000000000000000000000000000000800000000E1FBA0E00B409CD21B8014CCD21546869732070726F6772616D2063616E6E6F742062652072756E20696E20444F53206D6F64652E0D0D0A2400000000000000504500004C0102005CB4C08A0000000000000000E00022200B013000002200000002000000000000FE400000002000000060000000000010002000000002000004000000000000000400000000000000008000000002000000000000030040850000100000100000000010000010000000000000100000000000000000000000AC4000004F000000000000000000000000000000000000000000000000000000006000000C000000904000001C0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000080000000000000000000000082000004800000000000000000000002E7465787400000004210000002000000022000000020000000000000000000000000000200000602E72656C6F6300000C000000006000000002000000240000000000000000000000000000400000420000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000E0400000000000004800000002000500CC280000C417000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000007202280500000A7201000070038C0E000001280600000A6F0700000A2A7A02280500000A720100007003B88C0E000001280600000A046F0800000A2A46722F000070038C06000001280600000A2A4E02280500000A020328030000066F0900000A2A5202280500000A02032803000006046F0A00000A2A46724B000070038C06000001280600000A2A4E02280500000A020328060000066F0900000A2A5202280500000A02032806000006046F0A00000A2A7202280500000A726D000070038C07000001280600000A6F0B00000A2A7602280500000A726D000070038C07000001280600000A046F0C00000A2A8A02280500000A7285000070038C07000001048C07000001280D00000A6F0700000A2A8E02280500000A7285000070038C07000001048C07000001280D00000A056F0800000A2A7202280500000A72B5000070038C06000001280600000A6F0700000A2A7602280500000A72B5000070038C06000001280600000A046F0800000A2A4602280500000A72CB0000706F0900000A2A4A02280500000A72CB000070036F0A00000A2A4602280500000A72D70000706F0900000A2A4A02280500000A72D7000070036F0A00000A2A4602280500000A72F10000706F0E00000A2A4A02280500000A72F1000070036F0F00000A2A4602280500000A72FB0000706F0E00000A2A4A02280500000A72FB000070036F0F00000A2A7202280500000A7209010070038C06000001280600000A6F0E00000A2A7602280500000A7209010070038C06000001280600000A046F0F00000A2A4602280500000A72190100706F0700000A2A4A02280500000A7219010070036F0800000A2A001330030060000000000000000203281000000A021717280200000602181728020000060219162802000006021A172802000006021B162802000006021F6417280200000602042814000006020528160000060202281100000A6F1200000A2810000006020E04281A0000062A5A022835000006020317280E0000060203282F0000062A220203280D0000062A32020304050E04282A0000062A4202030405168D12000001282A0000062A0000133004003A000000010000110204283C000006020528040000060A0206283C0000060206052832000006020603281300000A723B010070281400000A0206040528270000062A0000133004004400000001000011020428040000060A0206283C00000602062830000006020306281500000A728901007072D9010070280600000A281400000A020403280800000602060304282D0000062A9E0202281100000A6F1200000A0304280C0000060202281100000A6F1200000A0304282E0000062A3E0203283C000006020328090000062A133002001100000001000011020328040000060A0206283C000006062A000000133002001700000001000011020328040000060A0206283C000006020328070000062A26020304280B0000062A860205282B0000060203052828000006020405282900000602030405282C0000062A00133004002800000002000011020328090000060A02030617281600000A281700000A280A00000602047E1800000A28050000062A1330040024000000020000110204032805000006020328090000060A02030617281600000A281900000A280A0000062A56020304052820000006020304050E0428390000062A82020328070000067E1800000A281500000A2C0C02037E1800000A28080000062A00133003002800000003000011021200FE15040000021200037D080000041200047D090000041200057D0A00000406280100002B2A133003002800000004000011021200FE15050000021200037D0B0000041200047D0C0000041200057D0D00000406280200002B2A133003002800000005000011021200FE15060000021200037D0E0000041200047D0F0000041200057D1000000406280300002B2A133003001800000006000011021200FE15090000021200037D1500000406280400002B2A4E020203283100000672EB010070281400000A2AA20302281100000A6F1200000A281300000A2D13020302281100000A6F1200000A280B0000062A172A00000013300300440000000000000002020328310000062D190204280700000602281100000A6F1200000A281300000A2B0117722F020070281400000A020204281D00000616FE017287020070281400000A2A13300300320000000700001102283500000602032812000006021200FE1508000002120002280F0000067D130000041200037D1400000406280500002B2A0000133003005C000000080000110228110000060A020602281100000A6F1200000A281300000A72B9020070281400000A02280F0000060B02062810000006027E1800000A2812000006021202FE15070000021202077D110000041202067D1200000408280600002B2A8A0202281100000A6F1200000A02280F000006281300000A722B030070281400000A2A2E020304052838000006042A6A020304052838000006027E1800000A03040E042839000006042A00001330040051000000010000110228190000062C06022835000006020428040000060A02067E1800000A281300000A725F030070281400000A0203283C00000602030428290000060204052818000006027E1800000A0304282C0000062A00000013300800660000000900001102280500000A046F1B00000A2C570204166A728B0300701A8D10000001251602281100000A6F1200000A8C07000001A22517038C07000001A22518058C06000001A225190E04A2166A281C00000A0A02066F1D00000AA51300000172C1030070281400000A2A0000133004004900000001000011020328040000060A020602281100000A6F1200000A281300000A7211040070281400000A0203282B0000060206032828000006020314281800000602067E1800000A03282C0000062A22020328170000062A5E02037E1800000A281500000A725B040070281400000A2A000042534A4201000100000000000C00000076342E302E33303331390000000005006C00000084090000237E0000F00900001007000023537472696E67730000000000110000980400002355530098150000100000002347554944000000A81500001C02000023426C6F620000000000000002000001571DA201090A000000FA013300160000010000001300000009000000150000003C000000630000001D00000006000000100000000900000001000000050000000A000000010000000200000007000000060000000000A0030100000000000600C001D3050600EF01D3050600AC01A9050F00F30500000A00690630060A00160030060A00200630060A00810130060A008A0630060600FC03DF0306006201DF030A00E00130060A009501300606000100DF0306004F02DF0306007706DF030A001A01300606000D02DF0306000104DF03000000001E000000000001000100010010002F04000015000100010003010000E2000000290001003D000A011000F20200002D0008003D000A011000D40200002D000B003D000A011000E00200002D000E003D000A011000910200002D0011003D000A011000B60200002D0013003D000A011000A80200002D0015003D000606530016015680F100190156802E04190156805105190156805B00190156802F0119015680590619010600F2038900060076048900060098001D010600450589000600CD008900060098001D0106004505890006009A0589000600CD00210106001E05890006003905890006002C0589000600EC048900060098001D015020000000008600F200240101006D20000000008100BC05290102008C20000000008100BD06300104009E20000000008100040536010500B22000000000810011053D010600C720000000008100AA0630010800D920000000008100380336010900ED2000000000810048033D010A000221000000008100040145010C001F210000000081000F014C010D003D210000000081006B0554010F0060210000000081007E055C0111008421000000008100B60065011400A121000000008100C0006B011500BF21000000008608B3045D001700D121000000008108BD0472011700E421000000008608C7045D001800F621000000008108D8047201180009220000000086084B01780119001B2200000000810854017C0119002E22000000008608B20378011A004022000000008108BD037C011A005322000000008100330030011B007022000000008100430081011C008E22000000008108560288011E00A0220000000081086B028C011E00B422000000008618A30591011F002023000000008600AB009A0123003723000000008600C300650124004023000000008600E603A00125004D23000000008600E603AC0129006023000000008600EA03AC012C00A82300000000860028024C012F00F8230000000086008903B6013100202400000000860030024501330030240000000086003A02360134005024000000008600CA003601350073240000000086006603540136007D240000000081001B03AC013800A02400000000810040044C013B00D42400000000810009044C013D0004250000000081000203A0013F001A2500000000810058039A0143003C250000000081009B04AC01440070250000000081002C03AC014700A42500000000810077035C014A00D825000000008100A8009A014D00FC250000000081006C0172014E0010260000000081009105D9004F003C26000000008100A7044C0150008C26000000008600E90472015200CC260000000086008104060053003427000000008100CD060600530057270000000086009E06BD01530063270000000086009A06C701560080270000000081004C04D3015A00E0270000000081001204A0015D00542800000000860071049A016100A9280000000086004A0030016200B228000000008100F70672016300000001002700000001008C0000000200220200000100DF0000000100DF0000000100DF0000000200220200000100DF0000000100DF0000000100DF00000002002202000001002806000001002806000002002202000001004B05000002000206000001004B0500000200020600000300220200000100A00000000100A00000000200220200000100220200000100220200000100220200000100220200000100A00000000100A00000000200FE0200000100220200000100A601000002005D0100000300C80300000400800200000100A00000000100A00000000100F703000002007E0400000300A00000000400700000000100F703000002007E0400000300A00000000100F703000002007E0400000300A00000000100D60000000200A00000000100020600000200D600000001004B0500000100A00000000100A000000001004B0500000200020600000100F703000002007E0400000300A00000000100F70300000200A000000001007E0400000200A00000000100F703000002007E0400000300A00000000400700000000100A00000000100F703000002007E0400000300A000000001004B0500000200D60000000300A000000001004B0500000200020600000300D60000000100A00000000100F90400000100F90400000100F90400000200A000000001004205000001007E0400000200A00000000300FE02000001007E0400000200A00000000300FE02000004007000000001007E0400000200A00000000300FE0200000100F703000002007E0400000300A00000000400700000000100A00000000100A0000000010028060900A30501001100A30506001900A3050A006100A30506002900770110007900470615006900CF031B006900D703200069001206260069001D062C0069000800330069001300390079004706400069004202470069004C024C002900A3055200290023015800890090045D003900DD0667002900A3066F003900E906670031007E067A003100560480003900790489003100650480002900FA02920069004E06D90029009B03DF0049001202EB0008000800F80008000C00FD00080010000201080014000701080018000C0108001C0011012E000B00E9012E001300F2012E001B00110201012300F80021012300F80041012300F80061012300F80081012300F800A1012300F800C1012300F800E1012300F80021022300F80041022300F80061022300F80081022300F800A1022300F800620075008D009E00A800B200BC00C600D4000200010000004505DC010000EC04DC0100005801E1010000C103E10100006F02E50102000F000300010010000300020011000500010012000500020013000700010014000700020015000900010016000900020019000B0001001A000B0004800000000000000000000000000000000069060000040000000000000000000000EF00750000000000020000000000000000000000000030060000000003000200040002000500020006000200070002000800020009000200350099003500A3003500AD003500B7003500C1003500CF0000000055496E7433320047657455496E743235360053657455496E74323536003C4D6F64756C653E00696E746572666163654944004765744964546F546F6B656E555249005365744964546F546F6B656E5552490076616C75655F5F00494E6F6E46756E6769626C65546F6B656E4D657461646174610053797374656D2E507269766174652E436F72654C696200696E74657266616365496400546F6B656E496400746F6B656E4964004C6F674D61726B417355736564004765744973557365640053657449735573656400476574417070726F76656400617070726F76656400696400546F6B656E496E746572666163650049537570706F727473496E746572666163650047657442616C616E63650053657442616C616E636500494D657373616765006765745F4D65737361676500494E6F6E46756E6769626C65546F6B656E456E756D657261626C65006765745F4E616D65007365745F4E616D65006E616D650056616C7565547970650043616E4F706572617465006765745F53746174650049536D617274436F6E74726163745374617465004950657273697374656E7453746174650073746174650044656275676761626C6541747472696275746500436F6D70696C6174696F6E52656C61786174696F6E7341747472696275746500496E6465784174747269627574650052756E74696D65436F6D7061746962696C6974794174747269627574650042797465006765745F52657475726E56616C75650076616C756500417070726F76650042616C616E63654F66004F776E65724F6600476574537472696E6700536574537472696E67006765745F4F776E65724F6E6C794D696E74696E67007365745F4F776E65724F6E6C794D696E74696E67006F776E65724F6E6C794D696E74696E67004F776E6572736869705472616E7366657265644C6F67004D61726B4173557365644C6F67004F776E6572736869705472616E736665725265717565737465644C6F6700417070726F76616C4C6F6700417070726F76616C466F72416C6C4C6F67005472616E736665724C6F670075726900536166655472616E7366657246726F6D496E7465726E616C005472616E73666572496E7465726E616C004C6F67417070726F76616C004765744964546F417070726F76616C005365744964546F417070726F76616C00436C656172417070726F76616C004973417070726F766564466F72416C6C004C6F67417070726F76616C466F72416C6C00536574417070726F76616C466F72416C6C0043616C6C00536D617274436F6E74726163742E646C6C006765745F53796D626F6C007365745F53796D626F6C0073796D626F6C00476574426F6F6C00536574426F6F6C0053797374656D00536166655472616E7366657246726F6D0066726F6D00456E756D00426F6F6C65616E00416464546F6B656E00456E73757265436F6E74726163745265636569766564546F6B656E00494E6F6E46756E6769626C65546F6B656E0052656D6F7665546F6B656E004D696E74546F6B656E006F705F5375627472616374696F6E006F705F4164646974696F6E004275726E00546F005A65726F00746F00436C61696D4F776E657273686970006765745F53656E646572004C6F675472616E736665720043616E5472616E73666572006765745F4F776E6572007365745F4F776E6572006765745F50656E64696E674F776E6572007365745F50656E64696E674F776E65720053657450656E64696E674F776E657200746F6B656E4F776E6572004765744964546F4F776E6572005365744964546F4F776E65720050726576696F75734F776E65720043757272656E744F776E6572004E65774F776E6572006E65774F776E6572006F776E657200494E6F6E46756E6769626C65546F6B656E5265636569766572004765744F776E6572546F4F70657261746F72005365744F776E6572546F4F70657261746F720049734F776E65724F724F70657261746F72002E63746F720053797374656D2E446961676E6F737469637300536574537570706F72746564496E74657266616365730053797374656D2E52756E74696D652E436F6D70696C6572536572766963657300446562756767696E674D6F646573006F70657261746F724164647265737300476574416464726573730053657441646472657373006164647265737300537472617469732E536D617274436F6E74726163747300466F726D6174004973436F6E747261637400495469636B6574436F6E747261637400536D617274436F6E7472616374004F626A656374006F705F496D706C6963697400495472616E73666572526573756C7400536166654D696E7400417373657274004765744964546F417070726F76616C4B6579004765744964546F4F776E65724B657900456E737572654F776E65724F6E6C79006F705F457175616C697479006F705F496E657175616C69747900456E737572654164647265737349734E6F74456D7074790000002D53007500700070006F00720074006500640049006E0074006500720066006100630065003A007B0030007D00001B4900640054006F004F0077006E00650072003A007B0030007D0000214900640054006F0041007000700072006F00760061006C003A007B0030007D000017420061006C0061006E00630065003A007B0030007D00002F4F0077006E006500720054006F004F00700065007200610074006F0072003A007B0030007D003A007B0031007D0000154900730055007300650064003A007B0030007D00000B4F0077006E00650072000019500065006E00640069006E0067004F0077006E006500720000094E0061006D006500000D530079006D0062006F006C00000F5500520049003A007B0030007D0000214F0077006E00650072004F006E006C0079004D0069006E00740069006E006700004D5400680065002000660072006F006D00200070006100720061006D00650074006500720020006900730020006E006F007400200074006F006B0065006E0020006F0077006E00650072002E00004F54006800650020007B0030007D0020006100640064007200650073007300200069007300200061006C0072006500610064007900200074006F006B0065006E0020006F0077006E00650072002E00001161007000700072006F007600650064000043430061006C006C006500720020006900730020006E006F00740020006F0077006E006500720020006E006F007200200061007000700072006F007600650064002E000057430061006C006C006500720020006900730020006E006F00740020006F0077006E006500720020006E006F007200200061007000700072006F00760065006400200066006F007200200074006F006B0065006E002E0000315400690063006B00650074002000770061007300200061006C0072006500610064007900200075007300650064002E00007143006C00610069006D004F0077006E0065007200730068006900700020006D007500730074002000620065002000630061006C006C0065006400200062007900200074006800650020006E00650077002800700065006E00640069006E006700290020006F0077006E00650072002E00003354006800650020006D006500740068006F00640020006900730020006F0077006E006500720020006F006E006C0079002E00002B54006F006B0065006E00200061006C007200650061006400790020006D0069006E007400650064002E0000354F006E004E006F006E00460075006E006700690062006C00650054006F006B0065006E0052006500630065006900760065006400004F4F006E004E006F006E00460075006E006700690062006C00650054006F006B0065006E00520065006300650069007600650064002000630061006C006C0020006600610069006C00650064002E0000494F006E006C007900200074006F006B0065006E0020006F0077006E00650072002000630061006E0020006200750072006E002000740068006500200074006F006B0065006E002E000039540068006500200061006400640072006500730073002000630061006E0020006E006F00740020006200650020007A00650072006F002E00000000008C629931B0A25947A574F3320067B7020004200101080320000105200101111104200012350500020E0E1C042001020E052002010E02052001111D0E062002010E111D05200111190E062002010E11190600030E0E1C1C0420010E0E052002010E0E0520010112210420001245042000111D040701111D07000202111D111D05200201020E04070111190500011119080800021119111911190306111D040701111006300101011E00040A0111100407011114040A0111140407011118040A0111180407011124040A0111240407011120040A011120080703111D111D111C040A01111C040701122505200102111D0B20051225111D0B0E1D1C0B0320001C087CEC85D7BEA7798E0401000000040200000004030000000404000000040500000004640000000206080306110C03061119020602042001020906200201110C020520010E1119062001111D1119072002011119111D0620011119111D07200201111D111907200202111D111D08200301111D111D020520010211190620020111190205200101111D0320000E042001010E0620020111190E0320000204200101020820040112210E0E020520010111190B200401111D111D11191D0509200301111D111D111906200201111D020920031119111D11190E0B20041119111D11190E1D0508200301111D11190E042800111D0328000E032800020801000800000000001E01000100540216577261704E6F6E457863657074696F6E5468726F777301080100020000000000000000000000000000000000000010000000000000000000000000000000D44000000000000000000000EE400000002000000000000000000000000000000000000000000000E0400000000000000000000000005F436F72446C6C4D61696E006D73636F7265652E646C6C0000000000FF2500200010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000C000000003100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

@YakupIpek
Copy link
Member

YakupIpek commented Mar 6, 2023

We should make some research about ticketing and how it is done in other chains. If there is currently any ERC standard then we should consider it to use.

Big issue i see on current design is, it changes current NFT implementation with none-standard methods for public usage. That means current NFTs are not going to compatible with these changes. Also we break standard implementation of the NFT.

My recommendation would be

Design another contract which you can transfer NFT and the contract can mark NFT as used then the contract send asset to destination address. The app can track logs of that contract.

I followed such design on some other sale NFT contracts. Here is NFTStore contract example.

When NFT ticket is placed for sale then you transfer ticket to Ticket contract address. Ticket contract is going to be notified by its OnNonFungibleTokenReceived method already by NFT Contract after it is transferred. OnNonFungibleTokenReceived method takes the parameter about which token transferred and by who. Also it takes another byte[] parameter which you can transfer extra data.

public bool OnNonFungibleTokenReceived(Address operatorAddress, Address fromAddress, UInt256 tokenId, byte[] data)

In here you can see that SafeTransferFrom is able to carry extra data to another contract.

public void SafeTransferFrom(Address from, Address to, UInt256 tokenId, byte[] data)

EnsureContractReceivedToken(from, to, tokenId, data);

In this way you can mark NFT tickets as used in Ticketing contract and read the logs.

I can give more details but let me know your opinion on this @madrazzl3 @fenix2222

public void MarkAsUsed(UInt256 tokenId)
{
EnsureOwnerOnly();
this.SetIsUsed(tokenId, true);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just remove This from here and others.

@YakupIpek
Copy link
Member

I left some more reviews and approved. You can merge after reviews.

@StratisIain
Copy link
Contributor

Contract has been whitelisted on CirrusTest

@StratisIain StratisIain merged commit cdf12db into stratisproject:master Mar 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants