tx · cgaJd6ZDpxK2rVq1ugUFMwwfz5ypyQ1k7q8MQ47KAu5 3Mu7bwtYrymjrXt1ttcqaQbFc1PqGhZndhv: -0.01000000 Waves 2019.09.11 00:33 [670566] smart account 3Mu7bwtYrymjrXt1ttcqaQbFc1PqGhZndhv > SELF 0.00000000 Waves
{ "type": 13, "id": "cgaJd6ZDpxK2rVq1ugUFMwwfz5ypyQ1k7q8MQ47KAu5", "fee": 1000000, "feeAssetId": null, "timestamp": 1568151176855, "version": 1, "sender": "3Mu7bwtYrymjrXt1ttcqaQbFc1PqGhZndhv", "senderPublicKey": "BxHnTcjvN9ZtnKfdKYp6aKRdkMB4ZHxHnTDr5dWx5Vz2", "proofs": [ "4kgk6nzaSSczNY3kGBF7quTZ8mpeexH8vT9HtsKnTaEHQ6jwAZMFkqNbRrZcVjRs3BfkmSCEgA6MW8vGKBF78zkH" ], "script": "base64:AAIDAAAAAAAAAAAAAAAAAAAAAwAAAAFpAQAAAAhtYWtlU2VsbAAAAAMAAAAKcHJpY2VBc3NldAAAAAVwcmljZQAAAANhbGwDAwkBAAAAAiE9AAAAAgUAAAAKcHJpY2VBc3NldAIAAAAFV0FWRVMJAQAAAAEhAAAAAQkBAAAACWlzRGVmaW5lZAAAAAEJAAPsAAAAAQkAAlkAAAABBQAAAApwcmljZUFzc2V0BwkAAAIAAAABAgAAACNUaGVyZSBpcyBubyBhc3NldCB3aXRoIHNwZWNpZmllZCBpZAMJAABnAAAAAgAAAAAAAAAAAAUAAAAFcHJpY2UJAAACAAAAAQIAAAAWcHJpY2UgbXVzdCBiZSBwb3NpdGl2ZQQAAAAHcGF5bWVudAkBAAAAE3ZhbHVlT3JFcnJvck1lc3NhZ2UAAAACCAUAAAABaQAAAAdwYXltZW50AgAAABF3aGVyZSBpcyBwYXltZW50PwMJAABnAAAAAgAAAAAAAAAAAAgFAAAAB3BheW1lbnQAAAAGYW1vdW50CQAAAgAAAAECAAAAF2Ftb3VudCBtdXN0IGJlIHBvc2l0aXZl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3NldAkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADBQAAAAVvd25lcggFAAAAB3BheW1lbnQAAAAGYW1vdW50AwkAAAAAAAACBQAAAApwcmljZUFzc2V0AgAAAAVXQVZFUwUAAAAEdW5pdAkAAlkAAAABBQAAAApwcmljZUFzc2V0BQAAAANuaWwAAAAAa9xAkA==", "chainId": 84, "height": 670566, "spentComplexity": 0 } View: original | compacted Prev: none Next: 1Mh8dJKr6Hedyb3EnSz3RA5LaLFGZjK8NcsfJyA4Pb2 Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 3 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | ||
5 | + | ||
6 | + | @Callable(a) | |
7 | + | func makeSell (b,c,d) = if (if ((b != "WAVES")) | |
8 | + | then !(isDefined(assetInfo(fromBase58String(b)))) | |
9 | + | else false) | |
10 | + | then throw("There is no asset with specified id") | |
11 | + | else if ((0 >= c)) | |
12 | + | then throw("price must be positive") | |
13 | + | else { | |
14 | + | let e = valueOrErrorMessage(a.payment, "where is payment?") | |
15 | + | if ((0 >= e.amount)) | |
16 | + | then throw("amount must be positive") | |
17 | + | else { | |
18 | + | let f = ("sell_" + toBase58String(a.transactionId)) | |
19 | + | let g = { | |
20 | + | let h = e.assetId | |
21 | + | if ($isInstanceOf(h, "ByteVector")) | |
22 | + | then { | |
23 | + | let i = h | |
24 | + | toBase58String(i) | |
25 | + | } | |
26 | + | else "WAVES" | |
27 | + | } | |
28 | + | WriteSet([DataEntry((f + "_amount"), e.amount), DataEntry((f + "_amount_asset"), g), DataEntry((f + "_price"), c), DataEntry((f + "_price_asset"), b), DataEntry((f + "_owner"), toBase58String(a.caller.bytes)), DataEntry((f + "_spent"), 0)]) | |
29 | + | } | |
30 | + | } | |
31 | + | ||
32 | + | ||
33 | + | ||
34 | + | @Callable(a) | |
35 | + | func makeBuy (g,c,d) = if (if ((g != "WAVES")) | |
36 | + | then !(isDefined(assetInfo(fromBase58String(g)))) | |
37 | + | else false) | |
38 | + | then throw("There is no asset with specified id") | |
39 | + | else if ((0 >= c)) | |
40 | + | then throw("price must be positive") | |
41 | + | else { | |
42 | + | let e = valueOrErrorMessage(a.payment, "where is payment?") | |
43 | + | if ((0 >= e.amount)) | |
44 | + | then throw("amount must be positive") | |
45 | + | else { | |
46 | + | let f = ("buy_" + toBase58String(a.transactionId)) | |
47 | + | let b = { | |
48 | + | let h = e.assetId | |
49 | + | if ($isInstanceOf(h, "ByteVector")) | |
50 | + | then { | |
51 | + | let i = h | |
52 | + | toBase58String(i) | |
53 | + | } | |
54 | + | else "WAVES" | |
55 | + | } | |
56 | + | WriteSet([DataEntry((f + "_amount"), (e.amount / c)), DataEntry((f + "_amount_asset"), g), DataEntry((f + "_price"), c), DataEntry((f + "_price_asset"), b), DataEntry((f + "_owner"), toBase58String(a.caller.bytes)), DataEntry((f + "_spent"), 0)]) | |
57 | + | } | |
58 | + | } | |
59 | + | ||
60 | + | ||
61 | + | ||
62 | + | @Callable(a) | |
63 | + | func takeSell (j) = { | |
64 | + | let e = valueOrErrorMessage(a.payment, "where is payment?") | |
65 | + | if ((0 >= e.amount)) | |
66 | + | then throw("amount must be positive") | |
67 | + | else { | |
68 | + | let f = ("sell_" + j) | |
69 | + | let k = { | |
70 | + | let h = e.assetId | |
71 | + | if ($isInstanceOf(h, "ByteVector")) | |
72 | + | then { | |
73 | + | let i = h | |
74 | + | toBase58String(i) | |
75 | + | } | |
76 | + | else "WAVES" | |
77 | + | } | |
78 | + | let b = valueOrErrorMessage(getString(this, (f + "_price_asset")), "there is no order with specified id") | |
79 | + | if ((b != k)) | |
80 | + | then throw(("payment asset must be " + b)) | |
81 | + | else { | |
82 | + | let c = getIntegerValue(this, (f + "_price")) | |
83 | + | let l = getIntegerValue(this, (f + "_amount")) | |
84 | + | let m = (e.amount / c) | |
85 | + | let n = value(addressFromString(getStringValue(this, (f + "_owner")))) | |
86 | + | let g = getStringValue(this, (f + "_amount_asset")) | |
87 | + | let o = getIntegerValue(this, (f + "_spent")) | |
88 | + | if ((m > (l - o))) | |
89 | + | then throw("not enougth asset in order") | |
90 | + | else ScriptResult(WriteSet([DataEntry((f + "_spent"), (o + m))]), TransferSet([ScriptTransfer(a.caller, m, if ((g == "WAVES")) | |
91 | + | then unit | |
92 | + | else fromBase58String(g)), ScriptTransfer(n, e.amount, if ((b == "WAVES")) | |
93 | + | then unit | |
94 | + | else fromBase58String(b))])) | |
95 | + | } | |
96 | + | } | |
97 | + | } | |
98 | + | ||
99 | + |
github/deemru/w8io/169f3d6 20.68 ms ◑