tx · 5dv17W9kjENMd97aBmUVcFFCMC5fR3Ahvm8gbAVtTi6Q

3Mr6LNXTo2cMvNMrka9pV1pwHZFXVHULoue:  -0.01400000 Waves

2021.12.06 09:59 [1822072] smart account 3Mr6LNXTo2cMvNMrka9pV1pwHZFXVHULoue > SELF 0.00000000 Waves

{ "type": 13, "id": "5dv17W9kjENMd97aBmUVcFFCMC5fR3Ahvm8gbAVtTi6Q", "fee": 1400000, "feeAssetId": null, "timestamp": 1638774010719, "version": 2, "chainId": 84, "sender": "3Mr6LNXTo2cMvNMrka9pV1pwHZFXVHULoue", "senderPublicKey": "9tHFZ3PMkyXBYPkjU77RdMPEGBzfm7BWxfuHvGjgdrv5", "proofs": [ "2pAX3MKJs2PtEpzLvFcuxRHckAarcG4WU3iJe9BhEMud4QioyD1Dn8zBAQChHmQ17BEHcQVy4kfihw5vrNxSyzEb" ], "script": "base64:AAIFAAAAAAAAAWIIAhIDCgEBEgMKAQgSAwoBCBoOCgJhMRIIcHJpY2VLZXkaCwoCYTISBWFzc2V0Gg4KAmEzEghvd25lcktleRoPCgJhNBIJaXNzdWVyS2V5Gg0KAmE1EgduYW1lS2V5GhQKAmE2Eg5kZXNjcmlwdGlvbktleRoTCgJhNxINdHJ5R2V0SW50ZWdlchoJCgJhOBIDa2V5GgkKAmE5EgN2YWwaDQoCYjESByRtYXRjaDAaEgoCYjISDHRyeUdldFN0cmluZxoLCgJiMxIFcHJpY2UaEgoCYjQSDGZpcnN0UGF5bWVudBoNCgJiNRIHYXNzZXRJZBoQCgJiNhIKYXNzZXRJZFN0choOCgJiNxIIYXNzZXRTdHIaDgoCYjgSCG93bmVyU3RyGgsKAmI5EgVvd25lchoWCgJjMRIQZmlyc3RQYXltZW50Qm9vbBoJCgJjMhIDZmVlGgwKAmMzEgZ2ZXJpZnkAAAAHAQAAAAJhMQAAAAEAAAACYTIJAAEsAAAAAgUAAAACYTICAAAABl9wcmljZQEAAAACYTMAAAABAAAAAmEyCQABLAAAAAIFAAAAA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mI4AwkAAAEAAAACBQAAAAJiMQIAAAAHQWRkcmVzcwQAAAABYQUAAAACYjEFAAAAAWEJAAACAAAAAQIAAAAVQWRkcmVzcyBwYXJzaW5nIGVycm9yAwkBAAAAAiE9AAAAAgUAAAACYjgJAAJYAAAAAQgIBQAAAAFpAAAABmNhbGxlcgAAAAVieXRlcwkAAAIAAAABAgAAADVUaGUgY2FsbGluZyBhZGRyZXNzIGlzIG5vdCB0aGUgb3duZXIgb2YgdGhlIE5GVCB0b2tlbgkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADCAUAAAABaQAAAAZjYWxsZXIAAAAAAAAAAAEJAAJZAAAAAQUAAAACYjcJAARMAAAAAgkBAAAAC0RlbGV0ZUVudHJ5AAAAAQkBAAAAAmExAAAAAQUAAAACYjcJAARMAAAAAgkBAAAAC0RlbGV0ZUVudHJ5AAAAAQkBAAAAAmEzAAAAAQUAAAACYjcJAARMAAAAAgkBAAAAC0RlbGV0ZUVudHJ5AAAAAQkBAAAAAmE0AAAAAQUAAAACYjcJAARMAAAAAgkBAAAAC0RlbGV0ZUVudHJ5AAAAAQkBAAAAAmE1AAAAAQUAAAACYjcJAARMAAAAAgkBAAAAC0RlbGV0ZUVudHJ5AAAAAQkBAAAAAmE2AAAAAQUAAAACYjcFAAAAA25pbAAAAAEAAAACdHgBAAAAAmMzAAAAAAkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAIBQAAAAJ0eAAAAA9zZW5kZXJQdWJsaWNLZXmIoM4C", "height": 1822072, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 68vEkzF76dyop3nTFC7sVep9KXsXBrKaZsiCfpvWZXKu Next: none Diff:
OldNewDifferences
88
99
1010 func issuerKey (asset) = (asset + "_issuer")
11+
12+
13+func nameKey (asset) = (asset + "_name")
1114
1215
1316 func descriptionKey (asset) = (asset + "_description")
5962 then asset.reissuable
6063 else false)
6164 then throw("Asset is not NFT")
62- else [IntegerEntry(priceKey(assetIdStr), price), StringEntry(ownerKey(assetIdStr), toBase58String(i.caller.bytes)), StringEntry(issuerKey(assetIdStr), toBase58String(asset.issuer.bytes)), StringEntry(descriptionKey(assetIdStr), asset.description)]
65+ else [IntegerEntry(priceKey(assetIdStr), price), StringEntry(ownerKey(assetIdStr), toBase58String(i.caller.bytes)), StringEntry(issuerKey(assetIdStr), toBase58String(asset.issuer.bytes)), StringEntry(nameKey(assetIdStr), asset.name), StringEntry(descriptionKey(assetIdStr), asset.description)]
6366 }
6467
6568
9194 then throw("Insufficient funds")
9295 else {
9396 let fee = ((price / 100) * 5)
94-[ScriptTransfer(i.caller, 1, fromBase58String(assetStr)), ScriptTransfer(owner, (price - fee), unit), DeleteEntry(priceKey(assetStr)), DeleteEntry(ownerKey(assetStr)), DeleteEntry(issuerKey(assetStr)), DeleteEntry(descriptionKey(assetStr))]
97+[ScriptTransfer(i.caller, 1, fromBase58String(assetStr)), ScriptTransfer(owner, (price - fee), unit), DeleteEntry(priceKey(assetStr)), DeleteEntry(ownerKey(assetStr)), DeleteEntry(issuerKey(assetStr)), DeleteEntry(nameKey(assetStr)), DeleteEntry(descriptionKey(assetStr))]
9598 }
9699 }
97100
108111 }
109112 if ((ownerStr != toBase58String(i.caller.bytes)))
110113 then throw("The calling address is not the owner of the NFT token")
111- else [ScriptTransfer(i.caller, 1, fromBase58String(assetStr)), DeleteEntry(priceKey(assetStr)), DeleteEntry(ownerKey(assetStr)), DeleteEntry(issuerKey(assetStr)), DeleteEntry(descriptionKey(assetStr))]
114+ else [ScriptTransfer(i.caller, 1, fromBase58String(assetStr)), DeleteEntry(priceKey(assetStr)), DeleteEntry(ownerKey(assetStr)), DeleteEntry(issuerKey(assetStr)), DeleteEntry(nameKey(assetStr)), DeleteEntry(descriptionKey(assetStr))]
112115 }
113116
114117
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 func priceKey (asset) = (asset + "_price")
55
66
77 func ownerKey (asset) = (asset + "_owner")
88
99
1010 func issuerKey (asset) = (asset + "_issuer")
11+
12+
13+func nameKey (asset) = (asset + "_name")
1114
1215
1316 func descriptionKey (asset) = (asset + "_description")
1417
1518
1619 func tryGetInteger (key) = {
1720 let val = match getInteger(this, key) {
1821 case b: Int =>
1922 b
2023 case _ =>
2124 0
2225 }
2326 val
2427 }
2528
2629
2730 func tryGetString (key) = {
2831 let val = match getString(this, key) {
2932 case b: String =>
3033 b
3134 case _ =>
3235 ""
3336 }
3437 val
3538 }
3639
3740
3841 @Callable(i)
3942 func offerForSale (price) = {
4043 let firstPayment = value(i.payments[0])
4144 let assetId = match firstPayment.assetId {
4245 case id: ByteVector =>
4346 id
4447 case w: Unit =>
4548 throw("Asset is not NFT")
4649 case _ =>
4750 throw("Match error")
4851 }
4952 let assetIdStr = toBase58String(assetId)
5053 let asset = match assetInfo(assetId) {
5154 case a: Asset =>
5255 a
5356 case _ =>
5457 throw("Error getting information about asset")
5558 }
5659 if (if (if ((asset.quantity != 1))
5760 then (asset.decimals != 0)
5861 else false)
5962 then asset.reissuable
6063 else false)
6164 then throw("Asset is not NFT")
62- else [IntegerEntry(priceKey(assetIdStr), price), StringEntry(ownerKey(assetIdStr), toBase58String(i.caller.bytes)), StringEntry(issuerKey(assetIdStr), toBase58String(asset.issuer.bytes)), StringEntry(descriptionKey(assetIdStr), asset.description)]
65+ else [IntegerEntry(priceKey(assetIdStr), price), StringEntry(ownerKey(assetIdStr), toBase58String(i.caller.bytes)), StringEntry(issuerKey(assetIdStr), toBase58String(asset.issuer.bytes)), StringEntry(nameKey(assetIdStr), asset.name), StringEntry(descriptionKey(assetIdStr), asset.description)]
6366 }
6467
6568
6669
6770 @Callable(i)
6871 func buy (assetStr) = {
6972 let price = tryGetInteger(priceKey(assetStr))
7073 let ownerStr = tryGetString(ownerKey(assetStr))
7174 let owner = match addressFromString(ownerStr) {
7275 case a: Address =>
7376 a
7477 case _ =>
7578 throw("Address parsing error")
7679 }
7780 let firstPayment = value(i.payments[0])
7881 let firstPaymentBool = match firstPayment.assetId {
7982 case t: ByteVector =>
8083 true
8184 case w: Unit =>
8285 false
8386 case _ =>
8487 throw("Match error")
8588 }
8689 if ((price == 0))
8790 then throw("This NFT is not for sale")
8891 else if (firstPaymentBool)
8992 then throw("Payment must be in Waves tokens only")
9093 else if ((price > firstPayment.amount))
9194 then throw("Insufficient funds")
9295 else {
9396 let fee = ((price / 100) * 5)
94-[ScriptTransfer(i.caller, 1, fromBase58String(assetStr)), ScriptTransfer(owner, (price - fee), unit), DeleteEntry(priceKey(assetStr)), DeleteEntry(ownerKey(assetStr)), DeleteEntry(issuerKey(assetStr)), DeleteEntry(descriptionKey(assetStr))]
97+[ScriptTransfer(i.caller, 1, fromBase58String(assetStr)), ScriptTransfer(owner, (price - fee), unit), DeleteEntry(priceKey(assetStr)), DeleteEntry(ownerKey(assetStr)), DeleteEntry(issuerKey(assetStr)), DeleteEntry(nameKey(assetStr)), DeleteEntry(descriptionKey(assetStr))]
9598 }
9699 }
97100
98101
99102
100103 @Callable(i)
101104 func cancelSelling (assetStr) = {
102105 let ownerStr = tryGetString(ownerKey(assetStr))
103106 let owner = match addressFromString(ownerStr) {
104107 case a: Address =>
105108 a
106109 case _ =>
107110 throw("Address parsing error")
108111 }
109112 if ((ownerStr != toBase58String(i.caller.bytes)))
110113 then throw("The calling address is not the owner of the NFT token")
111- else [ScriptTransfer(i.caller, 1, fromBase58String(assetStr)), DeleteEntry(priceKey(assetStr)), DeleteEntry(ownerKey(assetStr)), DeleteEntry(issuerKey(assetStr)), DeleteEntry(descriptionKey(assetStr))]
114+ else [ScriptTransfer(i.caller, 1, fromBase58String(assetStr)), DeleteEntry(priceKey(assetStr)), DeleteEntry(ownerKey(assetStr)), DeleteEntry(issuerKey(assetStr)), DeleteEntry(nameKey(assetStr)), DeleteEntry(descriptionKey(assetStr))]
112115 }
113116
114117
115118 @Verifier(tx)
116119 func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
117120

github/deemru/w8io/169f3d6 
34.29 ms