tx · 4ey9kFvkF3YadfYHJ9QfATr3LvnvKiRUxjhrd3tcswrH 3MuS6qVvhBR6wSynFRdcE3fVqmGBjoc7Hhx: -0.02200000 Waves 2023.07.27 13:55 [2684165] smart account 3MuS6qVvhBR6wSynFRdcE3fVqmGBjoc7Hhx > SELF 0.00000000 Waves
{ "type": 13, "id": "4ey9kFvkF3YadfYHJ9QfATr3LvnvKiRUxjhrd3tcswrH", "fee": 2200000, "feeAssetId": null, "timestamp": 1690455453311, "version": 2, "chainId": 84, "sender": "3MuS6qVvhBR6wSynFRdcE3fVqmGBjoc7Hhx", "senderPublicKey": "62CHk4MqTdq3LqeUycy7TPnpvwrjgerSa2FqAY2EafXn", "proofs": [ "2g8ou1AmcFzwcKhQuYVtQ8kqjkz3gGzx6zQ6dtfE21xfhKpEMhqy6uJKsEAAzKGJ28bvp2Bg9oYtT9zsYhe7Jpb9" ], "script": "base64:BgIrCAISBQoDCAEIEgMKAQgSBAoCCAQSAwoBCBIDCgEIEgUKAwgBCBIECgIIATAACXNlcGFyYXRvcgICX18ABU1VTFQ4AIDC1y8BB3dyYXBFcnIBA21zZwkAuQkCCQDMCAICGHZvdGluZ192ZXJpZmllZF92Mi5yaWRlOgkAzAgCBQNtc2cFA25pbAIBIAEIdGhyb3dFcnIBA21zZwkAAgEJAQd3cmFwRXJyAQUDbXNnAQVhc0ludAEDdmFsBAckbWF0Y2gwBQN2YWwDCQABAgUHJG1hdGNoMAIDSW50BAZ2YWxJbnQFByRtYXRjaDAFBnZhbEludAkAAgECG0ZhaWxlZCB0byBjYXN0IGludG8gSW50ZWdlcgEQZ2V0SW50ZWdlck9yWmVybwIHYWRkcmVzcwNrZXkJAQt2YWx1ZU9yRWxzZQIJAJoIAgUHYWRkcmVzcwUDa2V5AAABEGdldEludGVnZXJPckZhaWwCB2FkZHJlc3MDa2V5CQETdmFsdWVPckVycm9yTWVzc2FnZQIJAJoIAgUHYWRkcmVzcwUDa2V5CQEHd3JhcEVycgEJAKwCAgUDa2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EPa2V5Vm90aW5nUmV3YXJkAwUNY2FsbGVyQWRkcmVzcwUHYXNzZXRJZAUFaW5kZXgFA25pbAkBCHRocm93RXJyAQIQbm90aGluZyB0byBjbGFpbQUMcmV3YXJkQWN0aW9uCQACAQIkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuAQJ0eAEGdmVyaWZ5AAQPdGFyZ2V0UHVibGljS2V5BAckbWF0Y2gwCQEWbWFuYWdlclB1YmxpY0tleU9yVW5pdAADCQABAgUHJG1hdGNoMAIKQnl0ZVZlY3RvcgQCcGsFByRtYXRjaDAFAnBrAwkAAQIFByRtYXRjaDACBFVuaXQIBQJ0eA9zZW5kZXJQdWJsaWNLZXkJAAIBAgtNYXRjaCBlcnJvcgkA9AMDCAUCdHgJYm9keUJ5dGVzCQCRAwIIBQJ0eAZwcm9vZnMAAAUPdGFyZ2V0UHVibGljS2V53B5nmw==", "height": 2684165, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: CtTHQp6sU4V41BKz7F6wTwNPUnRDPqMu21ybf9aumc6o Next: FnjdA9Rj9FxjWAKpa45AtPk5xfNBPzmKCN2dqmAzu8xx Full:
Old | New | Differences | |
---|---|---|---|
1 | - | {-# STDLIB_VERSION | |
1 | + | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let | |
4 | + | let separator = "__" | |
5 | 5 | ||
6 | - | let | |
6 | + | let MULT8 = 100000000 | |
7 | 7 | ||
8 | - | func wrapErr ( | |
8 | + | func wrapErr (msg) = makeString(["voting_verified_v2.ride:", msg], " ") | |
9 | 9 | ||
10 | 10 | ||
11 | - | func throwErr ( | |
11 | + | func throwErr (msg) = throw(wrapErr(msg)) | |
12 | 12 | ||
13 | 13 | ||
14 | - | let ADMIN_LIST_SIZE = 5 | |
15 | - | ||
16 | - | let QUORUM = 3 | |
17 | - | ||
18 | - | let TXID_BYTES_LENGTH = 32 | |
19 | - | ||
20 | - | func keyAllowedTxIdVotePrefix (txId) = makeString(["%s%s%s", "allowTxId", txId], SEP) | |
14 | + | func asInt (val) = match val { | |
15 | + | case valInt: Int => | |
16 | + | valInt | |
17 | + | case _ => | |
18 | + | throw("Failed to cast into Integer") | |
19 | + | } | |
21 | 20 | ||
22 | 21 | ||
23 | - | func | |
22 | + | func getIntegerOrZero (address,key) = valueOrElse(getInteger(address, key), 0) | |
24 | 23 | ||
25 | 24 | ||
26 | - | func | |
25 | + | func getIntegerOrFail (address,key) = valueOrErrorMessage(getInteger(address, key), wrapErr((key + " is not defined"))) | |
27 | 26 | ||
28 | 27 | ||
29 | - | func | |
28 | + | func getStringOrEmpty (address,key) = valueOrElse(getString(address, key), "") | |
30 | 29 | ||
31 | 30 | ||
32 | - | func getAdminVote (prefix,admin) = { | |
33 | - | let voteKey = keyFullAdminVote(prefix, admin) | |
34 | - | valueOrElse(getInteger(voteKey), 0) | |
31 | + | func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), wrapErr((key + " is not defined"))) | |
32 | + | ||
33 | + | ||
34 | + | let keyBoostingContract = makeString(["%s", "boostingContract"], separator) | |
35 | + | ||
36 | + | let keyEmissionContract = makeString(["%s", "emissionContract"], separator) | |
37 | + | ||
38 | + | let keyAssetsStoreContract = makeString(["%s", "assetsStoreContract"], separator) | |
39 | + | ||
40 | + | let boostingContract = addressFromStringValue(getStringValue(keyBoostingContract)) | |
41 | + | ||
42 | + | let emissionContract = addressFromStringValue(getStringValue(keyEmissionContract)) | |
43 | + | ||
44 | + | let assetsStoreContract = addressFromStringValue(getStringValue(keyAssetsStoreContract)) | |
45 | + | ||
46 | + | let keyEmissionConfig = makeString(["%s", "config"], separator) | |
47 | + | ||
48 | + | let wxAssetIdStr = split(getStringOrFail(emissionContract, keyEmissionConfig), separator)[1] | |
49 | + | ||
50 | + | let wxAssetId = fromBase58String(wxAssetIdStr) | |
51 | + | ||
52 | + | let keyVotingThresholdAdd = makeString(["%s%s", "votingThreshold", "add"], separator) | |
53 | + | ||
54 | + | let keyVotingThresholdRemove = makeString(["%s%s", "votingThreshold", "remove"], separator) | |
55 | + | ||
56 | + | let keyPeriodLengthRemove = makeString(["%s", "periodLengthRemove"], separator) | |
57 | + | ||
58 | + | let keyMaxPeriodLength = makeString(["%s", "maxPeriodLength"], separator) | |
59 | + | ||
60 | + | let keyMinPeriodLength = makeString(["%s", "minPeriodLength"], separator) | |
61 | + | ||
62 | + | func keyVotingRewardAssetId (assetId,index) = makeString(["%s%s%d", "votingRewardAssetId", assetId, toString(index)], separator) | |
63 | + | ||
64 | + | ||
65 | + | func keyVotingReward (userAddress,assetId,index) = makeString(["%s%s%s%d", "votingReward", toString(userAddress), assetId, toString(index)], separator) | |
66 | + | ||
67 | + | ||
68 | + | func keyTotalVotingReward (assetId,index) = makeString(["%s%s%d", "totalVotingReward", assetId, toString(index)], separator) | |
69 | + | ||
70 | + | ||
71 | + | let keyFinalizeCallRewardAmount = makeString(["%s", "finalizeCallRewardAmount"], separator) | |
72 | + | ||
73 | + | let keyMinSuggestRemoveBalance = makeString(["%s", "minSuggestRemoveBalance"], separator) | |
74 | + | ||
75 | + | func keyCurrentIndex (assetId) = makeString(["%s%s", "currentIndex", assetId], separator) | |
76 | + | ||
77 | + | ||
78 | + | func keyVote (assetId,index,caller) = makeString(["%s%s%d%s", "vote", assetId, toString(index), toString(caller)], separator) | |
79 | + | ||
80 | + | ||
81 | + | func voteValue (inFavor,gwxAmount) = makeString(["%s%d", toString(inFavor), toString(gwxAmount)], separator) | |
82 | + | ||
83 | + | ||
84 | + | func keySuggestIssuer (assetId,index) = makeString(["%s%s%d", "suggestIssuer", assetId, toString(index)], separator) | |
85 | + | ||
86 | + | ||
87 | + | func keyClaimHistory (userAddress,assetId,index) = makeString(["%s%s%s%d", "history", toString(userAddress), assetId, toString(index)], separator) | |
88 | + | ||
89 | + | ||
90 | + | let keyFeePerBlock = makeString(["%s", "feePerBlock"], separator) | |
91 | + | ||
92 | + | let feePerBlock = getIntegerOrFail(this, keyFeePerBlock) | |
93 | + | ||
94 | + | let keyMinWxMinForSuggestAddAmountRequired = makeString(["%s", "wxMinForSuggestAddAmountRequired"], separator) | |
95 | + | ||
96 | + | let keyWxForSuggestRemoveAmountRequired = makeString(["%s", "wxForSuggestRemoveAmountRequired"], separator) | |
97 | + | ||
98 | + | func keyVotingInfo (assetId,index) = makeString(["%s%s%d", "votingInfo", assetId, toString(index)], separator) | |
99 | + | ||
100 | + | ||
101 | + | func votingInfoValue (isRewardExist,rewardAssetId,rewardAmount,votingType,status,votingStartHeight,votingEndHeight,votesQuorum,votesFor,votesAgainst) = makeString(["%s%s%d%s%s%d%d%d%d%d", toString(isRewardExist), rewardAssetId, toString(rewardAmount), votingType, status, toString(votingStartHeight), toString(votingEndHeight), toString(votesQuorum), toString(votesFor), toString(votesAgainst)], separator) | |
102 | + | ||
103 | + | ||
104 | + | func keyAssetImage (assetId) = makeString(["%s%s", "assetImage", assetId], separator) | |
105 | + | ||
106 | + | ||
107 | + | func getUserGwxAmountAtHeight (userAddress,targetHeight) = { | |
108 | + | let gwxAmount = invoke(boostingContract, "getUserGwxAmountAtHeightREADONLY", [userAddress, targetHeight], nil) | |
109 | + | asInt(gwxAmount) | |
35 | 110 | } | |
36 | 111 | ||
37 | 112 | ||
38 | - | func getAdminsList () = match getString(this, keyAdminAddressList()) { | |
113 | + | func keyManagerVaultAddress () = "%s__managerVaultAddress" | |
114 | + | ||
115 | + | ||
116 | + | func keyManagerPublicKey () = "%s__managerPublicKey" | |
117 | + | ||
118 | + | ||
119 | + | func getManagerVaultAddressOrThis () = match getString(keyManagerVaultAddress()) { | |
39 | 120 | case s: String => | |
40 | - | | |
121 | + | addressFromStringValue(s) | |
41 | 122 | case _ => | |
42 | - | | |
123 | + | this | |
43 | 124 | } | |
44 | 125 | ||
45 | 126 | ||
46 | - | func isInAdminList (address) = containsElement(getAdminsList(), address) | |
47 | - | ||
48 | - | ||
49 | - | func genVotesKeysHelper (a,adminAddress) = { | |
50 | - | let $t012621286 = a | |
51 | - | let result = $t012621286._1 | |
52 | - | let prefix = $t012621286._2 | |
53 | - | $Tuple2((result :+ keyFullAdminVote(prefix, adminAddress)), prefix) | |
127 | + | func managerPublicKeyOrUnit () = { | |
128 | + | let managerVaultAddress = getManagerVaultAddressOrThis() | |
129 | + | match getString(managerVaultAddress, keyManagerPublicKey()) { | |
130 | + | case s: String => | |
131 | + | fromBase58String(s) | |
132 | + | case _: Unit => | |
133 | + | unit | |
134 | + | case _ => | |
135 | + | throw("Match error") | |
136 | + | } | |
54 | 137 | } | |
55 | 138 | ||
56 | 139 | ||
57 | - | func genVotesKeys (keyPrefix) = { | |
58 | - | let adminList = keyAdminAddressList() | |
59 | - | let $t014331517 = { | |
60 | - | let $l = getAdminsList() | |
61 | - | let $s = size($l) | |
62 | - | let $acc0 = $Tuple2(nil, keyPrefix) | |
63 | - | func $f0_1 ($a,$i) = if (($i >= $s)) | |
64 | - | then $a | |
65 | - | else genVotesKeysHelper($a, $l[$i]) | |
66 | - | ||
67 | - | func $f0_2 ($a,$i) = if (($i >= $s)) | |
68 | - | then $a | |
69 | - | else throw("List size exceeds 5") | |
70 | - | ||
71 | - | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5) | |
72 | - | } | |
73 | - | let result = $t014331517._1 | |
74 | - | let prefix = $t014331517._2 | |
75 | - | result | |
140 | + | func getVotingInfoParts (votingInfo) = { | |
141 | + | let votingInfoParts = split(votingInfo, separator) | |
142 | + | let isRewardExistStr = votingInfoParts[1] | |
143 | + | let isRewardExist = if ((isRewardExistStr == "true")) | |
144 | + | then true | |
145 | + | else false | |
146 | + | let rewardAssetId = votingInfoParts[2] | |
147 | + | let rewardAmount = parseIntValue(votingInfoParts[3]) | |
148 | + | let votingType = votingInfoParts[4] | |
149 | + | let status = votingInfoParts[5] | |
150 | + | let votingStartHeight = parseIntValue(votingInfoParts[6]) | |
151 | + | let votingEndHeight = parseIntValue(votingInfoParts[7]) | |
152 | + | let votesQuorum = parseIntValue(votingInfoParts[8]) | |
153 | + | let votesFor = parseIntValue(votingInfoParts[9]) | |
154 | + | let votesAgainst = parseIntValue(votingInfoParts[10]) | |
155 | + | $Tuple10(isRewardExist, rewardAssetId, rewardAmount, votingType, status, votingStartHeight, votingEndHeight, votesQuorum, votesFor, votesAgainst) | |
76 | 156 | } | |
77 | 157 | ||
78 | 158 | ||
79 | - | func countVotesHelper (result,voteKey) = (result + valueOrElse(getInteger(voteKey), 0)) | |
80 | - | ||
81 | - | ||
82 | - | func countVotes (prefix) = { | |
83 | - | let votes = genVotesKeys(prefix) | |
84 | - | let $l = votes | |
85 | - | let $s = size($l) | |
86 | - | let $acc0 = 0 | |
87 | - | func $f0_1 ($a,$i) = if (($i >= $s)) | |
88 | - | then $a | |
89 | - | else countVotesHelper($a, $l[$i]) | |
90 | - | ||
91 | - | func $f0_2 ($a,$i) = if (($i >= $s)) | |
92 | - | then $a | |
93 | - | else throw("List size exceeds 5") | |
94 | - | ||
95 | - | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5) | |
159 | + | func votingExistChecks (assetId,currentIndex) = { | |
160 | + | let votingInfo = valueOrErrorMessage(getString(keyVotingInfo(assetId, currentIndex)), wrapErr("voting info not found")) | |
161 | + | let votingInfoArray = split(votingInfo, separator) | |
162 | + | let status = votingInfoArray[5] | |
163 | + | let votingEndHeight = valueOrErrorMessage(parseIntValue(votingInfoArray[7]), wrapErr("voting start height not found")) | |
164 | + | let suggestIssuer = valueOrErrorMessage(getString(keySuggestIssuer(assetId, currentIndex)), wrapErr("voting issuer not found")) | |
165 | + | let checks = [if ((status == "inProgress")) | |
166 | + | then true | |
167 | + | else throwErr("no voting in progress"), if ((votingEndHeight > height)) | |
168 | + | then true | |
169 | + | else throwErr("voting expired")] | |
170 | + | if ((checks == checks)) | |
171 | + | then $Tuple3(status, votingEndHeight, suggestIssuer) | |
172 | + | else throw("Strict value is not equal to itself.") | |
96 | 173 | } | |
97 | 174 | ||
98 | 175 | ||
99 | - | func clearVotesHelper (result,key) = (result :+ DeleteEntry(key)) | |
100 | - | ||
101 | - | ||
102 | - | func getClearVoteEntries (prefix) = { | |
103 | - | let votes = genVotesKeys(prefix) | |
104 | - | let $l = votes | |
105 | - | let $s = size($l) | |
106 | - | let $acc0 = nil | |
107 | - | func $f0_1 ($a,$i) = if (($i >= $s)) | |
108 | - | then $a | |
109 | - | else clearVotesHelper($a, $l[$i]) | |
110 | - | ||
111 | - | func $f0_2 ($a,$i) = if (($i >= $s)) | |
112 | - | then $a | |
113 | - | else throw("List size exceeds 5") | |
114 | - | ||
115 | - | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5) | |
176 | + | func calculateReward (voter,assetId,index) = { | |
177 | + | let voteKey = keyVote(assetId, index, voter) | |
178 | + | let lastVote = valueOrErrorMessage(getString(voteKey), wrapErr("you have not voted")) | |
179 | + | let lastVoteParts = split(lastVote, separator) | |
180 | + | let gwxAmount = parseIntValue(lastVoteParts[2]) | |
181 | + | let votingInfoStr = valueOrErrorMessage(getString(keyVotingInfo(assetId, index)), wrapErr("voting info not found")) | |
182 | + | let votingParts = getVotingInfoParts(votingInfoStr) | |
183 | + | let votesFor = votingParts._9 | |
184 | + | let votesAgainst = votingParts._10 | |
185 | + | let partOfTheTotalVotesX8 = fraction(gwxAmount, MULT8, (votesFor + votesAgainst)) | |
186 | + | let totalVotingReward = valueOrElse(getInteger(keyTotalVotingReward(assetId, index)), 0) | |
187 | + | let voterRewardAmount = fraction(partOfTheTotalVotesX8, totalVotingReward, MULT8, FLOOR) | |
188 | + | voterRewardAmount | |
116 | 189 | } | |
117 | 190 | ||
118 | 191 | ||
119 | - | func voteINTERNAL (callerAddressString,keyPrefix,minVotes,voteResult) = { | |
120 | - | let voteKey = keyFullAdminVote(keyPrefix, callerAddressString) | |
121 | - | let adminCurrentVote = getAdminVote(keyPrefix, callerAddressString) | |
122 | - | let err = if (!(isInAdminList(callerAddressString))) | |
123 | - | then throwErr((("Address: " + callerAddressString) + " not in Admin list")) | |
124 | - | else if ((adminCurrentVote == 1)) | |
125 | - | then throwErr((voteKey + " you already voted")) | |
126 | - | else unit | |
127 | - | if ((err == err)) | |
192 | + | @Callable(i) | |
193 | + | func suggestAdd (assetId,periodLength,assetImage) = { | |
194 | + | let wxPayment = i.payments[0] | |
195 | + | let wxPaymentAssetId = value(wxPayment.assetId) | |
196 | + | let wxPaymentAmount = value(wxPayment.amount) | |
197 | + | let minPeriodLength = getIntegerValue(keyMinPeriodLength) | |
198 | + | let maxPeriodLength = getIntegerValue(keyMaxPeriodLength) | |
199 | + | let tokenIsVerified = { | |
200 | + | let @ = invoke(assetsStoreContract, "isVerifiedREADONLY", [assetId], nil) | |
201 | + | if ($isInstanceOf(@, "Boolean")) | |
202 | + | then @ | |
203 | + | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
204 | + | } | |
205 | + | let checks = [if (if ((periodLength >= minPeriodLength)) | |
206 | + | then (maxPeriodLength >= periodLength) | |
207 | + | else false) | |
208 | + | then true | |
209 | + | else throwErr("invalid periodLength"), if ((tokenIsVerified == false)) | |
210 | + | then true | |
211 | + | else throwErr("token already verified"), if ((wxPaymentAmount > (periodLength * feePerBlock))) | |
212 | + | then true | |
213 | + | else throwErr("not enough wx for given period"), if ((wxPaymentAmount >= getIntegerValue(keyMinWxMinForSuggestAddAmountRequired))) | |
214 | + | then true | |
215 | + | else throwErr("payment less then min for suggest")] | |
216 | + | if ((checks == checks)) | |
128 | 217 | then { | |
129 | - | let votes = countVotes(keyPrefix) | |
130 | - | if (((votes + 1) >= minVotes)) | |
218 | + | let currentIndexKey = keyCurrentIndex(assetId) | |
219 | + | let currentIndex = getInteger(currentIndexKey) | |
220 | + | let newIndex = if (isDefined(currentIndex)) | |
221 | + | then (value(currentIndex) + 1) | |
222 | + | else 0 | |
223 | + | let $t087849424 = if ((size(i.payments) > 1)) | |
131 | 224 | then { | |
132 | - | let clearVoteEntries = getClearVoteEntries(keyPrefix) | |
133 | - | (clearVoteEntries ++ voteResult) | |
225 | + | let votingRewardPayment = i.payments[1] | |
226 | + | let votingRewardPaymentAssetId = toBase58String(value(votingRewardPayment.assetId)) | |
227 | + | let votingRewardPaymentAmount = value(votingRewardPayment.amount) | |
228 | + | $Tuple4(true, votingRewardPaymentAssetId, votingRewardPaymentAmount, [StringEntry(keyVotingRewardAssetId(assetId, newIndex), votingRewardPaymentAssetId), IntegerEntry(keyTotalVotingReward(assetId, newIndex), votingRewardPaymentAmount)]) | |
134 | 229 | } | |
135 | - | else [IntegerEntry(voteKey, 1)] | |
230 | + | else $Tuple4(false, "EMPTY", 0, nil) | |
231 | + | let isRewardExist = $t087849424._1 | |
232 | + | let rewardAssetId = $t087849424._2 | |
233 | + | let rewardAmount = $t087849424._3 | |
234 | + | let votingRewardActions = $t087849424._4 | |
235 | + | let votesQuorum = valueOrErrorMessage(getInteger(keyVotingThresholdAdd), wrapErr("votingThresholdAdd not set")) | |
236 | + | let votingInfo = votingInfoValue(isRewardExist, rewardAssetId, rewardAmount, "verification", "inProgress", height, (height + periodLength), votesQuorum, 0, 0) | |
237 | + | let finalizeCallRewardAmount = getIntegerValue(keyFinalizeCallRewardAmount) | |
238 | + | let burnWxAmount = (wxPaymentAmount - finalizeCallRewardAmount) | |
239 | + | ([IntegerEntry(currentIndexKey, newIndex), StringEntry(keySuggestIssuer(assetId, newIndex), toString(i.caller)), StringEntry(keyVotingInfo(assetId, newIndex), votingInfo), StringEntry(keyAssetImage(assetId), assetImage), Burn(wxPaymentAssetId, burnWxAmount)] ++ votingRewardActions) | |
136 | 240 | } | |
137 | 241 | else throw("Strict value is not equal to itself.") | |
138 | 242 | } | |
139 | 243 | ||
140 | 244 | ||
141 | - | func keyCalculatorAddress () = "%s__calculator" | |
142 | - | ||
143 | - | ||
144 | - | func keyProxyTreasuryAddress () = "%s__proxyTreasury" | |
145 | - | ||
146 | - | ||
147 | - | func keyChildAddress () = "%s__child" | |
148 | - | ||
149 | - | ||
150 | - | func keyBlockProcessingReward () = "%s__blockProcessingReward" | |
151 | - | ||
152 | - | ||
153 | - | func keyNextBlockToProcess () = "%s__nextBlockToProcess" | |
154 | - | ||
155 | - | ||
156 | - | func keyLpAssetId () = "%s__lpAssetId" | |
157 | - | ||
158 | - | ||
159 | - | let calculatorAddressOption = match getString(this, keyCalculatorAddress()) { | |
160 | - | case s: String => | |
161 | - | addressFromString(s) | |
162 | - | case _: Unit => | |
163 | - | unit | |
164 | - | case _ => | |
165 | - | throw("Match error") | |
166 | - | } | |
167 | - | ||
168 | - | let calculatorAddressOrFail = valueOrErrorMessage(calculatorAddressOption, wrapErr("invalid calculator address")) | |
169 | - | ||
170 | - | let proxyTreasuryAddressOption = match getString(this, keyProxyTreasuryAddress()) { | |
171 | - | case s: String => | |
172 | - | addressFromString(s) | |
173 | - | case _: Unit => | |
174 | - | unit | |
175 | - | case _ => | |
176 | - | throw("Match error") | |
177 | - | } | |
178 | - | ||
179 | - | let proxyTreasuryAddressOrFail = valueOrErrorMessage(proxyTreasuryAddressOption, wrapErr("invalid proxy treasury address")) | |
180 | - | ||
181 | - | func keyConfigAddress () = "%s__config" | |
182 | - | ||
183 | - | ||
184 | - | func keyChildrenAddress () = "contract_children" | |
185 | - | ||
186 | - | ||
187 | - | func keyVotingResultAddress () = "contract_voting_result" | |
188 | - | ||
189 | - | ||
190 | - | func keyProposalAllowBroadcast (address,txId) = ((("proposal_allow_broadcast_" + toString(address)) + "_") + toBase58String(txId)) | |
191 | - | ||
192 | - | ||
193 | - | func keyInvestedByUser (childAddress,userAddress) = makeString(["investor", toString(childAddress), toString(userAddress)], "_") | |
194 | - | ||
195 | - | ||
196 | - | let configAddressOption = match getString(this, keyConfigAddress()) { | |
197 | - | case s: String => | |
198 | - | addressFromString(s) | |
199 | - | case _: Unit => | |
200 | - | unit | |
201 | - | case _ => | |
202 | - | throw("Match error") | |
203 | - | } | |
204 | - | ||
205 | - | let configAddressOrFail = valueOrErrorMessage(configAddressOption, wrapErr("invalid config address")) | |
206 | - | ||
207 | - | let votingResultAddressOption = match configAddressOption { | |
208 | - | case a: Address => | |
209 | - | match getString(a, keyVotingResultAddress()) { | |
210 | - | case s: String => | |
211 | - | addressFromString(s) | |
212 | - | case _: Unit => | |
213 | - | unit | |
214 | - | case _ => | |
215 | - | throw("Match error") | |
216 | - | } | |
217 | - | case _: Unit => | |
218 | - | unit | |
219 | - | case _ => | |
220 | - | throw("Match error") | |
221 | - | } | |
222 | - | ||
223 | - | let votingResultAddressOrFail = valueOrErrorMessage(votingResultAddressOption, wrapErr("invalid voting result address")) | |
224 | - | ||
225 | - | let childrenAddressOption = match configAddressOption { | |
226 | - | case a: Address => | |
227 | - | match getString(a, keyChildrenAddress()) { | |
228 | - | case s: String => | |
229 | - | addressFromString(s) | |
230 | - | case _: Unit => | |
231 | - | unit | |
232 | - | case _ => | |
233 | - | throw("Match error") | |
234 | - | } | |
235 | - | case _: Unit => | |
236 | - | unit | |
237 | - | case _ => | |
238 | - | throw("Match error") | |
239 | - | } | |
240 | - | ||
241 | - | let childrenAddressOrFail = valueOrErrorMessage(childrenAddressOption, wrapErr("invalid children address")) | |
242 | - | ||
243 | - | let lpAssetIdOption = match getString(this, keyLpAssetId()) { | |
244 | - | case s: String => | |
245 | - | fromBase58String(s) | |
246 | - | case _: Unit => | |
247 | - | unit | |
248 | - | case _ => | |
249 | - | throw("Match error") | |
250 | - | } | |
251 | - | ||
252 | - | let lpAssetIdOrFail = valueOrErrorMessage(lpAssetIdOption, wrapErr("invalid lpAssetId")) | |
253 | - | ||
254 | - | func onlyAddress (i,address) = if ((i.caller == address)) | |
255 | - | then true | |
256 | - | else throwErr("permission denied") | |
257 | - | ||
258 | - | ||
259 | - | func onlyThis (i) = onlyAddress(i, this) | |
260 | - | ||
261 | - | ||
262 | - | func onlyCalculator (i) = onlyAddress(i, calculatorAddressOrFail) | |
263 | - | ||
264 | 245 | ||
265 | 246 | @Callable(i) | |
266 | - | func stringEntry (key,val) = if (onlyCalculator(i)) | |
267 | - | then $Tuple2([StringEntry(key, val)], key) | |
268 | - | else $Tuple2(nil, unit) | |
247 | + | func suggestRemove (assetId) = { | |
248 | + | let gwxAmountAtNow = getUserGwxAmountAtHeight(toString(i.caller), height) | |
249 | + | let minSuggestRemoveBalance = getIntegerValue(keyMinSuggestRemoveBalance) | |
250 | + | let wxPayment = i.payments[0] | |
251 | + | let wxPaymentAssetId = value(wxPayment.assetId) | |
252 | + | let wxPaymentAmount = value(wxPayment.amount) | |
253 | + | let tokenIsVerified = { | |
254 | + | let @ = invoke(assetsStoreContract, "isVerifiedREADONLY", [assetId], nil) | |
255 | + | if ($isInstanceOf(@, "Boolean")) | |
256 | + | then @ | |
257 | + | else throw(($getType(@) + " couldn't be cast to Boolean")) | |
258 | + | } | |
259 | + | let checks = [if (tokenIsVerified) | |
260 | + | then true | |
261 | + | else throwErr("token not verified"), if ((gwxAmountAtNow >= minSuggestRemoveBalance)) | |
262 | + | then true | |
263 | + | else throwErr("not enough gWXes"), if ((wxPaymentAmount >= getIntegerValue(keyWxForSuggestRemoveAmountRequired))) | |
264 | + | then true | |
265 | + | else throwErr("payment less then min for suggest")] | |
266 | + | if ((checks == checks)) | |
267 | + | then { | |
268 | + | let currentIndexKey = keyCurrentIndex(assetId) | |
269 | + | let currentIndex = getInteger(currentIndexKey) | |
270 | + | let newIndex = if (isDefined(currentIndex)) | |
271 | + | then (value(currentIndex) + 1) | |
272 | + | else 0 | |
273 | + | let periodLength = valueOrErrorMessage(getInteger(keyPeriodLengthRemove), wrapErr("periodLengthRemove not set")) | |
274 | + | let votingEndHeight = (height + periodLength) | |
275 | + | let votesQuorum = valueOrErrorMessage(getInteger(keyVotingThresholdRemove), wrapErr("votingThresholdRemove not set")) | |
276 | + | let votingInfo = votingInfoValue(false, "EMPTY", 0, "deverification", "inProgress", height, (height + periodLength), votesQuorum, 0, 0) | |
277 | + | [IntegerEntry(currentIndexKey, newIndex), StringEntry(keySuggestIssuer(assetId, newIndex), toString(i.caller)), StringEntry(keyVotingInfo(assetId, newIndex), votingInfo)] | |
278 | + | } | |
279 | + | else throw("Strict value is not equal to itself.") | |
280 | + | } | |
269 | 281 | ||
270 | 282 | ||
271 | 283 | ||
272 | 284 | @Callable(i) | |
273 | - | func integerEntry (key,val) = if (onlyCalculator(i)) | |
274 | - | then $Tuple2([IntegerEntry(key, val)], key) | |
275 | - | else $Tuple2(nil, unit) | |
285 | + | func vote (assetId,inFavor) = { | |
286 | + | let currentIndexKey = keyCurrentIndex(assetId) | |
287 | + | let currentIndex = valueOrErrorMessage(getInteger(currentIndexKey), wrapErr("voting does not exist")) | |
288 | + | let votingInfo = votingExistChecks(assetId, currentIndex) | |
289 | + | if ((votingInfo == votingInfo)) | |
290 | + | then { | |
291 | + | let currentVotingEndHeight = votingInfo._2 | |
292 | + | let gwxAmountAtEnd = getUserGwxAmountAtHeight(toString(i.caller), currentVotingEndHeight) | |
293 | + | let voteKey = keyVote(assetId, currentIndex, i.caller) | |
294 | + | let checks = [if ((getString(voteKey) == unit)) | |
295 | + | then true | |
296 | + | else throwErr("You have already voted"), if ((gwxAmountAtEnd > 0)) | |
297 | + | then true | |
298 | + | else throw("You'll not have gWX at the end of voting")] | |
299 | + | if ((checks == checks)) | |
300 | + | then { | |
301 | + | let votingInfoStr = valueOrErrorMessage(getString(keyVotingInfo(assetId, currentIndex)), wrapErr("voting info not found")) | |
302 | + | let votingInfoParts = getVotingInfoParts(votingInfoStr) | |
303 | + | let votesFor = votingInfoParts._9 | |
304 | + | let votesAgainst = votingInfoParts._10 | |
305 | + | let $t01274512906 = if (inFavor) | |
306 | + | then $Tuple2((votesFor + gwxAmountAtEnd), votesAgainst) | |
307 | + | else $Tuple2(votesFor, (votesAgainst + gwxAmountAtEnd)) | |
308 | + | let newVotesFor = $t01274512906._1 | |
309 | + | let newVotesAgainst = $t01274512906._2 | |
310 | + | let newVotingInfoValue = votingInfoValue(votingInfoParts._1, votingInfoParts._2, votingInfoParts._3, votingInfoParts._4, votingInfoParts._5, votingInfoParts._6, votingInfoParts._7, votingInfoParts._8, newVotesFor, newVotesAgainst) | |
311 | + | let votingRewardAction = match getString(keyVotingRewardAssetId(assetId, currentIndex)) { | |
312 | + | case pk: String => | |
313 | + | [StringEntry(keyVotingReward(i.caller, assetId, currentIndex), voteValue(inFavor, gwxAmountAtEnd))] | |
314 | + | case _: Unit => | |
315 | + | nil | |
316 | + | case _ => | |
317 | + | throw("Match error") | |
318 | + | } | |
319 | + | ([StringEntry(voteKey, voteValue(inFavor, gwxAmountAtEnd)), StringEntry(keyVotingInfo(assetId, currentIndex), newVotingInfoValue)] ++ votingRewardAction) | |
320 | + | } | |
321 | + | else throw("Strict value is not equal to itself.") | |
322 | + | } | |
323 | + | else throw("Strict value is not equal to itself.") | |
324 | + | } | |
276 | 325 | ||
277 | 326 | ||
278 | 327 | ||
279 | 328 | @Callable(i) | |
280 | - | func booleanEntry (key,val) = if (onlyCalculator(i)) | |
281 | - | then $Tuple2([BooleanEntry(key, val)], key) | |
282 | - | else $Tuple2(nil, unit) | |
329 | + | func cancelVote (assetId) = { | |
330 | + | let currentIndexKey = keyCurrentIndex(assetId) | |
331 | + | let currentIndex = valueOrErrorMessage(getInteger(currentIndexKey), wrapErr("voting does not exist")) | |
332 | + | let voteKey = keyVote(assetId, currentIndex, i.caller) | |
333 | + | let lastVote = valueOrErrorMessage(getString(voteKey), wrapErr("you have not voted")) | |
334 | + | let lastVoteParts = split(lastVote, separator) | |
335 | + | let inFavor = lastVoteParts[1] | |
336 | + | let gwxAmount = parseIntValue(lastVoteParts[2]) | |
337 | + | let votingInfo = votingExistChecks(assetId, currentIndex) | |
338 | + | if ((votingInfo == votingInfo)) | |
339 | + | then { | |
340 | + | let checks = [if (if ((inFavor == "true")) | |
341 | + | then true | |
342 | + | else (inFavor == "false")) | |
343 | + | then true | |
344 | + | else throwErr("invalid vote")] | |
345 | + | if ((checks == checks)) | |
346 | + | then { | |
347 | + | let votingInfoStr = valueOrErrorMessage(getString(keyVotingInfo(assetId, currentIndex)), wrapErr("voting info not found")) | |
348 | + | let votingInfoParts = getVotingInfoParts(votingInfoStr) | |
349 | + | let votesFor = votingInfoParts._9 | |
350 | + | let votesAgainst = votingInfoParts._10 | |
351 | + | let $t01453114692 = if ((inFavor == "true")) | |
352 | + | then $Tuple2((votesFor - gwxAmount), votesAgainst) | |
353 | + | else $Tuple2(votesFor, (votesAgainst - gwxAmount)) | |
354 | + | let newVotesFor = $t01453114692._1 | |
355 | + | let newVotesAgainst = $t01453114692._2 | |
356 | + | let newVotingInfoValue = votingInfoValue(votingInfoParts._1, votingInfoParts._2, votingInfoParts._3, votingInfoParts._4, votingInfoParts._5, votingInfoParts._6, votingInfoParts._7, votingInfoParts._8, newVotesFor, newVotesAgainst) | |
357 | + | [StringEntry(keyVotingInfo(assetId, currentIndex), newVotingInfoValue), DeleteEntry(voteKey), DeleteEntry(keyVotingReward(i.caller, assetId, currentIndex))] | |
358 | + | } | |
359 | + | else throw("Strict value is not equal to itself.") | |
360 | + | } | |
361 | + | else throw("Strict value is not equal to itself.") | |
362 | + | } | |
283 | 363 | ||
284 | 364 | ||
285 | 365 | ||
286 | 366 | @Callable(i) | |
287 | - | func binaryEntry (key,val) = if (onlyCalculator(i)) | |
288 | - | then $Tuple2([BinaryEntry(key, val)], key) | |
289 | - | else $Tuple2(nil, unit) | |
367 | + | func finalize (assetId) = { | |
368 | + | let currentIndexKey = keyCurrentIndex(assetId) | |
369 | + | let currentIndex = valueOrElse(getInteger(currentIndexKey), 0) | |
370 | + | let votingThresholdAdd = valueOrErrorMessage(getInteger(keyVotingThresholdAdd), wrapErr("votingThresholdAdd not set")) | |
371 | + | let votingThresholdRemove = valueOrErrorMessage(getInteger(keyVotingThresholdRemove), wrapErr("votingThresholdRemove not set")) | |
372 | + | let votingInfoStr = valueOrErrorMessage(getString(keyVotingInfo(assetId, currentIndex)), wrapErr("voting info not found")) | |
373 | + | let votingInfoParts = getVotingInfoParts(votingInfoStr) | |
374 | + | let votingType = votingInfoParts._4 | |
375 | + | let status = votingInfoParts._5 | |
376 | + | let votingEndHeight = votingInfoParts._7 | |
377 | + | let votingQuorum = votingInfoParts._8 | |
378 | + | let votesFor = votingInfoParts._9 | |
379 | + | let votesAgainst = votingInfoParts._10 | |
380 | + | let checks = [if ((status == "inProgress")) | |
381 | + | then true | |
382 | + | else throwErr("voting not in progress"), if ((height >= votingEndHeight)) | |
383 | + | then true | |
384 | + | else throwErr("voting not finished"), if (isDefined(getString(keyAssetImage(assetId)))) | |
385 | + | then true | |
386 | + | else throwErr("asset image not set")] | |
387 | + | if ((checks == checks)) | |
388 | + | then { | |
389 | + | let votingAccepted = if (if (((votesFor + votesAgainst) >= votingQuorum)) | |
390 | + | then (votesFor > votesAgainst) | |
391 | + | else false) | |
392 | + | then true | |
393 | + | else false | |
394 | + | let newStatus = if (votingAccepted) | |
395 | + | then "accepted" | |
396 | + | else "rejected" | |
397 | + | let assetImage = getStringValue(keyAssetImage(assetId)) | |
398 | + | let isVotingAccepted = if (votingAccepted) | |
399 | + | then { | |
400 | + | let votingAcceptedInvokes = if ((votingType == "verification")) | |
401 | + | then invoke(assetsStoreContract, "createOrUpdate", [assetId, assetImage, true], nil) | |
402 | + | else invoke(assetsStoreContract, "setVerified", [assetId, false], nil) | |
403 | + | votingAcceptedInvokes | |
404 | + | } | |
405 | + | else nil | |
406 | + | if ((isVotingAccepted == isVotingAccepted)) | |
407 | + | then { | |
408 | + | let newVotingInfoValue = votingInfoValue(votingInfoParts._1, votingInfoParts._2, votingInfoParts._3, votingInfoParts._4, newStatus, votingInfoParts._6, votingInfoParts._7, votingInfoParts._8, votingInfoParts._9, votingInfoParts._10) | |
409 | + | let finalizeCallRewardAmount = getIntegerValue(keyFinalizeCallRewardAmount) | |
410 | + | [StringEntry(keyVotingInfo(assetId, currentIndex), newVotingInfoValue), ScriptTransfer(i.caller, finalizeCallRewardAmount, wxAssetId)] | |
411 | + | } | |
412 | + | else throw("Strict value is not equal to itself.") | |
413 | + | } | |
414 | + | else throw("Strict value is not equal to itself.") | |
415 | + | } | |
290 | 416 | ||
291 | 417 | ||
292 | 418 | ||
293 | 419 | @Callable(i) | |
294 | - | func deleteEntry (key) = if (onlyCalculator(i)) | |
295 | - | then $Tuple2([DeleteEntry(key)], key) | |
296 | - | else $Tuple2(nil, unit) | |
420 | + | func claimREADONLY (assetId,index,userAddressStr) = { | |
421 | + | let userAddress = valueOrErrorMessage(addressFromString(userAddressStr), wrapErr("invalid address")) | |
422 | + | let votingRewardAssetIdStr = getString(keyVotingRewardAssetId(assetId, index)) | |
423 | + | let rewardAmount = if (isDefined(votingRewardAssetIdStr)) | |
424 | + | then calculateReward(userAddress, assetId, index) | |
425 | + | else 0 | |
426 | + | $Tuple2(nil, rewardAmount) | |
427 | + | } | |
297 | 428 | ||
298 | 429 | ||
299 | 430 | ||
300 | 431 | @Callable(i) | |
301 | - | func reissue (amount) = if (onlyCalculator(i)) | |
302 | - | then $Tuple2([Reissue(lpAssetIdOrFail, amount, true)], amount) | |
303 | - | else $Tuple2(nil, unit) | |
304 | - | ||
305 | - | ||
306 | - | ||
307 | - | @Callable(i) | |
308 | - | func burn (amount) = if (onlyCalculator(i)) | |
309 | - | then $Tuple2([Burn(lpAssetIdOrFail, amount)], amount) | |
310 | - | else $Tuple2(nil, unit) | |
311 | - | ||
312 | - | ||
313 | - | ||
314 | - | @Callable(i) | |
315 | - | func transferAsset (recepientBytes,amount,assetId) = if (onlyCalculator(i)) | |
316 | - | then $Tuple2([ScriptTransfer(Address(recepientBytes), amount, assetId)], amount) | |
317 | - | else $Tuple2(nil, unit) | |
318 | - | ||
319 | - | ||
320 | - | ||
321 | - | @Callable(i) | |
322 | - | func transferWaves (recepientBytes,amount) = if (onlyCalculator(i)) | |
323 | - | then $Tuple2([ScriptTransfer(Address(recepientBytes), amount, unit)], amount) | |
324 | - | else $Tuple2(nil, unit) | |
325 | - | ||
326 | - | ||
327 | - | ||
328 | - | @Callable(i) | |
329 | - | func transferFromProxyTreasury (recipientBytes,rewardsAmount) = if (onlyCalculator(i)) | |
330 | - | then $Tuple2(nil, invoke(proxyTreasuryAddressOrFail, "transferWaves", [recipientBytes, rewardsAmount], nil)) | |
331 | - | else $Tuple2(nil, unit) | |
332 | - | ||
333 | - | ||
334 | - | ||
335 | - | @Callable(i) | |
336 | - | func finalize (newTreasuryVolumeInWaves,pwrManagersBonusInWaves,treasuryVolumeDiffAllocationCoef) = $Tuple2(nil, reentrantInvoke(calculatorAddressOrFail, "finalize", [i.caller.bytes, newTreasuryVolumeInWaves, pwrManagersBonusInWaves, treasuryVolumeDiffAllocationCoef], i.payments)) | |
337 | - | ||
338 | - | ||
339 | - | ||
340 | - | @Callable(i) | |
341 | - | func finalizeREADONLY (newTreasuryVolumeInWaves,pwrManagersBonusInWaves,treasuryVolumeDiffAllocationCoef) = $Tuple2(nil, reentrantInvoke(calculatorAddressOrFail, "finalizeREADONLY", [newTreasuryVolumeInWaves, pwrManagersBonusInWaves, treasuryVolumeDiffAllocationCoef], nil)) | |
342 | - | ||
343 | - | ||
344 | - | ||
345 | - | @Callable(i) | |
346 | - | func claimLP () = $Tuple2(nil, reentrantInvoke(calculatorAddressOrFail, "claimLP", [i.caller.bytes], i.payments)) | |
347 | - | ||
348 | - | ||
349 | - | ||
350 | - | @Callable(i) | |
351 | - | func claimWaves (txIdStr) = $Tuple2(nil, reentrantInvoke(calculatorAddressOrFail, "claimWaves", [i.caller.bytes, fromBase58String(txIdStr)], i.payments)) | |
352 | - | ||
353 | - | ||
354 | - | ||
355 | - | @Callable(i) | |
356 | - | func invest () = $Tuple2(nil, reentrantInvoke(calculatorAddressOrFail, "invest", [i.caller.bytes], i.payments)) | |
357 | - | ||
358 | - | ||
359 | - | ||
360 | - | @Callable(i) | |
361 | - | func withdraw () = $Tuple2(nil, reentrantInvoke(calculatorAddressOrFail, "withdraw", [i.caller.bytes], i.payments)) | |
362 | - | ||
363 | - | ||
364 | - | ||
365 | - | @Callable(i) | |
366 | - | func cancelWithdraw (txIdStr) = $Tuple2(nil, reentrantInvoke(calculatorAddressOrFail, "cancelWithdraw", [i.caller.bytes, fromBase58String(txIdStr)], i.payments)) | |
367 | - | ||
368 | - | ||
369 | - | ||
370 | - | @Callable(i) | |
371 | - | func processBlocks () = $Tuple2(nil, reentrantInvoke(calculatorAddressOrFail, "processBlocks", [i.caller.bytes], i.payments)) | |
372 | - | ||
373 | - | ||
374 | - | ||
375 | - | @Callable(i) | |
376 | - | func voteForTxId (txId) = { | |
377 | - | let callerAddressString = toBase58String(i.caller.bytes) | |
378 | - | let keyPrefix = keyAllowedTxIdVotePrefix(txId) | |
379 | - | let result = [StringEntry(keyAllowedTxId(), txId)] | |
380 | - | let allowedTxIdOption = getString(this, keyAllowedTxId()) | |
381 | - | let err = [if ((size(fromBase58String(txId)) == TXID_BYTES_LENGTH)) | |
432 | + | func claim (assetId,index) = { | |
433 | + | let callerAddress = i.caller | |
434 | + | let claimHistoryKey = keyClaimHistory(callerAddress, assetId, index) | |
435 | + | let claimHistory = getInteger(claimHistoryKey) | |
436 | + | let checks = [if ((claimHistory == unit)) | |
382 | 437 | then true | |
383 | - | else throwErr((txId + " is not valid txId")), if (if ((allowedTxIdOption == unit)) | |
384 | - | then true | |
385 | - | else (value(allowedTxIdOption) != txId)) | |
386 | - | then true | |
387 | - | else throwErr((txId + " is already allowed"))] | |
388 | - | if ((err == err)) | |
389 | - | then voteINTERNAL(callerAddressString, keyPrefix, QUORUM, result) | |
438 | + | else throwErr("already claimed")] | |
439 | + | if ((checks == checks)) | |
440 | + | then { | |
441 | + | let rewardAmount = if ((calculateReward(callerAddress, assetId, index) > 0)) | |
442 | + | then calculateReward(callerAddress, assetId, index) | |
443 | + | else throwErr("nothing to claim") | |
444 | + | let votingRewardAssetIdStr = getString(keyVotingRewardAssetId(assetId, index)) | |
445 | + | let rewardAction = if (isDefined(votingRewardAssetIdStr)) | |
446 | + | then { | |
447 | + | let votingRewardAssetId = fromBase58String(value(votingRewardAssetIdStr)) | |
448 | + | [ScriptTransfer(callerAddress, rewardAmount, votingRewardAssetId), IntegerEntry(claimHistoryKey, rewardAmount), DeleteEntry(keyVotingReward(callerAddress, assetId, index))] | |
449 | + | } | |
450 | + | else throwErr("nothing to claim") | |
451 | + | rewardAction | |
452 | + | } | |
390 | 453 | else throw("Strict value is not equal to itself.") | |
391 | 454 | } | |
392 | 455 | ||
393 | 456 | ||
394 | 457 | @Verifier(tx) | |
395 | 458 | func verify () = { | |
396 | - | let byProposal = match votingResultAddressOption { | |
397 | - | case proposalAddress: Address => | |
398 | - | valueOrElse(getBoolean(proposalAddress, keyProposalAllowBroadcast(this, tx.id)), false) | |
459 | + | let targetPublicKey = match managerPublicKeyOrUnit() { | |
460 | + | case pk: ByteVector => | |
461 | + | pk | |
462 | + | case _: Unit => | |
463 | + | tx.senderPublicKey | |
399 | 464 | case _ => | |
400 | - | | |
465 | + | throw("Match error") | |
401 | 466 | } | |
402 | - | let byAdmins = (tx.id == fromBase58String(valueOrElse(getString(this, keyAllowedTxId()), ""))) | |
403 | - | let byOwner = if ((size(getAdminsList()) >= QUORUM)) | |
404 | - | then false | |
405 | - | else sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
406 | - | if (if (byProposal) | |
407 | - | then true | |
408 | - | else byAdmins) | |
409 | - | then true | |
410 | - | else byOwner | |
467 | + | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
411 | 468 | } | |
412 | 469 |
github/deemru/w8io/169f3d6 64.95 ms ◑