tx · 6zjTXSc3VuxfFfAsbJbpHLW7B4QiJCFQm4YsVEMyY7pG 3Mud1MQsH9Gx5zGAGQhFKfHqXQvowA1atzk: -0.01400000 Waves 2019.09.08 10:24 [666804] smart account 3Mud1MQsH9Gx5zGAGQhFKfHqXQvowA1atzk > SELF 0.00000000 Waves
{ "type": 13, "id": "6zjTXSc3VuxfFfAsbJbpHLW7B4QiJCFQm4YsVEMyY7pG", "fee": 1400000, "feeAssetId": null, "timestamp": 1567927461095, "version": 1, "sender": "3Mud1MQsH9Gx5zGAGQhFKfHqXQvowA1atzk", "senderPublicKey": "9SURqnUTarkuEdsn54ytB3K87f22Nm5oYg7UbZo8NGoV", "proofs": [ "4x1ByNoHVm8uqaDKqNp6DUVmYxqfi258YsM8smQXekcRhHDCoXWM43w4qTuq7GXzBDjFb83Ae7zAgJ2sKYDT5gcZ" ], "script": "base64:AAIDAAAAAAAAAAAAAAAFAAAAABJtYXhBdWN0aW9uRHVyYXRpb24JAABoAAAAAgAAAAAAAAAFoAAAAAAAAAAAHgAAAAAOcmV2ZWFsRHVyYXRpb24JAABoAAAAAgAAAAAAAAAFoAAAAAAAAAAABwEAAAAKaGFzaFN0cmluZwAAAAEAAAAEZGF0YQQAAAAGcmVzdWx0CQACWgAAAAEJAAH3AAAAAQkAAZsAAAABBQAAAARkYXRhBQAAAAZyZXN1bHQBAAAACWFkZFRvTGlzdAAAAAIAAAAEbGlzdAAAAAl3aGF0VG9BZGQDCQAAAAAAAAIJAASzAAAAAgUAAAAEbGlzdAUAAAAJd2hhdFRvQWRkAP//////////CQABLAAAAAIJAAEsAAAAAgUAAAAEbGlzdAIAAAABIAUAAAAJd2hhdFRvQWRkBQAAAARsaXN0AQAAAA5yZW1vdmVGcm9tTGlzdAAAAAIAAAAEbGlzdAAAAAx3aGF0VG9SZW1vdmUEAAAAA2lkeAkABLMAAAACBQAAAARsaXN0BQAAAAx3aGF0VG9SZW1vdmUEAAAABnJlc3VsdAMJAQAAAAlpc0RlZmluZW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AACURhdGFFbnRyeQAAAAIJAAEsAAAAAgkAASwAAAACBQAAAAlhdWN0aW9uSWQJAQAAAAV2YWx1ZQAAAAEFAAAABndpbm5lcgIAAAAHX3NldHRsZQYJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAAEsAAAAAgkBAAAABXZhbHVlAAAAAQUAAAAGd2lubmVyAgAAAAdfYmlkZGVyCQEAAAAOcmVtb3ZlRnJvbUxpc3QAAAACCQEAAAARQGV4dHJOYXRpdmUoMTA1MykAAAACBQAAAAR0aGlzCQABLAAAAAIJAQAAAAV2YWx1ZQAAAAEFAAAABndpbm5lcgIAAAAHX2JpZGRlcgUAAAAJYXVjdGlvbklkCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQABLAAAAAIFAAAACW9yZ2FuaXplcgIAAAAKX29yZ2FuaXplcgkBAAAADnJlbW92ZUZyb21MaXN0AAAAAgkBAAAAEUBleHRyTmF0aXZlKDEwNTMpAAAAAgUAAAAEdGhpcwkAASwAAAACBQAAAAlvcmdhbml6ZXICAAAACl9vcmdhbml6ZXIFAAAACWF1Y3Rpb25JZAUAAAADbmlsCQEAAAALVHJhbnNmZXJTZXQAAAABCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMFAAAADW9yZ2FuaXplckFkZHIFAAAAB2RlcG9zaXQIBQAAAANwbXQAAAAHYXNzZXRJZAkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADBQAAAAp3aW5uZXJBZGRyBQAAAAlsb3RBbW91bnQFAAAACGxvdEFzc2V0BQAAAANuaWwAAAAAreFcCg==", "chainId": 84, "height": 666804, "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 3 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let maxAuctionDuration = (1440 * 30) | |
5 | + | ||
6 | + | let revealDuration = (1440 * 7) | |
7 | + | ||
8 | + | func hashString (data) = { | |
9 | + | let result = toBase64String(sha256(toBytes(data))) | |
10 | + | result | |
11 | + | } | |
12 | + | ||
13 | + | ||
14 | + | func addToList (list,whatToAdd) = if ((indexOf(list, whatToAdd) == -1)) | |
15 | + | then ((list + " ") + whatToAdd) | |
16 | + | else list | |
17 | + | ||
18 | + | ||
19 | + | func removeFromList (list,whatToRemove) = { | |
20 | + | let idx = indexOf(list, whatToRemove) | |
21 | + | let result = if (isDefined(idx)) | |
22 | + | then (take(list, value(idx)) + takeRight(list, (value(idx) + size(whatToRemove)))) | |
23 | + | else list | |
24 | + | result | |
25 | + | } | |
26 | + | ||
27 | + | ||
28 | + | @Callable(i) | |
29 | + | func startAuction (duration,startPrice,priceAssetId,deposit) = { | |
30 | + | let auctionId = toBase58String(i.transactionId) | |
31 | + | let revealStart = (lastBlock.height + duration) | |
32 | + | let closingStart = (revealStart + revealDuration) | |
33 | + | let organizer = toBase58String(i.caller.bytes) | |
34 | + | let organizerKey = (organizer + "_organizer") | |
35 | + | let maybeOrganizerList = getString(this, organizerKey) | |
36 | + | let organizerList = if (isDefined(maybeOrganizerList)) | |
37 | + | then value(maybeOrganizerList) | |
38 | + | else "" | |
39 | + | let newOrganizerList = ((organizerList + " ") + auctionId) | |
40 | + | let pmt = extract(i.payment) | |
41 | + | if ((duration > maxAuctionDuration)) | |
42 | + | then throw(("Duration is too long. Must be less than " + toString(maxAuctionDuration))) | |
43 | + | else if (!(isDefined(pmt.assetId))) | |
44 | + | then throw("Payment currency should not be in WAVES") | |
45 | + | else if ((pmt.amount != 1)) | |
46 | + | then throw("Payment amount should be only one NFT") | |
47 | + | else if ((0 >= startPrice)) | |
48 | + | then throw("Start price should be > 0") | |
49 | + | else if ((startPrice >= deposit)) | |
50 | + | then throw((("Start price should be < deposit (" + toString(deposit)) + ")")) | |
51 | + | else if ((0 >= duration)) | |
52 | + | then throw("Duration should be > 0") | |
53 | + | else WriteSet([DataEntry((auctionId + "_reveal_start"), revealStart), DataEntry((auctionId + "_closing_start"), closingStart), DataEntry((auctionId + "_deposit"), deposit), DataEntry((auctionId + "_unrevealed_count"), 0), DataEntry((auctionId + "_top_price"), 0), DataEntry((auctionId + "_second_price"), 0), DataEntry((auctionId + "_settle"), false), DataEntry((auctionId + "_organizer"), organizer), DataEntry((auctionId + "_lot_assetId"), if (isDefined(pmt.assetId)) | |
54 | + | then toBase58String(value(pmt.assetId)) | |
55 | + | else "WAVES"), DataEntry((auctionId + "_lot_amount"), pmt.amount), DataEntry((auctionId + "_startPrice"), startPrice), DataEntry((auctionId + "_priceAssetId"), priceAssetId), DataEntry(organizerKey, newOrganizerList), DataEntry("test", hashString(("123" + toString(startPrice))))]) | |
56 | + | } | |
57 | + | ||
58 | + | ||
59 | + | ||
60 | + | @Callable(i) | |
61 | + | func bid (auctionId,hashBidAmount) = { | |
62 | + | let pmt = extract(i.payment) | |
63 | + | let pmtAssetIdStr = if (isDefined(pmt.assetId)) | |
64 | + | then toBase58String(value(pmt.assetId)) | |
65 | + | else "WAVES" | |
66 | + | let callerAddressStr = toBase58String(i.caller.bytes) | |
67 | + | let endHeight = getIntegerValue(this, (auctionId + "_reveal_start")) | |
68 | + | let startPrice = getIntegerValue(this, (auctionId + "_startPrice")) | |
69 | + | let priceAssetId = getStringValue(this, (auctionId + "_priceAssetId")) | |
70 | + | let organizer = getStringValue(this, (auctionId + "_organizer")) | |
71 | + | let deposit = getIntegerValue(this, (auctionId + "_deposit")) | |
72 | + | let unrevealedCount = getIntegerValue(this, (auctionId + "_unrevealed_count")) | |
73 | + | let bidder = getString(this, (callerAddressStr + "_bidder")) | |
74 | + | let bidFromTheSameUser = isDefined(getString(this, ((auctionId + callerAddressStr) + "_bid_hash"))) | |
75 | + | if ((lastBlock.height >= endHeight)) | |
76 | + | then throw("Auction already finished") | |
77 | + | else if (if (!(bidFromTheSameUser)) | |
78 | + | then (priceAssetId != pmtAssetIdStr) | |
79 | + | else false) | |
80 | + | then throw((("Bid must be in asset '" + priceAssetId) + "'")) | |
81 | + | else if (!(isDefined(organizer))) | |
82 | + | then throw("Organizer should be defined") | |
83 | + | else if (if (!(bidFromTheSameUser)) | |
84 | + | then (pmt.amount != deposit) | |
85 | + | else false) | |
86 | + | then throw("Payment should be equel to deposit") | |
87 | + | else { | |
88 | + | let inc = if (bidFromTheSameUser) | |
89 | + | then 0 | |
90 | + | else 1 | |
91 | + | WriteSet([DataEntry(((auctionId + callerAddressStr) + "_revealed"), false), DataEntry(((auctionId + callerAddressStr) + "_bid_hash"), hashBidAmount), DataEntry(((auctionId + callerAddressStr) + "_settle"), false), DataEntry((auctionId + "_unrevealed_count"), (unrevealedCount + inc)), DataEntry((callerAddressStr + "_bidder"), (((if (isDefined(bidder)) | |
92 | + | then value(bidder) | |
93 | + | else "") + " ") + auctionId))]) | |
94 | + | } | |
95 | + | } | |
96 | + | ||
97 | + | ||
98 | + | ||
99 | + | @Callable(i) | |
100 | + | func reveal (auctionId,bidAmount,salt) = { | |
101 | + | let callerAddressStr = toBase58String(i.caller.bytes) | |
102 | + | let organizer = getStringValue(this, (auctionId + "_organizer")) | |
103 | + | let bidHash = getStringValue(this, ((auctionId + callerAddressStr) + "_bid_hash")) | |
104 | + | let revealed = getBooleanValue(this, ((auctionId + callerAddressStr) + "_revealed")) | |
105 | + | let revealStart = getIntegerValue(this, (auctionId + "_reveal_start")) | |
106 | + | let closingStart = getIntegerValue(this, (auctionId + "_closing_start")) | |
107 | + | let oldTopPrice = getIntegerValue(this, (auctionId + "_top_price")) | |
108 | + | let oldSecondPrice = getIntegerValue(this, (auctionId + "_second_price")) | |
109 | + | let winner = getString(this, (auctionId + "_winner")) | |
110 | + | let unrevealedCount = getIntegerValue(this, (auctionId + "_unrevealed_count")) | |
111 | + | let bidAmountAsStr = toString(bidAmount) | |
112 | + | let stringToHash = (salt + bidAmountAsStr) | |
113 | + | let hash = hashString(stringToHash) | |
114 | + | if (!(isDefined(organizer))) | |
115 | + | then throw("Organizer is not defined") | |
116 | + | else if (!(isDefined(bidHash))) | |
117 | + | then throw("Bid is not defined") | |
118 | + | else if (if ((revealStart > lastBlock.height)) | |
119 | + | then true | |
120 | + | else (lastBlock.height > closingStart)) | |
121 | + | then throw(((((("Auction should be revealed between reveal (" + toString(revealStart)) + ") and closing (") + toString(closingStart)) + ") time, now is ") + toString(lastBlock.height))) | |
122 | + | else if ((hash != bidHash)) | |
123 | + | then throw("Bid hash from bidMount and sault is not equel with hash from the caller bid") | |
124 | + | else if ((revealed == true)) | |
125 | + | then throw("The bid has been already revealed") | |
126 | + | else { | |
127 | + | let newTopPrice = if ((bidAmount > oldTopPrice)) | |
128 | + | then bidAmount | |
129 | + | else oldTopPrice | |
130 | + | let newSecondPrice = if ((oldTopPrice == 0)) | |
131 | + | then newTopPrice | |
132 | + | else if ((bidAmount > oldTopPrice)) | |
133 | + | then oldTopPrice | |
134 | + | else if ((bidAmount > oldSecondPrice)) | |
135 | + | then bidAmount | |
136 | + | else oldSecondPrice | |
137 | + | let newWinner = if ((bidAmount > newTopPrice)) | |
138 | + | then callerAddressStr | |
139 | + | else if (isDefined(winner)) | |
140 | + | then value(winner) | |
141 | + | else callerAddressStr | |
142 | + | WriteSet([DataEntry((auctionId + "_top_price"), newTopPrice), DataEntry((auctionId + "_second_price"), newSecondPrice), DataEntry((auctionId + "_winner"), newWinner), DataEntry(((auctionId + callerAddressStr) + "_revealed"), true), DataEntry((auctionId + "_unrevealed_count"), (unrevealedCount - 1))]) | |
143 | + | } | |
144 | + | } | |
145 | + | ||
146 | + | ||
147 | + | ||
148 | + | @Callable(i) | |
149 | + | func withdraw (auctionId) = { | |
150 | + | let pmt = i.payment | |
151 | + | let callerAddressStr = toBase58String(i.caller.bytes) | |
152 | + | let closingStart = getIntegerValue(this, (auctionId + "_closing_start")) | |
153 | + | let unrevealedCount = getIntegerValue(this, (auctionId + "_unrevealed_count")) | |
154 | + | let organizer = getStringValue(this, (auctionId + "_organizer")) | |
155 | + | let revealTime = getIntegerValue(this, (auctionId + "_reveal_start")) | |
156 | + | let winner = getString(this, (auctionId + "_winner")) | |
157 | + | let lotAssetId = getStringValue(this, (auctionId + "_lot_assetId")) | |
158 | + | let lotAmount = getIntegerValue(this, (auctionId + "_lot_amount")) | |
159 | + | let priceAssetId = getStringValue(this, (auctionId + "_priceAssetId")) | |
160 | + | let settle = getBooleanValue(this, (auctionId + "_settle")) | |
161 | + | let secondPrice = getIntegerValue(this, (auctionId + "_second_price")) | |
162 | + | let deposit = getIntegerValue(this, (auctionId + "_deposit")) | |
163 | + | let lotAsset = if ((lotAssetId == "WAVES")) | |
164 | + | then unit | |
165 | + | else fromBase58String(lotAssetId) | |
166 | + | let priceAsset = if (if ((priceAssetId == "WAVES")) | |
167 | + | then true | |
168 | + | else (priceAssetId == "")) | |
169 | + | then unit | |
170 | + | else fromBase58String(priceAssetId) | |
171 | + | if (!(isDefined(organizer))) | |
172 | + | then throw("Organizer shoud exist") | |
173 | + | else if (if ((closingStart > (revealTime - lastBlock.height))) | |
174 | + | then (unrevealedCount != 0) | |
175 | + | else false) | |
176 | + | then throw("Its too early to withdraw") | |
177 | + | else if (if ((callerAddressStr == organizer)) | |
178 | + | then true | |
179 | + | else (callerAddressStr == winner)) | |
180 | + | then if ((settle == true)) | |
181 | + | then throw("Illegal state, settle shoould be false") | |
182 | + | else if (!(isDefined(winner))) | |
183 | + | then if (isDefined(getString(this, (auctionId + "_lot_passed")))) | |
184 | + | then throw("Organizer has already got his lot back") | |
185 | + | else { | |
186 | + | let organizerAddr = addressFromStringValue(value(organizer)) | |
187 | + | ScriptResult(WriteSet([DataEntry((auctionId + "_settle"), true), DataEntry((organizer + "_organizer"), removeFromList(getStringValue(this, (organizer + "_organizer")), auctionId))]), TransferSet([ScriptTransfer(organizerAddr, lotAmount, lotAsset)])) | |
188 | + | } | |
189 | + | else { | |
190 | + | let winnerAddr = addressFromStringValue(value(winner)) | |
191 | + | let organizerAddr = addressFromStringValue(value(organizer)) | |
192 | + | ScriptResult(WriteSet([DataEntry((auctionId + "_settle"), true), DataEntry(((auctionId + value(winner)) + "_settle"), true), DataEntry((value(winner) + "_bidder"), removeFromList(getStringValue(this, (value(winner) + "_bidder")), auctionId)), DataEntry((organizer + "_organizer"), removeFromList(getStringValue(this, (organizer + "_organizer")), auctionId))]), TransferSet([ScriptTransfer(organizerAddr, secondPrice, priceAsset), ScriptTransfer(winnerAddr, lotAmount, lotAsset), ScriptTransfer(winnerAddr, (deposit - secondPrice), priceAsset)])) | |
193 | + | } | |
194 | + | else { | |
195 | + | let maybeLocalSettle = getBooleanValue(this, ((auctionId + callerAddressStr) + "_settle")) | |
196 | + | let localSettle = if (isDefined(maybeLocalSettle)) | |
197 | + | then (value(maybeLocalSettle) == true) | |
198 | + | else false | |
199 | + | if (localSettle) | |
200 | + | then throw("Illegal state, settle shoould be false") | |
201 | + | else ScriptResult(WriteSet([DataEntry(((auctionId + callerAddressStr) + "_settle"), true), DataEntry((callerAddressStr + "_bidder"), removeFromList(getStringValue(this, (callerAddressStr + "_bidder")), auctionId))]), TransferSet([ScriptTransfer(i.caller, deposit, priceAsset)])) | |
202 | + | } | |
203 | + | } | |
204 | + | ||
205 | + | ||
206 | + | ||
207 | + | @Callable(i) | |
208 | + | func instantBuy (auctionId) = { | |
209 | + | let pmt = extract(i.payment) | |
210 | + | let pmtAssetIdStr = if (isDefined(pmt.assetId)) | |
211 | + | then toBase58String(value(pmt.assetId)) | |
212 | + | else "WAVES" | |
213 | + | let callerAddressStr = toBase58String(i.caller.bytes) | |
214 | + | let lotAssetId = getStringValue(this, (auctionId + "_lot_assetId")) | |
215 | + | let priceAssetId = getStringValue(this, (auctionId + "_priceAssetId")) | |
216 | + | let deposit = getIntegerValue(this, (auctionId + "_deposit")) | |
217 | + | let settle = getBooleanValue(this, (auctionId + "_settle")) | |
218 | + | let organizer = getStringValue(this, (auctionId + "_organizer")) | |
219 | + | let endHeight = getIntegerValue(this, (auctionId + "_reveal_start")) | |
220 | + | if ((lastBlock.height >= endHeight)) | |
221 | + | then throw("Only avialible diring budding phase") | |
222 | + | else if (if ((pmtAssetIdStr != priceAssetId)) | |
223 | + | then true | |
224 | + | else (pmt.amount != deposit)) | |
225 | + | then throw("Invalid payment") | |
226 | + | else if (settle) | |
227 | + | then throw("Already settled") | |
228 | + | else { | |
229 | + | let winner = callerAddressStr | |
230 | + | let organizerAddr = addressFromStringValue(value(organizer)) | |
231 | + | let winnerAddr = addressFromStringValue(value(winner)) | |
232 | + | let lotAmount = getIntegerValue(this, (auctionId + "_lot_amount")) | |
233 | + | let lotAsset = if ((lotAssetId == "WAVES")) | |
234 | + | then unit | |
235 | + | else fromBase58String(lotAssetId) | |
236 | + | ScriptResult(WriteSet([DataEntry((auctionId + "_settle"), true), DataEntry(((auctionId + value(winner)) + "_settle"), true), DataEntry((value(winner) + "_bidder"), removeFromList(getStringValue(this, (value(winner) + "_bidder")), auctionId)), DataEntry((organizer + "_organizer"), removeFromList(getStringValue(this, (organizer + "_organizer")), auctionId))]), TransferSet([ScriptTransfer(organizerAddr, deposit, pmt.assetId), ScriptTransfer(winnerAddr, lotAmount, lotAsset)])) | |
237 | + | } | |
238 | + | } | |
239 | + | ||
240 | + |
github/deemru/w8io/026f985 33.77 ms ◑