tx · EMZNaCq8LE6R1FPQ5n74zh6Q27jxVcFFETeHCRKf4CVS

3N5yhVkV6JS3NNqsQuLoVFJ1j3YP7uDzoQ3:  -0.01000000 Waves

2019.11.25 17:58 [780943] smart account 3N5yhVkV6JS3NNqsQuLoVFJ1j3YP7uDzoQ3 > SELF 0.00000000 Waves

{ "type": 13, "id": "EMZNaCq8LE6R1FPQ5n74zh6Q27jxVcFFETeHCRKf4CVS", "fee": 1000000, "feeAssetId": null, "timestamp": 1574693922675, "version": 1, "sender": "3N5yhVkV6JS3NNqsQuLoVFJ1j3YP7uDzoQ3", "senderPublicKey": "2hNvGkuWTr1UwJVDT4rM3B4CmF9NXUSgfrFmcDdu8Bwk", "proofs": [ "2mKsTHcNUsk94RXQ1ARFg8hMNseqRXRXHgmtNP7SHzbv27AGN2dgyM9tEq2P3W4TkYNeaRpAeAindbQydkhxSk7C" ], "script": "base64:AAIDAAAAAAAAAAkIARIAEgMKAQgAAAADAAAAAAt0aWNrZXRQcmljZQAAAAAAAAAAAwAAAAAFTVJUaWQBAAAAIHChkBw36JTYWgsazkDpCyVgxVwrjSJEZ1FQeglRlz1iAQAAAA9nZXRUaWNrZXRBbW91bnQAAAAABAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMCAAAAEXRpY2tldEFtb3VudFRvdGFsAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEAAAAAAAAAAAAAAAACAAAACmNvbnRleHRPYmoBAAAACWJ1eVRpY2tldAAAAAAEAAAAByRtYXRjaDAIBQAAAApjb250ZXh0T2JqAAAAB3BheW1lbnQDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAD0F0dGFjaGVkUGF5bWVudAQAAAABcAUAAAAHJG1hdGNoMAMDCQAAZwAAAAIIBQAAAAFwAAAABmFtb3VudAUAAAALdGlja2V0UHJpY2UJAAAAAAAAAggFAAAAAXAAAAAHYXNzZXRJZAUAAAAFTVJU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AAlpc0RlZmluZWQAAAABCQAEGwAAAAIFAAAABHRoaXMFAAAAB2xvdHRlcnkEAAAADXdpbm5lckFkZHJlc3MJAQAAABFAZXh0ck5hdGl2ZSgxMDUzKQAAAAIFAAAADmxvdHRlcnlBZGRyZXNzAgAAAA13aW5uZXJBZGRyZXNzBAAAAAx3aW5uZXJUaWNrZXQJAQAAABFAZXh0ck5hdGl2ZSgxMDUwKQAAAAIFAAAADmxvdHRlcnlBZGRyZXNzAgAAAAx3aW5uZXJUaWNrZXQJAQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAAEsAAAAAgIAAAANd2lubmluZ1RpY2tldAkAAaQAAAABBQAAAAx3aW5uZXJUaWNrZXQFAAAADXdpbm5lckFkZHJlc3MFAAAAA25pbAkAAAIAAAABAgAAACN5b3UgdG91Y2ggaW5jb3JyZWN0IGxvdHRlcnkgYWRkcmVzcwAAAACRyK/h", "chainId": 84, "height": 780943, "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 () = 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+ let caller = toString(contextObj.caller)
29+ WriteSet([DataEntry(((("ticketsFrom" + ticketsFrom) + "To") + ticketsTo), caller), DataEntry("ticketAmountTotal", ticketAmountTotalNew)])
30+ }
31+ else throw("Incorrect amount or assetId in payment")
32+ case _ =>
33+ throw("Payment not attached")
34+}
35+
36+
37+
38+@Callable(contextObj)
39+func addWinner (lottery) = {
40+ let lotteryAddress = addressFromStringValue(lottery)
41+ if (isDefined(getBoolean(this, lottery)))
42+ then {
43+ let winnerAddress = getStringValue(lotteryAddress, "winnerAddress")
44+ let winnerTicket = getIntegerValue(lotteryAddress, "winnerTicket")
45+ WriteSet([DataEntry(("winningTicket" + toString(winnerTicket)), winnerAddress)])
46+ }
47+ else throw("you touch incorrect lottery address")
48+ }
49+
50+

github/deemru/w8io/026f985 
22.02 ms