tx · 5pay2oR4YMAQGrAXBqFoZovNh37hmBeK7cLp4mNpyV8L 3N7mmvRnz5E1kLZiYkDYYce7qWuLQMYFzXT: -0.01400000 Waves 2019.12.13 22:26 [807508] smart account 3N7mmvRnz5E1kLZiYkDYYce7qWuLQMYFzXT > SELF 0.00000000 Waves
{ "type": 13, "id": "5pay2oR4YMAQGrAXBqFoZovNh37hmBeK7cLp4mNpyV8L", "fee": 1400000, "feeAssetId": null, "timestamp": 1576265196365, "version": 1, "sender": "3N7mmvRnz5E1kLZiYkDYYce7qWuLQMYFzXT", "senderPublicKey": "571z2nNJThBFYDwuwuveXdTYBjYVtwDd5wSA45DqH1bw", "proofs": [ "66uA5qtqTGPorxkFuYLSPAnBsepQbAuHDeniaUjhT5o8yCmbWyaraNxm3csaJBUnXEV2rjrCmwmmrFcSakSEPf1E" ], "script": "base64:AAIDAAAAAAAAAA4IARIFCgMIAQgSAwoBCAAAAA0AAAAABE5PTkUCAAAABG5vbmUBAAAADmdldE51bWJlckJ5S2V5AAAAAQAAAANrZXkEAAAAA251bQQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQAAAAAAAAAAAAUAAAADbnVtAQAAAAtnZXRTdHJCeUtleQAAAAEAAAADa2V5BAAAAANzdHIEAAAAByRtYXRjaDAJAAQdAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAAZTdHJpbmcEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEFAAAABE5PTkUFAAAAA3N0cgEAAAAPZ2V0S2V5SXRlbVByaWNlAAAAAQAAAARpdGVtCQABLAAAAAIFAAAABGl0ZW0CAAAABl9wcmljZQEAAAARZ2V0VmFsdWVJdGVtUHJpY2UAAAABAAAABGl0ZW0JAQAAAA5nZXROdW1iZXJCeUtleQAAAAEJAQAAAA9n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llckFkZHJlc3MJAQAAABRnZXRWYWx1ZUl0ZW1TdXBwbGllcgAAAAEFAAAABGl0ZW0DCQAAZgAAAAIFAAAABXByaWNlCAUAAAADcG10AAAABmFtb3VudAkAAAIAAAABAgAAAAVlcnJvcgMJAABmAAAAAggFAAAAA3BtdAAAAAZhbW91bnQFAAAABXByaWNlCQAAAgAAAAECAAAABWVycm9yAwkAAAAAAAACBQAAAA9zdXBwbGllckFkZHJlc3MFAAAABE5PTkUJAAACAAAAAQIAAAAFZXJyb3IJAQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAQAAABVnZXRLZXlVc2VySXRlbUNvdW50ZXIAAAACBQAAAAt1c2VyQWRkcmVzcwUAAAAEaXRlbQkAAGQAAAACCQEAAAAXZ2V0VmFsdWVVc2VySXRlbUNvdW50ZXIAAAACBQAAAAt1c2VyQWRkcmVzcwUAAAAEaXRlbQAAAAAAAAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkBAAAAFWdldEtleUJhbGFuY2VTdXBwbGllcgAAAAEFAAAAD3N1cHBsaWVyQWRkcmVzcwkAAGQAAAACCQEAAAAXZ2V0VmFsdWVCYWxhbmNlU3VwcGxpZXIAAAABBQAAAA9zdXBwbGllckFkZHJlc3MIBQAAAANwbXQAAAAGYW1vdW50BQAAAANuaWwAAAAAPg3eqw==", "chainId": 84, "height": 807508, "spentComplexity": 0 } View: original | compacted Prev: 7nVctESHt4FASWFy4A6tBLmMGCsijzobGFdydnLYaLiP Next: xRkXADQGS5uhfu4qFWaSYkuV232HDN4wqiPqo12odB6 Diff:
Old | New | Differences | |
---|---|---|---|
73 | 73 | } | |
74 | 74 | ||
75 | 75 | ||
76 | + | ||
77 | + | @Callable(x) | |
78 | + | func purchase (j) = { | |
79 | + | let B = extract(x.payment) | |
80 | + | if (isDefined(B.assetId)) | |
81 | + | then throw("Only WAVES token at that moment") | |
82 | + | else { | |
83 | + | let C = toBase58String(x.caller.bytes) | |
84 | + | let y = k(j) | |
85 | + | let A = t(j) | |
86 | + | if ((y > B.amount)) | |
87 | + | then throw("error") | |
88 | + | else if ((B.amount > y)) | |
89 | + | then throw("error") | |
90 | + | else if ((A == a)) | |
91 | + | then throw("error") | |
92 | + | else WriteSet([DataEntry(l(C, j), (n(C, j) + 1)), DataEntry(u(A), (w(A) + B.amount))]) | |
93 | + | } | |
94 | + | } | |
95 | + | ||
96 | + |
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("asdad") | |
72 | 72 | else WriteSet([DataEntry(s(j), A), DataEntry(i(j), y), DataEntry(r(j), z)]) | |
73 | 73 | } | |
74 | 74 | ||
75 | 75 | ||
76 | + | ||
77 | + | @Callable(x) | |
78 | + | func purchase (j) = { | |
79 | + | let B = extract(x.payment) | |
80 | + | if (isDefined(B.assetId)) | |
81 | + | then throw("Only WAVES token at that moment") | |
82 | + | else { | |
83 | + | let C = toBase58String(x.caller.bytes) | |
84 | + | let y = k(j) | |
85 | + | let A = t(j) | |
86 | + | if ((y > B.amount)) | |
87 | + | then throw("error") | |
88 | + | else if ((B.amount > y)) | |
89 | + | then throw("error") | |
90 | + | else if ((A == a)) | |
91 | + | then throw("error") | |
92 | + | else WriteSet([DataEntry(l(C, j), (n(C, j) + 1)), DataEntry(u(A), (w(A) + B.amount))]) | |
93 | + | } | |
94 | + | } | |
95 | + | ||
96 | + |
github/deemru/w8io/026f985 33.96 ms ◑