tx · 3MaQF2RpkVDUkPf2aLj8mTdHKwvKoFDTProYx4Y3uk18

3NBnUoHfxSDfoqjnDU2JGaXyK2fYJaB5JyZ:  -0.01000000 Waves

2019.12.02 19:41 [791311] smart account 3NBnUoHfxSDfoqjnDU2JGaXyK2fYJaB5JyZ > SELF 0.00000000 Waves

{ "type": 13, "id": "3MaQF2RpkVDUkPf2aLj8mTdHKwvKoFDTProYx4Y3uk18", "fee": 1000000, "feeAssetId": null, "timestamp": 1575304866568, "version": 1, "sender": "3NBnUoHfxSDfoqjnDU2JGaXyK2fYJaB5JyZ", "senderPublicKey": "Gq13j7CGZCkbVaaXWL7JTW8WkRTdci1Vx8Hc3buuzGDr", "proofs": [ "5SwukznAe4GMakoKwoJmv2fE2mPzAUswpJn2AxveqjqdLBizKkH91nz5mpMB8sftgy49NaFpgD4RsRAd5Kvi2GEZ" ], "script": "base64:AAIDAAAAAAAAAAkIARIAEgMKAQgAAAADAAAAAAt0aWNrZXRQcmljZQkAAGgAAAACAAAAAAAAAABkAAAAAAAAAABkAAAAAAVNUlRpZAEAAAAgKeael6TKukPl2shoQI/BCqNOkI24cGFIFf/zOPYqBTwBAAAAD2dldFRpY2tldEFtb3VudAAAAAAEAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwIAAAARdGlja2V0QW1vdW50VG90YWwDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQAAAAAAAAAAAAAAAAIAAAAKY29udGV4dE9iagEAAAAJYnV5VGlja2V0AAAAAAMJAAAAAAAAAggFAAAACmNvbnRleHRPYmoAAAAGY2FsbGVyBQAAAAR0aGlzCQAAAgAAAAECAAAAI3RpY2tldCBodWIgY2FuJ3QgY2FsbCB0aGlzIGZ1bmN0aW9uAwkAAAAAAAACCQEAAAARQGV4dHJOYXRpdmUoMTA1MykAAAACBQAAAAR0aGlzAgAAAAZzdGF0dXMCAAAAD3RpY2tldGluZ1BlcmlvZA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b3VudCBvciBhc3NldElkIGluIHBheW1lbnQJAAACAAAAAQIAAAAUUGF5bWVudCBub3QgYXR0YWNoZWQJAAACAAAAAQIAAAAZSXQgaXNuJ3QgdGlja2V0aW5nIHBlcmlvZAAAAApjb250ZXh0T2JqAQAAAAlhZGRXaW5uZXIAAAABAAAAB2xvdHRlcnkEAAAADmxvdHRlcnlBZGRyZXNzCQEAAAAcQGV4dHJVc2VyKGFkZHJlc3NGcm9tU3RyaW5nKQAAAAEFAAAAB2xvdHRlcnkDCQEAAAAJaXNEZWZpbmVkAAAAAQkABBsAAAACBQAAAAR0aGlzCQABLAAAAAICAAAACGxvdHRlcnlfBQAAAAdsb3R0ZXJ5BAAAAA13aW5uZXJBZGRyZXNzCQEAAAARQGV4dHJOYXRpdmUoMTA1MykAAAACBQAAAA5sb3R0ZXJ5QWRkcmVzcwIAAAANd2lubmVyQWRkcmVzcwQAAAAMd2lubmVyVGlja2V0CQEAAAARQGV4dHJOYXRpdmUoMTA1MCkAAAACBQAAAA5sb3R0ZXJ5QWRkcmVzcwIAAAAMd2lubmVyVGlja2V0CQEAAAAIV3JpdGVTZXQAAAABCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQABLAAAAAICAAAADXdpbm5pbmdUaWNrZXQJAAGkAAAAAQUAAAAMd2lubmVyVGlja2V0BQAAAA13aW5uZXJBZGRyZXNzBQAAAANuaWwJAAACAAAAAQIAAAAjeW91IHRvdWNoIGluY29ycmVjdCBsb3R0ZXJ5IGFkZHJlc3MAAAAA/Ewa2Q==", "chainId": 84, "height": 791311, "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 = (100 * 100)
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/169f3d6 
37.12 ms