tx · AzAEvBHtfnCsQHcnd61HGPZGaeGjaWBibsxjtDwak3xb 3NA37aEhY3CSPtrXjKUsNibx5i45P7FxuA4: -0.01000010 Waves 2021.07.07 13:24 [1603064] smart account 3NA37aEhY3CSPtrXjKUsNibx5i45P7FxuA4 > SELF 0.00000000 Waves
{ "type": 13, "id": "AzAEvBHtfnCsQHcnd61HGPZGaeGjaWBibsxjtDwak3xb", "fee": 1000010, "feeAssetId": null, "timestamp": 1625653554112, "version": 2, "chainId": 84, "sender": "3NA37aEhY3CSPtrXjKUsNibx5i45P7FxuA4", "senderPublicKey": "B3Kkg7AgjdZYrAW5kNXeBi1KfWcjdiHpEnu3tsfirQPy", "proofs": [ "2YhbYvP2HhvgfyMH6KgYL21JzRLJxAYV9baymNiy4Sgdm1rXaRqQGpibJoUBr9jdKzpZ5CjtJe7ZErMiSRRDbzGF" ], "script": "base64:AAIFAAAAAAAAAcQIAhIDCgEIGgoKAmExEgROT05FGhQKAmEyEg5nZXROdW1iZXJCeUtleRoJCgJhMxIDa2V5GgkKAmE0EgNudW0aDQoCYTUSByRtYXRjaDAaBwoCYTYSAWEaEQoCYTcSC2dldFN0ckJ5S2V5GgkKAmE4EgNzdHIaFQoCYTkSD2dldEtleUl0ZW1QcmljZRoKCgJiMRIEaXRlbRoXCgJiMhIRZ2V0VmFsdWVJdGVtUHJpY2UaGwoCYjMSFWdldEtleVVzZXJJdGVtQ291bnRlchoKCgJiNBIEdXNlchodCgJiNRIXZ2V0VmFsdWVVc2VySXRlbUNvdW50ZXIaGAoCYjYSEmdldEtleUl0ZW1TdXBwbGllchoaCgJiNxIUZ2V0VmFsdWVJdGVtU3VwcGxpZXIaGwoCYjgSFWdldEtleUJhbGFuY2VTdXBwbGllchoNCgJiORIHYWNjb3VudBodCgJjMRIXZ2V0VmFsdWVCYWxhbmNlU3VwcGxpZXIaBwoCYzISAWkaCQoCYzMSA3BtdBoRCgJjNBILdXNlckFkZHJlc3MaCwoCYzUSBXByaWNlGhQKAmM2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gAAAB5XQVZFUyB0b2tlbiBvbmx5IGF0IHRoZSBtb21lbnQEAAAAAmM0CQACWAAAAAEICAUAAAACYzIAAAAGY2FsbGVyAAAABWJ5dGVzBAAAAAJjNQkBAAAAAmIyAAAAAQUAAAACYjEEAAAAAmM2CQEAAAACYjcAAAABBQAAAAJiMQMJAABmAAAAAgUAAAACYzUIBQAAAAJjMwAAAAZhbW91bnQJAAACAAAAAQIAAAAtcHVyY2hhc2UgYW11bnQgY2Fubm90IGJlIGxlc3MgdGhhbiBpdGVtIHByaWNlAwkAAGYAAAACCAUAAAACYzMAAAAGYW1vdW50BQAAAAJjNQkAAAIAAAABAgAAADBwdXJjaGFzZSBhbW91bnQgY2Fubm90IGJlIGhpZ2hlciB0aGFuIGl0ZW0gcHJpY2UDCQAAAAAAAAIFAAAAAmM2BQAAAAJhMQkAAAIAAAABAgAAAB5TdXBwbGllciBhZGRyZXNzIGRvZXNuJ3QgZXhpc3QJAARMAAAAAgkBAAAADEludGVnZXJFbnRyeQAAAAIJAQAAAAJiMwAAAAIFAAAAAmM0BQAAAAJiMQkAAGQAAAACCQEAAAACYjUAAAACBQAAAAJjNAUAAAACYjEAAAAAAAAAAAEJAARMAAAAAgkBAAAADEludGVnZXJFbnRyeQAAAAIJAQAAAAJiOAAAAAEFAAAAAmM2CQAAZAAAAAIJAQAAAAJjMQAAAAEFAAAAAmM2CAUAAAACYzMAAAAGYW1vdW50BQAAAANuaWwAAAAAT0GD2g==", "height": 1603064, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 8d9yAQpheVaENo85ZwCNQ9nhQKMAUqLtw6sgCfEDMxsd Next: vWcCUP2hmEfqY76RapkjBHy55S5VTDW3F2UzJYY9q2P Diff:
Old | New | Differences | |
---|---|---|---|
5 | 5 | ||
6 | 6 | func b (c) = { | |
7 | 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 | + | } | |
18 | + | ||
19 | + | ||
20 | + | func g (c) = { | |
21 | + | let h = { | |
8 | 22 | let e = getString(this, c) | |
9 | 23 | if ($isInstanceOf(e, "String")) | |
10 | 24 | then { | |
13 | 27 | } | |
14 | 28 | else a | |
15 | 29 | } | |
16 | - | | |
30 | + | h | |
17 | 31 | } | |
18 | 32 | ||
19 | 33 | ||
20 | - | func | |
34 | + | func i (j) = (j + "_price") | |
21 | 35 | ||
22 | 36 | ||
23 | - | func | |
37 | + | func k (j) = b(i(j)) | |
24 | 38 | ||
25 | 39 | ||
26 | - | func l ( | |
40 | + | func l (m,j) = (((j + "_") + m) + "_cnt") | |
27 | 41 | ||
28 | 42 | ||
29 | - | func | |
43 | + | func n (m,j) = b(l(m, j)) | |
30 | 44 | ||
31 | 45 | ||
32 | - | func | |
46 | + | func o (j) = (j + "_data") | |
33 | 47 | ||
34 | 48 | ||
35 | - | @Callable(o) | |
36 | - | func addItem (k,p,q) = { | |
37 | - | let r = toBase58String(o.caller.bytes) | |
38 | - | let h = i(r, k) | |
39 | - | if ((0 >= p)) | |
40 | - | then throw("purchase amount cannot be less than item price") | |
41 | - | else if ((n(h) != a)) | |
42 | - | then throw("an item is already exist") | |
43 | - | else [StringEntry(m(h), r), IntegerEntry(g(h), p), StringEntry(l(h), q)] | |
49 | + | func p (j) = g(o(j)) | |
50 | + | ||
51 | + | ||
52 | + | func q (r) = (r + "_balance") | |
53 | + | ||
54 | + | ||
55 | + | func s (r) = b(q(r)) | |
56 | + | ||
57 | + | ||
58 | + | @Callable(t) | |
59 | + | func purchase (j) = { | |
60 | + | let u = t.payments[0] | |
61 | + | if (isDefined(u.assetId)) | |
62 | + | then throw("WAVES token only at the moment") | |
63 | + | else { | |
64 | + | let v = toBase58String(t.caller.bytes) | |
65 | + | let w = k(j) | |
66 | + | let x = p(j) | |
67 | + | if ((w > u.amount)) | |
68 | + | then throw("purchase amunt cannot be less than item price") | |
69 | + | else if ((u.amount > w)) | |
70 | + | then throw("purchase amount cannot be higher than item price") | |
71 | + | else if ((x == a)) | |
72 | + | then throw("Supplier address doesn't exist") | |
73 | + | else [IntegerEntry(l(v, j), (n(v, j) + 1)), IntegerEntry(q(x), (s(x) + u.amount))] | |
74 | + | } | |
44 | 75 | } | |
45 | 76 | ||
46 | 77 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
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 | + | 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 | + | } | |
18 | + | ||
19 | + | ||
20 | + | func g (c) = { | |
21 | + | let h = { | |
8 | 22 | let e = getString(this, c) | |
9 | 23 | if ($isInstanceOf(e, "String")) | |
10 | 24 | then { | |
11 | 25 | let f = e | |
12 | 26 | f | |
13 | 27 | } | |
14 | 28 | else a | |
15 | 29 | } | |
16 | - | | |
30 | + | h | |
17 | 31 | } | |
18 | 32 | ||
19 | 33 | ||
20 | - | func | |
34 | + | func i (j) = (j + "_price") | |
21 | 35 | ||
22 | 36 | ||
23 | - | func | |
37 | + | func k (j) = b(i(j)) | |
24 | 38 | ||
25 | 39 | ||
26 | - | func l ( | |
40 | + | func l (m,j) = (((j + "_") + m) + "_cnt") | |
27 | 41 | ||
28 | 42 | ||
29 | - | func | |
43 | + | func n (m,j) = b(l(m, j)) | |
30 | 44 | ||
31 | 45 | ||
32 | - | func | |
46 | + | func o (j) = (j + "_data") | |
33 | 47 | ||
34 | 48 | ||
35 | - | @Callable(o) | |
36 | - | func addItem (k,p,q) = { | |
37 | - | let r = toBase58String(o.caller.bytes) | |
38 | - | let h = i(r, k) | |
39 | - | if ((0 >= p)) | |
40 | - | then throw("purchase amount cannot be less than item price") | |
41 | - | else if ((n(h) != a)) | |
42 | - | then throw("an item is already exist") | |
43 | - | else [StringEntry(m(h), r), IntegerEntry(g(h), p), StringEntry(l(h), q)] | |
49 | + | func p (j) = g(o(j)) | |
50 | + | ||
51 | + | ||
52 | + | func q (r) = (r + "_balance") | |
53 | + | ||
54 | + | ||
55 | + | func s (r) = b(q(r)) | |
56 | + | ||
57 | + | ||
58 | + | @Callable(t) | |
59 | + | func purchase (j) = { | |
60 | + | let u = t.payments[0] | |
61 | + | if (isDefined(u.assetId)) | |
62 | + | then throw("WAVES token only at the moment") | |
63 | + | else { | |
64 | + | let v = toBase58String(t.caller.bytes) | |
65 | + | let w = k(j) | |
66 | + | let x = p(j) | |
67 | + | if ((w > u.amount)) | |
68 | + | then throw("purchase amunt cannot be less than item price") | |
69 | + | else if ((u.amount > w)) | |
70 | + | then throw("purchase amount cannot be higher than item price") | |
71 | + | else if ((x == a)) | |
72 | + | then throw("Supplier address doesn't exist") | |
73 | + | else [IntegerEntry(l(v, j), (n(v, j) + 1)), IntegerEntry(q(x), (s(x) + u.amount))] | |
74 | + | } | |
44 | 75 | } | |
45 | 76 | ||
46 | 77 |
github/deemru/w8io/026f985 25.51 ms ◑