tx · 85NzpGQw98mdFCUj2ZMfJmGdvd6b7QAKjBzGH7cAAEeX 3N4NPivoThtskr7JxnNrKL7s8BzmRGx9rT2: -0.01400000 Waves 2019.08.11 11:57 [626168] smart account 3N4NPivoThtskr7JxnNrKL7s8BzmRGx9rT2 > SELF 0.00000000 Waves
{ "type": 13, "id": "85NzpGQw98mdFCUj2ZMfJmGdvd6b7QAKjBzGH7cAAEeX", "fee": 1400000, "feeAssetId": null, "timestamp": 1565513833513, "version": 1, "sender": "3N4NPivoThtskr7JxnNrKL7s8BzmRGx9rT2", "senderPublicKey": "F3vhYapU4NBzfM2X4KNkoFcxj3UbYnJjqituG6KE7ZPG", "proofs": [ "5SYEWrZGagMNeJKckeVWKgQSS5xdXWfQi5dXsiCY7SAuZkLZv79pUEpscdTSbgBGVo6za2QA23x11ya8bBvbXzr1" ], "script": "base64:AAIDAAAAAAAAAAAAAAAIAAAAAAdSVU5OSU5HAgAAAAdSVU5OSU5HAAAAAAZDTE9TRUQCAAAABkNMT1NFRAAAAAAJREFQUE9XTkVSAgAAACMzTjROUGl2b1RodHNrcjdKeG5OcktMN3M4QnptUkd4OXJUMgAAAAAFV0FWRVMCAAAABVdBVkVTAAAAAAROT05FAgAAAAROT05FAQAAAAtnZXROdW1CeUtleQAAAAEAAAADa2V5BAAAAANudW0EAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEAAAAAAAAAAAAFAAAAA251bQEAAAALZ2V0U3RyQnlLZXkAAAABAAAAA2tleQQAAAADc3RyBAAAAAckbWF0Y2gwCQAEHQAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAGU3RyaW5nBAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhBQAAAAROT05FBQAAAANzdHIBAAAAEGdldENvbnRlc3RTdGF0dXMA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eQAAAAAEAAAAByRtYXRjaDAFAAAAAnR4AwMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAUU2V0U2NyaXB0VHJhbnNhY3Rpb24GCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAD0RhdGFUcmFuc2FjdGlvbgkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAIBQAAAAJ0eAAAAA9zZW5kZXJQdWJsaWNLZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAF0ludm9rZVNjcmlwdFRyYW5zYWN0aW9uBgaxkIa2", "chainId": 84, "height": 626168, "spentComplexity": 0 } View: original | compacted Prev: HhiuRwkypnEkcYDQNHqiLmkvYR2QFBbk3S51u7FS2p2b Next: GHpH2Pr3BzzUUeagvePuuyKa7bv4UzohXxasNMYKjQzC Diff:
Old | New | Differences | |
---|---|---|---|
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let RUNNING = "RUNNING" | |
5 | - | ||
6 | - | let CLOSEDFORBETTING = "CLOSEDFORBETTING" | |
7 | 5 | ||
8 | 6 | let CLOSED = "CLOSED" | |
9 | 7 | ||
42 | 40 | ||
43 | 41 | ||
44 | 42 | @Callable(i) | |
45 | - | func setContestStatus (contestStatus) = { | |
43 | + | func setContestStatus (contestNumber,contestStatus) = { | |
46 | 44 | let account = toBase58String(i.caller.bytes) | |
47 | - | let contestCurrNumber = getNumByKey("contest_currentnumber") | |
48 | 45 | if ((account != DAPPOWNER)) | |
49 | 46 | then throw("Only dAPP Owner can set Contest Status.") | |
50 | - | else if (if (if ((contestStatus != RUNNING)) | |
51 | - | then (contestStatus != CLOSEDFORBETTING) | |
52 | - | else false) | |
47 | + | else if (if ((contestStatus != RUNNING)) | |
53 | 48 | then (contestStatus != CLOSED) | |
54 | 49 | else false) | |
55 | 50 | then throw(("Invalid status: " + contestStatus)) | |
56 | - | else WriteSet([DataEntry((("contest_" + toString( | |
51 | + | else WriteSet([DataEntry((("contest_" + toString(contestNumber)) + "status"), contestStatus)]) | |
57 | 52 | } | |
58 | 53 | ||
59 | 54 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let RUNNING = "RUNNING" | |
5 | - | ||
6 | - | let CLOSEDFORBETTING = "CLOSEDFORBETTING" | |
7 | 5 | ||
8 | 6 | let CLOSED = "CLOSED" | |
9 | 7 | ||
10 | 8 | let DAPPOWNER = "3N4NPivoThtskr7JxnNrKL7s8BzmRGx9rT2" | |
11 | 9 | ||
12 | 10 | let WAVES = "WAVES" | |
13 | 11 | ||
14 | 12 | let NONE = "NONE" | |
15 | 13 | ||
16 | 14 | func getNumByKey (key) = { | |
17 | 15 | let num = match getInteger(this, key) { | |
18 | 16 | case a: Int => | |
19 | 17 | a | |
20 | 18 | case _ => | |
21 | 19 | 0 | |
22 | 20 | } | |
23 | 21 | num | |
24 | 22 | } | |
25 | 23 | ||
26 | 24 | ||
27 | 25 | func getStrByKey (key) = { | |
28 | 26 | let str = match getString(this, key) { | |
29 | 27 | case a: String => | |
30 | 28 | a | |
31 | 29 | case _ => | |
32 | 30 | NONE | |
33 | 31 | } | |
34 | 32 | str | |
35 | 33 | } | |
36 | 34 | ||
37 | 35 | ||
38 | 36 | func getContestStatus () = { | |
39 | 37 | let contestCurrNumber = getNumByKey("contest_currentnumber") | |
40 | 38 | getStrByKey((("contest_" + toString(contestCurrNumber)) + "status")) | |
41 | 39 | } | |
42 | 40 | ||
43 | 41 | ||
44 | 42 | @Callable(i) | |
45 | - | func setContestStatus (contestStatus) = { | |
43 | + | func setContestStatus (contestNumber,contestStatus) = { | |
46 | 44 | let account = toBase58String(i.caller.bytes) | |
47 | - | let contestCurrNumber = getNumByKey("contest_currentnumber") | |
48 | 45 | if ((account != DAPPOWNER)) | |
49 | 46 | then throw("Only dAPP Owner can set Contest Status.") | |
50 | - | else if (if (if ((contestStatus != RUNNING)) | |
51 | - | then (contestStatus != CLOSEDFORBETTING) | |
52 | - | else false) | |
47 | + | else if (if ((contestStatus != RUNNING)) | |
53 | 48 | then (contestStatus != CLOSED) | |
54 | 49 | else false) | |
55 | 50 | then throw(("Invalid status: " + contestStatus)) | |
56 | - | else WriteSet([DataEntry((("contest_" + toString( | |
51 | + | else WriteSet([DataEntry((("contest_" + toString(contestNumber)) + "status"), contestStatus)]) | |
57 | 52 | } | |
58 | 53 | ||
59 | 54 | ||
60 | 55 | ||
61 | 56 | @Callable(i) | |
62 | 57 | func setContestConfiguration (currencyTicker,contestStartHeight) = { | |
63 | 58 | let account = toBase58String(i.caller.bytes) | |
64 | 59 | let contestPrevNumber = getNumByKey("contest_currentnumber") | |
65 | 60 | let contestPrevStatus = getStrByKey((("contest_" + toString(contestPrevNumber)) + "_status")) | |
66 | 61 | let contestCurrNumber = (contestPrevNumber + 1) | |
67 | 62 | if ((account != DAPPOWNER)) | |
68 | 63 | then throw("Only dAPP Owner can Configure Contest.") | |
69 | 64 | else if ((height >= contestStartHeight)) | |
70 | 65 | then throw(("Start Height must be greater than current Blockchain height: " + toString(height))) | |
71 | 66 | else if ((contestPrevStatus == RUNNING)) | |
72 | 67 | then throw(("You cannot configure a new Contest while old Contest status is: " + contestPrevStatus)) | |
73 | 68 | else if ((currencyTicker != WAVES)) | |
74 | 69 | then throw((("dAPP does not support currency: " + currencyTicker) + " yet.")) | |
75 | 70 | else { | |
76 | 71 | let contestFinishHeight = (contestStartHeight + (7 * 1440)) | |
77 | 72 | WriteSet([DataEntry("contest_currentnumber", contestCurrNumber), DataEntry((("contest_" + toString(contestCurrNumber)) + "_currency"), currencyTicker), DataEntry((("contest_" + toString(contestCurrNumber)) + "_startheight"), contestStartHeight), DataEntry((("contest_" + toString(contestCurrNumber)) + "_finishheight"), contestFinishHeight), DataEntry((("contest_" + toString(contestCurrNumber)) + "_status"), RUNNING)]) | |
78 | 73 | } | |
79 | 74 | } | |
80 | 75 | ||
81 | 76 | ||
82 | 77 | ||
83 | 78 | @Callable(i) | |
84 | 79 | func bet (currencyValue) = { | |
85 | 80 | let WLT = base58'2B3mWxfnhAaCpJuqbkbiD6HVCTEcgwdmzxFCjZe65NYg' | |
86 | 81 | let account = toBase58String(i.caller.bytes) | |
87 | 82 | let pmt = extract(i.payment) | |
88 | 83 | let contestCurrNumber = getNumByKey("contest_currentnumber") | |
89 | 84 | let contestStartHeight = getNumByKey((("contest_" + toString(contestCurrNumber)) + "startheight")) | |
90 | 85 | let contestFinishHeight = getNumByKey((("contest_" + toString(contestCurrNumber)) + "finishheight")) | |
91 | 86 | let contestStatus = getStrByKey((("contest_" + toString(contestCurrNumber)) + "status")) | |
92 | 87 | if ((height > (contestFinishHeight - (2 * 1440)))) | |
93 | 88 | then throw("You cannot bet anymore at this height.") | |
94 | 89 | else if ((contestStatus != RUNNING)) | |
95 | 90 | then throw("Invalid status: you cannot bet now.") | |
96 | 91 | else if (if ((pmt.assetId != WLT)) | |
97 | 92 | then true | |
98 | 93 | else (pmt.amount != 500000)) | |
99 | 94 | then throw("You must pay 5 WLT to bet.") | |
100 | 95 | else WriteSet([DataEntry(((("bet_" + toString(contestCurrNumber)) + "_") + account), currencyValue)]) | |
101 | 96 | } | |
102 | 97 | ||
103 | 98 | ||
104 | 99 | @Verifier(tx) | |
105 | 100 | func verify () = match tx { | |
106 | 101 | case _: SetScriptTransaction|DataTransaction => | |
107 | 102 | sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
108 | 103 | case _: InvokeScriptTransaction => | |
109 | 104 | true | |
110 | 105 | case _ => | |
111 | 106 | true | |
112 | 107 | } | |
113 | 108 |
github/deemru/w8io/169f3d6 30.13 ms ◑