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