tx · GraTu7FdZRcy6EvgsW8ASHTfE9ZMQHboJdvNucMwvEtf 3MsqcsQSU3FeyxcMjrRQHcM8pTGrHu8yyWX: -0.01400000 Waves 2019.09.08 11:33 [666863] smart account 3MsqcsQSU3FeyxcMjrRQHcM8pTGrHu8yyWX > SELF 0.00000000 Waves
{ "type": 13, "id": "GraTu7FdZRcy6EvgsW8ASHTfE9ZMQHboJdvNucMwvEtf", "fee": 1400000, "feeAssetId": null, "timestamp": 1567931583948, "version": 1, "sender": "3MsqcsQSU3FeyxcMjrRQHcM8pTGrHu8yyWX", "senderPublicKey": "D1oc84fv4treBFDLvPS9vQdrs7A9HwTHxaeK9C7nHRTH", "proofs": [ "31zWmCwGKJYM3WC8tE8Jfie1WB7K4tmJkqecMZhwbv4kCQf4m5HS8PMuqgta6EcrfVHpxx763SCdY4vZyRdPn5PQ" ], "script": "base64:AAIDAAAAAAAAAAAAAAAAAAAAAwAAAAFpAQAAAAtjcmVhdGVPcmRlcgAAAAEAAAAFcHJpY2UEAAAAA3BtdAkBAAAAB2V4dHJhY3QAAAABCAUAAAABaQAAAAdwYXltZW50AwkBAAAAASEAAAABCQEAAAAJaXNEZWZpbmVkAAAAAQgFAAAAA3BtdAAAAAdhc3NldElkCQAAAgAAAAECAAAAIllvdSBuZWVkIHRvIHVzZSB0b2tlbklkLCBub3Qgd2F2ZXMEAAAACmN1cnJlbnRLZXkJAAJYAAAAAQgIBQAAAAFpAAAABmNhbGxlcgAAAAVieXRlcwQAAAAHYXNzZXRJZAkAAlgAAAABCQEAAAAHZXh0cmFjdAAAAAEIBQAAAANwbXQAAAAHYXNzZXRJZAQAAAAHdW5pcUtleQkAASwAAAACCQABLAAAAAIJAAEsAAAAAgkAASwAAAACBQAAAApjdXJyZW50S2V5AgAAAAFfBQAAAAdhc3NldElkAgAAAAFfCQABpAAAAAEFAAAABmhlaWdodAkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkAASwAAA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ACCQABLAAAAAIFAAAACmN1cnJlbnRLZXkCAAAAAV8FAAAAB2Fzc2V0SWQCAAAAAV8JAAGkAAAAAQUAAAAGaGVpZ2h0CQEAAAAIV3JpdGVTZXQAAAABCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQABLAAAAAICAAAACGNoZWNraW5fBQAAAAd1bmlxS2V5CAUAAAAJbGFzdEJsb2NrAAAACXRpbWVzdGFtcAUAAAADbmlsAAAAAKP+7RY=", "chainId": 84, "height": 666863, "spentComplexity": 0 } View: original | compacted Prev: CC6SjPAZg75MLopDhuPLdBDyAxAZmdQwHPnMNH3bqr4K Next: none Diff:
Old | New | Differences | |
---|---|---|---|
58 | 58 | let currentKey = toBase58String(i.caller.bytes) | |
59 | 59 | let assetId = toBase58String(extract(pmt.assetId)) | |
60 | 60 | let uniqKey = ((((currentKey + "_") + assetId) + "_") + toString(height)) | |
61 | - | WriteSet([DataEntry(("checkin_" + uniqKey), | |
61 | + | WriteSet([DataEntry(("checkin_" + uniqKey), lastBlock.timestamp)]) | |
62 | 62 | } | |
63 | 63 | } | |
64 | 64 |
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 createOrder (price) = { | |
8 | 8 | let pmt = extract(i.payment) | |
9 | 9 | if (!(isDefined(pmt.assetId))) | |
10 | 10 | then throw("You need to use tokenId, not waves") | |
11 | 11 | else { | |
12 | 12 | let currentKey = toBase58String(i.caller.bytes) | |
13 | 13 | let assetId = toBase58String(extract(pmt.assetId)) | |
14 | 14 | let uniqKey = ((((currentKey + "_") + assetId) + "_") + toString(height)) | |
15 | 15 | WriteSet([DataEntry(("assetAmount_" + uniqKey), pmt.amount), DataEntry(("assetPrice_" + uniqKey), price)]) | |
16 | 16 | } | |
17 | 17 | } | |
18 | 18 | ||
19 | 19 | ||
20 | 20 | ||
21 | 21 | @Callable(i) | |
22 | 22 | func buyTicket (uniqKey) = { | |
23 | 23 | let pmt = extract(i.payment) | |
24 | 24 | let assetId = extract(split(uniqKey, "_")[1]) | |
25 | 25 | let ownerId = extract(addressFromString(split(uniqKey, "_")[0])) | |
26 | 26 | let price = match getInteger(this, ("assetPrice_" + uniqKey)) { | |
27 | 27 | case p: Int => | |
28 | 28 | p | |
29 | 29 | case _ => | |
30 | 30 | 0 | |
31 | 31 | } | |
32 | 32 | let currentAmount = match getInteger(this, ("assetAmount_" + uniqKey)) { | |
33 | 33 | case a: Int => | |
34 | 34 | a | |
35 | 35 | case _ => | |
36 | 36 | 0 | |
37 | 37 | } | |
38 | 38 | let newAmount = (currentAmount - 1) | |
39 | 39 | if ((0 >= currentAmount)) | |
40 | 40 | then throw("Have not enough of tickets for this price") | |
41 | 41 | else if (isDefined(pmt.assetId)) | |
42 | 42 | then throw("You need to use waves") | |
43 | 43 | else if ((price > pmt.amount)) | |
44 | 44 | then throw("Count of waves is not match price") | |
45 | 45 | else ScriptResult(WriteSet([DataEntry(("assetAmount_" + uniqKey), newAmount)]), TransferSet([ScriptTransfer(i.caller, 1, fromBase58String(assetId)), ScriptTransfer(ownerId, price, unit)])) | |
46 | 46 | } | |
47 | 47 | ||
48 | 48 | ||
49 | 49 | ||
50 | 50 | @Callable(i) | |
51 | 51 | func checkIn () = { | |
52 | 52 | let pmt = extract(i.payment) | |
53 | 53 | if (!(isDefined(pmt.assetId))) | |
54 | 54 | then throw("You need to use tokenId, not waves") | |
55 | 55 | else if ((pmt.amount != 1)) | |
56 | 56 | then throw("Give only one ticket") | |
57 | 57 | else { | |
58 | 58 | let currentKey = toBase58String(i.caller.bytes) | |
59 | 59 | let assetId = toBase58String(extract(pmt.assetId)) | |
60 | 60 | let uniqKey = ((((currentKey + "_") + assetId) + "_") + toString(height)) | |
61 | - | WriteSet([DataEntry(("checkin_" + uniqKey), | |
61 | + | WriteSet([DataEntry(("checkin_" + uniqKey), lastBlock.timestamp)]) | |
62 | 62 | } | |
63 | 63 | } | |
64 | 64 | ||
65 | 65 |
github/deemru/w8io/169f3d6 26.83 ms ◑