tx · 5y1oCkK3imL5H8cEMoC3Sc3Fqdd8oCxCyLP6VAMr1SrX 3NBY19sy9tBYtV3Xf15DrMAgM555oi7S4pP: -0.05000000 Waves 2020.02.07 21:39 [889172] smart account 3NBY19sy9tBYtV3Xf15DrMAgM555oi7S4pP > SELF 0.00000000 Waves
{ "type": 13, "id": "5y1oCkK3imL5H8cEMoC3Sc3Fqdd8oCxCyLP6VAMr1SrX", "fee": 5000000, "feeAssetId": null, "timestamp": 1581100760971, "version": 1, "sender": "3NBY19sy9tBYtV3Xf15DrMAgM555oi7S4pP", "senderPublicKey": "FUWhBBCT8RpLYi4Ak1vzBzSaazgezQHqHdLScfYtbYNu", "proofs": [ "27dChn2UvSHRi94eWbNFTsvpM2SoVi8QPXswKE8rNkoLGxNhjCycQGyEArTHTZpJwRaFZ79w1XQexLhEbGCsQvk3" ], "script": "base64:AAIDAAAAAAAAAAsIARIAEgUKAwgBCAAAAA4AAAAABE5PTkUCAAAABG5vbmUBAAAADmdldE51bWJlckJ5S2V5AAAAAQAAAANrZXkEAAAAA251bQQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQAAAAAAAAAAAAUAAAADbnVtAQAAAAtnZXRTdHJCeUtleQAAAAEAAAADa2V5BAAAAANzdHIEAAAAByRtYXRjaDAJAAQdAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAAZTdHJpbmcEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEFAAAABE5PTkUFAAAAA3N0cgEAAAAPZ2V0S2V5SXRlbVByaWNlAAAAAQAAAARpdGVtCQABLAAAAAIFAAAABGl0ZW0CAAAABl9wcmljZQEAAAARZ2V0VmFsdWVJdGVtUHJpY2UAAAABAAAABGl0ZW0JAQAAAA5nZXROdW1iZXJCeUtleQAAAAEJAQAAAA9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AAAAckbWF0Y2gwBgceI6TE", "chainId": 84, "height": 889172, "spentComplexity": 0 } View: original | compacted Prev: 5stZyQYToEcRjWSnLBrCg5HLp2PLmR7rkdzLsjSdeqSq Next: none Diff:
Old | New | Differences | |
---|---|---|---|
61 | 61 | func w (v) = b(u(v)) | |
62 | 62 | ||
63 | 63 | ||
64 | - | @Callable(x) | |
64 | + | let x = base58'AEPkVhxxwDcFuxp5ykhU7hErZWKFukRePVvcsTpUJm1L' | |
65 | + | ||
66 | + | @Callable(y) | |
65 | 67 | func purchase () = { | |
66 | - | let | |
67 | - | if (isDefined( | |
68 | + | let z = extract(y.payment) | |
69 | + | if (isDefined(z.assetId)) | |
68 | 70 | then throw("can use WAVES only at the moment") | |
69 | 71 | else { | |
70 | - | let | |
71 | - | let | |
72 | + | let A = toBase58String(y.caller.bytes) | |
73 | + | let B = { | |
72 | 74 | let e = getInteger(this, "item_A_coupon_price") | |
73 | 75 | if ($isInstanceOf(e, "Int")) | |
74 | 76 | then { | |
77 | 79 | } | |
78 | 80 | else 0 | |
79 | 81 | } | |
80 | - | if (( | |
82 | + | if ((B > z.amount)) | |
81 | 83 | then throw("purchase amount cannot be less than item price") | |
82 | - | else if (( | |
84 | + | else if ((z.amount > B)) | |
83 | 85 | then throw("purchase amount cannot be higher than item price") | |
84 | - | else WriteSet([DataEntry(("status:purchase_item_A_customer_" + | |
86 | + | else WriteSet([DataEntry(("status:purchase_item_A_customer_" + A), "confirmed"), DataEntry(("price:purchase_item_A_customer_" + A), B)]) | |
85 | 87 | } | |
86 | 88 | } | |
87 | 89 | ||
88 | 90 | ||
89 | 91 | ||
90 | - | @Callable( | |
91 | - | func addItem (q, | |
92 | - | let | |
93 | - | let j = o( | |
94 | - | if ((0 >= | |
92 | + | @Callable(y) | |
93 | + | func addItem (q,B,C) = { | |
94 | + | let D = toBase58String(y.caller.bytes) | |
95 | + | let j = o(D, q) | |
96 | + | if ((0 >= B)) | |
95 | 97 | then throw("purchase amount cannot be less than item price") | |
96 | 98 | else if ((t(j) != a)) | |
97 | 99 | then throw("an item is already exist") | |
98 | - | else WriteSet([DataEntry(s(j), | |
100 | + | else WriteSet([DataEntry(s(j), D), DataEntry(i(j), B), DataEntry(r(j), C)]) | |
99 | 101 | } | |
100 | 102 | ||
103 | + | ||
104 | + | @Verifier(E) | |
105 | + | func F () = { | |
106 | + | let e = E | |
107 | + | if ($isInstanceOf(e, "SetScriptTransaction")) | |
108 | + | then { | |
109 | + | let G = e | |
110 | + | sigVerify(E.bodyBytes, E.proofs[0], x) | |
111 | + | } | |
112 | + | else if ($isInstanceOf(e, "DataTransaction")) | |
113 | + | then { | |
114 | + | let G = e | |
115 | + | true | |
116 | + | } | |
117 | + | else false | |
118 | + | } | |
101 | 119 |
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 f = e | |
26 | 26 | f | |
27 | 27 | } | |
28 | 28 | else a | |
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) + "_cnt") | |
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(sha256(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 | - | @Callable(x) | |
64 | + | let x = base58'AEPkVhxxwDcFuxp5ykhU7hErZWKFukRePVvcsTpUJm1L' | |
65 | + | ||
66 | + | @Callable(y) | |
65 | 67 | func purchase () = { | |
66 | - | let | |
67 | - | if (isDefined( | |
68 | + | let z = extract(y.payment) | |
69 | + | if (isDefined(z.assetId)) | |
68 | 70 | then throw("can use WAVES only at the moment") | |
69 | 71 | else { | |
70 | - | let | |
71 | - | let | |
72 | + | let A = toBase58String(y.caller.bytes) | |
73 | + | let B = { | |
72 | 74 | let e = getInteger(this, "item_A_coupon_price") | |
73 | 75 | if ($isInstanceOf(e, "Int")) | |
74 | 76 | then { | |
75 | 77 | let f = e | |
76 | 78 | f | |
77 | 79 | } | |
78 | 80 | else 0 | |
79 | 81 | } | |
80 | - | if (( | |
82 | + | if ((B > z.amount)) | |
81 | 83 | then throw("purchase amount cannot be less than item price") | |
82 | - | else if (( | |
84 | + | else if ((z.amount > B)) | |
83 | 85 | then throw("purchase amount cannot be higher than item price") | |
84 | - | else WriteSet([DataEntry(("status:purchase_item_A_customer_" + | |
86 | + | else WriteSet([DataEntry(("status:purchase_item_A_customer_" + A), "confirmed"), DataEntry(("price:purchase_item_A_customer_" + A), B)]) | |
85 | 87 | } | |
86 | 88 | } | |
87 | 89 | ||
88 | 90 | ||
89 | 91 | ||
90 | - | @Callable( | |
91 | - | func addItem (q, | |
92 | - | let | |
93 | - | let j = o( | |
94 | - | if ((0 >= | |
92 | + | @Callable(y) | |
93 | + | func addItem (q,B,C) = { | |
94 | + | let D = toBase58String(y.caller.bytes) | |
95 | + | let j = o(D, q) | |
96 | + | if ((0 >= B)) | |
95 | 97 | then throw("purchase amount cannot be less than item price") | |
96 | 98 | else if ((t(j) != a)) | |
97 | 99 | then throw("an item is already exist") | |
98 | - | else WriteSet([DataEntry(s(j), | |
100 | + | else WriteSet([DataEntry(s(j), D), DataEntry(i(j), B), DataEntry(r(j), C)]) | |
99 | 101 | } | |
100 | 102 | ||
103 | + | ||
104 | + | @Verifier(E) | |
105 | + | func F () = { | |
106 | + | let e = E | |
107 | + | if ($isInstanceOf(e, "SetScriptTransaction")) | |
108 | + | then { | |
109 | + | let G = e | |
110 | + | sigVerify(E.bodyBytes, E.proofs[0], x) | |
111 | + | } | |
112 | + | else if ($isInstanceOf(e, "DataTransaction")) | |
113 | + | then { | |
114 | + | let G = e | |
115 | + | true | |
116 | + | } | |
117 | + | else false | |
118 | + | } | |
101 | 119 |
github/deemru/w8io/169f3d6 33.90 ms ◑