tx · B1fLh7f8WPzpRQpp4PyXgXRQcPFwjGxXWYdTfUTGvTeN 3Mxq4pwTnFZeFxYsNgbbXVjvf54oyFtpgDq: -0.01000000 Waves 2021.01.20 20:34 [1362059] smart account 3Mxq4pwTnFZeFxYsNgbbXVjvf54oyFtpgDq > SELF 0.00000000 Waves
{ "type": 13, "id": "B1fLh7f8WPzpRQpp4PyXgXRQcPFwjGxXWYdTfUTGvTeN", "fee": 1000000, "feeAssetId": null, "timestamp": 1611164064815, "version": 2, "chainId": 84, "sender": "3Mxq4pwTnFZeFxYsNgbbXVjvf54oyFtpgDq", "senderPublicKey": "9UyGjnMoT4eqsvBsy7dNDQts5ZwLu43XVLDYgGRw7FDQ", "proofs": [ "4XsWNYYkGZ6A3Pm7mzi2CQb5LBHPyp2UYYdYvSTM8Sht8b3qE2KjiX2xUF9sR84NqGAnGp2hgaYKNWvNkGMboifT" ], "script": "base64:AAIDAAAAAAAAAAcIARIDCgEIAAAAAAAAAAEAAAABaQEAAAAIcHVyY2hhc2UAAAABAAAABGl0ZW0EAAAAA3BtdAkBAAAAB2V4dHJhY3QAAAABCAUAAAABaQAAAAdwYXltZW50AwkBAAAACWlzRGVmaW5lZAAAAAEIBQAAAANwbXQAAAAHYXNzZXRJZAkAAAIAAAABAgAAABJDYW4gb25seSB1c2UgV2F2ZXMEAAAAD2N1c3RvbWVyQWRkcmVzcwkAAlgAAAABCAgFAAAAAWkAAAAGY2FsbGVyAAAABWJ5dGVzBAAAAAVwcmljZQQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzCQABLAAAAAIJAAEsAAAAAgIAAAAFaXRlbV8FAAAABGl0ZW0CAAAABl9wcmljZQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhAAAAAAAAAAAAAwkAAAAAAAACBQAAAAVwcmljZQAAAAAAAAAAAAkAAAIAAAABAgAAABBDb3Vwb24gbm90IGZvdW5kAwkAAGYAAAACBQAAAAVwcmljZQgFAAAAA3BtdAAAAAZhbW91bnQJAAACAAAAAQIAAAAaUGF5bWVudCBzZW50IGlzIG5vdCBlbm91Z2gDCQAAZgAAAAIIBQAAAANwbXQAAAAGYW1vdW50BQAAAAVwcmljZQkAAAIAAAABAgAAABhQYXltZW50IHNlbnQgaXMgdG9vIG11Y2gJAQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAAEsAAAAAgkAASwAAAACCQABLAAAAAICAAAAEHN0YXR1czpwdXJjaGFzZV8FAAAABGl0ZW0CAAAACl9jdXN0b21lcl8FAAAAD2N1c3RvbWVyQWRkcmVzcwIAAAAJY29uZmlybWVkCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQABLAAAAAIJAAEsAAAAAgkAASwAAAACAgAAAA9wcmljZTpwdXJjaGFzZV8FAAAABGl0ZW0CAAAACl9jdXN0b21lcl8FAAAAD2N1c3RvbWVyQWRkcmVzcwUAAAAFcHJpY2UFAAAAA25pbAAAAAAVrNeg", "height": 1362059, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 3 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | ||
5 | + | ||
6 | + | @Callable(i) | |
7 | + | func purchase (item) = { | |
8 | + | let pmt = extract(i.payment) | |
9 | + | if (isDefined(pmt.assetId)) | |
10 | + | then throw("Can only use Waves") | |
11 | + | else { | |
12 | + | let customerAddress = toBase58String(i.caller.bytes) | |
13 | + | let price = match getInteger(this, (("item_" + item) + "_price")) { | |
14 | + | case a: Int => | |
15 | + | a | |
16 | + | case _ => | |
17 | + | 0 | |
18 | + | } | |
19 | + | if ((price == 0)) | |
20 | + | then throw("Coupon not found") | |
21 | + | else if ((price > pmt.amount)) | |
22 | + | then throw("Payment sent is not enough") | |
23 | + | else if ((pmt.amount > price)) | |
24 | + | then throw("Payment sent is too much") | |
25 | + | else WriteSet([DataEntry(((("status:purchase_" + item) + "_customer_") + customerAddress), "confirmed"), DataEntry(((("price:purchase_" + item) + "_customer_") + customerAddress), price)]) | |
26 | + | } | |
27 | + | } | |
28 | + | ||
29 | + |
github/deemru/w8io/169f3d6 30.22 ms ◑