tx · F1rNmiKXKwzaqpniGZPS9pWYdDpmuDbH89Vsj2YNLAg1

3N8nB5XeXcXTUDeiH6657UHa3wHa2rbZfDk:  -0.01500000 Waves

2021.06.07 21:12 [1560281] smart account 3N8nB5XeXcXTUDeiH6657UHa3wHa2rbZfDk > SELF 0.00000000 Waves

{ "type": 13, "id": "F1rNmiKXKwzaqpniGZPS9pWYdDpmuDbH89Vsj2YNLAg1", "fee": 1500000, "feeAssetId": null, "timestamp": 1623089518660, "version": 2, "chainId": 84, "sender": "3N8nB5XeXcXTUDeiH6657UHa3wHa2rbZfDk", "senderPublicKey": "BfXK2ez9xjdgWtoFNsnaGPRFjHcFixy3UUrQ2iN8wVfX", "proofs": [ "zQnuy75TjxjHh8NChg4AdBb9t18nizH4EnDegAM4Yo3R8euQgAuFiGsV8718CMNAmnKe2AgJj2vs319wPvpWiCj" ], "script": "base64:AAIEAAAAAAAAABUIAhIICgYICAgBAQESBwoFCAEBAQgAAAABAQAAABZjcmVhdGVQYXJraW5nU3BvdFNsaWNlAAAABAAAAA1wYXJraW5nU3BvdElkAAAACXN0YXJ0VGltZQAAAAdlbmRUaW1lAAAABXNsaWNlCQAETAAAAAIJAQAAAAxJbnRlZ2VyRW50cnkAAAACCQABLAAAAAIJAAEsAAAAAgkAASwAAAACBQAAAA1wYXJraW5nU3BvdElkAgAAAAdfc2xpY2VfCQABpAAAAAEFAAAABXNsaWNlAgAAAApfc3RhcnRUaW1lBQAAAAlzdGFydFRpbWUJAARMAAAAAgkBAAAADEludGVnZXJFbnRyeQAAAAIJAAEsAAAAAgkAASwAAAACCQABLAAAAAIFAAAADXBhcmtpbmdTcG90SWQCAAAAB19zbGljZV8JAAGkAAAAAQUAAAAFc2xpY2UCAAAACF9lbmRUaW1lBQAAAAdlbmRUaW1lBQAAAANuaWwAAAACAAAAAWkBAAAAEWNyZWF0ZVBhcmtpbmdTcG90AAAABgAAAAVvd25lcgAAAANsYXQAAAAEbG9uZwAAAAlzdGFydFRpbWUAAAAH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LZXkbBsH6", "height": 1560281, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 6ntZXaiJwLuixXe6LwSeUrT22RppxMfAsrFCEhy9bqRx Next: 9jadiwQiokxWMfw2cPm6FbcTeCFEQdYnHcFbz3nKVWeC Diff:
OldNewDifferences
1717 func bookParkingSpotSlice (parkingSpotId,desiredSlice,startTime,endTime,renter) = {
1818 let payment = i.payments[0]
1919 let cost = 15
20- if (!(isDefined(payment)))
21- then throw("missing payment")
22- else {
23- let bookedStartTime = (startTime - (startTime % 3600))
24- let bookedEndTime = (endTime - (endTime % 3600))
25- let parkingSpotStartTime = getIntegerValue(this, (((parkingSpotId + "_slice_") + toString(desiredSlice)) + "_startTime"))
26- let parkingSpotEndTime = getIntegerValue(this, (((parkingSpotId + "_slice_") + toString(desiredSlice)) + "_endTime"))
27- let existingSlice = getIntegerValue(this, (parkingSpotId + "_slice"))
28- if (if ((parkingSpotStartTime > bookedStartTime))
29- then true
30- else (bookedEndTime > parkingSpotEndTime))
31- then throw("time is out of range for parking spot")
32- else {
33- let existingRenter = getString(this, (((parkingSpotId + "_slice_") + toString(desiredSlice)) + "_renter"))
34- if ((existingRenter != unit))
35- then throw("parking spot has already been booked")
36- else if (if ((bookedStartTime == parkingSpotStartTime))
37- then (bookedEndTime == parkingSpotEndTime)
38- else false)
39- then [StringEntry((((parkingSpotId + "_slice_") + toString(desiredSlice)) + "_renter"), renter), IntegerEntry((((parkingSpotId + "_slice_") + toString(desiredSlice)) + "_slicetest0"), desiredSlice)]
20+ if (isDefined(payment.assetId))
21+ then throw("payment should be in waves")
22+ else if ((payment.amount != cost))
23+ then throw(((("payment is less than required, sent: " + toString(cost)) + " , required: ") + toString(cost)))
24+ else {
25+ let bookedStartTime = (startTime - (startTime % 3600))
26+ let bookedEndTime = (endTime - (endTime % 3600))
27+ let parkingSpotStartTime = getIntegerValue(this, (((parkingSpotId + "_slice_") + toString(desiredSlice)) + "_startTime"))
28+ let parkingSpotEndTime = getIntegerValue(this, (((parkingSpotId + "_slice_") + toString(desiredSlice)) + "_endTime"))
29+ let existingSlice = getIntegerValue(this, (parkingSpotId + "_slice"))
30+ if (if ((parkingSpotStartTime > bookedStartTime))
31+ then true
32+ else (bookedEndTime > parkingSpotEndTime))
33+ then throw("time is out of range for parking spot")
34+ else {
35+ let existingRenter = getString(this, (((parkingSpotId + "_slice_") + toString(desiredSlice)) + "_renter"))
36+ if ((existingRenter != unit))
37+ then throw("parking spot has already been booked")
4038 else if (if ((bookedStartTime == parkingSpotStartTime))
41- then (bookedEndTime != parkingSpotEndTime)
39+ then (bookedEndTime == parkingSpotEndTime)
4240 else false)
43- then ([StringEntry((((parkingSpotId + "_slice_") + toString(desiredSlice)) + "_renter"), renter), IntegerEntry((((parkingSpotId + "_slice_") + toString(desiredSlice)) + "_startTime"), bookedStartTime), IntegerEntry((((parkingSpotId + "_slice_") + toString(desiredSlice)) + "_endTime"), bookedEndTime), IntegerEntry((parkingSpotId + "_slice"), (existingSlice + 1))] ++ createParkingSpotSlice(parkingSpotId, bookedEndTime, parkingSpotEndTime, (existingSlice + 1)))
44- else if (if ((bookedEndTime == parkingSpotEndTime))
45- then (bookedStartTime != parkingSpotStartTime)
41+ then [StringEntry((((parkingSpotId + "_slice_") + toString(desiredSlice)) + "_renter"), renter), IntegerEntry((((parkingSpotId + "_slice_") + toString(desiredSlice)) + "_slicetest0"), desiredSlice)]
42+ else if (if ((bookedStartTime == parkingSpotStartTime))
43+ then (bookedEndTime != parkingSpotEndTime)
4644 else false)
47- then ([StringEntry((((parkingSpotId + "_slice_") + toString(desiredSlice)) + "_renter"), renter), IntegerEntry((((parkingSpotId + "_slice_") + toString(desiredSlice)) + "_startTime"), bookedStartTime), IntegerEntry((((parkingSpotId + "_slice_") + toString(desiredSlice)) + "_endTime"), bookedEndTime), IntegerEntry((parkingSpotId + "_slice"), (existingSlice + 1))] ++ createParkingSpotSlice(parkingSpotId, parkingSpotStartTime, bookedStartTime, (existingSlice + 1)))
48- else (([StringEntry((((parkingSpotId + "_slice_") + toString(desiredSlice)) + "_renter"), renter), IntegerEntry((((parkingSpotId + "_slice_") + toString(desiredSlice)) + "_startTime"), bookedStartTime), IntegerEntry((((parkingSpotId + "_slice_") + toString(desiredSlice)) + "_endTime"), bookedEndTime), IntegerEntry((parkingSpotId + "_slice"), (existingSlice + 2))] ++ createParkingSpotSlice(parkingSpotId, parkingSpotStartTime, bookedStartTime, (existingSlice + 1))) ++ createParkingSpotSlice(parkingSpotId, bookedEndTime, parkingSpotEndTime, (existingSlice + 2)))
49- }
50- }
45+ then ([StringEntry((((parkingSpotId + "_slice_") + toString(desiredSlice)) + "_renter"), renter), IntegerEntry((((parkingSpotId + "_slice_") + toString(desiredSlice)) + "_startTime"), bookedStartTime), IntegerEntry((((parkingSpotId + "_slice_") + toString(desiredSlice)) + "_endTime"), bookedEndTime), IntegerEntry((parkingSpotId + "_slice"), (existingSlice + 1))] ++ createParkingSpotSlice(parkingSpotId, bookedEndTime, parkingSpotEndTime, (existingSlice + 1)))
46+ else if (if ((bookedEndTime == parkingSpotEndTime))
47+ then (bookedStartTime != parkingSpotStartTime)
48+ else false)
49+ then ([StringEntry((((parkingSpotId + "_slice_") + toString(desiredSlice)) + "_renter"), renter), IntegerEntry((((parkingSpotId + "_slice_") + toString(desiredSlice)) + "_startTime"), bookedStartTime), IntegerEntry((((parkingSpotId + "_slice_") + toString(desiredSlice)) + "_endTime"), bookedEndTime), IntegerEntry((parkingSpotId + "_slice"), (existingSlice + 1))] ++ createParkingSpotSlice(parkingSpotId, parkingSpotStartTime, bookedStartTime, (existingSlice + 1)))
50+ else (([StringEntry((((parkingSpotId + "_slice_") + toString(desiredSlice)) + "_renter"), renter), IntegerEntry((((parkingSpotId + "_slice_") + toString(desiredSlice)) + "_startTime"), bookedStartTime), IntegerEntry((((parkingSpotId + "_slice_") + toString(desiredSlice)) + "_endTime"), bookedEndTime), IntegerEntry((parkingSpotId + "_slice"), (existingSlice + 2))] ++ createParkingSpotSlice(parkingSpotId, parkingSpotStartTime, bookedStartTime, (existingSlice + 1))) ++ createParkingSpotSlice(parkingSpotId, bookedEndTime, parkingSpotEndTime, (existingSlice + 2)))
51+ }
52+ }
5153 }
5254
5355
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 4 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 func createParkingSpotSlice (parkingSpotId,startTime,endTime,slice) = [IntegerEntry((((parkingSpotId + "_slice_") + toString(slice)) + "_startTime"), startTime), IntegerEntry((((parkingSpotId + "_slice_") + toString(slice)) + "_endTime"), endTime)]
55
66
77 @Callable(i)
88 func createParkingSpot (owner,lat,long,startTime,endTime,cost) = {
99 let roundedStartTime = (startTime - (startTime % 3600))
1010 let roundedEndTime = (endTime - (endTime % 3600))
1111 ([StringEntry((toBase58String(i.transactionId) + "_owner"), owner), StringEntry((toBase58String(i.transactionId) + "_lat"), lat), StringEntry((toBase58String(i.transactionId) + "_long"), long), IntegerEntry((toBase58String(i.transactionId) + "_cost"), cost), IntegerEntry((toBase58String(i.transactionId) + "_slice"), 0)] ++ createParkingSpotSlice(toBase58String(i.transactionId), roundedStartTime, roundedEndTime, 0))
1212 }
1313
1414
1515
1616 @Callable(i)
1717 func bookParkingSpotSlice (parkingSpotId,desiredSlice,startTime,endTime,renter) = {
1818 let payment = i.payments[0]
1919 let cost = 15
20- if (!(isDefined(payment)))
21- then throw("missing payment")
22- else {
23- let bookedStartTime = (startTime - (startTime % 3600))
24- let bookedEndTime = (endTime - (endTime % 3600))
25- let parkingSpotStartTime = getIntegerValue(this, (((parkingSpotId + "_slice_") + toString(desiredSlice)) + "_startTime"))
26- let parkingSpotEndTime = getIntegerValue(this, (((parkingSpotId + "_slice_") + toString(desiredSlice)) + "_endTime"))
27- let existingSlice = getIntegerValue(this, (parkingSpotId + "_slice"))
28- if (if ((parkingSpotStartTime > bookedStartTime))
29- then true
30- else (bookedEndTime > parkingSpotEndTime))
31- then throw("time is out of range for parking spot")
32- else {
33- let existingRenter = getString(this, (((parkingSpotId + "_slice_") + toString(desiredSlice)) + "_renter"))
34- if ((existingRenter != unit))
35- then throw("parking spot has already been booked")
36- else if (if ((bookedStartTime == parkingSpotStartTime))
37- then (bookedEndTime == parkingSpotEndTime)
38- else false)
39- then [StringEntry((((parkingSpotId + "_slice_") + toString(desiredSlice)) + "_renter"), renter), IntegerEntry((((parkingSpotId + "_slice_") + toString(desiredSlice)) + "_slicetest0"), desiredSlice)]
20+ if (isDefined(payment.assetId))
21+ then throw("payment should be in waves")
22+ else if ((payment.amount != cost))
23+ then throw(((("payment is less than required, sent: " + toString(cost)) + " , required: ") + toString(cost)))
24+ else {
25+ let bookedStartTime = (startTime - (startTime % 3600))
26+ let bookedEndTime = (endTime - (endTime % 3600))
27+ let parkingSpotStartTime = getIntegerValue(this, (((parkingSpotId + "_slice_") + toString(desiredSlice)) + "_startTime"))
28+ let parkingSpotEndTime = getIntegerValue(this, (((parkingSpotId + "_slice_") + toString(desiredSlice)) + "_endTime"))
29+ let existingSlice = getIntegerValue(this, (parkingSpotId + "_slice"))
30+ if (if ((parkingSpotStartTime > bookedStartTime))
31+ then true
32+ else (bookedEndTime > parkingSpotEndTime))
33+ then throw("time is out of range for parking spot")
34+ else {
35+ let existingRenter = getString(this, (((parkingSpotId + "_slice_") + toString(desiredSlice)) + "_renter"))
36+ if ((existingRenter != unit))
37+ then throw("parking spot has already been booked")
4038 else if (if ((bookedStartTime == parkingSpotStartTime))
41- then (bookedEndTime != parkingSpotEndTime)
39+ then (bookedEndTime == parkingSpotEndTime)
4240 else false)
43- then ([StringEntry((((parkingSpotId + "_slice_") + toString(desiredSlice)) + "_renter"), renter), IntegerEntry((((parkingSpotId + "_slice_") + toString(desiredSlice)) + "_startTime"), bookedStartTime), IntegerEntry((((parkingSpotId + "_slice_") + toString(desiredSlice)) + "_endTime"), bookedEndTime), IntegerEntry((parkingSpotId + "_slice"), (existingSlice + 1))] ++ createParkingSpotSlice(parkingSpotId, bookedEndTime, parkingSpotEndTime, (existingSlice + 1)))
44- else if (if ((bookedEndTime == parkingSpotEndTime))
45- then (bookedStartTime != parkingSpotStartTime)
41+ then [StringEntry((((parkingSpotId + "_slice_") + toString(desiredSlice)) + "_renter"), renter), IntegerEntry((((parkingSpotId + "_slice_") + toString(desiredSlice)) + "_slicetest0"), desiredSlice)]
42+ else if (if ((bookedStartTime == parkingSpotStartTime))
43+ then (bookedEndTime != parkingSpotEndTime)
4644 else false)
47- then ([StringEntry((((parkingSpotId + "_slice_") + toString(desiredSlice)) + "_renter"), renter), IntegerEntry((((parkingSpotId + "_slice_") + toString(desiredSlice)) + "_startTime"), bookedStartTime), IntegerEntry((((parkingSpotId + "_slice_") + toString(desiredSlice)) + "_endTime"), bookedEndTime), IntegerEntry((parkingSpotId + "_slice"), (existingSlice + 1))] ++ createParkingSpotSlice(parkingSpotId, parkingSpotStartTime, bookedStartTime, (existingSlice + 1)))
48- else (([StringEntry((((parkingSpotId + "_slice_") + toString(desiredSlice)) + "_renter"), renter), IntegerEntry((((parkingSpotId + "_slice_") + toString(desiredSlice)) + "_startTime"), bookedStartTime), IntegerEntry((((parkingSpotId + "_slice_") + toString(desiredSlice)) + "_endTime"), bookedEndTime), IntegerEntry((parkingSpotId + "_slice"), (existingSlice + 2))] ++ createParkingSpotSlice(parkingSpotId, parkingSpotStartTime, bookedStartTime, (existingSlice + 1))) ++ createParkingSpotSlice(parkingSpotId, bookedEndTime, parkingSpotEndTime, (existingSlice + 2)))
49- }
50- }
45+ then ([StringEntry((((parkingSpotId + "_slice_") + toString(desiredSlice)) + "_renter"), renter), IntegerEntry((((parkingSpotId + "_slice_") + toString(desiredSlice)) + "_startTime"), bookedStartTime), IntegerEntry((((parkingSpotId + "_slice_") + toString(desiredSlice)) + "_endTime"), bookedEndTime), IntegerEntry((parkingSpotId + "_slice"), (existingSlice + 1))] ++ createParkingSpotSlice(parkingSpotId, bookedEndTime, parkingSpotEndTime, (existingSlice + 1)))
46+ else if (if ((bookedEndTime == parkingSpotEndTime))
47+ then (bookedStartTime != parkingSpotStartTime)
48+ else false)
49+ then ([StringEntry((((parkingSpotId + "_slice_") + toString(desiredSlice)) + "_renter"), renter), IntegerEntry((((parkingSpotId + "_slice_") + toString(desiredSlice)) + "_startTime"), bookedStartTime), IntegerEntry((((parkingSpotId + "_slice_") + toString(desiredSlice)) + "_endTime"), bookedEndTime), IntegerEntry((parkingSpotId + "_slice"), (existingSlice + 1))] ++ createParkingSpotSlice(parkingSpotId, parkingSpotStartTime, bookedStartTime, (existingSlice + 1)))
50+ else (([StringEntry((((parkingSpotId + "_slice_") + toString(desiredSlice)) + "_renter"), renter), IntegerEntry((((parkingSpotId + "_slice_") + toString(desiredSlice)) + "_startTime"), bookedStartTime), IntegerEntry((((parkingSpotId + "_slice_") + toString(desiredSlice)) + "_endTime"), bookedEndTime), IntegerEntry((parkingSpotId + "_slice"), (existingSlice + 2))] ++ createParkingSpotSlice(parkingSpotId, parkingSpotStartTime, bookedStartTime, (existingSlice + 1))) ++ createParkingSpotSlice(parkingSpotId, bookedEndTime, parkingSpotEndTime, (existingSlice + 2)))
51+ }
52+ }
5153 }
5254
5355
5456 @Verifier(tx)
5557 func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
5658

github/deemru/w8io/026f985 
32.74 ms