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