tx · Ea759qxJ45yLFemEU1mCkfgjXesa9XEo8B2yK3Myx3uM 3N7tvef3FF3PwXeZfWHaiZkUnZiLUJfkTVr: -0.01000000 Waves 2019.11.25 17:33 [780922] smart account 3N7tvef3FF3PwXeZfWHaiZkUnZiLUJfkTVr > SELF 0.00000000 Waves
{ "type": 13, "id": "Ea759qxJ45yLFemEU1mCkfgjXesa9XEo8B2yK3Myx3uM", "fee": 1000000, "feeAssetId": null, "timestamp": 1574692450951, "version": 1, "sender": "3N7tvef3FF3PwXeZfWHaiZkUnZiLUJfkTVr", "senderPublicKey": "9748xQ1cEgDDNfNRYiA4n7RcL184CCT7WsKuJZVPNGiA", "proofs": [ "4rikByU3eF5vmNE89A64vjGmeoNmssL9WZxAmGojYfVWseqzaLZiD5ZeWFn4T14nxhGv9Kc6563N39YUKMrnPfHv" ], "script": "base64:AAIDAAAAAAAAAAkIARIAEgMKAQgAAAADAAAAAAt0aWNrZXRQcmljZQAAAAAAAAAAAwAAAAAFTVJUaWQBAAAAIHChkBw36JTYWgsazkDpCyVgxVwrjSJEZ1FQeglRlz1iAQAAAA9nZXRUaWNrZXRBbW91bnQAAAAABAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMCAAAAEXRpY2tldEFtb3VudFRvdGFsAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEAAAAAAAAAAAAAAAACAAAACmNvbnRleHRPYmoBAAAACWJ1eVRpY2tldAAAAAAEAAAAByRtYXRjaDAIBQAAAApjb250ZXh0T2JqAAAAB3BheW1lbnQDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAD0F0dGFjaGVkUGF5bWVudAQAAAABcAUAAAAHJG1hdGNoMAMDCQAAZwAAAAIIBQAAAAFwAAAABmFtb3VudAUAAAALdGlja2V0UHJpY2UJAAAAAAAAAggFAAAAAXAAAAAHYXNzZXRJZAUAAAAFTVJUaWQHBAAAABN0aWNrZXRzQnV5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wAAAAIFAAAABHRoaXMFAAAAB2xvdHRlcnkEAAAADXdpbm5lckFkZHJlc3MJAQAAABFAZXh0ck5hdGl2ZSgxMDUzKQAAAAIFAAAADmxvdHRlcnlBZGRyZXNzAgAAAA13aW5uZXJBZGRyZXNzBAAAAAx3aW5uZXJUaWNrZXQJAQAAABFAZXh0ck5hdGl2ZSgxMDUwKQAAAAIFAAAADmxvdHRlcnlBZGRyZXNzAgAAAAx3aW5uZXJUaWNrZXQJAQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAAEsAAAAAgIAAAANd2lubmluZ1RpY2tldAkAAaQAAAABBQAAAAx3aW5uZXJUaWNrZXQFAAAADXdpbm5lckFkZHJlc3MFAAAAA25pbAkAAAIAAAABAgAAACN5b3UgdG91Y2ggaW5jb3JyZWN0IGxvdHRlcnkgYWRkcmVzcwAAAACRyK/h", "chainId": 84, "height": 780922, "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
Old | New | Differences | |
---|---|---|---|
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/169f3d6 41.44 ms ◑