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