tx · FnX4UMjsbX962AT8hbUpmgXe8f6Yfu5PSKr275rTp2ab 3MuPe52GsMZN8tduGQ3jgoUBsJK1zAhjaqm: -0.01000000 Waves 2022.03.16 10:44 [1966242] smart account 3MuPe52GsMZN8tduGQ3jgoUBsJK1zAhjaqm > SELF 0.00000000 Waves
{ "type": 13, "id": "FnX4UMjsbX962AT8hbUpmgXe8f6Yfu5PSKr275rTp2ab", "fee": 1000000, "feeAssetId": null, "timestamp": 1647416692660, "version": 2, "chainId": 84, "sender": "3MuPe52GsMZN8tduGQ3jgoUBsJK1zAhjaqm", "senderPublicKey": "DKZcYM5WoZ3gBkiAgjzXdfQaZcfisgn2Zn4B226GHMcD", "proofs": [ "4H7rcyLE8nBWHmyvxHufo3XwJn9mSXNazexSn5AyD781svv17q43sasRCP7E5UaUYDSmx8qwjaGbUW7o8dZwAYV7" ], "script": "base64:AAIFAAAAAAAAAA4IAhIFCgMIAQgSAwoBCAAAAA0AAAAABE5PTkUCAAAABG5vbmUBAAAADmdldE51bWJlckJ5S2V5AAAAAQAAAANrZXkEAAAAA251bQQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQAAAAAAAAAAAAUAAAADbnVtAQAAAAtnZXRTdHJCeUtleQAAAAEAAAADa2V5BAAAAANzdHIEAAAAByRtYXRjaDAJAAQdAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAAZTdHJpbmcEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEFAAAABE5PTkUFAAAAA3N0cgEAAAAPZ2V0S2V5SXRlbVByaWNlAAAAAQAAAARpdGVtCQABLAAAAAIFAAAABGl0ZW0CAAAABl9wcmljZQEAAAARZ2V0VmFsdWVJdGVtUHJpY2UAAAABAAAABGl0ZW0JAQAAAA5nZXROdW1iZXJCeUtleQAAA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HRoZSBtb21lbnQEAAAAD2N1c3RvbWVyQWRkcmVzcwkAAlgAAAABCAgFAAAAAWkAAAAGY2FsbGVyAAAABWJ5dGVzBAAAAAVwcmljZQQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzCQABLAAAAAIJAAEsAAAAAgIAAAAFaXRlbV8FAAAAC2FjY291bnROYW1lAgAAAA1fY291cG9uX3ByaWNlAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEAAAAAAAAAAAADCQAAZgAAAAIFAAAABXByaWNlCAUAAAADcG10AAAABmFtb3VudAkAAAIAAAABAgAAAC5wdXJjaGFzZSBhbW91bnQgY2Fubm90IGJlIGxlc3MgdGhhbiBpdGVtIHByaWNlAwkAAGYAAAACCAUAAAADcG10AAAABmFtb3VudAUAAAAFcHJpY2UJAAACAAAAAQIAAAAwcHVyY2hhc2UgYW1vdW50IGNhbm5vdCBiZSBoaWdoZXIgdGhhbiBpdGVtIHByaWNlCQAFFAAAAAIJAARMAAAAAgkBAAAAC1N0cmluZ0VudHJ5AAAAAgkAASwAAAACCQABLAAAAAIJAAEsAAAAAgIAAAAVc3RhdHVzOnB1cmNoYXNlX2l0ZW1fBQAAAAthY2NvdW50TmFtZQIAAAAKX2N1c3RvbWVyXwUAAAAPY3VzdG9tZXJBZGRyZXNzAgAAAAljb25maXJtZWQJAARMAAAAAgkBAAAADEludGVnZXJFbnRyeQAAAAIJAAEsAAAAAgkAASwAAAACCQABLAAAAAICAAAAFHByaWNlOnB1cmNoYXNlX2l0ZW1fBQAAAAthY2NvdW50TmFtZQIAAAAKX2N1c3RvbWVyXwUAAAAPY3VzdG9tZXJBZGRyZXNzBQAAAAVwcmljZQUAAAADbmlsBQAAAAR1bml0AAAAABP+bHo=", "height": 1966242, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: FojoH3QYVEtEYvFUCPtgDxLzuUZsjhYRXHSZ2Rfz6Jyn Next: EHVLtGp9TM6QhaC2Rgv3XYvDb8rb4XgKFR6ixCSnviHx Diff:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
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 (b) = { | |
8 | - | let c = if ((size(a.payments) == 1)) | |
9 | - | then a.payments[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 | |
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 item price") | |
70 | + | else if ((t(j) != a)) | |
71 | + | then throw("an item is already exist") | |
72 | + | else $Tuple2([StringEntry(s(j), A), IntegerEntry(i(j), y), StringEntry(r(j), z)], unit) | |
73 | + | } | |
74 | + | ||
75 | + | ||
76 | + | ||
77 | + | @Callable(x) | |
78 | + | func purchase (B) = { | |
79 | + | let C = if ((size(x.payments) == 1)) | |
80 | + | then x.payments[0] | |
10 | 81 | else throw("Attached payment is required") | |
11 | - | if (isDefined( | |
82 | + | if (isDefined(C.assetId)) | |
12 | 83 | then throw("can use WAVES only at the moment") | |
13 | 84 | else { | |
14 | - | let | |
15 | - | let | |
16 | - | let | |
17 | - | if ($isInstanceOf( | |
85 | + | let D = toBase58String(x.caller.bytes) | |
86 | + | let y = { | |
87 | + | let e = getInteger(this, (("item_" + B) + "_coupon_price")) | |
88 | + | if ($isInstanceOf(e, "Int")) | |
18 | 89 | then { | |
19 | - | let | |
20 | - | | |
90 | + | let f = e | |
91 | + | f | |
21 | 92 | } | |
22 | 93 | else 0 | |
23 | 94 | } | |
24 | - | if (( | |
95 | + | if ((y > C.amount)) | |
25 | 96 | then throw("purchase amount cannot be less than item price") | |
26 | - | else if (( | |
97 | + | else if ((C.amount > y)) | |
27 | 98 | then throw("purchase amount cannot be higher than item price") | |
28 | - | else $Tuple2([StringEntry(((("status:purchase_item_" + | |
99 | + | else $Tuple2([StringEntry(((("status:purchase_item_" + B) + "_customer_") + D), "confirmed"), IntegerEntry(((("price:purchase_item_" + B) + "_customer_") + D), y)], unit) | |
29 | 100 | } | |
30 | 101 | } | |
31 | 102 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
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 (b) = { | |
8 | - | let c = if ((size(a.payments) == 1)) | |
9 | - | then a.payments[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 | |
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 item price") | |
70 | + | else if ((t(j) != a)) | |
71 | + | then throw("an item is already exist") | |
72 | + | else $Tuple2([StringEntry(s(j), A), IntegerEntry(i(j), y), StringEntry(r(j), z)], unit) | |
73 | + | } | |
74 | + | ||
75 | + | ||
76 | + | ||
77 | + | @Callable(x) | |
78 | + | func purchase (B) = { | |
79 | + | let C = if ((size(x.payments) == 1)) | |
80 | + | then x.payments[0] | |
10 | 81 | else throw("Attached payment is required") | |
11 | - | if (isDefined( | |
82 | + | if (isDefined(C.assetId)) | |
12 | 83 | then throw("can use WAVES only at the moment") | |
13 | 84 | else { | |
14 | - | let | |
15 | - | let | |
16 | - | let | |
17 | - | if ($isInstanceOf( | |
85 | + | let D = toBase58String(x.caller.bytes) | |
86 | + | let y = { | |
87 | + | let e = getInteger(this, (("item_" + B) + "_coupon_price")) | |
88 | + | if ($isInstanceOf(e, "Int")) | |
18 | 89 | then { | |
19 | - | let | |
20 | - | | |
90 | + | let f = e | |
91 | + | f | |
21 | 92 | } | |
22 | 93 | else 0 | |
23 | 94 | } | |
24 | - | if (( | |
95 | + | if ((y > C.amount)) | |
25 | 96 | then throw("purchase amount cannot be less than item price") | |
26 | - | else if (( | |
97 | + | else if ((C.amount > y)) | |
27 | 98 | then throw("purchase amount cannot be higher than item price") | |
28 | - | else $Tuple2([StringEntry(((("status:purchase_item_" + | |
99 | + | else $Tuple2([StringEntry(((("status:purchase_item_" + B) + "_customer_") + D), "confirmed"), IntegerEntry(((("price:purchase_item_" + B) + "_customer_") + D), y)], unit) | |
29 | 100 | } | |
30 | 101 | } | |
31 | 102 | ||
32 | 103 |
github/deemru/w8io/026f985 26.60 ms ◑