tx · 2E89vURoTYtZFPzrTjFVQzsKL4k96PmNh3gVDtzbJXZL

3N2D6tJAXzcTDgUiTWmcdCHd6ctYwNENuBn:  -0.01000000 Waves

2022.11.02 13:55 [2299396] smart account 3N2D6tJAXzcTDgUiTWmcdCHd6ctYwNENuBn > SELF 0.00000000 Waves

{ "type": 13, "id": "2E89vURoTYtZFPzrTjFVQzsKL4k96PmNh3gVDtzbJXZL", "fee": 1000000, "feeAssetId": null, "timestamp": 1667386523363, "version": 2, "chainId": 84, "sender": "3N2D6tJAXzcTDgUiTWmcdCHd6ctYwNENuBn", "senderPublicKey": "Cq4RbcVcQJpCWyHiACDqUf2PbU8PaX949Dun9wRSeDzE", "proofs": [ "4VMDamgnrXXi38qU39cbaBGJGZmPvtZpGVnASza8jxQJeviA8WfVKH8qX2brjLsPL5SnENMpNnsM4Fv6WSgtmLp9" ], "script": "base64:AAIDAAAAAAAAAAsIARIHCgUIAQEIAQAAAAAAAAABAAAAAWkBAAAAB3NlbGxhcnQAAAAFAAAABWFydElkAAAABVByaWNlAAAAB21heE1pbnQAAAAHYXNzZXRJZAAAAAhCbG9ja0VuZAQAAAAFbmZ0SWQJAAJYAAAAAQgFAAAAAWkAAAANdHJhbnNhY3Rpb25JZAkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkAASwAAAACBQAAAAVuZnRJZAIAAAAKX29yZ2FuaXplcgkAAlgAAAABCAgFAAAAAWkAAAAGY2FsbGVyAAAABWJ5dGVzCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQABLAAAAAIFAAAABW5mdElkAgAAAAtfc3RhcnRQcmljZQUAAAAFUHJpY2UJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAAEsAAAAAgUAAAAFbmZ0SWQCAAAADV9wcmljZUFzc2V0SWQFAAAAB2Fzc2V0SWQJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAAEsAAAAAgUAAAAFbmZ0SWQCAAAAC19tYXhNaW50bmZ0BQAAAAdtYXhNaW50CQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQABLAAAAAIFAAAABW5mdElkAgAAAAlfQmxvY2tFbmQFAAAACEJsb2NrRW5kBQAAAANuaWwAAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAACQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAgFAAAAAnR4AAAAD3NlbmRlclB1YmxpY0tledojnw0=", "height": 2299396, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: HNVsJpMfWYk3acCdf2pwS2KmPRToAcAE1QSJwpWztbyR Next: 2PJWJu4VYuaVkm6rxdmVwnGR3L1PaNq3HBqWXhNj6do7 Full:
OldNewDifferences
1-{-# STDLIB_VERSION 5 #-}
1+{-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
4-let ownerAddress = base58''
54
6-let nftAddress = base58''
75
8-let nftAssetId = base58''
9-
10-let kGlobalCounter = "GLOBAL_COUNTER"
11-
12-let feePercent = 5
13-
14-let artefactsFeePercent = 20
15-
16-func tryGetInteger (key) = {
17- let val = match getInteger(this, key) {
18- case b: Int =>
19- b
20- case _ =>
21- 0
22- }
23- val
6+@Callable(i)
7+func sellart (artId,Price,maxMint,assetId,BlockEnd) = {
8+ let nftId = toBase58String(i.transactionId)
9+ WriteSet([DataEntry((nftId + "_organizer"), toBase58String(i.caller.bytes)), DataEntry((nftId + "_startPrice"), Price), DataEntry((nftId + "_priceAssetId"), assetId), DataEntry((nftId + "_maxMintnft"), maxMint), DataEntry((nftId + "_BlockEnd"), BlockEnd)])
2410 }
2511
2612
27-func tryGetString (key) = {
28- let val = match getString(this, key) {
29- case b: String =>
30- b
31- case _ =>
32- ""
33- }
34- val
35- }
36-
37-
38-func tryGetBoolean (key) = match getBoolean(this, key) {
39- case b: Boolean =>
40- b
41- case _ =>
42- false
43-}
44-
45-
46-func getGlobalCounter () = tryGetInteger(kGlobalCounter)
47-
48-
49-func getAssetGenotype (assetId) = if ((value(assetInfo(assetId)).issuer == Address(ownerAddress)))
50- then "ART"
51- else {
52- let asset1 = match getString(Address(ownerAddress), toBase58String(assetId)) {
53- case b: String =>
54- b
55- case _ =>
56- ""
57- }
58- if ((asset1 != ""))
59- then asset1
60- else {
61- let asset2 = match getString(Address(nftAddress), toBase58String(assetId)) {
62- case c: String =>
63- c
64- case _ =>
65- ""
66- }
67- if ((asset2 != ""))
68- then asset2
69- else ""
70- }
71- }
72-
73-
74-@Callable(i)
75-func nftBuy (nftId) = {
76- let isnftart = tryGetBoolean((("nft_" + nftId) + "_nftart"))
77- let paymentAssetId = if ((isnftart == true))
78- then nftAssetId
79- else unit
80- let paymentAssetName = if ((isnftart == true))
81- then "nftart"
82- else "WAVES"
83- let pmt = value(i.payments[0])
84- let amount = pmt.amount
85- let assetId = tryGetString((("nft_" + nftId) + "_assetId"))
86- let bidId = toBase58String(i.transactionId)
87- let nftStatus = tryGetString((("nft_" + nftId) + "_status"))
88- let finalFee = if ((tryGetBoolean((("nft_" + nftId) + "_isArtefact")) == true))
89- then artefactsFeePercent
90- else feePercent
91- if ((pmt.assetId != paymentAssetId))
92- then throw((("nft does only support " + paymentAssetName) + " payments."))
93- else if ((nftStatus != "open"))
94- then throw("nft is closed. You cannot place a bid.")
95- else {
96- let instantPrice = tryGetInteger((("nft_" + nftId) + "_instantPrice"))
97- if ((instantPrice > amount))
98- then throw(("For instant purchase you need to pay at least " + toString(instantPrice)))
99- else {
100- let nftOwner = tryGetString((("nft_" + nftId) + "_owner"))
101- let recordPrice = tryGetInteger((assetId + "_recordPrice"))
102- let newRecordPrice = max([recordPrice, amount])
103-[StringEntry((("nft_" + nftId) + "_status"), "finished"), IntegerEntry((("nft_" + nftId) + "_finalPrice"), amount), IntegerEntry((assetId + "_recordPrice"), newRecordPrice), StringEntry((((("assetId_" + assetId) + "_bid_") + bidId) + "_data"), (((((("{\"nftId\": \"" + nftId) + "\", \"author\": \"") + toString(i.originCaller)) + "\", \"amount\": \"") + toString(amount)) + "\", \"status\": \"finished\"}")), DeleteEntry((((("address_" + nftOwner) + "_nft_") + nftId) + "_lockedNFT")), ScriptTransfer(i.originCaller, 1, fromBase58String(getStringValue(this, (("nft_" + nftId) + "_assetId")))), ScriptTransfer(addressFromStringValue(nftOwner), fraction(amount, (100 - finalFee), 100), paymentAssetId), ScriptTransfer(Address(ownerAddress), fraction(amount, finalFee, 100), paymentAssetId)]
104- }
105- }
106- }
107-
13+@Verifier(tx)
14+func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
10815

github/deemru/w8io/169f3d6 
47.41 ms