tx · CBsQwuKDUgw6aLNqeCyUjS2xT4NBJdDRZWho3BpvWCtf

3N4NPivoThtskr7JxnNrKL7s8BzmRGx9rT2:  -0.01400000 Waves

2019.08.11 11:42 [626156] smart account 3N4NPivoThtskr7JxnNrKL7s8BzmRGx9rT2 > SELF 0.00000000 Waves

{ "type": 13, "id": "CBsQwuKDUgw6aLNqeCyUjS2xT4NBJdDRZWho3BpvWCtf", "fee": 1400000, "feeAssetId": null, "timestamp": 1565512964255, "version": 1, "sender": "3N4NPivoThtskr7JxnNrKL7s8BzmRGx9rT2", "senderPublicKey": "F3vhYapU4NBzfM2X4KNkoFcxj3UbYnJjqituG6KE7ZPG", "proofs": [ "5iXMNZN52hwuvrfzNdCq2YGDGyhKBSAB6fTWex1fwUUF4KmTuXwxgt9QanmK3szgg5Q9FQRXGjQ83cfRo4ZfGRfG" ], "script": "base64:AAIDAAAAAAAAAAAAAAAJAAAAAAdSVU5OSU5HAgAAAAdSVU5OSU5HAAAAABBDTE9TRURGT1JCRVRUSU5HAgAAABBDTE9TRURGT1JCRVRUSU5HAAAAAAZDTE9TRUQCAAAABkNMT1NFRAAAAAAJREFQUE9XTkVSAgAAACMzTjROUGl2b1RodHNrcjdKeG5OcktMN3M4QnptUkd4OXJUMgAAAAAFV0FWRVMCAAAABVdBVkVTAAAAAAROT05FAgAAAAROT05FAQAAAAtnZXROdW1CeUtleQAAAAEAAAADa2V5BAAAAANudW0EAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEAAAAAAAAAAAAFAAAAA251bQEAAAALZ2V0U3RyQnlLZXkAAAABAAAAA2tleQQAAAADc3RyBAAAAAckbWF0Y2gwCQAEHQAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAGU3RyaW5nBAAAAAFhBQAAAAckbWF0Y2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ZXN0Q3Vyck51bWJlcgIAAAABXwUAAAAHYWNjb3VudAUAAAANY3VycmVuY3lWYWx1ZQUAAAADbmlsAAAAAQAAAAJ0eAEAAAAGdmVyaWZ5AAAAAAQAAAAHJG1hdGNoMAUAAAACdHgDAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAABRTZXRTY3JpcHRUcmFuc2FjdGlvbgYJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAPRGF0YVRyYW5zYWN0aW9uCQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAgFAAAAAnR4AAAAD3NlbmRlclB1YmxpY0tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAXSW52b2tlU2NyaXB0VHJhbnNhY3Rpb24GBqJUYmA=", "chainId": 84, "height": 626156, "spentComplexity": 0 } View: original | compacted Prev: B87FR8QWRBCko4yUHLwUgU8wY1rZMFZeskqGUQpkVh2y Next: GVQTh99ZWZKqoC9d1KUQE95Aubwg82e1fULQDm2gqJL7 Diff:
OldNewDifferences
3535 }
3636
3737
38-func getContestStatus () = getStrByKey("contest_status")
38+func getContestStatus () = {
39+ let contestCurrNumber = getNumByKey("contest_currentnumber")
40+ getStrByKey((("contest_" + toString(contestCurrNumber)) + "status"))
41+ }
3942
4043
4144 @Callable(i)
4245 func setContestStatus (contestStatus) = {
4346 let account = toBase58String(i.caller.bytes)
47+ let contestCurrNumber = getNumByKey("contest_currentnumber")
4448 if ((account != DAPPOWNER))
4549 then throw("Only dAPP Owner can set Contest Status.")
4650 else if (if (if ((contestStatus != RUNNING))
4953 then (contestStatus != CLOSED)
5054 else false)
5155 then throw(("Invalid status: " + contestStatus))
52- else WriteSet([DataEntry("contest_status", contestStatus)])
56+ else WriteSet([DataEntry((("contest_" + toString(contestCurrNumber)) + "status"), contestStatus)])
5357 }
5458
5559
5862 func setContestConfiguration (currencyTicker,contestStartHeight) = {
5963 let account = toBase58String(i.caller.bytes)
6064 let contestStatus = getContestStatus()
61- let contestNumber = getNumByKey("contest_number")
65+ let contestPrevNumber = getNumByKey("contest_currentnumber")
66+ let contestCurrNumber = (contestPrevNumber + 1)
6267 if ((account != DAPPOWNER))
6368 then throw("Only dAPP Owner can Configure Contest.")
6469 else if ((height >= contestStartHeight))
6974 then throw((("dAPP does not support currency: " + currencyTicker) + " yet."))
7075 else {
7176 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)])
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)])
7378 }
7479 }
7580
8085 let WLT = base58'2B3mWxfnhAaCpJuqbkbiD6HVCTEcgwdmzxFCjZe65NYg'
8186 let account = toBase58String(i.caller.bytes)
8287 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")
88+ let contestCurrNumber = getNumByKey("contest_currentnumber")
89+ let contestStartHeight = getNumByKey((("contest_" + toString(contestCurrNumber)) + "startheight"))
90+ let contestFinishHeight = getNumByKey((("contest_" + toString(contestCurrNumber)) + "finishheight"))
91+ let contestStatus = getStrByKey((("contest_" + toString(contestCurrNumber)) + "status"))
8792 if ((height > (contestFinishHeight - (2 * 1440))))
8893 then throw("You cannot bet anymore at this height.")
8994 else if ((contestStatus != RUNNING))
9297 then true
9398 else (pmt.amount != 500000))
9499 then throw("You must pay 5 WLT to bet.")
95- else WriteSet([DataEntry(((("bet_" + toString(contestNumber)) + "_") + account), currencyValue)])
100+ else WriteSet([DataEntry(((("bet_" + toString(contestCurrNumber)) + "_") + account), currencyValue)])
96101 }
97102
98103
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let RUNNING = "RUNNING"
55
66 let CLOSEDFORBETTING = "CLOSEDFORBETTING"
77
88 let CLOSED = "CLOSED"
99
1010 let DAPPOWNER = "3N4NPivoThtskr7JxnNrKL7s8BzmRGx9rT2"
1111
1212 let WAVES = "WAVES"
1313
1414 let NONE = "NONE"
1515
1616 func getNumByKey (key) = {
1717 let num = match getInteger(this, key) {
1818 case a: Int =>
1919 a
2020 case _ =>
2121 0
2222 }
2323 num
2424 }
2525
2626
2727 func getStrByKey (key) = {
2828 let str = match getString(this, key) {
2929 case a: String =>
3030 a
3131 case _ =>
3232 NONE
3333 }
3434 str
3535 }
3636
3737
38-func getContestStatus () = getStrByKey("contest_status")
38+func getContestStatus () = {
39+ let contestCurrNumber = getNumByKey("contest_currentnumber")
40+ getStrByKey((("contest_" + toString(contestCurrNumber)) + "status"))
41+ }
3942
4043
4144 @Callable(i)
4245 func setContestStatus (contestStatus) = {
4346 let account = toBase58String(i.caller.bytes)
47+ let contestCurrNumber = getNumByKey("contest_currentnumber")
4448 if ((account != DAPPOWNER))
4549 then throw("Only dAPP Owner can set Contest Status.")
4650 else if (if (if ((contestStatus != RUNNING))
4751 then (contestStatus != CLOSEDFORBETTING)
4852 else false)
4953 then (contestStatus != CLOSED)
5054 else false)
5155 then throw(("Invalid status: " + contestStatus))
52- else WriteSet([DataEntry("contest_status", contestStatus)])
56+ else WriteSet([DataEntry((("contest_" + toString(contestCurrNumber)) + "status"), contestStatus)])
5357 }
5458
5559
5660
5761 @Callable(i)
5862 func setContestConfiguration (currencyTicker,contestStartHeight) = {
5963 let account = toBase58String(i.caller.bytes)
6064 let contestStatus = getContestStatus()
61- let contestNumber = getNumByKey("contest_number")
65+ let contestPrevNumber = getNumByKey("contest_currentnumber")
66+ let contestCurrNumber = (contestPrevNumber + 1)
6267 if ((account != DAPPOWNER))
6368 then throw("Only dAPP Owner can Configure Contest.")
6469 else if ((height >= contestStartHeight))
6570 then throw(("Start Height must be greater than current Blockchain height: " + toString(height)))
6671 else if ((contestStatus != RUNNING))
6772 then throw(("You cannot configure Contest while status is: " + contestStatus))
6873 else if ((currencyTicker != WAVES))
6974 then throw((("dAPP does not support currency: " + currencyTicker) + " yet."))
7075 else {
7176 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)])
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)])
7378 }
7479 }
7580
7681
7782
7883 @Callable(i)
7984 func bet (currencyValue) = {
8085 let WLT = base58'2B3mWxfnhAaCpJuqbkbiD6HVCTEcgwdmzxFCjZe65NYg'
8186 let account = toBase58String(i.caller.bytes)
8287 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")
88+ let contestCurrNumber = getNumByKey("contest_currentnumber")
89+ let contestStartHeight = getNumByKey((("contest_" + toString(contestCurrNumber)) + "startheight"))
90+ let contestFinishHeight = getNumByKey((("contest_" + toString(contestCurrNumber)) + "finishheight"))
91+ let contestStatus = getStrByKey((("contest_" + toString(contestCurrNumber)) + "status"))
8792 if ((height > (contestFinishHeight - (2 * 1440))))
8893 then throw("You cannot bet anymore at this height.")
8994 else if ((contestStatus != RUNNING))
9095 then throw("Invalid status: you cannot bet now.")
9196 else if (if ((pmt.assetId != WLT))
9297 then true
9398 else (pmt.amount != 500000))
9499 then throw("You must pay 5 WLT to bet.")
95- else WriteSet([DataEntry(((("bet_" + toString(contestNumber)) + "_") + account), currencyValue)])
100+ else WriteSet([DataEntry(((("bet_" + toString(contestCurrNumber)) + "_") + account), currencyValue)])
96101 }
97102
98103
99104 @Verifier(tx)
100105 func verify () = match tx {
101106 case _: SetScriptTransaction|DataTransaction =>
102107 sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
103108 case _: InvokeScriptTransaction =>
104109 true
105110 case _ =>
106111 true
107112 }
108113

github/deemru/w8io/169f3d6 
42.82 ms