Contract con_ignoreit


Contract Code


  
1 I = importlib
2
3 collection_name = Variable()
4 collection_owner = Variable()
5 collection_nfts = Hash(default_value=0)
6 collection_balances = Hash(default_value=0)
7 collection_balances_approvals = Hash(default_value=0)
8 pixelwhale = Variable()
9 pixelwhale_info = Variable()
10
11
12 @construct
13 def seed():
14 collection_name.set("PixelWhale NFTs")
15 collection_owner.set(ctx.caller)
16 pixelwhale.set("con_pixel_whale_master_v1")
17 pixelwhale_info.set("con_pixel_whale_info_v1")
18
19 @export
20 def update_pixelwhale_contract(contract:str):
21 assert ctx.caller == collection_owner.get(), "Only the owner can call this"
22 pixelwhale.set(contract)
23
24 @export
25 def update_pixelwhale_info_contract(contract:str):
26 assert ctx.caller == collection_owner.get(), "Only the owner can call this"
27 pixelwhale_info.set(contract)
28
29
30 @export
31 def wrap_nft(uid: str):
32 #UID = https://www.pixelwhale.io/frames/>> 24f24ad8ed17ccde5b544edfc46f15ad10f51ba17fb89e9088fec0237c3467db <<
33 info = ForeignHash(foreign_contract=pixelwhale_info.get(), foreign_name='S')
34
35 I.import_module(pixelwhale.get()).transfer_from(uid=uid, to=ctx.this, main_account=ctx.caller)
36 if(collection_nfts[info[uid, 'name']] == 0):
37 collection_nfts[info[uid, 'name']] = {"description": info[uid, 'description'], "ipfs_image_url": f"https://www.pixelwhale.io/gif/{uid}.gif" , "metadata": {"speed":info[uid, 'meta', 'speed'], "num_of_frames":info[uid, 'meta', 'num_of_frames'], "uid": uid}, "amount": 1}
38 collection_balances[ctx.caller, info[uid, 'name']] = 1
39 else:
40 transfer(name=info[uid, 'name'], amount=1, to=ctx.caller)
41
42
43 @export
44 def unwrap_nft(uid: str):
45 #UID = https://www.pixelwhale.io/frames/>> 24f24ad8ed17ccde5b544edfc46f15ad10f51ba17fb89e9088fec0237c3467db <<
46 info = ForeignHash(foreign_contract=pixelwhale_info.get(), foreign_name='S')
47 transfer_from(name=info[uid, 'name'], amount=1, to=ctx.this, main_account=ctx.caller)
48 I.import_module(pixelwhale.get()).transfer(uid=uid, new_owner=ctx.caller)
49
50
51 @export
52 def transfer(name: str, amount:int, to: str):
53 assert amount > 0, "You cannot transfer negative amounts"
54 assert name != "", "Please specify the name of the NFT you want to transfer"
55 assert collection_balances[ctx.caller, name] >= amount, "You dont have enough NFTs to send"
56 collection_balances[ctx.caller, name] -= amount
57 collection_balances[to, name] += amount # Adds amount to receiver
58
59
60 @export
61 def approve(amount: int, name: str, to: str):
62 assert amount > 0, "Cannot approve negative amounts"
63 collection_balances_approvals[ctx.caller, to, name] += amount
64
65
66 @export
67 def transfer_from(name:str, amount:int, to: str, main_account: str):
68 assert amount > 0, "Cannot send negative balances!"
69 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)
70 assert collection_balances[main_account, name] >= amount, "Not enough NFTs to send!"
71 collection_balances_approvals[main_account, to, name] -= amount
72 collection_balances[main_account, name] -= amount
73 collection_balances[to, name] += amount

Byte Code

