tx · 5TphYTuR64FLpasmp8CY2JjV2DWcfLvAysHDVDi486zJ 3N4NPivoThtskr7JxnNrKL7s8BzmRGx9rT2: -0.01400000 Waves 2019.08.11 11:11 [626125] smart account 3N4NPivoThtskr7JxnNrKL7s8BzmRGx9rT2 > SELF 0.00000000 Waves
{ "type": 13, "id": "5TphYTuR64FLpasmp8CY2JjV2DWcfLvAysHDVDi486zJ", "fee": 1400000, "feeAssetId": null, "timestamp": 1565511072496, "version": 1, "sender": "3N4NPivoThtskr7JxnNrKL7s8BzmRGx9rT2", "senderPublicKey": "F3vhYapU4NBzfM2X4KNkoFcxj3UbYnJjqituG6KE7ZPG", "proofs": [ "2c3GD7rdxvcjpvvntDfe3bgxxsKsAbeZSNzszPujhefLeMqMyzxv3LRcygTpPvd58mQsfazwDzW51ZSiKPsurKQd" ], "script": "base64:AAIDAAAAAAAAAAAAAAAJAAAAAAdSVU5OSU5HAgAAAAdSVU5OSU5HAAAAABBDTE9TRURGT1JCRVRUSU5HAgAAABBDTE9TRURGT1JCRVRUSU5HAAAAAAZDTE9TRUQCAAAABkNMT1NFRAAAAAAJREFQUE9XTkVSAgAAACMzTjROUGl2b1RodHNrcjdKeG5OcktMN3M4QnptUkd4OXJUMgAAAAAFV0FWRVMCAAAABVdBVkVTAAAAAAROT05FAgAAAAROT05FAQAAAAtnZXROdW1CeUtleQAAAAEAAAADa2V5BAAAAANudW0EAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEAAAAAAAAAAAAFAAAAA251bQEAAAALZ2V0U3RyQnlLZXkAAAABAAAAA2tleQQAAAADc3RyBAAAAAckbWF0Y2gwCQAEHQAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAGU3RyaW5nBAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhBQAA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AehIAkAAAIAAAABAgAAABpZb3UgbXVzdCBwYXkgNSBXTFQgdG8gYmV0LgkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkAASwAAAACCQABLAAAAAIJAAEsAAAAAgIAAAAEYmV0XwkAAaQAAAABBQAAAA1jb250ZXN0TnVtYmVyAgAAAAFfBQAAAAdhY2NvdW50BQAAAA1jdXJyZW5jeVZhbHVlBQAAAANuaWwAAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAABAAAAAckbWF0Y2gwBQAAAAJ0eAMDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAFFNldFNjcmlwdFRyYW5zYWN0aW9uBgkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAA9EYXRhVHJhbnNhY3Rpb24JAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAACAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAABdJbnZva2VTY3JpcHRUcmFuc2FjdGlvbgYGoDu2vg==", "chainId": 84, "height": 626125, "spentComplexity": 0 } View: original | compacted Prev: 5sCYrwv8f74mmBzdB8CbZkTfJP9R6t45foMZSH8D4khP Next: B87FR8QWRBCko4yUHLwUgU8wY1rZMFZeskqGUQpkVh2y Diff:
Old | New | Differences | |
---|---|---|---|
58 | 58 | func setContestConfiguration (currencyTicker,contestStartHeight) = { | |
59 | 59 | let account = toBase58String(i.caller.bytes) | |
60 | 60 | let contestStatus = getContestStatus() | |
61 | - | let | |
61 | + | let contestNumber = getNumByKey("contest_number") | |
62 | 62 | if ((account != DAPPOWNER)) | |
63 | 63 | then throw("Only dAPP Owner can Configure Contest.") | |
64 | 64 | else if ((height >= contestStartHeight)) | |
66 | 66 | else if ((contestStatus != RUNNING)) | |
67 | 67 | then throw(("You cannot configure Contest while status is: " + contestStatus)) | |
68 | 68 | else if ((currencyTicker != WAVES)) | |
69 | - | then throw((("dAPP does not support currency: " + currencyTicker) + "yet.")) | |
70 | - | else WriteSet([DataEntry("contest_currency", currencyTicker), DataEntry("contest_startheight", contestStartHeight), DataEntry("contest_finishheight", contestFinishHeight), DataEntry("contest_status", RUNNING)]) | |
69 | + | then throw((("dAPP does not support currency: " + currencyTicker) + " yet.")) | |
70 | + | else { | |
71 | + | let contestFinishHeight = (contestStartHeight + (7 * 1440)) | |
72 | + | WriteSet([DataEntry("contest_number", (contestNumber + 1)), DataEntry("contest_currency", currencyTicker), DataEntry("contest_startheight", contestStartHeight), DataEntry("contest_finishheight", contestFinishHeight), DataEntry("contest_status", RUNNING)]) | |
73 | + | } | |
74 | + | } | |
75 | + | ||
76 | + | ||
77 | + | ||
78 | + | @Callable(i) | |
79 | + | func bet (currencyValue) = { | |
80 | + | let WLT = base58'CM8J4Z9HW3MdKgTxrpf3WYauXfjdu1zZKg19AGTicEYe' | |
81 | + | let account = toBase58String(i.caller.bytes) | |
82 | + | let pmt = extract(i.payment) | |
83 | + | let contestStartHeight = getNumByKey("contest_startheight") | |
84 | + | let contestFinishHeight = getNumByKey("contest_finishheight") | |
85 | + | let contestStatus = getStrByKey("contest_status") | |
86 | + | let contestNumber = getNumByKey("contest_number") | |
87 | + | if ((height > (contestFinishHeight - (2 * 1440)))) | |
88 | + | then throw("You cannot bet anymore at this height.") | |
89 | + | else if ((contestStatus != RUNNING)) | |
90 | + | then throw("Invalid status: you cannot bet now.") | |
91 | + | else if (if ((pmt.assetId != WLT)) | |
92 | + | then true | |
93 | + | else (pmt.amount != 500000)) | |
94 | + | then throw("You must pay 5 WLT to bet.") | |
95 | + | else WriteSet([DataEntry(((("bet_" + toString(contestNumber)) + "_") + account), currencyValue)]) | |
71 | 96 | } | |
72 | 97 | ||
73 | 98 |
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 () = getStrByKey("contest_status") | |
39 | 39 | ||
40 | 40 | ||
41 | 41 | @Callable(i) | |
42 | 42 | func setContestStatus (contestStatus) = { | |
43 | 43 | let account = toBase58String(i.caller.bytes) | |
44 | 44 | if ((account != DAPPOWNER)) | |
45 | 45 | then throw("Only dAPP Owner can set Contest Status.") | |
46 | 46 | else if (if (if ((contestStatus != RUNNING)) | |
47 | 47 | then (contestStatus != CLOSEDFORBETTING) | |
48 | 48 | else false) | |
49 | 49 | then (contestStatus != CLOSED) | |
50 | 50 | else false) | |
51 | 51 | then throw(("Invalid status: " + contestStatus)) | |
52 | 52 | else WriteSet([DataEntry("contest_status", contestStatus)]) | |
53 | 53 | } | |
54 | 54 | ||
55 | 55 | ||
56 | 56 | ||
57 | 57 | @Callable(i) | |
58 | 58 | func setContestConfiguration (currencyTicker,contestStartHeight) = { | |
59 | 59 | let account = toBase58String(i.caller.bytes) | |
60 | 60 | let contestStatus = getContestStatus() | |
61 | - | let | |
61 | + | let contestNumber = getNumByKey("contest_number") | |
62 | 62 | if ((account != DAPPOWNER)) | |
63 | 63 | then throw("Only dAPP Owner can Configure Contest.") | |
64 | 64 | else if ((height >= contestStartHeight)) | |
65 | 65 | then throw(("Start Height must be greater than current Blockchain height: " + toString(height))) | |
66 | 66 | else if ((contestStatus != RUNNING)) | |
67 | 67 | then throw(("You cannot configure Contest while status is: " + contestStatus)) | |
68 | 68 | else if ((currencyTicker != WAVES)) | |
69 | - | then throw((("dAPP does not support currency: " + currencyTicker) + "yet.")) | |
70 | - | else WriteSet([DataEntry("contest_currency", currencyTicker), DataEntry("contest_startheight", contestStartHeight), DataEntry("contest_finishheight", contestFinishHeight), DataEntry("contest_status", RUNNING)]) | |
69 | + | then throw((("dAPP does not support currency: " + currencyTicker) + " yet.")) | |
70 | + | else { | |
71 | + | let contestFinishHeight = (contestStartHeight + (7 * 1440)) | |
72 | + | WriteSet([DataEntry("contest_number", (contestNumber + 1)), DataEntry("contest_currency", currencyTicker), DataEntry("contest_startheight", contestStartHeight), DataEntry("contest_finishheight", contestFinishHeight), DataEntry("contest_status", RUNNING)]) | |
73 | + | } | |
74 | + | } | |
75 | + | ||
76 | + | ||
77 | + | ||
78 | + | @Callable(i) | |
79 | + | func bet (currencyValue) = { | |
80 | + | let WLT = base58'CM8J4Z9HW3MdKgTxrpf3WYauXfjdu1zZKg19AGTicEYe' | |
81 | + | let account = toBase58String(i.caller.bytes) | |
82 | + | let pmt = extract(i.payment) | |
83 | + | let contestStartHeight = getNumByKey("contest_startheight") | |
84 | + | let contestFinishHeight = getNumByKey("contest_finishheight") | |
85 | + | let contestStatus = getStrByKey("contest_status") | |
86 | + | let contestNumber = getNumByKey("contest_number") | |
87 | + | if ((height > (contestFinishHeight - (2 * 1440)))) | |
88 | + | then throw("You cannot bet anymore at this height.") | |
89 | + | else if ((contestStatus != RUNNING)) | |
90 | + | then throw("Invalid status: you cannot bet now.") | |
91 | + | else if (if ((pmt.assetId != WLT)) | |
92 | + | then true | |
93 | + | else (pmt.amount != 500000)) | |
94 | + | then throw("You must pay 5 WLT to bet.") | |
95 | + | else WriteSet([DataEntry(((("bet_" + toString(contestNumber)) + "_") + account), currencyValue)]) | |
71 | 96 | } | |
72 | 97 | ||
73 | 98 | ||
74 | 99 | @Verifier(tx) | |
75 | 100 | func verify () = match tx { | |
76 | 101 | case _: SetScriptTransaction|DataTransaction => | |
77 | 102 | sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
78 | 103 | case _: InvokeScriptTransaction => | |
79 | 104 | true | |
80 | 105 | case _ => | |
81 | 106 | true | |
82 | 107 | } | |
83 | 108 |
github/deemru/w8io/169f3d6 43.76 ms ◑