tx · B7hkcnyvHN66SqHNnEEEBaTSBHVfAnxAV7Fd9UvUeFNu
3MzFjVphaDKp1oZjd5KmCYou3wCzCzTmEFe: -0.00100000 Waves
2022.09.18 22:52 [2234997] smart account 3MzFjVphaDKp1oZjd5KmCYou3wCzCzTmEFe > SELF 0.00000000 Waves
{
"type": 13,
"id": "B7hkcnyvHN66SqHNnEEEBaTSBHVfAnxAV7Fd9UvUeFNu",
"fee": 100000,
"feeAssetId": null,
"timestamp": 1663530836902,
"version": 2,
"chainId": 84,
"sender": "3MzFjVphaDKp1oZjd5KmCYou3wCzCzTmEFe",
"senderPublicKey": "FFVf3kC6HkjRMmf8W6Zr2bNKhJ5EN5W1vG44GbgvHd9Z",
"proofs": [
"5oeeG3w2zq9PBxHXJmdpLJc1RsfHqgekyyedWwjzRo3uSySEEKoctme6FLJ5oNUnR8FraaGQ5j2qUrsN51kXaDo9"
],
"script": "base64:AAIDAAAAAAAAAAQIARIAAAAAAAAAAAEAAAABaQEAAAAIcHVyY2hhc2UAAAAABAAAAANwbXQJAQAAAAdleHRyYWN0AAAAAQgFAAAAAWkAAAAHcGF5bWVudAMJAQAAAAlpc0RlZmluZWQAAAABCAUAAAADcG10AAAAB2Fzc2V0SWQJAAACAAAAAQIAAAAgY2FuIHVzZSBXQVZFUyBvbmx5IGF0IHRoZSBtb21lbnQEAAAAD2N1c3RvbWVyQWRkcmVzcwkAAlgAAAABCAgFAAAAAWkAAAAGY2FsbGVyAAAABWJ5dGVzBAAAAAVwcmljZQQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzAgAAABNJdGVtX0FfY291cG9uX3ByaWNlAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEAAAAAAAAAAAADCQEAAAACIT0AAAACCAUAAAADcG10AAAABmFtb3VudAUAAAAFcHJpY2UJAAACAAAAAQIAAAApUHVyY2hhc2UgYW1vdW50IHNob3VsZCBiZSBlcXVhbCB0byBwcmljZSAJAQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAAEsAAAAAgIAAAAhc3RhdHVzOiBwdXJjaGFzZV9pdGVtX0FfY3VzdG9tZXJfBQAAAA9jdXN0b21lckFkZHJlc3MCAAAACWNvbmZpcm1lZAkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkAASwAAAACAgAAACBwcmljZTogcHVyY2hhc2VfaXRlbV9BX2N1c3RvbWVyXwUAAAAPY3VzdG9tZXJBZGRyZXNzBQAAAAVwcmljZQUAAAADbmlsAAAAAL815kw=",
"height": 2234997,
"applicationStatus": "succeeded",
"spentComplexity": 0
}
View: original | compacted
Prev: GoGfNK3BFnhYM8UdNp4ZAeCMkvxrgzqskiDTzTCCoLcJ
Next: Gt2NH17aJycRZQR3UqjybJQXiPRQrhjg422VcCQxBJRX
Diff:
Old | New | | Differences |
---|
10 | 10 | | then throw("can use WAVES only at the moment") |
---|
11 | 11 | | else { |
---|
12 | 12 | | let customerAddress = toBase58String(i.caller.bytes) |
---|
13 | | - | let price = match getInteger(this, "item_A_coupon_price") { |
---|
| 13 | + | let price = match getInteger(this, "Item_A_coupon_price") { |
---|
14 | 14 | | case a: Int => |
---|
15 | 15 | | a |
---|
16 | 16 | | case _ => |
---|
17 | 17 | | 0 |
---|
18 | 18 | | } |
---|
19 | | - | if ((price > pmt.amount)) |
---|
20 | | - | then throw("purchase amount cannot be less than item price") |
---|
21 | | - | else if ((pmt.amount > price)) |
---|
22 | | - | then throw("purchase amount cannot be higher than item price") |
---|
23 | | - | else WriteSet([DataEntry(("status: purchase_item_A_customer_" + customerAddress), "confirmed"), DataEntry(("price: purchase_item_A_customer_" + customerAddress), price)]) |
---|
| 19 | + | if ((pmt.amount != price)) |
---|
| 20 | + | then throw("Purchase amount should be equal to price ") |
---|
| 21 | + | else WriteSet([DataEntry(("status: purchase_item_A_customer_" + customerAddress), "confirmed"), DataEntry(("price: purchase_item_A_customer_" + customerAddress), price)]) |
---|
24 | 22 | | } |
---|
25 | 23 | | } |
---|
26 | 24 | | |
---|
Full:
Old | New | | Differences |
---|
1 | 1 | | {-# STDLIB_VERSION 3 #-} |
---|
2 | 2 | | {-# SCRIPT_TYPE ACCOUNT #-} |
---|
3 | 3 | | {-# CONTENT_TYPE DAPP #-} |
---|
4 | 4 | | |
---|
5 | 5 | | |
---|
6 | 6 | | @Callable(i) |
---|
7 | 7 | | func purchase () = { |
---|
8 | 8 | | let pmt = extract(i.payment) |
---|
9 | 9 | | if (isDefined(pmt.assetId)) |
---|
10 | 10 | | then throw("can use WAVES only at the moment") |
---|
11 | 11 | | else { |
---|
12 | 12 | | let customerAddress = toBase58String(i.caller.bytes) |
---|
13 | | - | let price = match getInteger(this, "item_A_coupon_price") { |
---|
| 13 | + | let price = match getInteger(this, "Item_A_coupon_price") { |
---|
14 | 14 | | case a: Int => |
---|
15 | 15 | | a |
---|
16 | 16 | | case _ => |
---|
17 | 17 | | 0 |
---|
18 | 18 | | } |
---|
19 | | - | if ((price > pmt.amount)) |
---|
20 | | - | then throw("purchase amount cannot be less than item price") |
---|
21 | | - | else if ((pmt.amount > price)) |
---|
22 | | - | then throw("purchase amount cannot be higher than item price") |
---|
23 | | - | else WriteSet([DataEntry(("status: purchase_item_A_customer_" + customerAddress), "confirmed"), DataEntry(("price: purchase_item_A_customer_" + customerAddress), price)]) |
---|
| 19 | + | if ((pmt.amount != price)) |
---|
| 20 | + | then throw("Purchase amount should be equal to price ") |
---|
| 21 | + | else WriteSet([DataEntry(("status: purchase_item_A_customer_" + customerAddress), "confirmed"), DataEntry(("price: purchase_item_A_customer_" + customerAddress), price)]) |
---|
24 | 22 | | } |
---|
25 | 23 | | } |
---|
26 | 24 | | |
---|
27 | 25 | | |
---|