tx · Bf7xxNkvNfeqbhkFTMs7wzeHAbMdMxvHM4QWZ5vsGEjM 3NAj7owPjfmLoE3odgXC6cXfB1QzEhnpBtt: -0.01400000 Waves 2020.11.18 14:20 [1270726] smart account 3NAj7owPjfmLoE3odgXC6cXfB1QzEhnpBtt > SELF 0.00000000 Waves
{ "type": 13, "id": "Bf7xxNkvNfeqbhkFTMs7wzeHAbMdMxvHM4QWZ5vsGEjM", "fee": 1400000, "feeAssetId": null, "timestamp": 1605698343795, "version": 2, "chainId": 84, "sender": "3NAj7owPjfmLoE3odgXC6cXfB1QzEhnpBtt", "senderPublicKey": "iRqJrgq4rS2ndNGFJoZtKcoTfskkxr3zfTesPWqtKzp", "proofs": [ "49WEyvJxCBW8f3V7opKmSv4KPhfhuT97ty4NfJZE3PpugnghjHtSrAZAr3hHxEGfxQxditrrzoYgoAn1Ku7MXgDa" ], "script": "base64:AAIEAAAAAAAAAAQIAhIAAAAAAAAAAAEAAAABaQEAAAAIcHVyY2hhc2UAAAAABAAAAAdwYXltZW50CQEAAAAFdmFsdWUAAAABCQABkQAAAAIIBQAAAAFpAAAACHBheW1lbnRzAAAAAAAAAAAAAwkBAAAACWlzRGVmaW5lZAAAAAEIBQAAAAdwYXltZW50AAAAB2Fzc2V0SWQJAAACAAAAAQIAAAAXT25seSBXYXZlcyBhcmUgYWNjZXB0ZWQEAAAAD2N1c3RvbWVyQWRkcmVzcwkAAlgAAAABCAgFAAAAAWkAAAAGY2FsbGVyAAAABWJ5dGVzBAAAAAVwcmljZQQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzAgAAABNpdGVtX0FfY291cG9uX3ByaWNlAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEAAAAAAAAAAAADCQAAAAAAAAIIBQAAAAdwYXltZW50AAAABmFtb3VudAAAAAAAAAAAAAkAAAIAAAABAgAAABRQdXJjaGFzZSBhbW91bnQgaXMgMAMJAABmAAAAAgUAAAAFcHJpY2UIBQAAAAdwYXltZW50AAAABmFtb3VudAkAAAIAAAABAgAAABpQdXJjaGFzZSBhbW91bnQgaXMgdG9vIGxvdwMJAABmAAAAAggFAAAAB3BheW1lbnQAAAAGYW1vdW50BQAAAAVwcmljZQkAAAIAAAABAgAAABtQdXJjaGFzZSBhbW91bnQgaXMgdG9vIGhpZ2gJAARMAAAAAgkBAAAAC1N0cmluZ0VudHJ5AAAAAgkAASwAAAACAgAAAB9zdGF0dXM6cHVyY2hhc2VfaXRlbV9BX2N1c3RvbWVyBQAAAA9jdXN0b21lckFkZHJlc3MCAAAABHRydWUJAARMAAAAAgkBAAAADEludGVnZXJFbnRyeQAAAAIJAAEsAAAAAgIAAAAecHJpY2U6cHVyY2hhc2VfaXRlbV9BX2N1c3RvbWVyBQAAAA9jdXN0b21lckFkZHJlc3MFAAAABXByaWNlBQAAAANuaWwAAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAABjO0FBw=", "height": 1270726, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 93vym5QArCvNXQpATsNikD8Mp6urYaKwiR7MPBKJp45d Next: Cdf882AQtM9hiAdb5A5EaDaXwKAzPvVqfNboYCnyXXGz Diff:
Old | New | Differences | |
---|---|---|---|
4 | 4 | ||
5 | 5 | ||
6 | 6 | @Callable(i) | |
7 | - | func purchase () = if (true) | |
8 | - | then throw("Hello") | |
9 | - | else throw("Witam") | |
7 | + | func purchase () = { | |
8 | + | let payment = value(i.payments[0]) | |
9 | + | if (isDefined(payment.assetId)) | |
10 | + | then throw("Only Waves are accepted") | |
11 | + | else { | |
12 | + | let customerAddress = toBase58String(i.caller.bytes) | |
13 | + | let price = match getInteger(this, "item_A_coupon_price") { | |
14 | + | case a: Int => | |
15 | + | a | |
16 | + | case _ => | |
17 | + | 0 | |
18 | + | } | |
19 | + | if ((payment.amount == 0)) | |
20 | + | then throw("Purchase amount is 0") | |
21 | + | else if ((price > payment.amount)) | |
22 | + | then throw("Purchase amount is too low") | |
23 | + | else if ((payment.amount > price)) | |
24 | + | then throw("Purchase amount is too high") | |
25 | + | else [StringEntry(("status:purchase_item_A_customer" + customerAddress), "true"), IntegerEntry(("price:purchase_item_A_customer" + customerAddress), price)] | |
26 | + | } | |
27 | + | } | |
10 | 28 | ||
11 | 29 | ||
12 | 30 | @Verifier(tx) |
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(i) | |
7 | - | func purchase () = if (true) | |
8 | - | then throw("Hello") | |
9 | - | else throw("Witam") | |
7 | + | func purchase () = { | |
8 | + | let payment = value(i.payments[0]) | |
9 | + | if (isDefined(payment.assetId)) | |
10 | + | then throw("Only Waves are accepted") | |
11 | + | else { | |
12 | + | let customerAddress = toBase58String(i.caller.bytes) | |
13 | + | let price = match getInteger(this, "item_A_coupon_price") { | |
14 | + | case a: Int => | |
15 | + | a | |
16 | + | case _ => | |
17 | + | 0 | |
18 | + | } | |
19 | + | if ((payment.amount == 0)) | |
20 | + | then throw("Purchase amount is 0") | |
21 | + | else if ((price > payment.amount)) | |
22 | + | then throw("Purchase amount is too low") | |
23 | + | else if ((payment.amount > price)) | |
24 | + | then throw("Purchase amount is too high") | |
25 | + | else [StringEntry(("status:purchase_item_A_customer" + customerAddress), "true"), IntegerEntry(("price:purchase_item_A_customer" + customerAddress), price)] | |
26 | + | } | |
27 | + | } | |
10 | 28 | ||
11 | 29 | ||
12 | 30 | @Verifier(tx) | |
13 | 31 | func verify () = true | |
14 | 32 |
github/deemru/w8io/169f3d6 31.47 ms ◑