tx · GncBYuA5GbUDbo3pmuTJtciJexs3i9NsiEbN4Q8Wxiff

3N5VEJS8qABqZMgTjpzxzqRyb9wKRZqD8Dk:  -0.01500000 Waves

2019.07.13 13:19 [583833] smart account 3N5VEJS8qABqZMgTjpzxzqRyb9wKRZqD8Dk > SELF 0.00000000 Waves

{ "type": 13, "id": "GncBYuA5GbUDbo3pmuTJtciJexs3i9NsiEbN4Q8Wxiff", "fee": 1500000, "feeAssetId": null, "timestamp": 1563013221845, "version": 1, "sender": "3N5VEJS8qABqZMgTjpzxzqRyb9wKRZqD8Dk", "senderPublicKey": "FiFWqA9QejjZ8t2YAtBeoV7m2X6qBMk2NGNG8cHbkEds", "proofs": [ "2FdJR1nhsD94xgDLrxGD1tutiz5djVM1oxxFXh3V3HRd8XAbZhgHkvzReKCsecUWTx8h2dPBSZrjtV9Tjzqs8T9X" ], "script": "base64:AAIDAAAAAAAAAAAAAAANAAAAAAROT05FAgAAAARub25lAQAAAA5nZXROdW1iZXJCeUtleQAAAAEAAAADa2V5BAAAAANudW0EAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEAAAAAAAAAAAAFAAAAA251bQEAAAALZ2V0U3RyQnlLZXkAAAABAAAAA2tleQQAAAADc3RyBAAAAAckbWF0Y2gwCQAEHQAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAGU3RyaW5nBAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhBQAAAAROT05FBQAAAANzdHIBAAAAD2dldEtleUl0ZW1QcmljZQAAAAEAAAAEaXRlbQkAASwAAAACBQAAAARpdGVtAgAAAAZfcHJpY2UBAAAAEWdldFZhbHVlSXRlbVByaWNlAAAAAQAAAARpdGVtCQEAAAAOZ2V0TnVtYmVyQnlLZXkAAAABCQEAAAAPZ2V0S2V5S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hn Diff:
OldNewDifferences
7373 }
7474
7575
76+
77+@Callable(x)
78+func purchase (j) = {
79+ let B = extract(x.payment)
80+ if (isDefined(B.assetId))
81+ then throw("Waves tokens only at the moment")
82+ else {
83+ let C = toBase58String(x.caller.bytes)
84+ let y = k(j)
85+ let A = t(j)
86+ if ((y > B.amount))
87+ then throw("purchase amount cannot be less then item price")
88+ else if ((B.amount > y))
89+ then throw("purchase amount cannot be higher then item price")
90+ else if ((A == a))
91+ then throw("supplier does not exist")
92+ else WriteSet([DataEntry(l(C, j), (n(C, j) + 1)), DataEntry(u(A), (w(A) + B.amount))])
93+ }
94+ }
95+
96+
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 = {
2222 let e = getString(this, c)
2323 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)
6565 func addItem (q,y,z) = {
6666 let A = toBase58String(x.caller.bytes)
6767 let j = o(A, q)
6868 if ((0 >= y))
6969 then throw("purchase amount cannot be less than item price")
7070 else if ((t(j) != a))
7171 then throw("an item is already exist")
7272 else WriteSet([DataEntry(s(j), A), DataEntry(i(j), A), DataEntry(r(j), A)])
7373 }
7474
7575
76+
77+@Callable(x)
78+func purchase (j) = {
79+ let B = extract(x.payment)
80+ if (isDefined(B.assetId))
81+ then throw("Waves tokens only at the moment")
82+ else {
83+ let C = toBase58String(x.caller.bytes)
84+ let y = k(j)
85+ let A = t(j)
86+ if ((y > B.amount))
87+ then throw("purchase amount cannot be less then item price")
88+ else if ((B.amount > y))
89+ then throw("purchase amount cannot be higher then item price")
90+ else if ((A == a))
91+ then throw("supplier does not exist")
92+ else WriteSet([DataEntry(l(C, j), (n(C, j) + 1)), DataEntry(u(A), (w(A) + B.amount))])
93+ }
94+ }
95+
96+

github/deemru/w8io/026f985 
29.46 ms