tx · DRsLqX2QarzkEPmF6nEBGRXqtApGqAR3sQp3idMG9SR2

3MsqcsQSU3FeyxcMjrRQHcM8pTGrHu8yyWX:  -0.01400000 Waves

2019.09.08 11:27 [666859] smart account 3MsqcsQSU3FeyxcMjrRQHcM8pTGrHu8yyWX > SELF 0.00000000 Waves

{ "type": 13, "id": "DRsLqX2QarzkEPmF6nEBGRXqtApGqAR3sQp3idMG9SR2", "fee": 1400000, "feeAssetId": null, "timestamp": 1567931247562, "version": 1, "sender": "3MsqcsQSU3FeyxcMjrRQHcM8pTGrHu8yyWX", "senderPublicKey": "D1oc84fv4treBFDLvPS9vQdrs7A9HwTHxaeK9C7nHRTH", "proofs": [ "4jhTzNkeSkfbyWDHeYH9av3cns29WMiqbH2b6RMCymKvrsjTNnJcW8pancWLZT1n7SYyGckP34YepqmPnZ3N4CVN" ], "script": "base64:AAIDAAAAAAAAAAAAAAAAAAAAAwAAAAFpAQAAAAtjcmVhdGVPcmRlcgAAAAEAAAAFcHJpY2UEAAAAA3BtdAkBAAAAB2V4dHJhY3QAAAABCAUAAAABaQAAAAdwYXltZW50AwkBAAAAASEAAAABCQEAAAAJaXNEZWZpbmVkAAAAAQgFAAAAA3BtdAAAAAdhc3NldElkCQAAAgAAAAECAAAAIllvdSBuZWVkIHRvIHVzZSB0b2tlbklkLCBub3Qgd2F2ZXMEAAAACmN1cnJlbnRLZXkJAAJYAAAAAQgIBQAAAAFpAAAABmNhbGxlcgAAAAVieXRlcwQAAAAHYXNzZXRJZAkAAlgAAAABCQEAAAAHZXh0cmFjdAAAAAEIBQAAAANwbXQAAAAHYXNzZXRJZAQAAAAHdW5pcUtleQkAASwAAAACCQABLAAAAAIJAAEsAAAAAgkAASwAAAACBQAAAApjdXJyZW50S2V5AgAAAAFfBQAAAAdhc3NldElkAgAAAAFfCQABpAAAAAEFAAAABmhlaWdodAkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkAASwAAAACAgAA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aXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkAASwAAAACAgAAAAhjaGVja2luXwUAAAAHdW5pcUtleQYFAAAAA25pbAAAAABT2Zs2", "chainId": 84, "height": 666859, "spentComplexity": 0 } View: original | compacted Prev: 8cGJtpNsJbDjtCxSUv8AihwNKw79pzJjgkibjMJo4gqv Next: CC6SjPAZg75MLopDhuPLdBDyAxAZmdQwHPnMNH3bqr4K Diff:
OldNewDifferences
4646 }
4747
4848
49+
50+@Callable(i)
51+func checkIn () = {
52+ let pmt = extract(i.payment)
53+ if (!(isDefined(pmt.assetId)))
54+ then throw("You need to use tokenId, not waves")
55+ else {
56+ let currentKey = toBase58String(i.caller.bytes)
57+ let assetId = toBase58String(extract(pmt.assetId))
58+ let uniqKey = ((((currentKey + "_") + assetId) + "_") + toString(height))
59+ WriteSet([DataEntry(("checkin_" + uniqKey), true)])
60+ }
61+ }
62+
63+
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44
55
66 @Callable(i)
77 func createOrder (price) = {
88 let pmt = extract(i.payment)
99 if (!(isDefined(pmt.assetId)))
1010 then throw("You need to use tokenId, not waves")
1111 else {
1212 let currentKey = toBase58String(i.caller.bytes)
1313 let assetId = toBase58String(extract(pmt.assetId))
1414 let uniqKey = ((((currentKey + "_") + assetId) + "_") + toString(height))
1515 WriteSet([DataEntry(("assetAmount_" + uniqKey), pmt.amount), DataEntry(("assetPrice_" + uniqKey), price)])
1616 }
1717 }
1818
1919
2020
2121 @Callable(i)
2222 func buyTicket (uniqKey) = {
2323 let pmt = extract(i.payment)
2424 let assetId = extract(split(uniqKey, "_")[1])
2525 let ownerId = extract(addressFromString(split(uniqKey, "_")[0]))
2626 let price = match getInteger(this, ("assetPrice_" + uniqKey)) {
2727 case p: Int =>
2828 p
2929 case _ =>
3030 0
3131 }
3232 let currentAmount = match getInteger(this, ("assetAmount_" + uniqKey)) {
3333 case a: Int =>
3434 a
3535 case _ =>
3636 0
3737 }
3838 let newAmount = (currentAmount - 1)
3939 if ((0 >= currentAmount))
4040 then throw("Have not enough of tickets for this price")
4141 else if (isDefined(pmt.assetId))
4242 then throw("You need to use waves")
4343 else if ((price > pmt.amount))
4444 then throw("Count of waves is not match price")
4545 else ScriptResult(WriteSet([DataEntry(("assetAmount_" + uniqKey), newAmount)]), TransferSet([ScriptTransfer(i.caller, 1, fromBase58String(assetId)), ScriptTransfer(ownerId, price, unit)]))
4646 }
4747
4848
49+
50+@Callable(i)
51+func checkIn () = {
52+ let pmt = extract(i.payment)
53+ if (!(isDefined(pmt.assetId)))
54+ then throw("You need to use tokenId, not waves")
55+ else {
56+ let currentKey = toBase58String(i.caller.bytes)
57+ let assetId = toBase58String(extract(pmt.assetId))
58+ let uniqKey = ((((currentKey + "_") + assetId) + "_") + toString(height))
59+ WriteSet([DataEntry(("checkin_" + uniqKey), true)])
60+ }
61+ }
62+
63+

github/deemru/w8io/169f3d6 
27.24 ms