tx · CDrGp3tfVNxyYV3JPZk3cWUZU7FpeWnWjrgYBsifJ947 3N3Y2QKUaFrVBoStGQpoVoRJJTeCeKwDGbc: -0.01400000 Waves 2019.09.19 18:58 [683383] smart account 3N3Y2QKUaFrVBoStGQpoVoRJJTeCeKwDGbc > SELF 0.00000000 Waves
{ "type": 13, "id": "CDrGp3tfVNxyYV3JPZk3cWUZU7FpeWnWjrgYBsifJ947", "fee": 1400000, "feeAssetId": null, "timestamp": 1568908725404, "version": 1, "sender": "3N3Y2QKUaFrVBoStGQpoVoRJJTeCeKwDGbc", "senderPublicKey": "Ammb6PN8K5Hi2inMgHsjhkqxAgRm1kkPjjvWXsndQ4sY", "proofs": [ "5Xk2gmpjV57qEwowDnUE46mpMdbLMrJ5qqEYDWiVJuASbQ5np6kzMCVG6mjLv24Tugie6KcZ4JgyFKTW3D7Rwb5e" ], "script": "base64:AAIDAAAAAAAAAAAAAAAOAAAAAA5vd25lclB1YmxpY0tleQEAAAAgkTEnTdeol7uGSzlcY9XCaZJBCT/vNHbkSFPcfsdd2lcAAAAABE5PTkUCAAAABG5vbmUBAAAADmdldE51bWJlckJ5S2V5AAAAAQAAAANrZXkEAAAAA251bQQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQAAAAAAAAAAAAUAAAADbnVtAQAAAAtnZXRTdHJCeUtleQAAAAEAAAADa2V5BAAAAANzdHIEAAAAByRtYXRjaDAJAAQdAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAAZTdHJpbmcEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEFAAAABE5PTkUFAAAAA3N0cgEAAAAPZ2V0S2V5SXRlbVByaWNlAAAAAQAAAARpdGVtCQABLAAAAAIFAAAABGl0ZW0CAAAABl9wcmljZQEAAAARZ2V0VmFsdW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HgAAAAGcHJvb2ZzAAAAAAAAAAAABQAAAA5vd25lclB1YmxpY0tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAPRGF0YVRyYW5zYWN0aW9uBAAAAAFkBQAAAAckbWF0Y2gwBgZk2h5V", "chainId": 84, "height": 683383, "spentComplexity": 0 } View: original | compacted Prev: 6cqELvDuNMW7h4VrTaZ6wDRvL2oMAgBdH9CUjj1Bt2pq Next: GHZBcozPb7Ne2atSBsj79fYhzJmAZ1b64DUjrDvc2B9j Diff:
Old | New | Differences | |
---|---|---|---|
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let a = base58'Ammb6PN8K5Hi2inMgHsjhkqxAgRm1kkPjjvWXsndQ4sY' | |
5 | 5 | ||
6 | - | @Callable(b) | |
7 | - | func purchase (c) = { | |
8 | - | let d = extract(b.payment) | |
9 | - | if (isDefined(d.assetId)) | |
6 | + | let b = "none" | |
7 | + | ||
8 | + | func c (d) = { | |
9 | + | let e = { | |
10 | + | let f = getInteger(this, d) | |
11 | + | if ($isInstanceOf(f, "Int")) | |
12 | + | then { | |
13 | + | let g = f | |
14 | + | g | |
15 | + | } | |
16 | + | else 0 | |
17 | + | } | |
18 | + | e | |
19 | + | } | |
20 | + | ||
21 | + | ||
22 | + | func h (d) = { | |
23 | + | let i = { | |
24 | + | let f = getString(this, d) | |
25 | + | if ($isInstanceOf(f, "String")) | |
26 | + | then { | |
27 | + | let g = f | |
28 | + | g | |
29 | + | } | |
30 | + | else b | |
31 | + | } | |
32 | + | i | |
33 | + | } | |
34 | + | ||
35 | + | ||
36 | + | func j (k) = (k + "_price") | |
37 | + | ||
38 | + | ||
39 | + | func l (k) = c(j(k)) | |
40 | + | ||
41 | + | ||
42 | + | func m (n,k) = (((k + "_") + n) + "_cnt") | |
43 | + | ||
44 | + | ||
45 | + | func o (n,k) = c(m(n, k)) | |
46 | + | ||
47 | + | ||
48 | + | func p (q,r) = ("item_" + toBase58String(sha256(toBytes((q + r))))) | |
49 | + | ||
50 | + | ||
51 | + | func s (k) = (k + "_data") | |
52 | + | ||
53 | + | ||
54 | + | func t (k) = (k + "_owner") | |
55 | + | ||
56 | + | ||
57 | + | func u (k) = h(t(k)) | |
58 | + | ||
59 | + | ||
60 | + | func v (w) = (w + "_balance") | |
61 | + | ||
62 | + | ||
63 | + | func x (w) = c(v(w)) | |
64 | + | ||
65 | + | ||
66 | + | @Callable(y) | |
67 | + | func addItem (r,z,A) = { | |
68 | + | let B = toBase58String(y.caller.bytes) | |
69 | + | let k = p(B, r) | |
70 | + | if ((0 >= z)) | |
71 | + | then throw("purchase amount cannot be less than item price") | |
72 | + | else if ((u(k) != b)) | |
73 | + | then throw("an item is already exist") | |
74 | + | else WriteSet([DataEntry(t(k), B), DataEntry(j(k), z), DataEntry(s(k), A)]) | |
75 | + | } | |
76 | + | ||
77 | + | ||
78 | + | ||
79 | + | @Callable(y) | |
80 | + | func purchase (k) = { | |
81 | + | let C = extract(y.payment) | |
82 | + | if (isDefined(C.assetId)) | |
10 | 83 | then throw("can use WAVES only at the moment") | |
11 | 84 | else { | |
12 | - | let | |
13 | - | let | |
14 | - | let | |
15 | - | if ($isInstanceOf( | |
85 | + | let D = toBase58String(y.caller.bytes) | |
86 | + | let z = { | |
87 | + | let f = getInteger(this, (("item_" + k) + "_coupon_price")) | |
88 | + | if ($isInstanceOf(f, "Int")) | |
16 | 89 | then { | |
17 | - | let | |
18 | - | | |
90 | + | let g = f | |
91 | + | g | |
19 | 92 | } | |
20 | 93 | else 0 | |
21 | 94 | } | |
22 | - | if (( | |
95 | + | if ((z > C.amount)) | |
23 | 96 | then throw("purchase amount cannot be less than item price") | |
24 | - | else if (( | |
97 | + | else if ((C.amount > z)) | |
25 | 98 | then throw("purchase amount cannot be higher than item price") | |
26 | - | else WriteSet([DataEntry(((("status:purchase_item_" + | |
99 | + | else WriteSet([DataEntry(((("status:purchase_item_" + k) + "_customer") + D), "confirmed"), DataEntry(((("price:purchase_item_" + k) + "_customer") + D), z)]) | |
27 | 100 | } | |
28 | 101 | } | |
29 | 102 | ||
30 | 103 | ||
31 | - | @Verifier( | |
32 | - | func | |
33 | - | let | |
34 | - | if ($isInstanceOf( | |
104 | + | @Verifier(E) | |
105 | + | func F () = { | |
106 | + | let f = E | |
107 | + | if ($isInstanceOf(f, "SetScriptTransaction")) | |
35 | 108 | then { | |
36 | - | let | |
37 | - | sigVerify( | |
109 | + | let G = f | |
110 | + | sigVerify(E.bodyBytes, E.proofs[0], a) | |
38 | 111 | } | |
39 | - | else if ($isInstanceOf( | |
112 | + | else if ($isInstanceOf(f, "DataTransaction")) | |
40 | 113 | then { | |
41 | - | let | |
114 | + | let G = f | |
42 | 115 | true | |
43 | 116 | } | |
44 | 117 | else true |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let a = base58'Ammb6PN8K5Hi2inMgHsjhkqxAgRm1kkPjjvWXsndQ4sY' | |
5 | 5 | ||
6 | - | @Callable(b) | |
7 | - | func purchase (c) = { | |
8 | - | let d = extract(b.payment) | |
9 | - | if (isDefined(d.assetId)) | |
6 | + | let b = "none" | |
7 | + | ||
8 | + | func c (d) = { | |
9 | + | let e = { | |
10 | + | let f = getInteger(this, d) | |
11 | + | if ($isInstanceOf(f, "Int")) | |
12 | + | then { | |
13 | + | let g = f | |
14 | + | g | |
15 | + | } | |
16 | + | else 0 | |
17 | + | } | |
18 | + | e | |
19 | + | } | |
20 | + | ||
21 | + | ||
22 | + | func h (d) = { | |
23 | + | let i = { | |
24 | + | let f = getString(this, d) | |
25 | + | if ($isInstanceOf(f, "String")) | |
26 | + | then { | |
27 | + | let g = f | |
28 | + | g | |
29 | + | } | |
30 | + | else b | |
31 | + | } | |
32 | + | i | |
33 | + | } | |
34 | + | ||
35 | + | ||
36 | + | func j (k) = (k + "_price") | |
37 | + | ||
38 | + | ||
39 | + | func l (k) = c(j(k)) | |
40 | + | ||
41 | + | ||
42 | + | func m (n,k) = (((k + "_") + n) + "_cnt") | |
43 | + | ||
44 | + | ||
45 | + | func o (n,k) = c(m(n, k)) | |
46 | + | ||
47 | + | ||
48 | + | func p (q,r) = ("item_" + toBase58String(sha256(toBytes((q + r))))) | |
49 | + | ||
50 | + | ||
51 | + | func s (k) = (k + "_data") | |
52 | + | ||
53 | + | ||
54 | + | func t (k) = (k + "_owner") | |
55 | + | ||
56 | + | ||
57 | + | func u (k) = h(t(k)) | |
58 | + | ||
59 | + | ||
60 | + | func v (w) = (w + "_balance") | |
61 | + | ||
62 | + | ||
63 | + | func x (w) = c(v(w)) | |
64 | + | ||
65 | + | ||
66 | + | @Callable(y) | |
67 | + | func addItem (r,z,A) = { | |
68 | + | let B = toBase58String(y.caller.bytes) | |
69 | + | let k = p(B, r) | |
70 | + | if ((0 >= z)) | |
71 | + | then throw("purchase amount cannot be less than item price") | |
72 | + | else if ((u(k) != b)) | |
73 | + | then throw("an item is already exist") | |
74 | + | else WriteSet([DataEntry(t(k), B), DataEntry(j(k), z), DataEntry(s(k), A)]) | |
75 | + | } | |
76 | + | ||
77 | + | ||
78 | + | ||
79 | + | @Callable(y) | |
80 | + | func purchase (k) = { | |
81 | + | let C = extract(y.payment) | |
82 | + | if (isDefined(C.assetId)) | |
10 | 83 | then throw("can use WAVES only at the moment") | |
11 | 84 | else { | |
12 | - | let | |
13 | - | let | |
14 | - | let | |
15 | - | if ($isInstanceOf( | |
85 | + | let D = toBase58String(y.caller.bytes) | |
86 | + | let z = { | |
87 | + | let f = getInteger(this, (("item_" + k) + "_coupon_price")) | |
88 | + | if ($isInstanceOf(f, "Int")) | |
16 | 89 | then { | |
17 | - | let | |
18 | - | | |
90 | + | let g = f | |
91 | + | g | |
19 | 92 | } | |
20 | 93 | else 0 | |
21 | 94 | } | |
22 | - | if (( | |
95 | + | if ((z > C.amount)) | |
23 | 96 | then throw("purchase amount cannot be less than item price") | |
24 | - | else if (( | |
97 | + | else if ((C.amount > z)) | |
25 | 98 | then throw("purchase amount cannot be higher than item price") | |
26 | - | else WriteSet([DataEntry(((("status:purchase_item_" + | |
99 | + | else WriteSet([DataEntry(((("status:purchase_item_" + k) + "_customer") + D), "confirmed"), DataEntry(((("price:purchase_item_" + k) + "_customer") + D), z)]) | |
27 | 100 | } | |
28 | 101 | } | |
29 | 102 | ||
30 | 103 | ||
31 | - | @Verifier( | |
32 | - | func | |
33 | - | let | |
34 | - | if ($isInstanceOf( | |
104 | + | @Verifier(E) | |
105 | + | func F () = { | |
106 | + | let f = E | |
107 | + | if ($isInstanceOf(f, "SetScriptTransaction")) | |
35 | 108 | then { | |
36 | - | let | |
37 | - | sigVerify( | |
109 | + | let G = f | |
110 | + | sigVerify(E.bodyBytes, E.proofs[0], a) | |
38 | 111 | } | |
39 | - | else if ($isInstanceOf( | |
112 | + | else if ($isInstanceOf(f, "DataTransaction")) | |
40 | 113 | then { | |
41 | - | let | |
114 | + | let G = f | |
42 | 115 | true | |
43 | 116 | } | |
44 | 117 | else true | |
45 | 118 | } | |
46 | 119 |
github/deemru/w8io/026f985 32.08 ms ◑