tx · 5Aoq76tGWqzsEqxcGnjCgH7a69CvCm7jyV6jF6KXGYGa 3Mzz3QCpMamT89CaFaovqXpnCdiUaKtLZ4D: -0.01400000 Waves 2019.06.22 17:13 [553358] smart account 3Mzz3QCpMamT89CaFaovqXpnCdiUaKtLZ4D > SELF 0.00000000 Waves
{ "type": 13, "id": "5Aoq76tGWqzsEqxcGnjCgH7a69CvCm7jyV6jF6KXGYGa", "fee": 1400000, "feeAssetId": null, "timestamp": 1561212871599, "version": 1, "sender": "3Mzz3QCpMamT89CaFaovqXpnCdiUaKtLZ4D", "senderPublicKey": "BJRaSW2saRv7CcFs3mSYpaVFQSFpZq9rGKnCcRKuKgWv", "proofs": [ "4M3W1NAAB2FZS8Pyr7L8T2Hrx7mppxtNCRjpzgoUPJvD6C2bRPVABLqBt4Xf4wfZSjtnmvJkrFyyMZPCvaneBxY2" ], "script": "base64:AAIDAAAAAAAAAAAAAAANAAAAAAROT05FAgAAAARub25lAQAAAApnZXRLZXlJdGVtAAAAAgAAAAhzdXBwbGllcgAAAAV0aXRsZQkAASwAAAACAgAAAAVpdGVtXwkAAlgAAAABCQAB9wAAAAEJAAGbAAAAAQkAASwAAAACBQAAAAhzdXBwbGllcgUAAAAFdGl0bGUBAAAAEmdldEtleUl0ZW1TdXBwbGllcgAAAAEAAAAEaXRlbQkAASwAAAACBQAAAARpdGVtAgAAAAZfb3duZXIBAAAAFWdldEtleUJhbGFuY2VTdXBwbGllcgAAAAEAAAAEaXRlbQkAASwAAAACBQAAAARpdGVtAgAAAAhfYmFsYW5jZQEAAAAPZ2V0S2V5SXRlbVByaWNlAAAAAQAAAARpdGVtCQABLAAAAAIFAAAABGl0ZW0CAAAABl9wcmljZQEAAAAOZ2V0S2V5SXRlbURhdGEAAAABAAAABGl0ZW0JAAEsAAAAAgUAAAAEaXRlbQIAAAAFX2RhdGEBAAAAFWdldEtleVVzZXJJdGVtQ291bnRlcgAAAAIAAAAEdXNlcgAAAARpdGVtCQABLAAAAAIJAAEs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ZQkBAAAAF2dldFZhbHVlQmFsYW5jZVN1cHBsaWVyAAAAAQUAAAAPc3VwcGxpZXJBZGRyZXNzAwkAAGcAAAACAAAAAAAAAAAABQAAAAdiYWxhbmNlCQAAAgAAAAECAAAAFGluc3VmZmljaWVudCBiYWxhbmNlCQEAAAAMU2NyaXB0UmVzdWx0AAAAAgkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkBAAAAFWdldEtleUJhbGFuY2VTdXBwbGllcgAAAAEFAAAAD3N1cHBsaWVyQWRkcmVzcwAAAAAAAAAAAAUAAAADbmlsCQEAAAALVHJhbnNmZXJTZXQAAAABCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMJAQAAABxAZXh0clVzZXIoYWRkcmVzc0Zyb21TdHJpbmcpAAAAAQUAAAAPc3VwcGxpZXJBZGRyZXNzBQAAAAdiYWxhbmNlBQAAAAR1bml0BQAAAANuaWwAAAAAwSzENA==", "chainId": 84, "height": 553358, "spentComplexity": 0 } View: original | compacted Prev: EKC61cF24UvhESRWABKAvwmG1BiZ1EMjb7zDrUh39kdc Next: C61ebeiM7iWGYJUJUebHmLWEMcbNizcbDkpqYELujFpe Diff:
Old | New | Differences | |
---|---|---|---|
120 | 120 | } | |
121 | 121 | ||
122 | 122 | ||
123 | + | ||
124 | + | @Callable(x) | |
125 | + | func withdraw () = { | |
126 | + | let D = toBase58String(x.caller.bytes) | |
127 | + | let F = v(D) | |
128 | + | if ((0 >= F)) | |
129 | + | then throw("insufficient balance") | |
130 | + | else ScriptResult(WriteSet([DataEntry(g(D), 0)]), TransferSet([ScriptTransfer(addressFromStringValue(D), F, unit)])) | |
131 | + | } | |
132 | + | ||
133 | + |
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,d) = ("item_" + toBase58String(sha256(toBytes((c + d))))) | |
7 | 7 | ||
8 | 8 | ||
9 | 9 | func e (f) = (f + "_owner") | |
10 | 10 | ||
11 | 11 | ||
12 | 12 | func g (f) = (f + "_balance") | |
13 | 13 | ||
14 | 14 | ||
15 | 15 | func h (f) = (f + "_price") | |
16 | 16 | ||
17 | 17 | ||
18 | 18 | func i (f) = (f + "_data") | |
19 | 19 | ||
20 | 20 | ||
21 | 21 | func j (k,f) = (((f + "_") + k) + "_cnt") | |
22 | 22 | ||
23 | 23 | ||
24 | 24 | func l (m) = { | |
25 | 25 | let n = { | |
26 | 26 | let o = getString(this, m) | |
27 | 27 | if ($isInstanceOf(o, "String")) | |
28 | 28 | then { | |
29 | 29 | let p = o | |
30 | 30 | p | |
31 | 31 | } | |
32 | 32 | else a | |
33 | 33 | } | |
34 | 34 | n | |
35 | 35 | } | |
36 | 36 | ||
37 | 37 | ||
38 | 38 | func q (m) = { | |
39 | 39 | let r = { | |
40 | 40 | let o = getInteger(this, m) | |
41 | 41 | if ($isInstanceOf(o, "Int")) | |
42 | 42 | then { | |
43 | 43 | let p = o | |
44 | 44 | p | |
45 | 45 | } | |
46 | 46 | else 0 | |
47 | 47 | } | |
48 | 48 | r | |
49 | 49 | } | |
50 | 50 | ||
51 | 51 | ||
52 | 52 | func s (f) = l(e(f)) | |
53 | 53 | ||
54 | 54 | ||
55 | 55 | func t (f) = q(h(f)) | |
56 | 56 | ||
57 | 57 | ||
58 | 58 | func u (k,f) = q(j(k, f)) | |
59 | 59 | ||
60 | 60 | ||
61 | 61 | func v (w) = q(g(w)) | |
62 | 62 | ||
63 | 63 | ||
64 | 64 | @Callable(x) | |
65 | 65 | func purchaseOld (y) = { | |
66 | 66 | let z = extract(x.payment) | |
67 | 67 | if (isDefined(z.assetId)) | |
68 | 68 | then throw("can use WAVES only at the moment") | |
69 | 69 | else { | |
70 | 70 | let A = toBase58String(x.caller.bytes) | |
71 | 71 | let B = { | |
72 | 72 | let o = getInteger(this, (("item_" + y) + "_coupon_price")) | |
73 | 73 | if ($isInstanceOf(o, "Int")) | |
74 | 74 | then { | |
75 | 75 | let p = o | |
76 | 76 | p | |
77 | 77 | } | |
78 | 78 | else 0 | |
79 | 79 | } | |
80 | 80 | if ((B > z.amount)) | |
81 | 81 | then throw("purschase amount cannot be less than item price") | |
82 | 82 | else if ((z.amount > B)) | |
83 | 83 | then throw("purchase amount cannot be higher than item price") | |
84 | 84 | else WriteSet([DataEntry(((("status:purchase_item_" + y) + "_customer_") + A), "confirmed"), DataEntry(((("price:purchase_item_" + y) + "_customer_") + A), B)]) | |
85 | 85 | } | |
86 | 86 | } | |
87 | 87 | ||
88 | 88 | ||
89 | 89 | ||
90 | 90 | @Callable(x) | |
91 | 91 | func addItem (d,B,C) = { | |
92 | 92 | let D = toBase58String(x.caller.bytes) | |
93 | 93 | let f = b(D, d) | |
94 | 94 | if ((0 >= B)) | |
95 | 95 | then throw("purchase amount cannot be less than item price") | |
96 | 96 | else if ((s(f) != a)) | |
97 | 97 | then throw("an items is already exist") | |
98 | 98 | else WriteSet([DataEntry(e(f), D), DataEntry(h(f), B), DataEntry(i(f), C)]) | |
99 | 99 | } | |
100 | 100 | ||
101 | 101 | ||
102 | 102 | ||
103 | 103 | @Callable(x) | |
104 | 104 | func purchase (f) = { | |
105 | 105 | let z = extract(x.payment) | |
106 | 106 | if (isDefined(z.assetId)) | |
107 | 107 | then throw("WAVES tokens only at the moment") | |
108 | 108 | else { | |
109 | 109 | let E = toBase58String(x.caller.bytes) | |
110 | 110 | let B = t(f) | |
111 | 111 | let D = s(f) | |
112 | 112 | if ((B > z.amount)) | |
113 | 113 | then throw("purchase amount cannot be less than item price") | |
114 | 114 | else if ((z.amount > B)) | |
115 | 115 | then throw("purchase amount cannot be higher than item price") | |
116 | 116 | else if ((D == a)) | |
117 | 117 | then throw("supplier does not exist") | |
118 | 118 | else WriteSet([DataEntry(j(E, f), (u(E, f) + 1)), DataEntry(g(D), (v(D) + z.amount))]) | |
119 | 119 | } | |
120 | 120 | } | |
121 | 121 | ||
122 | 122 | ||
123 | + | ||
124 | + | @Callable(x) | |
125 | + | func withdraw () = { | |
126 | + | let D = toBase58String(x.caller.bytes) | |
127 | + | let F = v(D) | |
128 | + | if ((0 >= F)) | |
129 | + | then throw("insufficient balance") | |
130 | + | else ScriptResult(WriteSet([DataEntry(g(D), 0)]), TransferSet([ScriptTransfer(addressFromStringValue(D), F, unit)])) | |
131 | + | } | |
132 | + | ||
133 | + |
github/deemru/w8io/026f985 32.58 ms ◑