tx · Gd4WnuP5akBT2gwJhpn5zRjWZynFc8cAUuRaxxVZhFYb 3MvgxS9JmLvNSyx4dJr6Zfke3Siz5p92gao: -0.01400000 Waves 2019.09.05 15:20 [662721] smart account 3MvgxS9JmLvNSyx4dJr6Zfke3Siz5p92gao > SELF 0.00000000 Waves
{ "type": 13, "id": "Gd4WnuP5akBT2gwJhpn5zRjWZynFc8cAUuRaxxVZhFYb", "fee": 1400000, "feeAssetId": null, "timestamp": 1567686029088, "version": 1, "sender": "3MvgxS9JmLvNSyx4dJr6Zfke3Siz5p92gao", "senderPublicKey": "DtnvSHiYQnjG4si66eUE3pTReZAnukP13TFUr4QtsJBc", "proofs": [ "3Mymzb66wCwejs1spYvVeoukvWVxV52LQUeMHqbwFgeDsLN1WPSwZ98gs327cnyTigwtgbki6E79rt3VUxPeGjVU" ], "script": "base64:AAIDAAAAAAAAAAAAAAANAAAAAAROT05FAgAAAARub25lAQAAAA5nZXROdW1iZXJCeUtleQAAAAEAAAADa2V5BAAAAANudW0EAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEFAAAABE5PTkUFAAAAA251bQEAAAALZ2V0U3RyQnlLZXkAAAABAAAAA2tleQQAAAADc3RyBAAAAAckbWF0Y2gwCQAEHQAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAGU3RyaW5nBAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhBQAAAAROT05FBQAAAANzdHIBAAAAD2dldEtleUl0ZW1QcmljZQAAAAEAAAAEaXRlbQkAASwAAAACBQAAAARpdGVtAgAAAAZfcHJpY2UBAAAAEWdldFZhbHVlSXRlbVByaWNlAAAAAQAAAARpdGVtCQEAAAAOZ2V0TnVtYmVyQnlLZXkAAAABCQEAAAAPZ2V0S2V5SXRlbVByaWNlAAAAAQ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wbGllckFkZHJlc3MJAAJYAAAAAQgIBQAAAAFpAAAABmNhbGxlcgAAAAVieXRlcwQAAAAEaXRlbQkBAAAACmdldEtleUl0ZW0AAAACBQAAAA9zdXBwbGllckFkZHJlc3MFAAAABXRpdGxlAwkAAGcAAAACAAAAAAAAAAAABQAAAAVwcmljZQkAAAIAAAABAgAAAClwdXJjaGFzZSBhbW91bnQgY2Fubm90IGJlIGxlc3MgdGhhbiBwcmljZQMJAQAAAAIhPQAAAAIJAQAAABRnZXRWYWx1ZUl0ZW1TdXBwbGllcgAAAAEFAAAABGl0ZW0FAAAABE5PTkUJAAACAAAAAQIAAAATaXRlbSBhbHJlYWR5IGV4aXN0cwkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkBAAAAEmdldEtleUl0ZW1TdXBwbGllcgAAAAEFAAAABGl0ZW0FAAAAD3N1cHBsaWVyQWRkcmVzcwkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkBAAAAD2dldEtleUl0ZW1QcmljZQAAAAEFAAAABGl0ZW0FAAAABXByaWNlCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQEAAAAOZ2V0S2V5SXRlbURhdGEAAAABBQAAAARpdGVtBQAAAARkYXRhBQAAAANuaWwAAAAADoDeZA==", "chainId": 84, "height": 662721, "spentComplexity": 0 } View: original | compacted Prev: 2WTo4FAdtw9bgZaqhMJPzyd3MxpZ5suG4J3JKCdL5mpX Next: 8fqdtYDbtvdXgS3c75i4fAXgfPuG6JgBhA5mpZH6zF8q Full:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let a = "none" | |
5 | + | ||
6 | + | func b (c) = { | |
7 | + | let d = { | |
8 | + | let e = getInteger(this, c) | |
9 | + | if ($isInstanceOf(e, "Int")) | |
10 | + | then { | |
11 | + | let f = e | |
12 | + | f | |
13 | + | } | |
14 | + | else a | |
15 | + | } | |
16 | + | d | |
17 | + | } | |
4 | 18 | ||
5 | 19 | ||
6 | - | @Callable(a) | |
7 | - | func purchase () = { | |
8 | - | let b = extract(a.payment) | |
9 | - | if (isDefined(b.assetId)) | |
10 | - | then throw("can use WAVES only at that moment") | |
11 | - | else { | |
12 | - | let c = toBase58String(a.caller.bytes) | |
13 | - | let d = { | |
14 | - | let e = getInteger(this, "item_A_coupon_price") | |
15 | - | if ($isInstanceOf(e, "Int")) | |
16 | - | then { | |
17 | - | let f = e | |
18 | - | f | |
19 | - | } | |
20 | - | else 0 | |
20 | + | func g (c) = { | |
21 | + | let h = { | |
22 | + | let e = getString(this, c) | |
23 | + | if ($isInstanceOf(e, "String")) | |
24 | + | then { | |
25 | + | let f = e | |
26 | + | f | |
21 | 27 | } | |
22 | - | if ((d > b.amount)) | |
23 | - | then throw("purchace amount cannot be less than item price") | |
24 | - | else if ((b.amount > d)) | |
25 | - | then throw("purchace amount cannot be higher than item price") | |
26 | - | else WriteSet([DataEntry(("status:purchase_item_A_customer_" + c), "confirmed"), DataEntry(("price:purchase_item_A_customer_" + c), d)]) | |
27 | - | } | |
28 | + | else a | |
29 | + | } | |
30 | + | h | |
31 | + | } | |
32 | + | ||
33 | + | ||
34 | + | func i (j) = (j + "_price") | |
35 | + | ||
36 | + | ||
37 | + | func k (j) = b(i(j)) | |
38 | + | ||
39 | + | ||
40 | + | func l (m,j) = (((j + "_") + m) + "_cnt") | |
41 | + | ||
42 | + | ||
43 | + | func n (m,j) = b(l(m, j)) | |
44 | + | ||
45 | + | ||
46 | + | func o (p,q) = ("item_" + toBase58String(sha256(toBytes((p + q))))) | |
47 | + | ||
48 | + | ||
49 | + | func r (j) = (j + "_data") | |
50 | + | ||
51 | + | ||
52 | + | func s (j) = (j + "_owner") | |
53 | + | ||
54 | + | ||
55 | + | func t (j) = g(s(j)) | |
56 | + | ||
57 | + | ||
58 | + | func u (v) = (v + "_balance") | |
59 | + | ||
60 | + | ||
61 | + | func w (v) = b(u(v)) | |
62 | + | ||
63 | + | ||
64 | + | @Callable(x) | |
65 | + | func addItem (q,y,z) = { | |
66 | + | let A = toBase58String(x.caller.bytes) | |
67 | + | let j = o(A, q) | |
68 | + | if ((0 >= y)) | |
69 | + | then throw("purchase amount cannot be less than price") | |
70 | + | else if ((t(j) != a)) | |
71 | + | then throw("item already exists") | |
72 | + | else WriteSet([DataEntry(s(j), A), DataEntry(i(j), y), DataEntry(r(j), z)]) | |
28 | 73 | } | |
29 | 74 | ||
30 | 75 |
github/deemru/w8io/169f3d6 40.47 ms ◑