tx · 91YTspwf5m6NRyGGsdJj2rmiHdHEY44zmoxDSr9sWL5f

3MuS6qVvhBR6wSynFRdcE3fVqmGBjoc7Hhx:  -0.00500000 Waves

2023.08.18 10:23 [2715738] smart account 3MuS6qVvhBR6wSynFRdcE3fVqmGBjoc7Hhx > SELF 0.00000000 Waves

{ "type": 13, "id": "91YTspwf5m6NRyGGsdJj2rmiHdHEY44zmoxDSr9sWL5f", "fee": 500000, "feeAssetId": null, "timestamp": 1692343420903, "version": 1, "sender": "3MuS6qVvhBR6wSynFRdcE3fVqmGBjoc7Hhx", "senderPublicKey": "62CHk4MqTdq3LqeUycy7TPnpvwrjgerSa2FqAY2EafXn", "proofs": [ "4tsV7AfUn5RttbvbJkNKpker34wVPBvvgAHvHJwRWR9h1D1xNKJPn4mdqd4368VS8UjfqyourXedJ2nHFdCwJKMA" ], "script": "base64:BgIKCAISBAoCCAESAAEBBHRlc3QABARsaXN0CQDMCAIJAJQKAgIBYQAACQDMCAIJAJQKAgIBYgABCQDMCAIJAJQKAgIBYwACBQNuaWwKAQNiYXICA2FjYwRuZXh0BAkkdDAxOTEyMDgFBG5leHQEAWEIBQkkdDAxOTEyMDgCXzEEAWIIBQkkdDAxOTEyMDgCXzIEAWMJAPwHBAUEdGhpcwIDZm9vCQDMCAIFAWEJAMwIAgUBYgUDbmlsBQNuaWwDCQAAAgUBYwUBYwAACQACAQIkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuCgACJGwFBGxpc3QKAAIkcwkAkAMBBQIkbAoABSRhY2MwAAAKAQUkZjBfMQICJGECJGkDCQBnAgUCJGkFAiRzBQIkYQkBA2JhcgIFAiRhCQCRAwIFAiRsBQIkaQoBBSRmMF8yAgIkYQIkaQMJAGcCBQIkaQUCJHMFAiRhCQACAQIUTGlzdCBzaXplIGV4Y2VlZHMgMTAJAQUkZjBfMgIJAQUkZjBfMQIJAQUkZjBfMQIJAQUkZjBfMQIJAQUkZjBfMQIJAQUkZjBfMQIJAQUkZjBfMQIJAQUkZjBfMQIJAQUkZjBfMQIJAQUkZjBfMQIJAQUkZjBfMQIFBSRhY2MwAAAAAQACAAMABAAFAAYABwAIAAkACgIBaQEDZm9vAgFhAWIJAMwIAgkBDEludGVnZXJFbnRyeQIFAWEFAWIFA25pbAFpAQFhAAQBYQkBBHRlc3QAAwkAAAIFAWEFAWEFA25pbAkAAgECJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgARkt5a", "chainId": 84, "height": 2715738, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: FmtVFbr79GPrefoRWByCjQuLwHJcYBFS7XZ5CRFnbJij Next: DygbdmnjtaS9cYUyP4yqdooK3Fs8n1uQmZwsXh2EyByL Full:
OldNewDifferences
1-{-# STDLIB_VERSION 7 #-}
1+{-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
4-let SEP = "__"
4+func test () = {
5+ let list = [$Tuple2("a", 0), $Tuple2("b", 1), $Tuple2("c", 2)]
6+ func bar (acc,next) = {
7+ let $t0191208 = next
8+ let a = $t0191208._1
9+ let b = $t0191208._2
10+ let c = invoke(this, "foo", [a, b], nil)
11+ if ((c == c))
12+ then 0
13+ else throw("Strict value is not equal to itself.")
14+ }
515
6-let WAVES = "WAVES"
7-
8-let contractFilename = "factory.ride"
9-
10-func wrapErr (s) = ((contractFilename + ": ") + s)
11-
12-
13-func throwErr (s) = throw(wrapErr(s))
14-
15-
16-func stringToAssetId (s) = if ((s == WAVES))
17- then unit
18- else fromBase58String(s)
19-
20-
21-let ADMIN_LIST_SIZE = 5
22-
23-let QUORUM = 3
24-
25-let TXID_BYTES_LENGTH = 32
26-
27-func keyAllowedTxIdVotePrefix (txId) = makeString(["%s%s%s", "allowTxId", txId], SEP)
28-
29-
30-func keyFullAdminVote (prefix,adminAddress) = makeString([prefix, adminAddress], SEP)
31-
32-
33-func keyAdminAddressList () = makeString(["%s", "adminAddressList"], SEP)
34-
35-
36-func keyAllowedTxId () = makeString(["%s", "txId"], SEP)
37-
38-
39-func getAdminVote (prefix,admin) = {
40- let voteKey = keyFullAdminVote(prefix, admin)
41- valueOrElse(getInteger(voteKey), 0)
42- }
43-
44-
45-func getAdminsList () = match getString(this, keyAdminAddressList()) {
46- case s: String =>
47- split(s, SEP)
48- case _ =>
49- nil
50-}
51-
52-
53-func isInAdminList (address) = containsElement(getAdminsList(), address)
54-
55-
56-func genVotesKeysHelper (a,adminAddress) = {
57- let $t013751399 = a
58- let result = $t013751399._1
59- let prefix = $t013751399._2
60- $Tuple2((result :+ keyFullAdminVote(prefix, adminAddress)), prefix)
61- }
62-
63-
64-func genVotesKeys (keyPrefix) = {
65- let adminList = keyAdminAddressList()
66- let $t015461630 = {
67- let $l = getAdminsList()
68- let $s = size($l)
69- let $acc0 = $Tuple2(nil, keyPrefix)
70- func $f0_1 ($a,$i) = if (($i >= $s))
71- then $a
72- else genVotesKeysHelper($a, $l[$i])
73-
74- func $f0_2 ($a,$i) = if (($i >= $s))
75- then $a
76- else throw("List size exceeds 5")
77-
78- $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5)
79- }
80- let result = $t015461630._1
81- let prefix = $t015461630._2
82- result
83- }
84-
85-
86-func countVotesHelper (result,voteKey) = (result + valueOrElse(getInteger(voteKey), 0))
87-
88-
89-func countVotes (prefix) = {
90- let votes = genVotesKeys(prefix)
91- let $l = votes
16+ let $l = list
9217 let $s = size($l)
9318 let $acc0 = 0
9419 func $f0_1 ($a,$i) = if (($i >= $s))
9520 then $a
96- else countVotesHelper($a, $l[$i])
21+ else bar($a, $l[$i])
9722
9823 func $f0_2 ($a,$i) = if (($i >= $s))
9924 then $a
100- else throw("List size exceeds 5")
25+ else throw("List size exceeds 10")
10126
102- $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5)
27+ $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)
10328 }
10429
10530
106-func clearVotesHelper (result,key) = (result :+ DeleteEntry(key))
107-
108-
109-func getClearVoteEntries (prefix) = {
110- let votes = genVotesKeys(prefix)
111- let $l = votes
112- let $s = size($l)
113- let $acc0 = nil
114- func $f0_1 ($a,$i) = if (($i >= $s))
115- then $a
116- else clearVotesHelper($a, $l[$i])
117-
118- func $f0_2 ($a,$i) = if (($i >= $s))
119- then $a
120- else throw("List size exceeds 5")
121-
122- $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5)
123- }
124-
125-
126-func voteINTERNAL (callerAddressString,keyPrefix,minVotes,voteResult) = {
127- let voteKey = keyFullAdminVote(keyPrefix, callerAddressString)
128- let adminCurrentVote = getAdminVote(keyPrefix, callerAddressString)
129- let err = if (!(isInAdminList(callerAddressString)))
130- then throwErr((("Address: " + callerAddressString) + " not in Admin list"))
131- else if ((adminCurrentVote == 1))
132- then throwErr((voteKey + " you already voted"))
133- else unit
134- if ((err == err))
135- then {
136- let votes = countVotes(keyPrefix)
137- if (((votes + 1) >= minVotes))
138- then {
139- let clearVoteEntries = getClearVoteEntries(keyPrefix)
140- (clearVoteEntries ++ voteResult)
141- }
142- else [IntegerEntry(voteKey, 1)]
143- }
144- else throw("Strict value is not equal to itself.")
145- }
146-
147-
148-func keyCalculatorAddress () = "%s__calculator"
149-
150-
151-func keyProxyTreasuryAddress () = "%s__proxyTreasury"
152-
153-
154-func keyChildAddress () = "%s__child"
155-
156-
157-func keyBlockProcessingReward () = "%s__blockProcessingReward"
158-
159-
160-func keyNextBlockToProcess () = "%s__nextBlockToProcess"
161-
162-
163-func keyLpAssetId () = "%s__lpAssetId"
164-
165-
166-let calculatorAddressOption = match getString(this, keyCalculatorAddress()) {
167- case s: String =>
168- addressFromString(s)
169- case _: Unit =>
170- unit
171- case _ =>
172- throw("Match error")
173-}
174-
175-let calculatorAddressOrFail = valueOrErrorMessage(calculatorAddressOption, wrapErr("invalid calculator address"))
176-
177-let proxyTreasuryAddressOption = match getString(this, keyProxyTreasuryAddress()) {
178- case s: String =>
179- addressFromString(s)
180- case _: Unit =>
181- unit
182- case _ =>
183- throw("Match error")
184-}
185-
186-let proxyTreasuryAddressOrFail = valueOrErrorMessage(proxyTreasuryAddressOption, wrapErr("invalid proxy treasury address"))
187-
188-func keyConfigAddress () = "%s__config"
189-
190-
191-func keyChildrenAddress () = "contract_children"
192-
193-
194-func keyVotingResultAddress () = "contract_voting_result"
195-
196-
197-func keyProposalAllowBroadcast (address,txId) = ((("proposal_allow_broadcast_" + toString(address)) + "_") + toBase58String(txId))
198-
199-
200-func keyInvestedByUser (childAddress,userAddress) = makeString(["investor", toString(childAddress), toString(userAddress)], "_")
201-
202-
203-let configAddressOption = match getString(this, keyConfigAddress()) {
204- case s: String =>
205- addressFromString(s)
206- case _: Unit =>
207- unit
208- case _ =>
209- throw("Match error")
210-}
211-
212-let configAddressOrFail = valueOrErrorMessage(configAddressOption, wrapErr("invalid config address"))
213-
214-let votingResultAddressOption = match configAddressOption {
215- case a: Address =>
216- match getString(a, keyVotingResultAddress()) {
217- case s: String =>
218- addressFromString(s)
219- case _: Unit =>
220- unit
221- case _ =>
222- throw("Match error")
223- }
224- case _: Unit =>
225- unit
226- case _ =>
227- throw("Match error")
228-}
229-
230-let votingResultAddressOrFail = valueOrErrorMessage(votingResultAddressOption, wrapErr("invalid voting result address"))
231-
232-let childrenAddressOption = match configAddressOption {
233- case a: Address =>
234- match getString(a, keyChildrenAddress()) {
235- case s: String =>
236- addressFromString(s)
237- case _: Unit =>
238- unit
239- case _ =>
240- throw("Match error")
241- }
242- case _: Unit =>
243- unit
244- case _ =>
245- throw("Match error")
246-}
247-
248-let childrenAddressOrFail = valueOrErrorMessage(childrenAddressOption, wrapErr("invalid children address"))
249-
250-let lpAssetIdOption = match getString(this, keyLpAssetId()) {
251- case s: String =>
252- fromBase58String(s)
253- case _: Unit =>
254- unit
255- case _ =>
256- throw("Match error")
257-}
258-
259-let lpAssetIdOrFail = valueOrErrorMessage(lpAssetIdOption, wrapErr("invalid lpAssetId"))
260-
261-func onlyAddress (i,address) = if ((i.caller == address))
262- then true
263- else throwErr("permission denied")
264-
265-
266-func onlyThis (i) = onlyAddress(i, this)
267-
268-
269-func onlyCalculator (i) = onlyAddress(i, calculatorAddressOrFail)
270-
271-
27231 @Callable(i)
273-func stringEntry (key,val) = if (onlyCalculator(i))
274- then $Tuple2([StringEntry(key, val)], key)
275- else $Tuple2(nil, unit)
32+func foo (a,b) = [IntegerEntry(a, b)]
27633
27734
27835
27936 @Callable(i)
280-func integerEntry (key,val) = if (onlyCalculator(i))
281- then $Tuple2([IntegerEntry(key, val)], key)
282- else $Tuple2(nil, unit)
283-
284-
285-
286-@Callable(i)
287-func booleanEntry (key,val) = if (onlyCalculator(i))
288- then $Tuple2([BooleanEntry(key, val)], key)
289- else $Tuple2(nil, unit)
290-
291-
292-
293-@Callable(i)
294-func binaryEntry (key,val) = if (onlyCalculator(i))
295- then $Tuple2([BinaryEntry(key, val)], key)
296- else $Tuple2(nil, unit)
297-
298-
299-
300-@Callable(i)
301-func deleteEntry (key) = if (onlyCalculator(i))
302- then $Tuple2([DeleteEntry(key)], key)
303- else $Tuple2(nil, unit)
304-
305-
306-
307-@Callable(i)
308-func reissue (amount) = if (onlyCalculator(i))
309- then $Tuple2([Reissue(lpAssetIdOrFail, amount, true)], amount)
310- else $Tuple2(nil, unit)
311-
312-
313-
314-@Callable(i)
315-func burn (amount) = if (onlyCalculator(i))
316- then $Tuple2([Burn(lpAssetIdOrFail, amount)], amount)
317- else $Tuple2(nil, unit)
318-
319-
320-
321-@Callable(i)
322-func transferAsset (recepientBytes,amount,assetId) = if (onlyCalculator(i))
323- then $Tuple2([ScriptTransfer(Address(recepientBytes), amount, assetId)], amount)
324- else $Tuple2(nil, unit)
325-
326-
327-
328-@Callable(i)
329-func transferAssets (recepientBytes,assetsList,amountsList) = if (onlyCalculator(i))
330- then {
331- func addNewTransfer (accum,nextAssetId) = {
332- let $t074577483 = accum
333- let transfers = $t074577483._1
334- let j = $t074577483._2
335- let newTransfer = ScriptTransfer(Address(recepientBytes), parseIntValue(amountsList[j]), stringToAssetId(assetsList[j]))
336- let updatedTransfers = (transfers :+ newTransfer)
337- $Tuple2(updatedTransfers, (j + 1))
338- }
339-
340- let $t077437824 = {
341- let $l = assetsList
342- let $s = size($l)
343- let $acc0 = $Tuple2(nil, 0)
344- func $f0_1 ($a,$i) = if (($i >= $s))
345- then $a
346- else addNewTransfer($a, $l[$i])
347-
348- func $f0_2 ($a,$i) = if (($i >= $s))
349- then $a
350- else throw("List size exceeds 10")
351-
352- $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)
353- }
354- let assetsTransfers = $t077437824._1
355- let _lastIndex = $t077437824._2
356- $Tuple2(assetsTransfers, unit)
357- }
358- else $Tuple2(nil, unit)
359-
360-
361-
362-@Callable(i)
363-func transferWaves (recepientBytes,amount) = if (onlyCalculator(i))
364- then $Tuple2([ScriptTransfer(Address(recepientBytes), amount, unit)], amount)
365- else $Tuple2(nil, unit)
366-
367-
368-
369-@Callable(i)
370-func transferFromProxyTreasury (recipientBytes,rewardsAmount) = if (onlyCalculator(i))
371- then $Tuple2(nil, invoke(proxyTreasuryAddressOrFail, "transferWaves", [recipientBytes, rewardsAmount], nil))
372- else $Tuple2(nil, unit)
373-
374-
375-
376-@Callable(i)
377-func finalize (newTreasuryVolumeInWaves,pwrManagersBonusInWaves,treasuryVolumeDiffAllocationCoef) = $Tuple2(nil, reentrantInvoke(calculatorAddressOrFail, "finalize", [i.caller.bytes, newTreasuryVolumeInWaves, pwrManagersBonusInWaves, treasuryVolumeDiffAllocationCoef], i.payments))
378-
379-
380-
381-@Callable(i)
382-func finalizeREADONLY (newTreasuryVolumeInWaves,pwrManagersBonusInWaves,treasuryVolumeDiffAllocationCoef) = $Tuple2(nil, reentrantInvoke(calculatorAddressOrFail, "finalizeREADONLY", [newTreasuryVolumeInWaves, pwrManagersBonusInWaves, treasuryVolumeDiffAllocationCoef], nil))
383-
384-
385-
386-@Callable(i)
387-func claimLP () = $Tuple2(nil, reentrantInvoke(calculatorAddressOrFail, "claimLP", [i.caller.bytes], i.payments))
388-
389-
390-
391-@Callable(i)
392-func claimCollateral (txIdStr) = $Tuple2(nil, reentrantInvoke(calculatorAddressOrFail, "claimCollateral", [i.caller.bytes, txIdStr], i.payments))
393-
394-
395-
396-@Callable(i)
397-func claimCollateralBulk (txIds) = $Tuple2(nil, reentrantInvoke(calculatorAddressOrFail, "claimCollateralBulk", [i.caller.bytes, txIds], i.payments))
398-
399-
400-
401-@Callable(i)
402-func invest () = $Tuple2(nil, reentrantInvoke(calculatorAddressOrFail, "invest", [i.caller.bytes], i.payments))
403-
404-
405-
406-@Callable(i)
407-func withdraw () = $Tuple2(nil, reentrantInvoke(calculatorAddressOrFail, "withdraw", [i.caller.bytes], i.payments))
408-
409-
410-
411-@Callable(i)
412-func cancelWithdraw (txIdStr) = $Tuple2(nil, reentrantInvoke(calculatorAddressOrFail, "cancelWithdraw", [i.caller.bytes, fromBase58String(txIdStr)], i.payments))
413-
414-
415-
416-@Callable(i)
417-func processBlocks () = $Tuple2(nil, reentrantInvoke(calculatorAddressOrFail, "processBlocks", [i.caller.bytes], i.payments))
418-
419-
420-
421-@Callable(i)
422-func claimCollateralREADONLY (userAddress,txIdStr) = $Tuple2(nil, reentrantInvoke(calculatorAddressOrFail, "claimCollateralREADONLY", [fromBase58String(userAddress), txIdStr], nil))
423-
424-
425-
426-@Callable(i)
427-func claimCollateralBulkREADONLY (userAddress,txIds) = $Tuple2(nil, reentrantInvoke(calculatorAddressOrFail, "claimCollateralBulkREADONLY", [fromBase58String(userAddress), txIds], nil))
428-
429-
430-
431-@Callable(i)
432-func voteForTxId (txId) = {
433- let callerAddressString = toBase58String(i.caller.bytes)
434- let keyPrefix = keyAllowedTxIdVotePrefix(txId)
435- let result = [StringEntry(keyAllowedTxId(), txId)]
436- let allowedTxIdOption = getString(this, keyAllowedTxId())
437- let err = [if ((size(fromBase58String(txId)) == TXID_BYTES_LENGTH))
438- then true
439- else throwErr((txId + " is not valid txId")), if (if ((allowedTxIdOption == unit))
440- then true
441- else (value(allowedTxIdOption) != txId))
442- then true
443- else throwErr((txId + " is already allowed"))]
444- if ((err == err))
445- then voteINTERNAL(callerAddressString, keyPrefix, QUORUM, result)
37+func a () = {
38+ let a = test()
39+ if ((a == a))
40+ then nil
44641 else throw("Strict value is not equal to itself.")
44742 }
44843
449-
450-@Verifier(tx)
451-func verify () = {
452- let byProposal = match votingResultAddressOption {
453- case proposalAddress: Address =>
454- valueOrElse(getBoolean(proposalAddress, keyProposalAllowBroadcast(this, tx.id)), false)
455- case _ =>
456- false
457- }
458- let byAdmins = (tx.id == fromBase58String(valueOrElse(getString(this, keyAllowedTxId()), "")))
459- let byOwner = if ((size(getAdminsList()) >= QUORUM))
460- then false
461- else sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
462- if (if (byProposal)
463- then true
464- else byAdmins)
465- then true
466- else byOwner
467- }
46844

github/deemru/w8io/026f985 
62.40 ms