tx · 68vEkzF76dyop3nTFC7sVep9KXsXBrKaZsiCfpvWZXKu

3Mr6LNXTo2cMvNMrka9pV1pwHZFXVHULoue:  -0.01400000 Waves

2021.12.06 09:26 [1822042] smart account 3Mr6LNXTo2cMvNMrka9pV1pwHZFXVHULoue > SELF 0.00000000 Waves

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

github/deemru/w8io/169f3d6 
42.24 ms