tx · 8ntMWPr84s9hnvJSjZPWBt7EZnpFXJKDGN1oz7EJYywh

3N6oQmUanp4TWuHnv5rma4WveVub63JRFB2:  -0.01200000 Waves

2023.06.28 20:30 [2642805] smart account 3N6oQmUanp4TWuHnv5rma4WveVub63JRFB2 > SELF 0.00000000 Waves

{ "type": 13, "id": "8ntMWPr84s9hnvJSjZPWBt7EZnpFXJKDGN1oz7EJYywh", "fee": 1200000, "feeAssetId": null, "timestamp": 1687973482981, "version": 2, "chainId": 84, "sender": "3N6oQmUanp4TWuHnv5rma4WveVub63JRFB2", "senderPublicKey": "EM2pooK6eEzhzFXZFGd2phMRus6f1M5GxBsawNk9oi37", "proofs": [ "63i2xFybEtc5DYnAngxAACY5FPAHSSkaPbPZLrKEF9FBFLQDPdCyDJcxjjTthQcjAfg7eg8EpumCs89vkaNJZsoi" ], "script": "base64:BgIbCAISBAoCCAESBAoCAQESBgoECAEBGBIDCgEBNQEVa2V5VXNlckd3bFJlbGVhc2VUaW1lAQh1c2VyQWRkcgkArAICAholcyVzX191c2VyR3dsUmVsZWFzZVRpbWVfXwUIdXNlckFkZHIAC0lkeEVmZlRvdGFsAAAACklkeEVmZlVzZXIAAQAFY2hhaW4JAMkBAgkAygECCAUEdGhpcwVieXRlcwABAAEAFWRlZmF1bHRSZXN0QWRkcmVzc1N0cgQHJG1hdGNoMAUFY2hhaW4DCQAAAgEBVwUHJG1hdGNoMAIjM1BRQ3V2RmJ2aDRMa1BVbnJuVTF6M2puYkExcDltM1dOaHYDCQAAAgEBVAUHJG1hdGNoMAIjM011bWtHR3p0Q0tBWHBXRHF4a2Rkb2ZxWFNVYnFRa3ZTSnkJAAIBAg1Vbmtub3duIGNoYWluAANTRVACAl9fAAVNVUxUNgDAhD0ABVNTSVpFABkABU1TSVpFAGQABUxTSVpFAOEBAAZYTFNJWkUAkAMAB1hYTFNJWkUA8QQBD2dldFN0cmluZ09yRmFpbAIHYWRkcmVzcwNrZXkJARN2YWx1ZU9yRXJyb3JNZXNz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GF0ZWREYXRhCQCsAgIJAKwCAgkArwICBQtjdXJyZW50RGF0YQkBBXZhbHVlAQkAtwkCBQtjdXJyZW50RGF0YQUDU0VQBQNTRVACBHRydWUJAJQKAgkAzAgCCQELU3RyaW5nRW50cnkCCQEZa2V5UHJvcG9zYWxTdGF0dXNEYXRhQnlJZAEFCnByb3Bvc2FsSWQFC3VwZGF0ZWREYXRhBQNuaWwFBHVuaXQAOLL5Sg==", "height": 2642805, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 7D25JRQWLTTnH8LN1AcJn6HcDP8YGHw74ukhB5qSnzQP Next: 53M6FQUSbp5Y1Zxr2eRXfquntmLipG9eGNbnmF4fxjug Diff:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
4+func keyUserGwlReleaseTime (userAddr) = ("%s%s__userGwlReleaseTime__" + userAddr)
5+
6+
7+let IdxEffTotal = 0
8+
9+let IdxEffUser = 1
10+
411 let chain = take(drop(this.bytes, 1), 1)
512
613 let defaultRestAddressStr = match chain {
2532 let XLSIZE = 400
2633
2734 let XXLSIZE = 625
28-
29-let recLandSize = 1
3035
3136 func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], ""))
3237
5459
5560 let stakingContract = getContractAddressOrFail(restCfg, IdxCfgStakingDapp)
5661
57-func keyStakedLandsByOwner (ownerAddr) = ("stakedLandsByOwner_" + ownerAddr)
58-
62+let recLandSize = 1
5963
6064 func keyResProportions () = "resTypesProportions"
6165
6266
63-func keyUserGwlReleaseTime (userAddr) = ("%s%s__userGwlReleaseTime__" + userAddr)
67+func keyStakedLandsByOwner (ownerAddr) = ("stakedLandsByOwner_" + ownerAddr)
6468
6569
6670 func numPiecesBySize (landSize) = match landSize {
7882 else throw("Unknown land size")
7983 }
8084
81-
82-let IdxEffTotal = 0
83-
84-let IdxEffUser = 1
8585
8686 func getVotingPower (userAddrStrOrEmpty) = {
8787 let props = split(valueOrElse(getString(stakingContract, keyResProportions()), "0_0_0_0_0_0"), "_")
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
4+func keyUserGwlReleaseTime (userAddr) = ("%s%s__userGwlReleaseTime__" + userAddr)
5+
6+
7+let IdxEffTotal = 0
8+
9+let IdxEffUser = 1
10+
411 let chain = take(drop(this.bytes, 1), 1)
512
613 let defaultRestAddressStr = match chain {
714 case _ =>
815 if ((base58'2W' == $match0))
916 then "3PQCuvFbvh4LkPUnrnU1z3jnbA1p9m3WNhv"
1017 else if ((base58'2T' == $match0))
1118 then "3MumkGGztCKAXpWDqxkddofqXSUbqQkvSJy"
1219 else throw("Unknown chain")
1320 }
1421
1522 let SEP = "__"
1623
1724 let MULT6 = 1000000
1825
1926 let SSIZE = 25
2027
2128 let MSIZE = 100
2229
2330 let LSIZE = 225
2431
2532 let XLSIZE = 400
2633
2734 let XXLSIZE = 625
28-
29-let recLandSize = 1
3035
3136 func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], ""))
3237
3338
3439 func getIntOrElse (key,defaultVal) = valueOrElse(getInteger(this, key), defaultVal)
3540
3641
3742 let IdxCfgStakingDapp = 1
3843
3944 func keyRestCfg () = "%s__restConfig"
4045
4146
4247 func keyRestAddress () = "%s__restAddr"
4348
4449
4550 func readRestCfgOrFail (rest) = split_4C(getStringOrFail(rest, keyRestCfg()), SEP)
4651
4752
4853 func getContractAddressOrFail (restCfg,idx) = valueOrErrorMessage(addressFromString(restCfg[idx]), ("Rest cfg doesn't contain address at index " + toString(idx)))
4954
5055
5156 let restContract = addressFromStringValue(valueOrElse(getString(this, keyRestAddress()), defaultRestAddressStr))
5257
5358 let restCfg = readRestCfgOrFail(restContract)
5459
5560 let stakingContract = getContractAddressOrFail(restCfg, IdxCfgStakingDapp)
5661
57-func keyStakedLandsByOwner (ownerAddr) = ("stakedLandsByOwner_" + ownerAddr)
58-
62+let recLandSize = 1
5963
6064 func keyResProportions () = "resTypesProportions"
6165
6266
63-func keyUserGwlReleaseTime (userAddr) = ("%s%s__userGwlReleaseTime__" + userAddr)
67+func keyStakedLandsByOwner (ownerAddr) = ("stakedLandsByOwner_" + ownerAddr)
6468
6569
6670 func numPiecesBySize (landSize) = match landSize {
6771 case _ =>
6872 if (("S" == $match0))
6973 then SSIZE
7074 else if (("M" == $match0))
7175 then MSIZE
7276 else if (("L" == $match0))
7377 then LSIZE
7478 else if (("XL" == $match0))
7579 then XLSIZE
7680 else if (("XXL" == $match0))
7781 then XXLSIZE
7882 else throw("Unknown land size")
7983 }
8084
81-
82-let IdxEffTotal = 0
83-
84-let IdxEffUser = 1
8585
8686 func getVotingPower (userAddrStrOrEmpty) = {
8787 let props = split(valueOrElse(getString(stakingContract, keyResProportions()), "0_0_0_0_0_0"), "_")
8888 func adder (acc,item) = (acc + parseIntValue(item))
8989
9090 let totalPower = {
9191 let $l = props
9292 let $s = size($l)
9393 let $acc0 = 0
9494 func $f0_1 ($a,$i) = if (($i >= $s))
9595 then $a
9696 else adder($a, $l[$i])
9797
9898 func $f0_2 ($a,$i) = if (($i >= $s))
9999 then $a
100100 else throw("List size exceeds 6")
101101
102102 $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6)
103103 }
104104 let usersPower = if ((userAddrStrOrEmpty == ""))
105105 then 0
106106 else {
107107 let landsStr = getString(stakingContract, keyStakedLandsByOwner(userAddrStrOrEmpty))
108108 let lands = if (isDefined(landsStr))
109109 then split_51C(value(landsStr), "_")
110110 else nil
111111 func oneLand (acc,landAssetId) = {
112112 let asset = value(assetInfo(fromBase58String(landAssetId)))
113113 let landSize = split(asset.description, "_")[recLandSize]
114114 (acc + numPiecesBySize(landSize))
115115 }
116116
117117 let $l = lands
118118 let $s = size($l)
119119 let $acc0 = 0
120120 func $f1_1 ($a,$i) = if (($i >= $s))
121121 then $a
122122 else oneLand($a, $l[$i])
123123
124124 func $f1_2 ($a,$i) = if (($i >= $s))
125125 then $a
126126 else throw("List size exceeds 100")
127127
128128 $f1_2($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20), 21), 22), 23), 24), 25), 26), 27), 28), 29), 30), 31), 32), 33), 34), 35), 36), 37), 38), 39), 40), 41), 42), 43), 44), 45), 46), 47), 48), 49), 50), 51), 52), 53), 54), 55), 56), 57), 58), 59), 60), 61), 62), 63), 64), 65), 66), 67), 68), 69), 70), 71), 72), 73), 74), 75), 76), 77), 78), 79), 80), 81), 82), 83), 84), 85), 86), 87), 88), 89), 90), 91), 92), 93), 94), 95), 96), 97), 98), 99), 100)
129129 }
130130 [totalPower, usersPower]
131131 }
132132
133133
134134 let LISTSEP = ":"
135135
136136 let DEFAULTQUORUM = 500000
137137
138138 let MAXTITLE = 250
139139
140140 let MAXVOTINGTIME = 1209600000
141141
142142 let DEFAULTFIRSTPROPOSAL = 1
143143
144144 let govIdxStart = 4
145145
146146 let govIdxEnd = 5
147147
148148 let govIdxQuorum = 6
149149
150150 let govIdxOptions = 7
151151
152152 let govStatusIdxTotalVotes = 4
153153
154154 let govStatusIdxIsCanceled = 5
155155
156156 func keyQuorumRequiredPercent () = "%s__quorumRequired"
157157
158158
159159 func keyLastProposalId () = "%s__proposalId"
160160
161161
162162 func keyFirstProposalId () = "%s__firstProposalId"
163163
164164
165165 func keyProposalStatusDataById (proposalId) = ("%s%d__proposalStatusData__" + toString(proposalId))
166166
167167
168168 func keyProposalDataById (proposalId) = ("%s%d__proposalData__" + toString(proposalId))
169169
170170
171171 func keyProposalVotesByIdAndOption (proposalId,opt) = makeString(["%s%d%d", "votesByOpt", toString(proposalId), toString(opt)], SEP)
172172
173173
174174 func keyProposalVotesByIdAndUser (proposalId,userAddr) = makeString(["%s%d%s", "votesByUser", toString(proposalId), userAddr], SEP)
175175
176176
177177 func keyProposalChoiceByIdAndUser (proposalId,userAddr) = makeString(["%s%d%s", "optionByUser", toString(proposalId), userAddr], SEP)
178178
179179
180180 func keyNumUniqueVotersByProposalId (proposalId) = ("%s%d__numVoters__" + toString(proposalId))
181181
182182
183183 func keyStatsAverUniqueVoters () = "%s%s%s__stats__avg__uniqueVoters"
184184
185185
186186 func keyStatsAverGwlVoted () = "%s%s%s__stats__avg__gwlVoted"
187187
188188
189189 func statusData (isVotingValid,winOption,winOptionVotes,totalVotes,canceledByTeam) = makeString(["%b%d%d%d%b", toString(isVotingValid), toString(winOption), toString(winOptionVotes), toString(totalVotes), toString(canceledByTeam)], SEP)
190190
191191
192192 func proposalData (proposalTxId,title,proposalTime,votingStartTime,votingEndTime,quorumInGwl,options) = makeString_2C(["%s%s%d%d%d%d%s", proposalTxId, title, toString(proposalTime), toString(votingStartTime), toString(votingEndTime), toString(quorumInGwl), options], SEP)
193193
194194
195195 func calcWinOption (proposalId,optionsList,isPrevOptional,oldChoice,optionalTotalOld,newChoice,newTotalByNewChoice) = {
196196 func findBest (acc,elem) = {
197197 let idx = value(indexOf(optionsList, elem))
198198 let val = if (isPrevOptional)
199199 then if ((idx == newChoice))
200200 then newTotalByNewChoice
201201 else getIntOrElse(keyProposalVotesByIdAndOption(proposalId, idx), 0)
202202 else if ((idx == value(oldChoice)))
203203 then optionalTotalOld
204204 else if ((idx == newChoice))
205205 then newTotalByNewChoice
206206 else getIntOrElse(keyProposalVotesByIdAndOption(proposalId, idx), 0)
207207 if ((acc._2 > val))
208208 then acc
209209 else $Tuple2(idx, val)
210210 }
211211
212212 let $l = optionsList
213213 let $s = size($l)
214214 let $acc0 = $Tuple2(0, 0)
215215 func $f0_1 ($a,$i) = if (($i >= $s))
216216 then $a
217217 else findBest($a, $l[$i])
218218
219219 func $f0_2 ($a,$i) = if (($i >= $s))
220220 then $a
221221 else throw("List size exceeds 10")
222222
223223 $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)
224224 }
225225
226226
227227 func updateStatusData (isCanceledStr,isValid,newWinOpt,newTotalVotes) = makeString(["%b%d%d%d%b", toString(isValid), toString(newWinOpt._1), toString(newWinOpt._2), toString(newTotalVotes), isCanceledStr], SEP)
228228
229229
230230 @Callable(i)
231231 func constructorV1 (restAddr,quorumReqPerc) = if ((i.caller != this))
232232 then throw("Permission denied")
233233 else [StringEntry(keyRestAddress(), restAddr), IntegerEntry(keyQuorumRequiredPercent(), quorumReqPerc)]
234234
235235
236236
237237 @Callable(i)
238238 func castVote (proposalId,choice) = {
239239 let userAddressStr = toString(i.caller)
240240 let dynamicData = split(getStringOrFail(this, keyProposalStatusDataById(proposalId)), SEP)
241241 if ((dynamicData[govStatusIdxIsCanceled] == "true"))
242242 then throw("Voting is canceled by team")
243243 else {
244244 let propData = split_4C(getStringOrFail(this, keyProposalDataById(proposalId)), SEP)
245245 let start = parseIntValue(propData[govIdxStart])
246246 let end = parseIntValue(propData[govIdxEnd])
247247 let now = lastBlock.timestamp
248248 if ((start > now))
249249 then throw("Voting not started yet")
250250 else if ((now >= end))
251251 then throw("Voting already finished")
252252 else {
253253 let availableOptions = split(propData[govIdxOptions], LISTSEP)
254254 let numOptions = size(availableOptions)
255255 if ((1 >= numOptions))
256256 then throw("Too few choices to vote")
257257 else if ((choice >= numOptions))
258258 then throw(("Unknown choice! Must be 0.." + toString((numOptions - 1))))
259259 else {
260260 let eff = getVotingPower(userAddressStr)
261261 let gwlAmt = eff[IdxEffUser]
262262 if ((0 >= gwlAmt))
263263 then throw("You need staked lands to vote")
264264 else {
265265 let gwlTotal = eff[IdxEffTotal]
266266 let oldChoice = getInteger(keyProposalChoiceByIdAndUser(proposalId, userAddressStr))
267267 let oldUserVotes = if (!(isDefined(oldChoice)))
268268 then 0
269269 else getIntOrElse(keyProposalVotesByIdAndUser(proposalId, userAddressStr), 0)
270270 let oldTotalByOldChoice = if (isDefined(oldChoice))
271271 then getIntOrElse(keyProposalVotesByIdAndOption(proposalId, value(oldChoice)), 0)
272272 else 0
273273 let oldTotalByNewChoice = getIntOrElse(keyProposalVotesByIdAndOption(proposalId, choice), 0)
274274 let oldTotal = parseIntValue(dynamicData[govStatusIdxTotalVotes])
275275 let newTotalByOldChoice = if (!(isDefined(oldChoice)))
276276 then 0
277277 else ((oldTotalByOldChoice - oldUserVotes) + (if ((value(oldChoice) == choice))
278278 then gwlAmt
279279 else 0))
280280 let newTotalByNewChoice = if (if (isDefined(oldChoice))
281281 then (value(oldChoice) == choice)
282282 else false)
283283 then newTotalByOldChoice
284284 else (oldTotalByNewChoice + gwlAmt)
285285 let newTotal = ((oldTotal - oldUserVotes) + gwlAmt)
286286 let isQuorumReached = (newTotal >= parseIntValue(propData[govIdxQuorum]))
287287 let numVotersByProposalId = getIntOrElse(keyNumUniqueVotersByProposalId(proposalId), 0)
288288 let oldAverUniqueVoters6 = getIntOrElse(keyStatsAverUniqueVoters(), 0)
289289 let numProposals = ((getIntegerValue(keyLastProposalId()) - valueOrElse(getInteger(keyFirstProposalId()), DEFAULTFIRSTPROPOSAL)) + 1)
290290 let uniqueDiff = if ((oldUserVotes == 0))
291291 then 1
292292 else 0
293293 let newAverUniqueVoters6 = (oldAverUniqueVoters6 + fraction(uniqueDiff, MULT6, numProposals))
294294 let oldAverGwl = getIntOrElse(keyStatsAverGwlVoted(), 0)
295295 let newAverGwl = (oldAverGwl + ((gwlAmt - oldUserVotes) / numProposals))
296296 let isPrevOptional = if (!(isDefined(oldChoice)))
297297 then true
298298 else (value(oldChoice) == choice)
299299 let optionalTotalOld = if (isPrevOptional)
300300 then nil
301301 else [IntegerEntry(keyProposalVotesByIdAndOption(proposalId, value(oldChoice)), newTotalByOldChoice)]
302302 let winOpt = calcWinOption(proposalId, availableOptions, isPrevOptional, oldChoice, newTotalByOldChoice, choice, newTotalByNewChoice)
303303 let releaseTime = max([end, getIntOrElse(keyUserGwlReleaseTime(userAddressStr), 0)])
304304 $Tuple2(([IntegerEntry(keyProposalChoiceByIdAndUser(proposalId, userAddressStr), choice), IntegerEntry(keyProposalVotesByIdAndUser(proposalId, userAddressStr), gwlAmt), IntegerEntry(keyProposalVotesByIdAndOption(proposalId, choice), newTotalByNewChoice), IntegerEntry(keyNumUniqueVotersByProposalId(proposalId), (numVotersByProposalId + uniqueDiff)), IntegerEntry(keyUserGwlReleaseTime(userAddressStr), releaseTime), IntegerEntry(keyStatsAverUniqueVoters(), newAverUniqueVoters6), IntegerEntry(keyStatsAverGwlVoted(), newAverGwl), StringEntry(keyProposalStatusDataById(proposalId), updateStatusData(dynamicData[govStatusIdxIsCanceled], isQuorumReached, winOpt, newTotal))] ++ optionalTotalOld), unit)
305305 }
306306 }
307307 }
308308 }
309309 }
310310
311311
312312
313313 @Callable(i)
314314 func initiateVoting (title,votingStartTime,votingEndTime,optionsList) = if ((i.caller != this))
315315 then throw("Permission denied")
316316 else if ((size(i.payments) != 0))
317317 then throw("governance doesn't require any payments")
318318 else {
319319 let proposalTxId = toBase58String(i.transactionId)
320320 if ((title == ""))
321321 then throw("Title is empty")
322322 else if ((size(title) > MAXTITLE))
323323 then throw("Too long title")
324324 else {
325325 let proposalTime = lastBlock.timestamp
326326 if ((proposalTime > votingStartTime))
327327 then throw(((("votingStartTime=" + toString(votingStartTime)) + " < proposalTime=") + toString(proposalTime)))
328328 else if ((votingStartTime > votingEndTime))
329329 then throw(((("votingEndTime=" + toString(votingEndTime)) + " < votingStartTime=") + toString(votingStartTime)))
330330 else if (((votingEndTime - votingStartTime) > MAXVOTINGTIME))
331331 then throw(((("Voting period exceeds max: " + toString((votingEndTime - votingStartTime))) + " > ") + toString(MAXVOTINGTIME)))
332332 else if ((1 >= size(optionsList)))
333333 then throw("Too few choices to vote")
334334 else {
335335 let eff = getVotingPower("")
336336 let gPiecesTotal = eff[IdxEffTotal]
337337 let quorum = getIntOrElse(keyQuorumRequiredPercent(), DEFAULTQUORUM)
338338 let quorumInGpieces = fraction(quorum, gPiecesTotal, MULT6)
339339 let proposalId = (getIntOrElse(keyLastProposalId(), 0) + 1)
340340 let optionsStr = makeString(optionsList, LISTSEP)
341341 $Tuple2([IntegerEntry(keyLastProposalId(), proposalId), StringEntry(keyProposalStatusDataById(proposalId), statusData(false, 0, 0, 0, false)), StringEntry(keyProposalDataById(proposalId), proposalData(proposalTxId, toBase16String(toBytes(title)), proposalTime, votingStartTime, votingEndTime, quorumInGpieces, optionsStr))], proposalTxId)
342342 }
343343 }
344344 }
345345
346346
347347
348348 @Callable(i)
349349 func cancelVoting (proposalId) = if ((i.caller != this))
350350 then throw("not authorized")
351351 else {
352352 let currentData = getStringOrFail(this, keyProposalStatusDataById(proposalId))
353353 let updatedData = ((take(currentData, value(lastIndexOf(currentData, SEP))) + SEP) + "true")
354354 $Tuple2([StringEntry(keyProposalStatusDataById(proposalId), updatedData)], unit)
355355 }
356356
357357

github/deemru/w8io/169f3d6 
67.45 ms