tx · 4RVQyaykC1p69SkvskeQPMW3Adudx1kM9scsdxQG6XsU

3N4ziXSMRverXyxHDUKKMR9MHXnB3TyU3Yh:  -0.01000000 Waves

2023.04.18 13:58 [2539897] smart account 3N4ziXSMRverXyxHDUKKMR9MHXnB3TyU3Yh > SELF 0.00000000 Waves

{ "type": 13, "id": "4RVQyaykC1p69SkvskeQPMW3Adudx1kM9scsdxQG6XsU", "fee": 1000000, "feeAssetId": null, "timestamp": 1681815552871, "version": 2, "chainId": 84, "sender": "3N4ziXSMRverXyxHDUKKMR9MHXnB3TyU3Yh", "senderPublicKey": "EU9obW1yVhR8qug3EmXPeew3DMagvJFQzY5Ku8bmcsU7", "proofs": [ "4QtapKp3djCZuF3tUsW6D1CFSRaWo38nhoA2ELUgfpCH9UHBQbsngLXbYnJsgU5JDcV4tMxVvbvPGYryn3JbiNNm" ], "script": "base64:BgIHCAISAwoBCA4AA1NFUAICX18AEGNvbnRyYWN0RmlsZW5hbWUCCXRlc3QucmlkZQEIdGhyb3dFcnIBAXMJAAIBCQCsAgIJAKwCAgUQY29udHJhY3RGaWxlbmFtZQICOiAFAXMBGWtleUFjdGl2ZU1hbmFnZXJQdWJsaWNLZXkACQC5CQIJAMwIAgICJXMJAMwIAgIQbWFuYWdlclB1YmxpY0tleQUDbmlsBQNTRVABGmtleUN1cnJlbnRNYW5hZ2VyUHVibGljS2V5AAkAuQkCCQDMCAICAiVzCQDMCAICEWtleUN1cnJlbnRNYW5hZ2VyBQNuaWwFA1NFUAEaa2V5UGVuZGluZ01hbmFnZXJQdWJsaWNLZXkACQC5CQIJAMwIAgICJXMJAMwIAgIXcGVuZGluZ01hbmFnZXJQdWJsaWNLZXkFA25pbAUDU0VQARprZXlTZXROZXdNYW5hZ2VyVm90ZVByZWZpeAEQbWFuYWdlclB1YmxpY0tleQkAuQkCCQDMCAICBiVzJXMlcwkAzAgCAgpzZXRNYW5hZ2VyCQDMCAIFEG1hbmFnZXJQdWJsaWNLZXkFA25pbAUDU0VQ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RpAwkAZwIFAiRpBQIkcwUCJGEJARJnZW5Wb3Rlc0tleXNIZWxwZXICBQIkYQkAkQMCBQIkbAUCJGkKAQUkZjBfMgICJGECJGkDCQBnAgUCJGkFAiRzBQIkYQkAAgECFExpc3Qgc2l6ZSBleGNlZWRzIDEwCQEFJGYwXzICCQEFJGYwXzECCQEFJGYwXzECCQEFJGYwXzECCQEFJGYwXzECCQEFJGYwXzECCQEFJGYwXzECCQEFJGYwXzECCQEFJGYwXzECCQEFJGYwXzECCQEFJGYwXzECBQUkYWNjMAAAAAEAAgADAAQABQAGAAcACAAJAAoBAWkBEHZvdGVGb3JOZXdNYW5nZXIBE25ld01hbmFnZXJQdWJsaWNLZXkEE2NhbGxlckFkZHJlc3NTdHJpbmcJANgEAQgIBQFpBmNhbGxlcgVieXRlcwMJAQ1pc0luQWRtaW5MaXN0AQUTY2FsbGVyQWRkcmVzc1N0cmluZwUDbmlsCQEIdGhyb3dFcnIBCQCsAgIFE2NhbGxlckFkZHJlc3NTdHJpbmcCEzogbm90IGluIEFkbWluIGxpc3QA7n1YGQ==", "height": 2539897, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 9282MN2U9tmBZha3kQ8RnJYBMS5k2GyDrivU8tRS34u8 Next: FnsZGczRfLRYUpQ5Pg9zjdd3JC9GNCVjWVP6Uq8Nk1b Diff:
OldNewDifferences
55
66 let contractFilename = "test.ride"
77
8-func keyPublicKeyList () = makeString(["%s", "multisigPublicKeyList"], SEP)
9-
10-
118 func throwErr (s) = throw(((contractFilename + ": ") + s))
129
1310
14-func pubKeyStringToBytes (result,pubKeyString) = (result :+ fromBase58String(pubKeyString))
11+func keyActiveManagerPublicKey () = makeString(["%s", "managerPublicKey"], SEP)
1512
1613
17-func getMultisigPubKeysList () = {
18- let rawMultisigPubKeys = valueOrElse(getString(this, keyPublicKeyList()), "")
19- split(rawMultisigPubKeys, SEP)
14+func keyCurrentManagerPublicKey () = makeString(["%s", "keyCurrentManager"], SEP)
15+
16+
17+func keyPendingManagerPublicKey () = makeString(["%s", "pendingManagerPublicKey"], SEP)
18+
19+
20+func keySetNewManagerVotePrefix (managerPublicKey) = makeString(["%s%s%s", "setManager", managerPublicKey], SEP)
21+
22+
23+func keySetNewManagerVote (managerPublicKey,admin) = makeString([keySetNewManagerVotePrefix(managerPublicKey), admin], SEP)
24+
25+
26+func getSetNewManagerVote (admin,managerPublicKey) = valueOrElse(getInteger(keySetNewManagerVote(admin, managerPublicKey)), 0)
27+
28+
29+func adminAdressList () = makeString(["%s", "adminAddressList"], SEP)
30+
31+
32+func getAdminsList () = split(valueOrElse(getString(this, adminAdressList()), ""), SEP)
33+
34+
35+func isInAdminList (address) = match indexOf(getAdminsList(), address) {
36+ case t: Int =>
37+ true
38+ case _ =>
39+ false
40+}
41+
42+
43+func genVotesKeysHelper (lst,adminAddress) = {
44+ let $t013191345 = lst
45+ let result = $t013191345._1
46+ let prefix = $t013191345._2
47+ $Tuple2((result :+ makeString([prefix, adminAddress], SEP)), prefix)
2048 }
2149
2250
23-func getPutblicKeysAsByteVectorList () = {
24- let rawPubKeysList = getMultisigPubKeysList()
25- let $l = rawPubKeysList
51+func genVotesKeys (keyPrefix) = {
52+ let adminList = adminAdressList()
53+ let $l = getAdminsList()
2654 let $s = size($l)
27- let $acc0 = nil
55+ let $acc0 = $Tuple2(nil, keyPrefix)
2856 func $f0_1 ($a,$i) = if (($i >= $s))
2957 then $a
30- else pubKeyStringToBytes($a, $l[$i])
58+ else genVotesKeysHelper($a, $l[$i])
3159
3260 func $f0_2 ($a,$i) = if (($i >= $s))
3361 then $a
34- else throw("List size exceeds 3")
62+ else throw("List size exceeds 10")
3563
36- $f0_2($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3)
37- }
38-
39-
40-func validateProof (publicKey,proof,bodyBytes) = if (sigVerify(bodyBytes, proof, publicKey))
41- then 1
42- else 0
43-
44-
45-func compareHelper (lst,proof) = {
46- let $t0927968 = lst
47- let results = $t0927968._1
48- let publicKey = $t0927968._2
49- let bodyBytes = $t0927968._3
50- $Tuple3((results :+ validateProof(publicKey, proof, bodyBytes)), publicKey, bodyBytes)
51- }
52-
53-
54-func compare (proofsList,publicKey,bodyBytes) = {
55- let $l = proofsList
56- let $s = size($l)
57- let $acc0 = $Tuple3(nil, publicKey, bodyBytes)
58- func $f0_1 ($a,$i) = if (($i >= $s))
59- then $a
60- else compareHelper($a, $l[$i])
61-
62- func $f0_2 ($a,$i) = if (($i >= $s))
63- then $a
64- else throw("List size exceeds 3")
65-
66- $f0_2($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3)
67- }
68-
69-
70-func accum (sum,val) = (sum + val)
71-
72-
73-func sumList (list) = {
74- let $l = list
75- let $s = size($l)
76- let $acc0 = 0
77- func $f0_1 ($a,$i) = if (($i >= $s))
78- then $a
79- else accum($a, $l[$i])
80-
81- func $f0_2 ($a,$i) = if (($i >= $s))
82- then $a
83- else throw("List size exceeds 3")
84-
85- $f0_2($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3)
86- }
87-
88-
89-func compareListHelper (proofs,publicKey) = {
90- let $t014301475 = proofs
91- let results = $t014301475._1
92- let proofsList = $t014301475._2
93- let bodyBytes = $t014301475._3
94- let compareList = compare(proofsList, publicKey, bodyBytes)._1
95- let sum = sumList(compareList)
96- $Tuple3((results :+ sum), proofsList, bodyBytes)
97- }
98-
99-
100-func normilizeHelper (results,next) = (results :+ min([1, next]))
101-
102-
103-func normilize (results) = {
104- let $l = results
105- let $s = size($l)
106- let $acc0 = nil
107- func $f0_1 ($a,$i) = if (($i >= $s))
108- then $a
109- else normilizeHelper($a, $l[$i])
110-
111- func $f0_2 ($a,$i) = if (($i >= $s))
112- then $a
113- else throw("List size exceeds 3")
114-
115- $f0_2($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3)
116- }
117-
118-
119-func validProofCount (publicKeysList,proofsList,bodyBytes) = {
120- let rawList = {
121- let $l = publicKeysList
122- let $s = size($l)
123- let $acc0 = $Tuple3(nil, proofsList, bodyBytes)
124- func $f0_1 ($a,$i) = if (($i >= $s))
125- then $a
126- else compareListHelper($a, $l[$i])
127-
128- func $f0_2 ($a,$i) = if (($i >= $s))
129- then $a
130- else throw("List size exceeds 3")
131-
132- $f0_2($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3)
133- }
134- let norm = normilize(rawList._1)
135- sumList(norm)
136- }
137-
138-
139-func filterProof (result,next) = if ((next != base58''))
140- then (result :+ next)
141- else result
142-
143-
144-func filterProofList (proofs) = {
145- let $l = proofs
146- let $s = size($l)
147- let $acc0 = nil
148- func $f0_1 ($a,$i) = if (($i >= $s))
149- then $a
150- else filterProof($a, $l[$i])
151-
152- func $f0_2 ($a,$i) = if (($i >= $s))
153- then $a
154- else throw("List size exceeds 8")
155-
156- $f0_2($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)
64+ $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)
15765 }
15866
15967
16068 @Callable(i)
161-func test () = nil
69+func voteForNewManger (newManagerPublicKey) = {
70+ let callerAddressString = toBase58String(i.caller.bytes)
71+ if (isInAdminList(callerAddressString))
72+ then nil
73+ else throwErr((callerAddressString + ": not in Admin list"))
74+ }
16275
163-
164-@Verifier(tx)
165-func verify () = match tx {
166- case s: SetScriptTransaction =>
167- sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
168- case _ =>
169- let proofsList = filterProofList(tx.proofs)
170- let publicKeysList = getPutblicKeysAsByteVectorList()
171- (validProofCount(publicKeysList, proofsList, tx.bodyBytes) > 0)
172-}
17376
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let SEP = "__"
55
66 let contractFilename = "test.ride"
77
8-func keyPublicKeyList () = makeString(["%s", "multisigPublicKeyList"], SEP)
9-
10-
118 func throwErr (s) = throw(((contractFilename + ": ") + s))
129
1310
14-func pubKeyStringToBytes (result,pubKeyString) = (result :+ fromBase58String(pubKeyString))
11+func keyActiveManagerPublicKey () = makeString(["%s", "managerPublicKey"], SEP)
1512
1613
17-func getMultisigPubKeysList () = {
18- let rawMultisigPubKeys = valueOrElse(getString(this, keyPublicKeyList()), "")
19- split(rawMultisigPubKeys, SEP)
14+func keyCurrentManagerPublicKey () = makeString(["%s", "keyCurrentManager"], SEP)
15+
16+
17+func keyPendingManagerPublicKey () = makeString(["%s", "pendingManagerPublicKey"], SEP)
18+
19+
20+func keySetNewManagerVotePrefix (managerPublicKey) = makeString(["%s%s%s", "setManager", managerPublicKey], SEP)
21+
22+
23+func keySetNewManagerVote (managerPublicKey,admin) = makeString([keySetNewManagerVotePrefix(managerPublicKey), admin], SEP)
24+
25+
26+func getSetNewManagerVote (admin,managerPublicKey) = valueOrElse(getInteger(keySetNewManagerVote(admin, managerPublicKey)), 0)
27+
28+
29+func adminAdressList () = makeString(["%s", "adminAddressList"], SEP)
30+
31+
32+func getAdminsList () = split(valueOrElse(getString(this, adminAdressList()), ""), SEP)
33+
34+
35+func isInAdminList (address) = match indexOf(getAdminsList(), address) {
36+ case t: Int =>
37+ true
38+ case _ =>
39+ false
40+}
41+
42+
43+func genVotesKeysHelper (lst,adminAddress) = {
44+ let $t013191345 = lst
45+ let result = $t013191345._1
46+ let prefix = $t013191345._2
47+ $Tuple2((result :+ makeString([prefix, adminAddress], SEP)), prefix)
2048 }
2149
2250
23-func getPutblicKeysAsByteVectorList () = {
24- let rawPubKeysList = getMultisigPubKeysList()
25- let $l = rawPubKeysList
51+func genVotesKeys (keyPrefix) = {
52+ let adminList = adminAdressList()
53+ let $l = getAdminsList()
2654 let $s = size($l)
27- let $acc0 = nil
55+ let $acc0 = $Tuple2(nil, keyPrefix)
2856 func $f0_1 ($a,$i) = if (($i >= $s))
2957 then $a
30- else pubKeyStringToBytes($a, $l[$i])
58+ else genVotesKeysHelper($a, $l[$i])
3159
3260 func $f0_2 ($a,$i) = if (($i >= $s))
3361 then $a
34- else throw("List size exceeds 3")
62+ else throw("List size exceeds 10")
3563
36- $f0_2($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3)
37- }
38-
39-
40-func validateProof (publicKey,proof,bodyBytes) = if (sigVerify(bodyBytes, proof, publicKey))
41- then 1
42- else 0
43-
44-
45-func compareHelper (lst,proof) = {
46- let $t0927968 = lst
47- let results = $t0927968._1
48- let publicKey = $t0927968._2
49- let bodyBytes = $t0927968._3
50- $Tuple3((results :+ validateProof(publicKey, proof, bodyBytes)), publicKey, bodyBytes)
51- }
52-
53-
54-func compare (proofsList,publicKey,bodyBytes) = {
55- let $l = proofsList
56- let $s = size($l)
57- let $acc0 = $Tuple3(nil, publicKey, bodyBytes)
58- func $f0_1 ($a,$i) = if (($i >= $s))
59- then $a
60- else compareHelper($a, $l[$i])
61-
62- func $f0_2 ($a,$i) = if (($i >= $s))
63- then $a
64- else throw("List size exceeds 3")
65-
66- $f0_2($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3)
67- }
68-
69-
70-func accum (sum,val) = (sum + val)
71-
72-
73-func sumList (list) = {
74- let $l = list
75- let $s = size($l)
76- let $acc0 = 0
77- func $f0_1 ($a,$i) = if (($i >= $s))
78- then $a
79- else accum($a, $l[$i])
80-
81- func $f0_2 ($a,$i) = if (($i >= $s))
82- then $a
83- else throw("List size exceeds 3")
84-
85- $f0_2($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3)
86- }
87-
88-
89-func compareListHelper (proofs,publicKey) = {
90- let $t014301475 = proofs
91- let results = $t014301475._1
92- let proofsList = $t014301475._2
93- let bodyBytes = $t014301475._3
94- let compareList = compare(proofsList, publicKey, bodyBytes)._1
95- let sum = sumList(compareList)
96- $Tuple3((results :+ sum), proofsList, bodyBytes)
97- }
98-
99-
100-func normilizeHelper (results,next) = (results :+ min([1, next]))
101-
102-
103-func normilize (results) = {
104- let $l = results
105- let $s = size($l)
106- let $acc0 = nil
107- func $f0_1 ($a,$i) = if (($i >= $s))
108- then $a
109- else normilizeHelper($a, $l[$i])
110-
111- func $f0_2 ($a,$i) = if (($i >= $s))
112- then $a
113- else throw("List size exceeds 3")
114-
115- $f0_2($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3)
116- }
117-
118-
119-func validProofCount (publicKeysList,proofsList,bodyBytes) = {
120- let rawList = {
121- let $l = publicKeysList
122- let $s = size($l)
123- let $acc0 = $Tuple3(nil, proofsList, bodyBytes)
124- func $f0_1 ($a,$i) = if (($i >= $s))
125- then $a
126- else compareListHelper($a, $l[$i])
127-
128- func $f0_2 ($a,$i) = if (($i >= $s))
129- then $a
130- else throw("List size exceeds 3")
131-
132- $f0_2($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3)
133- }
134- let norm = normilize(rawList._1)
135- sumList(norm)
136- }
137-
138-
139-func filterProof (result,next) = if ((next != base58''))
140- then (result :+ next)
141- else result
142-
143-
144-func filterProofList (proofs) = {
145- let $l = proofs
146- let $s = size($l)
147- let $acc0 = nil
148- func $f0_1 ($a,$i) = if (($i >= $s))
149- then $a
150- else filterProof($a, $l[$i])
151-
152- func $f0_2 ($a,$i) = if (($i >= $s))
153- then $a
154- else throw("List size exceeds 8")
155-
156- $f0_2($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)
64+ $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)
15765 }
15866
15967
16068 @Callable(i)
161-func test () = nil
69+func voteForNewManger (newManagerPublicKey) = {
70+ let callerAddressString = toBase58String(i.caller.bytes)
71+ if (isInAdminList(callerAddressString))
72+ then nil
73+ else throwErr((callerAddressString + ": not in Admin list"))
74+ }
16275
163-
164-@Verifier(tx)
165-func verify () = match tx {
166- case s: SetScriptTransaction =>
167- sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
168- case _ =>
169- let proofsList = filterProofList(tx.proofs)
170- let publicKeysList = getPutblicKeysAsByteVectorList()
171- (validProofCount(publicKeysList, proofsList, tx.bodyBytes) > 0)
172-}
17376

github/deemru/w8io/026f985 
29.86 ms