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:AAIFAAAAAAAAAVMIAhIDCgEBEgMKAQgSAwoBCBoOCgJhMRIIcHJpY2VLZXkaCwoCYTISBWFzc2V0Gg4KAmEzEghvd25lcktleRoPCgJhNBIJaXNzdWVyS2V5GhQKAmE1Eg5kZXNjcmlwdGlvbktleRoTCgJhNhINdHJ5R2V0SW50ZWdlchoJCgJhNxIDa2V5GgkKAmE4EgN2YWwaDQoCYTkSByRtYXRjaDAaEgoCYjESDHRyeUdldFN0cmluZxoLCgJiMhIFcHJpY2UaEgoCYjMSDGZpcnN0UGF5bWVudBoNCgJiNBIHYXNzZXRJZBoQCgJiNRIKYXNzZXRJZFN0choOCgJiNhIIYXNzZXRTdHIaDgoCYjcSCG93bmVyU3RyGgsKAmI4EgVvd25lchoWCgJiORIQZmlyc3RQYXltZW50Qm9vbBoJCgJjMRIDZmVlGgwKAmMyEgZ2ZXJpZnkAAAAGAQAAAAJhMQAAAAEAAAACYTIJAAEsAAAAAgUAAAACYTICAAAABl9wcmljZQEAAAACYTMAAAABAAAAAmEyCQABLAAAAAIFAAAAAmEyAgAAAAZfb3duZX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AAgAAAAECAAAANVRoZSBjYWxsaW5nIGFkZHJlc3MgaXMgbm90IHRoZSBvd25lciBvZiB0aGUgTkZUIHRva2VuCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAAFpAAAABmNhbGxlcgAAAAAAAAAAAQkAAlkAAAABBQAAAAJiNgkABEwAAAACCQEAAAALRGVsZXRlRW50cnkAAAABCQEAAAACYTEAAAABBQAAAAJiNgkABEwAAAACCQEAAAALRGVsZXRlRW50cnkAAAABCQEAAAACYTMAAAABBQAAAAJiNgkABEwAAAACCQEAAAALRGVsZXRlRW50cnkAAAABCQEAAAACYTQAAAABBQAAAAJiNgkABEwAAAACCQEAAAALRGVsZXRlRW50cnkAAAABCQEAAAACYTUAAAABBQAAAAJiNgUAAAADbmlsAAAAAQAAAAJ0eAEAAAACYzIAAAAACQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAgFAAAAAnR4AAAAD3NlbmRlclB1YmxpY0tleWRLvPI=",
"height": 1822042,
"applicationStatus": "succeeded",
"spentComplexity": 0
}
View: original | compacted
Prev: 7yTcDBLfPYvyzFuLGZbQMRNTwKcFvbNTrBUvQvxhEVAY
Next: 5dv17W9kjENMd97aBmUVcFFCMC5fR3Ahvm8gbAVtTi6Q
Diff:
Old | New | | Differences |
---|
8 | 8 | | |
---|
9 | 9 | | |
---|
10 | 10 | | func issuerKey (asset) = (asset + "_issuer") |
---|
| 11 | + | |
---|
| 12 | + | |
---|
| 13 | + | func descriptionKey (asset) = (asset + "_description") |
---|
11 | 14 | | |
---|
12 | 15 | | |
---|
13 | 16 | | func tryGetInteger (key) = { |
---|
|
56 | 59 | | then asset.reissuable |
---|
57 | 60 | | else false) |
---|
58 | 61 | | 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)] |
---|
60 | 63 | | } |
---|
61 | 64 | | |
---|
62 | 65 | | |
---|
|
88 | 91 | | then throw("Insufficient funds") |
---|
89 | 92 | | else { |
---|
90 | 93 | | 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))] |
---|
92 | 95 | | } |
---|
93 | 96 | | } |
---|
94 | 97 | | |
---|
|
105 | 108 | | } |
---|
106 | 109 | | if ((ownerStr != toBase58String(i.caller.bytes))) |
---|
107 | 110 | | 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))] |
---|
109 | 112 | | } |
---|
110 | 113 | | |
---|
111 | 114 | | |
---|
Full:
Old | New | | Differences |
---|
1 | 1 | | {-# STDLIB_VERSION 5 #-} |
---|
2 | 2 | | {-# SCRIPT_TYPE ACCOUNT #-} |
---|
3 | 3 | | {-# CONTENT_TYPE DAPP #-} |
---|
4 | 4 | | func priceKey (asset) = (asset + "_price") |
---|
5 | 5 | | |
---|
6 | 6 | | |
---|
7 | 7 | | func ownerKey (asset) = (asset + "_owner") |
---|
8 | 8 | | |
---|
9 | 9 | | |
---|
10 | 10 | | func issuerKey (asset) = (asset + "_issuer") |
---|
| 11 | + | |
---|
| 12 | + | |
---|
| 13 | + | func descriptionKey (asset) = (asset + "_description") |
---|
11 | 14 | | |
---|
12 | 15 | | |
---|
13 | 16 | | func tryGetInteger (key) = { |
---|
14 | 17 | | let val = match getInteger(this, key) { |
---|
15 | 18 | | case b: Int => |
---|
16 | 19 | | b |
---|
17 | 20 | | case _ => |
---|
18 | 21 | | 0 |
---|
19 | 22 | | } |
---|
20 | 23 | | val |
---|
21 | 24 | | } |
---|
22 | 25 | | |
---|
23 | 26 | | |
---|
24 | 27 | | func tryGetString (key) = { |
---|
25 | 28 | | let val = match getString(this, key) { |
---|
26 | 29 | | case b: String => |
---|
27 | 30 | | b |
---|
28 | 31 | | case _ => |
---|
29 | 32 | | "" |
---|
30 | 33 | | } |
---|
31 | 34 | | val |
---|
32 | 35 | | } |
---|
33 | 36 | | |
---|
34 | 37 | | |
---|
35 | 38 | | @Callable(i) |
---|
36 | 39 | | func offerForSale (price) = { |
---|
37 | 40 | | let firstPayment = value(i.payments[0]) |
---|
38 | 41 | | let assetId = match firstPayment.assetId { |
---|
39 | 42 | | case id: ByteVector => |
---|
40 | 43 | | id |
---|
41 | 44 | | case w: Unit => |
---|
42 | 45 | | throw("Asset is not NFT") |
---|
43 | 46 | | case _ => |
---|
44 | 47 | | throw("Match error") |
---|
45 | 48 | | } |
---|
46 | 49 | | let assetIdStr = toBase58String(assetId) |
---|
47 | 50 | | let asset = match assetInfo(assetId) { |
---|
48 | 51 | | case a: Asset => |
---|
49 | 52 | | a |
---|
50 | 53 | | case _ => |
---|
51 | 54 | | throw("Error getting information about asset") |
---|
52 | 55 | | } |
---|
53 | 56 | | if (if (if ((asset.quantity != 1)) |
---|
54 | 57 | | then (asset.decimals != 0) |
---|
55 | 58 | | else false) |
---|
56 | 59 | | then asset.reissuable |
---|
57 | 60 | | else false) |
---|
58 | 61 | | 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)] |
---|
60 | 63 | | } |
---|
61 | 64 | | |
---|
62 | 65 | | |
---|
63 | 66 | | |
---|
64 | 67 | | @Callable(i) |
---|
65 | 68 | | func buy (assetStr) = { |
---|
66 | 69 | | let price = tryGetInteger(priceKey(assetStr)) |
---|
67 | 70 | | let ownerStr = tryGetString(ownerKey(assetStr)) |
---|
68 | 71 | | let owner = match addressFromString(ownerStr) { |
---|
69 | 72 | | case a: Address => |
---|
70 | 73 | | a |
---|
71 | 74 | | case _ => |
---|
72 | 75 | | throw("Address parsing error") |
---|
73 | 76 | | } |
---|
74 | 77 | | let firstPayment = value(i.payments[0]) |
---|
75 | 78 | | let firstPaymentBool = match firstPayment.assetId { |
---|
76 | 79 | | case t: ByteVector => |
---|
77 | 80 | | true |
---|
78 | 81 | | case w: Unit => |
---|
79 | 82 | | false |
---|
80 | 83 | | case _ => |
---|
81 | 84 | | throw("Match error") |
---|
82 | 85 | | } |
---|
83 | 86 | | if ((price == 0)) |
---|
84 | 87 | | then throw("This NFT is not for sale") |
---|
85 | 88 | | else if (firstPaymentBool) |
---|
86 | 89 | | then throw("Payment must be in Waves tokens only") |
---|
87 | 90 | | else if ((price > firstPayment.amount)) |
---|
88 | 91 | | then throw("Insufficient funds") |
---|
89 | 92 | | else { |
---|
90 | 93 | | 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))] |
---|
92 | 95 | | } |
---|
93 | 96 | | } |
---|
94 | 97 | | |
---|
95 | 98 | | |
---|
96 | 99 | | |
---|
97 | 100 | | @Callable(i) |
---|
98 | 101 | | func cancelSelling (assetStr) = { |
---|
99 | 102 | | let ownerStr = tryGetString(ownerKey(assetStr)) |
---|
100 | 103 | | let owner = match addressFromString(ownerStr) { |
---|
101 | 104 | | case a: Address => |
---|
102 | 105 | | a |
---|
103 | 106 | | case _ => |
---|
104 | 107 | | throw("Address parsing error") |
---|
105 | 108 | | } |
---|
106 | 109 | | if ((ownerStr != toBase58String(i.caller.bytes))) |
---|
107 | 110 | | 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))] |
---|
109 | 112 | | } |
---|
110 | 113 | | |
---|
111 | 114 | | |
---|
112 | 115 | | @Verifier(tx) |
---|
113 | 116 | | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) |
---|
114 | 117 | | |
---|