tx · FTEkwSbc8XAmWnCF4EFZgraG1amBjypGcxDuTJRiAdgE 3MtVYGt1cJJB8g21cvSzJScK3hxUi9JHdcN: -0.01400000 Waves 2021.12.23 14:12 [1846830] smart account 3MtVYGt1cJJB8g21cvSzJScK3hxUi9JHdcN > SELF 0.00000000 Waves
{ "type": 13, "id": "FTEkwSbc8XAmWnCF4EFZgraG1amBjypGcxDuTJRiAdgE", "fee": 1400000, "feeAssetId": null, "timestamp": 1640258034803, "version": 2, "chainId": 84, "sender": "3MtVYGt1cJJB8g21cvSzJScK3hxUi9JHdcN", "senderPublicKey": "65qdY9G3EVQgF1GhvrT6rw2zPmUsFirt9Kjm5q5fdJvu", "proofs": [ "83vXrtCMj8eMegVRvrw6siL7A1gTJequotHHvHdzc6AzLdPPayEBPGLt9HPRBP8hJKK9ujByXEbU7e9ZF4HAY7G" ], "script": "base64:AAIFAAAAAAAAAz0IAhIGCgQBAQgIEgMKAQgSAwoBCBIDCgEIEgQKAggIEgQKAggIEgQKAggIGg4KAUESCWJpZEF1dGhvchoOCgFCEgliaWRBbW91bnQaBgoBQxIBaRoPCgFEEgpzdGFydFByaWNlGhEKAUUSDGluc3RhbnRQcmljZRoQCgFGEgtkZXNjcmlwdGlvbhoMCgFHEgdlZ2dTZWxsGhIKAUgSDWdsb2JhbENvdW50ZXIaCAoBSRIDcG10GgoKAUoSBWFzc2V0GhEKAUsSDGF1Y3Rpb25Pd25lchoVCgFMEhBwYXltZW50QXNzZXROYW1lGgsKAU0SBmFtb3VudBoSCgFOEg1hdWN0aW9uU3RhdHVzGg0KAU8SCGZpbmFsRmVlGhAKAVASC3JlY29yZFByaWNlGhMKAVESDm5ld1JlY29yZFByaWNlGg0KAVISCG1pblByaWNlGg4KAVMSCWJpZFN0YXR1cxoHCgFUEgJ0eBoLCgFVEgZ2ZXJpZnkaFQoBYRIQaW5jdWJhdG9yQWRkcmVzcxoTCgFiEg5icmVlZGVyQWRkcmVzcxoVCgFjEhBhcnRlZmFjdHNBZG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FCCQAETAAAAAIJAQAAAAxJbnRlZ2VyRW50cnkAAAACCQABLAAAAAIFAAAAAXICAAAADF9yZWNvcmRQcmljZQUAAAABUQkABEwAAAACCQEAAAALRGVsZXRlRW50cnkAAAABCQABLAAAAAIJAAEsAAAAAgkAASwAAAACCQABLAAAAAIJAAEsAAAAAgIAAAAIYWRkcmVzc18FAAAAAUECAAAACV9hdWN0aW9uXwUAAAABdwIAAAAFX2JpZF8FAAAAAXgJAARMAAAAAgkBAAAAC0RlbGV0ZUVudHJ5AAAAAQkAASwAAAACCQABLAAAAAIJAAEsAAAAAgkAASwAAAACAgAAAAhhZGRyZXNzXwUAAAABSwIAAAAJX2F1Y3Rpb25fBQAAAAF3AgAAAApfbG9ja2VkTkZUCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAAFDAAAABmNhbGxlcgkAAGsAAAADBQAAAAFCCQAAZQAAAAIAAAAAAAAAAGQFAAAAAU8AAAAAAAAAAGQFAAAAAXoJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwkBAAAAB0FkZHJlc3MAAAABBQAAAAFkCQAAawAAAAMFAAAAAUIFAAAAAU8AAAAAAAAAAGQFAAAAAXoJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwkBAAAAEUBleHRyTmF0aXZlKDEwNjIpAAAAAQUAAAABQQAAAAAAAAAAAQkAAlkAAAABBQAAAAFyBQAAAANuaWwAAAABAAAAAVQBAAAAAVUAAAAACQAB9AAAAAMIBQAAAAFUAAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAABVAAAAAZwcm9vZnMAAAAAAAAAAAAIBQAAAAFUAAAAD3NlbmRlclB1YmxpY0tledRLx0Y=", "height": 1846830, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: EneWmzuMyo8bPo935j7KBhNwm1sHMbCptMKdnJqiyDh Next: Eq3cjaSrZ8dGipmGjKWAqPCdp6zhKHeXvBrG9sSecYWt Diff:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let | |
4 | + | let incubatorAddress = base58'3PEktVux2RhchSN63DsDo4b4mz4QqzKSeDv' | |
5 | 5 | ||
6 | - | let | |
6 | + | let breederAddress = base58'3PDVuU45H7Eh5dmtNbnRNRStGwULA7NY6Hb' | |
7 | 7 | ||
8 | - | let ownerAddress = base58'3MpADDQFqadaCADNH9JDMQAGw9WEaMcymVU' | |
8 | + | let artefactsAddress = base58'3P5E9xamcWoymiqLx8ZdmR7o4fJSRMGp1WR' | |
9 | + | ||
10 | + | let feeAggregator = base58'3P6AobNbcQ3ZjcRY37mJPKN8PP9Giz8kgeY' | |
11 | + | ||
12 | + | let eggAssetId = base58'C1iWsKGqLwjHUndiQ7iXpdmPum9PeCDFfyXBdJJosDRS' | |
13 | + | ||
14 | + | let kGlobalCounter = "GLOBAL_COUNTER" | |
9 | 15 | ||
10 | 16 | let feePercent = 5 | |
11 | 17 | ||
41 | 47 | } | |
42 | 48 | ||
43 | 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(incubatorAddress), 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(breederAddress), toBase58String(assetId)) { | |
66 | + | case c: String => | |
67 | + | c | |
68 | + | case _ => | |
69 | + | "" | |
70 | + | } | |
71 | + | if ((asset2 != "")) | |
72 | + | then asset2 | |
73 | + | else "" | |
74 | + | } | |
75 | + | } | |
76 | + | ||
77 | + | ||
44 | 78 | func getBidCancelResults (auctionId,bidId) = { | |
45 | 79 | let isEggSell = tryGetBoolean((("auction_" + auctionId) + "_eggSell")) | |
46 | 80 | let paymentAssetId = if ((isEggSell == true)) | |
53 | 87 | } | |
54 | 88 | ||
55 | 89 | ||
56 | - | func getAssetGenotype (assetId) = if ((value(assetInfo(assetId)).issuer == Address(NFTIssuerAddress))) | |
57 | - | then "ART" | |
58 | - | else "" | |
59 | - | ||
60 | - | ||
61 | 90 | @Callable(i) | |
62 | 91 | func initAuction (startPrice,instantPrice,description,eggSell) = { | |
63 | - | let auctionId = toBase58String(i.transactionId) | |
92 | + | let globalCounter = getGlobalCounter() | |
93 | + | let auctionId = (toBase58String(i.transactionId) + toString(globalCounter)) | |
64 | 94 | let pmt = value(i.payments[0]) | |
65 | 95 | let assetId = value(pmt.assetId) | |
66 | 96 | let asset = getAssetGenotype(assetId) | |
67 | 97 | if ((asset == "")) | |
68 | 98 | then throw("You can only sell an NFT-duck created in incubator or breeder") | |
69 | - | else [StringEntry((("auction_" + auctionId) + "_status"), "open"), BooleanEntry((("auction_" + auctionId) + "_eggSell"), (eggSell == "true")), StringEntry((("auction_" + toBase58String(assetId)) + "_last"), auctionId), StringEntry((("auction_" + auctionId) + "_assetGen"), asset), StringEntry((("auction_" + auctionId) + "_assetId"), toBase58String(assetId)), IntegerEntry((("auction_" + auctionId) + "_startedAt"), lastBlock.timestamp), StringEntry((("auction_" + auctionId) + "_owner"), toString(i.originCaller)), StringEntry((("auction_" + auctionId) + "_description"), description), IntegerEntry((("auction_" + auctionId) + "_startPrice"), startPrice), BooleanEntry((("auction_" + auctionId) + "_isArtefact"), (value(assetInfo(assetId)).issuer == Address(NFTIssuerAddress))), IntegerEntry((("auction_" + auctionId) + "_instantPrice"), instantPrice), StringEntry((((("address_" + toString(i.originCaller)) + "_auction_") + auctionId) + "_lockedNFT"), toBase58String(assetId))] | |
99 | + | else [StringEntry((("auction_" + auctionId) + "_status"), "open"), BooleanEntry((("auction_" + auctionId) + "_eggSell"), (eggSell == "true")), IntegerEntry(kGlobalCounter, (globalCounter + 1)), StringEntry((("auction_" + toBase58String(assetId)) + "_last"), auctionId), StringEntry((("auction_" + auctionId) + "_assetGen"), asset), StringEntry((("auction_" + auctionId) + "_assetId"), toBase58String(assetId)), IntegerEntry((("auction_" + auctionId) + "_startedAt"), lastBlock.timestamp), StringEntry((("auction_" + auctionId) + "_owner"), toString(i.originCaller)), StringEntry((("auction_" + auctionId) + "_description"), description), IntegerEntry((("auction_" + auctionId) + "_startPrice"), startPrice), BooleanEntry((("auction_" + auctionId) + "_isArtefact"), (value(assetInfo(assetId)).issuer == Address(artefactsAddress))), IntegerEntry((("auction_" + auctionId) + "_instantPrice"), instantPrice), StringEntry((((("address_" + toString(i.originCaller)) + "_auction_") + auctionId) + "_lockedNFT"), toBase58String(assetId))] | |
100 | + | } | |
101 | + | ||
102 | + | ||
103 | + | ||
104 | + | @Callable(i) | |
105 | + | func cancelAuction (auctionId) = { | |
106 | + | let auctionOwner = tryGetString((("auction_" + auctionId) + "_owner")) | |
107 | + | if ((toString(i.originCaller) != auctionOwner)) | |
108 | + | then throw("Only allowed to auction owner") | |
109 | + | else if ((tryGetString((("auction_" + auctionId) + "_status")) != "open")) | |
110 | + | then throw("auction is close") | |
111 | + | else [StringEntry((("auction_" + auctionId) + "_status"), "cancelled"), DeleteEntry((((("address_" + auctionOwner) + "_auction_") + auctionId) + "_lockedNFT")), ScriptTransfer(i.originCaller, 1, fromBase58String(getStringValue(this, (("auction_" + auctionId) + "_assetId"))))] | |
112 | + | } | |
113 | + | ||
114 | + | ||
115 | + | ||
116 | + | @Callable(i) | |
117 | + | func instantBuy (auctionId) = { | |
118 | + | let isEggSell = tryGetBoolean((("auction_" + auctionId) + "_eggSell")) | |
119 | + | let paymentAssetId = if ((isEggSell == true)) | |
120 | + | then eggAssetId | |
121 | + | else unit | |
122 | + | let paymentAssetName = if ((isEggSell == true)) | |
123 | + | then "EGG" | |
124 | + | else "WAVES" | |
125 | + | let pmt = value(i.payments[0]) | |
126 | + | let amount = pmt.amount | |
127 | + | let assetId = tryGetString((("auction_" + auctionId) + "_assetId")) | |
128 | + | let bidId = toBase58String(i.transactionId) | |
129 | + | let auctionStatus = tryGetString((("auction_" + auctionId) + "_status")) | |
130 | + | let finalFee = if ((tryGetBoolean((("auction_" + auctionId) + "_isArtefact")) == true)) | |
131 | + | then artefactsFeePercent | |
132 | + | else feePercent | |
133 | + | if ((pmt.assetId != paymentAssetId)) | |
134 | + | then throw((("Auction does only support " + paymentAssetName) + " payments.")) | |
135 | + | else if ((auctionStatus != "open")) | |
136 | + | then throw("Auction is closed. You cannot place a bid.") | |
137 | + | else { | |
138 | + | let instantPrice = tryGetInteger((("auction_" + auctionId) + "_instantPrice")) | |
139 | + | if ((instantPrice > amount)) | |
140 | + | then throw(("For instant purchase you need to pay at least " + toString(instantPrice))) | |
141 | + | else { | |
142 | + | let auctionOwner = tryGetString((("auction_" + auctionId) + "_owner")) | |
143 | + | let recordPrice = tryGetInteger((assetId + "_recordPrice")) | |
144 | + | let newRecordPrice = max([recordPrice, amount]) | |
145 | + | [StringEntry((("auction_" + auctionId) + "_status"), "finished"), IntegerEntry((("auction_" + auctionId) + "_finalPrice"), amount), IntegerEntry((assetId + "_recordPrice"), newRecordPrice), StringEntry((((("assetId_" + assetId) + "_bid_") + bidId) + "_data"), (((((("{\"auctionId\": \"" + auctionId) + "\", \"author\": \"") + toString(i.originCaller)) + "\", \"amount\": \"") + toString(amount)) + "\", \"status\": \"finished\"}")), DeleteEntry((((("address_" + auctionOwner) + "_auction_") + auctionId) + "_lockedNFT")), ScriptTransfer(i.originCaller, 1, fromBase58String(getStringValue(this, (("auction_" + auctionId) + "_assetId")))), ScriptTransfer(addressFromStringValue(auctionOwner), fraction(amount, (100 - finalFee), 100), paymentAssetId), ScriptTransfer(Address(feeAggregator), fraction(amount, finalFee, 100), paymentAssetId)] | |
146 | + | } | |
147 | + | } | |
70 | 148 | } | |
71 | 149 | ||
72 | 150 | ||
86 | 164 | let assetId = getStringValue(this, (("auction_" + auctionId) + "_assetId")) | |
87 | 165 | if ((pmt.assetId != paymentAssetId)) | |
88 | 166 | then throw((("Auction does only support " + paymentAssetName) + " payments.")) | |
89 | - | else { | |
90 | - | let minPrice = tryGetInteger((("auction_" + auctionId) + "_startPrice")) | |
91 | - | if ((minPrice > amount)) | |
92 | - | then throw(("The minimal initial price is set as " + toString(minPrice))) | |
93 | - | else [StringEntry((((("auction_" + auctionId) + "_bid_") + bidId) + "_author"), toString(i.originCaller)), StringEntry((((("assetId_" + assetId) + "_bid_") + bidId) + "_data"), (((((("{\"auctionId\": \"" + auctionId) + "\", \"author\": \"") + toString(i.originCaller)) + "\", \"amount\": \"") + toString(amount)) + "\", \"status\": \"open\"}")), IntegerEntry((((("auction_" + auctionId) + "_bid_") + bidId) + "_amount"), amount), StringEntry(((((("address_" + toString(i.originCaller)) + "_auction_") + auctionId) + "_bid_") + bidId), assetId), StringEntry((((("auction_" + auctionId) + "_bid_") + bidId) + "_status"), "open")] | |
94 | - | } | |
167 | + | else if ((tryGetString((("auction_" + auctionId) + "_status")) != "open")) | |
168 | + | then throw("Auction was closed") | |
169 | + | else { | |
170 | + | let minPrice = tryGetInteger((("auction_" + auctionId) + "_startPrice")) | |
171 | + | if ((minPrice > amount)) | |
172 | + | then throw(("The minimal initial price is set as " + toString(minPrice))) | |
173 | + | else [StringEntry((((("auction_" + auctionId) + "_bid_") + bidId) + "_author"), toString(i.originCaller)), StringEntry((((("assetId_" + assetId) + "_bid_") + bidId) + "_data"), (((((("{\"auctionId\": \"" + auctionId) + "\", \"author\": \"") + toString(i.originCaller)) + "\", \"amount\": \"") + toString(amount)) + "\", \"status\": \"open\"}")), IntegerEntry((((("auction_" + auctionId) + "_bid_") + bidId) + "_amount"), amount), StringEntry(((((("address_" + toString(i.originCaller)) + "_auction_") + auctionId) + "_bid_") + bidId), assetId), StringEntry((((("auction_" + auctionId) + "_bid_") + bidId) + "_status"), "open")] | |
174 | + | } | |
95 | 175 | } | |
176 | + | ||
177 | + | ||
178 | + | ||
179 | + | @Callable(i) | |
180 | + | func cancelBid (auctionId,bidId) = { | |
181 | + | let assetId = getStringValue(this, (("auction_" + auctionId) + "_assetId")) | |
182 | + | let bidAuthor = tryGetString((((("auction_" + auctionId) + "_bid_") + bidId) + "_author")) | |
183 | + | let bidAmount = tryGetInteger((((("auction_" + auctionId) + "_bid_") + bidId) + "_amount")) | |
184 | + | if ((toString(i.originCaller) != bidAuthor)) | |
185 | + | then throw("Only allowed to the bid author") | |
186 | + | else if ((tryGetString((((("auction_" + auctionId) + "_bid_") + bidId) + "_status")) != "open")) | |
187 | + | then throw("bid is not open") | |
188 | + | else getBidCancelResults(auctionId, bidId) | |
189 | + | } | |
190 | + | ||
191 | + | ||
192 | + | ||
193 | + | @Callable(i) | |
194 | + | func cancelOutdatedBid (auctionId,bidId) = throw("to be released") | |
96 | 195 | ||
97 | 196 | ||
98 | 197 | ||
119 | 218 | else { | |
120 | 219 | let recordPrice = tryGetInteger((assetId + "_recordPrice")) | |
121 | 220 | let newRecordPrice = max([recordPrice, bidAmount]) | |
122 | - | [StringEntry((((("auction_" + auctionId) + "_bid_") + bidId) + "_status"), "finished"), StringEntry((("auction_" + auctionId) + "_status"), "finished"), StringEntry((((("assetId_" + assetId) + "_bid_") + bidId) + "_data"), (((((("{\"auctionId\": \"" + auctionId) + "\", \"author\": \"") + toString(i.originCaller)) + "\", \"amount\": \"") + toString(bidAmount)) + "\", \"status\": \"finished\"}")), IntegerEntry((("auction_" + auctionId) + "_finalPrice"), bidAmount), IntegerEntry((assetId + "_recordPrice"), newRecordPrice), DeleteEntry(((((("address_" + bidAuthor) + "_auction_") + auctionId) + "_bid_") + bidId)), DeleteEntry((((("address_" + auctionOwner) + "_auction_") + auctionId) + "_lockedNFT")), ScriptTransfer(i.caller, fraction(bidAmount, (100 - finalFee), 100), paymentAssetId), ScriptTransfer(Address( | |
221 | + | [StringEntry((((("auction_" + auctionId) + "_bid_") + bidId) + "_status"), "finished"), StringEntry((("auction_" + auctionId) + "_status"), "finished"), StringEntry((((("assetId_" + assetId) + "_bid_") + bidId) + "_data"), (((((("{\"auctionId\": \"" + auctionId) + "\", \"author\": \"") + toString(i.originCaller)) + "\", \"amount\": \"") + toString(bidAmount)) + "\", \"status\": \"finished\"}")), IntegerEntry((("auction_" + auctionId) + "_finalPrice"), bidAmount), IntegerEntry((assetId + "_recordPrice"), newRecordPrice), DeleteEntry(((((("address_" + bidAuthor) + "_auction_") + auctionId) + "_bid_") + bidId)), DeleteEntry((((("address_" + auctionOwner) + "_auction_") + auctionId) + "_lockedNFT")), ScriptTransfer(i.caller, fraction(bidAmount, (100 - finalFee), 100), paymentAssetId), ScriptTransfer(Address(feeAggregator), fraction(bidAmount, finalFee, 100), paymentAssetId), ScriptTransfer(addressFromStringValue(bidAuthor), 1, fromBase58String(assetId))] | |
123 | 222 | } | |
124 | - | } | |
125 | - | ||
126 | - | ||
127 | - | ||
128 | - | @Callable(i) | |
129 | - | func cancelBid (auctionId,bidId) = { | |
130 | - | let assetId = getStringValue(this, (("auction_" + auctionId) + "_assetId")) | |
131 | - | let bidAuthor = tryGetString((((("auction_" + auctionId) + "_bid_") + bidId) + "_author")) | |
132 | - | let bidAmount = tryGetInteger((((("auction_" + auctionId) + "_bid_") + bidId) + "_amount")) | |
133 | - | if ((toString(i.originCaller) != bidAuthor)) | |
134 | - | then throw("Only allowed to the bid author") | |
135 | - | else if ((tryGetString((((("auction_" + auctionId) + "_bid_") + bidId) + "_status")) != "open")) | |
136 | - | then throw("bid is not open") | |
137 | - | else getBidCancelResults(auctionId, bidId) | |
138 | - | } | |
139 | - | ||
140 | - | ||
141 | - | ||
142 | - | @Callable(i) | |
143 | - | func cancelAuction (auctionId) = { | |
144 | - | let auctionOwner = tryGetString((("auction_" + auctionId) + "_owner")) | |
145 | - | if ((toString(i.originCaller) != auctionOwner)) | |
146 | - | then throw("Only allowed to auction owner") | |
147 | - | else if ((tryGetString((("auction_" + auctionId) + "_status")) != "open")) | |
148 | - | then throw("auction is close") | |
149 | - | else [StringEntry((("auction_" + auctionId) + "_status"), "cancelled"), DeleteEntry((((("address_" + auctionOwner) + "_auction_") + auctionId) + "_lockedNFT")), ScriptTransfer(i.originCaller, 1, fromBase58String(getStringValue(this, (("auction_" + auctionId) + "_assetId"))))] | |
150 | 223 | } | |
151 | 224 | ||
152 | 225 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let | |
4 | + | let incubatorAddress = base58'3PEktVux2RhchSN63DsDo4b4mz4QqzKSeDv' | |
5 | 5 | ||
6 | - | let | |
6 | + | let breederAddress = base58'3PDVuU45H7Eh5dmtNbnRNRStGwULA7NY6Hb' | |
7 | 7 | ||
8 | - | let ownerAddress = base58'3MpADDQFqadaCADNH9JDMQAGw9WEaMcymVU' | |
8 | + | let artefactsAddress = base58'3P5E9xamcWoymiqLx8ZdmR7o4fJSRMGp1WR' | |
9 | + | ||
10 | + | let feeAggregator = base58'3P6AobNbcQ3ZjcRY37mJPKN8PP9Giz8kgeY' | |
11 | + | ||
12 | + | let eggAssetId = base58'C1iWsKGqLwjHUndiQ7iXpdmPum9PeCDFfyXBdJJosDRS' | |
13 | + | ||
14 | + | let kGlobalCounter = "GLOBAL_COUNTER" | |
9 | 15 | ||
10 | 16 | let feePercent = 5 | |
11 | 17 | ||
12 | 18 | let artefactsFeePercent = 20 | |
13 | 19 | ||
14 | 20 | func tryGetInteger (key) = { | |
15 | 21 | let val = match getInteger(this, key) { | |
16 | 22 | case b: Int => | |
17 | 23 | b | |
18 | 24 | case _ => | |
19 | 25 | 0 | |
20 | 26 | } | |
21 | 27 | val | |
22 | 28 | } | |
23 | 29 | ||
24 | 30 | ||
25 | 31 | func tryGetString (key) = { | |
26 | 32 | let val = match getString(this, key) { | |
27 | 33 | case b: String => | |
28 | 34 | b | |
29 | 35 | case _ => | |
30 | 36 | "" | |
31 | 37 | } | |
32 | 38 | val | |
33 | 39 | } | |
34 | 40 | ||
35 | 41 | ||
36 | 42 | func tryGetBoolean (key) = match getBoolean(this, key) { | |
37 | 43 | case b: Boolean => | |
38 | 44 | b | |
39 | 45 | case _ => | |
40 | 46 | false | |
41 | 47 | } | |
42 | 48 | ||
43 | 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(incubatorAddress), 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(breederAddress), toBase58String(assetId)) { | |
66 | + | case c: String => | |
67 | + | c | |
68 | + | case _ => | |
69 | + | "" | |
70 | + | } | |
71 | + | if ((asset2 != "")) | |
72 | + | then asset2 | |
73 | + | else "" | |
74 | + | } | |
75 | + | } | |
76 | + | ||
77 | + | ||
44 | 78 | func getBidCancelResults (auctionId,bidId) = { | |
45 | 79 | let isEggSell = tryGetBoolean((("auction_" + auctionId) + "_eggSell")) | |
46 | 80 | let paymentAssetId = if ((isEggSell == true)) | |
47 | 81 | then eggAssetId | |
48 | 82 | else unit | |
49 | 83 | let assetId = getStringValue(this, (("auction_" + auctionId) + "_assetId")) | |
50 | 84 | let bidAuthor = tryGetString((((("auction_" + auctionId) + "_bid_") + bidId) + "_author")) | |
51 | 85 | let bidAmount = tryGetInteger((((("auction_" + auctionId) + "_bid_") + bidId) + "_amount")) | |
52 | 86 | [StringEntry((((("assetId_" + assetId) + "_bid_") + bidId) + "_data"), (((((("{\"auctionId\": \"" + auctionId) + "\", \"author\": \"") + bidAuthor) + "\", \"amount\": \"") + toString(bidAmount)) + "\", \"status\": \"cancelled\"}")), StringEntry((((("auction_" + auctionId) + "_bid_") + bidId) + "_status"), "cancelled"), DeleteEntry(((((("address_" + bidAuthor) + "_auction_") + auctionId) + "_bid_") + bidId)), ScriptTransfer(Address(fromBase58String(bidAuthor)), bidAmount, paymentAssetId)] | |
53 | 87 | } | |
54 | 88 | ||
55 | 89 | ||
56 | - | func getAssetGenotype (assetId) = if ((value(assetInfo(assetId)).issuer == Address(NFTIssuerAddress))) | |
57 | - | then "ART" | |
58 | - | else "" | |
59 | - | ||
60 | - | ||
61 | 90 | @Callable(i) | |
62 | 91 | func initAuction (startPrice,instantPrice,description,eggSell) = { | |
63 | - | let auctionId = toBase58String(i.transactionId) | |
92 | + | let globalCounter = getGlobalCounter() | |
93 | + | let auctionId = (toBase58String(i.transactionId) + toString(globalCounter)) | |
64 | 94 | let pmt = value(i.payments[0]) | |
65 | 95 | let assetId = value(pmt.assetId) | |
66 | 96 | let asset = getAssetGenotype(assetId) | |
67 | 97 | if ((asset == "")) | |
68 | 98 | then throw("You can only sell an NFT-duck created in incubator or breeder") | |
69 | - | else [StringEntry((("auction_" + auctionId) + "_status"), "open"), BooleanEntry((("auction_" + auctionId) + "_eggSell"), (eggSell == "true")), StringEntry((("auction_" + toBase58String(assetId)) + "_last"), auctionId), StringEntry((("auction_" + auctionId) + "_assetGen"), asset), StringEntry((("auction_" + auctionId) + "_assetId"), toBase58String(assetId)), IntegerEntry((("auction_" + auctionId) + "_startedAt"), lastBlock.timestamp), StringEntry((("auction_" + auctionId) + "_owner"), toString(i.originCaller)), StringEntry((("auction_" + auctionId) + "_description"), description), IntegerEntry((("auction_" + auctionId) + "_startPrice"), startPrice), BooleanEntry((("auction_" + auctionId) + "_isArtefact"), (value(assetInfo(assetId)).issuer == Address(NFTIssuerAddress))), IntegerEntry((("auction_" + auctionId) + "_instantPrice"), instantPrice), StringEntry((((("address_" + toString(i.originCaller)) + "_auction_") + auctionId) + "_lockedNFT"), toBase58String(assetId))] | |
99 | + | else [StringEntry((("auction_" + auctionId) + "_status"), "open"), BooleanEntry((("auction_" + auctionId) + "_eggSell"), (eggSell == "true")), IntegerEntry(kGlobalCounter, (globalCounter + 1)), StringEntry((("auction_" + toBase58String(assetId)) + "_last"), auctionId), StringEntry((("auction_" + auctionId) + "_assetGen"), asset), StringEntry((("auction_" + auctionId) + "_assetId"), toBase58String(assetId)), IntegerEntry((("auction_" + auctionId) + "_startedAt"), lastBlock.timestamp), StringEntry((("auction_" + auctionId) + "_owner"), toString(i.originCaller)), StringEntry((("auction_" + auctionId) + "_description"), description), IntegerEntry((("auction_" + auctionId) + "_startPrice"), startPrice), BooleanEntry((("auction_" + auctionId) + "_isArtefact"), (value(assetInfo(assetId)).issuer == Address(artefactsAddress))), IntegerEntry((("auction_" + auctionId) + "_instantPrice"), instantPrice), StringEntry((((("address_" + toString(i.originCaller)) + "_auction_") + auctionId) + "_lockedNFT"), toBase58String(assetId))] | |
100 | + | } | |
101 | + | ||
102 | + | ||
103 | + | ||
104 | + | @Callable(i) | |
105 | + | func cancelAuction (auctionId) = { | |
106 | + | let auctionOwner = tryGetString((("auction_" + auctionId) + "_owner")) | |
107 | + | if ((toString(i.originCaller) != auctionOwner)) | |
108 | + | then throw("Only allowed to auction owner") | |
109 | + | else if ((tryGetString((("auction_" + auctionId) + "_status")) != "open")) | |
110 | + | then throw("auction is close") | |
111 | + | else [StringEntry((("auction_" + auctionId) + "_status"), "cancelled"), DeleteEntry((((("address_" + auctionOwner) + "_auction_") + auctionId) + "_lockedNFT")), ScriptTransfer(i.originCaller, 1, fromBase58String(getStringValue(this, (("auction_" + auctionId) + "_assetId"))))] | |
112 | + | } | |
113 | + | ||
114 | + | ||
115 | + | ||
116 | + | @Callable(i) | |
117 | + | func instantBuy (auctionId) = { | |
118 | + | let isEggSell = tryGetBoolean((("auction_" + auctionId) + "_eggSell")) | |
119 | + | let paymentAssetId = if ((isEggSell == true)) | |
120 | + | then eggAssetId | |
121 | + | else unit | |
122 | + | let paymentAssetName = if ((isEggSell == true)) | |
123 | + | then "EGG" | |
124 | + | else "WAVES" | |
125 | + | let pmt = value(i.payments[0]) | |
126 | + | let amount = pmt.amount | |
127 | + | let assetId = tryGetString((("auction_" + auctionId) + "_assetId")) | |
128 | + | let bidId = toBase58String(i.transactionId) | |
129 | + | let auctionStatus = tryGetString((("auction_" + auctionId) + "_status")) | |
130 | + | let finalFee = if ((tryGetBoolean((("auction_" + auctionId) + "_isArtefact")) == true)) | |
131 | + | then artefactsFeePercent | |
132 | + | else feePercent | |
133 | + | if ((pmt.assetId != paymentAssetId)) | |
134 | + | then throw((("Auction does only support " + paymentAssetName) + " payments.")) | |
135 | + | else if ((auctionStatus != "open")) | |
136 | + | then throw("Auction is closed. You cannot place a bid.") | |
137 | + | else { | |
138 | + | let instantPrice = tryGetInteger((("auction_" + auctionId) + "_instantPrice")) | |
139 | + | if ((instantPrice > amount)) | |
140 | + | then throw(("For instant purchase you need to pay at least " + toString(instantPrice))) | |
141 | + | else { | |
142 | + | let auctionOwner = tryGetString((("auction_" + auctionId) + "_owner")) | |
143 | + | let recordPrice = tryGetInteger((assetId + "_recordPrice")) | |
144 | + | let newRecordPrice = max([recordPrice, amount]) | |
145 | + | [StringEntry((("auction_" + auctionId) + "_status"), "finished"), IntegerEntry((("auction_" + auctionId) + "_finalPrice"), amount), IntegerEntry((assetId + "_recordPrice"), newRecordPrice), StringEntry((((("assetId_" + assetId) + "_bid_") + bidId) + "_data"), (((((("{\"auctionId\": \"" + auctionId) + "\", \"author\": \"") + toString(i.originCaller)) + "\", \"amount\": \"") + toString(amount)) + "\", \"status\": \"finished\"}")), DeleteEntry((((("address_" + auctionOwner) + "_auction_") + auctionId) + "_lockedNFT")), ScriptTransfer(i.originCaller, 1, fromBase58String(getStringValue(this, (("auction_" + auctionId) + "_assetId")))), ScriptTransfer(addressFromStringValue(auctionOwner), fraction(amount, (100 - finalFee), 100), paymentAssetId), ScriptTransfer(Address(feeAggregator), fraction(amount, finalFee, 100), paymentAssetId)] | |
146 | + | } | |
147 | + | } | |
70 | 148 | } | |
71 | 149 | ||
72 | 150 | ||
73 | 151 | ||
74 | 152 | @Callable(i) | |
75 | 153 | func placeBid (auctionId) = { | |
76 | 154 | let isEggSell = tryGetBoolean((("auction_" + auctionId) + "_eggSell")) | |
77 | 155 | let paymentAssetId = if ((isEggSell == true)) | |
78 | 156 | then eggAssetId | |
79 | 157 | else unit | |
80 | 158 | let paymentAssetName = if ((isEggSell == true)) | |
81 | 159 | then "EGG" | |
82 | 160 | else "WAVES" | |
83 | 161 | let pmt = value(i.payments[0]) | |
84 | 162 | let amount = pmt.amount | |
85 | 163 | let bidId = toBase58String(i.transactionId) | |
86 | 164 | let assetId = getStringValue(this, (("auction_" + auctionId) + "_assetId")) | |
87 | 165 | if ((pmt.assetId != paymentAssetId)) | |
88 | 166 | then throw((("Auction does only support " + paymentAssetName) + " payments.")) | |
89 | - | else { | |
90 | - | let minPrice = tryGetInteger((("auction_" + auctionId) + "_startPrice")) | |
91 | - | if ((minPrice > amount)) | |
92 | - | then throw(("The minimal initial price is set as " + toString(minPrice))) | |
93 | - | else [StringEntry((((("auction_" + auctionId) + "_bid_") + bidId) + "_author"), toString(i.originCaller)), StringEntry((((("assetId_" + assetId) + "_bid_") + bidId) + "_data"), (((((("{\"auctionId\": \"" + auctionId) + "\", \"author\": \"") + toString(i.originCaller)) + "\", \"amount\": \"") + toString(amount)) + "\", \"status\": \"open\"}")), IntegerEntry((((("auction_" + auctionId) + "_bid_") + bidId) + "_amount"), amount), StringEntry(((((("address_" + toString(i.originCaller)) + "_auction_") + auctionId) + "_bid_") + bidId), assetId), StringEntry((((("auction_" + auctionId) + "_bid_") + bidId) + "_status"), "open")] | |
94 | - | } | |
167 | + | else if ((tryGetString((("auction_" + auctionId) + "_status")) != "open")) | |
168 | + | then throw("Auction was closed") | |
169 | + | else { | |
170 | + | let minPrice = tryGetInteger((("auction_" + auctionId) + "_startPrice")) | |
171 | + | if ((minPrice > amount)) | |
172 | + | then throw(("The minimal initial price is set as " + toString(minPrice))) | |
173 | + | else [StringEntry((((("auction_" + auctionId) + "_bid_") + bidId) + "_author"), toString(i.originCaller)), StringEntry((((("assetId_" + assetId) + "_bid_") + bidId) + "_data"), (((((("{\"auctionId\": \"" + auctionId) + "\", \"author\": \"") + toString(i.originCaller)) + "\", \"amount\": \"") + toString(amount)) + "\", \"status\": \"open\"}")), IntegerEntry((((("auction_" + auctionId) + "_bid_") + bidId) + "_amount"), amount), StringEntry(((((("address_" + toString(i.originCaller)) + "_auction_") + auctionId) + "_bid_") + bidId), assetId), StringEntry((((("auction_" + auctionId) + "_bid_") + bidId) + "_status"), "open")] | |
174 | + | } | |
95 | 175 | } | |
176 | + | ||
177 | + | ||
178 | + | ||
179 | + | @Callable(i) | |
180 | + | func cancelBid (auctionId,bidId) = { | |
181 | + | let assetId = getStringValue(this, (("auction_" + auctionId) + "_assetId")) | |
182 | + | let bidAuthor = tryGetString((((("auction_" + auctionId) + "_bid_") + bidId) + "_author")) | |
183 | + | let bidAmount = tryGetInteger((((("auction_" + auctionId) + "_bid_") + bidId) + "_amount")) | |
184 | + | if ((toString(i.originCaller) != bidAuthor)) | |
185 | + | then throw("Only allowed to the bid author") | |
186 | + | else if ((tryGetString((((("auction_" + auctionId) + "_bid_") + bidId) + "_status")) != "open")) | |
187 | + | then throw("bid is not open") | |
188 | + | else getBidCancelResults(auctionId, bidId) | |
189 | + | } | |
190 | + | ||
191 | + | ||
192 | + | ||
193 | + | @Callable(i) | |
194 | + | func cancelOutdatedBid (auctionId,bidId) = throw("to be released") | |
96 | 195 | ||
97 | 196 | ||
98 | 197 | ||
99 | 198 | @Callable(i) | |
100 | 199 | func acceptBid (auctionId,bidId) = { | |
101 | 200 | let isEggSell = tryGetBoolean((("auction_" + auctionId) + "_eggSell")) | |
102 | 201 | let paymentAssetId = if ((isEggSell == true)) | |
103 | 202 | then eggAssetId | |
104 | 203 | else unit | |
105 | 204 | let auctionOwner = tryGetString((("auction_" + auctionId) + "_owner")) | |
106 | 205 | let bidAuthor = tryGetString((((("auction_" + auctionId) + "_bid_") + bidId) + "_author")) | |
107 | 206 | let bidAmount = tryGetInteger((((("auction_" + auctionId) + "_bid_") + bidId) + "_amount")) | |
108 | 207 | let bidStatus = tryGetString((((("auction_" + auctionId) + "_bid_") + bidId) + "_status")) | |
109 | 208 | let assetId = tryGetString((("auction_" + auctionId) + "_assetId")) | |
110 | 209 | let finalFee = if ((tryGetBoolean((("auction_" + auctionId) + "_isArtefact")) == true)) | |
111 | 210 | then artefactsFeePercent | |
112 | 211 | else feePercent | |
113 | 212 | if ((toString(i.originCaller) != auctionOwner)) | |
114 | 213 | then throw("Only allowed to auction owner") | |
115 | 214 | else if ((bidStatus != "open")) | |
116 | 215 | then throw("Bid was cancelled and cannot be accepted") | |
117 | 216 | else if ((tryGetString((("auction_" + auctionId) + "_status")) != "open")) | |
118 | 217 | then throw("Auction was closed") | |
119 | 218 | else { | |
120 | 219 | let recordPrice = tryGetInteger((assetId + "_recordPrice")) | |
121 | 220 | let newRecordPrice = max([recordPrice, bidAmount]) | |
122 | - | [StringEntry((((("auction_" + auctionId) + "_bid_") + bidId) + "_status"), "finished"), StringEntry((("auction_" + auctionId) + "_status"), "finished"), StringEntry((((("assetId_" + assetId) + "_bid_") + bidId) + "_data"), (((((("{\"auctionId\": \"" + auctionId) + "\", \"author\": \"") + toString(i.originCaller)) + "\", \"amount\": \"") + toString(bidAmount)) + "\", \"status\": \"finished\"}")), IntegerEntry((("auction_" + auctionId) + "_finalPrice"), bidAmount), IntegerEntry((assetId + "_recordPrice"), newRecordPrice), DeleteEntry(((((("address_" + bidAuthor) + "_auction_") + auctionId) + "_bid_") + bidId)), DeleteEntry((((("address_" + auctionOwner) + "_auction_") + auctionId) + "_lockedNFT")), ScriptTransfer(i.caller, fraction(bidAmount, (100 - finalFee), 100), paymentAssetId), ScriptTransfer(Address( | |
221 | + | [StringEntry((((("auction_" + auctionId) + "_bid_") + bidId) + "_status"), "finished"), StringEntry((("auction_" + auctionId) + "_status"), "finished"), StringEntry((((("assetId_" + assetId) + "_bid_") + bidId) + "_data"), (((((("{\"auctionId\": \"" + auctionId) + "\", \"author\": \"") + toString(i.originCaller)) + "\", \"amount\": \"") + toString(bidAmount)) + "\", \"status\": \"finished\"}")), IntegerEntry((("auction_" + auctionId) + "_finalPrice"), bidAmount), IntegerEntry((assetId + "_recordPrice"), newRecordPrice), DeleteEntry(((((("address_" + bidAuthor) + "_auction_") + auctionId) + "_bid_") + bidId)), DeleteEntry((((("address_" + auctionOwner) + "_auction_") + auctionId) + "_lockedNFT")), ScriptTransfer(i.caller, fraction(bidAmount, (100 - finalFee), 100), paymentAssetId), ScriptTransfer(Address(feeAggregator), fraction(bidAmount, finalFee, 100), paymentAssetId), ScriptTransfer(addressFromStringValue(bidAuthor), 1, fromBase58String(assetId))] | |
123 | 222 | } | |
124 | - | } | |
125 | - | ||
126 | - | ||
127 | - | ||
128 | - | @Callable(i) | |
129 | - | func cancelBid (auctionId,bidId) = { | |
130 | - | let assetId = getStringValue(this, (("auction_" + auctionId) + "_assetId")) | |
131 | - | let bidAuthor = tryGetString((((("auction_" + auctionId) + "_bid_") + bidId) + "_author")) | |
132 | - | let bidAmount = tryGetInteger((((("auction_" + auctionId) + "_bid_") + bidId) + "_amount")) | |
133 | - | if ((toString(i.originCaller) != bidAuthor)) | |
134 | - | then throw("Only allowed to the bid author") | |
135 | - | else if ((tryGetString((((("auction_" + auctionId) + "_bid_") + bidId) + "_status")) != "open")) | |
136 | - | then throw("bid is not open") | |
137 | - | else getBidCancelResults(auctionId, bidId) | |
138 | - | } | |
139 | - | ||
140 | - | ||
141 | - | ||
142 | - | @Callable(i) | |
143 | - | func cancelAuction (auctionId) = { | |
144 | - | let auctionOwner = tryGetString((("auction_" + auctionId) + "_owner")) | |
145 | - | if ((toString(i.originCaller) != auctionOwner)) | |
146 | - | then throw("Only allowed to auction owner") | |
147 | - | else if ((tryGetString((("auction_" + auctionId) + "_status")) != "open")) | |
148 | - | then throw("auction is close") | |
149 | - | else [StringEntry((("auction_" + auctionId) + "_status"), "cancelled"), DeleteEntry((((("address_" + auctionOwner) + "_auction_") + auctionId) + "_lockedNFT")), ScriptTransfer(i.originCaller, 1, fromBase58String(getStringValue(this, (("auction_" + auctionId) + "_assetId"))))] | |
150 | 223 | } | |
151 | 224 | ||
152 | 225 | ||
153 | 226 | @Verifier(tx) | |
154 | 227 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
155 | 228 |
github/deemru/w8io/03bedc9 54.68 ms ◑![]()