tx · FwBsK5DWmkqsmVoPF8WnTfm6WcvDYUd7YbCmEBgbbUGH
3NAj7owPjfmLoE3odgXC6cXfB1QzEhnpBtt: -0.01400000 Waves
2020.11.18 14:59 [1270766] smart account 3NAj7owPjfmLoE3odgXC6cXfB1QzEhnpBtt > SELF 0.00000000 Waves
{
"type": 13,
"id": "FwBsK5DWmkqsmVoPF8WnTfm6WcvDYUd7YbCmEBgbbUGH",
"fee": 1400000,
"feeAssetId": null,
"timestamp": 1605700768981,
"version": 2,
"chainId": 84,
"sender": "3NAj7owPjfmLoE3odgXC6cXfB1QzEhnpBtt",
"senderPublicKey": "iRqJrgq4rS2ndNGFJoZtKcoTfskkxr3zfTesPWqtKzp",
"proofs": [
"4bZQMZPA8o4xA5EG6m9G4WPe9WLUCp6XFiG6DFVWrXBM74VVSBRVRA1Ta73FSU4FBYnhcXeUveobHJAeUgx3dpcU"
],
"script": "base64:AAIEAAAAAAAAAAcIAhIDCgEIAAAAAAAAAAEAAAABaQEAAAAIcHVyY2hhc2UAAAABAAAACGl0ZW1OYW1lBAAAAAdwYXltZW50CQEAAAAFdmFsdWUAAAABCQABkQAAAAIIBQAAAAFpAAAACHBheW1lbnRzAAAAAAAAAAAAAwkBAAAACWlzRGVmaW5lZAAAAAEIBQAAAAdwYXltZW50AAAAB2Fzc2V0SWQJAAACAAAAAQIAAAAXT25seSBXYXZlcyBhcmUgYWNjZXB0ZWQEAAAAD2N1c3RvbWVyQWRkcmVzcwkAAlgAAAABCAgFAAAAAWkAAAAGY2FsbGVyAAAABWJ5dGVzBAAAAAVwcmljZQQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzCQABLAAAAAIFAAAACGl0ZW1OYW1lAgAAAA1fY291cG9uX3ByaWNlAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWEFAAAAByRtYXRjaDAJAABoAAAAAgUAAAABYQAAAAAABfXhAAkAAAIAAAABAgAAAA5JdGVtIG5vdCBmb3VuZAMJAABmAAAAAgUAAAAFcHJpY2UIBQAAAAdwYXltZW50AAAABmFtb3VudAkAAAIAAAABAgAAABpQdXJjaGFzZSBhbW91bnQgaXMgdG9vIGxvdwMJAABmAAAAAggFAAAAB3BheW1lbnQAAAAGYW1vdW50BQAAAAVwcmljZQkAAAIAAAABAgAAABtQdXJjaGFzZSBhbW91bnQgaXMgdG9vIGhpZ2gJAARMAAAAAgkBAAAAC1N0cmluZ0VudHJ5AAAAAgkAASwAAAACAgAAAB9zdGF0dXM6cHVyY2hhc2VfaXRlbV9BX2N1c3RvbWVyBQAAAA9jdXN0b21lckFkZHJlc3MCAAAABHRydWUJAARMAAAAAgkBAAAADEludGVnZXJFbnRyeQAAAAIJAAEsAAAAAgIAAAAecHJpY2U6cHVyY2hhc2VfaXRlbV9BX2N1c3RvbWVyBQAAAA9jdXN0b21lckFkZHJlc3MFAAAABXByaWNlBQAAAANuaWwAAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAABozLFnE=",
"height": 1270766,
"applicationStatus": "succeeded",
"spentComplexity": 0
}
View: original | compacted
Prev: Cdf882AQtM9hiAdb5A5EaDaXwKAzPvVqfNboYCnyXXGz
Next: CnaDhKVuCwogAt2eriKp8rAzajAkbeLX6Fsu4yXRjAoX
Diff:
Old | New | | Differences |
---|
4 | 4 | | |
---|
5 | 5 | | |
---|
6 | 6 | | @Callable(a) |
---|
7 | | - | func purchase () = { |
---|
8 | | - | let b = value(a.payments[0]) |
---|
9 | | - | if (isDefined(b.assetId)) |
---|
| 7 | + | func purchase (b) = { |
---|
| 8 | + | let c = value(a.payments[0]) |
---|
| 9 | + | if (isDefined(c.assetId)) |
---|
10 | 10 | | then throw("Only Waves are accepted") |
---|
11 | 11 | | else { |
---|
12 | | - | let c = toBase58String(a.caller.bytes) |
---|
13 | | - | let d = { |
---|
14 | | - | let e = getInteger(this, "item_A_coupon_price") |
---|
15 | | - | if ($isInstanceOf(e, "Int")) |
---|
| 12 | + | let d = toBase58String(a.caller.bytes) |
---|
| 13 | + | let e = { |
---|
| 14 | + | let f = getInteger(this, (b + "_coupon_price")) |
---|
| 15 | + | if ($isInstanceOf(f, "Int")) |
---|
16 | 16 | | then { |
---|
17 | | - | let f = e |
---|
18 | | - | (f * 100000000) |
---|
| 17 | + | let g = f |
---|
| 18 | + | (g * 100000000) |
---|
19 | 19 | | } |
---|
20 | | - | else 0 |
---|
| 20 | + | else throw("Item not found") |
---|
21 | 21 | | } |
---|
22 | | - | if ((b.amount == 0)) |
---|
23 | | - | then throw("Purchase amount is 0") |
---|
24 | | - | else if ((d > b.amount)) |
---|
25 | | - | then throw("Purchase amount is too low") |
---|
26 | | - | else if ((b.amount > d)) |
---|
27 | | - | then throw("Purchase amount is too high") |
---|
28 | | - | else [StringEntry(("status:purchase_item_A_customer" + c), "true"), IntegerEntry(("price:purchase_item_A_customer" + c), d)] |
---|
| 22 | + | if ((e > c.amount)) |
---|
| 23 | + | then throw("Purchase amount is too low") |
---|
| 24 | + | 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)] |
---|
29 | 27 | | } |
---|
30 | 28 | | } |
---|
31 | 29 | | |
---|
32 | 30 | | |
---|
33 | | - | @Verifier(g) |
---|
34 | | - | func h () = true |
---|
| 31 | + | @Verifier(h) |
---|
| 32 | + | func i () = true |
---|
35 | 33 | | |
---|
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 | | - | func purchase () = { |
---|
8 | | - | let b = value(a.payments[0]) |
---|
9 | | - | if (isDefined(b.assetId)) |
---|
| 7 | + | func purchase (b) = { |
---|
| 8 | + | let c = value(a.payments[0]) |
---|
| 9 | + | if (isDefined(c.assetId)) |
---|
10 | 10 | | then throw("Only Waves are accepted") |
---|
11 | 11 | | else { |
---|
12 | | - | let c = toBase58String(a.caller.bytes) |
---|
13 | | - | let d = { |
---|
14 | | - | let e = getInteger(this, "item_A_coupon_price") |
---|
15 | | - | if ($isInstanceOf(e, "Int")) |
---|
| 12 | + | let d = toBase58String(a.caller.bytes) |
---|
| 13 | + | let e = { |
---|
| 14 | + | let f = getInteger(this, (b + "_coupon_price")) |
---|
| 15 | + | if ($isInstanceOf(f, "Int")) |
---|
16 | 16 | | then { |
---|
17 | | - | let f = e |
---|
18 | | - | (f * 100000000) |
---|
| 17 | + | let g = f |
---|
| 18 | + | (g * 100000000) |
---|
19 | 19 | | } |
---|
20 | | - | else 0 |
---|
| 20 | + | else throw("Item not found") |
---|
21 | 21 | | } |
---|
22 | | - | if ((b.amount == 0)) |
---|
23 | | - | then throw("Purchase amount is 0") |
---|
24 | | - | else if ((d > b.amount)) |
---|
25 | | - | then throw("Purchase amount is too low") |
---|
26 | | - | else if ((b.amount > d)) |
---|
27 | | - | then throw("Purchase amount is too high") |
---|
28 | | - | else [StringEntry(("status:purchase_item_A_customer" + c), "true"), IntegerEntry(("price:purchase_item_A_customer" + c), d)] |
---|
| 22 | + | if ((e > c.amount)) |
---|
| 23 | + | then throw("Purchase amount is too low") |
---|
| 24 | + | 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)] |
---|
29 | 27 | | } |
---|
30 | 28 | | } |
---|
31 | 29 | | |
---|
32 | 30 | | |
---|
33 | | - | @Verifier(g) |
---|
34 | | - | func h () = true |
---|
| 31 | + | @Verifier(h) |
---|
| 32 | + | func i () = true |
---|
35 | 33 | | |
---|