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