tx · 5Y39PyhQ8PRGmTHduAmx5QmYLyX8yZZJVzgSzEJChgzu 3N9nVNxRXkYG1LxBamitnLpZzXcjGDZ2Q6z: -0.01400000 Waves 2019.10.18 18:33 [725626] smart account 3N9nVNxRXkYG1LxBamitnLpZzXcjGDZ2Q6z > SELF 0.00000000 Waves
{ "type": 13, "id": "5Y39PyhQ8PRGmTHduAmx5QmYLyX8yZZJVzgSzEJChgzu", "fee": 1400000, "feeAssetId": null, "timestamp": 1571412900231, "version": 1, "sender": "3N9nVNxRXkYG1LxBamitnLpZzXcjGDZ2Q6z", "senderPublicKey": "EEGsMXJbL3i6pER7gfBpcw87Km3h2gz6qiqhqPXbdob1", "proofs": [ "3eHWViP5C8ZacESHb14ndDVY22XnddM3YYfLGnAVnuqWRsA7v7hJVpqAc2KGRXJoWB13hZ5hjSuUYTD6Xfut1yeW" ], "script": "base64:AAIDAAAAAAAAABIIARIAEgUKAwgBCBIAEgMKAQEAAAANAAAAAAVvd25lcgEAAAAgxI5sOc85F96AyMEOQS+ZrrcXbjWOtavgO5Vy9VGjFCwBAAAADmdldE51bWJlckJ5S2V5AAAAAQAAAANrZXkEAAAABm51bWJlcgQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQAAAAAAAAAAAAUAAAAGbnVtYmVyAQAAAA5nZXRTdHJpbmdCeUtleQAAAAEAAAADa2V5BAAAAAZzdHJpbmcEAAAAByRtYXRjaDAJAAQdAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAAZTdHJpbmcEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWECAAAABG5vbmUFAAAABnN0cmluZwEAAAAPZ2V0SXRlbUtleVByaWNlAAAAAQAAAARpdGVtCQABLAAAAAIFAAAABGl0ZW0CAAAABl9wcmljZQEAAAARZ2V0Vm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VzdWx0AAAAAgkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgUAAAAKY3VycmVudEtleQUAAAAJbmV3QW1vdW50BQAAAANuaWwJAQAAAAtUcmFuc2ZlclNldAAAAAEJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwgFAAAAAWkAAAAGY2FsbGVyBQAAAAZhbW91bnQFAAAABHVuaXQFAAAAA25pbAAAAAEAAAACdHgBAAAABnZlcmlmeQAAAAAEAAAAByRtYXRjaDAFAAAAAnR4AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAABRTZXRTY3JpcHRUcmFuc2FjdGlvbgQAAAABYQUAAAAHJG1hdGNoMAkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAFAAAABW93bmVyAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAA9EYXRhVHJhbnNhY3Rpb24EAAAAAWIFAAAAByRtYXRjaDAGBzcVMZY=", "chainId": 84, "height": 725626, "spentComplexity": 0 } View: original | compacted Prev: BEBVB9dADX4fvRRDye9yrfxdVNzT9FWzNwqPpWaYJd3q Next: none Diff:
Old | New | Differences | |
---|---|---|---|
107 | 107 | ||
108 | 108 | ||
109 | 109 | @Callable(x) | |
110 | - | func | |
110 | + | func purchase () = { | |
111 | 111 | let y = extract(x.payment) | |
112 | 112 | if (isDefined(y.assetId)) | |
113 | 113 | then throw("you can use WAVES only at the moment") | |
123 | 123 | else 0 | |
124 | 124 | } | |
125 | 125 | if ((D > y.amount)) | |
126 | - | then throw(" | |
126 | + | then throw("purchase amount cannot be less that item price") | |
127 | 127 | else if ((y.amount > D)) | |
128 | - | then throw(" | |
129 | - | else WriteSet([DataEntry(("status: | |
128 | + | then throw("purchase amount cannot be higher that item price") | |
129 | + | else WriteSet([DataEntry(("status:purchase_item_A_customer_" + G), "confirmed"), DataEntry(("price:purchase_item_A_customer" + G), D)]) | |
130 | 130 | } | |
131 | 131 | } | |
132 | 132 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let a = base58'EEGsMXJbL3i6pER7gfBpcw87Km3h2gz6qiqhqPXbdob1' | |
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 "none" | |
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) + "count") | |
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(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 deposit () = { | |
66 | 66 | let y = extract(x.payment) | |
67 | 67 | if (isDefined(y.assetId)) | |
68 | 68 | then throw("you can use WAVES only at the moment") | |
69 | 69 | else { | |
70 | 70 | let z = toBase58String(x.caller.bytes) | |
71 | 71 | let A = { | |
72 | 72 | let e = getInteger(this, ("wl_sts" + z)) | |
73 | 73 | if ($isInstanceOf(e, "Int")) | |
74 | 74 | then { | |
75 | 75 | let f = e | |
76 | 76 | f | |
77 | 77 | } | |
78 | 78 | else 0 | |
79 | 79 | } | |
80 | 80 | let B = { | |
81 | 81 | let e = getString(this, ("wls_sts" + z)) | |
82 | 82 | if ($isInstanceOf(e, "String")) | |
83 | 83 | then { | |
84 | 84 | let f = e | |
85 | 85 | f | |
86 | 86 | } | |
87 | 87 | else throw("user has not waitlisted") | |
88 | 88 | } | |
89 | 89 | let C = (A + y.amount) | |
90 | 90 | WriteSet([DataEntry(z, C)]) | |
91 | 91 | } | |
92 | 92 | } | |
93 | 93 | ||
94 | 94 | ||
95 | 95 | ||
96 | 96 | @Callable(x) | |
97 | 97 | func addItem (q,D,E) = { | |
98 | 98 | let F = toBase58String(x.caller.bytes) | |
99 | 99 | let j = o(F, q) | |
100 | 100 | if ((0 >= D)) | |
101 | 101 | then throw("purchase amount cannot be less that item price") | |
102 | 102 | else if (("none" != t(j))) | |
103 | 103 | then throw("an item is alreadt exist") | |
104 | 104 | else WriteSet([DataEntry(s(j), F), DataEntry(i(j), D), DataEntry(r(j), E)]) | |
105 | 105 | } | |
106 | 106 | ||
107 | 107 | ||
108 | 108 | ||
109 | 109 | @Callable(x) | |
110 | - | func | |
110 | + | func purchase () = { | |
111 | 111 | let y = extract(x.payment) | |
112 | 112 | if (isDefined(y.assetId)) | |
113 | 113 | then throw("you can use WAVES only at the moment") | |
114 | 114 | else { | |
115 | 115 | let G = toBase58String(x.caller.bytes) | |
116 | 116 | let D = { | |
117 | 117 | let e = getInteger(this, "item_A_coupon_price") | |
118 | 118 | if ($isInstanceOf(e, "Int")) | |
119 | 119 | then { | |
120 | 120 | let f = e | |
121 | 121 | f | |
122 | 122 | } | |
123 | 123 | else 0 | |
124 | 124 | } | |
125 | 125 | if ((D > y.amount)) | |
126 | - | then throw(" | |
126 | + | then throw("purchase amount cannot be less that item price") | |
127 | 127 | else if ((y.amount > D)) | |
128 | - | then throw(" | |
129 | - | else WriteSet([DataEntry(("status: | |
128 | + | then throw("purchase amount cannot be higher that item price") | |
129 | + | else WriteSet([DataEntry(("status:purchase_item_A_customer_" + G), "confirmed"), DataEntry(("price:purchase_item_A_customer" + G), D)]) | |
130 | 130 | } | |
131 | 131 | } | |
132 | 132 | ||
133 | 133 | ||
134 | 134 | ||
135 | 135 | @Callable(x) | |
136 | 136 | func withdraw (H) = { | |
137 | 137 | let z = toBase58String(x.caller.bytes) | |
138 | 138 | let A = { | |
139 | 139 | let e = getInteger(this, z) | |
140 | 140 | if ($isInstanceOf(e, "Int")) | |
141 | 141 | then { | |
142 | 142 | let f = e | |
143 | 143 | f | |
144 | 144 | } | |
145 | 145 | else 0 | |
146 | 146 | } | |
147 | 147 | let C = (A - H) | |
148 | 148 | if ((0 > H)) | |
149 | 149 | then throw("can't withdraw negative amount") | |
150 | 150 | else if ((0 > C)) | |
151 | 151 | then throw("not enough balance") | |
152 | 152 | else ScriptResult(WriteSet([DataEntry(z, C)]), TransferSet([ScriptTransfer(x.caller, H, unit)])) | |
153 | 153 | } | |
154 | 154 | ||
155 | 155 | ||
156 | 156 | @Verifier(I) | |
157 | 157 | func J () = { | |
158 | 158 | let e = I | |
159 | 159 | if ($isInstanceOf(e, "SetScriptTransaction")) | |
160 | 160 | then { | |
161 | 161 | let f = e | |
162 | 162 | sigVerify(I.bodyBytes, I.proofs[0], a) | |
163 | 163 | } | |
164 | 164 | else if ($isInstanceOf(e, "DataTransaction")) | |
165 | 165 | then { | |
166 | 166 | let K = e | |
167 | 167 | true | |
168 | 168 | } | |
169 | 169 | else false | |
170 | 170 | } | |
171 | 171 |
github/deemru/w8io/169f3d6 41.52 ms ◑