tx · 637DpxjwFJBc8aJ4faHbT2FxA6nXUFvaZnqjtV1Y6brC
3N4LH5XizMixv95sbA8KzKsWP79LBJ6EQ1K: -0.05000000 Waves
2020.09.29 15:47 [1198625] smart account 3N4LH5XizMixv95sbA8KzKsWP79LBJ6EQ1K > SELF 0.00000000 Waves
{
"type": 13,
"id": "637DpxjwFJBc8aJ4faHbT2FxA6nXUFvaZnqjtV1Y6brC",
"fee": 5000000,
"feeAssetId": null,
"timestamp": 1601383622942,
"version": 2,
"chainId": 84,
"sender": "3N4LH5XizMixv95sbA8KzKsWP79LBJ6EQ1K",
"senderPublicKey": "B1L9ADLhT3AgSCGBbDqFgvHGQg23J4vtF6qx38yTzi2V",
"proofs": [
"6xBKenid49EnY5hGJwAKv7eaRyztTdQp3a6c7vCuo6RDPw8EWhFtC4qZkLirtGHGbYyTUrGe4P88UxpfboYHs97"
],
"script": "base64:AAIDAAAAAAAAAAQIARIAAAAAAQAAAAAFb3duZXIBAAAAIJSqgv33P33K3xXhz0FACThxfYLi7Vx7YjREdx3vVuhiAAAAAQAAAAFpAQAAAAhwdXJjaGFzZQAAAAAEAAAACHByb2R1Y3RBAAAAAAAATEtABAAAAANwbXQJAQAAAAdleHRyYWN0AAAAAQgFAAAAAWkAAAAHcGF5bWVudAMJAQAAAAlpc0RlZmluZWQAAAABCAUAAAADcG10AAAAB2Fzc2V0SWQJAAACAAAAAQIAAAAgY2FuIHVzZSBXQVZFUyBvbmx5IGF0IHRoZSBtb21lbnQEAAAAD2N1c3RvbWVyQWRkcmVzcwkAAlgAAAABCAgFAAAAAWkAAAAGY2FsbGVyAAAABWJ5dGVzBAAAAAVwcmljZQQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzAgAAABNpdGVtX0FfY291cG9uX3ByaWNlAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWEFAAAAByRtYXRjaDAFAAAACHByb2R1Y3RBAAAAAAAAAAAAAwkAAGYAAAACBQAAAAVwcmljZQgFAAAAA3BtdAAAAAZhbW91bnQJAAACAAAAAQIAAAAucHVyY2hhc2UgYW1vdW50IGNhbm5vdCBiZSBsZXNzIHRoYW4gaXRlbSBwcmljZQMJAABmAAAAAggFAAAAA3BtdAAAAAZhbW91bnQFAAAABXByaWNlCQAAAgAAAAECAAAAMHB1cmNoYXNlIGFtb3VudCBjYW5ub3QgYmUgaGlnaGVyIHRoYW4gaXRlbSBwcmljZQkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkAASwAAAACAgAAACBzdGF0dXM6cHVyY2hhc2VfaXRlbV9BX2N1c3RvbWVyXwUAAAAPY3VzdG9tZXJBZGRyZXNzAgAAAAljb25maXJtZWQJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAAEsAAAAAgIAAAAfcHJpY2U6cHVyY2hhc2VfaXRlbV9BX2N1c3RvbWVyXwUAAAAPY3VzdG9tZXJBZGRyZXNzBQAAAAVwcmljZQUAAAADbmlsAAAAAQAAAAJ0eAEAAAAGdmVyaWZ5AAAAAAQAAAAHJG1hdGNoMAUAAAACdHgDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAFFNldFNjcmlwdFRyYW5zYWN0aW9uBAAAAAFkBQAAAAckbWF0Y2gwCQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAUAAAAFb3duZXIDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAD0RhdGFUcmFuc2FjdGlvbgQAAAABZAUAAAAHJG1hdGNoMAYHIHCstw==",
"height": 1198625,
"applicationStatus": "succeeded",
"spentComplexity": 0
}
View: original | compacted
Prev: ALfrUoaBJL84noy8HpmuSs3VLtMWxdAkRZYrgfaQLRBs
Next: none
Diff:
Old | New | | Differences |
---|
5 | 5 | | |
---|
6 | 6 | | @Callable(i) |
---|
7 | 7 | | func purchase () = { |
---|
| 8 | + | let productA = 5000000 |
---|
8 | 9 | | let pmt = extract(i.payment) |
---|
9 | 10 | | if (isDefined(pmt.assetId)) |
---|
10 | 11 | | then throw("can use WAVES only at the moment") |
---|
|
12 | 13 | | let customerAddress = toBase58String(i.caller.bytes) |
---|
13 | 14 | | let price = match getInteger(this, "item_A_coupon_price") { |
---|
14 | 15 | | case a: Int => |
---|
15 | | - | 1 |
---|
| 16 | + | productA |
---|
16 | 17 | | case _ => |
---|
17 | 18 | | 0 |
---|
18 | 19 | | } |
---|
Full:
Old | New | | Differences |
---|
1 | 1 | | {-# STDLIB_VERSION 3 #-} |
---|
2 | 2 | | {-# SCRIPT_TYPE ACCOUNT #-} |
---|
3 | 3 | | {-# CONTENT_TYPE DAPP #-} |
---|
4 | 4 | | let owner = base58'B1L9ADLhT3AgSCGBbDqFgvHGQg23J4vtF6qx38yTzi2V' |
---|
5 | 5 | | |
---|
6 | 6 | | @Callable(i) |
---|
7 | 7 | | func purchase () = { |
---|
| 8 | + | let productA = 5000000 |
---|
8 | 9 | | let pmt = extract(i.payment) |
---|
9 | 10 | | if (isDefined(pmt.assetId)) |
---|
10 | 11 | | then throw("can use WAVES only at the moment") |
---|
11 | 12 | | else { |
---|
12 | 13 | | let customerAddress = toBase58String(i.caller.bytes) |
---|
13 | 14 | | let price = match getInteger(this, "item_A_coupon_price") { |
---|
14 | 15 | | case a: Int => |
---|
15 | | - | 1 |
---|
| 16 | + | productA |
---|
16 | 17 | | case _ => |
---|
17 | 18 | | 0 |
---|
18 | 19 | | } |
---|
19 | 20 | | if ((price > pmt.amount)) |
---|
20 | 21 | | then throw("purchase amount cannot be less than item price") |
---|
21 | 22 | | else if ((pmt.amount > price)) |
---|
22 | 23 | | then throw("purchase amount cannot be higher than item price") |
---|
23 | 24 | | else WriteSet([DataEntry(("status:purchase_item_A_customer_" + customerAddress), "confirmed"), DataEntry(("price:purchase_item_A_customer_" + customerAddress), price)]) |
---|
24 | 25 | | } |
---|
25 | 26 | | } |
---|
26 | 27 | | |
---|
27 | 28 | | |
---|
28 | 29 | | @Verifier(tx) |
---|
29 | 30 | | func verify () = match tx { |
---|
30 | 31 | | case d: SetScriptTransaction => |
---|
31 | 32 | | sigVerify(tx.bodyBytes, tx.proofs[0], owner) |
---|
32 | 33 | | case d: DataTransaction => |
---|
33 | 34 | | true |
---|
34 | 35 | | case _ => |
---|
35 | 36 | | false |
---|
36 | 37 | | } |
---|
37 | 38 | | |
---|