e30000000000000000000000000600000040000000731201000065005a0165026400640164028d025a0365026400640364028d025a04650564046400640564068d035a06650564046400640764068d035a07650564046400640864068d035a0865026400640964028d025a0965026400640a64028d025a0a640b640c84005a0b650c64008301650d640d9c01640e640f840483015a0e650c64008301650d640d9c0164106411840483015a0f650c64008301650d64129c0164136414840483015a10650c64008301650d64129c0164156416840483015a11650c64008301650d6512650d64179c0364186419840483015a13650c640083016512650d650d641a9c03641b641c840483015a14650c64008301650d6512650d650d641d9c04641e641f840483015a15642053002921da0c636f6e5f69676e6f72656974da0f636f6c6c656374696f6e5f6e616d652902da08636f6e7472616374da046e616d65da10636f6c6c656374696f6e5f6f776e6572e900000000da0f636f6c6c656374696f6e5f6e6674732903da0d64656661756c745f76616c756572030000007204000000da13636f6c6c656374696f6e5f62616c616e636573da1d636f6c6c656374696f6e5f62616c616e6365735f617070726f76616c73da0a706978656c7768616c65da0f706978656c7768616c655f696e666f630000000000000000000000000200000043000000732e00000074006a0164018301010074026a0174036a048301010074056a0164028301010074066a016403830101006400530029044e7a0f506978656c5768616c65204e465473da19636f6e5f706978656c5f7768616c655f6d61737465725f7631da17636f6e5f706978656c5f7768616c655f696e666f5f76312907da115f5f636f6c6c656374696f6e5f6e616d65da03736574da125f5f636f6c6c656374696f6e5f6f776e6572da03637478da0663616c6c6572da0c5f5f706978656c7768616c65da115f5f706978656c7768616c655f696e666fa90072160000007216000000da00da045f5f5f5f0e000000730800000000010a010c010a01721800000029017203000000630100000000000000010000000200000043000000732400000074006a0174026a0383006b027316740464018301820174056a067c00830101006400530029024e7a1c4f6e6c7920746865206f776e65722063616e2063616c6c20746869732907721200000072130000007211000000da03676574da0e417373657274696f6e4572726f727214000000721000000029017203000000721600000072160000007217000000da1a7570646174655f706978656c7768616c655f636f6e7472616374150000007306000000000210010601721b000000630100000000000000010000000200000043000000732400000074006a0174026a0383006b027316740464018301820174056a067c00830101006400530029024e7a1c4f6e6c7920746865206f776e65722063616e2063616c6c207468697329077212000000721300000072110000007219000000721a0000007215000000721000000029017203000000721600000072160000007217000000da1f7570646174655f706978656c7768616c655f696e666f5f636f6e74726163741c0000007306000000000210010601721c0000002901da0375696463010000000000000002000000070000004300000073c0000000740074016a02830064016402640364048d047d0174036a0474056a02830083016a067c0074076a0874076a0964058d030100740a7c017c00640666021900190064076b0272a47c017c0064086602190064097c009b00640a9d037c017c00640b640c660319007c017c00640b640d660319007c00640e9c03640f64109c04740a7c017c006406660219003c00640f740b74076a097c017c0064066602190066023c006e18740c7c017c00640666021900640f74076a0964118d0301006400530029124eda01537201000000da04696e666f2904da10666f726569676e5f636f6e7472616374da0c666f726569676e5f6e616d65720300000072040000002903721d000000da02746fda0c6d61696e5f6163636f756e7472040000007206000000da0b6465736372697074696f6e7a1e68747470733a2f2f7777772e706978656c7768616c652e696f2f6769662f7a042e676966da046d657461da057370656564da0d6e756d5f6f665f6672616d6573290372260000007227000000721d000000e90100000029047224000000da0e697066735f696d6167655f75726cda086d65746164617461da06616d6f756e7429037204000000722b0000007222000000290dda0b466f726569676e4861736872150000007219000000da0149da0d696d706f72745f6d6f64756c657214000000da0d7472616e736665725f66726f6d7212000000da04746869737213000000da115f5f636f6c6c656374696f6e5f6e667473da155f5f636f6c6c656374696f6e5f62616c616e636573da087472616e736665722902721d000000da065f5f696e666f721600000072160000007217000000da08777261705f6e6674230000007318000000000208010c0114010a011401040106010a010e01240118027235000000630100000000000000020000000600000043000000734e000000740074016a02830064016402640364048d047d0174037c017c00640566021900640674046a0574046a0664078d04010074076a0874096a02830083016a0a7c0074046a0664088d0201006400530029094e721e0000007201000000721f000000290472200000007221000000720300000072040000007204000000722800000029047204000000722b000000722200000072230000002902721d000000da096e65775f6f776e6572290b722c00000072150000007219000000722f000000721200000072300000007213000000722d000000722e000000721400000072330000002902721d0000007234000000721600000072160000007217000000da0a756e777261705f6e667434000000730a000000000208010c0112010a01723700000029037204000000722b000000722200000063030000000000000003000000040000004300000073680000007c0164016b04731074006402830182017c0064036b0373207400640483018201740174026a037c00660219007c016b05733a7400640583018201740174026a037c006602050019007c01380003003c0074017c027c006602050019007c01370003003c006400530029064e72060000007a24596f752063616e6e6f74207472616e73666572206e6567617469766520616d6f756e747372170000007a37506c65617365207370656369667920746865206e616d65206f6620746865204e465420796f752077616e7420746f207472616e736665727a21596f7520646f6e74206861766520656e6f756768204e46547320746f2073656e642904721a00000072320000007212000000721300000029037204000000722b000000722200000072160000007216000000721700000072330000003d000000730c0000000002100110010c010e01160172330000002903722b00000072040000007222000000630300000000000000030000000400000043000000732c0000007c0064016b0473107400640283018201740174026a037c027c016603050019007c00370003003c006400530029034e72060000007a1f43616e6e6f7420617070726f7665206e6567617469766520616d6f756e74732904721a000000da1f5f5f636f6c6c656374696f6e5f62616c616e6365735f617070726f76616c73721200000072130000002903722b00000072040000007222000000721600000072160000007217000000da07617070726f766547000000730400000000021001723900000029047204000000722b0000007222000000722300000063040000000000000004000000060000004300000073960000007c0164016b047310740064028301820174017c037c027c00660319007c016b05733c740064036a0274017c037c027c00660319007c0183028301820174037c037c00660219007c016b057354740064048301820174017c037c027c006603050019007c01380003003c0074037c037c006602050019007c01380003003c0074037c027c006602050019007c01370003003c006400530029054e72060000007a1e43616e6e6f742073656e64206e656761746976652062616c616e636573217a484e6f7420656e6f756768204e46547320617070726f76656420746f2073656e642120596f752068617665207b7d20616e642061726520747279696e6720746f207370656e64207b7d7a184e6f7420656e6f756768204e46547320746f2073656e64212904721a0000007238000000da06666f726d6174723200000029047204000000722b00000072220000007223000000721600000072160000007217000000722f0000004d0000007312000000000210010c010c0114010a010e0116011401722f0000004e2916da09696d706f72746c6962722d000000da085661726961626c65720f0000007211000000da0448617368723100000072320000007238000000721400000072150000007218000000da085f5f6578706f7274da03737472721b000000721c00000072350000007237000000da03696e7472330000007239000000722f0000007216000000721600000072160000007217000000da083c6d6f64756c653e01000000733200000004010c010c01060108010601080104010a010c010c0308070601100606011006060110100601100806011409060114050601