tx · BzahxzYZFuNh5PvUKJKQGB4KxPVgrYQC937ZQE1sMCQM
3NAj7owPjfmLoE3odgXC6cXfB1QzEhnpBtt: -0.01400000 Waves
2020.11.18 16:42 [1270858] smart account 3NAj7owPjfmLoE3odgXC6cXfB1QzEhnpBtt > SELF 0.00000000 Waves
{
"type": 13,
"id": "BzahxzYZFuNh5PvUKJKQGB4KxPVgrYQC937ZQE1sMCQM",
"fee": 1400000,
"feeAssetId": null,
"timestamp": 1605707018481,
"version": 2,
"chainId": 84,
"sender": "3NAj7owPjfmLoE3odgXC6cXfB1QzEhnpBtt",
"senderPublicKey": "iRqJrgq4rS2ndNGFJoZtKcoTfskkxr3zfTesPWqtKzp",
"proofs": [
"LQaRtFSSvXkrEQ3pgBauit2JLueLXuCE2vJGSvm2dT571QxjLcU6uUkDx3GWEQYwVDPajnVXFPiXcZZrfRXgKaA"
],
"script": "base64:AAIEAAAAAAAAAA4IAhIDCgEIEgUKAwgBCAAAAAAAAAACAAAAAWkBAAAACHB1cmNoYXNlAAAAAQAAAARpdGVtBAAAAAdwYXltZW50CQEAAAAFdmFsdWUAAAABCQABkQAAAAIIBQAAAAFpAAAACHBheW1lbnRzAAAAAAAAAAAAAwkBAAAACWlzRGVmaW5lZAAAAAEIBQAAAAdwYXltZW50AAAAB2Fzc2V0SWQJAAACAAAAAQIAAAAKV2F2ZXMgb25seQQAAAALdXNlckFkZHJlc3MJAAJYAAAAAQgIBQAAAAFpAAAABmNhbGxlcgAAAAVieXRlcwQAAAAFcHJpY2UJAQAAABFAZXh0ck5hdGl2ZSgxMDUwKQAAAAIFAAAABHRoaXMJAAEsAAAAAgUAAAAEaXRlbQIAAAAGX3ByaWNlBAAAAAhzdXBwbGllcgkBAAAAEUBleHRyTmF0aXZlKDEwNTMpAAAAAgUAAAAEdGhpcwkAASwAAAACBQAAAARpdGVtAgAAAAlfc3VwcGxpZXIDCQAAZgAAAAIFAAAABXByaWNlCAUAAAAHcGF5bWVudAAAAAZhbW91bnQJAA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AAAAAAAAAAUAAAADbmlsAAAAAQAAAAJ0eAEAAAAGdmVyaWZ5AAAAAAZyu/uJ",
"height": 1270858,
"applicationStatus": "succeeded",
"spentComplexity": 0
}
View: original | compacted
Prev: EH3rjfx3jQY3oymHJnWF263qfCuqGB6a9BsYjwNEikZv
Next: 4ppnnPcbAokg66apjxWC9sX6gGmFbkGz9CShCiExuNu5
Diff:
Old | New | | Differences |
---|
7 | 7 | | func purchase (b) = { |
---|
8 | 8 | | let c = value(a.payments[0]) |
---|
9 | 9 | | if (isDefined(c.assetId)) |
---|
10 | | - | then throw("Only Waves are accepted") |
---|
| 10 | + | then throw("Waves only") |
---|
11 | 11 | | else { |
---|
12 | 12 | | let d = toBase58String(a.caller.bytes) |
---|
13 | | - | let e = { |
---|
14 | | - | let f = getInteger(this, (b + "_coupon_price")) |
---|
15 | | - | if ($isInstanceOf(f, "Int")) |
---|
16 | | - | then { |
---|
17 | | - | let g = f |
---|
18 | | - | (g * 100000000) |
---|
19 | | - | } |
---|
20 | | - | else throw("Item not found") |
---|
21 | | - | } |
---|
| 13 | + | let e = getIntegerValue(this, (b + "_price")) |
---|
| 14 | + | let f = getStringValue(this, (b + "_supplier")) |
---|
22 | 15 | | if ((e > c.amount)) |
---|
23 | | - | then throw("Purchase amount is too low") |
---|
| 16 | + | then throw("Too low") |
---|
24 | 17 | | else if ((c.amount > e)) |
---|
25 | | - | then throw("Purchase amount is too high") |
---|
26 | | - | else [StringEntry(("status:purchase_item_A_customer" + d), "true"), IntegerEntry(("price:purchase_item_A_customer" + d), e)] |
---|
| 18 | + | then throw("Too high") |
---|
| 19 | + | else [IntegerEntry((b + "_counter"), (getIntegerValue(this, (b + "_counter")) + 1))] |
---|
27 | 20 | | } |
---|
28 | 21 | | } |
---|
29 | 22 | | |
---|
30 | 23 | | |
---|
31 | 24 | | |
---|
32 | 25 | | @Callable(a) |
---|
33 | | - | func addItem (h,e,i) = { |
---|
34 | | - | let j = toBase58String(a.caller.bytes) |
---|
35 | | - | let k = ((("item_" + j) + "_") + h) |
---|
| 26 | + | func addItem (g,e,h) = { |
---|
| 27 | + | let i = toBase58String(a.caller.bytes) |
---|
| 28 | + | let j = ((("item_" + i) + "_") + g) |
---|
36 | 29 | | if ((0 >= e)) |
---|
37 | 30 | | then throw("Price cannot be lower than 0") |
---|
38 | | - | else if (isDefined(getString(this, k))) |
---|
| 31 | + | else if (isDefined(getString(this, j))) |
---|
39 | 32 | | then throw("Item exists") |
---|
40 | | - | else [StringEntry((k + "_supplier"), j), IntegerEntry((k + "_price"), e), StringEntry((k + "_data"), i)] |
---|
| 33 | + | else [StringEntry((j + "_supplier"), i), IntegerEntry((j + "_price"), e), StringEntry((j + "_data"), h), IntegerEntry((j + "_counter"), 0)] |
---|
41 | 34 | | } |
---|
42 | 35 | | |
---|
43 | 36 | | |
---|
44 | | - | @Verifier(l) |
---|
45 | | - | func m () = true |
---|
| 37 | + | @Verifier(k) |
---|
| 38 | + | func l () = true |
---|
46 | 39 | | |
---|
Full:
Old | New | | Differences |
---|
1 | 1 | | {-# STDLIB_VERSION 4 #-} |
---|
2 | 2 | | {-# SCRIPT_TYPE ACCOUNT #-} |
---|
3 | 3 | | {-# CONTENT_TYPE DAPP #-} |
---|
4 | 4 | | |
---|
5 | 5 | | |
---|
6 | 6 | | @Callable(a) |
---|
7 | 7 | | func purchase (b) = { |
---|
8 | 8 | | let c = value(a.payments[0]) |
---|
9 | 9 | | if (isDefined(c.assetId)) |
---|
10 | | - | then throw("Only Waves are accepted") |
---|
| 10 | + | then throw("Waves only") |
---|
11 | 11 | | else { |
---|
12 | 12 | | let d = toBase58String(a.caller.bytes) |
---|
13 | | - | let e = { |
---|
14 | | - | let f = getInteger(this, (b + "_coupon_price")) |
---|
15 | | - | if ($isInstanceOf(f, "Int")) |
---|
16 | | - | then { |
---|
17 | | - | let g = f |
---|
18 | | - | (g * 100000000) |
---|
19 | | - | } |
---|
20 | | - | else throw("Item not found") |
---|
21 | | - | } |
---|
| 13 | + | let e = getIntegerValue(this, (b + "_price")) |
---|
| 14 | + | let f = getStringValue(this, (b + "_supplier")) |
---|
22 | 15 | | if ((e > c.amount)) |
---|
23 | | - | then throw("Purchase amount is too low") |
---|
| 16 | + | then throw("Too low") |
---|
24 | 17 | | else if ((c.amount > e)) |
---|
25 | | - | then throw("Purchase amount is too high") |
---|
26 | | - | else [StringEntry(("status:purchase_item_A_customer" + d), "true"), IntegerEntry(("price:purchase_item_A_customer" + d), e)] |
---|
| 18 | + | then throw("Too high") |
---|
| 19 | + | else [IntegerEntry((b + "_counter"), (getIntegerValue(this, (b + "_counter")) + 1))] |
---|
27 | 20 | | } |
---|
28 | 21 | | } |
---|
29 | 22 | | |
---|
30 | 23 | | |
---|
31 | 24 | | |
---|
32 | 25 | | @Callable(a) |
---|
33 | | - | func addItem (h,e,i) = { |
---|
34 | | - | let j = toBase58String(a.caller.bytes) |
---|
35 | | - | let k = ((("item_" + j) + "_") + h) |
---|
| 26 | + | func addItem (g,e,h) = { |
---|
| 27 | + | let i = toBase58String(a.caller.bytes) |
---|
| 28 | + | let j = ((("item_" + i) + "_") + g) |
---|
36 | 29 | | if ((0 >= e)) |
---|
37 | 30 | | then throw("Price cannot be lower than 0") |
---|
38 | | - | else if (isDefined(getString(this, k))) |
---|
| 31 | + | else if (isDefined(getString(this, j))) |
---|
39 | 32 | | then throw("Item exists") |
---|
40 | | - | else [StringEntry((k + "_supplier"), j), IntegerEntry((k + "_price"), e), StringEntry((k + "_data"), i)] |
---|
| 33 | + | else [StringEntry((j + "_supplier"), i), IntegerEntry((j + "_price"), e), StringEntry((j + "_data"), h), IntegerEntry((j + "_counter"), 0)] |
---|
41 | 34 | | } |
---|
42 | 35 | | |
---|
43 | 36 | | |
---|
44 | | - | @Verifier(l) |
---|
45 | | - | func m () = true |
---|
| 37 | + | @Verifier(k) |
---|
| 38 | + | func l () = true |
---|
46 | 39 | | |
---|