tx · GyuUDQNnw43bP7gmpHX7PiGC1scCJsFFFtv4JmmascnP 3N1VfY3QCn7kcm6UEv8fceDHvUbwroRF4hB: -0.01400000 Waves 2019.11.25 01:05 [779911] smart account 3N1VfY3QCn7kcm6UEv8fceDHvUbwroRF4hB > SELF 0.00000000 Waves
{ "type": 13, "id": "GyuUDQNnw43bP7gmpHX7PiGC1scCJsFFFtv4JmmascnP", "fee": 1400000, "feeAssetId": null, "timestamp": 1574632432085, "version": 1, "sender": "3N1VfY3QCn7kcm6UEv8fceDHvUbwroRF4hB", "senderPublicKey": "AMqmqGuYr6ZKRbxyCb6N4Vr7M77Lqs9AsQdM7nkfxjEh", "proofs": [ "3VdFvvGuCAw5dKK1Xgb6Gg4bRtiXtAAKhgBF8xcgSxgjB5ZNq1hhiSACX5KMEh3WbY1rSSMnxm9EU5ym8bmciLZ2" ], "script": "base64:AAIDAAAAAAAAABAIARIFCgMIAQgSAwoBCBIAAAAAHQAAAAAETk9ORQIAAAAEbm9uZQAAAAAGVk9URVJTAAAAAAAAAAADAAAAAAZRVU9SVU0AAAAAAAAAAAIAAAAABlZPVElORwIAAAAGdm90aW5nAAAAAAZSRVZFQUwCAAAABnJldmVhbAAAAAAIRkVBVFVSRUQCAAAACGZlYXR1cmVkAAAAAAhERUxJU1RFRAIAAAAIZGVsaXN0ZWQBAAAADmdldE51bWJlckJ5S2V5AAAAAQAAAANrZXkEAAAAA251bQQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQAAAAAAAAAAAAUAAAADbnVtAQAAAAtnZXRTdHJCeUtleQAAAAEAAAADa2V5BAAAAANzdHIEAAAAByRtYXRjaDAJAAQdAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAAZTdHJpbmcEAAAAAWEFAAAAByRtYXRjaDAFAAA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UJhbGFuY2VTdXBwbGllcgAAAAEFAAAAD3N1cHBsaWVyQWRkcmVzcwkAAGQAAAACCQEAAAAXZ2V0VmFsdWVCYWxhbmNlU3VwcGxpZXIAAAABBQAAAA9zdXBwbGllckFkZHJlc3MIBQAAAANwbXQAAAAGYW1vdW50BQAAAANuaWwAAAABaQEAAAAId2l0aGRyYXcAAAAABAAAAA9zdXBwbGllckFkZHJlc3MJAAJYAAAAAQgIBQAAAAFpAAAABmNhbGxlcgAAAAVieXRlcwQAAAAHYmFsYW5jZQkBAAAAF2dldFZhbHVlQmFsYW5jZVN1cHBsaWVyAAAAAQUAAAAPc3VwcGxpZXJBZGRyZXNzAwkAAGcAAAACAAAAAAAAAAAABQAAAAdiYWxhbmNlCQAAAgAAAAECAAAAFWluc3VmZmljaWVudCBiYWxiYW5jZQkBAAAADFNjcmlwdFJlc3VsdAAAAAIJAQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAQAAABVnZXRLZXlCYWxhbmNlU3VwcGxpZXIAAAABBQAAAA9zdXBwbGllckFkZHJlc3MAAAAAAAAAAAAFAAAAA25pbAkBAAAAC1RyYW5zZmVyU2V0AAAAAQkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADCQEAAAAcQGV4dHJVc2VyKGFkZHJlc3NGcm9tU3RyaW5nKQAAAAEFAAAAD3N1cHBsaWVyQWRkcmVzcwUAAAAHYmFsYW5jZQUAAAAEdW5pdAUAAAADbmlsAAAAACYo4EA=", "chainId": 84, "height": 779911, "spentComplexity": 0 } View: original | compacted Prev: 3eVMQ5zQBBkLL4kM5WC31TCLPba7SF1GHZnyPRXDR2v2 Next: 4KBPE33whLwqoX4Y8SzEv7acLscqkoVTN8LSS2P3B2t1 Diff:
Old | New | Differences | |
---|---|---|---|
73 | 73 | func C (B) = h(A(B)) | |
74 | 74 | ||
75 | 75 | ||
76 | - | @Callable(D) | |
77 | - | func addItem (w,E,F) = { | |
78 | - | let G = toBase58String(D.caller.bytes) | |
79 | - | let p = u(G, w) | |
80 | - | if ((0 >= E)) | |
76 | + | func D (p,s) = (((p + "_") + s) + "_commit") | |
77 | + | ||
78 | + | ||
79 | + | func E (p,s) = m(D(p, s)) | |
80 | + | ||
81 | + | ||
82 | + | func F (p) = (p + "_comctn") | |
83 | + | ||
84 | + | ||
85 | + | func G (p) = h(F(p)) | |
86 | + | ||
87 | + | ||
88 | + | func H (p,s) = (((p + "_") + s) + "_reveal") | |
89 | + | ||
90 | + | ||
91 | + | func I (p,s) = m(H(p, s)) | |
92 | + | ||
93 | + | ||
94 | + | func J (p) = (p + "_status") | |
95 | + | ||
96 | + | ||
97 | + | func K (p) = m(J(p)) | |
98 | + | ||
99 | + | ||
100 | + | func L (p,M) = ((p + "_res:") + M) | |
101 | + | ||
102 | + | ||
103 | + | func N (p,M) = h(L(p, M)) | |
104 | + | ||
105 | + | ||
106 | + | @Callable(O) | |
107 | + | func addItem (w,P,Q) = { | |
108 | + | let R = toBase58String(O.caller.bytes) | |
109 | + | let p = u(R, w) | |
110 | + | if ((0 >= P)) | |
81 | 111 | then throw("purchase amount cannot be less than item price") | |
82 | 112 | else if ((z(p) != a)) | |
83 | 113 | then throw("an item is already exist") | |
84 | - | else WriteSet([DataEntry(y(p), | |
114 | + | else WriteSet([DataEntry(y(p), R), DataEntry(o(p), P), DataEntry(x(p), Q)]) | |
85 | 115 | } | |
86 | 116 | ||
87 | 117 | ||
88 | 118 | ||
89 | - | @Callable( | |
119 | + | @Callable(O) | |
90 | 120 | func purchase (p) = { | |
91 | - | let | |
92 | - | if (isDefined( | |
121 | + | let S = extract(O.payment) | |
122 | + | if (isDefined(S.assetId)) | |
93 | 123 | then throw("WAVES tokens only at the moment") | |
94 | 124 | else { | |
95 | - | let | |
96 | - | let | |
97 | - | let | |
98 | - | if (( | |
125 | + | let T = toBase58String(O.caller.bytes) | |
126 | + | let P = q(p) | |
127 | + | let R = z(p) | |
128 | + | if ((P > S.amount)) | |
99 | 129 | then throw("purchase amount cannot be less than item price") | |
100 | - | else if (( | |
130 | + | else if ((S.amount > P)) | |
101 | 131 | then throw("purchase amount cannot be higher than item price") | |
102 | - | else if (( | |
132 | + | else if ((R == a)) | |
103 | 133 | then throw("supplier does not exist") | |
104 | - | else WriteSet([DataEntry(r( | |
134 | + | else WriteSet([DataEntry(r(T, p), (t(T, p) + 1)), DataEntry(A(R), (C(R) + S.amount))]) | |
105 | 135 | } | |
106 | 136 | } | |
107 | 137 | ||
108 | 138 | ||
109 | 139 | ||
110 | - | @Callable( | |
140 | + | @Callable(O) | |
111 | 141 | func withdraw () = { | |
112 | - | let | |
113 | - | let | |
114 | - | if ((0 >= | |
142 | + | let R = toBase58String(O.caller.bytes) | |
143 | + | let U = C(R) | |
144 | + | if ((0 >= U)) | |
115 | 145 | then throw("insufficient balbance") | |
116 | - | else ScriptResult(WriteSet([DataEntry(A( | |
146 | + | else ScriptResult(WriteSet([DataEntry(A(R), 0)]), TransferSet([ScriptTransfer(addressFromStringValue(R), U, unit)])) | |
117 | 147 | } | |
118 | 148 | ||
119 | 149 |
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 | let b = 3 | |
7 | 7 | ||
8 | 8 | let c = 2 | |
9 | 9 | ||
10 | 10 | let d = "voting" | |
11 | 11 | ||
12 | 12 | let e = "reveal" | |
13 | 13 | ||
14 | 14 | let f = "featured" | |
15 | 15 | ||
16 | 16 | let g = "delisted" | |
17 | 17 | ||
18 | 18 | func h (i) = { | |
19 | 19 | let j = { | |
20 | 20 | let k = getInteger(this, i) | |
21 | 21 | if ($isInstanceOf(k, "Int")) | |
22 | 22 | then { | |
23 | 23 | let l = k | |
24 | 24 | l | |
25 | 25 | } | |
26 | 26 | else 0 | |
27 | 27 | } | |
28 | 28 | j | |
29 | 29 | } | |
30 | 30 | ||
31 | 31 | ||
32 | 32 | func m (i) = { | |
33 | 33 | let n = { | |
34 | 34 | let k = getString(this, i) | |
35 | 35 | if ($isInstanceOf(k, "String")) | |
36 | 36 | then { | |
37 | 37 | let l = k | |
38 | 38 | l | |
39 | 39 | } | |
40 | 40 | else a | |
41 | 41 | } | |
42 | 42 | n | |
43 | 43 | } | |
44 | 44 | ||
45 | 45 | ||
46 | 46 | func o (p) = (p + "_price") | |
47 | 47 | ||
48 | 48 | ||
49 | 49 | func q (p) = h(o(p)) | |
50 | 50 | ||
51 | 51 | ||
52 | 52 | func r (s,p) = (((p + "_") + s) + "_cnt") | |
53 | 53 | ||
54 | 54 | ||
55 | 55 | func t (s,p) = h(r(s, p)) | |
56 | 56 | ||
57 | 57 | ||
58 | 58 | func u (v,w) = ("item_" + toBase58String(sha256(toBytes((v + w))))) | |
59 | 59 | ||
60 | 60 | ||
61 | 61 | func x (p) = (p + "_data") | |
62 | 62 | ||
63 | 63 | ||
64 | 64 | func y (p) = (p + "_owner") | |
65 | 65 | ||
66 | 66 | ||
67 | 67 | func z (p) = m(y(p)) | |
68 | 68 | ||
69 | 69 | ||
70 | 70 | func A (B) = (B + "_balance") | |
71 | 71 | ||
72 | 72 | ||
73 | 73 | func C (B) = h(A(B)) | |
74 | 74 | ||
75 | 75 | ||
76 | - | @Callable(D) | |
77 | - | func addItem (w,E,F) = { | |
78 | - | let G = toBase58String(D.caller.bytes) | |
79 | - | let p = u(G, w) | |
80 | - | if ((0 >= E)) | |
76 | + | func D (p,s) = (((p + "_") + s) + "_commit") | |
77 | + | ||
78 | + | ||
79 | + | func E (p,s) = m(D(p, s)) | |
80 | + | ||
81 | + | ||
82 | + | func F (p) = (p + "_comctn") | |
83 | + | ||
84 | + | ||
85 | + | func G (p) = h(F(p)) | |
86 | + | ||
87 | + | ||
88 | + | func H (p,s) = (((p + "_") + s) + "_reveal") | |
89 | + | ||
90 | + | ||
91 | + | func I (p,s) = m(H(p, s)) | |
92 | + | ||
93 | + | ||
94 | + | func J (p) = (p + "_status") | |
95 | + | ||
96 | + | ||
97 | + | func K (p) = m(J(p)) | |
98 | + | ||
99 | + | ||
100 | + | func L (p,M) = ((p + "_res:") + M) | |
101 | + | ||
102 | + | ||
103 | + | func N (p,M) = h(L(p, M)) | |
104 | + | ||
105 | + | ||
106 | + | @Callable(O) | |
107 | + | func addItem (w,P,Q) = { | |
108 | + | let R = toBase58String(O.caller.bytes) | |
109 | + | let p = u(R, w) | |
110 | + | if ((0 >= P)) | |
81 | 111 | then throw("purchase amount cannot be less than item price") | |
82 | 112 | else if ((z(p) != a)) | |
83 | 113 | then throw("an item is already exist") | |
84 | - | else WriteSet([DataEntry(y(p), | |
114 | + | else WriteSet([DataEntry(y(p), R), DataEntry(o(p), P), DataEntry(x(p), Q)]) | |
85 | 115 | } | |
86 | 116 | ||
87 | 117 | ||
88 | 118 | ||
89 | - | @Callable( | |
119 | + | @Callable(O) | |
90 | 120 | func purchase (p) = { | |
91 | - | let | |
92 | - | if (isDefined( | |
121 | + | let S = extract(O.payment) | |
122 | + | if (isDefined(S.assetId)) | |
93 | 123 | then throw("WAVES tokens only at the moment") | |
94 | 124 | else { | |
95 | - | let | |
96 | - | let | |
97 | - | let | |
98 | - | if (( | |
125 | + | let T = toBase58String(O.caller.bytes) | |
126 | + | let P = q(p) | |
127 | + | let R = z(p) | |
128 | + | if ((P > S.amount)) | |
99 | 129 | then throw("purchase amount cannot be less than item price") | |
100 | - | else if (( | |
130 | + | else if ((S.amount > P)) | |
101 | 131 | then throw("purchase amount cannot be higher than item price") | |
102 | - | else if (( | |
132 | + | else if ((R == a)) | |
103 | 133 | then throw("supplier does not exist") | |
104 | - | else WriteSet([DataEntry(r( | |
134 | + | else WriteSet([DataEntry(r(T, p), (t(T, p) + 1)), DataEntry(A(R), (C(R) + S.amount))]) | |
105 | 135 | } | |
106 | 136 | } | |
107 | 137 | ||
108 | 138 | ||
109 | 139 | ||
110 | - | @Callable( | |
140 | + | @Callable(O) | |
111 | 141 | func withdraw () = { | |
112 | - | let | |
113 | - | let | |
114 | - | if ((0 >= | |
142 | + | let R = toBase58String(O.caller.bytes) | |
143 | + | let U = C(R) | |
144 | + | if ((0 >= U)) | |
115 | 145 | then throw("insufficient balbance") | |
116 | - | else ScriptResult(WriteSet([DataEntry(A( | |
146 | + | else ScriptResult(WriteSet([DataEntry(A(R), 0)]), TransferSet([ScriptTransfer(addressFromStringValue(R), U, unit)])) | |
117 | 147 | } | |
118 | 148 | ||
119 | 149 |
github/deemru/w8io/026f985 31.40 ms ◑