tx · AbKzGgoyXD78oYVqqA8tzZ8HChnQzyoDg9V168np9vLL 3N1Epwa6GQuTQr2K9WzeUcqSFCdERwuvL5T: -0.01400000 Waves 2023.05.10 13:18 [2571658] smart account 3N1Epwa6GQuTQr2K9WzeUcqSFCdERwuvL5T > SELF 0.00000000 Waves
{ "type": 13, "id": "AbKzGgoyXD78oYVqqA8tzZ8HChnQzyoDg9V168np9vLL", "fee": 1400000, "feeAssetId": null, "timestamp": 1683713888978, "version": 2, "chainId": 84, "sender": "3N1Epwa6GQuTQr2K9WzeUcqSFCdERwuvL5T", "senderPublicKey": "7iXEgsFNsnbLZ3ca4tmz8jffnyxMu9keuBV6CuQPJLuA", "proofs": [ "3kEos3gpx3oWZcG6WUZesSHjboNCPKAFjyWSs52U8f1EporDV9KngRujWL9RcAzRbeC6EVwTiiPjX6LTqjs9dkU3" ], "script": "base64:BgKiDAgCEg0KCwgICAgICAEIAQgBEgMKAQESBAoCCAgSBQoDCAgEEgQKAggIEgMKAQESAwoBARIECgIICBIECgIICCIJc2VwYXJhdG9yIgxrZXlGZWVBbW91bnQiDmtleVVzZG5Bc3NldElkIg5rZXlFcG9jaExlbmd0aCIRa2V5RmluYWxpemVSZXdhcmQiDGtleVd4QXNzZXRJZCIWa2V5QXNzZXRzU3RvcmVDb250cmFjdCITa2V5VXNlclBvb2xDb250cmFjdCITa2V5RW1pc3Npb25Db250cmFjdCITa2V5Qm9vc3RpbmdDb250cmFjdCISa2V5RmFjdG9yeUNvbnRyYWN0IhlrZXlWb3RpbmdFbWlzc2lvbkNvbnRyYWN0IgxrZXlUaHJlc2hvbGQiD2dldFN0cmluZ09yRmFpbCIDa2V5IgxnZXRJbnRPckZhaWwiEGtleUluTGlzdEFzc2V0SWQiDWFtb3VudEFzc2V0SWQiDHByaWNlQXNzZXRJZCIPa2V5U3VnZ2VzdEluZGV4Ig5rZXlTdGFydEhlaWdodCIMc3VnZ2VzdEluZGV4Ig9rZXlWb3RpbmdSZXN1bHQiCnRvdGF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ml0BQJhUQkAAgECJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgFXAQdhcHByb3ZlAgFyAXMEAmFXAwkAAAIIBQFXBmNhbGxlcgUBUgYJAQFZAQUBVwMJAAACBQJhVwUCYVcEAmFVCQDMCAIJAPwHBAUBUQIWc2V0V3hFbWlzc2lvblBvb2xMYWJlbAkAzAgCBQFyCQDMCAIFAXMFA25pbAUDbmlsCQDMCAIJAPwHBAUBUwIGY3JlYXRlCQDMCAIFAXIJAMwIAgUBcwUDbmlsBQNuaWwFA25pbAMJAAACBQJhVQUCYVUJAJQKAgUDbmlsBQR1bml0CQACAQIkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuCQACAQIkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuAQJhWAECYVkABAJhWgQBTAkBAVQAAwkAAQIFAUwCCkJ5dGVWZWN0b3IEAVgFAUwFAVgDCQABAgUBTAIEVW5pdAgFAmFYD3NlbmRlclB1YmxpY0tleQkAAgECC01hdGNoIGVycm9yCQD0AwMIBQJhWAlib2R5Qnl0ZXMJAJEDAggFAmFYBnByb29mcwAABQJhWlVPg14=", "height": 2571658, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 6mJoi84NMtLPsVKujuiyDpB2TUDHx7qcAZE9KoSqQSZj Next: none Diff:
Old | New | Differences | |
---|---|---|---|
70 | 70 | func keyManagerPublicKey () = "%s__managerPublicKey" | |
71 | 71 | ||
72 | 72 | ||
73 | - | func keyPendingManagerPublicKey () = "%s__pendingManagerPublicKey" | |
73 | + | func keyManagerVaultAddress () = "%s__managerVaultAddress" | |
74 | + | ||
75 | + | ||
76 | + | func getManagerVaultAddressOrThis () = match getString(keyManagerVaultAddress()) { | |
77 | + | case s: String => | |
78 | + | addressFromStringValue(s) | |
79 | + | case _ => | |
80 | + | this | |
81 | + | } | |
74 | 82 | ||
75 | 83 | ||
76 | 84 | let assetsStoreContract = addressFromStringValue(getStringOrFail(keyAssetsStoreContract)) | |
85 | 93 | ||
86 | 94 | let votingEmissionContract = addressFromStringValue(getStringOrFail(keyVotingEmissionContract)) | |
87 | 95 | ||
88 | - | func managerPublicKeyOrUnit () = match getString(keyManagerPublicKey()) { | |
89 | - | case s: String => | |
90 | - | fromBase58String(s) | |
91 | - | case _: Unit => | |
92 | - | unit | |
93 | - | case _ => | |
94 | - | throw("Match error") | |
95 | - | } | |
96 | - | ||
97 | - | ||
98 | - | func pendingManagerPublicKeyOrUnit () = match getString(keyPendingManagerPublicKey()) { | |
99 | - | case s: String => | |
100 | - | fromBase58String(s) | |
101 | - | case _: Unit => | |
102 | - | unit | |
103 | - | case _ => | |
104 | - | throw("Match error") | |
105 | - | } | |
96 | + | func managerPublicKeyOrUnit () = { | |
97 | + | let managerVaultAddress = getManagerVaultAddressOrThis() | |
98 | + | match getString(managerVaultAddress, keyManagerPublicKey()) { | |
99 | + | case s: String => | |
100 | + | fromBase58String(s) | |
101 | + | case _: Unit => | |
102 | + | unit | |
103 | + | case _ => | |
104 | + | throw("Match error") | |
105 | + | } | |
106 | + | } | |
106 | 107 | ||
107 | 108 | ||
108 | 109 | func isManager (i) = match managerPublicKeyOrUnit() { | |
425 | 426 | } | |
426 | 427 | ||
427 | 428 | ||
428 | - | ||
429 | - | @Callable(i) | |
430 | - | func setManager (pendingManagerPublicKey) = { | |
431 | - | let checkCaller = mustManager(i) | |
432 | - | if ((checkCaller == checkCaller)) | |
433 | - | then { | |
434 | - | let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey) | |
435 | - | if ((checkManagerPublicKey == checkManagerPublicKey)) | |
436 | - | then [StringEntry(keyPendingManagerPublicKey(), pendingManagerPublicKey)] | |
437 | - | else throw("Strict value is not equal to itself.") | |
438 | - | } | |
439 | - | else throw("Strict value is not equal to itself.") | |
440 | - | } | |
441 | - | ||
442 | - | ||
443 | - | ||
444 | - | @Callable(i) | |
445 | - | func confirmManager () = { | |
446 | - | let pm = pendingManagerPublicKeyOrUnit() | |
447 | - | let hasPM = if (isDefined(pm)) | |
448 | - | then true | |
449 | - | else throw("no pending manager") | |
450 | - | if ((hasPM == hasPM)) | |
451 | - | then { | |
452 | - | let checkPM = if ((i.callerPublicKey == value(pm))) | |
453 | - | then true | |
454 | - | else throw("you are not pending manager") | |
455 | - | if ((checkPM == checkPM)) | |
456 | - | then [StringEntry(keyManagerPublicKey(), toBase58String(value(pm))), DeleteEntry(keyPendingManagerPublicKey())] | |
457 | - | else throw("Strict value is not equal to itself.") | |
458 | - | } | |
459 | - | else throw("Strict value is not equal to itself.") | |
460 | - | } | |
461 | - | ||
462 | - | ||
463 | 429 | @Verifier(tx) | |
464 | 430 | func verify () = { | |
465 | 431 | let targetPublicKey = match managerPublicKeyOrUnit() { |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let separator = "__" | |
5 | 5 | ||
6 | 6 | let keyFeeAmount = makeString(["%s", "fee"], separator) | |
7 | 7 | ||
8 | 8 | let keyUsdnAssetId = makeString(["%s", "usdnAssetId"], separator) | |
9 | 9 | ||
10 | 10 | let keyEpochLength = makeString(["%s", "epochLength"], separator) | |
11 | 11 | ||
12 | 12 | let keyFinalizeReward = makeString(["%s", "finalizeReward"], separator) | |
13 | 13 | ||
14 | 14 | let keyWxAssetId = makeString(["%s", "wxAssetId"], separator) | |
15 | 15 | ||
16 | 16 | let keyAssetsStoreContract = makeString(["%s", "assetsStoreContract"], separator) | |
17 | 17 | ||
18 | 18 | let keyUserPoolContract = makeString(["%s", "userPoolContract"], separator) | |
19 | 19 | ||
20 | 20 | let keyEmissionContract = makeString(["%s", "emissionContract"], separator) | |
21 | 21 | ||
22 | 22 | let keyBoostingContract = makeString(["%s", "boostingContract"], separator) | |
23 | 23 | ||
24 | 24 | let keyFactoryContract = makeString(["%s", "factoryContract"], separator) | |
25 | 25 | ||
26 | 26 | let keyVotingEmissionContract = makeString(["%s", "votingEmissionContract"], separator) | |
27 | 27 | ||
28 | 28 | let keyThreshold = makeString(["%s", "votingThreshold"], separator) | |
29 | 29 | ||
30 | 30 | func getStringOrFail (key) = valueOrErrorMessage(getString(this, key), (key + " is not defined")) | |
31 | 31 | ||
32 | 32 | ||
33 | 33 | func getIntOrFail (key) = valueOrErrorMessage(getInteger(this, key), (key + " is not defined")) | |
34 | 34 | ||
35 | 35 | ||
36 | 36 | func keyInListAssetId (amountAssetId,priceAssetId) = makeString(["%s%s%s", "inList", amountAssetId, priceAssetId], separator) | |
37 | 37 | ||
38 | 38 | ||
39 | 39 | func keySuggestIndex (amountAssetId,priceAssetId) = makeString(["%s%s%s", "suggestIndex", amountAssetId, priceAssetId], separator) | |
40 | 40 | ||
41 | 41 | ||
42 | 42 | func keyStartHeight (amountAssetId,priceAssetId,suggestIndex) = makeString(["%s%s%s%d", "startHeight", amountAssetId, priceAssetId, toString(suggestIndex)], separator) | |
43 | 43 | ||
44 | 44 | ||
45 | 45 | func keyVotingResult (amountAssetId,priceAssetId,suggestIndex) = makeString(["%s%s%s%d", "votingResult", amountAssetId, priceAssetId, toString(suggestIndex)], separator) | |
46 | 46 | ||
47 | 47 | ||
48 | 48 | func totalVotes (totalYes,totalNo) = makeString(["%d%d", totalYes, totalNo], separator) | |
49 | 49 | ||
50 | 50 | ||
51 | 51 | func keyVote (amountAssetId,priceAssetId,suggestIndex,voterAddress) = makeString(["%s%s%s%d%s", "vote", amountAssetId, priceAssetId, toString(suggestIndex), voterAddress], separator) | |
52 | 52 | ||
53 | 53 | ||
54 | 54 | func keyVoteValue (gwxAmount,vote) = { | |
55 | 55 | let key = if (vote) | |
56 | 56 | then makeString(["%d%s", gwxAmount, "yes"], separator) | |
57 | 57 | else makeString(["%d%s", gwxAmount, "no"], separator) | |
58 | 58 | key | |
59 | 59 | } | |
60 | 60 | ||
61 | 61 | ||
62 | 62 | func keyInList (pool) = { | |
63 | 63 | let $t024632503 = pool | |
64 | 64 | let amountAssetId = $t024632503._1 | |
65 | 65 | let priceAssetId = $t024632503._2 | |
66 | 66 | makeString(["%s%s%s", "inList", amountAssetId, priceAssetId], separator) | |
67 | 67 | } | |
68 | 68 | ||
69 | 69 | ||
70 | 70 | func keyManagerPublicKey () = "%s__managerPublicKey" | |
71 | 71 | ||
72 | 72 | ||
73 | - | func keyPendingManagerPublicKey () = "%s__pendingManagerPublicKey" | |
73 | + | func keyManagerVaultAddress () = "%s__managerVaultAddress" | |
74 | + | ||
75 | + | ||
76 | + | func getManagerVaultAddressOrThis () = match getString(keyManagerVaultAddress()) { | |
77 | + | case s: String => | |
78 | + | addressFromStringValue(s) | |
79 | + | case _ => | |
80 | + | this | |
81 | + | } | |
74 | 82 | ||
75 | 83 | ||
76 | 84 | let assetsStoreContract = addressFromStringValue(getStringOrFail(keyAssetsStoreContract)) | |
77 | 85 | ||
78 | 86 | let boostingContract = addressFromStringValue(getStringOrFail(keyBoostingContract)) | |
79 | 87 | ||
80 | 88 | let emissionContract = addressFromStringValue(getStringOrFail(keyEmissionContract)) | |
81 | 89 | ||
82 | 90 | let factoryContract = addressFromStringValue(getStringOrFail(keyFactoryContract)) | |
83 | 91 | ||
84 | 92 | let userPoolContract = addressFromStringValue(getStringOrFail(keyUserPoolContract)) | |
85 | 93 | ||
86 | 94 | let votingEmissionContract = addressFromStringValue(getStringOrFail(keyVotingEmissionContract)) | |
87 | 95 | ||
88 | - | func managerPublicKeyOrUnit () = match getString(keyManagerPublicKey()) { | |
89 | - | case s: String => | |
90 | - | fromBase58String(s) | |
91 | - | case _: Unit => | |
92 | - | unit | |
93 | - | case _ => | |
94 | - | throw("Match error") | |
95 | - | } | |
96 | - | ||
97 | - | ||
98 | - | func pendingManagerPublicKeyOrUnit () = match getString(keyPendingManagerPublicKey()) { | |
99 | - | case s: String => | |
100 | - | fromBase58String(s) | |
101 | - | case _: Unit => | |
102 | - | unit | |
103 | - | case _ => | |
104 | - | throw("Match error") | |
105 | - | } | |
96 | + | func managerPublicKeyOrUnit () = { | |
97 | + | let managerVaultAddress = getManagerVaultAddressOrThis() | |
98 | + | match getString(managerVaultAddress, keyManagerPublicKey()) { | |
99 | + | case s: String => | |
100 | + | fromBase58String(s) | |
101 | + | case _: Unit => | |
102 | + | unit | |
103 | + | case _ => | |
104 | + | throw("Match error") | |
105 | + | } | |
106 | + | } | |
106 | 107 | ||
107 | 108 | ||
108 | 109 | func isManager (i) = match managerPublicKeyOrUnit() { | |
109 | 110 | case pk: ByteVector => | |
110 | 111 | (i.callerPublicKey == pk) | |
111 | 112 | case _: Unit => | |
112 | 113 | (i.caller == this) | |
113 | 114 | case _ => | |
114 | 115 | throw("Match error") | |
115 | 116 | } | |
116 | 117 | ||
117 | 118 | ||
118 | 119 | func mustManager (i) = if (isManager(i)) | |
119 | 120 | then true | |
120 | 121 | else throw("permission denied") | |
121 | 122 | ||
122 | 123 | ||
123 | 124 | func asInt (val) = match val { | |
124 | 125 | case valInt: Int => | |
125 | 126 | valInt | |
126 | 127 | case _ => | |
127 | 128 | throw("failed to cast into Integer") | |
128 | 129 | } | |
129 | 130 | ||
130 | 131 | ||
131 | 132 | @Callable(i) | |
132 | 133 | func constructor (assetsStoreContractPrm,boostingContractPrm,emissionContractPrm,factoryContractPrm,userPoolContractPrm,votingEmissionContractPrm,feeAmountPrm,wxAssetIdPrm,votingDurationPrm,usdnAssetIdPrm,finalizeRewardPrm) = { | |
133 | 134 | let checks = [mustManager(i), if (isDefined(addressFromString(assetsStoreContractPrm))) | |
134 | 135 | then true | |
135 | 136 | else throw("Invalid asset_store contract address"), if (isDefined(addressFromString(boostingContractPrm))) | |
136 | 137 | then true | |
137 | 138 | else throw("Invalid boosting contract address"), if (isDefined(addressFromString(userPoolContractPrm))) | |
138 | 139 | then true | |
139 | 140 | else throw("Invalid user_pools contract address"), if (isDefined(addressFromString(emissionContractPrm))) | |
140 | 141 | then true | |
141 | 142 | else throw("Invalid emission contract address"), if (isDefined(addressFromString(factoryContractPrm))) | |
142 | 143 | then true | |
143 | 144 | else throw("Invalid factory contract address"), if ((feeAmountPrm >= 0)) | |
144 | 145 | then true | |
145 | 146 | else throw("Invalid fee amount"), if ((votingDurationPrm > 0)) | |
146 | 147 | then true | |
147 | 148 | else throw("Invalid voting duration"), if ((finalizeRewardPrm >= 0)) | |
148 | 149 | then true | |
149 | 150 | else throw("Invalid finalize reward"), if (isDefined(assetInfo(fromBase58String(wxAssetIdPrm)))) | |
150 | 151 | then true | |
151 | 152 | else throw("Invalid WX asset ID"), if (isDefined(assetInfo(fromBase58String(usdnAssetIdPrm)))) | |
152 | 153 | then true | |
153 | 154 | else throw("Invalid USDN asset ID")] | |
154 | 155 | if ((checks == checks)) | |
155 | 156 | then $Tuple2([StringEntry(keyAssetsStoreContract, assetsStoreContractPrm), StringEntry(keyBoostingContract, boostingContractPrm), StringEntry(keyEmissionContract, emissionContractPrm), StringEntry(keyFactoryContract, factoryContractPrm), StringEntry(keyUserPoolContract, userPoolContractPrm), StringEntry(keyVotingEmissionContract, votingEmissionContractPrm), IntegerEntry(keyFeeAmount, feeAmountPrm), IntegerEntry(keyEpochLength, votingDurationPrm), IntegerEntry(keyFinalizeReward, finalizeRewardPrm), StringEntry(keyWxAssetId, wxAssetIdPrm), StringEntry(keyUsdnAssetId, usdnAssetIdPrm)], unit) | |
156 | 157 | else throw("Strict value is not equal to itself.") | |
157 | 158 | } | |
158 | 159 | ||
159 | 160 | ||
160 | 161 | ||
161 | 162 | @Callable(i) | |
162 | 163 | func constructorV2 (threshold) = { | |
163 | 164 | let checks = [mustManager(i), if ((threshold > 0)) | |
164 | 165 | then true | |
165 | 166 | else throw("invalid threshold")] | |
166 | 167 | if ((checks == checks)) | |
167 | 168 | then $Tuple2([IntegerEntry(keyThreshold, threshold)], unit) | |
168 | 169 | else throw("Strict value is not equal to itself.") | |
169 | 170 | } | |
170 | 171 | ||
171 | 172 | ||
172 | 173 | ||
173 | 174 | @Callable(i) | |
174 | 175 | func suggest (amountAssetId,priceAssetId) = { | |
175 | 176 | let pool = $Tuple2(amountAssetId, priceAssetId) | |
176 | 177 | let payment = value(i.payments[0]) | |
177 | 178 | let checkAmountAsset = if ((amountAssetId == "WAVES")) | |
178 | 179 | then unit | |
179 | 180 | else { | |
180 | 181 | let info = valueOrErrorMessage(assetInfo(fromBase58String(amountAssetId)), "invalid amountAssetId ID") | |
181 | 182 | if ((info.scripted == false)) | |
182 | 183 | then true | |
183 | 184 | else throw("asset is smart") | |
184 | 185 | } | |
185 | 186 | if ((checkAmountAsset == checkAmountAsset)) | |
186 | 187 | then { | |
187 | 188 | let checks = [if ((toBase58String(value(payment.assetId)) == value(getString(keyWxAssetId)))) | |
188 | 189 | then true | |
189 | 190 | else throw("invalid fee asset"), if ((payment.amount == value(getInteger(keyFeeAmount)))) | |
190 | 191 | then true | |
191 | 192 | else throw("invalid fee amount"), if ((getInteger(keyInListAssetId(amountAssetId, priceAssetId)) == unit)) | |
192 | 193 | then true | |
193 | 194 | else throw("already in voting list"), if (!(valueOrElse(getBoolean(votingEmissionContract, keyInList(pool)), false))) | |
194 | 195 | then true | |
195 | 196 | else throw("pool is in emission voting list")] | |
196 | 197 | if ((checks == checks)) | |
197 | 198 | then { | |
198 | 199 | let ensureActive = match invoke(userPoolContract, "statusREADONLY", [amountAssetId, priceAssetId], nil) { | |
199 | 200 | case s: String => | |
200 | 201 | if ((s == "active")) | |
201 | 202 | then true | |
202 | 203 | else throw("user pool is not active") | |
203 | 204 | case _ => | |
204 | 205 | throw("user pool is not active") | |
205 | 206 | } | |
206 | 207 | if ((ensureActive == ensureActive)) | |
207 | 208 | then { | |
208 | 209 | let ensureAmountAssetVerified = if (isManager(i)) | |
209 | 210 | then unit | |
210 | 211 | else { | |
211 | 212 | let inv = match invoke(assetsStoreContract, "isVerifiedREADONLY", [amountAssetId], nil) { | |
212 | 213 | case b: Boolean => | |
213 | 214 | if (b) | |
214 | 215 | then true | |
215 | 216 | else throw("asset is not verified") | |
216 | 217 | case _ => | |
217 | 218 | throw("asset is not verified") | |
218 | 219 | } | |
219 | 220 | if ((inv == inv)) | |
220 | 221 | then unit | |
221 | 222 | else throw("Strict value is not equal to itself.") | |
222 | 223 | } | |
223 | 224 | if ((ensureAmountAssetVerified == ensureAmountAssetVerified)) | |
224 | 225 | then { | |
225 | 226 | let burnFeeInv = invoke(emissionContract, "burn", nil, [AttachedPayment(payment.assetId, payment.amount)]) | |
226 | 227 | if ((burnFeeInv == burnFeeInv)) | |
227 | 228 | then { | |
228 | 229 | let newSuggestIndex = match getInteger(keySuggestIndex(amountAssetId, priceAssetId)) { | |
229 | 230 | case int: Int => | |
230 | 231 | (int + 1) | |
231 | 232 | case _ => | |
232 | 233 | 0 | |
233 | 234 | } | |
234 | 235 | $Tuple2([IntegerEntry(keyInListAssetId(amountAssetId, priceAssetId), newSuggestIndex), IntegerEntry(keyStartHeight(amountAssetId, priceAssetId, newSuggestIndex), height), StringEntry(keyVotingResult(amountAssetId, priceAssetId, newSuggestIndex), totalVotes("0", "0")), IntegerEntry(keySuggestIndex(amountAssetId, priceAssetId), newSuggestIndex)], unit) | |
235 | 236 | } | |
236 | 237 | else throw("Strict value is not equal to itself.") | |
237 | 238 | } | |
238 | 239 | else throw("Strict value is not equal to itself.") | |
239 | 240 | } | |
240 | 241 | else throw("Strict value is not equal to itself.") | |
241 | 242 | } | |
242 | 243 | else throw("Strict value is not equal to itself.") | |
243 | 244 | } | |
244 | 245 | else throw("Strict value is not equal to itself.") | |
245 | 246 | } | |
246 | 247 | ||
247 | 248 | ||
248 | 249 | ||
249 | 250 | @Callable(i) | |
250 | 251 | func vote (amountAssetId,priceAssetId,inFavor) = { | |
251 | 252 | let suggestIndex = value(getInteger(keyInListAssetId(amountAssetId, priceAssetId))) | |
252 | 253 | let votingFinishHeight = (value(getInteger(keyStartHeight(amountAssetId, priceAssetId, suggestIndex))) + value(getInteger(keyEpochLength))) | |
253 | 254 | let checks = [if (isDefined(getInteger(keyInListAssetId(amountAssetId, priceAssetId)))) | |
254 | 255 | then true | |
255 | 256 | else throw("the token isn't on the voting list"), if ((votingFinishHeight > height)) | |
256 | 257 | then true | |
257 | 258 | else throw("too late to vote")] | |
258 | 259 | if ((checks == checks)) | |
259 | 260 | then { | |
260 | 261 | let gwxAmount = invoke(boostingContract, "getUserGwxAmountAtHeightREADONLY", [toString(i.caller), votingFinishHeight], nil) | |
261 | 262 | let notZero = if ((asInt(gwxAmount) > 0)) | |
262 | 263 | then true | |
263 | 264 | else throw("you don't have gwx") | |
264 | 265 | if ((notZero == notZero)) | |
265 | 266 | then { | |
266 | 267 | let vote = match getString(keyVote(amountAssetId, priceAssetId, suggestIndex, toString(i.caller))) { | |
267 | 268 | case s: String => | |
268 | 269 | let vote = split(s, separator) | |
269 | 270 | let voteValue = vote[1] | |
270 | 271 | let voteType = vote[2] | |
271 | 272 | let isVoteTypeSimilar = if (if ((voteType == "yes")) | |
272 | 273 | then (inFavor == true) | |
273 | 274 | else false) | |
274 | 275 | then true | |
275 | 276 | else if ((voteType == "no")) | |
276 | 277 | then (inFavor == false) | |
277 | 278 | else false | |
278 | 279 | let isVoteValueSimilar = if (isVoteTypeSimilar) | |
279 | 280 | then (asInt(gwxAmount) == parseIntValue(voteValue)) | |
280 | 281 | else false | |
281 | 282 | let isNewVoteSimilar = if (if (isVoteTypeSimilar) | |
282 | 283 | then isVoteValueSimilar | |
283 | 284 | else false) | |
284 | 285 | then throw("you already voted") | |
285 | 286 | else invoke(this, "cancelVote", [amountAssetId, priceAssetId], nil) | |
286 | 287 | isNewVoteSimilar | |
287 | 288 | case u: Unit => | |
288 | 289 | u | |
289 | 290 | case _ => | |
290 | 291 | throw("Match error") | |
291 | 292 | } | |
292 | 293 | if ((vote == vote)) | |
293 | 294 | then { | |
294 | 295 | let votingResult = split(value(getString(keyVotingResult(amountAssetId, priceAssetId, suggestIndex))), separator) | |
295 | 296 | let positiveVotes = votingResult[1] | |
296 | 297 | let negativeVotes = votingResult[2] | |
297 | 298 | let newPositiveAndNegativeVotes = if (inFavor) | |
298 | 299 | then { | |
299 | 300 | let newPositiveVotes = (parseIntValue(positiveVotes) + asInt(gwxAmount)) | |
300 | 301 | [toString(newPositiveVotes), negativeVotes] | |
301 | 302 | } | |
302 | 303 | else { | |
303 | 304 | let newNegativeVotes = (parseIntValue(negativeVotes) + asInt(gwxAmount)) | |
304 | 305 | [positiveVotes, toString(newNegativeVotes)] | |
305 | 306 | } | |
306 | 307 | let voteKey = keyVote(amountAssetId, priceAssetId, suggestIndex, toString(i.caller)) | |
307 | 308 | let voteValue = keyVoteValue(toString(asInt(gwxAmount)), inFavor) | |
308 | 309 | $Tuple2([StringEntry(keyVotingResult(amountAssetId, priceAssetId, suggestIndex), totalVotes(newPositiveAndNegativeVotes[0], newPositiveAndNegativeVotes[1])), StringEntry(voteKey, voteValue)], unit) | |
309 | 310 | } | |
310 | 311 | else throw("Strict value is not equal to itself.") | |
311 | 312 | } | |
312 | 313 | else throw("Strict value is not equal to itself.") | |
313 | 314 | } | |
314 | 315 | else throw("Strict value is not equal to itself.") | |
315 | 316 | } | |
316 | 317 | ||
317 | 318 | ||
318 | 319 | ||
319 | 320 | @Callable(i) | |
320 | 321 | func cancelVote (amountAssetId,priceAssetId) = { | |
321 | 322 | let userAddress = if ((i.caller == this)) | |
322 | 323 | then toString(i.originCaller) | |
323 | 324 | else toString(i.caller) | |
324 | 325 | let suggestIndex = value(getInteger(keyInListAssetId(amountAssetId, priceAssetId))) | |
325 | 326 | let checks = [if (isDefined(getString(keyVotingResult(amountAssetId, priceAssetId, suggestIndex)))) | |
326 | 327 | then true | |
327 | 328 | else throw("no vote for assets pair")] | |
328 | 329 | if ((checks == checks)) | |
329 | 330 | then { | |
330 | 331 | let vote = split(value(getString(keyVote(amountAssetId, priceAssetId, suggestIndex, userAddress))), separator) | |
331 | 332 | let voteValue = vote[1] | |
332 | 333 | let voteType = vote[2] | |
333 | 334 | let votingResult = split(value(getString(keyVotingResult(amountAssetId, priceAssetId, suggestIndex))), separator) | |
334 | 335 | let positiveVotes = votingResult[1] | |
335 | 336 | let negativeVotes = votingResult[2] | |
336 | 337 | let actions = if ((voteType == "yes")) | |
337 | 338 | then { | |
338 | 339 | let newPositiveVotes = (parseIntValue(positiveVotes) - parseIntValue(voteValue)) | |
339 | 340 | $Tuple2([StringEntry(keyVotingResult(amountAssetId, priceAssetId, suggestIndex), totalVotes(toString(newPositiveVotes), negativeVotes)), DeleteEntry(keyVote(amountAssetId, priceAssetId, suggestIndex, userAddress))], unit) | |
340 | 341 | } | |
341 | 342 | else { | |
342 | 343 | let newNegativeVotes = (parseIntValue(negativeVotes) - parseIntValue(voteValue)) | |
343 | 344 | $Tuple2([StringEntry(keyVotingResult(amountAssetId, priceAssetId, suggestIndex), totalVotes(positiveVotes, toString(newNegativeVotes))), DeleteEntry(keyVote(amountAssetId, priceAssetId, suggestIndex, userAddress))], unit) | |
344 | 345 | } | |
345 | 346 | actions | |
346 | 347 | } | |
347 | 348 | else throw("Strict value is not equal to itself.") | |
348 | 349 | } | |
349 | 350 | ||
350 | 351 | ||
351 | 352 | ||
352 | 353 | @Callable(i) | |
353 | 354 | func setFee (newFee) = { | |
354 | 355 | let checks = [mustManager(i)] | |
355 | 356 | if ((checks == checks)) | |
356 | 357 | then [IntegerEntry(keyFeeAmount, newFee)] | |
357 | 358 | else throw("Strict value is not equal to itself.") | |
358 | 359 | } | |
359 | 360 | ||
360 | 361 | ||
361 | 362 | ||
362 | 363 | @Callable(i) | |
363 | 364 | func setThreshold (newThreshold) = { | |
364 | 365 | let checks = [mustManager(i), if ((newThreshold > 0)) | |
365 | 366 | then true | |
366 | 367 | else throw("invalid threshold")] | |
367 | 368 | if ((checks == checks)) | |
368 | 369 | then $Tuple2([IntegerEntry(keyThreshold, newThreshold)], unit) | |
369 | 370 | else throw("Strict value is not equal to itself.") | |
370 | 371 | } | |
371 | 372 | ||
372 | 373 | ||
373 | 374 | ||
374 | 375 | @Callable(i) | |
375 | 376 | func finalize (amountAssetId,priceAssetId) = { | |
376 | 377 | let suggestIndex = value(getInteger(keyInListAssetId(amountAssetId, priceAssetId))) | |
377 | 378 | let votingFinishHeight = (value(getInteger(keyStartHeight(amountAssetId, priceAssetId, suggestIndex))) + value(getInteger(keyEpochLength))) | |
378 | 379 | let checks = [if (isDefined(getInteger(keyInListAssetId(amountAssetId, priceAssetId)))) | |
379 | 380 | then true | |
380 | 381 | else throw("no assets pair"), if ((height >= votingFinishHeight)) | |
381 | 382 | then true | |
382 | 383 | else throw("insufficient height for completion")] | |
383 | 384 | if ((checks == checks)) | |
384 | 385 | then { | |
385 | 386 | let votingResult = split(value(getString(keyVotingResult(amountAssetId, priceAssetId, suggestIndex))), separator) | |
386 | 387 | let positiveVotes = parseIntValue(votingResult[1]) | |
387 | 388 | let negativeVotes = parseIntValue(votingResult[2]) | |
388 | 389 | let allVotes = (positiveVotes + negativeVotes) | |
389 | 390 | let threshold = getIntOrFail(keyThreshold) | |
390 | 391 | let actions = if (if ((allVotes >= threshold)) | |
391 | 392 | then (positiveVotes > negativeVotes) | |
392 | 393 | else false) | |
393 | 394 | then { | |
394 | 395 | let res = invoke(factoryContract, "setWxEmissionPoolLabel", [amountAssetId, priceAssetId], nil) | |
395 | 396 | if ((res == res)) | |
396 | 397 | then { | |
397 | 398 | let votingEmissionInv = invoke(votingEmissionContract, "create", [amountAssetId, priceAssetId], nil) | |
398 | 399 | if ((votingEmissionInv == votingEmissionInv)) | |
399 | 400 | then $Tuple2([DeleteEntry(keyInListAssetId(amountAssetId, priceAssetId))], unit) | |
400 | 401 | else throw("Strict value is not equal to itself.") | |
401 | 402 | } | |
402 | 403 | else throw("Strict value is not equal to itself.") | |
403 | 404 | } | |
404 | 405 | else $Tuple2([DeleteEntry(keyInListAssetId(amountAssetId, priceAssetId))], unit) | |
405 | 406 | actions | |
406 | 407 | } | |
407 | 408 | else throw("Strict value is not equal to itself.") | |
408 | 409 | } | |
409 | 410 | ||
410 | 411 | ||
411 | 412 | ||
412 | 413 | @Callable(i) | |
413 | 414 | func approve (amountAssetId,priceAssetId) = { | |
414 | 415 | let checkCaller = if ((i.caller == userPoolContract)) | |
415 | 416 | then true | |
416 | 417 | else mustManager(i) | |
417 | 418 | if ((checkCaller == checkCaller)) | |
418 | 419 | then { | |
419 | 420 | let res = [invoke(factoryContract, "setWxEmissionPoolLabel", [amountAssetId, priceAssetId], nil), invoke(votingEmissionContract, "create", [amountAssetId, priceAssetId], nil)] | |
420 | 421 | if ((res == res)) | |
421 | 422 | then $Tuple2(nil, unit) | |
422 | 423 | else throw("Strict value is not equal to itself.") | |
423 | 424 | } | |
424 | 425 | else throw("Strict value is not equal to itself.") | |
425 | 426 | } | |
426 | 427 | ||
427 | 428 | ||
428 | - | ||
429 | - | @Callable(i) | |
430 | - | func setManager (pendingManagerPublicKey) = { | |
431 | - | let checkCaller = mustManager(i) | |
432 | - | if ((checkCaller == checkCaller)) | |
433 | - | then { | |
434 | - | let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey) | |
435 | - | if ((checkManagerPublicKey == checkManagerPublicKey)) | |
436 | - | then [StringEntry(keyPendingManagerPublicKey(), pendingManagerPublicKey)] | |
437 | - | else throw("Strict value is not equal to itself.") | |
438 | - | } | |
439 | - | else throw("Strict value is not equal to itself.") | |
440 | - | } | |
441 | - | ||
442 | - | ||
443 | - | ||
444 | - | @Callable(i) | |
445 | - | func confirmManager () = { | |
446 | - | let pm = pendingManagerPublicKeyOrUnit() | |
447 | - | let hasPM = if (isDefined(pm)) | |
448 | - | then true | |
449 | - | else throw("no pending manager") | |
450 | - | if ((hasPM == hasPM)) | |
451 | - | then { | |
452 | - | let checkPM = if ((i.callerPublicKey == value(pm))) | |
453 | - | then true | |
454 | - | else throw("you are not pending manager") | |
455 | - | if ((checkPM == checkPM)) | |
456 | - | then [StringEntry(keyManagerPublicKey(), toBase58String(value(pm))), DeleteEntry(keyPendingManagerPublicKey())] | |
457 | - | else throw("Strict value is not equal to itself.") | |
458 | - | } | |
459 | - | else throw("Strict value is not equal to itself.") | |
460 | - | } | |
461 | - | ||
462 | - | ||
463 | 429 | @Verifier(tx) | |
464 | 430 | func verify () = { | |
465 | 431 | let targetPublicKey = match managerPublicKeyOrUnit() { | |
466 | 432 | case pk: ByteVector => | |
467 | 433 | pk | |
468 | 434 | case _: Unit => | |
469 | 435 | tx.senderPublicKey | |
470 | 436 | case _ => | |
471 | 437 | throw("Match error") | |
472 | 438 | } | |
473 | 439 | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
474 | 440 | } | |
475 | 441 |
github/deemru/w8io/169f3d6 112.32 ms ◑