tx · 84coToqpZfpipNqgWoitUALGjUYGnBWFooC39M8Rp9Tp 3N93ycb6Sxsr6i5DyDhkijcNRya84PeyipH: -0.01000000 Waves 2019.11.27 13:58 [783586] smart account 3N93ycb6Sxsr6i5DyDhkijcNRya84PeyipH > SELF 0.00000000 Waves
{ "type": 13, "id": "84coToqpZfpipNqgWoitUALGjUYGnBWFooC39M8Rp9Tp", "fee": 1000000, "feeAssetId": null, "timestamp": 1574852393341, "version": 1, "sender": "3N93ycb6Sxsr6i5DyDhkijcNRya84PeyipH", "senderPublicKey": "DsbhWSmahx8ZAEZtC3rY6QiPzMQo4FAEdAKxZmMcTEkZ", "proofs": [ "q1TQCVkip4RXrvNzWyKQ4pZHYFVdUJ7cNcJNP7cyxMohohNtG7fbTtJD78ZKNFuUYcY6B1hQWGFv4zh3NMn2EeY" ], "script": "base64:AAIDAAAAAAAAAAkIARIAEgMKAQgAAAADAAAAAAt0aWNrZXRQcmljZQAAAAAAAAAAAwAAAAAFTVJUaWQBAAAAIHChkBw36JTYWgsazkDpCyVgxVwrjSJEZ1FQeglRlz1iAQAAAA9nZXRUaWNrZXRBbW91bnQAAAAABAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMCAAAAEXRpY2tldEFtb3VudFRvdGFsAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEAAAAAAAAAAAAAAAACAAAACmNvbnRleHRPYmoBAAAACWJ1eVRpY2tldAAAAAADCQAAAAAAAAIIBQAAAApjb250ZXh0T2JqAAAABmNhbGxlcgUAAAAEdGhpcwkAAAIAAAABAgAAACN0aWNrZXQgaHViIGNhbid0IGNhbGwgdGhpcyBmdW5jdGlvbgQAAAAHJG1hdGNoMAgFAAAACmNvbnRleHRPYmoAAAAHcGF5bWVudAMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAPQXR0YWNoZWRQYXltZW50BAAAAAFwBQAAAAckbWF0Y2gwAwMJAABn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5sb3R0ZXJ5QWRkcmVzcwkBAAAAHEBleHRyVXNlcihhZGRyZXNzRnJvbVN0cmluZykAAAABBQAAAAdsb3R0ZXJ5AwkBAAAACWlzRGVmaW5lZAAAAAEJAAQbAAAAAgUAAAAEdGhpcwkAASwAAAACAgAAAAhsb3R0ZXJ5XwUAAAAHbG90dGVyeQQAAAANd2lubmVyQWRkcmVzcwkBAAAAEUBleHRyTmF0aXZlKDEwNTMpAAAAAgUAAAAObG90dGVyeUFkZHJlc3MCAAAADXdpbm5lckFkZHJlc3MEAAAADHdpbm5lclRpY2tldAkBAAAAEUBleHRyTmF0aXZlKDEwNTApAAAAAgUAAAAObG90dGVyeUFkZHJlc3MCAAAADHdpbm5lclRpY2tldAkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkAASwAAAACAgAAAA13aW5uaW5nVGlja2V0CQABpAAAAAEFAAAADHdpbm5lclRpY2tldAUAAAANd2lubmVyQWRkcmVzcwUAAAADbmlsCQAAAgAAAAECAAAAI3lvdSB0b3VjaCBpbmNvcnJlY3QgbG90dGVyeSBhZGRyZXNzAAAAAJE167U=", "chainId": 84, "height": 783586, "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 () = if ((contextObj.caller == this)) | |
18 | + | then throw("ticket hub can't call this function") | |
19 | + | else match contextObj.payment { | |
20 | + | case p: AttachedPayment => | |
21 | + | if (if ((p.amount >= ticketPrice)) | |
22 | + | then (p.assetId == MRTid) | |
23 | + | else false) | |
24 | + | then { | |
25 | + | let ticketsBuyingAmount = (p.amount / ticketPrice) | |
26 | + | let ticketAmountTotalCurrent = getTicketAmount() | |
27 | + | let ticketAmountTotalNew = (ticketAmountTotalCurrent + ticketsBuyingAmount) | |
28 | + | let ticketsFrom = toString((ticketAmountTotalCurrent + 1)) | |
29 | + | let ticketsTo = toString((ticketAmountTotalCurrent + ticketsBuyingAmount)) | |
30 | + | let caller = toString(contextObj.caller) | |
31 | + | WriteSet([DataEntry(((("ticketsFrom" + ticketsFrom) + "To") + ticketsTo), caller), DataEntry("ticketAmountTotal", ticketAmountTotalNew)]) | |
32 | + | } | |
33 | + | else throw("Incorrect amount or assetId in payment") | |
34 | + | case _ => | |
35 | + | throw("Payment not attached") | |
36 | + | } | |
37 | + | ||
38 | + | ||
39 | + | ||
40 | + | @Callable(contextObj) | |
41 | + | func addWinner (lottery) = { | |
42 | + | let lotteryAddress = addressFromStringValue(lottery) | |
43 | + | if (isDefined(getBoolean(this, ("lottery_" + lottery)))) | |
44 | + | then { | |
45 | + | let winnerAddress = getStringValue(lotteryAddress, "winnerAddress") | |
46 | + | let winnerTicket = getIntegerValue(lotteryAddress, "winnerTicket") | |
47 | + | WriteSet([DataEntry(("winningTicket" + toString(winnerTicket)), winnerAddress)]) | |
48 | + | } | |
49 | + | else throw("you touch incorrect lottery address") | |
50 | + | } | |
51 | + | ||
52 | + |
github/deemru/w8io/169f3d6 44.89 ms ◑