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:AAIDAAAAAAAAAA4IARIDCgEIEgUKAwgBCAAAAA0AAAAABE5PTkUCAAAABG5vbmUBAAAADmdldE51bWJlckJ5S2V5AAAAAQAAAANrZXkEAAAAA251bQQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQAAAAAAAAAAAAUAAAADbnVtAQAAAAtnZXRTdHJCeUtleQAAAAEAAAADa2V5BAAAAANzdHIEAAAAByRtYXRjaDAJAAQdAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAAZTdHJpbmcEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEFAAAABE5PTkUFAAAAA3N0cgEAAAAPZ2V0S2V5SXRlbVByaWNlAAAAAQAAAARpdGVtCQABLAAAAAIFAAAABGl0ZW0CAAAABl9wcmljZQEAAAARZ2V0VmFsdWVJdGVtUHJpY2UAAAABAAAABGl0ZW0JAQAAAA5nZXROdW1iZXJ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AAAHYWRkSXRlbQAAAAMAAAAFdGl0bGUAAAAFcHJpY2UAAAAEZGF0YQQAAAAPc3VwcGxpZXJBZGRyZXNzCQACWAAAAAEICAUAAAABaQAAAAZjYWxsZXIAAAAFYnl0ZXMEAAAABGl0ZW0JAQAAAApnZXRLZXlJdGVtAAAAAgUAAAAPc3VwcGxpZXJBZGRyZXNzBQAAAAV0aXRsZQMJAABnAAAAAgAAAAAAAAAAAAUAAAAFcHJpY2UJAAACAAAAAQIAAAArcHVyY2hhc2UgY2Fubm90IGJlIGxlc3MgdGhhbiB0aGUgaXRlbSBwcmljZQMJAQAAAAIhPQAAAAIJAQAAABRnZXRWYWx1ZUl0ZW1TdXBwbGllcgAAAAEFAAAABGl0ZW0FAAAABE5PTkUJAAACAAAAAQIAAAAYVGhlIGl0ZW0gYWxyZWFkeSBleGl0c3RzCQEAAAAIV3JpdGVTZXQAAAABCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQEAAAASZ2V0S2V5SXRlbVN1cHBsaWVyAAAAAQUAAAAEaXRlbQUAAAAPc3VwcGxpZXJBZGRyZXNzCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQEAAAAPZ2V0S2V5SXRlbVByaWNlAAAAAQUAAAAEaXRlbQUAAAAFcHJpY2UJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAQAAAA5nZXRLZXlJdGVtRGF0YQAAAAEFAAAABGl0ZW0FAAAABGRhdGEFAAAAA25pbAAAAACVl79s",
"height": 2237872,
"applicationStatus": "succeeded",
"spentComplexity": 0
}
View: original | compacted
Prev: G6DAxYWgrrwBWBFg4uwSHuQHzqxV8y7fjyjruXmhRAJf
Next: LzGFe5oDRvadGJqCpt8fUXcb1cSp2WmFdCLsMk7LbAm
Diff:
Old | New | | Differences |
---|
19 | 19 | | |
---|
20 | 20 | | func g (c) = { |
---|
21 | 21 | | let h = { |
---|
22 | | - | let e = getInteger(this, c) |
---|
23 | | - | if ($isInstanceOf(e, "Int")) |
---|
| 22 | + | let e = getString(this, c) |
---|
| 23 | + | if ($isInstanceOf(e, "String")) |
---|
24 | 24 | | then { |
---|
25 | 25 | | let f = e |
---|
26 | 26 | | f |
---|
|
62 | 62 | | |
---|
63 | 63 | | |
---|
64 | 64 | | @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)) |
---|
68 | 68 | | then throw("can use WAVES only at the moment") |
---|
69 | 69 | | 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)) |
---|
81 | 74 | | 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))]) |
---|
83 | 78 | | } |
---|
84 | 79 | | } |
---|
85 | 80 | | |
---|
86 | 81 | | |
---|
87 | 82 | | |
---|
88 | 83 | | @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)) |
---|
93 | 88 | | then throw("purchase cannot be less than the item price") |
---|
94 | 89 | | else if ((t(j) != a)) |
---|
95 | 90 | | 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)]) |
---|
97 | 92 | | } |
---|
98 | 93 | | |
---|
99 | 94 | | |
---|
Full:
Old | New | | Differences |
---|
1 | 1 | | {-# STDLIB_VERSION 3 #-} |
---|
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 | 8 | | let e = getInteger(this, c) |
---|
9 | 9 | | if ($isInstanceOf(e, "Int")) |
---|
10 | 10 | | then { |
---|
11 | 11 | | let f = e |
---|
12 | 12 | | f |
---|
13 | 13 | | } |
---|
14 | 14 | | else 0 |
---|
15 | 15 | | } |
---|
16 | 16 | | d |
---|
17 | 17 | | } |
---|
18 | 18 | | |
---|
19 | 19 | | |
---|
20 | 20 | | func g (c) = { |
---|
21 | 21 | | let h = { |
---|
22 | | - | let e = getInteger(this, c) |
---|
23 | | - | if ($isInstanceOf(e, "Int")) |
---|
| 22 | + | let e = getString(this, c) |
---|
| 23 | + | if ($isInstanceOf(e, "String")) |
---|
24 | 24 | | then { |
---|
25 | 25 | | let f = e |
---|
26 | 26 | | f |
---|
27 | 27 | | } |
---|
28 | 28 | | else a |
---|
29 | 29 | | } |
---|
30 | 30 | | h |
---|
31 | 31 | | } |
---|
32 | 32 | | |
---|
33 | 33 | | |
---|
34 | 34 | | func i (j) = (j + "_price") |
---|
35 | 35 | | |
---|
36 | 36 | | |
---|
37 | 37 | | func k (j) = b(i(j)) |
---|
38 | 38 | | |
---|
39 | 39 | | |
---|
40 | 40 | | func l (m,j) = (((j + "_") + m) + "_cnt") |
---|
41 | 41 | | |
---|
42 | 42 | | |
---|
43 | 43 | | func n (m,j) = b(l(m, j)) |
---|
44 | 44 | | |
---|
45 | 45 | | |
---|
46 | 46 | | func o (p,q) = ("item_" + toBase58String(sha256(toBytes((p + q))))) |
---|
47 | 47 | | |
---|
48 | 48 | | |
---|
49 | 49 | | func r (j) = (j + "_data") |
---|
50 | 50 | | |
---|
51 | 51 | | |
---|
52 | 52 | | func s (j) = (j + "_owner") |
---|
53 | 53 | | |
---|
54 | 54 | | |
---|
55 | 55 | | func t (j) = g(s(j)) |
---|
56 | 56 | | |
---|
57 | 57 | | |
---|
58 | 58 | | func u (v) = (v + "_balance") |
---|
59 | 59 | | |
---|
60 | 60 | | |
---|
61 | 61 | | func w (v) = b(u(v)) |
---|
62 | 62 | | |
---|
63 | 63 | | |
---|
64 | 64 | | @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)) |
---|
68 | 68 | | then throw("can use WAVES only at the moment") |
---|
69 | 69 | | 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)) |
---|
81 | 74 | | 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))]) |
---|
83 | 78 | | } |
---|
84 | 79 | | } |
---|
85 | 80 | | |
---|
86 | 81 | | |
---|
87 | 82 | | |
---|
88 | 83 | | @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)) |
---|
93 | 88 | | then throw("purchase cannot be less than the item price") |
---|
94 | 89 | | else if ((t(j) != a)) |
---|
95 | 90 | | 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)]) |
---|
97 | 92 | | } |
---|
98 | 93 | | |
---|
99 | 94 | | |
---|