tx · GLpUasPTE8zJVWy5GpmwZkDfkAjQpspNZWStQ61K11So 3MxN6Cszfki941gTcEwXc8ngmbWPTsHoJFq: -0.01400000 Waves 2019.06.22 21:19 [553606] smart account 3MxN6Cszfki941gTcEwXc8ngmbWPTsHoJFq > SELF 0.00000000 Waves
{ "type": 13, "id": "GLpUasPTE8zJVWy5GpmwZkDfkAjQpspNZWStQ61K11So", "fee": 1400000, "feeAssetId": null, "timestamp": 1561227575952, "version": 1, "sender": "3MxN6Cszfki941gTcEwXc8ngmbWPTsHoJFq", "senderPublicKey": "4fygXNNAjU52sT9N6uq4o9Ck8G75e94ukktN3pd4VxVo", "proofs": [ "3bcndQft8QAvncn8oVAq3ko43MwHVMNkZjSuunMun7DtJgj1dRcK6rrewfo81rVvkbLbhSkp1Kr6L9HpQipemnyw" ], "script": "base64:AAIDAAAAAAAAAAAAAAANAAAAAAROT05FAgAAAARub25lAQAAAA9nZXRLZXlJdGVtUHJpY2UAAAABAAAABGl0ZW0JAAEsAAAAAgUAAAAEaXRlbQIAAAAGX3ByaWNlAQAAAA5nZXROdW1iZXJCeUtleQAAAAEAAAADa2V5BAAAAANudW0EAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEAAAAAAAAAAAAFAAAAA251bQEAAAALZ2V0U3RyQnlLZXkAAAABAAAAA2tleQQAAAADc3RyBAAAAAckbWF0Y2gwCQAEHQAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAGU3RyaW5nBAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhBQAAAAROT05FBQAAAANzdHIBAAAAFWdldEtleVVzZXJJdGVtQ291bnRlcgAAAAIAAAAEdXNlcgAAAARpdGVtCQABLAAAAAIJAAEsAAAAAgkAASwAAAACBQAAAARpdGVtAgAAAAFfBQAAAAR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2V5QmFsYW5jZVN1cHBsaWVyAAAAAQUAAAAHc3VwcGFkZAAAAAAAAAAAAAUAAAADbmlsCQEAAAALVHJhbnNmZXJTZXQAAAABCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMJAQAAABxAZXh0clVzZXIoYWRkcmVzc0Zyb21TdHJpbmcpAAAAAQUAAAAHc3VwcGFkZAUAAAADYmFsBQAAAAR1bml0BQAAAANuaWwAAAAARyI28g==", "chainId": 84, "height": 553606, "spentComplexity": 0 } View: original | compacted Prev: HmBzj946MzeuYTqBQTjWtVqvSPJ1gvCdHhuwFRTqpsaS Next: HeRHzxxTGC5NoPqJLvFtMF9b7mDb9zjEuaZRaw3yGjU6 Diff:
Old | New | Differences | |
---|---|---|---|
96 | 96 | @Callable(x) | |
97 | 97 | func withdraw () = { | |
98 | 98 | let E = toBase58String(x.caller.bytes) | |
99 | - | let F = | |
100 | - | if (( | |
101 | - | then throw("Insufficient Balance") | |
99 | + | let F = d((E + "_balance")) | |
100 | + | if ((0 >= F)) | |
101 | + | then throw("Insufficient Balance xD") | |
102 | 102 | else ScriptResult(WriteSet([DataEntry(u(E), 0)]), TransferSet([ScriptTransfer(addressFromStringValue(E), F, unit)])) | |
103 | 103 | } | |
104 | 104 |
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) = (c + "_price") | |
7 | 7 | ||
8 | 8 | ||
9 | 9 | func d (e) = { | |
10 | 10 | let f = { | |
11 | 11 | let g = getInteger(this, e) | |
12 | 12 | if ($isInstanceOf(g, "Int")) | |
13 | 13 | then { | |
14 | 14 | let h = g | |
15 | 15 | h | |
16 | 16 | } | |
17 | 17 | else 0 | |
18 | 18 | } | |
19 | 19 | f | |
20 | 20 | } | |
21 | 21 | ||
22 | 22 | ||
23 | 23 | func i (e) = { | |
24 | 24 | let j = { | |
25 | 25 | let g = getString(this, e) | |
26 | 26 | if ($isInstanceOf(g, "String")) | |
27 | 27 | then { | |
28 | 28 | let h = g | |
29 | 29 | h | |
30 | 30 | } | |
31 | 31 | else a | |
32 | 32 | } | |
33 | 33 | j | |
34 | 34 | } | |
35 | 35 | ||
36 | 36 | ||
37 | 37 | func k (l,c) = (((c + "_") + l) + "_cnt") | |
38 | 38 | ||
39 | 39 | ||
40 | 40 | func m (c) = d(b(c)) | |
41 | 41 | ||
42 | 42 | ||
43 | 43 | func n (l,c) = d(k(l, c)) | |
44 | 44 | ||
45 | 45 | ||
46 | 46 | func o (p,q) = ("item_" + toBase58String(sha256(toBytes((p + q))))) | |
47 | 47 | ||
48 | 48 | ||
49 | 49 | func r (c) = (c + "_data") | |
50 | 50 | ||
51 | 51 | ||
52 | 52 | func s (c) = (c + "_owner") | |
53 | 53 | ||
54 | 54 | ||
55 | 55 | func t (c) = i(s(c)) | |
56 | 56 | ||
57 | 57 | ||
58 | 58 | func u (v) = (v + "_balance") | |
59 | 59 | ||
60 | 60 | ||
61 | 61 | func w (v) = d(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 c = o(A, q) | |
68 | 68 | if ((0 >= y)) | |
69 | 69 | then throw("purchase amount cannot be less than 0 or 0") | |
70 | 70 | else if ((t(c) != a)) | |
71 | 71 | then throw("an item already exists") | |
72 | 72 | else WriteSet([DataEntry(s(c), A), DataEntry(b(c), y), DataEntry(r(c), z)]) | |
73 | 73 | } | |
74 | 74 | ||
75 | 75 | ||
76 | 76 | ||
77 | 77 | @Callable(x) | |
78 | 78 | func purchase (c) = { | |
79 | 79 | let B = extract(x.payment) | |
80 | 80 | if (isDefined(B.assetId)) | |
81 | 81 | then throw("Can use Waves only at the moment") | |
82 | 82 | else { | |
83 | 83 | let C = toBase58String(x.caller.bytes) | |
84 | 84 | let y = m(c) | |
85 | 85 | let D = t(c) | |
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 WriteSet([DataEntry(k(C, c), (n(C, c) + 1)), DataEntry(u(D), (w(D) + B.amount))]) | |
91 | 91 | } | |
92 | 92 | } | |
93 | 93 | ||
94 | 94 | ||
95 | 95 | ||
96 | 96 | @Callable(x) | |
97 | 97 | func withdraw () = { | |
98 | 98 | let E = toBase58String(x.caller.bytes) | |
99 | - | let F = | |
100 | - | if (( | |
101 | - | then throw("Insufficient Balance") | |
99 | + | let F = d((E + "_balance")) | |
100 | + | if ((0 >= F)) | |
101 | + | then throw("Insufficient Balance xD") | |
102 | 102 | else ScriptResult(WriteSet([DataEntry(u(E), 0)]), TransferSet([ScriptTransfer(addressFromStringValue(E), F, unit)])) | |
103 | 103 | } | |
104 | 104 | ||
105 | 105 |
github/deemru/w8io/169f3d6 44.31 ms ◑