tx · Do9boHeu51KxmWGzdqvKSVHdSNrJ6c1EKyFaKrHexBmN 3Mu7bwtYrymjrXt1ttcqaQbFc1PqGhZndhv: -0.01400000 Waves 2019.09.30 12:44 [699007] smart account 3Mu7bwtYrymjrXt1ttcqaQbFc1PqGhZndhv > SELF 0.00000000 Waves
{ "type": 13, "id": "Do9boHeu51KxmWGzdqvKSVHdSNrJ6c1EKyFaKrHexBmN", "fee": 1400000, "feeAssetId": null, "timestamp": 1569836658094, "version": 1, "sender": "3Mu7bwtYrymjrXt1ttcqaQbFc1PqGhZndhv", "senderPublicKey": "BxHnTcjvN9ZtnKfdKYp6aKRdkMB4ZHxHnTDr5dWx5Vz2", "proofs": [ "5wsBJaBXaZZib8cv6ZFLZWmLJ1BaBjm18wpG19MQiQHYh4FRfoC7DM9LBk8fcA9cbeDm4s7QsfwcdmoPocsVze8U" ], "script": "base64:AAIDAAAAAAAAAAAAAAACAAAAAAh1VG9rZW5JZAEAAAAgg1ag/CIT1AiojH1skJ2ufidI0Eb3a9g5aB0rTX7UN7gBAAAAC2NoZWNrU3RhdHVzAAAAAQAAAAdhZGRyZXNzBAAAAA9zdGF0dXNVbmxpbWl0ZWQEAAAAByRtYXRjaDAJAAQbAAAAAgUAAAAEdGhpcwkAASwAAAACBQAAAAdhZGRyZXNzAgAAAApfdW5saW1pdGVkAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAAdCb29sZWFuBAAAAARib29sBQAAAAckbWF0Y2gwBQAAAARib29sAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAARVbml0BwkBAAAABXRocm93AAAAAAQAAAAKc3RhdHVzVGltZQQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzCQABLAAAAAIFAAAAB2FkZHJlc3MCAAAABV90aW1lAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAA2ludAUAAAAHJG1hdGNoMAUAAAADaW50AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAARVbml0AAAA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MJAAEsAAAAAgkAAS8AAAACBQAAAAZvcmRlcnMFAAAABWluZGV4CQABMAAAAAIFAAAABm9yZGVycwkAAGQAAAACBQAAAAVpbmRleAkAATEAAAABBQAAAAdvcmRlcklkCQEAAAAMU2NyaXB0UmVzdWx0AAAAAgkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgIAAAAGb3JkZXJzBQAAAAluZXdPcmRlcnMJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIFAAAAB29yZGVySWQFAAAAB25ld0RhdGEFAAAAA25pbAkBAAAAC1RyYW5zZmVyU2V0AAAAAQkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADCAUAAAABaQAAAAZjYWxsZXIFAAAADHJldHVybkFtb3VudAMJAAAAAAAAAgUAAAALYW1vdW50QXNzZXQCAAAABVdBVkVTBQAAAAR1bml0CQACWQAAAAEFAAAAC2Ftb3VudEFzc2V0BQAAAANuaWwAAAAAURuJiw==", "chainId": 84, "height": 699007, "spentComplexity": 0 } View: original | compacted Prev: BG3hvuFjaWQ5f1hffcaoqPjZuecSwt589Kg1yCs8Q6ko Next: GhN8QV1Z67tpAc8Ng12Di2WdpUhPLRf5mMCMLNBhioLq Diff:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let uTokenId = base58'9qh2MiJhfqNS1o3R5wcUrAAWpeqZs9R8SLwQvCx88Vaf' | |
5 | + | ||
6 | + | func checkStatus (address) = { | |
7 | + | let statusUnlimited = match getBoolean(this, (address + "_unlimited")) { | |
8 | + | case bool: Boolean => | |
9 | + | bool | |
10 | + | case _: Unit => | |
11 | + | false | |
12 | + | case _ => | |
13 | + | throw() | |
14 | + | } | |
15 | + | let statusTime = match getInteger(this, (address + "_time")) { | |
16 | + | case int: Int => | |
17 | + | int | |
18 | + | case _: Unit => | |
19 | + | 0 | |
20 | + | case _ => | |
21 | + | throw() | |
22 | + | } | |
23 | + | if (statusUnlimited) | |
24 | + | then true | |
25 | + | else (statusTime > lastBlock.timestamp) | |
26 | + | } | |
4 | 27 | ||
5 | 28 | ||
6 | 29 | @Callable(i) | |
7 | - | func makeSell (priceAsset,price) = if (if ((priceAsset != "WAVES")) | |
30 | + | func addAsset (assetId) = { | |
31 | + | let addingPrice = (100 * 100000000) | |
32 | + | let addingPriceStr = "100" | |
33 | + | let payment = valueOrErrorMessage(i.payment, "Where is payment?") | |
34 | + | if (if (isDefined(payment.assetId)) | |
35 | + | then (payment.assetId != uTokenId) | |
36 | + | else false) | |
37 | + | then throw("OTCu or WAVES only") | |
38 | + | else if ((payment.amount != addingPrice)) | |
39 | + | then throw((("You have to pay " + addingPriceStr) + " OTCu or WAVES")) | |
40 | + | else if (!(isDefined(assetInfo(fromBase58String(assetId))))) | |
41 | + | then throw("There is no asset with specified id") | |
42 | + | else { | |
43 | + | let assets = match getString(this, "assets") { | |
44 | + | case str: String => | |
45 | + | str | |
46 | + | case _: Unit => | |
47 | + | "" | |
48 | + | case _ => | |
49 | + | throw() | |
50 | + | } | |
51 | + | if (isDefined(indexOf(assets, assetId))) | |
52 | + | then throw("Asset is already available") | |
53 | + | else WriteSet([DataEntry("assets", (assets + assetId))]) | |
54 | + | } | |
55 | + | } | |
56 | + | ||
57 | + | ||
58 | + | ||
59 | + | @Callable(i) | |
60 | + | func pro (unlimited) = { | |
61 | + | let address = toBase58String(i.caller.bytes) | |
62 | + | let unlimitedPrice = (50 * 100000000) | |
63 | + | let unlimitedPriceStr = "50" | |
64 | + | let monthPrice = (10 * 100000000) | |
65 | + | let monthPriceStr = "10" | |
66 | + | let payment = valueOrErrorMessage(i.payment, "Where is payment?") | |
67 | + | if (if (isDefined(payment.assetId)) | |
68 | + | then (payment.assetId != uTokenId) | |
69 | + | else false) | |
70 | + | then throw("OTCu or WAVES only") | |
71 | + | else if (if (unlimited) | |
72 | + | then (payment.amount != unlimitedPrice) | |
73 | + | else false) | |
74 | + | then throw((("You have to pay " + unlimitedPriceStr) + " OTCu or WAVES")) | |
75 | + | else if (if (!(unlimited)) | |
76 | + | then (payment.amount != monthPrice) | |
77 | + | else false) | |
78 | + | then throw((("You have to pay " + monthPriceStr) + " OTCu or WAVES")) | |
79 | + | else { | |
80 | + | let currentUnlimited = match getBoolean(this, (address + "_unlimited")) { | |
81 | + | case bool: Boolean => | |
82 | + | bool | |
83 | + | case _: Unit => | |
84 | + | false | |
85 | + | case _ => | |
86 | + | throw() | |
87 | + | } | |
88 | + | let currentTime = match getInteger(this, (address + "_time")) { | |
89 | + | case int: Int => | |
90 | + | int | |
91 | + | case _: Unit => | |
92 | + | 0 | |
93 | + | case _ => | |
94 | + | throw() | |
95 | + | } | |
96 | + | if (currentUnlimited) | |
97 | + | then throw("You have unlimited PRO status already. What do you want?") | |
98 | + | else { | |
99 | + | let month = 2629743000 | |
100 | + | WriteSet([DataEntry((address + "_unlimited"), unlimited), DataEntry((address + "_time"), if (unlimited) | |
101 | + | then 0 | |
102 | + | else (currentTime + month))]) | |
103 | + | } | |
104 | + | } | |
105 | + | } | |
106 | + | ||
107 | + | ||
108 | + | ||
109 | + | @Callable(i) | |
110 | + | func makeSell (priceAsset,price,all,password) = if (if ((priceAsset != "WAVES")) | |
8 | 111 | then !(isDefined(assetInfo(fromBase58String(priceAsset)))) | |
9 | 112 | else false) | |
10 | 113 | then throw("There is no asset with specified id") | |
15 | 118 | if ((0 >= payment.amount)) | |
16 | 119 | then throw("amount must be positive") | |
17 | 120 | else { | |
18 | - | let orderId = ("sell_" + toBase58String(i.transactionId)) | |
19 | 121 | let amountAsset = match payment.assetId { | |
20 | 122 | case p: ByteVector => | |
21 | 123 | toBase58String(p) | |
22 | 124 | case _ => | |
23 | 125 | "WAVES" | |
24 | 126 | } | |
25 | - | WriteSet([DataEntry((orderId + "_amount"), payment.amount), DataEntry((orderId + "_amount_asset"), amountAsset), DataEntry((orderId + "_price"), price), DataEntry((orderId + "_price_asset"), priceAsset), DataEntry((orderId + "_owner"), toBase58String(i.caller.bytes)), DataEntry((orderId + "_spent"), 0)]) | |
127 | + | let assets = valueOrErrorMessage(getString(this, "assets"), "There are not available assets") | |
128 | + | if (if (!(isDefined(indexOf(assets, priceAsset)))) | |
129 | + | then true | |
130 | + | else !(isDefined(indexOf(assets, amountAsset)))) | |
131 | + | then throw("Asset are not available for trading") | |
132 | + | else { | |
133 | + | let address = toBase58String(i.caller.bytes) | |
134 | + | if (if (!(checkStatus(address))) | |
135 | + | then if (all) | |
136 | + | then true | |
137 | + | else (password != "") | |
138 | + | else false) | |
139 | + | then throw("You must have pro status to use these features") | |
140 | + | else { | |
141 | + | let orderId = toBase58String(i.transactionId) | |
142 | + | let orders = match getString(this, "orders") { | |
143 | + | case s: String => | |
144 | + | s | |
145 | + | case _: Unit => | |
146 | + | "" | |
147 | + | case _ => | |
148 | + | throw() | |
149 | + | } | |
150 | + | let passwordValid = fromBase58String(password) | |
151 | + | let data = ((((((((((((((toString(payment.amount) + "_") + amountAsset) + "_") + toString(price)) + "_") + priceAsset) + "_") + address) + "_") + toString(all)) + "_") + password) + "_") + toString(0)) | |
152 | + | WriteSet([DataEntry("orders", (orders + orderId)), DataEntry(orderId, data)]) | |
153 | + | } | |
154 | + | } | |
26 | 155 | } | |
27 | 156 | } | |
28 | 157 | ||
29 | 158 | ||
30 | 159 | ||
31 | 160 | @Callable(i) | |
32 | - | func makeBuy (amountAsset,price) = if (if ((amountAsset != "WAVES")) | |
161 | + | func makeBuy (amountAsset,price,all,password) = if (if ((amountAsset != "WAVES")) | |
33 | 162 | then !(isDefined(assetInfo(fromBase58String(amountAsset)))) | |
34 | 163 | else false) | |
35 | 164 | then throw("There is no asset with specified id") | |
40 | 169 | if ((0 >= payment.amount)) | |
41 | 170 | then throw("amount must be positive") | |
42 | 171 | else { | |
43 | - | let orderId = ("buy_" + toBase58String(i.transactionId)) | |
44 | 172 | let priceAsset = match payment.assetId { | |
45 | 173 | case p: ByteVector => | |
46 | 174 | toBase58String(p) | |
47 | 175 | case _ => | |
48 | 176 | "WAVES" | |
49 | 177 | } | |
50 | - | let amountAssetDecimals = if ((amountAsset == "WAVES")) | |
51 | - | then 8 | |
52 | - | else value(assetInfo(fromBase58String(amountAsset))).decimals | |
53 | - | let buyAmount = ((payment.amount * pow(10, 0, amountAssetDecimals, 0, 0, CEILING)) / price) | |
54 | - | if ((buyAmount == 0)) | |
55 | - | then throw("invalid buy amount") | |
56 | - | else WriteSet([DataEntry((orderId + "_amount"), buyAmount), DataEntry((orderId + "_amount_asset"), amountAsset), DataEntry((orderId + "_price"), price), DataEntry((orderId + "_price_asset"), priceAsset), DataEntry((orderId + "_owner"), toBase58String(i.caller.bytes)), DataEntry((orderId + "_spent"), 0)]) | |
178 | + | let assets = valueOrErrorMessage(getString(this, "assets"), "There are not available assets") | |
179 | + | if (if (!(isDefined(indexOf(assets, priceAsset)))) | |
180 | + | then true | |
181 | + | else !(isDefined(indexOf(assets, amountAsset)))) | |
182 | + | then throw("Asset are not available for trading") | |
183 | + | else { | |
184 | + | let address = toBase58String(i.caller.bytes) | |
185 | + | if (if (!(checkStatus(address))) | |
186 | + | then if (all) | |
187 | + | then true | |
188 | + | else (password != "") | |
189 | + | else false) | |
190 | + | then throw("You must have pro status to use these features") | |
191 | + | else { | |
192 | + | let orderId = toBase58String(i.transactionId) | |
193 | + | let orders = match getString(this, "orders") { | |
194 | + | case s: String => | |
195 | + | s | |
196 | + | case _: Unit => | |
197 | + | "" | |
198 | + | case _ => | |
199 | + | throw() | |
200 | + | } | |
201 | + | let amountAssetDecimals = if ((amountAsset == "WAVES")) | |
202 | + | then 8 | |
203 | + | else value(assetInfo(fromBase58String(amountAsset))).decimals | |
204 | + | let buyAmount = ((payment.amount * pow(10, 0, amountAssetDecimals, 0, 0, CEILING)) / price) | |
205 | + | if ((buyAmount == 0)) | |
206 | + | then throw("invalid buy amount") | |
207 | + | else { | |
208 | + | let data = ((((((((((((((toString(buyAmount) + "_") + amountAsset) + "_") + toString(price)) + "_") + priceAsset) + "_") + address) + "_") + toString(all)) + "_") + password) + "_") + toString(0)) | |
209 | + | WriteSet([DataEntry("orders", (orders + orderId)), DataEntry(orderId, data)]) | |
210 | + | } | |
211 | + | } | |
212 | + | } | |
57 | 213 | } | |
58 | 214 | } | |
59 | 215 | ||
60 | 216 | ||
61 | 217 | ||
62 | 218 | @Callable(i) | |
63 | - | func takeSell ( | |
219 | + | func takeSell (orderId,sig) = { | |
64 | 220 | let payment = valueOrErrorMessage(i.payment, "where is payment?") | |
65 | 221 | if ((0 >= payment.amount)) | |
66 | 222 | then throw("amount must be positive") | |
67 | 223 | else { | |
68 | - | let orderId = ("sell_" + id) | |
69 | 224 | let paymentAsset = match payment.assetId { | |
70 | 225 | case p: ByteVector => | |
71 | 226 | toBase58String(p) | |
72 | 227 | case _ => | |
73 | 228 | "WAVES" | |
74 | 229 | } | |
75 | - | let priceAsset = valueOrErrorMessage(getString(this, (orderId + "_price_asset")), "there is no order with specified id") | |
230 | + | let data = valueOrErrorMessage(getString(this, orderId), "Invalid order id") | |
231 | + | let amount = parseIntValue(split(data, "_")[0]) | |
232 | + | let amountAsset = split(data, "_")[1] | |
233 | + | let price = parseIntValue(split(data, "_")[2]) | |
234 | + | let priceAsset = split(data, "_")[3] | |
235 | + | let owner = value(addressFromString(split(data, "_")[4])) | |
236 | + | let all = if ((split(data, "_")[5] == "true")) | |
237 | + | then true | |
238 | + | else false | |
239 | + | let password = split(data, "_")[6] | |
240 | + | let spent = parseIntValue(split(data, "_")[7]) | |
76 | 241 | if ((priceAsset != paymentAsset)) | |
77 | - | then throw((" | |
242 | + | then throw(("Payment asset must be " + priceAsset)) | |
78 | 243 | else { | |
79 | - | let price = getIntegerValue(this, (orderId + "_price")) | |
80 | - | let amount = getIntegerValue(this, (orderId + "_amount")) | |
81 | - | let amountAsset = getStringValue(this, (orderId + "_amount_asset")) | |
82 | - | let amountAssetDecimals = if ((amountAsset == "WAVES")) | |
83 | - | then 8 | |
84 | - | else value(assetInfo(fromBase58String(amountAsset))).decimals | |
85 | - | let buyAmount = ((payment.amount * pow(10, 0, amountAssetDecimals, 0, 0, CEILING)) / price) | |
86 | - | if ((buyAmount == 0)) | |
87 | - | then throw("invalid amount") | |
244 | + | let valid = if ((password != "")) | |
245 | + | then sigVerify(i.callerPublicKey, fromBase58String(sig), fromBase58String(password)) | |
246 | + | else true | |
247 | + | if (!(valid)) | |
248 | + | then throw("The order is private") | |
88 | 249 | else { | |
89 | - | let owner = value(addressFromString(getStringValue(this, (orderId + "_owner")))) | |
90 | - | let spent = getIntegerValue(this, (orderId + "_spent")) | |
91 | - | if ((buyAmount > (amount - spent))) | |
92 | - | then throw("not enougth asset in order") | |
93 | - | else ScriptResult(WriteSet([DataEntry((orderId + "_spent"), (spent + buyAmount))]), TransferSet([ScriptTransfer(i.caller, buyAmount, if ((amountAsset == "WAVES")) | |
94 | - | then unit | |
95 | - | else fromBase58String(amountAsset)), ScriptTransfer(owner, payment.amount, if ((priceAsset == "WAVES")) | |
96 | - | then unit | |
97 | - | else fromBase58String(priceAsset))])) | |
250 | + | let amountAssetDecimals = if ((amountAsset == "WAVES")) | |
251 | + | then 8 | |
252 | + | else value(assetInfo(fromBase58String(amountAsset))).decimals | |
253 | + | let buyAmount = ((payment.amount * pow(10, 0, amountAssetDecimals, 0, 0, CEILING)) / price) | |
254 | + | if ((buyAmount == 0)) | |
255 | + | then throw("Invalid amount") | |
256 | + | else if (if (all) | |
257 | + | then (amount > buyAmount) | |
258 | + | else false) | |
259 | + | then throw("You must take all or none") | |
260 | + | else if ((buyAmount > (amount - spent))) | |
261 | + | then throw("Not enougth asset in order") | |
262 | + | else { | |
263 | + | let orders = match getString(this, "orders") { | |
264 | + | case s: String => | |
265 | + | s | |
266 | + | case _: Unit => | |
267 | + | "" | |
268 | + | case _ => | |
269 | + | throw() | |
270 | + | } | |
271 | + | let newData = (dropRight(data, size(split(data, "_")[7])) + toString((spent + buyAmount))) | |
272 | + | let index = value(indexOf(orders, orderId)) | |
273 | + | let newOrders = if ((amount == (buyAmount + spent))) | |
274 | + | then (take(orders, index) + drop(orders, (index + size(orderId)))) | |
275 | + | else orders | |
276 | + | ScriptResult(WriteSet([DataEntry("orders", newOrders), DataEntry(orderId, newData)]), TransferSet([ScriptTransfer(i.caller, buyAmount, if ((amountAsset == "WAVES")) | |
277 | + | then unit | |
278 | + | else fromBase58String(amountAsset)), ScriptTransfer(owner, payment.amount, if ((priceAsset == "WAVES")) | |
279 | + | then unit | |
280 | + | else fromBase58String(priceAsset))])) | |
281 | + | } | |
98 | 282 | } | |
99 | 283 | } | |
100 | 284 | } | |
103 | 287 | ||
104 | 288 | ||
105 | 289 | @Callable(i) | |
106 | - | func takeBuy ( | |
290 | + | func takeBuy (orderId,sig) = { | |
107 | 291 | let payment = valueOrErrorMessage(i.payment, "where is payment?") | |
108 | 292 | if ((0 >= payment.amount)) | |
109 | 293 | then throw("amount must be positive") | |
110 | 294 | else { | |
111 | - | let orderId = ("buy_" + id) | |
112 | 295 | let paymentAsset = match payment.assetId { | |
113 | 296 | case p: ByteVector => | |
114 | 297 | toBase58String(p) | |
115 | 298 | case _ => | |
116 | 299 | "WAVES" | |
117 | 300 | } | |
118 | - | let amountAsset = valueOrErrorMessage(getString(this, (orderId + "_amount_asset")), "there is no order with specified id") | |
301 | + | let data = valueOrErrorMessage(getString(this, orderId), "Invalid order id") | |
302 | + | let amount = parseIntValue(split(data, "_")[0]) | |
303 | + | let amountAsset = split(data, "_")[1] | |
304 | + | let price = parseIntValue(split(data, "_")[2]) | |
305 | + | let priceAsset = split(data, "_")[3] | |
306 | + | let owner = value(addressFromString(split(data, "_")[4])) | |
307 | + | let all = if ((split(data, "_")[5] == "true")) | |
308 | + | then true | |
309 | + | else false | |
310 | + | let password = split(data, "_")[6] | |
311 | + | let spent = parseIntValue(split(data, "_")[7]) | |
119 | 312 | if ((amountAsset != paymentAsset)) | |
120 | 313 | then throw(("payment asset must be " + amountAsset)) | |
121 | 314 | else { | |
122 | - | let price = getIntegerValue(this, (orderId + "_price")) | |
123 | - | let amount = getIntegerValue(this, (orderId + "_amount")) | |
124 | - | let priceAsset = getStringValue(this, (orderId + "_price_asset")) | |
125 | - | let amountAssetDecimals = if ((amountAsset == "WAVES")) | |
126 | - | then 8 | |
127 | - | else value(assetInfo(fromBase58String(amountAsset))).decimals | |
128 | - | let priceAmount = ((payment.amount * price) / pow(10, 0, amountAssetDecimals, 0, 0, CEILING)) | |
129 | - | if ((priceAmount == 0)) | |
130 | - | then throw("invalid amount") | |
315 | + | let valid = if ((password != "")) | |
316 | + | then sigVerify(i.callerPublicKey, fromBase58String(sig), fromBase58String(password)) | |
317 | + | else true | |
318 | + | if (!(valid)) | |
319 | + | then throw("The order is private") | |
131 | 320 | else { | |
132 | - | let owner = value(addressFromString(getStringValue(this, (orderId + "_owner")))) | |
133 | - | let spent = getIntegerValue(this, (orderId + "_spent")) | |
134 | - | if ((payment.amount > (amount - spent))) | |
135 | - | then throw("not enougth asset in order") | |
136 | - | else ScriptResult(WriteSet([DataEntry((orderId + "_spent"), (spent + payment.amount))]), TransferSet([ScriptTransfer(i.caller, priceAmount, if ((priceAsset == "WAVES")) | |
137 | - | then unit | |
138 | - | else fromBase58String(priceAsset)), ScriptTransfer(owner, payment.amount, if ((amountAsset == "WAVES")) | |
139 | - | then unit | |
140 | - | else fromBase58String(amountAsset))])) | |
321 | + | let amountAssetDecimals = if ((amountAsset == "WAVES")) | |
322 | + | then 8 | |
323 | + | else value(assetInfo(fromBase58String(amountAsset))).decimals | |
324 | + | let priceAmount = ((payment.amount * price) / pow(10, 0, amountAssetDecimals, 0, 0, CEILING)) | |
325 | + | if ((priceAmount == 0)) | |
326 | + | then throw("invalid amount") | |
327 | + | else if (if (all) | |
328 | + | then (amount > priceAmount) | |
329 | + | else false) | |
330 | + | then throw("You must take all or none") | |
331 | + | else if ((payment.amount > (amount - spent))) | |
332 | + | then throw("not enougth asset in order") | |
333 | + | else { | |
334 | + | let orders = match getString(this, "orders") { | |
335 | + | case s: String => | |
336 | + | s | |
337 | + | case _: Unit => | |
338 | + | "" | |
339 | + | case _ => | |
340 | + | throw() | |
341 | + | } | |
342 | + | let newData = (dropRight(data, size(split(data, "_")[7])) + toString((spent + payment.amount))) | |
343 | + | let index = value(indexOf(orders, orderId)) | |
344 | + | let newOrders = if ((amount == (payment.amount + spent))) | |
345 | + | then (take(orders, index) + drop(orders, (index + size(orderId)))) | |
346 | + | else orders | |
347 | + | ScriptResult(WriteSet([DataEntry("orders", newOrders), DataEntry(orderId, newData)]), TransferSet([ScriptTransfer(i.caller, priceAmount, if ((priceAsset == "WAVES")) | |
348 | + | then unit | |
349 | + | else fromBase58String(priceAsset)), ScriptTransfer(owner, payment.amount, if ((amountAsset == "WAVES")) | |
350 | + | then unit | |
351 | + | else fromBase58String(amountAsset))])) | |
352 | + | } | |
141 | 353 | } | |
354 | + | } | |
355 | + | } | |
356 | + | } | |
357 | + | ||
358 | + | ||
359 | + | ||
360 | + | @Callable(i) | |
361 | + | func returnBuy (orderId) = { | |
362 | + | let data = valueOrErrorMessage(getString(this, orderId), "Invalid order id") | |
363 | + | let amount = parseIntValue(split(data, "_")[0]) | |
364 | + | let amountAsset = split(data, "_")[1] | |
365 | + | let price = parseIntValue(split(data, "_")[2]) | |
366 | + | let priceAsset = split(data, "_")[3] | |
367 | + | let owner = value(addressFromString(split(data, "_")[4])) | |
368 | + | let all = if ((split(data, "_")[5] == "true")) | |
369 | + | then true | |
370 | + | else false | |
371 | + | let password = split(data, "_")[6] | |
372 | + | let spent = parseIntValue(split(data, "_")[7]) | |
373 | + | if ((owner != i.caller)) | |
374 | + | then throw("Return should be called by order owner") | |
375 | + | else { | |
376 | + | let amountAssetDecimals = if ((amountAsset == "WAVES")) | |
377 | + | then 8 | |
378 | + | else value(assetInfo(fromBase58String(amountAsset))).decimals | |
379 | + | let returnAmount = (((amount - spent) * price) / pow(10, 0, amountAssetDecimals, 0, 0, CEILING)) | |
380 | + | if ((0 >= returnAmount)) | |
381 | + | then throw("nothing to return") | |
382 | + | else { | |
383 | + | let orders = match getString(this, "orders") { | |
384 | + | case s: String => | |
385 | + | s | |
386 | + | case _: Unit => | |
387 | + | "" | |
388 | + | case _ => | |
389 | + | throw() | |
390 | + | } | |
391 | + | let newData = (dropRight(data, size(split(data, "_")[7])) + toString(amount)) | |
392 | + | let index = value(indexOf(orders, orderId)) | |
393 | + | let newOrders = (take(orders, index) + drop(orders, (index + size(orderId)))) | |
394 | + | ScriptResult(WriteSet([DataEntry("orders", newOrders), DataEntry(orderId, newData)]), TransferSet([ScriptTransfer(i.caller, returnAmount, if ((priceAsset == "WAVES")) | |
395 | + | then unit | |
396 | + | else fromBase58String(priceAsset))])) | |
397 | + | } | |
398 | + | } | |
399 | + | } | |
400 | + | ||
401 | + | ||
402 | + | ||
403 | + | @Callable(i) | |
404 | + | func returnSell (orderId) = { | |
405 | + | let data = valueOrErrorMessage(getString(this, orderId), "Invalid order id") | |
406 | + | let amount = parseIntValue(split(data, "_")[0]) | |
407 | + | let amountAsset = split(data, "_")[1] | |
408 | + | let price = parseIntValue(split(data, "_")[2]) | |
409 | + | let priceAsset = split(data, "_")[3] | |
410 | + | let owner = value(addressFromString(split(data, "_")[4])) | |
411 | + | let all = if ((split(data, "_")[5] == "true")) | |
412 | + | then true | |
413 | + | else false | |
414 | + | let password = split(data, "_")[6] | |
415 | + | let spent = parseIntValue(split(data, "_")[7]) | |
416 | + | if ((owner != i.caller)) | |
417 | + | then throw("return should be called by order owner") | |
418 | + | else { | |
419 | + | let returnAmount = (amount - spent) | |
420 | + | if ((0 >= returnAmount)) | |
421 | + | then throw("nothing to return") | |
422 | + | else { | |
423 | + | let orders = match getString(this, "orders") { | |
424 | + | case s: String => | |
425 | + | s | |
426 | + | case _: Unit => | |
427 | + | "" | |
428 | + | case _ => | |
429 | + | throw() | |
430 | + | } | |
431 | + | let newData = (dropRight(data, size(split(data, "_")[7])) + toString(amount)) | |
432 | + | let index = value(indexOf(orders, orderId)) | |
433 | + | let newOrders = (take(orders, index) + drop(orders, (index + size(orderId)))) | |
434 | + | ScriptResult(WriteSet([DataEntry("orders", newOrders), DataEntry(orderId, newData)]), TransferSet([ScriptTransfer(i.caller, returnAmount, if ((amountAsset == "WAVES")) | |
435 | + | then unit | |
436 | + | else fromBase58String(amountAsset))])) | |
142 | 437 | } | |
143 | 438 | } | |
144 | 439 | } |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let uTokenId = base58'9qh2MiJhfqNS1o3R5wcUrAAWpeqZs9R8SLwQvCx88Vaf' | |
5 | + | ||
6 | + | func checkStatus (address) = { | |
7 | + | let statusUnlimited = match getBoolean(this, (address + "_unlimited")) { | |
8 | + | case bool: Boolean => | |
9 | + | bool | |
10 | + | case _: Unit => | |
11 | + | false | |
12 | + | case _ => | |
13 | + | throw() | |
14 | + | } | |
15 | + | let statusTime = match getInteger(this, (address + "_time")) { | |
16 | + | case int: Int => | |
17 | + | int | |
18 | + | case _: Unit => | |
19 | + | 0 | |
20 | + | case _ => | |
21 | + | throw() | |
22 | + | } | |
23 | + | if (statusUnlimited) | |
24 | + | then true | |
25 | + | else (statusTime > lastBlock.timestamp) | |
26 | + | } | |
4 | 27 | ||
5 | 28 | ||
6 | 29 | @Callable(i) | |
7 | - | func makeSell (priceAsset,price) = if (if ((priceAsset != "WAVES")) | |
30 | + | func addAsset (assetId) = { | |
31 | + | let addingPrice = (100 * 100000000) | |
32 | + | let addingPriceStr = "100" | |
33 | + | let payment = valueOrErrorMessage(i.payment, "Where is payment?") | |
34 | + | if (if (isDefined(payment.assetId)) | |
35 | + | then (payment.assetId != uTokenId) | |
36 | + | else false) | |
37 | + | then throw("OTCu or WAVES only") | |
38 | + | else if ((payment.amount != addingPrice)) | |
39 | + | then throw((("You have to pay " + addingPriceStr) + " OTCu or WAVES")) | |
40 | + | else if (!(isDefined(assetInfo(fromBase58String(assetId))))) | |
41 | + | then throw("There is no asset with specified id") | |
42 | + | else { | |
43 | + | let assets = match getString(this, "assets") { | |
44 | + | case str: String => | |
45 | + | str | |
46 | + | case _: Unit => | |
47 | + | "" | |
48 | + | case _ => | |
49 | + | throw() | |
50 | + | } | |
51 | + | if (isDefined(indexOf(assets, assetId))) | |
52 | + | then throw("Asset is already available") | |
53 | + | else WriteSet([DataEntry("assets", (assets + assetId))]) | |
54 | + | } | |
55 | + | } | |
56 | + | ||
57 | + | ||
58 | + | ||
59 | + | @Callable(i) | |
60 | + | func pro (unlimited) = { | |
61 | + | let address = toBase58String(i.caller.bytes) | |
62 | + | let unlimitedPrice = (50 * 100000000) | |
63 | + | let unlimitedPriceStr = "50" | |
64 | + | let monthPrice = (10 * 100000000) | |
65 | + | let monthPriceStr = "10" | |
66 | + | let payment = valueOrErrorMessage(i.payment, "Where is payment?") | |
67 | + | if (if (isDefined(payment.assetId)) | |
68 | + | then (payment.assetId != uTokenId) | |
69 | + | else false) | |
70 | + | then throw("OTCu or WAVES only") | |
71 | + | else if (if (unlimited) | |
72 | + | then (payment.amount != unlimitedPrice) | |
73 | + | else false) | |
74 | + | then throw((("You have to pay " + unlimitedPriceStr) + " OTCu or WAVES")) | |
75 | + | else if (if (!(unlimited)) | |
76 | + | then (payment.amount != monthPrice) | |
77 | + | else false) | |
78 | + | then throw((("You have to pay " + monthPriceStr) + " OTCu or WAVES")) | |
79 | + | else { | |
80 | + | let currentUnlimited = match getBoolean(this, (address + "_unlimited")) { | |
81 | + | case bool: Boolean => | |
82 | + | bool | |
83 | + | case _: Unit => | |
84 | + | false | |
85 | + | case _ => | |
86 | + | throw() | |
87 | + | } | |
88 | + | let currentTime = match getInteger(this, (address + "_time")) { | |
89 | + | case int: Int => | |
90 | + | int | |
91 | + | case _: Unit => | |
92 | + | 0 | |
93 | + | case _ => | |
94 | + | throw() | |
95 | + | } | |
96 | + | if (currentUnlimited) | |
97 | + | then throw("You have unlimited PRO status already. What do you want?") | |
98 | + | else { | |
99 | + | let month = 2629743000 | |
100 | + | WriteSet([DataEntry((address + "_unlimited"), unlimited), DataEntry((address + "_time"), if (unlimited) | |
101 | + | then 0 | |
102 | + | else (currentTime + month))]) | |
103 | + | } | |
104 | + | } | |
105 | + | } | |
106 | + | ||
107 | + | ||
108 | + | ||
109 | + | @Callable(i) | |
110 | + | func makeSell (priceAsset,price,all,password) = if (if ((priceAsset != "WAVES")) | |
8 | 111 | then !(isDefined(assetInfo(fromBase58String(priceAsset)))) | |
9 | 112 | else false) | |
10 | 113 | then throw("There is no asset with specified id") | |
11 | 114 | else if ((0 >= price)) | |
12 | 115 | then throw("price must be positive") | |
13 | 116 | else { | |
14 | 117 | let payment = valueOrErrorMessage(i.payment, "where is payment?") | |
15 | 118 | if ((0 >= payment.amount)) | |
16 | 119 | then throw("amount must be positive") | |
17 | 120 | else { | |
18 | - | let orderId = ("sell_" + toBase58String(i.transactionId)) | |
19 | 121 | let amountAsset = match payment.assetId { | |
20 | 122 | case p: ByteVector => | |
21 | 123 | toBase58String(p) | |
22 | 124 | case _ => | |
23 | 125 | "WAVES" | |
24 | 126 | } | |
25 | - | WriteSet([DataEntry((orderId + "_amount"), payment.amount), DataEntry((orderId + "_amount_asset"), amountAsset), DataEntry((orderId + "_price"), price), DataEntry((orderId + "_price_asset"), priceAsset), DataEntry((orderId + "_owner"), toBase58String(i.caller.bytes)), DataEntry((orderId + "_spent"), 0)]) | |
127 | + | let assets = valueOrErrorMessage(getString(this, "assets"), "There are not available assets") | |
128 | + | if (if (!(isDefined(indexOf(assets, priceAsset)))) | |
129 | + | then true | |
130 | + | else !(isDefined(indexOf(assets, amountAsset)))) | |
131 | + | then throw("Asset are not available for trading") | |
132 | + | else { | |
133 | + | let address = toBase58String(i.caller.bytes) | |
134 | + | if (if (!(checkStatus(address))) | |
135 | + | then if (all) | |
136 | + | then true | |
137 | + | else (password != "") | |
138 | + | else false) | |
139 | + | then throw("You must have pro status to use these features") | |
140 | + | else { | |
141 | + | let orderId = toBase58String(i.transactionId) | |
142 | + | let orders = match getString(this, "orders") { | |
143 | + | case s: String => | |
144 | + | s | |
145 | + | case _: Unit => | |
146 | + | "" | |
147 | + | case _ => | |
148 | + | throw() | |
149 | + | } | |
150 | + | let passwordValid = fromBase58String(password) | |
151 | + | let data = ((((((((((((((toString(payment.amount) + "_") + amountAsset) + "_") + toString(price)) + "_") + priceAsset) + "_") + address) + "_") + toString(all)) + "_") + password) + "_") + toString(0)) | |
152 | + | WriteSet([DataEntry("orders", (orders + orderId)), DataEntry(orderId, data)]) | |
153 | + | } | |
154 | + | } | |
26 | 155 | } | |
27 | 156 | } | |
28 | 157 | ||
29 | 158 | ||
30 | 159 | ||
31 | 160 | @Callable(i) | |
32 | - | func makeBuy (amountAsset,price) = if (if ((amountAsset != "WAVES")) | |
161 | + | func makeBuy (amountAsset,price,all,password) = if (if ((amountAsset != "WAVES")) | |
33 | 162 | then !(isDefined(assetInfo(fromBase58String(amountAsset)))) | |
34 | 163 | else false) | |
35 | 164 | then throw("There is no asset with specified id") | |
36 | 165 | else if ((0 >= price)) | |
37 | 166 | then throw("price must be positive") | |
38 | 167 | else { | |
39 | 168 | let payment = valueOrErrorMessage(i.payment, "where is payment?") | |
40 | 169 | if ((0 >= payment.amount)) | |
41 | 170 | then throw("amount must be positive") | |
42 | 171 | else { | |
43 | - | let orderId = ("buy_" + toBase58String(i.transactionId)) | |
44 | 172 | let priceAsset = match payment.assetId { | |
45 | 173 | case p: ByteVector => | |
46 | 174 | toBase58String(p) | |
47 | 175 | case _ => | |
48 | 176 | "WAVES" | |
49 | 177 | } | |
50 | - | let amountAssetDecimals = if ((amountAsset == "WAVES")) | |
51 | - | then 8 | |
52 | - | else value(assetInfo(fromBase58String(amountAsset))).decimals | |
53 | - | let buyAmount = ((payment.amount * pow(10, 0, amountAssetDecimals, 0, 0, CEILING)) / price) | |
54 | - | if ((buyAmount == 0)) | |
55 | - | then throw("invalid buy amount") | |
56 | - | else WriteSet([DataEntry((orderId + "_amount"), buyAmount), DataEntry((orderId + "_amount_asset"), amountAsset), DataEntry((orderId + "_price"), price), DataEntry((orderId + "_price_asset"), priceAsset), DataEntry((orderId + "_owner"), toBase58String(i.caller.bytes)), DataEntry((orderId + "_spent"), 0)]) | |
178 | + | let assets = valueOrErrorMessage(getString(this, "assets"), "There are not available assets") | |
179 | + | if (if (!(isDefined(indexOf(assets, priceAsset)))) | |
180 | + | then true | |
181 | + | else !(isDefined(indexOf(assets, amountAsset)))) | |
182 | + | then throw("Asset are not available for trading") | |
183 | + | else { | |
184 | + | let address = toBase58String(i.caller.bytes) | |
185 | + | if (if (!(checkStatus(address))) | |
186 | + | then if (all) | |
187 | + | then true | |
188 | + | else (password != "") | |
189 | + | else false) | |
190 | + | then throw("You must have pro status to use these features") | |
191 | + | else { | |
192 | + | let orderId = toBase58String(i.transactionId) | |
193 | + | let orders = match getString(this, "orders") { | |
194 | + | case s: String => | |
195 | + | s | |
196 | + | case _: Unit => | |
197 | + | "" | |
198 | + | case _ => | |
199 | + | throw() | |
200 | + | } | |
201 | + | let amountAssetDecimals = if ((amountAsset == "WAVES")) | |
202 | + | then 8 | |
203 | + | else value(assetInfo(fromBase58String(amountAsset))).decimals | |
204 | + | let buyAmount = ((payment.amount * pow(10, 0, amountAssetDecimals, 0, 0, CEILING)) / price) | |
205 | + | if ((buyAmount == 0)) | |
206 | + | then throw("invalid buy amount") | |
207 | + | else { | |
208 | + | let data = ((((((((((((((toString(buyAmount) + "_") + amountAsset) + "_") + toString(price)) + "_") + priceAsset) + "_") + address) + "_") + toString(all)) + "_") + password) + "_") + toString(0)) | |
209 | + | WriteSet([DataEntry("orders", (orders + orderId)), DataEntry(orderId, data)]) | |
210 | + | } | |
211 | + | } | |
212 | + | } | |
57 | 213 | } | |
58 | 214 | } | |
59 | 215 | ||
60 | 216 | ||
61 | 217 | ||
62 | 218 | @Callable(i) | |
63 | - | func takeSell ( | |
219 | + | func takeSell (orderId,sig) = { | |
64 | 220 | let payment = valueOrErrorMessage(i.payment, "where is payment?") | |
65 | 221 | if ((0 >= payment.amount)) | |
66 | 222 | then throw("amount must be positive") | |
67 | 223 | else { | |
68 | - | let orderId = ("sell_" + id) | |
69 | 224 | let paymentAsset = match payment.assetId { | |
70 | 225 | case p: ByteVector => | |
71 | 226 | toBase58String(p) | |
72 | 227 | case _ => | |
73 | 228 | "WAVES" | |
74 | 229 | } | |
75 | - | let priceAsset = valueOrErrorMessage(getString(this, (orderId + "_price_asset")), "there is no order with specified id") | |
230 | + | let data = valueOrErrorMessage(getString(this, orderId), "Invalid order id") | |
231 | + | let amount = parseIntValue(split(data, "_")[0]) | |
232 | + | let amountAsset = split(data, "_")[1] | |
233 | + | let price = parseIntValue(split(data, "_")[2]) | |
234 | + | let priceAsset = split(data, "_")[3] | |
235 | + | let owner = value(addressFromString(split(data, "_")[4])) | |
236 | + | let all = if ((split(data, "_")[5] == "true")) | |
237 | + | then true | |
238 | + | else false | |
239 | + | let password = split(data, "_")[6] | |
240 | + | let spent = parseIntValue(split(data, "_")[7]) | |
76 | 241 | if ((priceAsset != paymentAsset)) | |
77 | - | then throw((" | |
242 | + | then throw(("Payment asset must be " + priceAsset)) | |
78 | 243 | else { | |
79 | - | let price = getIntegerValue(this, (orderId + "_price")) | |
80 | - | let amount = getIntegerValue(this, (orderId + "_amount")) | |
81 | - | let amountAsset = getStringValue(this, (orderId + "_amount_asset")) | |
82 | - | let amountAssetDecimals = if ((amountAsset == "WAVES")) | |
83 | - | then 8 | |
84 | - | else value(assetInfo(fromBase58String(amountAsset))).decimals | |
85 | - | let buyAmount = ((payment.amount * pow(10, 0, amountAssetDecimals, 0, 0, CEILING)) / price) | |
86 | - | if ((buyAmount == 0)) | |
87 | - | then throw("invalid amount") | |
244 | + | let valid = if ((password != "")) | |
245 | + | then sigVerify(i.callerPublicKey, fromBase58String(sig), fromBase58String(password)) | |
246 | + | else true | |
247 | + | if (!(valid)) | |
248 | + | then throw("The order is private") | |
88 | 249 | else { | |
89 | - | let owner = value(addressFromString(getStringValue(this, (orderId + "_owner")))) | |
90 | - | let spent = getIntegerValue(this, (orderId + "_spent")) | |
91 | - | if ((buyAmount > (amount - spent))) | |
92 | - | then throw("not enougth asset in order") | |
93 | - | else ScriptResult(WriteSet([DataEntry((orderId + "_spent"), (spent + buyAmount))]), TransferSet([ScriptTransfer(i.caller, buyAmount, if ((amountAsset == "WAVES")) | |
94 | - | then unit | |
95 | - | else fromBase58String(amountAsset)), ScriptTransfer(owner, payment.amount, if ((priceAsset == "WAVES")) | |
96 | - | then unit | |
97 | - | else fromBase58String(priceAsset))])) | |
250 | + | let amountAssetDecimals = if ((amountAsset == "WAVES")) | |
251 | + | then 8 | |
252 | + | else value(assetInfo(fromBase58String(amountAsset))).decimals | |
253 | + | let buyAmount = ((payment.amount * pow(10, 0, amountAssetDecimals, 0, 0, CEILING)) / price) | |
254 | + | if ((buyAmount == 0)) | |
255 | + | then throw("Invalid amount") | |
256 | + | else if (if (all) | |
257 | + | then (amount > buyAmount) | |
258 | + | else false) | |
259 | + | then throw("You must take all or none") | |
260 | + | else if ((buyAmount > (amount - spent))) | |
261 | + | then throw("Not enougth asset in order") | |
262 | + | else { | |
263 | + | let orders = match getString(this, "orders") { | |
264 | + | case s: String => | |
265 | + | s | |
266 | + | case _: Unit => | |
267 | + | "" | |
268 | + | case _ => | |
269 | + | throw() | |
270 | + | } | |
271 | + | let newData = (dropRight(data, size(split(data, "_")[7])) + toString((spent + buyAmount))) | |
272 | + | let index = value(indexOf(orders, orderId)) | |
273 | + | let newOrders = if ((amount == (buyAmount + spent))) | |
274 | + | then (take(orders, index) + drop(orders, (index + size(orderId)))) | |
275 | + | else orders | |
276 | + | ScriptResult(WriteSet([DataEntry("orders", newOrders), DataEntry(orderId, newData)]), TransferSet([ScriptTransfer(i.caller, buyAmount, if ((amountAsset == "WAVES")) | |
277 | + | then unit | |
278 | + | else fromBase58String(amountAsset)), ScriptTransfer(owner, payment.amount, if ((priceAsset == "WAVES")) | |
279 | + | then unit | |
280 | + | else fromBase58String(priceAsset))])) | |
281 | + | } | |
98 | 282 | } | |
99 | 283 | } | |
100 | 284 | } | |
101 | 285 | } | |
102 | 286 | ||
103 | 287 | ||
104 | 288 | ||
105 | 289 | @Callable(i) | |
106 | - | func takeBuy ( | |
290 | + | func takeBuy (orderId,sig) = { | |
107 | 291 | let payment = valueOrErrorMessage(i.payment, "where is payment?") | |
108 | 292 | if ((0 >= payment.amount)) | |
109 | 293 | then throw("amount must be positive") | |
110 | 294 | else { | |
111 | - | let orderId = ("buy_" + id) | |
112 | 295 | let paymentAsset = match payment.assetId { | |
113 | 296 | case p: ByteVector => | |
114 | 297 | toBase58String(p) | |
115 | 298 | case _ => | |
116 | 299 | "WAVES" | |
117 | 300 | } | |
118 | - | let amountAsset = valueOrErrorMessage(getString(this, (orderId + "_amount_asset")), "there is no order with specified id") | |
301 | + | let data = valueOrErrorMessage(getString(this, orderId), "Invalid order id") | |
302 | + | let amount = parseIntValue(split(data, "_")[0]) | |
303 | + | let amountAsset = split(data, "_")[1] | |
304 | + | let price = parseIntValue(split(data, "_")[2]) | |
305 | + | let priceAsset = split(data, "_")[3] | |
306 | + | let owner = value(addressFromString(split(data, "_")[4])) | |
307 | + | let all = if ((split(data, "_")[5] == "true")) | |
308 | + | then true | |
309 | + | else false | |
310 | + | let password = split(data, "_")[6] | |
311 | + | let spent = parseIntValue(split(data, "_")[7]) | |
119 | 312 | if ((amountAsset != paymentAsset)) | |
120 | 313 | then throw(("payment asset must be " + amountAsset)) | |
121 | 314 | else { | |
122 | - | let price = getIntegerValue(this, (orderId + "_price")) | |
123 | - | let amount = getIntegerValue(this, (orderId + "_amount")) | |
124 | - | let priceAsset = getStringValue(this, (orderId + "_price_asset")) | |
125 | - | let amountAssetDecimals = if ((amountAsset == "WAVES")) | |
126 | - | then 8 | |
127 | - | else value(assetInfo(fromBase58String(amountAsset))).decimals | |
128 | - | let priceAmount = ((payment.amount * price) / pow(10, 0, amountAssetDecimals, 0, 0, CEILING)) | |
129 | - | if ((priceAmount == 0)) | |
130 | - | then throw("invalid amount") | |
315 | + | let valid = if ((password != "")) | |
316 | + | then sigVerify(i.callerPublicKey, fromBase58String(sig), fromBase58String(password)) | |
317 | + | else true | |
318 | + | if (!(valid)) | |
319 | + | then throw("The order is private") | |
131 | 320 | else { | |
132 | - | let owner = value(addressFromString(getStringValue(this, (orderId + "_owner")))) | |
133 | - | let spent = getIntegerValue(this, (orderId + "_spent")) | |
134 | - | if ((payment.amount > (amount - spent))) | |
135 | - | then throw("not enougth asset in order") | |
136 | - | else ScriptResult(WriteSet([DataEntry((orderId + "_spent"), (spent + payment.amount))]), TransferSet([ScriptTransfer(i.caller, priceAmount, if ((priceAsset == "WAVES")) | |
137 | - | then unit | |
138 | - | else fromBase58String(priceAsset)), ScriptTransfer(owner, payment.amount, if ((amountAsset == "WAVES")) | |
139 | - | then unit | |
140 | - | else fromBase58String(amountAsset))])) | |
321 | + | let amountAssetDecimals = if ((amountAsset == "WAVES")) | |
322 | + | then 8 | |
323 | + | else value(assetInfo(fromBase58String(amountAsset))).decimals | |
324 | + | let priceAmount = ((payment.amount * price) / pow(10, 0, amountAssetDecimals, 0, 0, CEILING)) | |
325 | + | if ((priceAmount == 0)) | |
326 | + | then throw("invalid amount") | |
327 | + | else if (if (all) | |
328 | + | then (amount > priceAmount) | |
329 | + | else false) | |
330 | + | then throw("You must take all or none") | |
331 | + | else if ((payment.amount > (amount - spent))) | |
332 | + | then throw("not enougth asset in order") | |
333 | + | else { | |
334 | + | let orders = match getString(this, "orders") { | |
335 | + | case s: String => | |
336 | + | s | |
337 | + | case _: Unit => | |
338 | + | "" | |
339 | + | case _ => | |
340 | + | throw() | |
341 | + | } | |
342 | + | let newData = (dropRight(data, size(split(data, "_")[7])) + toString((spent + payment.amount))) | |
343 | + | let index = value(indexOf(orders, orderId)) | |
344 | + | let newOrders = if ((amount == (payment.amount + spent))) | |
345 | + | then (take(orders, index) + drop(orders, (index + size(orderId)))) | |
346 | + | else orders | |
347 | + | ScriptResult(WriteSet([DataEntry("orders", newOrders), DataEntry(orderId, newData)]), TransferSet([ScriptTransfer(i.caller, priceAmount, if ((priceAsset == "WAVES")) | |
348 | + | then unit | |
349 | + | else fromBase58String(priceAsset)), ScriptTransfer(owner, payment.amount, if ((amountAsset == "WAVES")) | |
350 | + | then unit | |
351 | + | else fromBase58String(amountAsset))])) | |
352 | + | } | |
141 | 353 | } | |
354 | + | } | |
355 | + | } | |
356 | + | } | |
357 | + | ||
358 | + | ||
359 | + | ||
360 | + | @Callable(i) | |
361 | + | func returnBuy (orderId) = { | |
362 | + | let data = valueOrErrorMessage(getString(this, orderId), "Invalid order id") | |
363 | + | let amount = parseIntValue(split(data, "_")[0]) | |
364 | + | let amountAsset = split(data, "_")[1] | |
365 | + | let price = parseIntValue(split(data, "_")[2]) | |
366 | + | let priceAsset = split(data, "_")[3] | |
367 | + | let owner = value(addressFromString(split(data, "_")[4])) | |
368 | + | let all = if ((split(data, "_")[5] == "true")) | |
369 | + | then true | |
370 | + | else false | |
371 | + | let password = split(data, "_")[6] | |
372 | + | let spent = parseIntValue(split(data, "_")[7]) | |
373 | + | if ((owner != i.caller)) | |
374 | + | then throw("Return should be called by order owner") | |
375 | + | else { | |
376 | + | let amountAssetDecimals = if ((amountAsset == "WAVES")) | |
377 | + | then 8 | |
378 | + | else value(assetInfo(fromBase58String(amountAsset))).decimals | |
379 | + | let returnAmount = (((amount - spent) * price) / pow(10, 0, amountAssetDecimals, 0, 0, CEILING)) | |
380 | + | if ((0 >= returnAmount)) | |
381 | + | then throw("nothing to return") | |
382 | + | else { | |
383 | + | let orders = match getString(this, "orders") { | |
384 | + | case s: String => | |
385 | + | s | |
386 | + | case _: Unit => | |
387 | + | "" | |
388 | + | case _ => | |
389 | + | throw() | |
390 | + | } | |
391 | + | let newData = (dropRight(data, size(split(data, "_")[7])) + toString(amount)) | |
392 | + | let index = value(indexOf(orders, orderId)) | |
393 | + | let newOrders = (take(orders, index) + drop(orders, (index + size(orderId)))) | |
394 | + | ScriptResult(WriteSet([DataEntry("orders", newOrders), DataEntry(orderId, newData)]), TransferSet([ScriptTransfer(i.caller, returnAmount, if ((priceAsset == "WAVES")) | |
395 | + | then unit | |
396 | + | else fromBase58String(priceAsset))])) | |
397 | + | } | |
398 | + | } | |
399 | + | } | |
400 | + | ||
401 | + | ||
402 | + | ||
403 | + | @Callable(i) | |
404 | + | func returnSell (orderId) = { | |
405 | + | let data = valueOrErrorMessage(getString(this, orderId), "Invalid order id") | |
406 | + | let amount = parseIntValue(split(data, "_")[0]) | |
407 | + | let amountAsset = split(data, "_")[1] | |
408 | + | let price = parseIntValue(split(data, "_")[2]) | |
409 | + | let priceAsset = split(data, "_")[3] | |
410 | + | let owner = value(addressFromString(split(data, "_")[4])) | |
411 | + | let all = if ((split(data, "_")[5] == "true")) | |
412 | + | then true | |
413 | + | else false | |
414 | + | let password = split(data, "_")[6] | |
415 | + | let spent = parseIntValue(split(data, "_")[7]) | |
416 | + | if ((owner != i.caller)) | |
417 | + | then throw("return should be called by order owner") | |
418 | + | else { | |
419 | + | let returnAmount = (amount - spent) | |
420 | + | if ((0 >= returnAmount)) | |
421 | + | then throw("nothing to return") | |
422 | + | else { | |
423 | + | let orders = match getString(this, "orders") { | |
424 | + | case s: String => | |
425 | + | s | |
426 | + | case _: Unit => | |
427 | + | "" | |
428 | + | case _ => | |
429 | + | throw() | |
430 | + | } | |
431 | + | let newData = (dropRight(data, size(split(data, "_")[7])) + toString(amount)) | |
432 | + | let index = value(indexOf(orders, orderId)) | |
433 | + | let newOrders = (take(orders, index) + drop(orders, (index + size(orderId)))) | |
434 | + | ScriptResult(WriteSet([DataEntry("orders", newOrders), DataEntry(orderId, newData)]), TransferSet([ScriptTransfer(i.caller, returnAmount, if ((amountAsset == "WAVES")) | |
435 | + | then unit | |
436 | + | else fromBase58String(amountAsset))])) | |
142 | 437 | } | |
143 | 438 | } | |
144 | 439 | } | |
145 | 440 | ||
146 | 441 |
github/deemru/w8io/169f3d6 56.97 ms ◑