tx · 7pLVXKrBqMQfHgsSHz3biGLxomLXP9D1MyCNFsjZjbs3 3MyGCG2trjn9SNnUSTnDq4atqjnRM7938kP: -0.01000000 Waves 2019.11.21 14:23 [774873] smart account 3MyGCG2trjn9SNnUSTnDq4atqjnRM7938kP > SELF 0.00000000 Waves
{ "type": 13, "id": "7pLVXKrBqMQfHgsSHz3biGLxomLXP9D1MyCNFsjZjbs3", "fee": 1000000, "feeAssetId": null, "timestamp": 1574335483480, "version": 1, "sender": "3MyGCG2trjn9SNnUSTnDq4atqjnRM7938kP", "senderPublicKey": "HezDgztBiWTcLgRU82ESNqwPeLRs3My5F2tAxGPZeFk1", "proofs": [ "3K4kqY3ezyt9ijohSRt2xuXjwaGFJytWTih1mbtyNDQbnUAfoLsqDkhGQcqixAxHsb1bHvyAwd4moFenwFX23zFs" ], "script": "base64:AAIDAAAAAAAAAAwIARIDCgEIEgMKAQgAAAADAAAAAAt0aWNrZXRQcmljZQAAAAAAAAAAAwAAAAAFTVJUaWQBAAAAIHChkBw36JTYWgsazkDpCyVgxVwrjSJEZ1FQeglRlz1iAQAAAA9nZXRUaWNrZXRBbW91bnQAAAAABAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMCAAAADHRpY2tldEFtb3VudAMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhAAAAAAAAAAAAAAAAAgAAAApjb250ZXh0T2JqAQAAAAlidXlUaWNrZXQAAAABAAAADWFkZHJlc1RvTGVhc2UEAAAAByRtYXRjaDAIBQAAAApjb250ZXh0T2JqAAAAB3BheW1lbnQDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAD0F0dGFjaGVkUGF5bWVudAQAAAABcAUAAAAHJG1hdGNoMAMDCQAAZwAAAAIIBQAAAAFwAAAABmFtb3VudAUAAAALdGlja2V0UHJpY2UJAAAAAAAAAggFAAAAAXAAAAAHYXNzZXRJZAUAAAAFTVJUaWQHBAAAABN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0ZXJ5BAAAAA13aW5uZXJBZGRyZXNzCQEAAAARQGV4dHJOYXRpdmUoMTA1MykAAAACBQAAAA5sb3R0ZXJ5QWRkcmVzcwIAAAANd2lubmVyQWRkcmVzcwQAAAAMd2lubmVyVGlja2V0CQEAAAARQGV4dHJOYXRpdmUoMTA1MCkAAAACBQAAAA5sb3R0ZXJ5QWRkcmVzcwIAAAAMd2lubmVyVGlja2V0CQEAAAAIV3JpdGVTZXQAAAABCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQABLAAAAAICAAAADXdpbm5pbmdUaWNrZXQJAAGkAAAAAQUAAAAMd2lubmVyVGlja2V0BQAAAA13aW5uZXJBZGRyZXNzBQAAAANuaWwJAAACAAAAAQIAAAAjeW91IHRvdWNoIGluY29ycmVjdCBsb3R0ZXJ5IGFkZHJlc3MAAAAAJ1wdqg==", "chainId": 84, "height": 774873, "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, "ticketAmount") { | |
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), 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 21.21 ms ◑