tx · 4Uv8Tn6GUToksBEFdotzSLLqMeDKAoSi1EQv82sr9nfP

3N8sAHbQNJtR2fdMny1XGbUdrhmCA34vVWC:  -0.01000000 Waves

2019.11.25 15:17 [780775] smart account 3N8sAHbQNJtR2fdMny1XGbUdrhmCA34vVWC > SELF 0.00000000 Waves

{ "type": 13, "id": "4Uv8Tn6GUToksBEFdotzSLLqMeDKAoSi1EQv82sr9nfP", "fee": 1000000, "feeAssetId": null, "timestamp": 1574684277212, "version": 1, "sender": "3N8sAHbQNJtR2fdMny1XGbUdrhmCA34vVWC", "senderPublicKey": "AszaubQMqjNrpkLg2dErde5dGA49rMKBZDzYwtxLXEGD", "proofs": [ "3q4gPEt7SBm2wE9oXQ8qUSSFUTNLpZDMDQYtyfagcsrUKhgnhGfdn5oq5A58GG8ay8sCyHgVtNxv9Yh2vVv6zX7c" ], "script": "base64:AAIDAAAAAAAAAAwIARIDCgEIEgMKAQgAAAADAAAAAAt0aWNrZXRQcmljZQAAAAAAAAAAAwAAAAAFTVJUaWQBAAAAIHChkBw36JTYWgsazkDpCyVgxVwrjSJEZ1FQeglRlz1iAQAAAA9nZXRUaWNrZXRBbW91bnQAAAAABAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMCAAAAEXRpY2tldEFtb3VudFRvdGFsAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEAAAAAAAAAAAAAAAACAAAACmNvbnRleHRPYmoBAAAACWJ1eVRpY2tldAAAAAEAAAANYWRkcmVzVG9MZWFzZQQAAAAHJG1hdGNoMAgFAAAACmNvbnRleHRPYmoAAAAHcGF5bWVudAMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAPQXR0YWNoZWRQYXltZW50BAAAAAFwBQAAAAckbWF0Y2gwAwMJAABnAAAAAggFAAAAAXAAAAAGYW1vdW50BQAAAAt0aWNrZXRQcmljZQkAAAAAAAACCAUAAAABcAAAAAdhc3NldElkB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cmluZykAAAABBQAAAAdsb3R0ZXJ5AwkBAAAACWlzRGVmaW5lZAAAAAEJAAQbAAAAAgUAAAAEdGhpcwUAAAAHbG90dGVyeQQAAAANd2lubmVyQWRkcmVzcwkBAAAAEUBleHRyTmF0aXZlKDEwNTMpAAAAAgUAAAAObG90dGVyeUFkZHJlc3MCAAAADXdpbm5lckFkZHJlc3MEAAAADHdpbm5lclRpY2tldAkBAAAAEUBleHRyTmF0aXZlKDEwNTApAAAAAgUAAAAObG90dGVyeUFkZHJlc3MCAAAADHdpbm5lclRpY2tldAkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkAASwAAAACAgAAAA13aW5uaW5nVGlja2V0CQABpAAAAAEFAAAADHdpbm5lclRpY2tldAUAAAANd2lubmVyQWRkcmVzcwUAAAADbmlsCQAAAgAAAAECAAAAI3lvdSB0b3VjaCBpbmNvcnJlY3QgbG90dGVyeSBhZGRyZXNzAAAAAK9pK7M=", "chainId": 84, "height": 780775, "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 (addresToLease) = match contextObj.payment {
18+ case p: AttachedPayment =>
19+ if (if ((p.amount >= ticketPrice))
20+ then (p.assetId == MRTid)
21+ else false)
22+ then {
23+ let ticketsBuyingAmount = (p.amount / ticketPrice)
24+ let ticketAmountTotalCurrent = getTicketAmount()
25+ let ticketAmountTotalNew = (ticketAmountTotalCurrent + ticketsBuyingAmount)
26+ let ticketsFrom = toString((ticketAmountTotalCurrent + 1))
27+ let ticketsTo = toString((ticketAmountTotalCurrent + ticketsBuyingAmount))
28+ WriteSet([DataEntry(((((("ticketsFrom" + ticketsFrom) + "To") + ticketsTo) + "_") + toString(contextObj.caller)), addresToLease), DataEntry("ticketAmountTotal", ticketAmountTotalNew)])
29+ }
30+ else throw("Incorrect amount or assetId in payment")
31+ case _ =>
32+ throw("Payment not attached")
33+}
34+
35+
36+
37+@Callable(contextObj)
38+func addWinner (lottery) = {
39+ let lotteryAddress = addressFromStringValue(lottery)
40+ if (isDefined(getBoolean(this, lottery)))
41+ then {
42+ let winnerAddress = getStringValue(lotteryAddress, "winnerAddress")
43+ let winnerTicket = getIntegerValue(lotteryAddress, "winnerTicket")
44+ WriteSet([DataEntry(("winningTicket" + toString(winnerTicket)), winnerAddress)])
45+ }
46+ else throw("you touch incorrect lottery address")
47+ }
48+
49+

github/deemru/w8io/169f3d6 
17.21 ms