tx · 9YYT8QXW1hJbw7ZYCQwo98GL2475ot1oVjXLYD6LrrpT

3MpMuGN8rW9EpPwzETAQz88Pe9TQhSwiriq:  -0.01500000 Waves

2023.07.21 15:17 [2675602] smart account 3MpMuGN8rW9EpPwzETAQz88Pe9TQhSwiriq > SELF 0.00000000 Waves

{ "type": 13, "id": "9YYT8QXW1hJbw7ZYCQwo98GL2475ot1oVjXLYD6LrrpT", "fee": 1500000, "feeAssetId": null, "timestamp": 1689941859026, "version": 2, "chainId": 84, "sender": "3MpMuGN8rW9EpPwzETAQz88Pe9TQhSwiriq", "senderPublicKey": "57SkjQUEwC1ayCqLbXLuzBqifK6B6SR6rfxtGsbAo3zW", "proofs": [ "2F7Y5VKdkgdtGdUABC2nBM8pQ6Fi9vuPMZjMjiRkbbt5nqDxD6ZUKUWMmyP4jJKVkjghFW4YtAUas7EGbQjZmYbW" ], "script": "base64:BgIfCAISAwoBARIAEgMKAQgSAwoBARIDCgEIEgASAwoBCC8ADGNvbnRyYWN0RmlsZQIQbXB0X3N0YWtpbmcucmlkZQADU0VQAgJfXwAGc2NhbGU4AIDC1y8AEkFERFJFU1NfQllURVNfU0laRQAaAA1CTE9DS1NfSU5fREFZAKALAQh0aHJvd0VycgEDbXNnCQACAQkArAICCQCsAgIFDGNvbnRyYWN0RmlsZQICOiAFA21zZwAKa2V5QXNzZXRJZAkAuQkCCQDMCAICAiVzCQDMCAICB2Fzc2V0SWQFA25pbAUDU0VQABNrZXlFbWlzc2lvblBlckJsb2NrCQC5CQIJAMwIAgICJXMJAMwIAgIQZW1pc3Npb25QZXJCbG9jawUDbmlsBQNTRVAAGWtleUVtaXNzaW9uUGVyaW9kSW5CbG9ja3MJALkJAgkAzAgCAgIlcwkAzAgCAhZlbWlzc2lvblBlcmlvZEluQmxvY2tzBQNuaWwFA1NFUAANa2V5U3RhcnRCbG9jawkAuQkCCQDMCAICAiVzCQDMCAICCnN0YXJ0QmxvY2sFA25pbAUDU0VQABBrZXlUb3RhbExwQW1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AwkAAAIFA2VycgUDZXJyCQEMdm90ZUlOVEVSTkFMBAUTY2FsbGVyQWRkcmVzc1N0cmluZwUJa2V5UHJlZml4BQZRVU9SVU0FBnJlc3VsdAkAAgECJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgECdHgBBnZlcmlmeQAECGJ5QWRtaW5zCQAAAggFAnR4AmlkCQDZBAEJAQt2YWx1ZU9yRWxzZQIJAJ0IAgUEdGhpcwkBDmtleUFsbG93ZWRUeElkAAIABAdieU93bmVyAwkAZwIJAJADAQkBDWdldEFkbWluc0xpc3QABQZRVU9SVU0HCQD0AwMIBQJ0eAlib2R5Qnl0ZXMJAJEDAggFAnR4BnByb29mcwAACAUCdHgPc2VuZGVyUHVibGljS2V5AwUIYnlBZG1pbnMGBQdieU93bmVyvyEcpw==", "height": 2675602, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 3vNLwKZ7ywkKpGbgqP6yX4tKUizLA3DeWCqEWiiqAirE Next: FFoWS1oHzoqnYQchnxygtgTm36PgxzCFRGYRRswxVRQW Diff:
OldNewDifferences
99
1010 let ADDRESS_BYTES_SIZE = 26
1111
12-let BLOCKS_IN_DAY = 10
12+let BLOCKS_IN_DAY = 1440
1313
1414 func throwErr (msg) = throw(((contractFile + ": ") + msg))
1515
1717 let keyAssetId = makeString(["%s", "assetId"], SEP)
1818
1919 let keyEmissionPerBlock = makeString(["%s", "emissionPerBlock"], SEP)
20+
21+let keyEmissionPeriodInBlocks = makeString(["%s", "emissionPeriodInBlocks"], SEP)
2022
2123 let keyStartBlock = makeString(["%s", "startBlock"], SEP)
2224
4345 then unit
4446 else fromBase58String(assetIdString)
4547
46-let emissionPerDay = (valueOrElse(getInteger(this, keyEmissionPerBlock), 0) * BLOCKS_IN_DAY)
48+let emissionPeriodInBlocks = valueOrElse(getInteger(this, keyEmissionPeriodInBlocks), BLOCKS_IN_DAY)
4749
48-let heightInDays = fraction(height, 1, BLOCKS_IN_DAY)
50+let emissionPerPeriod = (valueOrElse(getInteger(this, keyEmissionPerBlock), 0) * emissionPeriodInBlocks)
51+
52+let heightInDays = fraction(height, 1, emissionPeriodInBlocks)
4953
5054 let ADMIN_LIST_SIZE = 5
5155
8387
8488
8589 func genVotesKeysHelper (a,adminAddress) = {
86- let $t024082432 = a
87- let result = $t024082432._1
88- let prefix = $t024082432._2
90+ let $t026352659 = a
91+ let result = $t026352659._1
92+ let prefix = $t026352659._2
8993 $Tuple2((result :+ keyFullAdminVote(prefix, adminAddress)), prefix)
9094 }
9195
9296
9397 func genVotesKeys (keyPrefix) = {
9498 let adminList = keyAdminAddressList()
95- let $t025792663 = {
99+ let $t028062890 = {
96100 let $l = getAdminsList()
97101 let $s = size($l)
98102 let $acc0 = $Tuple2(nil, keyPrefix)
106110
107111 $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5)
108112 }
109- let result = $t025792663._1
110- let prefix = $t025792663._2
113+ let result = $t028062890._1
114+ let prefix = $t028062890._2
111115 result
112116 }
113117
176180
177181 func calcTotalProfit () = {
178182 let startBlock = valueOrElse(getInteger(this, keyStartBlock), 0)
179- let startDay = fraction(startBlock, 1, BLOCKS_IN_DAY)
183+ let startDay = fraction(startBlock, 1, emissionPeriodInBlocks)
180184 let elapsedDays = (heightInDays - startDay)
181- max([0, (emissionPerDay * elapsedDays)])
185+ max([0, (emissionPerPeriod * elapsedDays)])
182186 }
183187
184188
255259 let userLpAmount = getUserLpAmount(userAddress)
256260 let check = [if ((lpAssetWithdrawAmount > 0))
257261 then true
258- else throwErr("amount should be more than 0"), if ((userLpAmount >= lpAssetWithdrawAmount))
262+ else throwErr("LP amount should be more than 0"), if ((userLpAmount >= lpAssetWithdrawAmount))
259263 then true
260- else throwErr((("cannot withdraw more than available (" + toString(userLpAmount)) + ")"))]
264+ else throwErr((("cannot withdraw more than available LP (" + toString(userLpAmount)) + ")"))]
261265 if ((check == check))
262266 then {
263267 let newUserLpAmount = (userLpAmount - lpAssetWithdrawAmount)
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let contractFile = "mpt_staking.ride"
55
66 let SEP = "__"
77
88 let scale8 = 100000000
99
1010 let ADDRESS_BYTES_SIZE = 26
1111
12-let BLOCKS_IN_DAY = 10
12+let BLOCKS_IN_DAY = 1440
1313
1414 func throwErr (msg) = throw(((contractFile + ": ") + msg))
1515
1616
1717 let keyAssetId = makeString(["%s", "assetId"], SEP)
1818
1919 let keyEmissionPerBlock = makeString(["%s", "emissionPerBlock"], SEP)
20+
21+let keyEmissionPeriodInBlocks = makeString(["%s", "emissionPeriodInBlocks"], SEP)
2022
2123 let keyStartBlock = makeString(["%s", "startBlock"], SEP)
2224
2325 let keyTotalLpAmount = makeString(["%s", "totalLpAmount"], SEP)
2426
2527 let keyTotalAssetAmount = makeString(["%s", "totalAssetAmount"], SEP)
2628
2729 func keyUserLpAmount (userAddress) = makeString(["%s%s", "userLpAmount", userAddress], SEP)
2830
2931
3032 func keyUserTotalAssetWithdrawn (userAddress) = makeString(["%s%s", "totalAssetWithdrawn", userAddress], SEP)
3133
3234
3335 func keyUserTotalAssetStaked (userAddress) = makeString(["%s%s", "totalAssetStaked", userAddress], SEP)
3436
3537
3638 let totalLpAmount = valueOrElse(getInteger(this, keyTotalLpAmount), 0)
3739
3840 let totalAssetAmount = valueOrElse(getInteger(this, keyTotalAssetAmount), 0)
3941
4042 let assetIdString = valueOrElse(getString(this, keyAssetId), "WAVES")
4143
4244 let assetIdBytes = if ((assetIdString == "WAVES"))
4345 then unit
4446 else fromBase58String(assetIdString)
4547
46-let emissionPerDay = (valueOrElse(getInteger(this, keyEmissionPerBlock), 0) * BLOCKS_IN_DAY)
48+let emissionPeriodInBlocks = valueOrElse(getInteger(this, keyEmissionPeriodInBlocks), BLOCKS_IN_DAY)
4749
48-let heightInDays = fraction(height, 1, BLOCKS_IN_DAY)
50+let emissionPerPeriod = (valueOrElse(getInteger(this, keyEmissionPerBlock), 0) * emissionPeriodInBlocks)
51+
52+let heightInDays = fraction(height, 1, emissionPeriodInBlocks)
4953
5054 let ADMIN_LIST_SIZE = 5
5155
5256 let QUORUM = 3
5357
5458 let TXID_BYTES_LENGTH = 32
5559
5660 func keyAllowedTxIdVotePrefix (txId) = makeString(["%s%s%s", "allowTxId", txId], SEP)
5761
5862
5963 func keyFullAdminVote (prefix,adminAddress) = makeString([prefix, adminAddress], SEP)
6064
6165
6266 func keyAdminAddressList () = makeString(["%s", "adminAddressList"], SEP)
6367
6468
6569 func keyAllowedTxId () = makeString(["%s", "txId"], SEP)
6670
6771
6872 func getAdminVote (prefix,admin) = {
6973 let voteKey = keyFullAdminVote(prefix, admin)
7074 valueOrElse(getInteger(voteKey), 0)
7175 }
7276
7377
7478 func getAdminsList () = match getString(this, keyAdminAddressList()) {
7579 case s: String =>
7680 split(s, SEP)
7781 case _ =>
7882 nil
7983 }
8084
8185
8286 func isInAdminList (address) = containsElement(getAdminsList(), address)
8387
8488
8589 func genVotesKeysHelper (a,adminAddress) = {
86- let $t024082432 = a
87- let result = $t024082432._1
88- let prefix = $t024082432._2
90+ let $t026352659 = a
91+ let result = $t026352659._1
92+ let prefix = $t026352659._2
8993 $Tuple2((result :+ keyFullAdminVote(prefix, adminAddress)), prefix)
9094 }
9195
9296
9397 func genVotesKeys (keyPrefix) = {
9498 let adminList = keyAdminAddressList()
95- let $t025792663 = {
99+ let $t028062890 = {
96100 let $l = getAdminsList()
97101 let $s = size($l)
98102 let $acc0 = $Tuple2(nil, keyPrefix)
99103 func $f0_1 ($a,$i) = if (($i >= $s))
100104 then $a
101105 else genVotesKeysHelper($a, $l[$i])
102106
103107 func $f0_2 ($a,$i) = if (($i >= $s))
104108 then $a
105109 else throw("List size exceeds 5")
106110
107111 $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5)
108112 }
109- let result = $t025792663._1
110- let prefix = $t025792663._2
113+ let result = $t028062890._1
114+ let prefix = $t028062890._2
111115 result
112116 }
113117
114118
115119 func countVotesHelper (result,voteKey) = (result + valueOrElse(getInteger(voteKey), 0))
116120
117121
118122 func countVotes (prefix) = {
119123 let votes = genVotesKeys(prefix)
120124 let $l = votes
121125 let $s = size($l)
122126 let $acc0 = 0
123127 func $f0_1 ($a,$i) = if (($i >= $s))
124128 then $a
125129 else countVotesHelper($a, $l[$i])
126130
127131 func $f0_2 ($a,$i) = if (($i >= $s))
128132 then $a
129133 else throw("List size exceeds 5")
130134
131135 $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5)
132136 }
133137
134138
135139 func clearVotesHelper (result,key) = (result :+ DeleteEntry(key))
136140
137141
138142 func getClearVoteEntries (prefix) = {
139143 let votes = genVotesKeys(prefix)
140144 let $l = votes
141145 let $s = size($l)
142146 let $acc0 = nil
143147 func $f0_1 ($a,$i) = if (($i >= $s))
144148 then $a
145149 else clearVotesHelper($a, $l[$i])
146150
147151 func $f0_2 ($a,$i) = if (($i >= $s))
148152 then $a
149153 else throw("List size exceeds 5")
150154
151155 $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5)
152156 }
153157
154158
155159 func voteINTERNAL (callerAddressString,keyPrefix,minVotes,voteResult) = {
156160 let voteKey = keyFullAdminVote(keyPrefix, callerAddressString)
157161 let adminCurrentVote = getAdminVote(keyPrefix, callerAddressString)
158162 let err = if (!(isInAdminList(callerAddressString)))
159163 then throwErr((("Address: " + callerAddressString) + " not in Admin list"))
160164 else if ((adminCurrentVote == 1))
161165 then throwErr((voteKey + " you already voted"))
162166 else unit
163167 if ((err == err))
164168 then {
165169 let votes = countVotes(keyPrefix)
166170 if (((votes + 1) >= minVotes))
167171 then {
168172 let clearVoteEntries = getClearVoteEntries(keyPrefix)
169173 (clearVoteEntries ++ voteResult)
170174 }
171175 else [IntegerEntry(voteKey, 1)]
172176 }
173177 else throw("Strict value is not equal to itself.")
174178 }
175179
176180
177181 func calcTotalProfit () = {
178182 let startBlock = valueOrElse(getInteger(this, keyStartBlock), 0)
179- let startDay = fraction(startBlock, 1, BLOCKS_IN_DAY)
183+ let startDay = fraction(startBlock, 1, emissionPeriodInBlocks)
180184 let elapsedDays = (heightInDays - startDay)
181- max([0, (emissionPerDay * elapsedDays)])
185+ max([0, (emissionPerPeriod * elapsedDays)])
182186 }
183187
184188
185189 func debugDays () = {
186190 let startBlock = valueOrElse(getInteger(this, keyStartBlock), 0)
187191 let startDay = fraction(startBlock, 1, BLOCKS_IN_DAY)
188192 let elapsedDays = (heightInDays - startDay)
189193 $Tuple5(startDay, heightInDays, elapsedDays, startBlock, height)
190194 }
191195
192196
193197 func getTotalAssetAmountWithProfitOrMaxAvailable () = {
194198 let totalAssetAmountWithProfit = (totalAssetAmount + calcTotalProfit())
195199 let totalAmount = match assetIdBytes {
196200 case u: Unit =>
197201 min([totalAssetAmountWithProfit, wavesBalance(this).available])
198202 case b: ByteVector =>
199203 min([totalAssetAmountWithProfit, assetBalance(this, b)])
200204 case _ =>
201205 throw("Match error")
202206 }
203207 if ((totalLpAmount == 0))
204208 then 0
205209 else totalAmount
206210 }
207211
208212
209213 func getCurrentPrice () = if ((totalLpAmount != 0))
210214 then fraction(getTotalAssetAmountWithProfitOrMaxAvailable(), scale8, totalLpAmount)
211215 else (1 * scale8)
212216
213217
214218 func getUserLpAmount (userAddress) = valueOrElse(getInteger(this, keyUserLpAmount(userAddress)), 0)
215219
216220
217221 func getUserAvailableAssetsToWithdraw (userAddress) = {
218222 let userLpAmount = getUserLpAmount(userAddress)
219223 let userAvailableAssetToWithdraw = fraction(userLpAmount, getCurrentPrice(), scale8)
220224 if ((getCurrentPrice() > (userAvailableAssetToWithdraw * scale8)))
221225 then 0
222226 else userAvailableAssetToWithdraw
223227 }
224228
225229
226230 func getStakeActions (i,userAddress) = {
227231 let checks = [if ((size(i.payments) == 1))
228232 then true
229233 else throwErr("should include 1 payment"), if ((i.payments[0].assetId == assetIdBytes))
230234 then true
231235 else throwErr(("payment should be in " + assetIdString)), if ((i.payments[0].amount > 0))
232236 then true
233237 else "payment amount should be greater than 0"]
234238 if ((checks == checks))
235239 then {
236240 let paymentAmount = i.payments[0].amount
237241 let paymentLpAmount = fraction(paymentAmount, scale8, getCurrentPrice())
238242 let userLpAmount = getUserLpAmount(userAddress)
239243 let userTotalStakedAmount = valueOrElse(getInteger(this, keyUserTotalAssetStaked(userAddress)), 0)
240244 let newTotalLpAmount = (totalLpAmount + paymentLpAmount)
241245 let newTotalAssetAmount = (totalAssetAmount + paymentAmount)
242246 let newUserLpAmount = (userLpAmount + paymentLpAmount)
243247 let newUserTotalStakedAmount = (userTotalStakedAmount + paymentAmount)
244248 let updateStartHeightAction = if ((totalLpAmount == 0))
245249 then [IntegerEntry(keyStartBlock, height)]
246250 else nil
247251 ([IntegerEntry(keyTotalLpAmount, newTotalLpAmount), IntegerEntry(keyTotalAssetAmount, newTotalAssetAmount), IntegerEntry(keyUserLpAmount(userAddress), newUserLpAmount), IntegerEntry(keyUserTotalAssetStaked(userAddress), newUserTotalStakedAmount)] ++ updateStartHeightAction)
248252 }
249253 else throw("Strict value is not equal to itself.")
250254 }
251255
252256
253257 func getWithdrawActions (i,lpAssetWithdrawAmount) = {
254258 let userAddress = toString(i.caller)
255259 let userLpAmount = getUserLpAmount(userAddress)
256260 let check = [if ((lpAssetWithdrawAmount > 0))
257261 then true
258- else throwErr("amount should be more than 0"), if ((userLpAmount >= lpAssetWithdrawAmount))
262+ else throwErr("LP amount should be more than 0"), if ((userLpAmount >= lpAssetWithdrawAmount))
259263 then true
260- else throwErr((("cannot withdraw more than available (" + toString(userLpAmount)) + ")"))]
264+ else throwErr((("cannot withdraw more than available LP (" + toString(userLpAmount)) + ")"))]
261265 if ((check == check))
262266 then {
263267 let newUserLpAmount = (userLpAmount - lpAssetWithdrawAmount)
264268 let withdrawAssetAmount = fraction(lpAssetWithdrawAmount, getCurrentPrice(), scale8)
265269 let newTotalLpAmount = (totalLpAmount - lpAssetWithdrawAmount)
266270 let newTotalAssetAmount = fraction(newTotalLpAmount, getCurrentPrice(), scale8)
267271 let userTotalAssetWithdrawn = valueOrElse(getInteger(this, keyUserTotalAssetWithdrawn(userAddress)), 0)
268272 let newUserTotalAssetWithdrawn = (userTotalAssetWithdrawn + withdrawAssetAmount)
269273 [IntegerEntry(keyTotalLpAmount, newTotalLpAmount), IntegerEntry(keyTotalAssetAmount, newTotalAssetAmount), IntegerEntry(keyUserLpAmount(userAddress), newUserLpAmount), IntegerEntry(keyUserTotalAssetWithdrawn(userAddress), newUserTotalAssetWithdrawn), IntegerEntry(keyStartBlock, height), ScriptTransfer(i.caller, withdrawAssetAmount, assetIdBytes)]
270274 }
271275 else throw("Strict value is not equal to itself.")
272276 }
273277
274278
275279 @Callable(i)
276280 func setEmissionPerBlock (emissionPerBlock) = {
277281 let check = [if ((i.caller == this))
278282 then true
279283 else throwErr("permission denied")]
280284 if ((check == check))
281285 then [IntegerEntry(keyTotalAssetAmount, getTotalAssetAmountWithProfitOrMaxAvailable()), IntegerEntry(keyStartBlock, height), IntegerEntry(keyEmissionPerBlock, max([0, emissionPerBlock]))]
282286 else throw("Strict value is not equal to itself.")
283287 }
284288
285289
286290
287291 @Callable(i)
288292 func stake () = getStakeActions(i, toString(i.caller))
289293
290294
291295
292296 @Callable(i)
293297 func stakeFor (userAddress) = {
294298 let check = [if ((size(fromBase58String(userAddress)) == ADDRESS_BYTES_SIZE))
295299 then true
296300 else throwErr("address is not valid")]
297301 if ((check == check))
298302 then getStakeActions(i, userAddress)
299303 else throw("Strict value is not equal to itself.")
300304 }
301305
302306
303307
304308 @Callable(i)
305309 func withdraw (withdrawAssetAmount) = {
306310 let userAddress = toString(i.caller)
307311 let userLpAmount = getUserLpAmount(userAddress)
308312 let lpAmountToWithdraw = fraction(withdrawAssetAmount, scale8, getCurrentPrice())
309313 let userAvailableAssetToWithdraw = getUserAvailableAssetsToWithdraw(userAddress)
310314 let check = [if ((withdrawAssetAmount > 0))
311315 then true
312316 else throwErr("withdraw amount should be more than 0"), if ((userAvailableAssetToWithdraw >= withdrawAssetAmount))
313317 then true
314318 else throwErr((("cannot withdraw more than available (" + toString(userAvailableAssetToWithdraw)) + ")"))]
315319 if ((check == check))
316320 then getWithdrawActions(i, lpAmountToWithdraw)
317321 else throw("Strict value is not equal to itself.")
318322 }
319323
320324
321325
322326 @Callable(i)
323327 func getUserAssetsREADONLY (userAddress) = {
324328 let userLpAmount = getUserLpAmount(userAddress)
325329 let userAvailableAssetToWithdraw = getUserAvailableAssetsToWithdraw(userAddress)
326330 let userTotalStakedAmount = valueOrElse(getInteger(this, keyUserTotalAssetStaked(userAddress)), 0)
327331 let userTotalAssetWithdrawn = valueOrElse(getInteger(this, keyUserTotalAssetWithdrawn(userAddress)), 0)
328332 $Tuple2(nil, $Tuple5(userLpAmount, userAvailableAssetToWithdraw, getCurrentPrice(), userTotalStakedAmount, userTotalAssetWithdrawn))
329333 }
330334
331335
332336
333337 @Callable(i)
334338 func getTotalAssetsREADONLY () = $Tuple2(nil, $Tuple3(totalLpAmount, getTotalAssetAmountWithProfitOrMaxAvailable(), getCurrentPrice()))
335339
336340
337341
338342 @Callable(i)
339343 func voteForTxId (txId) = {
340344 let callerAddressString = toBase58String(i.caller.bytes)
341345 let keyPrefix = keyAllowedTxIdVotePrefix(txId)
342346 let result = [StringEntry(keyAllowedTxId(), txId)]
343347 let allowedTxIdOption = getString(this, keyAllowedTxId())
344348 let err = [if ((size(fromBase58String(txId)) == TXID_BYTES_LENGTH))
345349 then true
346350 else throwErr((txId + " is not valid txId")), if (if ((allowedTxIdOption == unit))
347351 then true
348352 else (value(allowedTxIdOption) != txId))
349353 then true
350354 else throwErr((txId + " is already allowed"))]
351355 if ((err == err))
352356 then voteINTERNAL(callerAddressString, keyPrefix, QUORUM, result)
353357 else throw("Strict value is not equal to itself.")
354358 }
355359
356360
357361 @Verifier(tx)
358362 func verify () = {
359363 let byAdmins = (tx.id == fromBase58String(valueOrElse(getString(this, keyAllowedTxId()), "")))
360364 let byOwner = if ((size(getAdminsList()) >= QUORUM))
361365 then false
362366 else sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
363367 if (byAdmins)
364368 then true
365369 else byOwner
366370 }
367371

github/deemru/w8io/026f985 
60.20 ms