tx · 3v8VURZcPDpU5hFaUqSi89vtqMrWjfqqEjwGVjSjng3e 3N7Wiiso7vo69pqWfLtpzT3tbzMUGahqpgo: -0.01400000 Waves 2019.08.15 10:37 [631880] smart account 3N7Wiiso7vo69pqWfLtpzT3tbzMUGahqpgo > SELF 0.00000000 Waves
{ "type": 13, "id": "3v8VURZcPDpU5hFaUqSi89vtqMrWjfqqEjwGVjSjng3e", "fee": 1400000, "feeAssetId": null, "timestamp": 1565854624518, "version": 1, "sender": "3N7Wiiso7vo69pqWfLtpzT3tbzMUGahqpgo", "senderPublicKey": "5GQSFwNMkJFTT3FeLT3KENqoSr42yiJP3Av5qAYq1F7f", "proofs": [ "4eEYDyiY1t2WSdLmCMsbw6QbZoPNDRJUTTLS1sroaU7EF4KgF9KRKS6PXW7upqw9u3ajQ8fdzRMGCq4bcPqRSDkr" ], "script": "base64:AAIDAAAAAAAAAAAAAAALAAAAAAdSVU5OSU5HAgAAAAdSVU5OSU5HAAAAAAZDTE9TRUQCAAAABkNMT1NFRAAAAAAJREFQUE9XTkVSAgAAACMzTjdXaWlzbzd2bzY5cHFXZkx0cHpUM3Riek1VR2FocXBnbwAAAAAFV0FWRVMCAAAABVdBVkVTAAAAAAROT05FAgAAAAROT05FAAAAAANGRUUAAAAAAAANu6AAAAAAA1dMVAEAAAAguhzhiEkXRAZBdFhaB2FMQW+3WMuNgvHvyYRPNpTXmmUBAAAAC2dldE51bUJ5S2V5AAAAAQAAAANrZXkEAAAAA251bQQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQAAAAAAAAAAAAUAAAADbnVtAQAAAAtnZXRTdHJCeUtleQAAAAEAAAADa2V5BAAAAANzdHIEAAAAByRtYXRjaDAJAAQdAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAAZTdH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ACBQAAAAdhY2NvdW50BQAAAAlEQVBQT1dORVIJAAACAAAAAQIAAAAiT25seSBkQVBQIE93bmVyIGNhbiBDbG9zZSBDb250ZXN0LgkBAAAADFNjcmlwdFJlc3VsdAAAAAIFAAAAD3dyaXRlU3RhdGlzdGljcwUAAAALd2luVHJhbnNmZXIAAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAABAAAAAckbWF0Y2gwBQAAAAJ0eAMDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAFFNldFNjcmlwdFRyYW5zYWN0aW9uBgkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAA9EYXRhVHJhbnNhY3Rpb24JAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAACAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAABdJbnZva2VTY3JpcHRUcmFuc2FjdGlvbgYGx0XiFA==", "chainId": 84, "height": 631880, "spentComplexity": 0 } View: original | compacted Prev: F1HLuWBJoz7RdmWjrf4bmD5mGPTEGkJKve4XDWK6UQV5 Next: Cs5tpMFExCyvrYrqNjqMVsxjVmLieAgVPtbJGko9Nybb Diff:
Old | New | Differences | |
---|---|---|---|
85 | 85 | then throw((("dAPP does not support currency: " + currencyTicker) + " yet.")) | |
86 | 86 | else { | |
87 | 87 | let contestFinishHeight = (contestStartHeight + (7 * 1440)) | |
88 | - | WriteSet([DataEntry("contest_currentnumber", contestNewNumber), DataEntry((("contest_" + toString(contestNewNumber)) + "_currency"), currencyTicker), DataEntry((("contest_" + toString(contestNewNumber)) + "_startheight"), contestStartHeight), DataEntry((("contest_" + toString(contestNewNumber)) + "_finishheight"), contestFinishHeight), DataEntry((("contest_" + toString(contestNewNumber)) + "_status"), RUNNING), DataEntry((("contest_" + toString(contestNewNumber)) + "_votecounter"), | |
88 | + | WriteSet([DataEntry("contest_currentnumber", contestNewNumber), DataEntry((("contest_" + toString(contestNewNumber)) + "_currency"), currencyTicker), DataEntry((("contest_" + toString(contestNewNumber)) + "_startheight"), contestStartHeight), DataEntry((("contest_" + toString(contestNewNumber)) + "_finishheight"), contestFinishHeight), DataEntry((("contest_" + toString(contestNewNumber)) + "_status"), RUNNING), DataEntry((("contest_" + toString(contestNewNumber)) + "_votecounter"), 0)]) | |
89 | 89 | } | |
90 | 90 | } | |
91 | 91 |
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 CLOSED = "CLOSED" | |
7 | 7 | ||
8 | 8 | let DAPPOWNER = "3N7Wiiso7vo69pqWfLtpzT3tbzMUGahqpgo" | |
9 | 9 | ||
10 | 10 | let WAVES = "WAVES" | |
11 | 11 | ||
12 | 12 | let NONE = "NONE" | |
13 | 13 | ||
14 | 14 | let FEE = 900000 | |
15 | 15 | ||
16 | 16 | let WLT = base58'DXWNi4KTciwBKCqMoK9jHmesmAVRbM47dmD3jsiBhEMA' | |
17 | 17 | ||
18 | 18 | func getNumByKey (key) = { | |
19 | 19 | let num = match getInteger(this, key) { | |
20 | 20 | case a: Int => | |
21 | 21 | a | |
22 | 22 | case _ => | |
23 | 23 | 0 | |
24 | 24 | } | |
25 | 25 | num | |
26 | 26 | } | |
27 | 27 | ||
28 | 28 | ||
29 | 29 | func getStrByKey (key) = { | |
30 | 30 | let str = match getString(this, key) { | |
31 | 31 | case a: String => | |
32 | 32 | a | |
33 | 33 | case _ => | |
34 | 34 | NONE | |
35 | 35 | } | |
36 | 36 | str | |
37 | 37 | } | |
38 | 38 | ||
39 | 39 | ||
40 | 40 | func getContestStatus () = { | |
41 | 41 | let contestCurrNumber = getNumByKey("contest_currentnumber") | |
42 | 42 | getStrByKey((("contest_" + toString(contestCurrNumber)) + "_status")) | |
43 | 43 | } | |
44 | 44 | ||
45 | 45 | ||
46 | 46 | func getExtWAVESUSDCurrencyRate () = { | |
47 | 47 | let oracleAddress = extract(addressFromString("3PPTrTo3AzR56N7ArzbU3Bpq9zYMgcf39Mk")) | |
48 | 48 | let WAVESUSDCurrencyRate = match getInteger(oracleAddress, "waves_usd_2") { | |
49 | 49 | case a: Int => | |
50 | 50 | a | |
51 | 51 | case _ => | |
52 | 52 | 0 | |
53 | 53 | } | |
54 | 54 | WAVESUSDCurrencyRate | |
55 | 55 | } | |
56 | 56 | ||
57 | 57 | ||
58 | 58 | @Callable(i) | |
59 | 59 | func setContestStatus (contestNumber,contestStatus) = { | |
60 | 60 | let account = toBase58String(i.caller.bytes) | |
61 | 61 | if ((account != DAPPOWNER)) | |
62 | 62 | then throw("Only dAPP Owner can set Contest Status.") | |
63 | 63 | else if (if ((contestStatus != RUNNING)) | |
64 | 64 | then (contestStatus != CLOSED) | |
65 | 65 | else false) | |
66 | 66 | then throw(("Invalid status: " + contestStatus)) | |
67 | 67 | else WriteSet([DataEntry((("contest_" + toString(contestNumber)) + "_status"), contestStatus)]) | |
68 | 68 | } | |
69 | 69 | ||
70 | 70 | ||
71 | 71 | ||
72 | 72 | @Callable(i) | |
73 | 73 | func setContestConfiguration (currencyTicker,contestStartHeight) = { | |
74 | 74 | let account = toBase58String(i.caller.bytes) | |
75 | 75 | let contestCurrNumber = getNumByKey("contest_currentnumber") | |
76 | 76 | let contestCurrStatus = getStrByKey((("contest_" + toString(contestCurrNumber)) + "_status")) | |
77 | 77 | let contestNewNumber = (contestCurrNumber + 1) | |
78 | 78 | if ((account != DAPPOWNER)) | |
79 | 79 | then throw("Only dAPP Owner can Configure Contest.") | |
80 | 80 | else if ((height >= contestStartHeight)) | |
81 | 81 | then throw(("Start Height must be greater than current Blockchain height: " + toString(height))) | |
82 | 82 | else if ((contestCurrStatus == RUNNING)) | |
83 | 83 | then throw(("You cannot configure a new Contest while old Contest status is: " + contestCurrStatus)) | |
84 | 84 | else if ((currencyTicker != WAVES)) | |
85 | 85 | then throw((("dAPP does not support currency: " + currencyTicker) + " yet.")) | |
86 | 86 | else { | |
87 | 87 | let contestFinishHeight = (contestStartHeight + (7 * 1440)) | |
88 | - | WriteSet([DataEntry("contest_currentnumber", contestNewNumber), DataEntry((("contest_" + toString(contestNewNumber)) + "_currency"), currencyTicker), DataEntry((("contest_" + toString(contestNewNumber)) + "_startheight"), contestStartHeight), DataEntry((("contest_" + toString(contestNewNumber)) + "_finishheight"), contestFinishHeight), DataEntry((("contest_" + toString(contestNewNumber)) + "_status"), RUNNING), DataEntry((("contest_" + toString(contestNewNumber)) + "_votecounter"), | |
88 | + | WriteSet([DataEntry("contest_currentnumber", contestNewNumber), DataEntry((("contest_" + toString(contestNewNumber)) + "_currency"), currencyTicker), DataEntry((("contest_" + toString(contestNewNumber)) + "_startheight"), contestStartHeight), DataEntry((("contest_" + toString(contestNewNumber)) + "_finishheight"), contestFinishHeight), DataEntry((("contest_" + toString(contestNewNumber)) + "_status"), RUNNING), DataEntry((("contest_" + toString(contestNewNumber)) + "_votecounter"), 0)]) | |
89 | 89 | } | |
90 | 90 | } | |
91 | 91 | ||
92 | 92 | ||
93 | 93 | ||
94 | 94 | @Callable(i) | |
95 | 95 | func bet (currencyValue) = { | |
96 | 96 | let account = toBase58String(i.caller.bytes) | |
97 | 97 | let pmt = extract(i.payment) | |
98 | 98 | let contestCurrNumber = getNumByKey("contest_currentnumber") | |
99 | 99 | let contestStartHeight = getNumByKey((("contest_" + toString(contestCurrNumber)) + "_startheight")) | |
100 | 100 | let contestFinishHeight = getNumByKey((("contest_" + toString(contestCurrNumber)) + "_finishheight")) | |
101 | 101 | let contestVoteCounter = getNumByKey((("contest_" + toString(contestCurrNumber)) + "_votecounter")) | |
102 | 102 | let thisVoteId = (contestVoteCounter + 1) | |
103 | 103 | let key = ((("bet_" + toString(contestCurrNumber)) + "_") + currencyValue) | |
104 | 104 | let contestStatus = getStrByKey((("contest_" + toString(contestCurrNumber)) + "_status")) | |
105 | 105 | let existingBetAccount = getStrByKey(((("bet_" + toString(contestCurrNumber)) + "_") + currencyValue)) | |
106 | 106 | if ((height > (contestFinishHeight - (2 * 1440)))) | |
107 | 107 | then throw("You cannot bet anymore at this height.") | |
108 | 108 | else if ((contestStatus != RUNNING)) | |
109 | 109 | then throw("Invalid status: you cannot bet now.") | |
110 | 110 | else if (if ((pmt.assetId != WLT)) | |
111 | 111 | then true | |
112 | 112 | else (pmt.amount != 500000)) | |
113 | 113 | then throw("You must pay 5 WLT to bet.") | |
114 | 114 | else if (if ((existingBetAccount != NONE)) | |
115 | 115 | then (existingBetAccount != account) | |
116 | 116 | else false) | |
117 | 117 | then throw(((((((("Key: " + key) + " Account:") + account) + " Existing Bet Account: ") + existingBetAccount) + " Currency Value:") + currencyValue)) | |
118 | 118 | else WriteSet([DataEntry((((("bet_" + toString(contestCurrNumber)) + "_") + toString(thisVoteId)) + "_owner"), account), DataEntry(((("bet_" + toString(contestCurrNumber)) + "_") + toString(thisVoteId)), currencyValue), DataEntry((("contest_" + toString(contestCurrNumber)) + "_votecounter"), thisVoteId)]) | |
119 | 119 | } | |
120 | 120 | ||
121 | 121 | ||
122 | 122 | ||
123 | 123 | @Callable(i) | |
124 | 124 | func closecontest (currencyRate) = { | |
125 | 125 | let contestCurrNumber = getNumByKey("contest_currentnumber") | |
126 | 126 | let key = ((("bet_" + toString(contestCurrNumber)) + "_") + currencyRate) | |
127 | 127 | let winnerAccount = getStrByKey(key) | |
128 | 128 | let account = toBase58String(i.caller.bytes) | |
129 | 129 | let balance = wavesBalance(this) | |
130 | 130 | let winTransfer = TransferSet([ScriptTransfer(extract(addressFromString(winnerAccount)), (wavesBalance(this) - FEE), unit)]) | |
131 | 131 | let writeStatistics = WriteSet([DataEntry((("contest_" + toString(contestCurrNumber)) + "_status"), CLOSED), DataEntry((("contest_" + toString(contestCurrNumber)) + "_winner"), winnerAccount), DataEntry((("contest_" + toString(contestCurrNumber)) + "_currencyrate"), currencyRate), DataEntry((("contest_" + toString(contestCurrNumber)) + "_height"), height)]) | |
132 | 132 | if ((account != DAPPOWNER)) | |
133 | 133 | then throw("Only dAPP Owner can Close Contest.") | |
134 | 134 | else ScriptResult(writeStatistics, winTransfer) | |
135 | 135 | } | |
136 | 136 | ||
137 | 137 | ||
138 | 138 | @Verifier(tx) | |
139 | 139 | func verify () = match tx { | |
140 | 140 | case _: SetScriptTransaction|DataTransaction => | |
141 | 141 | sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
142 | 142 | case _: InvokeScriptTransaction => | |
143 | 143 | true | |
144 | 144 | case _ => | |
145 | 145 | true | |
146 | 146 | } | |
147 | 147 |
github/deemru/w8io/026f985 47.28 ms ◑