tx · ESTcvu8S9pTZiz2248A3tUjFUKUHsdjdtZPLT5nb8ZAL 3N4kXZHGke6yRq3Z57q7BTgCrT2SCvQCYER: -0.01400000 Waves 2022.12.06 13:53 [2348387] smart account 3N4kXZHGke6yRq3Z57q7BTgCrT2SCvQCYER > SELF 0.00000000 Waves
{ "type": 13, "id": "ESTcvu8S9pTZiz2248A3tUjFUKUHsdjdtZPLT5nb8ZAL", "fee": 1400000, "feeAssetId": null, "timestamp": 1670323973115, "version": 2, "chainId": 84, "sender": "3N4kXZHGke6yRq3Z57q7BTgCrT2SCvQCYER", "senderPublicKey": "6sxdMr2xYPPACEJccwmgS7nWC2ez1c38Y1kDX49ne42b", "proofs": [ "3A4ieKeKWRaZn9bNgK1Y1QZ8JHGmR5V4p95eYA6nzBjVWtS7JjrY32kPzJADwJxhvFVbv9CnuL9D832TrVoLVCtW" ], "script": "base64:BgIwCAISBgoECAgICBIAEgASABIECgIBARIAEgMKAQgSAwoBCBIECgIBARIGCgQICAEIIgAJU0VQQVJBVE9SAgJfXwAFV0FWRVMCBVdBVkVTAAxLRVlfTVVMVElTSUcCCE1VTFRJU0lHAApLRVlfU1RBVFVTAgZTVEFUVVMADktFWV9CQVNFX0FTU0VUAgpCQVNFX0FTU0VUAAlLRVlfQVNTRVQCBUFTU0VUABNLRVlfU1RBS0lOR19BREFQVEVSAg9TVEFLSU5HX0FEQVBURVIAEktFWV9TVEFLSU5HX0FNT1VOVAIOU1RBS0lOR19BTU9VTlQADUtFWV9MQVNUX1JBVEUCCUxBU1RfUkFURQAQS0VZX0NVUlJFTlRfUkFURQIMQ1VSUkVOVF9SQVRFAA9LRVlfTEFTVF9IRUlHSFQCC0xBU1RfSEVJR0hUABFLRVlfVEFSR0VUX0hFSUdIVAINVEFSR0VUX0hFSUdIVAAXS0VZX1NQT05TT1JTSElQX01BTkFHRVICE1NQT05TT1JTSElQX01BTkFHRVIACkZVTkNfU1RBS0UCBXN0YWtlAAxGVU5DX1VOU1RBS0UCB3Vu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CQDMCAIFCktFWV9TVEFUVVMJAMwIAgkApQgBBQR0aGlzCQDMCAIJANgEAQgFAnR4AmlkBQNuaWwFCVNFUEFSQVRPUgcJAPQDAwgFAnR4CWJvZHlCeXRlcwkAkQMCCAUCdHgGcHJvb2ZzAAAIBQJ0eA9zZW5kZXJQdWJsaWNLZXnGdYTq", "height": 2348387, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 8gijVd7Gv2Fnt3rZZMJ2tT7TMkJ7VEKsu6ZtEKs6xU4C Next: 39yN9B3cFNUELJvo8AnR4a76UkmazLK9xYofXQndrUZG Diff:
Old | New | Differences | |
---|---|---|---|
429 | 429 | if ((err == err)) | |
430 | 430 | then { | |
431 | 431 | let sponsorAssetStr = toBase58String(_loadAsset()) | |
432 | - | let wxAsset = _toAssetVector(wxAsset_) | |
433 | - | let wxAssetInfo = valueOrErrorMessage(assetInfo(valueOrErrorMessage(wxAsset, "wxVotingSuggest: invalid wx asset")), "wxVotingSuggest: invalid wx asset info") | |
434 | - | let invocation = invoke(addressFromStringValue(votingAddress_), "suggest", [sponsorAssetStr, assetImage_], [AttachedPayment(wxAsset, (wxAmount_ * wxAssetInfo.decimals))]) | |
432 | + | let invocation = invoke(addressFromStringValue(votingAddress_), "suggest", [sponsorAssetStr, assetImage_], [AttachedPayment(_toAssetVector(wxAsset_), wxAmount_)]) | |
435 | 433 | if ((invocation == invocation)) | |
436 | 434 | then $Tuple2(nil, unit) | |
437 | 435 | else throw("Strict value is not equal to itself.") |
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 WAVES = "WAVES" | |
7 | 7 | ||
8 | 8 | let KEY_MULTISIG = "MULTISIG" | |
9 | 9 | ||
10 | 10 | let KEY_STATUS = "STATUS" | |
11 | 11 | ||
12 | 12 | let KEY_BASE_ASSET = "BASE_ASSET" | |
13 | 13 | ||
14 | 14 | let KEY_ASSET = "ASSET" | |
15 | 15 | ||
16 | 16 | let KEY_STAKING_ADAPTER = "STAKING_ADAPTER" | |
17 | 17 | ||
18 | 18 | let KEY_STAKING_AMOUNT = "STAKING_AMOUNT" | |
19 | 19 | ||
20 | 20 | let KEY_LAST_RATE = "LAST_RATE" | |
21 | 21 | ||
22 | 22 | let KEY_CURRENT_RATE = "CURRENT_RATE" | |
23 | 23 | ||
24 | 24 | let KEY_LAST_HEIGHT = "LAST_HEIGHT" | |
25 | 25 | ||
26 | 26 | let KEY_TARGET_HEIGHT = "TARGET_HEIGHT" | |
27 | 27 | ||
28 | 28 | let KEY_SPONSORSHIP_MANAGER = "SPONSORSHIP_MANAGER" | |
29 | 29 | ||
30 | 30 | let FUNC_STAKE = "stake" | |
31 | 31 | ||
32 | 32 | let FUNC_UNSTAKE = "unstake" | |
33 | 33 | ||
34 | 34 | let FUNC_CLAIM_REWARD = "claimReward" | |
35 | 35 | ||
36 | 36 | let PERCENT_FACTOR = toBigInt(1000000000000) | |
37 | 37 | ||
38 | 38 | let ZERO_BIGINT = toBigInt(0) | |
39 | 39 | ||
40 | 40 | let ONE_BIGINT = toBigInt(1) | |
41 | 41 | ||
42 | 42 | let INIT_AMOUNT = 100000000 | |
43 | 43 | ||
44 | 44 | func _validateAddress (address_) = match addressFromString(address_) { | |
45 | 45 | case a: Address => | |
46 | 46 | true | |
47 | 47 | case _ => | |
48 | 48 | false | |
49 | 49 | } | |
50 | 50 | ||
51 | 51 | ||
52 | 52 | func _validateAsset (asset_) = if ((asset_ == WAVES)) | |
53 | 53 | then true | |
54 | 54 | else match assetInfo(fromBase58String(asset_)) { | |
55 | 55 | case a: Asset => | |
56 | 56 | true | |
57 | 57 | case _ => | |
58 | 58 | false | |
59 | 59 | } | |
60 | 60 | ||
61 | 61 | ||
62 | 62 | func _toAssetVector (asset_) = if ((asset_ == WAVES)) | |
63 | 63 | then unit | |
64 | 64 | else fromBase58String(asset_) | |
65 | 65 | ||
66 | 66 | ||
67 | 67 | func _getAssetDecimals (asset_) = match asset_ { | |
68 | 68 | case a: ByteVector => | |
69 | 69 | match assetInfo(a) { | |
70 | 70 | case asset: Asset => | |
71 | 71 | asset.decimals | |
72 | 72 | case _ => | |
73 | 73 | throw("_getAssetDecimals: no such asset") | |
74 | 74 | } | |
75 | 75 | case _ => | |
76 | 76 | 8 | |
77 | 77 | } | |
78 | 78 | ||
79 | 79 | ||
80 | 80 | func _getAssetQuantity (asset_) = match assetInfo(asset_) { | |
81 | 81 | case a: Asset => | |
82 | 82 | a.quantity | |
83 | 83 | case _ => | |
84 | 84 | throw("_getAssetQuantity: no such asset") | |
85 | 85 | } | |
86 | 86 | ||
87 | 87 | ||
88 | 88 | func _getAssetBalance (asset_,address) = match asset_ { | |
89 | 89 | case a: ByteVector => | |
90 | 90 | assetBalance(address, a) | |
91 | 91 | case _ => | |
92 | 92 | wavesBalance(address).regular | |
93 | 93 | } | |
94 | 94 | ||
95 | 95 | ||
96 | 96 | func _loadBaseAsset () = match getString(KEY_BASE_ASSET) { | |
97 | 97 | case a: String => | |
98 | 98 | if ((a == WAVES)) | |
99 | 99 | then unit | |
100 | 100 | else fromBase58String(a) | |
101 | 101 | case _ => | |
102 | 102 | throw("_loadBaseAsset: no base asset") | |
103 | 103 | } | |
104 | 104 | ||
105 | 105 | ||
106 | 106 | func _loadStakingAdapter () = match getString(KEY_STAKING_ADAPTER) { | |
107 | 107 | case a: String => | |
108 | 108 | addressFromStringValue(a) | |
109 | 109 | case _ => | |
110 | 110 | throw("_loadStakingAdapter: no staking adapter") | |
111 | 111 | } | |
112 | 112 | ||
113 | 113 | ||
114 | 114 | func _loadSponsorshipManager () = match getString(KEY_SPONSORSHIP_MANAGER) { | |
115 | 115 | case a: String => | |
116 | 116 | addressFromStringValue(a) | |
117 | 117 | case _ => | |
118 | 118 | throw("_loadSponsorshipManager: no sponsorship manager") | |
119 | 119 | } | |
120 | 120 | ||
121 | 121 | ||
122 | 122 | func _loadInt (key_,default_) = match getInteger(key_) { | |
123 | 123 | case a: Int => | |
124 | 124 | a | |
125 | 125 | case _ => | |
126 | 126 | default_ | |
127 | 127 | } | |
128 | 128 | ||
129 | 129 | ||
130 | 130 | func _loadBigInt (key_,default_) = match getBinary(key_) { | |
131 | 131 | case a: ByteVector => | |
132 | 132 | toBigInt(a) | |
133 | 133 | case _ => | |
134 | 134 | default_ | |
135 | 135 | } | |
136 | 136 | ||
137 | 137 | ||
138 | 138 | func _loadAsset () = match getString(KEY_ASSET) { | |
139 | 139 | case a: String => | |
140 | 140 | fromBase58String(a) | |
141 | 141 | case _ => | |
142 | 142 | base58'' | |
143 | 143 | } | |
144 | 144 | ||
145 | 145 | ||
146 | 146 | func _updateStaking (asset_,amount_,adapter_) = { | |
147 | 147 | let stakingAmount = _loadInt(KEY_STAKING_AMOUNT, 0) | |
148 | 148 | let newStakingAmount = (stakingAmount + amount_) | |
149 | 149 | let invocation = if ((amount_ > 0)) | |
150 | 150 | then invoke(adapter_, FUNC_STAKE, nil, [AttachedPayment(asset_, amount_)]) | |
151 | 151 | else invoke(adapter_, FUNC_UNSTAKE, [(-1 * amount_)], nil) | |
152 | 152 | if ((invocation == invocation)) | |
153 | 153 | then [IntegerEntry(KEY_STAKING_AMOUNT, newStakingAmount)] | |
154 | 154 | else throw("Strict value is not equal to itself.") | |
155 | 155 | } | |
156 | 156 | ||
157 | 157 | ||
158 | 158 | func _checkpoint (compensation) = { | |
159 | 159 | let invocation = invoke(_loadStakingAdapter(), FUNC_CLAIM_REWARD, nil, nil) | |
160 | 160 | if ((invocation == invocation)) | |
161 | 161 | then match invocation { | |
162 | 162 | case reward: (Int, Int, Int) => | |
163 | 163 | if (compensation) | |
164 | 164 | then { | |
165 | 165 | let stake = invoke(this, FUNC_STAKE, [reward._1, reward._3], nil) | |
166 | 166 | if ((stake == stake)) | |
167 | 167 | then $Tuple2(true, reward._2) | |
168 | 168 | else throw("Strict value is not equal to itself.") | |
169 | 169 | } | |
170 | 170 | else { | |
171 | 171 | let stake = invoke(this, FUNC_STAKE, [(reward._1 + reward._2), reward._3], nil) | |
172 | 172 | if ((stake == stake)) | |
173 | 173 | then $Tuple2(true, 0) | |
174 | 174 | else throw("Strict value is not equal to itself.") | |
175 | 175 | } | |
176 | 176 | case _ => | |
177 | 177 | $Tuple2(false, 0) | |
178 | 178 | } | |
179 | 179 | else throw("Strict value is not equal to itself.") | |
180 | 180 | } | |
181 | 181 | ||
182 | 182 | ||
183 | 183 | @Callable(i) | |
184 | 184 | func init (tokenName_,tokenDescr_,baseAsset_,stakingAdapter_) = { | |
185 | 185 | let multisig = valueOrErrorMessage(getString(KEY_MULTISIG), "init: no multisig set") | |
186 | 186 | let asset = _loadAsset() | |
187 | 187 | let baseAsset = _toAssetVector(baseAsset_) | |
188 | 188 | let err = if ((i.caller != this)) | |
189 | 189 | then throw("init: permission denied") | |
190 | 190 | else if ((asset != base58'')) | |
191 | 191 | then throw("init: already initialized") | |
192 | 192 | else if (if ((4 > size(tokenName_))) | |
193 | 193 | then true | |
194 | 194 | else (size(tokenName_) > 16)) | |
195 | 195 | then throw("init: invalid token name") | |
196 | 196 | else if ((size(tokenDescr_) > 1000)) | |
197 | 197 | then throw("init: invalid token description") | |
198 | 198 | else if (!(_validateAsset(baseAsset_))) | |
199 | 199 | then throw("init: invalid base asset") | |
200 | 200 | else if (!(_validateAddress(stakingAdapter_))) | |
201 | 201 | then throw("init: invalid staking adapter") | |
202 | 202 | else unit | |
203 | 203 | if ((err == err)) | |
204 | 204 | then { | |
205 | 205 | let tokenDecimals = _getAssetDecimals(baseAsset) | |
206 | 206 | let issue = Issue(tokenName_, tokenDescr_, INIT_AMOUNT, tokenDecimals, true) | |
207 | 207 | let assetId = calculateAssetId(issue) | |
208 | 208 | let stakeActions = _updateStaking(baseAsset, INIT_AMOUNT, addressFromStringValue(stakingAdapter_)) | |
209 | 209 | $Tuple2(([StringEntry(KEY_BASE_ASSET, baseAsset_), StringEntry(KEY_STAKING_ADAPTER, stakingAdapter_), StringEntry(KEY_ASSET, toBase58String(assetId)), issue] ++ stakeActions), unit) | |
210 | 210 | } | |
211 | 211 | else throw("Strict value is not equal to itself.") | |
212 | 212 | } | |
213 | 213 | ||
214 | 214 | ||
215 | 215 | ||
216 | 216 | @Callable(i) | |
217 | 217 | func getRate () = { | |
218 | 218 | let lastRate = _loadBigInt(KEY_LAST_RATE, PERCENT_FACTOR) | |
219 | 219 | let currentRate = _loadBigInt(KEY_CURRENT_RATE, ZERO_BIGINT) | |
220 | 220 | let lastHeight = _loadInt(KEY_LAST_HEIGHT, 0) | |
221 | 221 | let targetHeight = min([_loadInt(KEY_TARGET_HEIGHT, 0), height]) | |
222 | 222 | let rate = (lastRate + (currentRate * toBigInt((targetHeight - lastHeight)))) | |
223 | 223 | $Tuple2(nil, toString(rate)) | |
224 | 224 | } | |
225 | 225 | ||
226 | 226 | ||
227 | 227 | ||
228 | 228 | @Callable(i) | |
229 | 229 | func checkpoint () = { | |
230 | 230 | let checkpoint = _checkpoint(true) | |
231 | 231 | if ((checkpoint == checkpoint)) | |
232 | 232 | then if (!(checkpoint._1)) | |
233 | 233 | then throw("checkpoint: no reward") | |
234 | 234 | else if ((checkpoint._2 > 0)) | |
235 | 235 | then $Tuple2([ScriptTransfer(i.originCaller, checkpoint._2, _loadBaseAsset())], unit) | |
236 | 236 | else $Tuple2(nil, unit) | |
237 | 237 | else throw("Strict value is not equal to itself.") | |
238 | 238 | } | |
239 | 239 | ||
240 | 240 | ||
241 | 241 | ||
242 | 242 | @Callable(i) | |
243 | 243 | func deposit () = { | |
244 | 244 | let caller = toString(i.caller) | |
245 | 245 | let baseAsset = _loadBaseAsset() | |
246 | 246 | let asset = _loadAsset() | |
247 | 247 | let assetQuantity = toBigInt(_getAssetQuantity(asset)) | |
248 | 248 | let err = if ((size(i.payments) != 1)) | |
249 | 249 | then throw("deposit: no payments") | |
250 | 250 | else if ((i.payments[0].assetId != baseAsset)) | |
251 | 251 | then throw("deposit: payment is not in base asset") | |
252 | 252 | else if ((0 >= i.payments[0].amount)) | |
253 | 253 | then throw("deposit: invalid payment amount") | |
254 | 254 | else unit | |
255 | 255 | if ((err == err)) | |
256 | 256 | then { | |
257 | 257 | let checkpoint = _checkpoint(false) | |
258 | 258 | if ((checkpoint == checkpoint)) | |
259 | 259 | then { | |
260 | 260 | let lastRate = _loadBigInt(KEY_LAST_RATE, PERCENT_FACTOR) | |
261 | 261 | let currentRate = _loadBigInt(KEY_CURRENT_RATE, ZERO_BIGINT) | |
262 | 262 | let lastHeight = _loadInt(KEY_LAST_HEIGHT, 0) | |
263 | 263 | let targetHeight = min([_loadInt(KEY_TARGET_HEIGHT, 0), height]) | |
264 | 264 | let lastRateUpdated = (lastRate + (currentRate * toBigInt((targetHeight - lastHeight)))) | |
265 | 265 | let issueAmount = toInt(fraction(toBigInt(i.payments[0].amount), PERCENT_FACTOR, lastRateUpdated, FLOOR)) | |
266 | 266 | let currentRateUpdated = fraction(currentRate, assetQuantity, (assetQuantity + toBigInt(issueAmount)), FLOOR) | |
267 | 267 | let lastHeightUpdated = targetHeight | |
268 | 268 | let stakeActions = _updateStaking(baseAsset, i.payments[0].amount, _loadStakingAdapter()) | |
269 | 269 | $Tuple2(([Reissue(asset, issueAmount, true), ScriptTransfer(i.caller, issueAmount, asset), BinaryEntry(KEY_LAST_RATE, toBytes(lastRateUpdated)), BinaryEntry(KEY_CURRENT_RATE, toBytes(currentRateUpdated)), IntegerEntry(KEY_LAST_HEIGHT, lastHeightUpdated)] ++ stakeActions), unit) | |
270 | 270 | } | |
271 | 271 | else throw("Strict value is not equal to itself.") | |
272 | 272 | } | |
273 | 273 | else throw("Strict value is not equal to itself.") | |
274 | 274 | } | |
275 | 275 | ||
276 | 276 | ||
277 | 277 | ||
278 | 278 | @Callable(i) | |
279 | 279 | func stake (amount_,spreadBlocks_) = { | |
280 | 280 | let caller = toString(i.caller) | |
281 | 281 | let baseAsset = _loadBaseAsset() | |
282 | 282 | let asset = _loadAsset() | |
283 | 283 | let assetQuantity = toBigInt(_getAssetQuantity(asset)) | |
284 | 284 | let err = if ((i.caller != this)) | |
285 | 285 | then throw("stake: only this contract") | |
286 | 286 | else if ((0 >= amount_)) | |
287 | 287 | then throw("stake: invalid stake amount") | |
288 | 288 | else if ((amount_ > _getAssetBalance(baseAsset, this))) | |
289 | 289 | then throw("stake: insufficient stake amount") | |
290 | 290 | else if ((assetQuantity == ZERO_BIGINT)) | |
291 | 291 | then throw("stake: no deposits to stake for") | |
292 | 292 | else unit | |
293 | 293 | if ((err == err)) | |
294 | 294 | then { | |
295 | 295 | let lastRate = _loadBigInt(KEY_LAST_RATE, PERCENT_FACTOR) | |
296 | 296 | let currentRate = _loadBigInt(KEY_CURRENT_RATE, ZERO_BIGINT) | |
297 | 297 | let lastHeight = _loadInt(KEY_LAST_HEIGHT, 0) | |
298 | 298 | let targetHeight = _loadInt(KEY_TARGET_HEIGHT, 0) | |
299 | 299 | let minTargetHeight = min([targetHeight, height]) | |
300 | 300 | let actions = if ((minTargetHeight == height)) | |
301 | 301 | then { | |
302 | 302 | let lastRateUpdated = (lastRate + (toBigInt((minTargetHeight - lastHeight)) * currentRate)) | |
303 | 303 | let remainingReward = (currentRate * toBigInt((targetHeight - minTargetHeight))) | |
304 | 304 | let currentRateUpdated = fraction(((toBigInt(amount_) * PERCENT_FACTOR) + remainingReward), ONE_BIGINT, (assetQuantity * toBigInt(spreadBlocks_))) | |
305 | 305 | let lastHeightUpdated = height | |
306 | 306 | let targetHeightUpdated = (lastHeightUpdated + spreadBlocks_) | |
307 | 307 | [BinaryEntry(KEY_LAST_RATE, toBytes(lastRateUpdated)), BinaryEntry(KEY_CURRENT_RATE, toBytes(currentRateUpdated)), IntegerEntry(KEY_LAST_HEIGHT, lastHeightUpdated), IntegerEntry(KEY_TARGET_HEIGHT, targetHeightUpdated)] | |
308 | 308 | } | |
309 | 309 | else if ((targetHeight > lastHeight)) | |
310 | 310 | then { | |
311 | 311 | let lastRateUpdated = (lastRate + (toBigInt((targetHeight - lastHeight)) * currentRate)) | |
312 | 312 | let currentRateUpdated = fraction(toBigInt(amount_), PERCENT_FACTOR, (assetQuantity * toBigInt(spreadBlocks_))) | |
313 | 313 | let lastHeightUpdated = height | |
314 | 314 | let targetHeightUpdated = (lastHeightUpdated + spreadBlocks_) | |
315 | 315 | [BinaryEntry(KEY_LAST_RATE, toBytes(lastRateUpdated)), BinaryEntry(KEY_CURRENT_RATE, toBytes(currentRateUpdated)), IntegerEntry(KEY_LAST_HEIGHT, lastHeightUpdated), IntegerEntry(KEY_TARGET_HEIGHT, targetHeightUpdated)] | |
316 | 316 | } | |
317 | 317 | else { | |
318 | 318 | let currentRateUpdated = fraction(toBigInt(amount_), PERCENT_FACTOR, (assetQuantity * toBigInt(spreadBlocks_))) | |
319 | 319 | let lastHeightUpdated = height | |
320 | 320 | let targetHeightUpdated = (lastHeightUpdated + spreadBlocks_) | |
321 | 321 | [BinaryEntry(KEY_CURRENT_RATE, toBytes(currentRateUpdated)), IntegerEntry(KEY_LAST_HEIGHT, lastHeightUpdated), IntegerEntry(KEY_TARGET_HEIGHT, targetHeightUpdated)] | |
322 | 322 | } | |
323 | 323 | let stakeActions = _updateStaking(baseAsset, amount_, _loadStakingAdapter()) | |
324 | 324 | $Tuple2((actions ++ stakeActions), unit) | |
325 | 325 | } | |
326 | 326 | else throw("Strict value is not equal to itself.") | |
327 | 327 | } | |
328 | 328 | ||
329 | 329 | ||
330 | 330 | ||
331 | 331 | @Callable(i) | |
332 | 332 | func withdraw () = { | |
333 | 333 | let caller = toString(i.caller) | |
334 | 334 | let baseAsset = _loadBaseAsset() | |
335 | 335 | let asset = _loadAsset() | |
336 | 336 | let assetQuantity = toBigInt(_getAssetQuantity(asset)) | |
337 | 337 | let err = if ((1 > size(i.payments))) | |
338 | 338 | then throw("withdraw: no payments") | |
339 | 339 | else if ((i.payments[0].assetId != asset)) | |
340 | 340 | then throw("withdraw: payment is not in correct asset") | |
341 | 341 | else if ((0 >= i.payments[0].amount)) | |
342 | 342 | then throw("withdraw: invalid payment amount") | |
343 | 343 | else unit | |
344 | 344 | if ((err == err)) | |
345 | 345 | then { | |
346 | 346 | let checkpoint = _checkpoint(false) | |
347 | 347 | if ((checkpoint == checkpoint)) | |
348 | 348 | then { | |
349 | 349 | let lastRate = _loadBigInt(KEY_LAST_RATE, PERCENT_FACTOR) | |
350 | 350 | let currentRate = _loadBigInt(KEY_CURRENT_RATE, ZERO_BIGINT) | |
351 | 351 | let lastHeight = _loadInt(KEY_LAST_HEIGHT, 0) | |
352 | 352 | let targetHeight = min([_loadInt(KEY_TARGET_HEIGHT, 0), height]) | |
353 | 353 | let lastRateUpdated = (lastRate + (currentRate * toBigInt((targetHeight - lastHeight)))) | |
354 | 354 | let baseAmount = toInt(fraction(toBigInt(i.payments[0].amount), lastRateUpdated, PERCENT_FACTOR, FLOOR)) | |
355 | 355 | let currentRateUpdated = fraction(currentRate, assetQuantity, (assetQuantity - toBigInt(i.payments[0].amount)), FLOOR) | |
356 | 356 | let lastHeightUpdated = targetHeight | |
357 | 357 | let stakeActions = _updateStaking(baseAsset, (-1 * baseAmount), _loadStakingAdapter()) | |
358 | 358 | $Tuple2((stakeActions ++ [Burn(asset, i.payments[0].amount), ScriptTransfer(i.caller, baseAmount, unit), BinaryEntry(KEY_LAST_RATE, toBytes(lastRateUpdated)), BinaryEntry(KEY_CURRENT_RATE, toBytes(currentRateUpdated)), IntegerEntry(KEY_LAST_HEIGHT, lastHeightUpdated)]), unit) | |
359 | 359 | } | |
360 | 360 | else throw("Strict value is not equal to itself.") | |
361 | 361 | } | |
362 | 362 | else throw("Strict value is not equal to itself.") | |
363 | 363 | } | |
364 | 364 | ||
365 | 365 | ||
366 | 366 | ||
367 | 367 | @Callable(i) | |
368 | 368 | func setMultisig (multisig_) = { | |
369 | 369 | let err = if ((i.caller != this)) | |
370 | 370 | then throw("setMultisig: permission denied") | |
371 | 371 | else if (!(_validateAddress(multisig_))) | |
372 | 372 | then throw("setMultisig: invalid multisig address") | |
373 | 373 | else unit | |
374 | 374 | if ((err == err)) | |
375 | 375 | then $Tuple2([StringEntry(KEY_MULTISIG, multisig_)], unit) | |
376 | 376 | else throw("Strict value is not equal to itself.") | |
377 | 377 | } | |
378 | 378 | ||
379 | 379 | ||
380 | 380 | ||
381 | 381 | @Callable(i) | |
382 | 382 | func setSponsorshipManager (manager_) = { | |
383 | 383 | let err = if ((i.caller != this)) | |
384 | 384 | then throw("setSponsorshipManager: permission denied") | |
385 | 385 | else if (!(_validateAddress(manager_))) | |
386 | 386 | then throw("setSponsorshipManager: invalid manager address") | |
387 | 387 | else unit | |
388 | 388 | if ((err == err)) | |
389 | 389 | then $Tuple2([StringEntry(KEY_SPONSORSHIP_MANAGER, manager_)], unit) | |
390 | 390 | else throw("Strict value is not equal to itself.") | |
391 | 391 | } | |
392 | 392 | ||
393 | 393 | ||
394 | 394 | ||
395 | 395 | @Callable(i) | |
396 | 396 | func updateSponsorship (minSponsoredAssetFee_,wavesRequiredAmount_) = { | |
397 | 397 | let err = if ((i.caller != _loadSponsorshipManager())) | |
398 | 398 | then throw("updateSponsorship: permission denied") | |
399 | 399 | else if ((0 > minSponsoredAssetFee_)) | |
400 | 400 | then throw("updateSponsorship: invalid sponsorship fee") | |
401 | 401 | else if ((0 > wavesRequiredAmount_)) | |
402 | 402 | then throw("updateSponsorship: invalid waves required amount") | |
403 | 403 | else unit | |
404 | 404 | if ((err == err)) | |
405 | 405 | then { | |
406 | 406 | let sponsorAsset = _loadAsset() | |
407 | 407 | let minSponsoredAssetFee = if ((minSponsoredAssetFee_ == 0)) | |
408 | 408 | then unit | |
409 | 409 | else minSponsoredAssetFee_ | |
410 | 410 | let actions = if ((wavesBalance(this).regular > wavesRequiredAmount_)) | |
411 | 411 | then [ScriptTransfer(i.caller, (wavesBalance(this).regular - wavesRequiredAmount_), unit)] | |
412 | 412 | else nil | |
413 | 413 | $Tuple2((actions ++ [ScriptTransfer(i.caller, assetBalance(this, sponsorAsset), sponsorAsset), SponsorFee(sponsorAsset, minSponsoredAssetFee)]), unit) | |
414 | 414 | } | |
415 | 415 | else throw("Strict value is not equal to itself.") | |
416 | 416 | } | |
417 | 417 | ||
418 | 418 | ||
419 | 419 | ||
420 | 420 | @Callable(i) | |
421 | 421 | func wxVotingSuggest (votingAddress_,wxAsset_,wxAmount_,assetImage_) = { | |
422 | 422 | let err = if ((i.caller != this)) | |
423 | 423 | then throw("wxVotingSuggest: permission denied") | |
424 | 424 | else if (!(_validateAddress(votingAddress_))) | |
425 | 425 | then throw("wxVotingSuggest: invalid voting address") | |
426 | 426 | else if ((0 > wxAmount_)) | |
427 | 427 | then throw("wxVotingSuggest: invalid wx amount") | |
428 | 428 | else unit | |
429 | 429 | if ((err == err)) | |
430 | 430 | then { | |
431 | 431 | let sponsorAssetStr = toBase58String(_loadAsset()) | |
432 | - | let wxAsset = _toAssetVector(wxAsset_) | |
433 | - | let wxAssetInfo = valueOrErrorMessage(assetInfo(valueOrErrorMessage(wxAsset, "wxVotingSuggest: invalid wx asset")), "wxVotingSuggest: invalid wx asset info") | |
434 | - | let invocation = invoke(addressFromStringValue(votingAddress_), "suggest", [sponsorAssetStr, assetImage_], [AttachedPayment(wxAsset, (wxAmount_ * wxAssetInfo.decimals))]) | |
432 | + | let invocation = invoke(addressFromStringValue(votingAddress_), "suggest", [sponsorAssetStr, assetImage_], [AttachedPayment(_toAssetVector(wxAsset_), wxAmount_)]) | |
435 | 433 | if ((invocation == invocation)) | |
436 | 434 | then $Tuple2(nil, unit) | |
437 | 435 | else throw("Strict value is not equal to itself.") | |
438 | 436 | } | |
439 | 437 | else throw("Strict value is not equal to itself.") | |
440 | 438 | } | |
441 | 439 | ||
442 | 440 | ||
443 | 441 | @Verifier(tx) | |
444 | 442 | func verify () = match getString(KEY_MULTISIG) { | |
445 | 443 | case multisig: String => | |
446 | 444 | valueOrElse(getBoolean(addressFromStringValue(multisig), makeString([KEY_STATUS, toString(this), toBase58String(tx.id)], SEPARATOR)), false) | |
447 | 445 | case _ => | |
448 | 446 | sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
449 | 447 | } | |
450 | 448 |
github/deemru/w8io/026f985 47.88 ms ◑