tx · 3aL4sNQtRDQm5cYR4wgada7tYxwLWQ97aXGFP2qoo9H8

3N13KQpdY3UU7JkWUBD9kN7t7xuUgeyYMTT:  -0.00500000 Waves

2023.07.03 16:50 [2649811] smart account 3N13KQpdY3UU7JkWUBD9kN7t7xuUgeyYMTT > SELF 0.00000000 Waves

{ "type": 13, "id": "3aL4sNQtRDQm5cYR4wgada7tYxwLWQ97aXGFP2qoo9H8", "fee": 500000, "feeAssetId": null, "timestamp": 1688392272962, "version": 1, "sender": "3N13KQpdY3UU7JkWUBD9kN7t7xuUgeyYMTT", "senderPublicKey": "HmygqMrDfZtwU85YLdzAEnJ2Gv1qZ1z37iRQDFn873kv", "proofs": [ "36UFzoiedCFEndxoFCXYc5uem5nqyBahkmHLkTywumQHW1Gs5WMLjd83ts98o5WGTTA5TnSt9D8Wv6icVVgH7HeT" ], "script": "base64:BgINCAISBAoCAgESAwoBCCEAA1NFUAICX18AEGNvbnRyYWN0RmlsZW5hbWUCDXRyZWFzdXJ5LnJpZGUAD0FETUlOX0xJU1RfU0laRQAFAAZRVU9SVU0AAwARVFhJRF9CWVRFU19MRU5HVEgAIAEHd3JhcEVycgEBcwkArAICCQCsAgIFEGNvbnRyYWN0RmlsZW5hbWUCAjogBQFzAQh0aHJvd0VycgEBcwkAAgEJAQd3cmFwRXJyAQUBcwEYa2V5QWxsb3dlZFR4SWRWb3RlUHJlZml4AQR0eElkCQC5CQIJAMwIAgIGJXMlcyVzCQDMCAICCWFsbG93VHhJZAkAzAgCBQR0eElkBQNuaWwFA1NFUAEQa2V5RnVsbEFkbWluVm90ZQIGcHJlZml4DGFkbWluQWRkcmVzcwkAuQkCCQDMCAIFBnByZWZpeAkAzAgCBQxhZG1pbkFkZHJlc3MFA25pbAUDU0VQARNrZXlBZG1pbkFkZHJlc3NMaXN0AAkAuQkCCQDMCAICAiVzCQDMCAICEGFkbWluQWRkcmVzc0xpc3QFA25pbAUDU0VQARFrZXlGYWN0b3J5QWRkcmVzcwAJALkJAgkA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ElkAhIgaXMgbm90IHZhbGlkIHR4SWQJAMwIAgMDCQAAAgURYWxsb3dlZFR4SWRPcHRpb24FBHVuaXQGCQECIT0CCQEFdmFsdWUBBRFhbGxvd2VkVHhJZE9wdGlvbgUEdHhJZAYJAQh0aHJvd0VycgEJAKwCAgUEdHhJZAITIGlzIGFscmVhZHkgYWxsb3dlZAUDbmlsAwkAAAIFA2VycgUDZXJyCQEMdm90ZUlOVEVSTkFMBAUTY2FsbGVyQWRkcmVzc1N0cmluZwUJa2V5UHJlZml4BQZRVU9SVU0FBnJlc3VsdAkAAgECJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgAtGDey", "chainId": 84, "height": 2649811, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: Hxv3s35dPuYmcjBKrT3JtnHZ9phhoPfEtggfbAzr5zYi Full:
OldNewDifferences
1-# no script
1+{-# STDLIB_VERSION 6 #-}
2+{-# SCRIPT_TYPE ACCOUNT #-}
3+{-# CONTENT_TYPE DAPP #-}
4+let SEP = "__"
5+
6+let contractFilename = "treasury.ride"
7+
8+let ADMIN_LIST_SIZE = 5
9+
10+let QUORUM = 3
11+
12+let TXID_BYTES_LENGTH = 32
13+
14+func wrapErr (s) = ((contractFilename + ": ") + s)
15+
16+
17+func throwErr (s) = throw(wrapErr(s))
18+
19+
20+func keyAllowedTxIdVotePrefix (txId) = makeString(["%s%s%s", "allowTxId", txId], SEP)
21+
22+
23+func keyFullAdminVote (prefix,adminAddress) = makeString([prefix, adminAddress], SEP)
24+
25+
26+func keyAdminAddressList () = makeString(["%s", "adminAddressList"], SEP)
27+
28+
29+func keyFactoryAddress () = makeString(["%s", "factory"], SEP)
30+
31+
32+func keyAllowedTxId () = makeString(["%s", "txId"], SEP)
33+
34+
35+func keyConfigAddress () = "%s__config"
36+
37+
38+func keyVotingResultAddress () = "contract_voting_result"
39+
40+
41+func keyProposalAllowBroadcast (address,txId) = ((("proposal_allow_broadcast_" + toString(address)) + "_") + toBase58String(txId))
42+
43+
44+let configAddressOption = match getString(this, keyConfigAddress()) {
45+ case s: String =>
46+ addressFromString(s)
47+ case _: Unit =>
48+ unit
49+ case _ =>
50+ throw("Match error")
51+}
52+
53+let configAddress = valueOrErrorMessage(configAddressOption, wrapErr("invalid config address"))
54+
55+let factoryAddressOption = match getString(this, keyFactoryAddress()) {
56+ case s: String =>
57+ addressFromString(s)
58+ case _: Unit =>
59+ unit
60+ case _ =>
61+ throw("Match error")
62+}
63+
64+let factoryAddressOrFail = valueOrErrorMessage(factoryAddressOption, wrapErr("invalid factory address"))
65+
66+let votingResultContractOption = match configAddressOption {
67+ case a: Address =>
68+ match getString(a, keyVotingResultAddress()) {
69+ case s: String =>
70+ addressFromString(s)
71+ case _: Unit =>
72+ unit
73+ case _ =>
74+ throw("Match error")
75+ }
76+ case _: Unit =>
77+ unit
78+ case _ =>
79+ throw("Match error")
80+}
81+
82+let votingResultContract = valueOrErrorMessage(votingResultContractOption, wrapErr("invalid voting result address"))
83+
84+func onlyAddress (i,address) = if ((i.caller == address))
85+ then true
86+ else throwErr("permission denied")
87+
88+
89+func onlyFactory (i) = onlyAddress(i, factoryAddressOrFail)
90+
91+
92+func getAdminVote (prefix,admin) = {
93+ let voteKey = keyFullAdminVote(prefix, admin)
94+ valueOrElse(getInteger(voteKey), 0)
95+ }
96+
97+
98+func getAdminsList () = match getString(this, keyAdminAddressList()) {
99+ case s: String =>
100+ split(s, SEP)
101+ case _ =>
102+ nil
103+}
104+
105+
106+func isInAdminList (address) = containsElement(getAdminsList(), address)
107+
108+
109+func genVotesKeysHelper (a,adminAddress) = {
110+ let $t025392563 = a
111+ let result = $t025392563._1
112+ let prefix = $t025392563._2
113+ $Tuple2((result :+ keyFullAdminVote(prefix, adminAddress)), prefix)
114+ }
115+
116+
117+func genVotesKeys (keyPrefix) = {
118+ let adminList = keyAdminAddressList()
119+ let $t027102794 = {
120+ let $l = getAdminsList()
121+ let $s = size($l)
122+ let $acc0 = $Tuple2(nil, keyPrefix)
123+ func $f0_1 ($a,$i) = if (($i >= $s))
124+ then $a
125+ else genVotesKeysHelper($a, $l[$i])
126+
127+ func $f0_2 ($a,$i) = if (($i >= $s))
128+ then $a
129+ else throw("List size exceeds 5")
130+
131+ $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5)
132+ }
133+ let result = $t027102794._1
134+ let prefix = $t027102794._2
135+ result
136+ }
137+
138+
139+func countVotesHelper (result,voteKey) = (result + valueOrElse(getInteger(voteKey), 0))
140+
141+
142+func countVotes (prefix) = {
143+ let votes = genVotesKeys(prefix)
144+ let $l = votes
145+ let $s = size($l)
146+ let $acc0 = 0
147+ func $f0_1 ($a,$i) = if (($i >= $s))
148+ then $a
149+ else countVotesHelper($a, $l[$i])
150+
151+ func $f0_2 ($a,$i) = if (($i >= $s))
152+ then $a
153+ else throw("List size exceeds 5")
154+
155+ $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5)
156+ }
157+
158+
159+func clearVotesHelper (result,key) = (result :+ DeleteEntry(key))
160+
161+
162+func getClearVoteEntries (prefix) = {
163+ let votes = genVotesKeys(prefix)
164+ let $l = votes
165+ let $s = size($l)
166+ let $acc0 = nil
167+ func $f0_1 ($a,$i) = if (($i >= $s))
168+ then $a
169+ else clearVotesHelper($a, $l[$i])
170+
171+ func $f0_2 ($a,$i) = if (($i >= $s))
172+ then $a
173+ else throw("List size exceeds 5")
174+
175+ $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5)
176+ }
177+
178+
179+func voteINTERNAL (callerAddressString,keyPrefix,minVotes,voteResult) = {
180+ let voteKey = keyFullAdminVote(keyPrefix, callerAddressString)
181+ let adminCurrentVote = getAdminVote(keyPrefix, callerAddressString)
182+ let err = if (!(isInAdminList(callerAddressString)))
183+ then throwErr((("Address: " + callerAddressString) + " not in Admin list"))
184+ else if ((adminCurrentVote == 1))
185+ then throwErr((voteKey + " you already voted"))
186+ else unit
187+ if ((err == err))
188+ then {
189+ let votes = countVotes(keyPrefix)
190+ if (((votes + 1) >= minVotes))
191+ then {
192+ let clearVoteEntries = getClearVoteEntries(keyPrefix)
193+ (clearVoteEntries ++ voteResult)
194+ }
195+ else [IntegerEntry(voteKey, 1)]
196+ }
197+ else throw("Strict value is not equal to itself.")
198+ }
199+
200+
201+@Callable(i)
202+func transferWaves (recipientBytes,amount) = {
203+ let checkCaller = onlyFactory(i)
204+ if ((checkCaller == checkCaller))
205+ then [ScriptTransfer(Address(recipientBytes), amount, unit)]
206+ else throw("Strict value is not equal to itself.")
207+ }
208+
209+
210+
211+@Callable(i)
212+func voteForTxId (txId) = {
213+ let callerAddressString = toBase58String(i.caller.bytes)
214+ let keyPrefix = keyAllowedTxIdVotePrefix(txId)
215+ let result = [StringEntry(keyAllowedTxId(), txId)]
216+ let allowedTxIdOption = getString(this, keyAllowedTxId())
217+ let err = [if ((size(fromBase58String(txId)) == TXID_BYTES_LENGTH))
218+ then true
219+ else throwErr((txId + " is not valid txId")), if (if ((allowedTxIdOption == unit))
220+ then true
221+ else (value(allowedTxIdOption) != txId))
222+ then true
223+ else throwErr((txId + " is already allowed"))]
224+ if ((err == err))
225+ then voteINTERNAL(callerAddressString, keyPrefix, QUORUM, result)
226+ else throw("Strict value is not equal to itself.")
227+ }
228+
229+

github/deemru/w8io/026f985 
36.18 ms