tx · yuBBwuLtN8CRTpbtGjNzyFzTy2pBRryugpWEoeaLdex 3N66job2d8LT5VRVrR6sVrm5TetTVjHiBgK: -0.01000000 Waves 2022.10.19 13:13 [2279137] smart account 3N66job2d8LT5VRVrR6sVrm5TetTVjHiBgK > SELF 0.00000000 Waves
{ "type": 13, "id": "yuBBwuLtN8CRTpbtGjNzyFzTy2pBRryugpWEoeaLdex", "fee": 1000000, "feeAssetId": null, "timestamp": 1666174454355, "version": 2, "chainId": 84, "sender": "3N66job2d8LT5VRVrR6sVrm5TetTVjHiBgK", "senderPublicKey": "HtiQy2G7cXKiGN6z5x5aCuKqMKhLWN6RQCkkrstfEnpQ", "proofs": [ "64eTKvveH1BfBwzS7KN3BnxJRzdfdRiCrvBGADpbV9qHymPhAM9aUjgPrKWr3vY6Yktg9sFkUSYFqwxZ8ai5sw13" ], "script": "base64:AAIFAAAAAAAAAAcIAhIDCgEIAAAADQAAAAAMb3duZXJBZGRyZXNzAQAAABoBV4y1SJ9+nhXVGJeOG3f7CX9nYtrhbWMlSQAAAAAKbmZ0QWRkcmVzcwEAAAAAAAAAABBhcnRlZmFjdHNBZGRyZXNzAQAAAAAAAAAADWZlZUFnZ3JlZ2F0b3IBAAAAAAAAAAAKbmZ0QXNzZXRJZAEAAAAAAAAAAA5rR2xvYmFsQ291bnRlcgIAAAAOR0xPQkFMX0NPVU5URVIAAAAACmZlZVBlcmNlbnQAAAAAAAAAAAUAAAAAE2FydGVmYWN0c0ZlZVBlcmNlbnQAAAAAAAAAABQBAAAADXRyeUdldEludGVnZXIAAAABAAAAA2tleQQAAAADdmFsBAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAFiBQAAAAckbWF0Y2gwBQAAAAFiAAAAAAAAAAAABQAAAAN2YWwBAAAADHRyeUdldFN0cmluZwAAAAEAAAADa2V5BAAAAAN2YWwEAAAAByRtYXRjaDAJAAQd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AAAAAAAABkBQAAAA5wYXltZW50QXNzZXRJZAUAAAADbmlsAAAAAFZLHW4=", "height": 2279137, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: 5fz8V8TtRsDmfTfCcrqKqX2xBquU2bD8QazhbJfzpeJF Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 5 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let ownerAddress = base58'3PEktVux2RhchSN63DsDo4b4mz4QqzKSeDv' | |
5 | + | ||
6 | + | let nftAddress = base58'' | |
7 | + | ||
8 | + | let artefactsAddress = base58'' | |
9 | + | ||
10 | + | let feeAggregator = base58'' | |
11 | + | ||
12 | + | let nftAssetId = base58'' | |
13 | + | ||
14 | + | let kGlobalCounter = "GLOBAL_COUNTER" | |
15 | + | ||
16 | + | let feePercent = 5 | |
17 | + | ||
18 | + | let artefactsFeePercent = 20 | |
19 | + | ||
20 | + | func tryGetInteger (key) = { | |
21 | + | let val = match getInteger(this, key) { | |
22 | + | case b: Int => | |
23 | + | b | |
24 | + | case _ => | |
25 | + | 0 | |
26 | + | } | |
27 | + | val | |
28 | + | } | |
29 | + | ||
30 | + | ||
31 | + | func tryGetString (key) = { | |
32 | + | let val = match getString(this, key) { | |
33 | + | case b: String => | |
34 | + | b | |
35 | + | case _ => | |
36 | + | "" | |
37 | + | } | |
38 | + | val | |
39 | + | } | |
40 | + | ||
41 | + | ||
42 | + | func tryGetBoolean (key) = match getBoolean(this, key) { | |
43 | + | case b: Boolean => | |
44 | + | b | |
45 | + | case _ => | |
46 | + | false | |
47 | + | } | |
48 | + | ||
49 | + | ||
50 | + | func getGlobalCounter () = tryGetInteger(kGlobalCounter) | |
51 | + | ||
52 | + | ||
53 | + | func getAssetGenotype (assetId) = if ((value(assetInfo(assetId)).issuer == Address(artefactsAddress))) | |
54 | + | then "ART" | |
55 | + | else { | |
56 | + | let asset1 = match getString(Address(ownerAddress), toBase58String(assetId)) { | |
57 | + | case b: String => | |
58 | + | b | |
59 | + | case _ => | |
60 | + | "" | |
61 | + | } | |
62 | + | if ((asset1 != "")) | |
63 | + | then asset1 | |
64 | + | else { | |
65 | + | let asset2 = match getString(Address(nftAddress), toBase58String(assetId)) { | |
66 | + | case c: String => | |
67 | + | c | |
68 | + | case _ => | |
69 | + | "" | |
70 | + | } | |
71 | + | if ((asset2 != "")) | |
72 | + | then asset2 | |
73 | + | else "" | |
74 | + | } | |
75 | + | } | |
76 | + | ||
77 | + | ||
78 | + | @Callable(i) | |
79 | + | func nftBuy (nftId) = { | |
80 | + | let isnftart = tryGetBoolean((("nft_" + nftId) + "_nftart")) | |
81 | + | let paymentAssetId = if ((isnftart == true)) | |
82 | + | then nftAssetId | |
83 | + | else unit | |
84 | + | let paymentAssetName = if ((isnftart == true)) | |
85 | + | then "nftart" | |
86 | + | else "WAVES" | |
87 | + | let pmt = value(i.payments[0]) | |
88 | + | let amount = pmt.amount | |
89 | + | let assetId = tryGetString((("nft_" + nftId) + "_assetId")) | |
90 | + | let bidId = toBase58String(i.transactionId) | |
91 | + | let nftStatus = tryGetString((("nft_" + nftId) + "_status")) | |
92 | + | let finalFee = if ((tryGetBoolean((("nft_" + nftId) + "_isArtefact")) == true)) | |
93 | + | then artefactsFeePercent | |
94 | + | else feePercent | |
95 | + | if ((pmt.assetId != paymentAssetId)) | |
96 | + | then throw((("nft does only support " + paymentAssetName) + " payments.")) | |
97 | + | else if ((nftStatus != "open")) | |
98 | + | then throw("nft is closed. You cannot place a bid.") | |
99 | + | else { | |
100 | + | let instantPrice = tryGetInteger((("nft_" + nftId) + "_instantPrice")) | |
101 | + | if ((instantPrice > amount)) | |
102 | + | then throw(("For instant purchase you need to pay at least " + toString(instantPrice))) | |
103 | + | else { | |
104 | + | let nftOwner = tryGetString((("nft_" + nftId) + "_owner")) | |
105 | + | let recordPrice = tryGetInteger((assetId + "_recordPrice")) | |
106 | + | let newRecordPrice = max([recordPrice, amount]) | |
107 | + | [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(feeAggregator), fraction(amount, finalFee, 100), paymentAssetId)] | |
108 | + | } | |
109 | + | } | |
110 | + | } | |
111 | + | ||
112 | + |
github/deemru/w8io/169f3d6 29.01 ms ◑