tx · 3HGTZWJH9WeaqStV5m2Aezjv6wBqqNX6486mUJD8yo1y 3Ms6Ht5bdVJa6sQnRBUg9nfNpEp7obSad8o: -0.05000000 Waves 2019.08.06 15:45 [619065] smart account 3Ms6Ht5bdVJa6sQnRBUg9nfNpEp7obSad8o > SELF 0.00000000 Waves
{ "type": 13, "id": "3HGTZWJH9WeaqStV5m2Aezjv6wBqqNX6486mUJD8yo1y", "fee": 5000000, "feeAssetId": null, "timestamp": 1565095552781, "version": 1, "sender": "3Ms6Ht5bdVJa6sQnRBUg9nfNpEp7obSad8o", "senderPublicKey": "Ebb2ffqL8cMnNmXPNvHLy53xrK7t5WaSFhneCPBSoxop", "proofs": [ "91kYCaYybirDt47Z8o2VNHZKo8yHDu75MqutvUvpcF14T3q4y2VfLy86hTTQvYd67K2yVyKGZQbYcEKrBKL8mXC" ], "script": "base64:AAIDAAAAAAAAAAAAAAANAAAAAAROT05FAgAAAARub25lAQAAAA5nZXROdW1iZXJCeUtleQAAAAEAAAADa2V5BAAAAANudW0EAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWkFAAAAByRtYXRjaDAFAAAAAWkAAAAAAAAAAAAFAAAAA251bQEAAAALZ2V0U3RyQnlLZXkAAAABAAAAA2tleQQAAAADc3RyBAAAAAckbWF0Y2gwCQAEHQAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAGU3RyaW5nBAAAAAFzBQAAAAckbWF0Y2gwBQAAAAFzBQAAAAROT05FBQAAAANzdHIBAAAAD2dldEtleUl0ZW1QcmljZQAAAAEAAAAEaXRlbQkAASwAAAACBQAAAARpdGVtAgAAAAZfcHJpY2UBAAAAEWdldFZhbHVlSXRlbVByaWNlAAAAAQAAAARpdGVtCQEAAAAOZ2V0TnVtYmVyQnlLZXkAAAABCQEAAAAPZ2V0S2V5SXRlbVByaW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2NyaXB0UmVzdWx0AAAAAgkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkBAAAAFWdldEtleUJhbGFuY2VTdXBwbGllcgAAAAEFAAAAD3N1cHBsaWVyQWRkcmVzcwAAAAAAAAAAAAUAAAADbmlsCQEAAAALVHJhbnNmZXJTZXQAAAABCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMJAQAAABxAZXh0clVzZXIoYWRkcmVzc0Zyb21TdHJpbmcpAAAAAQUAAAAPc3VwcGxpZXJBZGRyZXNzBQAAAAdiYWxhbmNlBQAAAAR1bml0BQAAAANuaWwAAAAAG40Lug==", "chainId": 84, "height": 619065, "spentComplexity": 0 } View: original | compacted Prev: 2xGPBNsfLpWVTGPcd9QBJEUf8A5wb7Xy4cP3DgEimFtx Next: 6QUFhzgKooJSEY9d2r1utM4r2pebFEH3aMDvRZdLTUS2 Diff:
Old | New | Differences | |
---|---|---|---|
92 | 92 | } | |
93 | 93 | ||
94 | 94 | ||
95 | + | ||
96 | + | @Callable(y) | |
97 | + | func withdraw () = { | |
98 | + | let B = toBase58String(y.caller.bytes) | |
99 | + | let E = x(B) | |
100 | + | if ((0 >= E)) | |
101 | + | then throw("Ballance is zero") | |
102 | + | else ScriptResult(WriteSet([DataEntry(v(B), 0)]), TransferSet([ScriptTransfer(addressFromStringValue(B), E, unit)])) | |
103 | + | } | |
104 | + | ||
105 | + |
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 i = e | |
26 | 26 | i | |
27 | 27 | } | |
28 | 28 | else a | |
29 | 29 | } | |
30 | 30 | h | |
31 | 31 | } | |
32 | 32 | ||
33 | 33 | ||
34 | 34 | func j (k) = (k + "_price") | |
35 | 35 | ||
36 | 36 | ||
37 | 37 | func l (k) = b(j(k)) | |
38 | 38 | ||
39 | 39 | ||
40 | 40 | func m (n,k) = (((k + "_") + n) + "_cnt") | |
41 | 41 | ||
42 | 42 | ||
43 | 43 | func o (n,k) = b(m(n, k)) | |
44 | 44 | ||
45 | 45 | ||
46 | 46 | func p (q,r) = ("ietm_" + toBase58String(sha256(toBytes((q + r))))) | |
47 | 47 | ||
48 | 48 | ||
49 | 49 | func s (k) = (k + "_data") | |
50 | 50 | ||
51 | 51 | ||
52 | 52 | func t (k) = (k + "_owner") | |
53 | 53 | ||
54 | 54 | ||
55 | 55 | func u (k) = g(t(k)) | |
56 | 56 | ||
57 | 57 | ||
58 | 58 | func v (w) = (w + "_balance") | |
59 | 59 | ||
60 | 60 | ||
61 | 61 | func x (w) = b(v(w)) | |
62 | 62 | ||
63 | 63 | ||
64 | 64 | @Callable(y) | |
65 | 65 | func addItem (r,z,A) = { | |
66 | 66 | let B = toBase58String(y.caller.bytes) | |
67 | 67 | let k = p(B, r) | |
68 | 68 | if ((0 >= z)) | |
69 | 69 | then throw("Please add valid price") | |
70 | 70 | else if ((u(k) != a)) | |
71 | 71 | then throw((k + " - item already exists")) | |
72 | 72 | else WriteSet([DataEntry(t(k), B), DataEntry(j(k), z), DataEntry(s(k), A)]) | |
73 | 73 | } | |
74 | 74 | ||
75 | 75 | ||
76 | 76 | ||
77 | 77 | @Callable(y) | |
78 | 78 | func purchase (k) = { | |
79 | 79 | let C = extract(y.payment) | |
80 | 80 | if (isDefined(C.assetId)) | |
81 | 81 | then throw("Only payments in WAVES are avalible") | |
82 | 82 | else { | |
83 | 83 | let D = toBase58String(y.caller.bytes) | |
84 | 84 | let z = l(k) | |
85 | 85 | let B = u(k) | |
86 | 86 | if ((z > C.amount)) | |
87 | 87 | then throw("Please send exact coupon price") | |
88 | 88 | else if ((C.amount > z)) | |
89 | 89 | then throw("Please send exact coupon price") | |
90 | 90 | else WriteSet([DataEntry(m(D, k), (o(D, k) + 1)), DataEntry(v(B), (x(B) + C.amount))]) | |
91 | 91 | } | |
92 | 92 | } | |
93 | 93 | ||
94 | 94 | ||
95 | + | ||
96 | + | @Callable(y) | |
97 | + | func withdraw () = { | |
98 | + | let B = toBase58String(y.caller.bytes) | |
99 | + | let E = x(B) | |
100 | + | if ((0 >= E)) | |
101 | + | then throw("Ballance is zero") | |
102 | + | else ScriptResult(WriteSet([DataEntry(v(B), 0)]), TransferSet([ScriptTransfer(addressFromStringValue(B), E, unit)])) | |
103 | + | } | |
104 | + | ||
105 | + |
github/deemru/w8io/169f3d6 31.33 ms ◑