tx · DyfEUMjxzzXeydsTn1xjZi2aKd7W1j91MeFiouDRgkVt

3N4ziXSMRverXyxHDUKKMR9MHXnB3TyU3Yh:  -0.01000000 Waves

2023.04.18 17:14 [2540086] smart account 3N4ziXSMRverXyxHDUKKMR9MHXnB3TyU3Yh > SELF 0.00000000 Waves

{ "type": 13, "id": "DyfEUMjxzzXeydsTn1xjZi2aKd7W1j91MeFiouDRgkVt", "fee": 1000000, "feeAssetId": null, "timestamp": 1681827269097, "version": 2, "chainId": 84, "sender": "3N4ziXSMRverXyxHDUKKMR9MHXnB3TyU3Yh", "senderPublicKey": "EU9obW1yVhR8qug3EmXPeew3DMagvJFQzY5Ku8bmcsU7", "proofs": [ "4MTn8ZtdxaBvyUUWW1YK1TVXj8H5ZD3XmqhhyZ8Cu4KfTbBHDXxjLL5cA9LALq1dPfSQCSB6aQtQ2ZPjGb2LmBgZ" ], "script": "base64:BgILCAISABIDCgEIEgAVAANTRVACAl9fABBjb250cmFjdEZpbGVuYW1lAgl0ZXN0LnJpZGUBCHRocm93RXJyAQFzCQACAQkArAICCQCsAgIFEGNvbnRyYWN0RmlsZW5hbWUCAjogBQFzARlrZXlBY3RpdmVNYW5hZ2VyUHVibGljS2V5AAkAuQkCCQDMCAICAiVzCQDMCAICEG1hbmFnZXJQdWJsaWNLZXkFA25pbAUDU0VQARprZXlQZW5kaW5nTWFuYWdlclB1YmxpY0tleQAJALkJAgkAzAgCAgIlcwkAzAgCAhdwZW5kaW5nTWFuYWdlclB1YmxpY0tleQUDbmlsBQNTRVABHXBlbmRpbmdNYW5hZ2VyUHVibGljS2V5T3JVbml0AAQHJG1hdGNoMAkAoggBCQEaa2V5UGVuZGluZ01hbmFnZXJQdWJsaWNLZXkAAwkAAQIFByRtYXRjaDACBlN0cmluZwQBcwUHJG1hdGNoMAkA2QQBBQFzAwkAAQIFByRtYXRjaDACBFVuaXQFBHVuaXQJAAIBAgtNYXRjaCBlcnJvcgEaa2V5U2V0TmV3TWFuYWdlclZvdGV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5kaW5nTWFuYWdlclN0cmluZwUDbmlsCQDMCAIJAQxJbnRlZ2VyRW50cnkCCQEYa2V5RGVhY3RpdmF0ZU1hbmFnZXJWb3RlAQUTY2FsbGVyQWRkcmVzc1N0cmluZwABBQNuaWwJAQh0aHJvd0VycgEJAKwCAgkArAICAglBZGRyZXNzOiAFE2NhbGxlckFkZHJlc3NTdHJpbmcCEiBub3QgaW4gQWRtaW4gbGlzdADdi2Bb", "height": 2540086, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 4pNi8fwyVmUGrvB13YQSVJjJWRw1MJ56K5saNAbxj6v5 Next: AR6YkGR42shTBWuk6u8eBmFfXR5oPExJkGxYXmv6iGzo Diff:
OldNewDifferences
1111 func keyActiveManagerPublicKey () = makeString(["%s", "managerPublicKey"], SEP)
1212
1313
14-func keyCurrentManagerPublicKey () = makeString(["%s", "keyCurrentManager"], SEP)
14+func keyPendingManagerPublicKey () = makeString(["%s", "pendingManagerPublicKey"], SEP)
1515
1616
17-func keyPendingManagerPublicKey () = makeString(["%s", "pendingManagerPublicKey"], SEP)
17+func pendingManagerPublicKeyOrUnit () = match getString(keyPendingManagerPublicKey()) {
18+ case s: String =>
19+ fromBase58String(s)
20+ case _: Unit =>
21+ unit
22+ case _ =>
23+ throw("Match error")
24+}
1825
1926
2027 func keySetNewManagerVotePrefix (managerPublicKey) = makeString(["%s%s%s", "setManager", managerPublicKey], SEP)
2431
2532
2633 func getSetNewManagerVote (managerPublicKey,admin) = valueOrElse(getInteger(keySetNewManagerVote(managerPublicKey, admin)), 0)
34+
35+
36+func keyDeactivateManagerVotePrefix () = makeString(["%s%s", "deactivateManager"], SEP)
37+
38+
39+func keyDeactivateManagerVote (admin) = makeString([keyDeactivateManagerVotePrefix(), admin], SEP)
40+
41+
42+func getDeactivateManagerVote (admin) = valueOrElse(getInteger(keyDeactivateManagerVote(admin)), 0)
2743
2844
2945 func adminAdressList () = makeString(["%s", "adminAddressList"], SEP)
4157
4258
4359 func genVotesKeysHelper (lst,adminAddress) = {
44- let $t013191345 = lst
45- let result = $t013191345._1
46- let prefix = $t013191345._2
60+ let $t018291855 = lst
61+ let result = $t018291855._1
62+ let prefix = $t018291855._2
4763 $Tuple2((result :+ makeString([prefix, adminAddress], SEP)), prefix)
4864 }
4965
106122
107123
108124 @Callable(i)
125+func confirmManager () = {
126+ let pm = pendingManagerPublicKeyOrUnit()
127+ let hasPM = if (isDefined(pm))
128+ then true
129+ else throwErr("no pending manager")
130+ if ((hasPM == hasPM))
131+ then {
132+ let checkPM = if ((i.callerPublicKey == value(pm)))
133+ then true
134+ else throwErr("you are not pending manager")
135+ if ((checkPM == checkPM))
136+ then [StringEntry(keyActiveManagerPublicKey(), toBase58String(value(pm)))]
137+ else throw("Strict value is not equal to itself.")
138+ }
139+ else throw("Strict value is not equal to itself.")
140+ }
141+
142+
143+
144+@Callable(i)
109145 func voteForNewManger (newManagerPublicKey) = {
110146 let callerAddressString = toBase58String(i.caller.bytes)
111147 if (isInAdminList(callerAddressString))
112148 then if ((getSetNewManagerVote(newManagerPublicKey, callerAddressString) == 1))
113- then throwErr((((callerAddressString + ": ") + newManagerPublicKey) + ": voteForNewManger() you already voted"))
149+ then throwErr((((("Address: " + callerAddressString) + " NewManager: ") + newManagerPublicKey) + " voteForNewManger() you already voted"))
114150 else {
115151 let votes = countVotes(keySetNewManagerVotePrefix(newManagerPublicKey))
116152 if (((votes + 1) >= 2))
120156 }
121157 else [IntegerEntry(keySetNewManagerVote(newManagerPublicKey, callerAddressString), 1)]
122158 }
123- else throwErr((callerAddressString + ": not in Admin list"))
159+ else throwErr((("Address: " + callerAddressString) + " not in Admin list"))
160+ }
161+
162+
163+
164+@Callable(i)
165+func deactivateManager () = {
166+ let callerAddressString = toBase58String(i.caller.bytes)
167+ let pendingManagerString = getStringValue(keyPendingManagerPublicKey())
168+ if (isInAdminList(callerAddressString))
169+ then if ((getDeactivateManagerVote(callerAddressString) == 1))
170+ then throwErr((("Address: " + callerAddressString) + " deactivateManager() you already voted"))
171+ else {
172+ let votes = countVotes(keyDeactivateManagerVotePrefix())
173+ if (((votes + 1) >= 1))
174+ then {
175+ let clearVotesEntries = getClearVotesEntries(keyDeactivateManagerVotePrefix())
176+ (clearVotesEntries ++ [StringEntry(keyActiveManagerPublicKey(), pendingManagerString)])
177+ }
178+ else [IntegerEntry(keyDeactivateManagerVote(callerAddressString), 1)]
179+ }
180+ else throwErr((("Address: " + callerAddressString) + " not in Admin list"))
124181 }
125182
126183
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let SEP = "__"
55
66 let contractFilename = "test.ride"
77
88 func throwErr (s) = throw(((contractFilename + ": ") + s))
99
1010
1111 func keyActiveManagerPublicKey () = makeString(["%s", "managerPublicKey"], SEP)
1212
1313
14-func keyCurrentManagerPublicKey () = makeString(["%s", "keyCurrentManager"], SEP)
14+func keyPendingManagerPublicKey () = makeString(["%s", "pendingManagerPublicKey"], SEP)
1515
1616
17-func keyPendingManagerPublicKey () = makeString(["%s", "pendingManagerPublicKey"], SEP)
17+func pendingManagerPublicKeyOrUnit () = match getString(keyPendingManagerPublicKey()) {
18+ case s: String =>
19+ fromBase58String(s)
20+ case _: Unit =>
21+ unit
22+ case _ =>
23+ throw("Match error")
24+}
1825
1926
2027 func keySetNewManagerVotePrefix (managerPublicKey) = makeString(["%s%s%s", "setManager", managerPublicKey], SEP)
2128
2229
2330 func keySetNewManagerVote (managerPublicKey,admin) = makeString([keySetNewManagerVotePrefix(managerPublicKey), admin], SEP)
2431
2532
2633 func getSetNewManagerVote (managerPublicKey,admin) = valueOrElse(getInteger(keySetNewManagerVote(managerPublicKey, admin)), 0)
34+
35+
36+func keyDeactivateManagerVotePrefix () = makeString(["%s%s", "deactivateManager"], SEP)
37+
38+
39+func keyDeactivateManagerVote (admin) = makeString([keyDeactivateManagerVotePrefix(), admin], SEP)
40+
41+
42+func getDeactivateManagerVote (admin) = valueOrElse(getInteger(keyDeactivateManagerVote(admin)), 0)
2743
2844
2945 func adminAdressList () = makeString(["%s", "adminAddressList"], SEP)
3046
3147
3248 func getAdminsList () = split(valueOrElse(getString(this, adminAdressList()), ""), SEP)
3349
3450
3551 func isInAdminList (address) = match indexOf(getAdminsList(), address) {
3652 case t: Int =>
3753 true
3854 case _ =>
3955 false
4056 }
4157
4258
4359 func genVotesKeysHelper (lst,adminAddress) = {
44- let $t013191345 = lst
45- let result = $t013191345._1
46- let prefix = $t013191345._2
60+ let $t018291855 = lst
61+ let result = $t018291855._1
62+ let prefix = $t018291855._2
4763 $Tuple2((result :+ makeString([prefix, adminAddress], SEP)), prefix)
4864 }
4965
5066
5167 func genVotesKeys (keyPrefix) = {
5268 let adminList = adminAdressList()
5369 let $l = getAdminsList()
5470 let $s = size($l)
5571 let $acc0 = $Tuple2(nil, keyPrefix)
5672 func $f0_1 ($a,$i) = if (($i >= $s))
5773 then $a
5874 else genVotesKeysHelper($a, $l[$i])
5975
6076 func $f0_2 ($a,$i) = if (($i >= $s))
6177 then $a
6278 else throw("List size exceeds 10")
6379
6480 $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)
6581 }
6682
6783
6884 func countVotesHelper (result,voteKey) = (result + valueOrElse(getInteger(voteKey), 0))
6985
7086
7187 func countVotes (prefix) = {
7288 let votes = genVotesKeys(prefix)._1
7389 let $l = votes
7490 let $s = size($l)
7591 let $acc0 = 0
7692 func $f0_1 ($a,$i) = if (($i >= $s))
7793 then $a
7894 else countVotesHelper($a, $l[$i])
7995
8096 func $f0_2 ($a,$i) = if (($i >= $s))
8197 then $a
8298 else throw("List size exceeds 10")
8399
84100 $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)
85101 }
86102
87103
88104 func clearVotesHelper (result,key) = (result :+ DeleteEntry(key))
89105
90106
91107 func getClearVotesEntries (prefix) = {
92108 let votes = genVotesKeys(prefix)._1
93109 let $l = votes
94110 let $s = size($l)
95111 let $acc0 = nil
96112 func $f0_1 ($a,$i) = if (($i >= $s))
97113 then $a
98114 else clearVotesHelper($a, $l[$i])
99115
100116 func $f0_2 ($a,$i) = if (($i >= $s))
101117 then $a
102118 else throw("List size exceeds 10")
103119
104120 $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)
105121 }
106122
107123
108124 @Callable(i)
125+func confirmManager () = {
126+ let pm = pendingManagerPublicKeyOrUnit()
127+ let hasPM = if (isDefined(pm))
128+ then true
129+ else throwErr("no pending manager")
130+ if ((hasPM == hasPM))
131+ then {
132+ let checkPM = if ((i.callerPublicKey == value(pm)))
133+ then true
134+ else throwErr("you are not pending manager")
135+ if ((checkPM == checkPM))
136+ then [StringEntry(keyActiveManagerPublicKey(), toBase58String(value(pm)))]
137+ else throw("Strict value is not equal to itself.")
138+ }
139+ else throw("Strict value is not equal to itself.")
140+ }
141+
142+
143+
144+@Callable(i)
109145 func voteForNewManger (newManagerPublicKey) = {
110146 let callerAddressString = toBase58String(i.caller.bytes)
111147 if (isInAdminList(callerAddressString))
112148 then if ((getSetNewManagerVote(newManagerPublicKey, callerAddressString) == 1))
113- then throwErr((((callerAddressString + ": ") + newManagerPublicKey) + ": voteForNewManger() you already voted"))
149+ then throwErr((((("Address: " + callerAddressString) + " NewManager: ") + newManagerPublicKey) + " voteForNewManger() you already voted"))
114150 else {
115151 let votes = countVotes(keySetNewManagerVotePrefix(newManagerPublicKey))
116152 if (((votes + 1) >= 2))
117153 then {
118154 let clearVotesEntries = getClearVotesEntries(keySetNewManagerVotePrefix(newManagerPublicKey))
119155 (clearVotesEntries ++ [StringEntry(keyPendingManagerPublicKey(), newManagerPublicKey)])
120156 }
121157 else [IntegerEntry(keySetNewManagerVote(newManagerPublicKey, callerAddressString), 1)]
122158 }
123- else throwErr((callerAddressString + ": not in Admin list"))
159+ else throwErr((("Address: " + callerAddressString) + " not in Admin list"))
160+ }
161+
162+
163+
164+@Callable(i)
165+func deactivateManager () = {
166+ let callerAddressString = toBase58String(i.caller.bytes)
167+ let pendingManagerString = getStringValue(keyPendingManagerPublicKey())
168+ if (isInAdminList(callerAddressString))
169+ then if ((getDeactivateManagerVote(callerAddressString) == 1))
170+ then throwErr((("Address: " + callerAddressString) + " deactivateManager() you already voted"))
171+ else {
172+ let votes = countVotes(keyDeactivateManagerVotePrefix())
173+ if (((votes + 1) >= 1))
174+ then {
175+ let clearVotesEntries = getClearVotesEntries(keyDeactivateManagerVotePrefix())
176+ (clearVotesEntries ++ [StringEntry(keyActiveManagerPublicKey(), pendingManagerString)])
177+ }
178+ else [IntegerEntry(keyDeactivateManagerVote(callerAddressString), 1)]
179+ }
180+ else throwErr((("Address: " + callerAddressString) + " not in Admin list"))
124181 }
125182
126183

github/deemru/w8io/026f985 
32.29 ms