tx · CnaDhKVuCwogAt2eriKp8rAzajAkbeLX6Fsu4yXRjAoX 3NAj7owPjfmLoE3odgXC6cXfB1QzEhnpBtt: -0.01400000 Waves 2020.11.18 16:04 [1270827] smart account 3NAj7owPjfmLoE3odgXC6cXfB1QzEhnpBtt > SELF 0.00000000 Waves
{ "type": 13, "id": "CnaDhKVuCwogAt2eriKp8rAzajAkbeLX6Fsu4yXRjAoX", "fee": 1400000, "feeAssetId": null, "timestamp": 1605704649644, "version": 2, "chainId": 84, "sender": "3NAj7owPjfmLoE3odgXC6cXfB1QzEhnpBtt", "senderPublicKey": "iRqJrgq4rS2ndNGFJoZtKcoTfskkxr3zfTesPWqtKzp", "proofs": [ "MTg4gJfw74w3rQnCzFiyotuGcfK53NGDDLJiazrRGLecA43RPkedEs5NoCGanemU1yhM56JBzGJYL1przT1hxEX" ], "script": "base64:AAIEAAAAAAAAAA4IAhIDCgEIEgUKAwgBCAAAAAAAAAACAAAAAWkBAAAACHB1cmNoYXNlAAAAAQAAAAhpdGVtTmFtZQQAAAAHcGF5bWVudAkBAAAABXZhbHVlAAAAAQkAAZEAAAACCAUAAAABaQAAAAhwYXltZW50cwAAAAAAAAAAAAMJAQAAAAlpc0RlZmluZWQAAAABCAUAAAAHcGF5bWVudAAAAAdhc3NldElkCQAAAgAAAAECAAAAF09ubHkgV2F2ZXMgYXJlIGFjY2VwdGVkBAAAAA9jdXN0b21lckFkZHJlc3MJAAJYAAAAAQgIBQAAAAFpAAAABmNhbGxlcgAAAAVieXRlcwQAAAAFcHJpY2UEAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwkAASwAAAACBQAAAAhpdGVtTmFtZQIAAAANX2NvdXBvbl9wcmljZQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAFhBQAAAAckbWF0Y2gwCQAAaAAAAAIFAAAAAWEAAAAAAAX14QAJAAACAAAAAQIAAAAOSXRlbSBub3QgZm91bmQDCQAAZgAAAAIFAAAABXByaWNl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GVnZXJFbnRyeQAAAAIJAAEsAAAAAgUAAAADa2V5AgAAAAZfcHJpY2UFAAAABXByaWNlCQAETAAAAAIJAQAAAAtTdHJpbmdFbnRyeQAAAAIJAAEsAAAAAgUAAAADa2V5AgAAAAVfZGF0YQUAAAAEZGF0YQUAAAADbmlsAAAAAQAAAAJ0eAEAAAAGdmVyaWZ5AAAAAAZRKZ47", "height": 1270827, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: FwBsK5DWmkqsmVoPF8WnTfm6WcvDYUd7YbCmEBgbbUGH Next: b9niW7Wp4DXFaiyp3ZKavC26bKpupahBrbcUfu3TdVh Diff:
Old | New | Differences | |
---|---|---|---|
25 | 25 | } | |
26 | 26 | ||
27 | 27 | ||
28 | + | ||
29 | + | @Callable(i) | |
30 | + | func addItem (title,price,data) = { | |
31 | + | let supplierAddress = toBase58String(i.caller.bytes) | |
32 | + | let key = ("item_" + toBase58String(sha256(toBytes((supplierAddress + title))))) | |
33 | + | if ((0 >= price)) | |
34 | + | then throw("Price cannot be lower than 0") | |
35 | + | else if ((getStringValue(this, key) != "none")) | |
36 | + | then throw("Item exists") | |
37 | + | else [StringEntry((key + "_supplier"), supplierAddress), IntegerEntry((key + "_price"), price), StringEntry((key + "_data"), data)] | |
38 | + | } | |
39 | + | ||
40 | + | ||
28 | 41 | @Verifier(tx) | |
29 | 42 | func verify () = true | |
30 | 43 |
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 | 7 | func purchase (itemName) = { | |
8 | 8 | let payment = value(i.payments[0]) | |
9 | 9 | if (isDefined(payment.assetId)) | |
10 | 10 | then throw("Only Waves are accepted") | |
11 | 11 | else { | |
12 | 12 | let customerAddress = toBase58String(i.caller.bytes) | |
13 | 13 | let price = match getInteger(this, (itemName + "_coupon_price")) { | |
14 | 14 | case a: Int => | |
15 | 15 | (a * 100000000) | |
16 | 16 | case _ => | |
17 | 17 | throw("Item not found") | |
18 | 18 | } | |
19 | 19 | if ((price > payment.amount)) | |
20 | 20 | then throw("Purchase amount is too low") | |
21 | 21 | else if ((payment.amount > price)) | |
22 | 22 | then throw("Purchase amount is too high") | |
23 | 23 | else [StringEntry(("status:purchase_item_A_customer" + customerAddress), "true"), IntegerEntry(("price:purchase_item_A_customer" + customerAddress), price)] | |
24 | 24 | } | |
25 | 25 | } | |
26 | 26 | ||
27 | 27 | ||
28 | + | ||
29 | + | @Callable(i) | |
30 | + | func addItem (title,price,data) = { | |
31 | + | let supplierAddress = toBase58String(i.caller.bytes) | |
32 | + | let key = ("item_" + toBase58String(sha256(toBytes((supplierAddress + title))))) | |
33 | + | if ((0 >= price)) | |
34 | + | then throw("Price cannot be lower than 0") | |
35 | + | else if ((getStringValue(this, key) != "none")) | |
36 | + | then throw("Item exists") | |
37 | + | else [StringEntry((key + "_supplier"), supplierAddress), IntegerEntry((key + "_price"), price), StringEntry((key + "_data"), data)] | |
38 | + | } | |
39 | + | ||
40 | + | ||
28 | 41 | @Verifier(tx) | |
29 | 42 | func verify () = true | |
30 | 43 |
github/deemru/w8io/026f985 23.11 ms ◑