tx · HhiuRwkypnEkcYDQNHqiLmkvYR2QFBbk3S51u7FS2p2b 3N4NPivoThtskr7JxnNrKL7s8BzmRGx9rT2: -0.01400000 Waves 2019.08.11 11:53 [626166] smart account 3N4NPivoThtskr7JxnNrKL7s8BzmRGx9rT2 > SELF 0.00000000 Waves
{ "type": 13, "id": "HhiuRwkypnEkcYDQNHqiLmkvYR2QFBbk3S51u7FS2p2b", "fee": 1400000, "feeAssetId": null, "timestamp": 1565513596777, "version": 1, "sender": "3N4NPivoThtskr7JxnNrKL7s8BzmRGx9rT2", "senderPublicKey": "F3vhYapU4NBzfM2X4KNkoFcxj3UbYnJjqituG6KE7ZPG", "proofs": [ "5HqNQhC8KAzj5E4nMR7wd5zYaVEd2w4bhoSQbGBVxjiLTHiubseFrg5CBxQLccTCrcuwmXZteyXusdvEi2ok4NNn" ], "script": "base64:AAIDAAAAAAAAAAAAAAAJAAAAAAdSVU5OSU5HAgAAAAdSVU5OSU5HAAAAABBDTE9TRURGT1JCRVRUSU5HAgAAABBDTE9TRURGT1JCRVRUSU5HAAAAAAZDTE9TRUQCAAAABkNMT1NFRAAAAAAJREFQUE9XTkVSAgAAACMzTjROUGl2b1RodHNrcjdKeG5OcktMN3M4QnptUkd4OXJUMgAAAAAFV0FWRVMCAAAABVdBVkVTAAAAAAROT05FAgAAAAROT05FAQAAAAtnZXROdW1CeUtleQAAAAEAAAADa2V5BAAAAANudW0EAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEAAAAAAAAAAAAFAAAAA251bQEAAAALZ2V0U3RyQnlLZXkAAAABAAAAA2tleQQAAAADc3RyBAAAAAckbWF0Y2gwCQAEHQAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAGU3RyaW5nBAAAAAFhBQAAAAckbWF0Y2gwBQAA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V3JpdGVTZXQAAAABCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQABLAAAAAIJAAEsAAAAAgkAASwAAAACAgAAAARiZXRfCQABpAAAAAEFAAAAEWNvbnRlc3RDdXJyTnVtYmVyAgAAAAFfBQAAAAdhY2NvdW50BQAAAA1jdXJyZW5jeVZhbHVlBQAAAANuaWwAAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAABAAAAAckbWF0Y2gwBQAAAAJ0eAMDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAFFNldFNjcmlwdFRyYW5zYWN0aW9uBgkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAA9EYXRhVHJhbnNhY3Rpb24JAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAACAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAABdJbnZva2VTY3JpcHRUcmFuc2FjdGlvbgYGs6TA3Q==", "chainId": 84, "height": 626166, "spentComplexity": 0 } View: original | compacted Prev: GVQTh99ZWZKqoC9d1KUQE95Aubwg82e1fULQDm2gqJL7 Next: 85NzpGQw98mdFCUj2ZMfJmGdvd6b7QAKjBzGH7cAAEeX Diff:
Old | New | Differences | |
---|---|---|---|
61 | 61 | @Callable(i) | |
62 | 62 | func setContestConfiguration (currencyTicker,contestStartHeight) = { | |
63 | 63 | let account = toBase58String(i.caller.bytes) | |
64 | - | let contestStatus = getContestStatus() | |
65 | 64 | let contestPrevNumber = getNumByKey("contest_currentnumber") | |
65 | + | let contestPrevStatus = getStrByKey((("contest_" + toString(contestPrevNumber)) + "_status")) | |
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 (if ((contestStatus != RUNNING)) | |
72 | - | then (contestStatus != NONE) | |
73 | - | else false) | |
74 | - | then throw(("You cannot configure Contest while status is: " + contestStatus)) | |
71 | + | else if ((contestPrevStatus == RUNNING)) | |
72 | + | then throw(("You cannot configure a new Contest while old Contest status is: " + contestPrevStatus)) | |
75 | 73 | else if ((currencyTicker != WAVES)) | |
76 | 74 | then throw((("dAPP does not support currency: " + currencyTicker) + " yet.")) | |
77 | 75 | else { |
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 | - | let contestStatus = getContestStatus() | |
65 | 64 | let contestPrevNumber = getNumByKey("contest_currentnumber") | |
65 | + | let contestPrevStatus = getStrByKey((("contest_" + toString(contestPrevNumber)) + "_status")) | |
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 (if ((contestStatus != RUNNING)) | |
72 | - | then (contestStatus != NONE) | |
73 | - | else false) | |
74 | - | then throw(("You cannot configure Contest while status is: " + contestStatus)) | |
71 | + | else if ((contestPrevStatus == RUNNING)) | |
72 | + | then throw(("You cannot configure a new Contest while old Contest status is: " + contestPrevStatus)) | |
75 | 73 | else if ((currencyTicker != WAVES)) | |
76 | 74 | then throw((("dAPP does not support currency: " + currencyTicker) + " yet.")) | |
77 | 75 | else { | |
78 | 76 | let contestFinishHeight = (contestStartHeight + (7 * 1440)) | |
79 | 77 | 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)]) | |
80 | 78 | } | |
81 | 79 | } | |
82 | 80 | ||
83 | 81 | ||
84 | 82 | ||
85 | 83 | @Callable(i) | |
86 | 84 | func bet (currencyValue) = { | |
87 | 85 | let WLT = base58'2B3mWxfnhAaCpJuqbkbiD6HVCTEcgwdmzxFCjZe65NYg' | |
88 | 86 | let account = toBase58String(i.caller.bytes) | |
89 | 87 | let pmt = extract(i.payment) | |
90 | 88 | let contestCurrNumber = getNumByKey("contest_currentnumber") | |
91 | 89 | let contestStartHeight = getNumByKey((("contest_" + toString(contestCurrNumber)) + "startheight")) | |
92 | 90 | let contestFinishHeight = getNumByKey((("contest_" + toString(contestCurrNumber)) + "finishheight")) | |
93 | 91 | let contestStatus = getStrByKey((("contest_" + toString(contestCurrNumber)) + "status")) | |
94 | 92 | if ((height > (contestFinishHeight - (2 * 1440)))) | |
95 | 93 | then throw("You cannot bet anymore at this height.") | |
96 | 94 | else if ((contestStatus != RUNNING)) | |
97 | 95 | then throw("Invalid status: you cannot bet now.") | |
98 | 96 | else if (if ((pmt.assetId != WLT)) | |
99 | 97 | then true | |
100 | 98 | else (pmt.amount != 500000)) | |
101 | 99 | then throw("You must pay 5 WLT to bet.") | |
102 | 100 | else WriteSet([DataEntry(((("bet_" + toString(contestCurrNumber)) + "_") + account), currencyValue)]) | |
103 | 101 | } | |
104 | 102 | ||
105 | 103 | ||
106 | 104 | @Verifier(tx) | |
107 | 105 | func verify () = match tx { | |
108 | 106 | case _: SetScriptTransaction|DataTransaction => | |
109 | 107 | sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
110 | 108 | case _: InvokeScriptTransaction => | |
111 | 109 | true | |
112 | 110 | case _ => | |
113 | 111 | true | |
114 | 112 | } | |
115 | 113 |
github/deemru/w8io/169f3d6 33.26 ms ◑