tx · 7AZAbkKJcjr7Cduct2433dDyb9Bgnxuz484Gxs4qugUV

3MzFjVphaDKp1oZjd5KmCYou3wCzCzTmEFe:  -0.00300000 Waves

2022.09.20 22:17 [2237872] smart account 3MzFjVphaDKp1oZjd5KmCYou3wCzCzTmEFe > SELF 0.00000000 Waves

{ "type": 13, "id": "7AZAbkKJcjr7Cduct2433dDyb9Bgnxuz484Gxs4qugUV", "fee": 300000, "feeAssetId": null, "timestamp": 1663701479892, "version": 2, "chainId": 84, "sender": "3MzFjVphaDKp1oZjd5KmCYou3wCzCzTmEFe", "senderPublicKey": "FFVf3kC6HkjRMmf8W6Zr2bNKhJ5EN5W1vG44GbgvHd9Z", "proofs": [ "AH77aHC8G9jD8fg9ds7uKpUUHzbE4zRnyqHi6SoZf1w7WMAFYZMaqD71j35B36xqQPUMmXsHMpv47jDDVbDabvV" ], "script": "base64:AAIDAAAAAAAAAA4IARIDCgEIEgUKAwgBCAAAAA0AAAAABE5PTkUCAAAABG5vbmUBAAAADmdldE51bWJlckJ5S2V5AAAAAQAAAANrZXkEAAAAA251bQQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQAAAAAAAAAAAAUAAAADbnVtAQAAAAtnZXRTdHJCeUtleQAAAAEAAAADa2V5BAAAAANzdHIEAAAAByRtYXRjaDAJAAQdAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAAZTdHJpbmcEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEFAAAABE5PTkUFAAAAA3N0cgEAAAAPZ2V0S2V5SXRlbVByaWNlAAAAAQAAAARpdGVtCQABLAAAAAIFAAAABGl0ZW0CAAAABl9wcmljZQEAAAARZ2V0VmFsdWVJdGVtUHJpY2UAAAABAAAABGl0ZW0JAQAAAA5nZXROdW1iZXJCeUtleQAAA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XRlbQAAAAMAAAAFdGl0bGUAAAAFcHJpY2UAAAAEZGF0YQQAAAAPc3VwcGxpZXJBZGRyZXNzCQACWAAAAAEICAUAAAABaQAAAAZjYWxsZXIAAAAFYnl0ZXMEAAAABGl0ZW0JAQAAAApnZXRLZXlJdGVtAAAAAgUAAAAPc3VwcGxpZXJBZGRyZXNzBQAAAAV0aXRsZQMJAABnAAAAAgAAAAAAAAAAAAUAAAAFcHJpY2UJAAACAAAAAQIAAAArcHVyY2hhc2UgY2Fubm90IGJlIGxlc3MgdGhhbiB0aGUgaXRlbSBwcmljZQMJAQAAAAIhPQAAAAIJAQAAABRnZXRWYWx1ZUl0ZW1TdXBwbGllcgAAAAEFAAAABGl0ZW0FAAAABE5PTkUJAAACAAAAAQIAAAAYVGhlIGl0ZW0gYWxyZWFkeSBleGl0c3RzCQEAAAAIV3JpdGVTZXQAAAABCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQEAAAASZ2V0S2V5SXRlbVN1cHBsaWVyAAAAAQUAAAAEaXRlbQUAAAAPc3VwcGxpZXJBZGRyZXNzCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQEAAAAPZ2V0S2V5SXRlbVByaWNlAAAAAQUAAAAEaXRlbQUAAAAFcHJpY2UJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAQAAAA5nZXRLZXlJdGVtRGF0YQAAAAEFAAAABGl0ZW0FAAAABGRhdGEFAAAAA25pbAAAAACVl79s", "height": 2237872, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: G6DAxYWgrrwBWBFg4uwSHuQHzqxV8y7fjyjruXmhRAJf Next: LzGFe5oDRvadGJqCpt8fUXcb1cSp2WmFdCLsMk7LbAm Diff:
OldNewDifferences
1919
2020 func g (c) = {
2121 let h = {
22- let e = getInteger(this, c)
23- if ($isInstanceOf(e, "Int"))
22+ let e = getString(this, c)
23+ if ($isInstanceOf(e, "String"))
2424 then {
2525 let f = e
2626 f
6262
6363
6464 @Callable(x)
65-func purchase (y) = {
66- let z = extract(x.payment)
67- if (isDefined(z.assetId))
65+func purchase (j) = {
66+ let y = extract(x.payment)
67+ if (isDefined(y.assetId))
6868 then throw("can use WAVES only at the moment")
6969 else {
70- let A = toBase58String(x.caller.bytes)
71- let B = {
72- let e = getInteger(this, (("Item_" + y) + "_coupon_price"))
73- if ($isInstanceOf(e, "Int"))
74- then {
75- let f = e
76- f
77- }
78- else 0
79- }
80- if ((z.amount != B))
70+ let z = toBase58String(x.caller.bytes)
71+ let A = k(j)
72+ let B = t(j)
73+ if ((y.amount != A))
8174 then throw("Purchase amount should be equal to price ")
82- else WriteSet([DataEntry(((("status: purchase_item_" + y) + "_customer_") + A), "confirmed"), DataEntry(((("price: purchase_item_" + y) + "_customer_") + A), B)])
75+ else if ((B == a))
76+ then throw("The supplier does not exist")
77+ else WriteSet([DataEntry(l(z, j), (n(z, j) + 1)), DataEntry(u(B), (w(B) + y.amount))])
8378 }
8479 }
8580
8681
8782
8883 @Callable(x)
89-func addItem (q,B,C) = {
90- let D = toBase58String(x.caller.bytes)
91- let j = o(D, q)
92- if ((0 >= B))
84+func addItem (q,A,C) = {
85+ let B = toBase58String(x.caller.bytes)
86+ let j = o(B, q)
87+ if ((0 >= A))
9388 then throw("purchase cannot be less than the item price")
9489 else if ((t(j) != a))
9590 then throw("The item already exitsts")
96- else WriteSet([DataEntry(s(j), D), DataEntry(i(j), B), DataEntry(r(j), C)])
91+ else WriteSet([DataEntry(s(j), B), DataEntry(i(j), A), DataEntry(r(j), C)])
9792 }
9893
9994
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let a = "none"
55
66 func b (c) = {
77 let d = {
88 let e = getInteger(this, c)
99 if ($isInstanceOf(e, "Int"))
1010 then {
1111 let f = e
1212 f
1313 }
1414 else 0
1515 }
1616 d
1717 }
1818
1919
2020 func g (c) = {
2121 let h = {
22- let e = getInteger(this, c)
23- if ($isInstanceOf(e, "Int"))
22+ let e = getString(this, c)
23+ if ($isInstanceOf(e, "String"))
2424 then {
2525 let f = e
2626 f
2727 }
2828 else a
2929 }
3030 h
3131 }
3232
3333
3434 func i (j) = (j + "_price")
3535
3636
3737 func k (j) = b(i(j))
3838
3939
4040 func l (m,j) = (((j + "_") + m) + "_cnt")
4141
4242
4343 func n (m,j) = b(l(m, j))
4444
4545
4646 func o (p,q) = ("item_" + toBase58String(sha256(toBytes((p + q)))))
4747
4848
4949 func r (j) = (j + "_data")
5050
5151
5252 func s (j) = (j + "_owner")
5353
5454
5555 func t (j) = g(s(j))
5656
5757
5858 func u (v) = (v + "_balance")
5959
6060
6161 func w (v) = b(u(v))
6262
6363
6464 @Callable(x)
65-func purchase (y) = {
66- let z = extract(x.payment)
67- if (isDefined(z.assetId))
65+func purchase (j) = {
66+ let y = extract(x.payment)
67+ if (isDefined(y.assetId))
6868 then throw("can use WAVES only at the moment")
6969 else {
70- let A = toBase58String(x.caller.bytes)
71- let B = {
72- let e = getInteger(this, (("Item_" + y) + "_coupon_price"))
73- if ($isInstanceOf(e, "Int"))
74- then {
75- let f = e
76- f
77- }
78- else 0
79- }
80- if ((z.amount != B))
70+ let z = toBase58String(x.caller.bytes)
71+ let A = k(j)
72+ let B = t(j)
73+ if ((y.amount != A))
8174 then throw("Purchase amount should be equal to price ")
82- else WriteSet([DataEntry(((("status: purchase_item_" + y) + "_customer_") + A), "confirmed"), DataEntry(((("price: purchase_item_" + y) + "_customer_") + A), B)])
75+ else if ((B == a))
76+ then throw("The supplier does not exist")
77+ else WriteSet([DataEntry(l(z, j), (n(z, j) + 1)), DataEntry(u(B), (w(B) + y.amount))])
8378 }
8479 }
8580
8681
8782
8883 @Callable(x)
89-func addItem (q,B,C) = {
90- let D = toBase58String(x.caller.bytes)
91- let j = o(D, q)
92- if ((0 >= B))
84+func addItem (q,A,C) = {
85+ let B = toBase58String(x.caller.bytes)
86+ let j = o(B, q)
87+ if ((0 >= A))
9388 then throw("purchase cannot be less than the item price")
9489 else if ((t(j) != a))
9590 then throw("The item already exitsts")
96- else WriteSet([DataEntry(s(j), D), DataEntry(i(j), B), DataEntry(r(j), C)])
91+ else WriteSet([DataEntry(s(j), B), DataEntry(i(j), A), DataEntry(r(j), C)])
9792 }
9893
9994

github/deemru/w8io/169f3d6 
54.80 ms