tx · EZxJScqqseu3gGmUZqAvVdXcQ2PTXkaZx68qAXLsdpsB 3NBEbFU6dKpoAcsbaEK2aC62UQMjYFW4xiL: -0.01400000 Waves 2021.02.13 13:06 [1396245] smart account 3NBEbFU6dKpoAcsbaEK2aC62UQMjYFW4xiL > SELF 0.00000000 Waves
{ "type": 13, "id": "EZxJScqqseu3gGmUZqAvVdXcQ2PTXkaZx68qAXLsdpsB", "fee": 1400000, "feeAssetId": null, "timestamp": 1613210781727, "version": 2, "chainId": 84, "sender": "3NBEbFU6dKpoAcsbaEK2aC62UQMjYFW4xiL", "senderPublicKey": "AwmS57W97dpK3Bs6tsewG3YaYgJukDtmEZFbG1oQTV4T", "proofs": [ "xoWZXwuyu8kAJq5eNqo3Rb2UrcjToDmbcZyuDvRtamyMPRXCfmEQgXgyVb3fYuojvsEnGGBxiDNVxi6MGFEQrdQ" ], "script": "base64:AAIDAAAAAAAAAA4IARIDCgEIEgASAwoBAQAAAAkAAAAAB1JVTk5JTkcCAAAAB1JVTk5JTkcAAAAABkNMT1NFRAIAAAAGQ0xPU0VEAAAAAAhDQU5DRUxFRAIAAAAIQ0FOQ0VMRUQAAAAACURBUFBPV05FUgIAAAAjM05CRWJGVTZkS3BvQWNzYmFFSzJhQzYyVVFNallGVzR4aUwAAAAABVdBVkVTAgAAAAVXQVZFUwAAAAAETk9ORQIAAAAETk9ORQAAAAADRkVFAAAAAAAADbugAQAAAAtnZXROdW1CeUtleQAAAAEAAAADa2V5BAAAAANudW0EAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEAAAAAAAAAAAAFAAAAA251bQEAAAALZ2V0U3RyQnlLZXkAAAABAAAAA2tleQQAAAADc3RyBAAAAAckbWF0Y2gwCQAEHQAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIA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CAxIGJldC4JAQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAAEsAAAAAgkAASwAAAACCQABLAAAAAICAAAABGJldF8JAAGkAAAAAQUAAAARY29udGVzdEN1cnJOdW1iZXICAAAAAV8JAAGkAAAAAQUAAAANY3VycmVuY3lWYWx1ZQUAAAAHYWNjb3VudAkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkAASwAAAACCQABLAAAAAIJAAEsAAAAAgkAASwAAAACAgAAAAhjb250ZXN0XwkAAaQAAAABBQAAABFjb250ZXN0Q3Vyck51bWJlcgIAAAABXwUAAAAHYWNjb3VudAIAAAAFX2JldHMJAABkAAAAAgUAAAARYWNjb3VudEJldHNOdW1iZXIAAAAAAAAAAAEFAAAAA25pbAAAAAEAAAACdHgBAAAABnZlcmlmeQAAAAAEAAAAByRtYXRjaDAFAAAAAnR4AwMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAUU2V0U2NyaXB0VHJhbnNhY3Rpb24GCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAD0RhdGFUcmFuc2FjdGlvbgkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAIBQAAAAJ0eAAAAA9zZW5kZXJQdWJsaWNLZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAF0ludm9rZVNjcmlwdFRyYW5zYWN0aW9uBgbxjBw8", "height": 1396245, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 9eNbgoHtgZe7fbVb3k3pi5Bw1PZDtn5oh7oXcF8uJLi9 Next: ArekSYd3TjA3cAGzHFvyWjxWG8bFGLhcUgT3psaVZ9WJ Diff:
Old | New | Differences | |
---|---|---|---|
7 | 7 | ||
8 | 8 | let CANCELED = "CANCELED" | |
9 | 9 | ||
10 | - | let DAPPOWNER = " | |
10 | + | let DAPPOWNER = "3NBEbFU6dKpoAcsbaEK2aC62UQMjYFW4xiL" | |
11 | 11 | ||
12 | 12 | let WAVES = "WAVES" | |
13 | 13 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let RUNNING = "RUNNING" | |
5 | 5 | ||
6 | 6 | let CLOSED = "CLOSED" | |
7 | 7 | ||
8 | 8 | let CANCELED = "CANCELED" | |
9 | 9 | ||
10 | - | let DAPPOWNER = " | |
10 | + | let DAPPOWNER = "3NBEbFU6dKpoAcsbaEK2aC62UQMjYFW4xiL" | |
11 | 11 | ||
12 | 12 | let WAVES = "WAVES" | |
13 | 13 | ||
14 | 14 | let NONE = "NONE" | |
15 | 15 | ||
16 | 16 | let FEE = 900000 | |
17 | 17 | ||
18 | 18 | func getNumByKey (key) = { | |
19 | 19 | let num = match getInteger(this, key) { | |
20 | 20 | case a: Int => | |
21 | 21 | a | |
22 | 22 | case _ => | |
23 | 23 | 0 | |
24 | 24 | } | |
25 | 25 | num | |
26 | 26 | } | |
27 | 27 | ||
28 | 28 | ||
29 | 29 | func getStrByKey (key) = { | |
30 | 30 | let str = match getString(this, key) { | |
31 | 31 | case a: String => | |
32 | 32 | a | |
33 | 33 | case _ => | |
34 | 34 | NONE | |
35 | 35 | } | |
36 | 36 | str | |
37 | 37 | } | |
38 | 38 | ||
39 | 39 | ||
40 | 40 | @Callable(i) | |
41 | 41 | func setContestStatus (contestStatus) = { | |
42 | 42 | let account = toBase58String(i.caller.bytes) | |
43 | 43 | let contestCurrNumber = getNumByKey("contest_currentnumber") | |
44 | 44 | if ((account != DAPPOWNER)) | |
45 | 45 | then throw("Only dAPP Owner can set Contest Status.") | |
46 | 46 | else if (if ((contestStatus != CANCELED)) | |
47 | 47 | then (contestStatus != CLOSED) | |
48 | 48 | else false) | |
49 | 49 | then throw(("Invalid status: " + contestStatus)) | |
50 | 50 | else WriteSet([DataEntry((("contest_" + toString(contestCurrNumber)) + "_status"), contestStatus)]) | |
51 | 51 | } | |
52 | 52 | ||
53 | 53 | ||
54 | 54 | ||
55 | 55 | @Callable(i) | |
56 | 56 | func setContestConfiguration () = { | |
57 | 57 | let account = toBase58String(i.caller.bytes) | |
58 | 58 | let contestCurrNumber = getNumByKey("contest_currentnumber") | |
59 | 59 | let contestCurrStatus = getStrByKey((("contest_" + toString(contestCurrNumber)) + "_status")) | |
60 | 60 | let contestNewNumber = (contestCurrNumber + 1) | |
61 | 61 | let balance = wavesBalance(this) | |
62 | 62 | if ((account != DAPPOWNER)) | |
63 | 63 | then throw(((("Only dAPP Owner can Configure Contest. Caller account: " + account) + " dapp owner: ") + DAPPOWNER)) | |
64 | 64 | else if ((contestCurrStatus == RUNNING)) | |
65 | 65 | then throw(("You cannot configure a new Contest while old Contest status is: " + contestCurrStatus)) | |
66 | 66 | else { | |
67 | 67 | let contestFinishHeight = (height + (6 * 1440)) | |
68 | 68 | WriteSet([DataEntry("contest_currentnumber", contestNewNumber), DataEntry((("contest_" + toString(contestNewNumber)) + "_finishheight"), contestFinishHeight), DataEntry((("contest_" + toString(contestNewNumber)) + "_status"), RUNNING), DataEntry((("contest_" + toString(contestNewNumber)) + "_betcounter"), 0)]) | |
69 | 69 | } | |
70 | 70 | } | |
71 | 71 | ||
72 | 72 | ||
73 | 73 | ||
74 | 74 | @Callable(i) | |
75 | 75 | func bet (currencyValue) = { | |
76 | 76 | let account = toBase58String(i.caller.bytes) | |
77 | 77 | let pmt = extract(i.payment) | |
78 | 78 | let contestCurrNumber = getNumByKey("contest_currentnumber") | |
79 | 79 | let contestStartHeight = getNumByKey((("contest_" + toString(contestCurrNumber)) + "_startheight")) | |
80 | 80 | let contestFinishHeight = getNumByKey((("contest_" + toString(contestCurrNumber)) + "_finishheight")) | |
81 | 81 | let contestCurrStatus = getStrByKey((("contest_" + toString(contestCurrNumber)) + "_status")) | |
82 | 82 | let contestStatus = getStrByKey((("contest_" + toString(contestCurrNumber)) + "_status")) | |
83 | 83 | let accountBetsNumber = getNumByKey((((("contest_" + toString(contestCurrNumber)) + "_") + account) + "_bets")) | |
84 | 84 | let existingBetAccount = getStrByKey(((("bet_" + toString(contestCurrNumber)) + "_") + toString(currencyValue))) | |
85 | 85 | if ((height > (contestFinishHeight - (2 * 1440)))) | |
86 | 86 | then throw("You cannot bet anymore at this height.") | |
87 | 87 | else if ((contestCurrStatus != RUNNING)) | |
88 | 88 | then throw(("Invalid status: you cannot bet now, contest status is: " + contestCurrStatus)) | |
89 | 89 | else if (if ((existingBetAccount != NONE)) | |
90 | 90 | then (existingBetAccount != account) | |
91 | 91 | else false) | |
92 | 92 | then throw((("Another user: " + existingBetAccount) + " did bet already on this rate.")) | |
93 | 93 | else if ((accountBetsNumber >= 1)) | |
94 | 94 | then throw("You can do at most 1 bet.") | |
95 | 95 | else WriteSet([DataEntry(((("bet_" + toString(contestCurrNumber)) + "_") + toString(currencyValue)), account), DataEntry((((("contest_" + toString(contestCurrNumber)) + "_") + account) + "_bets"), (accountBetsNumber + 1))]) | |
96 | 96 | } | |
97 | 97 | ||
98 | 98 | ||
99 | 99 | @Verifier(tx) | |
100 | 100 | func verify () = match tx { | |
101 | 101 | case _: SetScriptTransaction|DataTransaction => | |
102 | 102 | sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
103 | 103 | case _: InvokeScriptTransaction => | |
104 | 104 | true | |
105 | 105 | case _ => | |
106 | 106 | true | |
107 | 107 | } | |
108 | 108 |
github/deemru/w8io/169f3d6 66.91 ms ◑