tx · GcmnqKtf1iH9m1Jkj9ehTPWFgLg5cr17ff2Rewio4Jz4

3MrwiwvG6BeUNCyXBfSAHgaXHASsxbjYMVF:  -0.01000000 Waves

2022.10.11 16:54 [2267763] smart account 3MrwiwvG6BeUNCyXBfSAHgaXHASsxbjYMVF > SELF 0.00000000 Waves

{ "type": 13, "id": "GcmnqKtf1iH9m1Jkj9ehTPWFgLg5cr17ff2Rewio4Jz4", "fee": 1000000, "feeAssetId": null, "timestamp": 1665496517313, "version": 2, "chainId": 84, "sender": "3MrwiwvG6BeUNCyXBfSAHgaXHASsxbjYMVF", "senderPublicKey": "7m7j9TNbV4vKeeJqy37XpMNH784X3GGN6acbgLwbBiDD", "proofs": [ "56piCnp3HbZamzYwHAxVAhWrKgndwH5i1hF9gV3TyUYg2HVDiCVf1ecJiQNEEFrjG3Hh2aLpyppXeQU5bWS77h8g" ], "script": "base64:AAIFAAAAAAAAABcIAhIHCgUBCAgYGBIECgIBARIECgIBEQAAABwAAAAADWtBZG1pblB1YktleTECAAAAC2FkbWluX3B1Yl8xAAAAAA1rQWRtaW5QdWJLZXkyAgAAAAthZG1pbl9wdWJfMgAAAAANa0FkbWluUHViS2V5MwIAAAALYWRtaW5fcHViXzMAAAAAEmtBZG1pbkludm9rZVB1YktleQIAAAAQYWRtaW5faW52b2tlX3B1YgAAAAAQa01vbmV5Qm94QWRkcmVzcwIAAAARbW9uZXlfYm94X2FkZHJlc3MAAAAAC2tHb3ZBZGRyZXNzAgAAABJnb3Zlcm5hbmNlX2FkZHJlc3MAAAAAB2tBY3RpdmUCAAAABmFjdGl2ZQAAAAANa0xhc3RTdXJ2ZXlJZAIAAAAObGFzdF9zdXJ2ZXlfaWQAAAAAF2tTdXJ2ZXlIZWlnaHRDb21wbGV0aW9uAgAAABlfc3VydmV5X2hlaWdodF9jb21wbGV0aW9uAAAAAAxrU3VydmV5VGl0bGUCAAAADV9zdXJ2ZXlfdGl0bGUAAAAAEmtTdXJ2ZXlEZXNjcmlwdGlv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WJLZXkxU2lnbmVkBQAAABJhZG1pblB1YktleTJTaWduZWQFAAAAEmFkbWluUHViS2V5M1NpZ25lZAAAAAAAAAAAAq9cpNs=", "height": 2267763, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: 4dFyybK9k9XcDDixshUgsigT2Lj1fS4GxiKtBhcCqa69 Full:
OldNewDifferences
1-# no script
1+{-# STDLIB_VERSION 5 #-}
2+{-# SCRIPT_TYPE ACCOUNT #-}
3+{-# CONTENT_TYPE DAPP #-}
4+let kAdminPubKey1 = "admin_pub_1"
5+
6+let kAdminPubKey2 = "admin_pub_2"
7+
8+let kAdminPubKey3 = "admin_pub_3"
9+
10+let kAdminInvokePubKey = "admin_invoke_pub"
11+
12+let kMoneyBoxAddress = "money_box_address"
13+
14+let kGovAddress = "governance_address"
15+
16+let kActive = "active"
17+
18+let kLastSurveyId = "last_survey_id"
19+
20+let kSurveyHeightCompletion = "_survey_height_completion"
21+
22+let kSurveyTitle = "_survey_title"
23+
24+let kSurveyDescription = "_survey_description"
25+
26+let kSurveyOptionName = "_survey_option_name"
27+
28+let kSurveyOptionType = "_survey_option_type"
29+
30+let kUserVote = "_survey_user_vote"
31+
32+let kTotalSwopVoted = "_survey_option_total_swop_voted"
33+
34+let kUserSwopInGov = "_SWOP_amount"
35+
36+let oracle = Address(base58'3MvVBtsXroQpy1tsPw21TU2ET9A8WfmrNjz')
37+
38+func getBase58FromOracle (key) = match getString(oracle, key) {
39+ case string: String =>
40+ fromBase58String(string)
41+ case nothing =>
42+ throw((key + "is empty"))
43+}
44+
45+
46+let adminPubKey1 = getBase58FromOracle(kAdminPubKey1)
47+
48+let adminPubKey2 = getBase58FromOracle(kAdminPubKey2)
49+
50+let adminPubKey3 = getBase58FromOracle(kAdminPubKey3)
51+
52+let adminPubKeyInvoke = getBase58FromOracle(kAdminInvokePubKey)
53+
54+let moneyBoxAddress = Address(getBase58FromOracle(kMoneyBoxAddress))
55+
56+let govAddress = Address(getBase58FromOracle(kGovAddress))
57+
58+let active = valueOrElse(getBoolean(this, kActive), true)
59+
60+func isActive () = if (active)
61+ then unit
62+ else throw("DApp is inactive at this moment")
63+
64+
65+func isAdminCall (i) = if (containsElement([adminPubKey1, adminPubKey2, adminPubKey3], i.callerPublicKey))
66+ then unit
67+ else throw("Only admin can call this function")
68+
69+
70+func isMoneyBoxCall (i) = if ((moneyBoxAddress == i.caller))
71+ then unit
72+ else throw("Only Money box can call this function")
73+
74+
75+@Callable(i)
76+func initSurvey (heightCompletion,surveyTitle,surveyDescription,options,optionsType) = valueOrElse(isActive(), valueOrElse(isAdminCall(i), if ((height >= heightCompletion))
77+ then throw("Height of survey completion must be greater than currnet height")
78+ else if ((size(options) > 10))
79+ then throw("Max 10 options must be specified")
80+ else if ((size(options) != size(optionsType)))
81+ then throw("Size of optionsTypes must be same as options")
82+ else {
83+ let newSurveyId = (valueOrElse(getInteger(this, kLastSurveyId), 0) + 1)
84+ func prepareOptions (acc,name) = {
85+ let $t030263054 = acc
86+ let types = $t030263054._1
87+ let k = $t030263054._2
88+ let result = $t030263054._3
89+ let res = ((result :+ StringEntry((((toString(newSurveyId) + "_") + toString(k)) + kSurveyOptionName), name)) :+ StringEntry((((toString(newSurveyId) + "_") + toString(k)) + kSurveyOptionType), types[k]))
90+ $Tuple3(types, (k + 1), res)
91+ }
92+
93+ let optionsEntries = {
94+ let $l = options
95+ let $s = size($l)
96+ let $acc0 = $Tuple3(optionsType, 0, nil)
97+ func $f0_1 ($a,$i) = if (($i >= $s))
98+ then $a
99+ else prepareOptions($a, $l[$i])
100+
101+ func $f0_2 ($a,$i) = if (($i >= $s))
102+ then $a
103+ else throw("List size exceeds 10")
104+
105+ $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10)
106+ }
107+ ([IntegerEntry(kLastSurveyId, newSurveyId), IntegerEntry((toString(newSurveyId) + kSurveyHeightCompletion), heightCompletion), StringEntry((toString(newSurveyId) + kSurveyTitle), surveyTitle), StringEntry((toString(newSurveyId) + kSurveyDescription), surveyDescription)] ++ optionsEntries._3)
108+ }))
109+
110+
111+
112+@Callable(i)
113+func vote (surveyId,option) = valueOrElse(isActive(), if (!(isDefined(getString(this, (toString(surveyId) + kSurveyTitle)))))
114+ then throw(("There is no survey with id " + toString(surveyId)))
115+ else if (!(isDefined(getString(this, (((toString(surveyId) + "_") + toString(option)) + kSurveyOptionName)))))
116+ then throw(((("There is no option " + toString(option)) + " in survey ") + toString(surveyId)))
117+ else if (isDefined(getInteger(this, (((toString(surveyId) + "_") + toString(i.caller)) + kUserVote))))
118+ then throw("You can't vote twice")
119+ else if ((height > value(getInteger(this, (toString(surveyId) + kSurveyHeightCompletion)))))
120+ then throw("Survey already end")
121+ else if ((0 >= valueOrElse(getInteger(govAddress, (toString(i.caller) + kUserSwopInGov)), 0)))
122+ then throw("Stake swop in governance to survey")
123+ else [IntegerEntry((((toString(surveyId) + "_") + toString(i.caller)) + kUserVote), option)])
124+
125+
126+
127+@Callable(i)
128+func writeTotals (surveyId,totals) = valueOrElse(isActive(), valueOrElse(isMoneyBoxCall(i), if (!(isDefined(getString(this, (toString(surveyId) + kSurveyTitle)))))
129+ then throw(("There is no survey with id " + toString(surveyId)))
130+ else if ((value(getInteger(this, (toString(surveyId) + kSurveyHeightCompletion))) > height))
131+ then throw("Survey is not ended yet")
132+ else {
133+ func prepareTotals (acc,total) = {
134+ let $t057155741 = acc
135+ let option = $t057155741._1
136+ let result = $t057155741._2
137+ let res = (result :+ IntegerEntry((((toString(surveyId) + "_") + toString(option)) + kTotalSwopVoted), total))
138+ $Tuple2((option + 1), res)
139+ }
140+
141+ let optionsEntries = {
142+ let $l = totals
143+ let $s = size($l)
144+ let $acc0 = $Tuple2(0, nil)
145+ func $f0_1 ($a,$i) = if (($i >= $s))
146+ then $a
147+ else prepareTotals($a, $l[$i])
148+
149+ func $f0_2 ($a,$i) = if (($i >= $s))
150+ then $a
151+ else throw("List size exceeds 10")
152+
153+ $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10)
154+ }
155+ optionsEntries._2
156+ }))
157+
158+
159+@Verifier(tx)
160+func verify () = {
161+ let adminPubKey1Signed = if (sigVerify(tx.bodyBytes, tx.proofs[0], adminPubKey1))
162+ then 1
163+ else 0
164+ let adminPubKey2Signed = if (sigVerify(tx.bodyBytes, tx.proofs[1], adminPubKey2))
165+ then 1
166+ else 0
167+ let adminPubKey3Signed = if (sigVerify(tx.bodyBytes, tx.proofs[2], adminPubKey3))
168+ then 1
169+ else 0
170+ (((adminPubKey1Signed + adminPubKey2Signed) + adminPubKey3Signed) >= 2)
171+ }
172+

github/deemru/w8io/169f3d6 
30.04 ms