tx · 4Q9mi4c6aa9MAZpEX1u9ji4V79qDpyRZ3uGEWm4skKXQ

3NAH9wsZ5Gr1LW7eZTnbbFAGL3omhKK7YWK:  -0.01000000 Waves

2022.04.30 15:52 [2031218] smart account 3NAH9wsZ5Gr1LW7eZTnbbFAGL3omhKK7YWK > SELF 0.00000000 Waves

{ "type": 13, "id": "4Q9mi4c6aa9MAZpEX1u9ji4V79qDpyRZ3uGEWm4skKXQ", "fee": 1000000, "feeAssetId": null, "timestamp": 1651323159806, "version": 2, "chainId": 84, "sender": "3NAH9wsZ5Gr1LW7eZTnbbFAGL3omhKK7YWK", "senderPublicKey": "EdiZKeSSzmoYqkk6ce532zc65KcUXi9HckEuP7sWPHmW", "proofs": [ "DeLuwtzyt4B87L3t4ndixXmrvHbzUx8ogjNwdNtcoEzhWGoowWPMh227f6EA1UUJyMBFLU4Eevo5CGRynbjumAD" ], "script": "base64:AAIDAAAAAAAAAA4IARIFCgMIAQgSAwoBCAAAAA0AAAAABE5PTkUCAAAABG5vbmUBAAAADmdldE51bWJlckJ5S2V5AAAAAQAAAANrZXkEAAAAA251bQQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQAAAAAAAAAAAAUAAAADbnVtAQAAAAtnZXRTdHJCeUtleQAAAAEAAAADa2V5BAAAAANzdHIEAAAAByRtYXRjaDAJAAQdAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAAZTdHJpbmcEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEFAAAABE5PTkUFAAAAA3N0cgEAAAAPZ2V0S2V5SXRlbVByaWNlAAAAAQAAAARpdGVtCQABLAAAAAIFAAAABGl0ZW0CAAAABl9wcmljZQEAAAARZ2V0VmFsdWVJdGVtUHJpY2UAAAABAAAABGl0ZW0JAQAAAA5nZXROdW1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QQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzCQABLAAAAAIJAAEsAAAAAgIAAAAFaXRlbV8FAAAABmNvdXBvbgIAAAANX2NvdXBvbl9wcmljZQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhAAAAAAAAAAAAAwkAAGYAAAACBQAAAAVwcmljZQgFAAAAA3BtdAAAAAZhbW91bnQJAAACAAAAAQIAAAAucHVyY2hhc2UgYW1vdW50IGNhbm5vdCBiZSBsZXNzIHRoYW4gaXRlbSBwcmljZQMJAABmAAAAAggFAAAAA3BtdAAAAAZhbW91bnQFAAAABXByaWNlCQAAAgAAAAECAAAAMHB1cmNoYXNlIGFtb3VudCBjYW5ub3QgYmUgaGlnaGVyIHRoYW4gaXRlbSBwcmljZQkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkAASwAAAACCQABLAAAAAIJAAEsAAAAAgIAAAAVc3RhdHVzOnB1cmNoYXNlX2l0ZW1fBQAAAAZjb3Vwb24CAAAACl9jdXN0b21lcl8FAAAAD2N1c3RvbWVyQWRkcmVzcwIAAAAJY29uZmlybWVkCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQABLAAAAAIJAAEsAAAAAgkAASwAAAACAgAAABRwcmljZTpwdXJjaGFzZV9pdGVtXwUAAAAGY291cG9uAgAAAApfY3VzdG9tZXJfBQAAAA9jdXN0b21lckFkZHJlc3MFAAAABXByaWNlBQAAAANuaWwAAAAA4jZVMA==", "height": 2031218, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 5iEA3oZjeqTBadABVhbNQaX5Mf6NhPwP57Ui3JK4vovL Next: 25JMQu2Eku8ER5ZwD7ybznMJASw9u49LxCZXmPSevb7A Diff:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# 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+ }
418
519
6-@Callable(a)
7-func purchase () = {
8- let b = extract(a.payment)
9- if (isDefined(b.assetId))
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 thanitem price")
70+ else if ((t(j) != a))
71+ then throw("an item is already exist")
72+ else WriteSet([DataEntry(s(j), A), DataEntry(i(j), y), DataEntry(r(j), z)])
73+ }
74+
75+
76+
77+@Callable(x)
78+func purchase (B) = {
79+ let C = extract(x.payment)
80+ if (isDefined(C.assetId))
1081 then throw("can use WAVES only at the moment")
1182 else {
12- let c = toBase58String(a.caller.bytes)
13- let d = {
14- let e = getInteger(this, "item_A_coupon_price")
83+ let D = toBase58String(x.caller.bytes)
84+ let y = {
85+ let e = getInteger(this, (("item_" + B) + "_coupon_price"))
1586 if ($isInstanceOf(e, "Int"))
1687 then {
1788 let f = e
1990 }
2091 else 0
2192 }
22- if ((d > b.amount))
93+ if ((y > C.amount))
2394 then throw("purchase amount cannot be less than item price")
24- else if ((b.amount > d))
95+ else if ((C.amount > y))
2596 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)])
97+ else WriteSet([DataEntry(((("status:purchase_item_" + B) + "_customer_") + D), "confirmed"), DataEntry(((("price:purchase_item_" + B) + "_customer_") + D), y)])
2798 }
2899 }
29100
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# 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+ }
418
519
6-@Callable(a)
7-func purchase () = {
8- let b = extract(a.payment)
9- if (isDefined(b.assetId))
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 thanitem price")
70+ else if ((t(j) != a))
71+ then throw("an item is already exist")
72+ else WriteSet([DataEntry(s(j), A), DataEntry(i(j), y), DataEntry(r(j), z)])
73+ }
74+
75+
76+
77+@Callable(x)
78+func purchase (B) = {
79+ let C = extract(x.payment)
80+ if (isDefined(C.assetId))
1081 then throw("can use WAVES only at the moment")
1182 else {
12- let c = toBase58String(a.caller.bytes)
13- let d = {
14- let e = getInteger(this, "item_A_coupon_price")
83+ let D = toBase58String(x.caller.bytes)
84+ let y = {
85+ let e = getInteger(this, (("item_" + B) + "_coupon_price"))
1586 if ($isInstanceOf(e, "Int"))
1687 then {
1788 let f = e
1889 f
1990 }
2091 else 0
2192 }
22- if ((d > b.amount))
93+ if ((y > C.amount))
2394 then throw("purchase amount cannot be less than item price")
24- else if ((b.amount > d))
95+ else if ((C.amount > y))
2596 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)])
97+ else WriteSet([DataEntry(((("status:purchase_item_" + B) + "_customer_") + D), "confirmed"), DataEntry(((("price:purchase_item_" + B) + "_customer_") + D), y)])
2798 }
2899 }
29100
30101

github/deemru/w8io/026f985 
33.67 ms