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