tx · E1GzyHZ2nBL1SktQ6c44DiCLogSHF7bLsXMDaFrTeyHj 3N4ziXSMRverXyxHDUKKMR9MHXnB3TyU3Yh: -0.01000000 Waves 2023.04.19 11:45 [2541219] smart account 3N4ziXSMRverXyxHDUKKMR9MHXnB3TyU3Yh > SELF 0.00000000 Waves
{ "type": 13, "id": "E1GzyHZ2nBL1SktQ6c44DiCLogSHF7bLsXMDaFrTeyHj", "fee": 1000000, "feeAssetId": null, "timestamp": 1681893970998, "version": 2, "chainId": 84, "sender": "3N4ziXSMRverXyxHDUKKMR9MHXnB3TyU3Yh", "senderPublicKey": "EU9obW1yVhR8qug3EmXPeew3DMagvJFQzY5Ku8bmcsU7", "proofs": [ "LU6KV8qvqs9BkcoszrLC9LaCMj4Esyi1BBkUp4X33BxHiK5SjiYVFWvsT9xvbH3UGXc1JzSw4TASuygULEUFrym" ], "script": "base64:BgIcCAISABIDCgEIEgASABIDCgEIEgMKAQgSAwoBCBkAA1NFUAICX18AEGNvbnRyYWN0RmlsZW5hbWUCEm1hbmFnZXJfdmF1bHQucmlkZQEIdGhyb3dFcnIBAXMJAAIBCQCsAgIJAKwCAgUQY29udHJhY3RGaWxlbmFtZQICOiAFAXMBGWtleUFjdGl2ZU1hbmFnZXJQdWJsaWNLZXkACQC5CQIJAMwIAgICJXMJAMwIAgIQbWFuYWdlclB1YmxpY0tleQUDbmlsBQNTRVABGmtleVBlbmRpbmdNYW5hZ2VyUHVibGljS2V5AAkAuQkCCQDMCAICAiVzCQDMCAICF3BlbmRpbmdNYW5hZ2VyUHVibGljS2V5BQNuaWwFA1NFUAEaa2V5Q3VycmVudE1hbmFnZXJQdWJsaWNLZXkACQC5CQIJAMwIAgICJXMJAMwIAgIXY3VycmVudE1hbmFnZXJQdWJsaWNLZXkFA25pbAUDU0VQARprZXlTZXROZXdNYW5hZ2VyVm90ZVByZWZpeAEQbWFuYWdlclB1YmxpY0tleQkAuQkCCQDMCAICBiVzJXMlcwkAzAgCAgpzZXRNYW5hZ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WxsZXJBZGRyZXNzU3RyaW5nBQlrZXlQcmVmaXgFBnF1b3J1bQUGcmVzdWx0AQJ0eAEGdmVyaWZ5AAQLYWxsb3dlZFR4SWQJANkEAQkBEUBleHRyTmF0aXZlKDEwNTgpAQkBDmtleUFsbG93ZWRUeElkAAQHJG1hdGNoMAUCdHgDCQABAgUHJG1hdGNoMAIUU2V0U2NyaXB0VHJhbnNhY3Rpb24EAXQFByRtYXRjaDAJAPQDAwgFAnR4CWJvZHlCeXRlcwkAkQMCCAUCdHgGcHJvb2ZzAAAIBQJ0eA9zZW5kZXJQdWJsaWNLZXkDCQABAgUHJG1hdGNoMAIPRGF0YVRyYW5zYWN0aW9uBAF0BQckbWF0Y2gwCQD0AwMIBQJ0eAlib2R5Qnl0ZXMJAJEDAggFAnR4BnByb29mcwAACAUCdHgPc2VuZGVyUHVibGljS2V5CQAAAggFAnR4AmlkBQthbGxvd2VkVHhJZDJOyrg=", "height": 2541219, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: GG9XYpqFpVQLLSwi2m2fc7QA2A3EpmAVxk7mGpYiwWGu Next: J8eXxeZThKDDw1WEZ9EBziSoar1DzUYQ14uFZnPgNgHk Diff:
Old | New | Differences | |
---|---|---|---|
176 | 176 | func voteForNewManger (newManagerPublicKey) = { | |
177 | 177 | let callerAddressString = toBase58String(i.caller.bytes) | |
178 | 178 | let keyPrefix = keySetNewManagerVotePrefix(newManagerPublicKey) | |
179 | - | let | |
179 | + | let quorum = 2 | |
180 | 180 | let result = [StringEntry(keyPendingManagerPublicKey(), newManagerPublicKey)] | |
181 | - | voteINTERNAL(callerAddressString, keyPrefix, | |
181 | + | voteINTERNAL(callerAddressString, keyPrefix, quorum, result) | |
182 | 182 | } | |
183 | 183 | ||
184 | 184 | ||
187 | 187 | func deactivateManager () = { | |
188 | 188 | let callerAddressString = toBase58String(i.caller.bytes) | |
189 | 189 | let keyPrefix = keyDeactivateManagerVotePrefix() | |
190 | - | let | |
190 | + | let quorum = 1 | |
191 | 191 | let result = [StringEntry(keyActiveManagerPublicKey(), "disabled")] | |
192 | - | voteINTERNAL(callerAddressString, keyPrefix, | |
192 | + | voteINTERNAL(callerAddressString, keyPrefix, quorum, result) | |
193 | 193 | } | |
194 | 194 | ||
195 | 195 | ||
198 | 198 | func activateManager () = { | |
199 | 199 | let callerAddressString = toBase58String(i.caller.bytes) | |
200 | 200 | let keyPrefix = keyActivateManagerVotePrefix() | |
201 | - | let | |
201 | + | let quorum = 2 | |
202 | 202 | let currentManagerString = getStringValue(keyCurrentManagerPublicKey()) | |
203 | 203 | let result = [StringEntry(keyActiveManagerPublicKey(), currentManagerString)] | |
204 | - | voteINTERNAL(callerAddressString, keyPrefix, | |
204 | + | voteINTERNAL(callerAddressString, keyPrefix, quorum, result) | |
205 | 205 | } | |
206 | 206 | ||
207 | 207 | ||
210 | 210 | func addNewAdmin (newAdminAddress) = { | |
211 | 211 | let callerAddressString = toBase58String(i.caller.bytes) | |
212 | 212 | let keyPrefix = keyAddNewAdminVotePrefix(newAdminAddress) | |
213 | - | let | |
213 | + | let quorum = 2 | |
214 | 214 | let currentAdminList = getAdminsList() | |
215 | 215 | match indexOf(currentAdminList, newAdminAddress) { | |
216 | 216 | case a: Int => | |
218 | 218 | case _ => | |
219 | 219 | let newAdminList = (currentAdminList :+ newAdminAddress) | |
220 | 220 | let result = [StringEntry(keyAdminAddressList(), makeString(newAdminList, SEP))] | |
221 | - | voteINTERNAL(callerAddressString, keyPrefix, | |
221 | + | voteINTERNAL(callerAddressString, keyPrefix, quorum, result) | |
222 | 222 | } | |
223 | 223 | } | |
224 | 224 | ||
228 | 228 | func removeAdmin (removeCandidate) = { | |
229 | 229 | let callerAddressString = toBase58String(i.caller.bytes) | |
230 | 230 | let keyPrefix = keyRemoveAdminVotePrefix(removeCandidate) | |
231 | - | let | |
231 | + | let quorum = 2 | |
232 | 232 | let currentAdminList = getAdminsList() | |
233 | 233 | match indexOf(currentAdminList, removeCandidate) { | |
234 | 234 | case index: Int => | |
235 | 235 | let newAdminList = removeByIndex(currentAdminList, index) | |
236 | 236 | let result = [StringEntry(keyAdminAddressList(), makeString(newAdminList, SEP))] | |
237 | - | voteINTERNAL(callerAddressString, keyPrefix, | |
237 | + | voteINTERNAL(callerAddressString, keyPrefix, quorum, result) | |
238 | 238 | case _ => | |
239 | 239 | throwErr((removeCandidate + " not found in Admin List")) | |
240 | 240 | } | |
246 | 246 | func voteForTxId (txId) = { | |
247 | 247 | let callerAddressString = toBase58String(i.caller.bytes) | |
248 | 248 | let keyPrefix = keyAllowedTxIdVotePrefix(txId) | |
249 | - | let | |
249 | + | let quorum = 2 | |
250 | 250 | let result = [StringEntry(keyAllowedTxId(), txId)] | |
251 | - | voteINTERNAL(callerAddressString, keyPrefix, | |
251 | + | voteINTERNAL(callerAddressString, keyPrefix, quorum, result) | |
252 | 252 | } | |
253 | 253 | ||
254 | 254 | ||
257 | 257 | let allowedTxId = fromBase58String(getStringValue(keyAllowedTxId())) | |
258 | 258 | match tx { | |
259 | 259 | case t: SetScriptTransaction => | |
260 | + | sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
261 | + | case t: DataTransaction => | |
260 | 262 | sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
261 | 263 | case _ => | |
262 | 264 | (tx.id == allowedTxId) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let SEP = "__" | |
5 | 5 | ||
6 | 6 | let contractFilename = "manager_vault.ride" | |
7 | 7 | ||
8 | 8 | func throwErr (s) = throw(((contractFilename + ": ") + s)) | |
9 | 9 | ||
10 | 10 | ||
11 | 11 | func keyActiveManagerPublicKey () = makeString(["%s", "managerPublicKey"], SEP) | |
12 | 12 | ||
13 | 13 | ||
14 | 14 | func keyPendingManagerPublicKey () = makeString(["%s", "pendingManagerPublicKey"], SEP) | |
15 | 15 | ||
16 | 16 | ||
17 | 17 | func keyCurrentManagerPublicKey () = makeString(["%s", "currentManagerPublicKey"], SEP) | |
18 | 18 | ||
19 | 19 | ||
20 | 20 | func keySetNewManagerVotePrefix (managerPublicKey) = makeString(["%s%s%s", "setManager", managerPublicKey], SEP) | |
21 | 21 | ||
22 | 22 | ||
23 | 23 | func keyDeactivateManagerVotePrefix () = makeString(["%s%s", "deactivateManager"], SEP) | |
24 | 24 | ||
25 | 25 | ||
26 | 26 | func keyActivateManagerVotePrefix () = makeString(["%s%s", "activateManager"], SEP) | |
27 | 27 | ||
28 | 28 | ||
29 | 29 | func keyAddNewAdminVotePrefix (adminCandidate) = makeString(["%s%s%s", "addAdmin", adminCandidate], SEP) | |
30 | 30 | ||
31 | 31 | ||
32 | 32 | func keyRemoveAdminVotePrefix (removeCandidate) = makeString(["%s%s%s", "removeAdmin", removeCandidate], SEP) | |
33 | 33 | ||
34 | 34 | ||
35 | 35 | func keyAllowedTxIdVotePrefix (txId) = makeString(["%s%s%s", "allowTxId", txId], SEP) | |
36 | 36 | ||
37 | 37 | ||
38 | 38 | func keyAdminAddressList () = makeString(["%s", "adminAddressList"], SEP) | |
39 | 39 | ||
40 | 40 | ||
41 | 41 | func keyAllowedTxId () = makeString(["%s", "TXID"], SEP) | |
42 | 42 | ||
43 | 43 | ||
44 | 44 | func getAdminVote (prefix,admin) = { | |
45 | 45 | let voteKey = makeString([prefix, admin], SEP) | |
46 | 46 | valueOrElse(getInteger(voteKey), 0) | |
47 | 47 | } | |
48 | 48 | ||
49 | 49 | ||
50 | 50 | func pendingManagerPublicKeyOrUnit () = match getString(keyPendingManagerPublicKey()) { | |
51 | 51 | case s: String => | |
52 | 52 | fromBase58String(s) | |
53 | 53 | case _: Unit => | |
54 | 54 | unit | |
55 | 55 | case _ => | |
56 | 56 | throw("Match error") | |
57 | 57 | } | |
58 | 58 | ||
59 | 59 | ||
60 | 60 | func getAdminsList () = split(valueOrElse(getString(this, keyAdminAddressList()), ""), SEP) | |
61 | 61 | ||
62 | 62 | ||
63 | 63 | func isInAdminList (address) = match indexOf(getAdminsList(), address) { | |
64 | 64 | case t: Int => | |
65 | 65 | true | |
66 | 66 | case _ => | |
67 | 67 | false | |
68 | 68 | } | |
69 | 69 | ||
70 | 70 | ||
71 | 71 | func genVotesKeysHelper (a,adminAddress) = { | |
72 | 72 | let $t020142038 = a | |
73 | 73 | let result = $t020142038._1 | |
74 | 74 | let prefix = $t020142038._2 | |
75 | 75 | $Tuple2((result :+ makeString([prefix, adminAddress], SEP)), prefix) | |
76 | 76 | } | |
77 | 77 | ||
78 | 78 | ||
79 | 79 | func genVotesKeys (keyPrefix) = { | |
80 | 80 | let adminList = keyAdminAddressList() | |
81 | 81 | let $l = getAdminsList() | |
82 | 82 | let $s = size($l) | |
83 | 83 | let $acc0 = $Tuple2(nil, keyPrefix) | |
84 | 84 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
85 | 85 | then $a | |
86 | 86 | else genVotesKeysHelper($a, $l[$i]) | |
87 | 87 | ||
88 | 88 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
89 | 89 | then $a | |
90 | 90 | else throw("List size exceeds 10") | |
91 | 91 | ||
92 | 92 | $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) | |
93 | 93 | } | |
94 | 94 | ||
95 | 95 | ||
96 | 96 | func countVotesHelper (result,voteKey) = (result + valueOrElse(getInteger(voteKey), 0)) | |
97 | 97 | ||
98 | 98 | ||
99 | 99 | func countVotes (prefix) = { | |
100 | 100 | let votes = genVotesKeys(prefix)._1 | |
101 | 101 | let $l = votes | |
102 | 102 | let $s = size($l) | |
103 | 103 | let $acc0 = 0 | |
104 | 104 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
105 | 105 | then $a | |
106 | 106 | else countVotesHelper($a, $l[$i]) | |
107 | 107 | ||
108 | 108 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
109 | 109 | then $a | |
110 | 110 | else throw("List size exceeds 10") | |
111 | 111 | ||
112 | 112 | $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) | |
113 | 113 | } | |
114 | 114 | ||
115 | 115 | ||
116 | 116 | func clearVotesHelper (result,key) = (result :+ DeleteEntry(key)) | |
117 | 117 | ||
118 | 118 | ||
119 | 119 | func getClearVotesEntries (prefix) = { | |
120 | 120 | let votes = genVotesKeys(prefix)._1 | |
121 | 121 | let $l = votes | |
122 | 122 | let $s = size($l) | |
123 | 123 | let $acc0 = nil | |
124 | 124 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
125 | 125 | then $a | |
126 | 126 | else clearVotesHelper($a, $l[$i]) | |
127 | 127 | ||
128 | 128 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
129 | 129 | then $a | |
130 | 130 | else throw("List size exceeds 10") | |
131 | 131 | ||
132 | 132 | $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) | |
133 | 133 | } | |
134 | 134 | ||
135 | 135 | ||
136 | 136 | func voteINTERNAL (callerAddressString,keyPrefix,minVotes,voteResult) = { | |
137 | 137 | let voteKey = makeString([keyPrefix, callerAddressString], SEP) | |
138 | 138 | let adminCurrentVote = getAdminVote(keyPrefix, callerAddressString) | |
139 | 139 | if (isInAdminList(callerAddressString)) | |
140 | 140 | then if ((adminCurrentVote == 1)) | |
141 | 141 | then throwErr((voteKey + " you already voted")) | |
142 | 142 | else { | |
143 | 143 | let votes = countVotes(keyPrefix) | |
144 | 144 | if (((votes + 1) >= minVotes)) | |
145 | 145 | then { | |
146 | 146 | let clearVotesEntries = getClearVotesEntries(keyPrefix) | |
147 | 147 | (clearVotesEntries ++ voteResult) | |
148 | 148 | } | |
149 | 149 | else [IntegerEntry(voteKey, 1)] | |
150 | 150 | } | |
151 | 151 | else throwErr((("Address: " + callerAddressString) + " not in Admin list")) | |
152 | 152 | } | |
153 | 153 | ||
154 | 154 | ||
155 | 155 | @Callable(i) | |
156 | 156 | func confirmManager () = { | |
157 | 157 | let pm = pendingManagerPublicKeyOrUnit() | |
158 | 158 | let hasPM = if (isDefined(pm)) | |
159 | 159 | then true | |
160 | 160 | else throwErr("no pending manager") | |
161 | 161 | if ((hasPM == hasPM)) | |
162 | 162 | then { | |
163 | 163 | let checkPM = if ((i.callerPublicKey == value(pm))) | |
164 | 164 | then true | |
165 | 165 | else throwErr("you are not pending manager") | |
166 | 166 | if ((checkPM == checkPM)) | |
167 | 167 | then [StringEntry(keyCurrentManagerPublicKey(), toBase58String(value(pm)))] | |
168 | 168 | else throw("Strict value is not equal to itself.") | |
169 | 169 | } | |
170 | 170 | else throw("Strict value is not equal to itself.") | |
171 | 171 | } | |
172 | 172 | ||
173 | 173 | ||
174 | 174 | ||
175 | 175 | @Callable(i) | |
176 | 176 | func voteForNewManger (newManagerPublicKey) = { | |
177 | 177 | let callerAddressString = toBase58String(i.caller.bytes) | |
178 | 178 | let keyPrefix = keySetNewManagerVotePrefix(newManagerPublicKey) | |
179 | - | let | |
179 | + | let quorum = 2 | |
180 | 180 | let result = [StringEntry(keyPendingManagerPublicKey(), newManagerPublicKey)] | |
181 | - | voteINTERNAL(callerAddressString, keyPrefix, | |
181 | + | voteINTERNAL(callerAddressString, keyPrefix, quorum, result) | |
182 | 182 | } | |
183 | 183 | ||
184 | 184 | ||
185 | 185 | ||
186 | 186 | @Callable(i) | |
187 | 187 | func deactivateManager () = { | |
188 | 188 | let callerAddressString = toBase58String(i.caller.bytes) | |
189 | 189 | let keyPrefix = keyDeactivateManagerVotePrefix() | |
190 | - | let | |
190 | + | let quorum = 1 | |
191 | 191 | let result = [StringEntry(keyActiveManagerPublicKey(), "disabled")] | |
192 | - | voteINTERNAL(callerAddressString, keyPrefix, | |
192 | + | voteINTERNAL(callerAddressString, keyPrefix, quorum, result) | |
193 | 193 | } | |
194 | 194 | ||
195 | 195 | ||
196 | 196 | ||
197 | 197 | @Callable(i) | |
198 | 198 | func activateManager () = { | |
199 | 199 | let callerAddressString = toBase58String(i.caller.bytes) | |
200 | 200 | let keyPrefix = keyActivateManagerVotePrefix() | |
201 | - | let | |
201 | + | let quorum = 2 | |
202 | 202 | let currentManagerString = getStringValue(keyCurrentManagerPublicKey()) | |
203 | 203 | let result = [StringEntry(keyActiveManagerPublicKey(), currentManagerString)] | |
204 | - | voteINTERNAL(callerAddressString, keyPrefix, | |
204 | + | voteINTERNAL(callerAddressString, keyPrefix, quorum, result) | |
205 | 205 | } | |
206 | 206 | ||
207 | 207 | ||
208 | 208 | ||
209 | 209 | @Callable(i) | |
210 | 210 | func addNewAdmin (newAdminAddress) = { | |
211 | 211 | let callerAddressString = toBase58String(i.caller.bytes) | |
212 | 212 | let keyPrefix = keyAddNewAdminVotePrefix(newAdminAddress) | |
213 | - | let | |
213 | + | let quorum = 2 | |
214 | 214 | let currentAdminList = getAdminsList() | |
215 | 215 | match indexOf(currentAdminList, newAdminAddress) { | |
216 | 216 | case a: Int => | |
217 | 217 | throwErr((newAdminAddress + " already in Admin List")) | |
218 | 218 | case _ => | |
219 | 219 | let newAdminList = (currentAdminList :+ newAdminAddress) | |
220 | 220 | let result = [StringEntry(keyAdminAddressList(), makeString(newAdminList, SEP))] | |
221 | - | voteINTERNAL(callerAddressString, keyPrefix, | |
221 | + | voteINTERNAL(callerAddressString, keyPrefix, quorum, result) | |
222 | 222 | } | |
223 | 223 | } | |
224 | 224 | ||
225 | 225 | ||
226 | 226 | ||
227 | 227 | @Callable(i) | |
228 | 228 | func removeAdmin (removeCandidate) = { | |
229 | 229 | let callerAddressString = toBase58String(i.caller.bytes) | |
230 | 230 | let keyPrefix = keyRemoveAdminVotePrefix(removeCandidate) | |
231 | - | let | |
231 | + | let quorum = 2 | |
232 | 232 | let currentAdminList = getAdminsList() | |
233 | 233 | match indexOf(currentAdminList, removeCandidate) { | |
234 | 234 | case index: Int => | |
235 | 235 | let newAdminList = removeByIndex(currentAdminList, index) | |
236 | 236 | let result = [StringEntry(keyAdminAddressList(), makeString(newAdminList, SEP))] | |
237 | - | voteINTERNAL(callerAddressString, keyPrefix, | |
237 | + | voteINTERNAL(callerAddressString, keyPrefix, quorum, result) | |
238 | 238 | case _ => | |
239 | 239 | throwErr((removeCandidate + " not found in Admin List")) | |
240 | 240 | } | |
241 | 241 | } | |
242 | 242 | ||
243 | 243 | ||
244 | 244 | ||
245 | 245 | @Callable(i) | |
246 | 246 | func voteForTxId (txId) = { | |
247 | 247 | let callerAddressString = toBase58String(i.caller.bytes) | |
248 | 248 | let keyPrefix = keyAllowedTxIdVotePrefix(txId) | |
249 | - | let | |
249 | + | let quorum = 2 | |
250 | 250 | let result = [StringEntry(keyAllowedTxId(), txId)] | |
251 | - | voteINTERNAL(callerAddressString, keyPrefix, | |
251 | + | voteINTERNAL(callerAddressString, keyPrefix, quorum, result) | |
252 | 252 | } | |
253 | 253 | ||
254 | 254 | ||
255 | 255 | @Verifier(tx) | |
256 | 256 | func verify () = { | |
257 | 257 | let allowedTxId = fromBase58String(getStringValue(keyAllowedTxId())) | |
258 | 258 | match tx { | |
259 | 259 | case t: SetScriptTransaction => | |
260 | + | sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
261 | + | case t: DataTransaction => | |
260 | 262 | sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
261 | 263 | case _ => | |
262 | 264 | (tx.id == allowedTxId) | |
263 | 265 | } | |
264 | 266 | } | |
265 | 267 |
github/deemru/w8io/026f985 57.88 ms ◑