tx · 5qHBTkaE9krL3kLkMPNrR7MjTRxcUDhMwDCiYaJaMWqU

3NCjRb9DzrDYwnCjmd15tbwLgwr4ER9HF7q:  -0.01000000 Waves

2019.11.27 18:22 [783854] smart account 3NCjRb9DzrDYwnCjmd15tbwLgwr4ER9HF7q > SELF 0.00000000 Waves

{ "type": 13, "id": "5qHBTkaE9krL3kLkMPNrR7MjTRxcUDhMwDCiYaJaMWqU", "fee": 1000000, "feeAssetId": null, "timestamp": 1574868170421, "version": 1, "sender": "3NCjRb9DzrDYwnCjmd15tbwLgwr4ER9HF7q", "senderPublicKey": "EZ3j2bh2WzP9d74uhwnA7Eg4zrteivP6K2MSYq5cCCon", "proofs": [ "5upiVtMasWm3hRtDhhLv2czDLJMh12A7aMjBPzcgDsDTi25LaeVpfQRGfQrpRnxxDyFHCeU5NbqVeDYrHUyK4k89" ], "script": "base64:AAIDAAAAAAAAAAkIARIAEgMKAQgAAAADAAAAAAt0aWNrZXRQcmljZQAAAAAAAAAAAwAAAAAFTVJUaWQBAAAAIHChkBw36JTYWgsazkDpCyVgxVwrjSJEZ1FQeglRlz1iAQAAAA9nZXRUaWNrZXRBbW91bnQAAAAABAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMCAAAAEXRpY2tldEFtb3VudFRvdGFsAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEAAAAAAAAAAAAAAAACAAAACmNvbnRleHRPYmoBAAAACWJ1eVRpY2tldAAAAAADCQAAAAAAAAIIBQAAAApjb250ZXh0T2JqAAAABmNhbGxlcgUAAAAEdGhpcwkAAAIAAAABAgAAACN0aWNrZXQgaHViIGNhbid0IGNhbGwgdGhpcyBmdW5jdGlvbgMJAAAAAAAAAgkBAAAAEUBleHRyTmF0aXZlKDEwNTMpAAAAAgUAAAAEdGhpcwIAAAAGc3RhdHVzAgAAAA90aWNrZXRpbmdQZXJpb2QEAAAAByRtYXRjaDAIBQA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CBpbiBwYXltZW50CQAAAgAAAAECAAAAFFBheW1lbnQgbm90IGF0dGFjaGVkCQAAAgAAAAECAAAAGUl0IGlzbid0IHRpY2tldGluZyBwZXJpb2QAAAAKY29udGV4dE9iagEAAAAJYWRkV2lubmVyAAAAAQAAAAdsb3R0ZXJ5BAAAAA5sb3R0ZXJ5QWRkcmVzcwkBAAAAHEBleHRyVXNlcihhZGRyZXNzRnJvbVN0cmluZykAAAABBQAAAAdsb3R0ZXJ5AwkBAAAACWlzRGVmaW5lZAAAAAEJAAQbAAAAAgUAAAAEdGhpcwkAASwAAAACAgAAAAhsb3R0ZXJ5XwUAAAAHbG90dGVyeQQAAAANd2lubmVyQWRkcmVzcwkBAAAAEUBleHRyTmF0aXZlKDEwNTMpAAAAAgUAAAAObG90dGVyeUFkZHJlc3MCAAAADXdpbm5lckFkZHJlc3MEAAAADHdpbm5lclRpY2tldAkBAAAAEUBleHRyTmF0aXZlKDEwNTApAAAAAgUAAAAObG90dGVyeUFkZHJlc3MCAAAADHdpbm5lclRpY2tldAkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkAASwAAAACAgAAAA13aW5uaW5nVGlja2V0CQABpAAAAAEFAAAADHdpbm5lclRpY2tldAUAAAANd2lubmVyQWRkcmVzcwUAAAADbmlsCQAAAgAAAAECAAAAI3lvdSB0b3VjaCBpbmNvcnJlY3QgbG90dGVyeSBhZGRyZXNzAAAAAHNDT34=", "chainId": 84, "height": 783854, "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'8afYrbDBr6Tw5JgaWUgm2GncY7rL87JvGG7aWezWMGgZ'
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/169f3d6 
23.57 ms