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:AAIFAAAAAAAAAcQIAhIDCgEIGgoKAmExEgROT05FGhQKAmEyEg5nZXROdW1iZXJCeUtleRoJCgJhMxIDa2V5GgkKAmE0EgNudW0aDQoCYTUSByRtYXRjaDAaBwoCYTYSAWEaEQoCYTcSC2dldFN0ckJ5S2V5GgkKAmE4EgNzdHIaFQoCYTkSD2dldEtleUl0ZW1QcmljZRoKCgJiMRIEaXRlbRoXCgJiMhIRZ2V0VmFsdWVJdGVtUHJpY2UaGwoCYjMSFWdldEtleVVzZXJJdGVtQ291bnRlchoKCgJiNBIEdXNlchodCgJiNRIXZ2V0VmFsdWVVc2VySXRlbUNvdW50ZXIaGAoCYjYSEmdldEtleUl0ZW1TdXBwbGllchoaCgJiNxIUZ2V0VmFsdWVJdGVtU3VwcGxpZXIaGwoCYjgSFWdldEtleUJhbGFuY2VTdXBwbGllchoNCgJiORIHYWNjb3VudBodCgJjMRIXZ2V0VmFsdWVCYWxhbmNlU3VwcGxpZXIaBwoCYzISAWkaCQoCYzMSA3BtdBoRCgJjNBILdXNlckFkZHJlc3MaCwoCYzUSBXByaWNlGhQKAmM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AgAAAB5XQVZFUyB0b2tlbiBvbmx5IGF0IHRoZSBtb21lbnQEAAAAAmM0CQACWAAAAAEICAUAAAACYzIAAAAGY2FsbGVyAAAABWJ5dGVzBAAAAAJjNQkBAAAAAmIyAAAAAQUAAAACYjEEAAAAAmM2CQEAAAACYjcAAAABBQAAAAJiMQMJAABmAAAAAgUAAAACYzUIBQAAAAJjMwAAAAZhbW91bnQJAAACAAAAAQIAAAAtcHVyY2hhc2UgYW11bnQgY2Fubm90IGJlIGxlc3MgdGhhbiBpdGVtIHByaWNlAwkAAGYAAAACCAUAAAACYzMAAAAGYW1vdW50BQAAAAJjNQkAAAIAAAABAgAAADBwdXJjaGFzZSBhbW91bnQgY2Fubm90IGJlIGhpZ2hlciB0aGFuIGl0ZW0gcHJpY2UDCQAAAAAAAAIFAAAAAmM2BQAAAAJhMQkAAAIAAAABAgAAAB5TdXBwbGllciBhZGRyZXNzIGRvZXNuJ3QgZXhpc3QJAARMAAAAAgkBAAAADEludGVnZXJFbnRyeQAAAAIJAQAAAAJiMwAAAAIFAAAAAmM0BQAAAAJiMQkAAGQAAAACCQEAAAACYjUAAAACBQAAAAJjNAUAAAACYjEAAAAAAAAAAAEJAARMAAAAAgkBAAAADEludGVnZXJFbnRyeQAAAAIJAQAAAAJiOAAAAAEFAAAAAmM2CQAAZAAAAAIJAQAAAAJjMQAAAAEFAAAAAmM2CAUAAAACYzMAAAAGYW1vdW50BQAAAANuaWwAAAAAT0GD2g==", "height": 1603064, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 8d9yAQpheVaENo85ZwCNQ9nhQKMAUqLtw6sgCfEDMxsd Next: vWcCUP2hmEfqY76RapkjBHy55S5VTDW3F2UzJYY9q2P Diff:
OldNewDifferences
55
66 func b (c) = {
77 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 = {
822 let e = getString(this, c)
923 if ($isInstanceOf(e, "String"))
1024 then {
1327 }
1428 else a
1529 }
16- d
30+ h
1731 }
1832
1933
20-func g (h) = (h + "_price")
34+func i (j) = (j + "_price")
2135
2236
23-func i (j,k) = ("item_" + toBase58String(sha256(toBytes((j + k)))))
37+func k (j) = b(i(j))
2438
2539
26-func l (h) = (h + "_data")
40+func l (m,j) = (((j + "_") + m) + "_cnt")
2741
2842
29-func m (h) = (h + "_data")
43+func n (m,j) = b(l(m, j))
3044
3145
32-func n (h) = b(m(h))
46+func o (j) = (j + "_data")
3347
3448
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+ }
4475 }
4576
4677
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let a = "none"
55
66 func b (c) = {
77 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 = {
822 let e = getString(this, c)
923 if ($isInstanceOf(e, "String"))
1024 then {
1125 let f = e
1226 f
1327 }
1428 else a
1529 }
16- d
30+ h
1731 }
1832
1933
20-func g (h) = (h + "_price")
34+func i (j) = (j + "_price")
2135
2236
23-func i (j,k) = ("item_" + toBase58String(sha256(toBytes((j + k)))))
37+func k (j) = b(i(j))
2438
2539
26-func l (h) = (h + "_data")
40+func l (m,j) = (((j + "_") + m) + "_cnt")
2741
2842
29-func m (h) = (h + "_data")
43+func n (m,j) = b(l(m, j))
3044
3145
32-func n (h) = b(m(h))
46+func o (j) = (j + "_data")
3347
3448
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+ }
4475 }
4576
4677

github/deemru/w8io/026f985 
25.51 ms