tx · E4hnHnqqXTGSuC6mGyswzT6Du8GRcCJHKHjtk1UqHgRY 3Mrm2Y65tQHXfGxscQKTNc8ezxczedMDcnk: -0.01400000 Waves 2019.09.18 12:26 [681514] smart account 3Mrm2Y65tQHXfGxscQKTNc8ezxczedMDcnk > SELF 0.00000000 Waves
{ "type": 13, "id": "E4hnHnqqXTGSuC6mGyswzT6Du8GRcCJHKHjtk1UqHgRY", "fee": 1400000, "feeAssetId": null, "timestamp": 1568798817904, "version": 1, "sender": "3Mrm2Y65tQHXfGxscQKTNc8ezxczedMDcnk", "senderPublicKey": "Fxiie4GD9XKqtFXMHFgiDJTqvfZP1xSgdYbS7ZQtq4RW", "proofs": [ "3Nrw3i1JR9i9NMEQYRvLQf3hEyUt97TYCKaZKe1ZFWe4tsdqzErx5b2NcNoA8KhyM1YnMD5GNSmSw5shBQRbupDq" ], "script": "base64:AAIDAAAAAAAAAAAAAAAIAAAAAAROT05FAgAAAARub25lAQAAAA5nZXROdW1iZXJCeUtleQAAAAEAAAADa2V5BAAAAANudW0EAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEAAAAAAAAAAAAFAAAAA251bQEAAAALZ2V0U3RyQnlLZXkAAAABAAAAA2tleQQAAAADc3RyBAAAAAckbWF0Y2gwCQAEHQAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAGU3RyaW5nBAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhBQAAAAROT05FBQAAAANzdHIBAAAAD2dldEtleUl0ZW1QcmljZQAAAAEAAAAEaXRlbQkAASwAAAACBQAAAARpdGVtAgAAAAZfcHJpY2UBAAAAEmdldEtleUl0ZW1TdXBwbGllcgAAAAEAAAAEaXRlbQkAASwAAAACBQAAAARpdGVtAgAAAAZfb3duZXIBAAAAFGdldFZhbH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AAACURhdGFFbnRyeQAAAAIJAQAAAA5nZXRLZXlJdGVtRGF0YQAAAAEFAAAABGl0ZW0FAAAABGRhdGEFAAAAA25pbAAAAAD7ewqa", "chainId": 84, "height": 681514, "spentComplexity": 0 } View: original | compacted Prev: AhLKmPrrsKtK6Xby4FXJkd1axr3amE3TRumtKUNY42vc Next: F7oPxdRuk7feFxoivJh5aaPVEcxzZpg3cqLQDV5ZWzS9 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 0 | |
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 the 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("purchase amount cannot be less than item price") | |
24 | - | else if ((b.amount > d)) | |
25 | - | then throw("purchase 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) = (j + "_owner") | |
38 | + | ||
39 | + | ||
40 | + | func l (j) = g(k(j)) | |
41 | + | ||
42 | + | ||
43 | + | func m (n,o) = ("item_" + toBase58String(sha256(toBytes((n + o))))) | |
44 | + | ||
45 | + | ||
46 | + | func p (j) = (j + "_data") | |
47 | + | ||
48 | + | ||
49 | + | @Callable(q) | |
50 | + | func addItem (o,r,s) = { | |
51 | + | let t = toBase58String(q.caller.bytes) | |
52 | + | let j = m(t, o) | |
53 | + | if ((0 >= r)) | |
54 | + | then throw("Purchase amount cannot be less than item price.") | |
55 | + | else if ((l(j) != a)) | |
56 | + | then throw("Ann item is already exist.") | |
57 | + | else WriteSet([DataEntry(k(j), t), DataEntry(i(j), r), DataEntry(p(j), s)]) | |
28 | 58 | } | |
29 | 59 | ||
30 | 60 |
github/deemru/w8io/026f985 27.89 ms ◑