tx · A5F8AjD2JwLWavKVJC9CWaQmUddJMDMJwLDah7kxyRvH 3NBXRmoaNi1RVTa9JvuXhCeU1kTPGXdbCP7: -0.01400000 Waves 2019.07.03 22:45 [569682] smart account 3NBXRmoaNi1RVTa9JvuXhCeU1kTPGXdbCP7 > SELF 0.00000000 Waves
{ "type": 13, "id": "A5F8AjD2JwLWavKVJC9CWaQmUddJMDMJwLDah7kxyRvH", "fee": 1400000, "feeAssetId": null, "timestamp": 1562183110550, "version": 1, "sender": "3NBXRmoaNi1RVTa9JvuXhCeU1kTPGXdbCP7", "senderPublicKey": "97dwMYPb6V2WyfYZoeFDjc6tbk4b5XRPKkEBgPLC9v4K", "proofs": [ "34EZ9qKKVavhkzcVYrCjrh44cxccBedF7wd4ADpVUibpAC1nba5xfxGegaRtcR1YwU9oh9EXhbqCzy5FuXVDKTB6" ], "script": "base64:AAIDAAAAAAAAAAAAAAANAAAAAAROT05FAgAAAARub25lAQAAAA5nZXROdW1iZXJCeUtleQAAAAEAAAADa2V5BAAAAANudW0EAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEAAAAAAAAAAAAFAAAAA251bQEAAAALZ2V0U3RyQnlLZXkAAAABAAAAA2tleQQAAAADc3RyBAAAAAckbWF0Y2gwCQAEHQAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAGU3RyaW5nBAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhBQAAAAROT05FBQAAAANzdHIBAAAAD2dldEtleUl0ZW1QcmljZQAAAAEAAAAEaXRlbQkAASwAAAACBQAAAARpdGVtAgAAAAZfcHJpY2UBAAAAEWdldFZhbHVlSXRlbVByaWNlAAAAAQAAAARpdGVtCQEAAAAOZ2V0TnVtYmVyQnlLZXkAAAABCQEAAAAPZ2V0S2V5SXRlbV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cHBsaWVyQWRkcmVzcwkBAAAAFGdldFZhbHVlSXRlbVN1cHBsaWVyAAAAAQUAAAAEaXRlbQMJAABmAAAAAgUAAAAFcHJpY2UIBQAAAANwbXQAAAAGYW1vdW50CQAAAgAAAAECAAAALnB1cmNoYXNlIGFtb3VudCBjYW5ub3QgYmUgbGVzcyB0aGFuIGl0ZW0gcHJpY2UDCQAAZgAAAAIIBQAAAANwbXQAAAAGYW1vdW50BQAAAAVwcmljZQkAAAIAAAABAgAAADBwdXJjaGFzZSBhbW91bnQgY2Fubm90IGJlIGhpZ2hlciB0aGFuIGl0ZW0gcHJpY2UDCQAAAAAAAAIFAAAAD3N1cHBsaWVyQWRkcmVzcwUAAAAETk9ORQkAAAIAAAABAgAAABdzdXBwbGllciBkb2VzIG5vdCBleGlzdAkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkBAAAAFWdldEtleVVzZXJJdGVtQ291bnRlcgAAAAIFAAAAC3VzZXJBZGRyZXNzBQAAAARpdGVtCQAAZAAAAAIJAQAAABdnZXRWYWx1ZVVzZXJJdGVtQ291bnRlcgAAAAIFAAAAC3VzZXJBZGRyZXNzBQAAAARpdGVtAAAAAAAAAAABCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQEAAAAVZ2V0S2V5QmFsYW5jZVN1cHBsaWVyAAAAAQUAAAAPc3VwcGxpZXJBZGRyZXNzCQAAZAAAAAIJAQAAABdnZXRWYWx1ZUJhbGFuY2VTdXBwbGllcgAAAAEFAAAAD3N1cHBsaWVyQWRkcmVzcwgFAAAAA3BtdAAAAAZhbW91bnQFAAAAA25pbAAAAACKr/sG", "chainId": 84, "height": 569682, "spentComplexity": 0 } View: original | compacted Prev: A4RueqTy6mJYPsrojuX94ApsxCKvCgybCa97iPgLZ79R Next: t7RFnzkZdm1ncPm71hZ2Rdd3gBfqCSW5q7RKZjpofZu Full:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let a = "none" | |
5 | 5 | ||
6 | 6 | func b (c) = { | |
7 | 7 | let d = { | |
8 | 8 | let e = getInteger(this, c) | |
9 | 9 | if ($isInstanceOf(e, "Int")) | |
10 | 10 | then { | |
11 | 11 | let f = e | |
12 | 12 | f | |
13 | 13 | } | |
14 | 14 | else 0 | |
15 | 15 | } | |
16 | 16 | d | |
17 | 17 | } | |
18 | 18 | ||
19 | 19 | ||
20 | 20 | func g (c) = { | |
21 | 21 | let h = { | |
22 | 22 | let e = getString(this, c) | |
23 | 23 | if ($isInstanceOf(e, "String")) | |
24 | 24 | then { | |
25 | 25 | let f = e | |
26 | 26 | f | |
27 | 27 | } | |
28 | 28 | else a | |
29 | 29 | } | |
30 | 30 | h | |
31 | 31 | } | |
32 | 32 | ||
33 | 33 | ||
34 | 34 | func i (j) = (j + "_price") | |
35 | 35 | ||
36 | 36 | ||
37 | 37 | func k (j) = b(i(j)) | |
38 | 38 | ||
39 | 39 | ||
40 | 40 | func l (m,j) = (((j + "_") + m) + "_cnt") | |
41 | 41 | ||
42 | 42 | ||
43 | 43 | func n (m,j) = b(l(m, j)) | |
44 | 44 | ||
45 | 45 | ||
46 | 46 | func o (p,q) = ("item_" + toBase58String(sha256(toBytes((p + q))))) | |
47 | 47 | ||
48 | 48 | ||
49 | 49 | func r (j) = (j + "_data") | |
50 | 50 | ||
51 | 51 | ||
52 | 52 | func s (j) = (j + "_owner") | |
53 | 53 | ||
54 | 54 | ||
55 | 55 | func t (j) = g(s(j)) | |
56 | 56 | ||
57 | 57 | ||
58 | 58 | func u (v) = (v + "_balance") | |
59 | 59 | ||
60 | 60 | ||
61 | 61 | func w (v) = b(u(v)) | |
62 | 62 | ||
63 | 63 | ||
64 | 64 | @Callable(x) | |
65 | 65 | func addItem (q,y,z) = { | |
66 | 66 | let A = toBase58String(x.caller.bytes) | |
67 | 67 | let j = o(A, q) | |
68 | 68 | if ((0 >= y)) | |
69 | 69 | then throw("purchase amount cannot be less than item price") | |
70 | 70 | else if ((t(j) != a)) | |
71 | 71 | then throw("an item is already exist") | |
72 | 72 | else WriteSet([DataEntry(s(j), A), DataEntry(i(j), y), DataEntry(r(j), z)]) | |
73 | 73 | } | |
74 | 74 | ||
75 | 75 | ||
76 | 76 | ||
77 | 77 | @Callable(x) | |
78 | 78 | func purchase (j) = { | |
79 | 79 | let B = extract(x.payment) | |
80 | 80 | if (isDefined(B.assetId)) | |
81 | 81 | then throw("WAVES tokens only at the moment") | |
82 | 82 | else { | |
83 | 83 | let C = toBase58String(x.caller.bytes) | |
84 | 84 | let y = k(j) | |
85 | 85 | let A = t(j) | |
86 | 86 | if ((y > B.amount)) | |
87 | 87 | then throw("purchase amount cannot be less than item price") | |
88 | 88 | else if ((B.amount > y)) | |
89 | 89 | then throw("purchase amount cannot be higher than item price") | |
90 | 90 | else if ((A == a)) | |
91 | 91 | then throw("supplier does not exist") | |
92 | 92 | else WriteSet([DataEntry(l(C, j), (n(C, j) + 1)), DataEntry(u(A), (w(A) + B.amount))]) | |
93 | 93 | } | |
94 | 94 | } | |
95 | 95 | ||
96 | 96 |
github/deemru/w8io/026f985 29.55 ms ◑