tx · 8jPgiKRQ3Ck5FBVUBenbXv4HHQaRVXDtYKDE45H51hiG

3N5kv9zPPj9YbiMXbCeiCNf9o5B5M9NC4Ps:  -0.01000000 Waves

2019.12.02 18:23 [791224] smart account 3N5kv9zPPj9YbiMXbCeiCNf9o5B5M9NC4Ps > SELF 0.00000000 Waves

{ "type": 13, "id": "8jPgiKRQ3Ck5FBVUBenbXv4HHQaRVXDtYKDE45H51hiG", "fee": 1000000, "feeAssetId": null, "timestamp": 1575300180488, "version": 1, "sender": "3N5kv9zPPj9YbiMXbCeiCNf9o5B5M9NC4Ps", "senderPublicKey": "85CmZ2RmgncdEzYyCV1uWovKo5YmJLPMtLMGXYyB8K7Q", "proofs": [ "2kLeopneCsJw17CsKqr4DKgSXqVSLpEGLAVzy8QXDVEBoiBPh9bF3br7ZaURrG189zhsgUM7s6FyrzLu6t6VVdGC" ], "script": "base64:AAIDAAAAAAAAAAkIARIAEgMKAQgAAAADAAAAAAt0aWNrZXRQcmljZQAAAAAAAAAAAwAAAAAFTVJUaWQBAAAAICnmnpekyrpD5drIaECPwQqjTpCNuHBhSBX/8zj2KgU8AQAAAA9nZXRUaWNrZXRBbW91bnQAAAAABAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMCAAAAEXRpY2tldEFtb3VudFRvdGFsAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEAAAAAAAAAAAAAAAACAAAACmNvbnRleHRPYmoBAAAACWJ1eVRpY2tldAAAAAADCQAAAAAAAAIIBQAAAApjb250ZXh0T2JqAAAABmNhbGxlcgUAAAAEdGhpcwkAAAIAAAABAgAAACN0aWNrZXQgaHViIGNhbid0IGNhbGwgdGhpcyBmdW5jdGlvbgMJAAAAAAAAAgkBAAAAEUBleHRyTmF0aXZlKDEwNTMpAAAAAgUAAAAEdGhpcwIAAAAGc3RhdHVzAgAAAA90aWNrZXRpbmdQZXJpb2QEAAAAByRtYXRja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zZXRJZCBpbiBwYXltZW50CQAAAgAAAAECAAAAFFBheW1lbnQgbm90IGF0dGFjaGVkCQAAAgAAAAECAAAAGUl0IGlzbid0IHRpY2tldGluZyBwZXJpb2QAAAAKY29udGV4dE9iagEAAAAJYWRkV2lubmVyAAAAAQAAAAdsb3R0ZXJ5BAAAAA5sb3R0ZXJ5QWRkcmVzcwkBAAAAHEBleHRyVXNlcihhZGRyZXNzRnJvbVN0cmluZykAAAABBQAAAAdsb3R0ZXJ5AwkBAAAACWlzRGVmaW5lZAAAAAEJAAQbAAAAAgUAAAAEdGhpcwkAASwAAAACAgAAAAhsb3R0ZXJ5XwUAAAAHbG90dGVyeQQAAAANd2lubmVyQWRkcmVzcwkBAAAAEUBleHRyTmF0aXZlKDEwNTMpAAAAAgUAAAAObG90dGVyeUFkZHJlc3MCAAAADXdpbm5lckFkZHJlc3MEAAAADHdpbm5lclRpY2tldAkBAAAAEUBleHRyTmF0aXZlKDEwNTApAAAAAgUAAAAObG90dGVyeUFkZHJlc3MCAAAADHdpbm5lclRpY2tldAkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkAASwAAAACAgAAAA13aW5uaW5nVGlja2V0CQABpAAAAAEFAAAADHdpbm5lclRpY2tldAUAAAANd2lubmVyQWRkcmVzcwUAAAADbmlsCQAAAgAAAAECAAAAI3lvdSB0b3VjaCBpbmNvcnJlY3QgbG90dGVyeSBhZGRyZXNzAAAAABhx4Qo=", "chainId": 84, "height": 791224, "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
OldNewDifferences
1-# no script
1+{-# STDLIB_VERSION 3 #-}
2+{-# SCRIPT_TYPE ACCOUNT #-}
3+{-# CONTENT_TYPE DAPP #-}
4+let ticketPrice = 3
5+
6+let MRTid = base58'3pZgFJLNfUey8rnyG6zrTVwvXdptnUZdkmpYu3wY5CuR'
7+
8+func getTicketAmount () = match getInteger(this, "ticketAmountTotal") {
9+ case a: Int =>
10+ a
11+ case _ =>
12+ 0
13+}
14+
15+
16+@Callable(contextObj)
17+func buyTicket () = if ((contextObj.caller == this))
18+ then throw("ticket hub can't call this function")
19+ else if ((getStringValue(this, "status") == "ticketingPeriod"))
20+ then match contextObj.payment {
21+ case p: AttachedPayment =>
22+ if (if ((p.amount >= ticketPrice))
23+ then (p.assetId == MRTid)
24+ else false)
25+ then {
26+ let ticketsBuyingAmount = (p.amount / ticketPrice)
27+ let ticketAmountTotalCurrent = getTicketAmount()
28+ let ticketAmountTotalNew = (ticketAmountTotalCurrent + ticketsBuyingAmount)
29+ let ticketsFrom = toString((ticketAmountTotalCurrent + 1))
30+ let ticketsTo = toString((ticketAmountTotalCurrent + ticketsBuyingAmount))
31+ let caller = toString(contextObj.caller)
32+ WriteSet([DataEntry(((("ticketsFrom" + ticketsFrom) + "To") + ticketsTo), caller), DataEntry("ticketAmountTotal", ticketAmountTotalNew)])
33+ }
34+ else throw("Incorrect amount or assetId in payment")
35+ case _ =>
36+ throw("Payment not attached")
37+ }
38+ else throw("It isn't ticketing period")
39+
40+
41+
42+@Callable(contextObj)
43+func addWinner (lottery) = {
44+ let lotteryAddress = addressFromStringValue(lottery)
45+ if (isDefined(getBoolean(this, ("lottery_" + lottery))))
46+ then {
47+ let winnerAddress = getStringValue(lotteryAddress, "winnerAddress")
48+ let winnerTicket = getIntegerValue(lotteryAddress, "winnerTicket")
49+ WriteSet([DataEntry(("winningTicket" + toString(winnerTicket)), winnerAddress)])
50+ }
51+ else throw("you touch incorrect lottery address")
52+ }
53+
54+

github/deemru/w8io/026f985 
18.60 ms