tx · EKGryZBJNkvtqUa49WZ9pXvnQThXHooWS9TKRkLT4LxZ 3ND5e5puMFTnV5TfaMoyrSQYrfSZFosGJuy: -0.01400000 Waves 2021.12.29 17:03 [1855605] smart account 3ND5e5puMFTnV5TfaMoyrSQYrfSZFosGJuy > SELF 0.00000000 Waves
{ "type": 13, "id": "EKGryZBJNkvtqUa49WZ9pXvnQThXHooWS9TKRkLT4LxZ", "fee": 1400000, "feeAssetId": null, "timestamp": 1640786590600, "version": 2, "chainId": 84, "sender": "3ND5e5puMFTnV5TfaMoyrSQYrfSZFosGJuy", "senderPublicKey": "C6iMaphKmZhNNRTWqKgEoycaCTfy6skgkLcPNxABf8aj", "proofs": [ "458me9CFqz8zCyoG6PhgqqY7yDjLVgv7dHeBkgTsE8LLT8kuLWRBdPkP24wvfr4odiaL9DbHsVBSrhs4isVo9FDq", "2f6hvnEiKG1HbuGb59FZv7kVeft1sVRazpTxo5a5kwgd291mpycZP7k3YrT781HVH7c12Q6EDweSgS9ZADMRYSKR" ], "script": "base64:AAIFAAAAAAAAD2cIAhIDCgEEEgcKBQEBCAgEEgMKAQESAwoBARIAEgMKAQESABIAEgMKAQESBQoDBAEIEgAaFAoBQRIPa2V5QWRtaW5QdWJLZXkyGhQKAUISD2tleUFkbWluUHViS2V5MxoLCgFDEgZvcmFjbGUaEAoBRBILZ2V0QWRtaW5QdWIaEAoBRRILa2V5QWRtaW5QdWIaDAoBRhIHJG1hdGNoMBoLCgFHEgZzdHJpbmcaDAoBSBIHbm90aGluZxoRCgFJEgxhZG1pblB1YktleTEaEQoBShIMYWRtaW5QdWJLZXkyGhEKAUsSDGFkbWluUHViS2V5MxoZCgFMEhRhZG1pblB1YktleVN0YXJ0U3RvcBoXCgFNEhJhZG1pblB1YktleVN0YWtpbmcaEgoBThINd2FsbGV0QWRkcmVzcxoSCgFPEg12b3RpbmdBZGRyZXNzGgkKAVASBFVTRE4aCQoBURIETlNCVBoJCgFSEgRFVVJOGhIKAVMSDXN0YWtpbm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9keUJ5dGVzCQABkQAAAAIIBQAAAAJjQwAAAAZwcm9vZnMAAAAAAAAAAAAFAAAAAU0DAwMDBQAAAAJjSQYFAAAAAmNKBgUAAAACY0sFAAAAAmNMBwYFAAAAAmNFBQAAAAJjRaC0PsE=", "height": 1855605, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: B3aeZjkppFCCQPDZVgtcLiCbhhtdB7VczeQ6uvCdDJKA Next: 486qMbpXFGSkkC1biqL7VnqquwU4Y6NAHQRyJH4kF4hx Diff:
Old | New | Differences | |
---|---|---|---|
41 | 41 | ||
42 | 42 | let kStartHeight = "start_height" | |
43 | 43 | ||
44 | - | let kFirstHarvestHeight = "first_harvest_height" | |
44 | + | let keyUSDNNSBTAddress = "staking_usdnnsbt_address" | |
45 | + | ||
46 | + | let keyEURNAddress = "staking_eurn_address" | |
47 | + | ||
48 | + | let keyLeasingPool = "leasing_address" | |
49 | + | ||
50 | + | let keyLeasingAmount = "leasing_amount" | |
51 | + | ||
52 | + | let keyLeasingId = "leasing_id" | |
45 | 53 | ||
46 | 54 | let keyAdminPubKey1 = "admin_pub_1" | |
47 | 55 | ||
77 | 85 | ||
78 | 86 | let NSBT = base58'36mg8NZTaFRDygiVwb8uBnLR51hetJruUCZcxhaVcHj9' | |
79 | 87 | ||
80 | - | let SWOP = base58'2HAJrwa8q4SxBx9cHYaBTQdBjdk5wwqdof7ccpAx2uhZ' | |
81 | - | ||
82 | 88 | let EURN = base58'ECBCkHS68DckpBrzLeoRgYbFg7sCVqR176mPqbXsj9pA' | |
83 | 89 | ||
84 | - | let | |
90 | + | let stakingAssets = ["WAVES", toBase58String(USDN), toBase58String(NSBT), toBase58String(EURN)] | |
85 | 91 | ||
86 | - | let | |
92 | + | let stakingUSDNNSBTAddress = Address(fromBase58String(valueOrErrorMessage(getString(oracle, keyUSDNNSBTAddress), "no usdn staking address"))) | |
87 | 93 | ||
88 | - | let | |
94 | + | let stakingEURNAddress = Address(fromBase58String(valueOrErrorMessage(getString(oracle, keyEURNAddress), "no usdn staking address"))) | |
89 | 95 | ||
90 | - | let | |
96 | + | let USDNToWavesExchanger = Address(base58'3N8PGkzXhbtTvEwEQTtE2xiTJmsDEQ9XfoZ') | |
91 | 97 | ||
92 | - | let stakingFeeInUSDN = 270000 | |
93 | - | ||
94 | - | let stakingFeeInEURN = 234000 | |
98 | + | let USDNToNSBTExchanger = Address(base58'3MqW1t2cxdYy2emEMk3YtZkRwQPhHaTfWRe') | |
95 | 99 | ||
96 | 100 | let basePeriod = valueOrErrorMessage(getInteger(votingAddress, kBasePeriod), "Empty kBasePeriod") | |
97 | 101 | ||
143 | 147 | ||
144 | 148 | let commission = 3000 | |
145 | 149 | ||
146 | - | let commissionGovernance = 1200 | |
147 | - | ||
148 | 150 | let commissionScaleDelimiter = 1000000 | |
149 | 151 | ||
150 | 152 | let scaleValue3 = 1000 | |
152 | 154 | let scaleValue8 = 100000000 | |
153 | 155 | ||
154 | 156 | let slippageToleranceDelimiter = 1000 | |
155 | - | ||
156 | - | let scaleValue8Digits = 8 | |
157 | 157 | ||
158 | 158 | func accountBalance (assetId) = match assetId { | |
159 | 159 | case id: ByteVector => | |
176 | 176 | then getInteger(stakingEURNAddress, ((("%s%s%s__stakingBalance__" + toBase58String(aId)) + "__") + toString(this))) | |
177 | 177 | else 0 | |
178 | 178 | case _: Unit => | |
179 | - | 0 | |
179 | + | valueOrElse(getInteger(this, keyLeasingAmount), 0) | |
180 | 180 | case _ => | |
181 | 181 | throw("Match error") | |
182 | 182 | } | |
234 | 234 | func suspend (cause) = [BooleanEntry(keyActive, false), StringEntry(keyCause, cause)] | |
235 | 235 | ||
236 | 236 | ||
237 | - | func deductStakingFee (amount,assetId,secondAssetId) = if (if ((assetId == USDN)) | |
238 | - | then true | |
239 | - | else (assetId == EURN)) | |
240 | - | then { | |
241 | - | let stakinFee = if ((assetId == USDN)) | |
242 | - | then (stakingFeeInUSDN * (if ((secondAssetId == NSBT)) | |
243 | - | then 2 | |
244 | - | else 1)) | |
245 | - | else if ((assetId == EURN)) | |
246 | - | then stakingFeeInEURN | |
247 | - | else 0 | |
248 | - | let result = (amount - stakinFee) | |
249 | - | if ((0 >= result)) | |
250 | - | then throw((((("Insufficient amount " + toString(amount)) + " to deduct staking fee ") + toString(stakinFee)) + "USDN/EURN")) | |
251 | - | else result | |
252 | - | } | |
253 | - | else amount | |
237 | + | func calcStakingFuncAndAddres (stake,assetId) = if (stake) | |
238 | + | then if ((assetId == USDN)) | |
239 | + | then $Tuple2("lockNeutrino", stakingUSDNNSBTAddress) | |
240 | + | else if ((assetId == NSBT)) | |
241 | + | then $Tuple2("lockNsbt", stakingUSDNNSBTAddress) | |
242 | + | else $Tuple2("startStaking", stakingEURNAddress) | |
243 | + | else if ((assetId == USDN)) | |
244 | + | then $Tuple2("unlockNeutrino", stakingUSDNNSBTAddress) | |
245 | + | else if ((assetId == NSBT)) | |
246 | + | then $Tuple2("unlockNsbt", stakingUSDNNSBTAddress) | |
247 | + | else $Tuple2("stopStaking", stakingEURNAddress) | |
254 | 248 | ||
255 | 249 | ||
256 | - | func getStakingFee (assetId,secondAssetId) = if ((assetId == USDN)) | |
257 | - | then (stakingFeeInUSDN * (if ((secondAssetId == NSBT)) | |
258 | - | then 2 | |
259 | - | else 1)) | |
260 | - | else if ((assetId == EURN)) | |
261 | - | then stakingFeeInEURN | |
262 | - | else 0 | |
250 | + | func calcStakingParams (stake,amount,assetId) = if (stake) | |
251 | + | then { | |
252 | + | let $t069306996 = calcStakingFuncAndAddres(stake, assetId) | |
253 | + | let call = $t069306996._1 | |
254 | + | let stakingAddr = $t069306996._2 | |
255 | + | $Tuple4(call, stakingAddr, nil, [AttachedPayment(assetId, amount)]) | |
256 | + | } | |
257 | + | else { | |
258 | + | let $t070827148 = calcStakingFuncAndAddres(stake, assetId) | |
259 | + | let call = $t070827148._1 | |
260 | + | let stakingAddr = $t070827148._2 | |
261 | + | $Tuple4(call, stakingAddr, [amount, toBase58String(assetId)], nil) | |
262 | + | } | |
263 | 263 | ||
264 | 264 | ||
265 | 265 | func throwInsufficientAvailableBalance (amount,available,assetName) = throw((((((((("Insufficient DApp balance to pay " + toString(amount)) + " ") + assetName) + " due to staking. Available: ") + toString(available)) + " ") + assetName) + ". Please contact support in Telegram: https://t.me/swopfisupport")) | |
273 | 273 | ||
274 | 274 | @Callable(i) | |
275 | 275 | func init (firstHarvest) = { | |
276 | - | let $ | |
277 | - | let pmtAmountA = $ | |
278 | - | let pmtAssetIdA = $ | |
279 | - | let $ | |
280 | - | let pmtAmountB = $ | |
281 | - | let pmtAssetIdB = $ | |
282 | - | let $ | |
283 | - | let pmtStrAssetIdA = $ | |
284 | - | let pmtAssetNameA = $ | |
285 | - | let pmtDecimalsA = $ | |
286 | - | let $ | |
287 | - | let pmtStrAssetIdB = $ | |
288 | - | let pmtAssetNameB = $ | |
289 | - | let pmtDecimalsB = $ | |
276 | + | let $t083358412 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
277 | + | let pmtAmountA = $t083358412._1 | |
278 | + | let pmtAssetIdA = $t083358412._2 | |
279 | + | let $t084178494 = $Tuple2(i.payments[1].amount, i.payments[1].assetId) | |
280 | + | let pmtAmountB = $t084178494._1 | |
281 | + | let pmtAssetIdB = $t084178494._2 | |
282 | + | let $t084998576 = getAssetInfo(pmtAssetIdA) | |
283 | + | let pmtStrAssetIdA = $t084998576._1 | |
284 | + | let pmtAssetNameA = $t084998576._2 | |
285 | + | let pmtDecimalsA = $t084998576._3 | |
286 | + | let $t085818658 = getAssetInfo(pmtAssetIdB) | |
287 | + | let pmtStrAssetIdB = $t085818658._1 | |
288 | + | let pmtAssetNameB = $t085818658._2 | |
289 | + | let pmtDecimalsB = $t085818658._3 | |
290 | 290 | if (!(containsElement([adminPubKey1, adminPubKey2, adminPubKey3, adminPubKeyStaking], i.callerPublicKey))) | |
291 | 291 | then throw("Only admin can call this function") | |
292 | 292 | else if (isDefined(getBoolean(this, keyActive))) | |
303 | 303 | let shareInitialSupply = fraction(arg1, arg2, arg3) | |
304 | 304 | let shareIssue = Issue(shareName, shareDescription, shareInitialSupply, shareDecimals, true) | |
305 | 305 | let shareIssueId = calculateAssetId(shareIssue) | |
306 | - | let baseEntry = [StringEntry(keyVersion, version), BooleanEntry(keyActive, true), StringEntry(keyAssetIdA, pmtStrAssetIdA), StringEntry(keyAssetIdB, pmtStrAssetIdB), IntegerEntry(keyBalanceA, pmtAmountA), IntegerEntry(keyBalanceB, pmtAmountB), IntegerEntry(keyCommission, commission), IntegerEntry(keyCommissionScaleDelimiter, commissionScaleDelimiter), shareIssue, StringEntry(keyShareAssetId, toBase58String(shareIssueId)), IntegerEntry(keyShareAssetSupply, shareInitialSupply), ScriptTransfer(i.caller, shareInitialSupply, shareIssueId)] | |
307 | - | if (firstHarvest) | |
308 | - | then (baseEntry ++ [BooleanEntry(keyFirstHarvest, firstHarvest), IntegerEntry(keyFirstHarvestHeight, (startHeight + (firstHarvestEndPeriod * periodLength)))]) | |
309 | - | else baseEntry | |
306 | + | let stake1 = if (containsElement(stakingAssets, pmtStrAssetIdA)) | |
307 | + | then invoke(this, "stakeUnstake", [true, pmtAmountA, pmtStrAssetIdA], nil) | |
308 | + | else 0 | |
309 | + | if ((stake1 == stake1)) | |
310 | + | then { | |
311 | + | let stake2 = if (containsElement(stakingAssets, pmtStrAssetIdB)) | |
312 | + | then invoke(this, "stakeUnstake", [true, pmtAmountB, pmtStrAssetIdB], nil) | |
313 | + | else 0 | |
314 | + | if ((stake2 == stake2)) | |
315 | + | then { | |
316 | + | let baseEntry = [StringEntry(keyVersion, version), BooleanEntry(keyActive, true), StringEntry(keyAssetIdA, pmtStrAssetIdA), StringEntry(keyAssetIdB, pmtStrAssetIdB), IntegerEntry(keyBalanceA, pmtAmountA), IntegerEntry(keyBalanceB, pmtAmountB), IntegerEntry(keyCommission, commission), IntegerEntry(keyCommissionScaleDelimiter, commissionScaleDelimiter), shareIssue, StringEntry(keyShareAssetId, toBase58String(shareIssueId)), IntegerEntry(keyShareAssetSupply, shareInitialSupply), ScriptTransfer(i.caller, shareInitialSupply, shareIssueId)] | |
317 | + | if (firstHarvest) | |
318 | + | then (baseEntry ++ [BooleanEntry(keyFirstHarvest, firstHarvest), IntegerEntry(keyFirstHarvestHeight, (startHeight + (firstHarvestEndPeriod * periodLength)))]) | |
319 | + | else baseEntry | |
320 | + | } | |
321 | + | else throw("Strict value is not equal to itself.") | |
322 | + | } | |
323 | + | else throw("Strict value is not equal to itself.") | |
310 | 324 | } | |
311 | 325 | } | |
312 | 326 | ||
314 | 328 | ||
315 | 329 | @Callable(i) | |
316 | 330 | func initWithInitRatio (amtAssetA,amtAssetB,strAssetIdA,strAssetIdB,firstHarvest) = { | |
317 | - | let $ | |
318 | - | let pmtStrAssetIdA = $ | |
319 | - | let pmtAssetNameA = $ | |
320 | - | let pmtDecimalsA = $ | |
321 | - | let $ | |
322 | - | let pmtStrAssetIdB = $ | |
323 | - | let pmtAssetNameB = $ | |
324 | - | let pmtDecimalsB = $ | |
331 | + | let $t01124711334 = getAssetInfoFromString(strAssetIdA) | |
332 | + | let pmtStrAssetIdA = $t01124711334._1 | |
333 | + | let pmtAssetNameA = $t01124711334._2 | |
334 | + | let pmtDecimalsA = $t01124711334._3 | |
335 | + | let $t01133911426 = getAssetInfoFromString(strAssetIdB) | |
336 | + | let pmtStrAssetIdB = $t01133911426._1 | |
337 | + | let pmtAssetNameB = $t01133911426._2 | |
338 | + | let pmtDecimalsB = $t01133911426._3 | |
325 | 339 | if (!(containsElement([adminPubKey1, adminPubKey2, adminPubKey3, adminPubKeyStaking], i.callerPublicKey))) | |
326 | 340 | then throw("Only admin can call this function") | |
327 | 341 | else if (isDefined(getBoolean(this, keyActive))) | |
357 | 371 | func replenishWithTwoTokens (slippageTolerance) = { | |
358 | 372 | let pmtAssetIdA = i.payments[0].assetId | |
359 | 373 | let pmtAssetIdB = i.payments[1].assetId | |
360 | - | let pmtAmountA = deductStakingFee(i.payments[0].amount, pmtAssetIdA, pmtAssetIdB) | |
361 | - | let pmtAmountB = deductStakingFee(i.payments[1].amount, pmtAssetIdB, pmtAssetIdA) | |
374 | + | let pmtAmountA = i.payments[0].amount | |
375 | + | let pmtAmountB = i.payments[1].amount | |
376 | + | let $t01392314000 = getAssetInfo(pmtAssetIdA) | |
377 | + | let pmtStrAssetIdA = $t01392314000._1 | |
378 | + | let pmtAssetNameA = $t01392314000._2 | |
379 | + | let pmtDecimalsA = $t01392314000._3 | |
380 | + | let $t01400514082 = getAssetInfo(pmtAssetIdB) | |
381 | + | let pmtStrAssetIdB = $t01400514082._1 | |
382 | + | let pmtAssetNameB = $t01400514082._2 | |
383 | + | let pmtDecimalsB = $t01400514082._3 | |
362 | 384 | if (if ((balanceA == 0)) | |
363 | 385 | then (balanceB == 0) | |
364 | 386 | else false) | |
365 | 387 | then { | |
366 | - | let $t01345913536 = getAssetInfo(pmtAssetIdA) | |
367 | - | let pmtStrAssetIdA = $t01345913536._1 | |
368 | - | let pmtAssetNameA = $t01345913536._2 | |
369 | - | let pmtDecimalsA = $t01345913536._3 | |
370 | - | let $t01354513622 = getAssetInfo(pmtAssetIdB) | |
371 | - | let pmtStrAssetIdB = $t01354513622._1 | |
372 | - | let pmtAssetNameB = $t01354513622._2 | |
373 | - | let pmtDecimalsB = $t01354513622._3 | |
374 | 388 | let tokenRatio = fraction(fraction(assetInitA, scaleValue8, pmtAmountA), scaleValue3, fraction(assetInitB, scaleValue8, pmtAmountB)) | |
375 | 389 | if ((pmtAssetIdA == pmtAssetIdB)) | |
376 | 390 | then throw("Assets must be different") | |
397 | 411 | then throw("Too small amount to replenish") | |
398 | 412 | else if (!(hasEnoughBalance)) | |
399 | 413 | then ([ScriptTransfer(i.caller, pmtAmountA, pmtAssetIdA), ScriptTransfer(i.caller, pmtAmountB, pmtAssetIdB)] ++ suspendSuspicious()) | |
400 | - | else [Reissue(shareAssetId, shareInitialSupply, true), IntegerEntry(keyBalanceA, pmtAmountA), IntegerEntry(keyBalanceB, pmtAmountB), IntegerEntry(keyShareAssetSupply, shareInitialSupply), ScriptTransfer(i.caller, shareInitialSupply, shareAssetId)] | |
414 | + | else { | |
415 | + | let stake1 = if (containsElement(stakingAssets, pmtStrAssetIdA)) | |
416 | + | then invoke(this, "stakeUnstake", [true, pmtAmountA, pmtStrAssetIdA], nil) | |
417 | + | else 0 | |
418 | + | if ((stake1 == stake1)) | |
419 | + | then { | |
420 | + | let stake2 = if (containsElement(stakingAssets, pmtStrAssetIdB)) | |
421 | + | then invoke(this, "stakeUnstake", [true, pmtAmountB, pmtStrAssetIdB], nil) | |
422 | + | else 0 | |
423 | + | if ((stake2 == stake2)) | |
424 | + | then [Reissue(shareAssetId, shareInitialSupply, true), IntegerEntry(keyBalanceA, pmtAmountA), IntegerEntry(keyBalanceB, pmtAmountB), IntegerEntry(keyShareAssetSupply, shareInitialSupply), ScriptTransfer(i.caller, shareInitialSupply, shareAssetId)] | |
425 | + | else throw("Strict value is not equal to itself.") | |
426 | + | } | |
427 | + | else throw("Strict value is not equal to itself.") | |
428 | + | } | |
401 | 429 | } | |
402 | 430 | } | |
403 | 431 | else { | |
425 | 453 | then throw("Too small amount to replenish") | |
426 | 454 | else if (!(hasEnoughBalance)) | |
427 | 455 | then ([ScriptTransfer(i.caller, pmtAmountA, pmtAssetIdA), ScriptTransfer(i.caller, pmtAmountB, pmtAssetIdB)] ++ suspendSuspicious()) | |
428 | - | else [IntegerEntry(keyBalanceA, (balanceA + pmtAmountA)), IntegerEntry(keyBalanceB, (balanceB + pmtAmountB)), IntegerEntry(keyShareAssetSupply, (shareAssetSupply + shareTokenToPayAmount)), Reissue(shareAssetId, shareTokenToPayAmount, true), ScriptTransfer(i.caller, shareTokenToPayAmount, shareAssetId)] | |
456 | + | else { | |
457 | + | let stake1 = if (containsElement(stakingAssets, pmtStrAssetIdA)) | |
458 | + | then invoke(this, "stakeUnstake", [true, pmtAmountA, pmtStrAssetIdA], nil) | |
459 | + | else 0 | |
460 | + | if ((stake1 == stake1)) | |
461 | + | then { | |
462 | + | let stake2 = if (containsElement(stakingAssets, pmtStrAssetIdB)) | |
463 | + | then invoke(this, "stakeUnstake", [true, pmtAmountB, pmtStrAssetIdB], nil) | |
464 | + | else 0 | |
465 | + | if ((stake2 == stake2)) | |
466 | + | then [IntegerEntry(keyBalanceA, (balanceA + pmtAmountA)), IntegerEntry(keyBalanceB, (balanceB + pmtAmountB)), IntegerEntry(keyShareAssetSupply, (shareAssetSupply + shareTokenToPayAmount)), Reissue(shareAssetId, shareTokenToPayAmount, true), ScriptTransfer(i.caller, shareTokenToPayAmount, shareAssetId)] | |
467 | + | else throw("Strict value is not equal to itself.") | |
468 | + | } | |
469 | + | else throw("Strict value is not equal to itself.") | |
470 | + | } | |
429 | 471 | } | |
430 | 472 | } | |
431 | 473 | ||
433 | 475 | ||
434 | 476 | @Callable(i) | |
435 | 477 | func withdraw () = { | |
436 | - | let $ | |
437 | - | let pmtAmount = $ | |
438 | - | let pmtAssetId = $ | |
439 | - | let amountToPayA = | |
440 | - | let amountToPayB = | |
478 | + | let $t01925119326 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
479 | + | let pmtAmount = $t01925119326._1 | |
480 | + | let pmtAssetId = $t01925119326._2 | |
481 | + | let amountToPayA = fraction(pmtAmount, balanceA, shareAssetSupply) | |
482 | + | let amountToPayB = fraction(pmtAmount, balanceB, shareAssetSupply) | |
441 | 483 | if (!(isActive)) | |
442 | 484 | then throw("DApp is inactive at this moment") | |
443 | 485 | else if ((size(i.payments) != 1)) | |
450 | 492 | then true | |
451 | 493 | else (amountToPayB > availableBalanceB)) | |
452 | 494 | then throwInsufficientAvailableBalances(amountToPayA, amountToPayB) | |
453 | - | else [IntegerEntry(keyBalanceA, (balanceA - amountToPayA)), IntegerEntry(keyBalanceB, (balanceB - amountToPayB)), IntegerEntry(keyShareAssetSupply, (shareAssetSupply - pmtAmount)), Burn(shareAssetId, pmtAmount), ScriptTransfer(i.caller, amountToPayA, assetIdA), ScriptTransfer(i.caller, amountToPayB, assetIdB)] | |
495 | + | else { | |
496 | + | let stake1 = if (containsElement(stakingAssets, strAssetIdA)) | |
497 | + | then invoke(this, "stakeUnstake", [false, amountToPayA, strAssetIdA], nil) | |
498 | + | else 0 | |
499 | + | if ((stake1 == stake1)) | |
500 | + | then { | |
501 | + | let stake2 = if (containsElement(stakingAssets, strAssetIdB)) | |
502 | + | then invoke(this, "stakeUnstake", [false, amountToPayB, strAssetIdB], nil) | |
503 | + | else 0 | |
504 | + | if ((stake2 == stake2)) | |
505 | + | then [IntegerEntry(keyBalanceA, (balanceA - amountToPayA)), IntegerEntry(keyBalanceB, (balanceB - amountToPayB)), IntegerEntry(keyShareAssetSupply, (shareAssetSupply - pmtAmount)), Burn(shareAssetId, pmtAmount), ScriptTransfer(i.caller, amountToPayA, assetIdA), ScriptTransfer(i.caller, amountToPayB, assetIdB)] | |
506 | + | else throw("Strict value is not equal to itself.") | |
507 | + | } | |
508 | + | else throw("Strict value is not equal to itself.") | |
509 | + | } | |
454 | 510 | } | |
455 | 511 | ||
456 | 512 | ||
457 | 513 | ||
458 | 514 | @Callable(i) | |
459 | 515 | func exchange (minAmountToReceive) = { | |
460 | - | let $ | |
461 | - | let pmtAmount = $ | |
462 | - | let pmtAssetId = $ | |
516 | + | let $t02084120916 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
517 | + | let pmtAmount = $t02084120916._1 | |
518 | + | let pmtAssetId = $t02084120916._2 | |
463 | 519 | func calculateFees (tokenFrom,tokenTo) = { | |
464 | 520 | let amountWithoutFee = fraction(tokenTo, pmtAmount, (pmtAmount + tokenFrom)) | |
465 | 521 | let amountWithFee = fraction(amountWithoutFee, (commissionScaleDelimiter - commission), commissionScaleDelimiter) | |
484 | 540 | else if ((pmtAssetId == assetIdA)) | |
485 | 541 | then { | |
486 | 542 | let assetIdSend = assetIdB | |
487 | - | let $ | |
488 | - | let amountWithoutFee = $ | |
489 | - | let amountWithFee = $ | |
490 | - | let governanceReward = $ | |
543 | + | let $t02219022281 = calculateFees(balanceA, balanceB) | |
544 | + | let amountWithoutFee = $t02219022281._1 | |
545 | + | let amountWithFee = $t02219022281._2 | |
546 | + | let governanceReward = $t02219022281._3 | |
491 | 547 | let newBalanceA = (balanceA + pmtAmount) | |
492 | 548 | let newBalanceB = ((balanceB - amountWithFee) - governanceReward) | |
493 | - | if (if ((stakedAmountA >= newBalanceA)) | |
494 | - | then true | |
495 | - | else (stakedAmountB >= newBalanceB)) | |
496 | - | then throwInsufficientAvailableBalance(amountWithFee, availableBalanceB, assetNameB) | |
497 | - | else [IntegerEntry(keyBalanceA, newBalanceA), IntegerEntry(keyBalanceB, newBalanceB), ScriptTransfer(i.caller, amountWithFee, assetIdSend), ScriptTransfer(walletAddress, governanceReward, assetIdSend)] | |
549 | + | let stake1 = if (containsElement(stakingAssets, strAssetIdA)) | |
550 | + | then invoke(this, "stakeUnstake", [true, pmtAmount, strAssetIdA], nil) | |
551 | + | else 0 | |
552 | + | if ((stake1 == stake1)) | |
553 | + | then { | |
554 | + | let stake2 = if (containsElement(stakingAssets, strAssetIdB)) | |
555 | + | then invoke(this, "stakeUnstake", [false, (amountWithFee + governanceReward), strAssetIdB], nil) | |
556 | + | else 0 | |
557 | + | if ((stake2 == stake2)) | |
558 | + | then [IntegerEntry(keyBalanceA, newBalanceA), IntegerEntry(keyBalanceB, newBalanceB), ScriptTransfer(i.caller, amountWithFee, assetIdSend), ScriptTransfer(walletAddress, governanceReward, assetIdSend)] | |
559 | + | else throw("Strict value is not equal to itself.") | |
560 | + | } | |
561 | + | else throw("Strict value is not equal to itself.") | |
498 | 562 | } | |
499 | 563 | else if ((pmtAssetId == assetIdB)) | |
500 | 564 | then { | |
501 | 565 | let assetIdSend = assetIdA | |
502 | - | let $ | |
503 | - | let amountWithoutFee = $ | |
504 | - | let amountWithFee = $ | |
505 | - | let governanceReward = $ | |
566 | + | let $t02323623327 = calculateFees(balanceB, balanceA) | |
567 | + | let amountWithoutFee = $t02323623327._1 | |
568 | + | let amountWithFee = $t02323623327._2 | |
569 | + | let governanceReward = $t02323623327._3 | |
506 | 570 | let newBalanceA = ((balanceA - amountWithFee) - governanceReward) | |
507 | 571 | let newBalanceB = (balanceB + pmtAmount) | |
508 | 572 | if (if ((stakedAmountA >= newBalanceA)) | |
509 | 573 | then true | |
510 | 574 | else (stakedAmountB >= newBalanceB)) | |
511 | 575 | then throwInsufficientAvailableBalance(amountWithFee, availableBalanceA, assetNameA) | |
512 | - | else [IntegerEntry(keyBalanceA, newBalanceA), IntegerEntry(keyBalanceB, newBalanceB), ScriptTransfer(i.caller, amountWithFee, assetIdSend), ScriptTransfer(walletAddress, governanceReward, assetIdSend)] | |
576 | + | else { | |
577 | + | let stake1 = if (containsElement(stakingAssets, strAssetIdA)) | |
578 | + | then invoke(this, "stakeUnstake", [false, (amountWithFee + governanceReward), strAssetIdA], nil) | |
579 | + | else 0 | |
580 | + | if ((stake1 == stake1)) | |
581 | + | then { | |
582 | + | let stake2 = if (containsElement(stakingAssets, strAssetIdB)) | |
583 | + | then invoke(this, "stakeUnstake", [true, pmtAmount, strAssetIdB], nil) | |
584 | + | else 0 | |
585 | + | if ((stake2 == stake2)) | |
586 | + | then [IntegerEntry(keyBalanceA, newBalanceA), IntegerEntry(keyBalanceB, newBalanceB), ScriptTransfer(i.caller, amountWithFee, assetIdSend), ScriptTransfer(walletAddress, governanceReward, assetIdSend)] | |
587 | + | else throw("Strict value is not equal to itself.") | |
588 | + | } | |
589 | + | else throw("Strict value is not equal to itself.") | |
590 | + | } | |
513 | 591 | } | |
514 | 592 | else throw(((("Incorrect asset attached. Expected: " + strAssetIdA) + " or ") + strAssetIdB)) | |
515 | 593 | } | |
558 | 636 | then true | |
559 | 637 | else (0 > amountEnrollB)) | |
560 | 638 | then throw("Too large amountLeave") | |
561 | - | else [IntegerEntry(keyBalanceA, (balanceA + amountEnrollA)), IntegerEntry(keyBalanceB, (balanceB + amountEnrollB)), IntegerEntry(("last_income_" + strAssetIdA), amountEnrollA), IntegerEntry(("last_income_" + strAssetIdB), amountEnrollB)] | |
639 | + | else { | |
640 | + | let stake1 = if (if (containsElement(stakingAssets, strAssetIdA)) | |
641 | + | then (amountEnrollA > 0) | |
642 | + | else false) | |
643 | + | then invoke(this, "stakeUnstake", [true, amountEnrollA, strAssetIdA], nil) | |
644 | + | else 0 | |
645 | + | if ((stake1 == stake1)) | |
646 | + | then { | |
647 | + | let stake2 = if (if (containsElement(stakingAssets, strAssetIdB)) | |
648 | + | then (amountEnrollB > 0) | |
649 | + | else false) | |
650 | + | then invoke(this, "stakeUnstake", [true, amountEnrollB, strAssetIdB], nil) | |
651 | + | else 0 | |
652 | + | if ((stake2 == stake2)) | |
653 | + | then [IntegerEntry(keyBalanceA, (balanceA + amountEnrollA)), IntegerEntry(keyBalanceB, (balanceB + amountEnrollB)), IntegerEntry(("last_income_" + strAssetIdA), amountEnrollA), IntegerEntry(("last_income_" + strAssetIdB), amountEnrollB)] | |
654 | + | else throw("Strict value is not equal to itself.") | |
655 | + | } | |
656 | + | else throw("Strict value is not equal to itself.") | |
657 | + | } | |
562 | 658 | } | |
659 | + | ||
660 | + | ||
661 | + | ||
662 | + | @Callable(i) | |
663 | + | func stakeUnstake (stake,amount,assetIdString) = if ((i.caller != this)) | |
664 | + | then throw("Only contract itself can invoke this function") | |
665 | + | else if ((assetIdString == "WAVES")) | |
666 | + | then { | |
667 | + | let pool = addressFromStringValue(valueOrErrorMessage(getString(oracle, keyLeasingPool), "No leasing pool in oracle")) | |
668 | + | let leasingId = getBinary(this, keyLeasingId) | |
669 | + | let leasingAmount = valueOrElse(getInteger(this, keyLeasingAmount), 0) | |
670 | + | let newLeaseAmount = if (stake) | |
671 | + | then (leasingAmount + amount) | |
672 | + | else (leasingAmount - amount) | |
673 | + | let newLease = Lease(pool, newLeaseAmount) | |
674 | + | let newLeaseId = calculateLeaseId(newLease) | |
675 | + | let baseEtry = [newLease, BinaryEntry(keyLeasingId, newLeaseId), IntegerEntry(keyLeasingAmount, newLeaseAmount)] | |
676 | + | match leasingId { | |
677 | + | case lId: ByteVector => | |
678 | + | ([LeaseCancel(lId)] ++ baseEtry) | |
679 | + | case _ => | |
680 | + | baseEtry | |
681 | + | } | |
682 | + | } | |
683 | + | else { | |
684 | + | let $t02793128034 = calcStakingParams(stake, amount, fromBase58String(assetIdString)) | |
685 | + | let call = $t02793128034._1 | |
686 | + | let addr = $t02793128034._2 | |
687 | + | let params = $t02793128034._3 | |
688 | + | let payments = $t02793128034._4 | |
689 | + | let inv = invoke(addr, call, params, payments) | |
690 | + | nil | |
691 | + | } | |
692 | + | ||
693 | + | ||
694 | + | ||
695 | + | @Callable(i) | |
696 | + | func stakeAll () = if (!(isActive)) | |
697 | + | then throw("DApp is inactive at this moment") | |
698 | + | else if (!(containsElement([adminPubKey1, adminPubKey2, adminPubKey3, adminPubKeyStartStop], i.callerPublicKey))) | |
699 | + | then throw("Only admin can call this function") | |
700 | + | else { | |
701 | + | let stake1 = if (containsElement(stakingAssets, strAssetIdA)) | |
702 | + | then { | |
703 | + | let amountA = (balanceA - stakedAmountA) | |
704 | + | if ((amountA > 0)) | |
705 | + | then invoke(this, "stakeUnstake", [true, amountA, strAssetIdA], nil) | |
706 | + | else 0 | |
707 | + | } | |
708 | + | else 0 | |
709 | + | if ((stake1 == stake1)) | |
710 | + | then { | |
711 | + | let stake2 = if (containsElement(stakingAssets, strAssetIdB)) | |
712 | + | then { | |
713 | + | let amountB = (balanceB - stakedAmountB) | |
714 | + | if ((amountB > 0)) | |
715 | + | then invoke(this, "stakeUnstake", [true, amountB, strAssetIdB], nil) | |
716 | + | else 0 | |
717 | + | } | |
718 | + | else 0 | |
719 | + | if ((stake2 == stake2)) | |
720 | + | then nil | |
721 | + | else throw("Strict value is not equal to itself.") | |
722 | + | } | |
723 | + | else throw("Strict value is not equal to itself.") | |
724 | + | } | |
563 | 725 | ||
564 | 726 | ||
565 | 727 | @Verifier(tx) | |
581 | 743 | let callTakeIntoAccount = if ((inv.dApp == this)) | |
582 | 744 | then (inv.function == "takeIntoAccountExtraFunds") | |
583 | 745 | else false | |
584 | - | let callStaking = if (if ((inv.dApp == stakingUSDNNSBTAddress)) | |
585 | - | then if (if (if (containsElement(["lockNeutrino", "lockNsbt"], inv.function)) | |
586 | - | then (size(inv.payments) == 1) | |
587 | - | else false) | |
588 | - | then if ((inv.payments[0].assetId == USDN)) | |
589 | - | then true | |
590 | - | else (inv.payments[0].assetId == NSBT) | |
591 | - | else false) | |
592 | - | then true | |
593 | - | else if (containsElement(["unlockNeutrino", "unlockNsbt"], inv.function)) | |
594 | - | then (size(inv.payments) == 0) | |
595 | - | else false | |
596 | - | else false) | |
597 | - | then true | |
598 | - | else if ((inv.dApp == stakingEURNAddress)) | |
599 | - | then if (if (if ((inv.function == "startStaking")) | |
600 | - | then (size(inv.payments) == 1) | |
601 | - | else false) | |
602 | - | then (inv.payments[0].assetId == EURN) | |
603 | - | else false) | |
604 | - | then true | |
605 | - | else if ((inv.function == "stopStaking")) | |
606 | - | then (size(inv.payments) == 0) | |
607 | - | else false | |
608 | - | else false | |
609 | 746 | let exchangeToWaves = if (if (if ((inv.dApp == USDNToWavesExchanger)) | |
610 | 747 | then (inv.function == "exchange") | |
611 | 748 | else false) | |
635 | 772 | else sigVerify(tx.bodyBytes, tx.proofs[0], adminPubKey3)) | |
636 | 773 | then true | |
637 | 774 | else sigVerify(tx.bodyBytes, tx.proofs[0], adminPubKeyStaking) | |
638 | - | if (if (if (if (if (callTakeIntoAccount) | |
639 | - | then true | |
640 | - | else callStaking) | |
775 | + | if (if (if (if (callTakeIntoAccount) | |
641 | 776 | then true | |
642 | 777 | else exchangeToWaves) | |
643 | 778 | then true |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let version = "1.0.0" | |
5 | 5 | ||
6 | 6 | let keyVersion = "version" | |
7 | 7 | ||
8 | 8 | let keyActive = "active" | |
9 | 9 | ||
10 | 10 | let keyAssetIdA = "A_asset_id" | |
11 | 11 | ||
12 | 12 | let keyAssetIdB = "B_asset_id" | |
13 | 13 | ||
14 | 14 | let keyBalanceA = "A_asset_balance" | |
15 | 15 | ||
16 | 16 | let keyBalanceB = "B_asset_balance" | |
17 | 17 | ||
18 | 18 | let keyBalanceInitA = "A_asset_init" | |
19 | 19 | ||
20 | 20 | let keyBalanceInitB = "B_asset_init" | |
21 | 21 | ||
22 | 22 | let keyShareAssetId = "share_asset_id" | |
23 | 23 | ||
24 | 24 | let keyShareAssetSupply = "share_asset_supply" | |
25 | 25 | ||
26 | 26 | let keyCommission = "commission" | |
27 | 27 | ||
28 | 28 | let keyCommissionScaleDelimiter = "commission_scale_delimiter" | |
29 | 29 | ||
30 | 30 | let keyCause = "shutdown_cause" | |
31 | 31 | ||
32 | 32 | let keyFirstHarvest = "first_harvest" | |
33 | 33 | ||
34 | 34 | let keyFirstHarvestHeight = "first_harvest_height" | |
35 | 35 | ||
36 | 36 | let kShareLimit = "share_limit_on_first_harvest" | |
37 | 37 | ||
38 | 38 | let kBasePeriod = "base_period" | |
39 | 39 | ||
40 | 40 | let kPeriodLength = "period_length" | |
41 | 41 | ||
42 | 42 | let kStartHeight = "start_height" | |
43 | 43 | ||
44 | - | let kFirstHarvestHeight = "first_harvest_height" | |
44 | + | let keyUSDNNSBTAddress = "staking_usdnnsbt_address" | |
45 | + | ||
46 | + | let keyEURNAddress = "staking_eurn_address" | |
47 | + | ||
48 | + | let keyLeasingPool = "leasing_address" | |
49 | + | ||
50 | + | let keyLeasingAmount = "leasing_amount" | |
51 | + | ||
52 | + | let keyLeasingId = "leasing_id" | |
45 | 53 | ||
46 | 54 | let keyAdminPubKey1 = "admin_pub_1" | |
47 | 55 | ||
48 | 56 | let keyAdminPubKey2 = "admin_pub_2" | |
49 | 57 | ||
50 | 58 | let keyAdminPubKey3 = "admin_pub_3" | |
51 | 59 | ||
52 | 60 | let oracle = Address(base58'3NBBWfzZtZtszaXbitTKnrB2xXwv26Bn7H9') | |
53 | 61 | ||
54 | 62 | func getAdminPub (keyAdminPub) = match getString(oracle, keyAdminPub) { | |
55 | 63 | case string: String => | |
56 | 64 | fromBase58String(string) | |
57 | 65 | case nothing => | |
58 | 66 | throw("Admin public key is empty") | |
59 | 67 | } | |
60 | 68 | ||
61 | 69 | ||
62 | 70 | let adminPubKey1 = getAdminPub(keyAdminPubKey1) | |
63 | 71 | ||
64 | 72 | let adminPubKey2 = getAdminPub(keyAdminPubKey2) | |
65 | 73 | ||
66 | 74 | let adminPubKey3 = getAdminPub(keyAdminPubKey3) | |
67 | 75 | ||
68 | 76 | let adminPubKeyStartStop = base58'Kn7NpzaG12dLZgcHf2ipUftU6hbJygmrhFqQYE4B7ZK' | |
69 | 77 | ||
70 | 78 | let adminPubKeyStaking = base58'Kn7NpzaG12dLZgcHf2ipUftU6hbJygmrhFqQYE4B7ZK' | |
71 | 79 | ||
72 | 80 | let walletAddress = Address(base58'3NAGTtZz6WpupSN89NZD5rMZwwziZEg4Kx4') | |
73 | 81 | ||
74 | 82 | let votingAddress = Address(base58'3MrJgdL1GniipErHy44YF9idzLaUL2iX5DQ') | |
75 | 83 | ||
76 | 84 | let USDN = base58'8UrfDVd5GreeUwm7uPk7eYz1eMv376kzR52C6sANPkwS' | |
77 | 85 | ||
78 | 86 | let NSBT = base58'36mg8NZTaFRDygiVwb8uBnLR51hetJruUCZcxhaVcHj9' | |
79 | 87 | ||
80 | - | let SWOP = base58'2HAJrwa8q4SxBx9cHYaBTQdBjdk5wwqdof7ccpAx2uhZ' | |
81 | - | ||
82 | 88 | let EURN = base58'ECBCkHS68DckpBrzLeoRgYbFg7sCVqR176mPqbXsj9pA' | |
83 | 89 | ||
84 | - | let | |
90 | + | let stakingAssets = ["WAVES", toBase58String(USDN), toBase58String(NSBT), toBase58String(EURN)] | |
85 | 91 | ||
86 | - | let | |
92 | + | let stakingUSDNNSBTAddress = Address(fromBase58String(valueOrErrorMessage(getString(oracle, keyUSDNNSBTAddress), "no usdn staking address"))) | |
87 | 93 | ||
88 | - | let | |
94 | + | let stakingEURNAddress = Address(fromBase58String(valueOrErrorMessage(getString(oracle, keyEURNAddress), "no usdn staking address"))) | |
89 | 95 | ||
90 | - | let | |
96 | + | let USDNToWavesExchanger = Address(base58'3N8PGkzXhbtTvEwEQTtE2xiTJmsDEQ9XfoZ') | |
91 | 97 | ||
92 | - | let stakingFeeInUSDN = 270000 | |
93 | - | ||
94 | - | let stakingFeeInEURN = 234000 | |
98 | + | let USDNToNSBTExchanger = Address(base58'3MqW1t2cxdYy2emEMk3YtZkRwQPhHaTfWRe') | |
95 | 99 | ||
96 | 100 | let basePeriod = valueOrErrorMessage(getInteger(votingAddress, kBasePeriod), "Empty kBasePeriod") | |
97 | 101 | ||
98 | 102 | let startHeight = valueOrErrorMessage(getInteger(votingAddress, kStartHeight), "Empty kStartHeight") | |
99 | 103 | ||
100 | 104 | let periodLength = valueOrErrorMessage(getInteger(votingAddress, kPeriodLength), "Empty kPeriodLength") | |
101 | 105 | ||
102 | 106 | let firstHarvestEndPeriod = ((basePeriod + ((height - startHeight) / periodLength)) + 3) | |
103 | 107 | ||
104 | 108 | let isActive = getBooleanValue(this, keyActive) | |
105 | 109 | ||
106 | 110 | let strAssetIdA = getStringValue(this, keyAssetIdA) | |
107 | 111 | ||
108 | 112 | let strAssetIdB = getStringValue(this, keyAssetIdB) | |
109 | 113 | ||
110 | 114 | let assetIdA = if ((strAssetIdA == "WAVES")) | |
111 | 115 | then unit | |
112 | 116 | else fromBase58String(strAssetIdA) | |
113 | 117 | ||
114 | 118 | let assetIdB = if ((strAssetIdB == "WAVES")) | |
115 | 119 | then unit | |
116 | 120 | else fromBase58String(strAssetIdB) | |
117 | 121 | ||
118 | 122 | let assetNameA = match assetIdA { | |
119 | 123 | case id: ByteVector => | |
120 | 124 | value(assetInfo(id)).name | |
121 | 125 | case waves: Unit => | |
122 | 126 | "WAVES" | |
123 | 127 | case _ => | |
124 | 128 | throw("Match error") | |
125 | 129 | } | |
126 | 130 | ||
127 | 131 | let assetNameB = match assetIdB { | |
128 | 132 | case id: ByteVector => | |
129 | 133 | value(assetInfo(id)).name | |
130 | 134 | case waves: Unit => | |
131 | 135 | "WAVES" | |
132 | 136 | case _ => | |
133 | 137 | throw("Match error") | |
134 | 138 | } | |
135 | 139 | ||
136 | 140 | let balanceA = getIntegerValue(this, keyBalanceA) | |
137 | 141 | ||
138 | 142 | let balanceB = getIntegerValue(this, keyBalanceB) | |
139 | 143 | ||
140 | 144 | let shareAssetId = fromBase58String(getStringValue(this, keyShareAssetId)) | |
141 | 145 | ||
142 | 146 | let shareAssetSupply = getIntegerValue(this, keyShareAssetSupply) | |
143 | 147 | ||
144 | 148 | let commission = 3000 | |
145 | 149 | ||
146 | - | let commissionGovernance = 1200 | |
147 | - | ||
148 | 150 | let commissionScaleDelimiter = 1000000 | |
149 | 151 | ||
150 | 152 | let scaleValue3 = 1000 | |
151 | 153 | ||
152 | 154 | let scaleValue8 = 100000000 | |
153 | 155 | ||
154 | 156 | let slippageToleranceDelimiter = 1000 | |
155 | - | ||
156 | - | let scaleValue8Digits = 8 | |
157 | 157 | ||
158 | 158 | func accountBalance (assetId) = match assetId { | |
159 | 159 | case id: ByteVector => | |
160 | 160 | assetBalance(this, id) | |
161 | 161 | case waves: Unit => | |
162 | 162 | wavesBalance(this).available | |
163 | 163 | case _ => | |
164 | 164 | throw("Match error") | |
165 | 165 | } | |
166 | 166 | ||
167 | 167 | ||
168 | 168 | func stakedAmount (assetId) = { | |
169 | 169 | let stakedAmountCalculated = match assetId { | |
170 | 170 | case aId: ByteVector => | |
171 | 171 | if (if ((aId == USDN)) | |
172 | 172 | then true | |
173 | 173 | else (aId == NSBT)) | |
174 | 174 | then getInteger(stakingUSDNNSBTAddress, ((("rpd_balance_" + toBase58String(aId)) + "_") + toString(this))) | |
175 | 175 | else if ((aId == EURN)) | |
176 | 176 | then getInteger(stakingEURNAddress, ((("%s%s%s__stakingBalance__" + toBase58String(aId)) + "__") + toString(this))) | |
177 | 177 | else 0 | |
178 | 178 | case _: Unit => | |
179 | - | 0 | |
179 | + | valueOrElse(getInteger(this, keyLeasingAmount), 0) | |
180 | 180 | case _ => | |
181 | 181 | throw("Match error") | |
182 | 182 | } | |
183 | 183 | match stakedAmountCalculated { | |
184 | 184 | case i: Int => | |
185 | 185 | i | |
186 | 186 | case _ => | |
187 | 187 | 0 | |
188 | 188 | } | |
189 | 189 | } | |
190 | 190 | ||
191 | 191 | ||
192 | 192 | let stakedAmountA = stakedAmount(assetIdA) | |
193 | 193 | ||
194 | 194 | let stakedAmountB = stakedAmount(assetIdB) | |
195 | 195 | ||
196 | 196 | let assetInitA = getIntegerValue(this, keyBalanceInitA) | |
197 | 197 | ||
198 | 198 | let assetInitB = getIntegerValue(this, keyBalanceInitB) | |
199 | 199 | ||
200 | 200 | let availableBalanceA = (balanceA - stakedAmountA) | |
201 | 201 | ||
202 | 202 | let availableBalanceB = (balanceB - stakedAmountB) | |
203 | 203 | ||
204 | 204 | let accountBalanceWithStakedA = (accountBalance(assetIdA) + stakedAmountA) | |
205 | 205 | ||
206 | 206 | let accountBalanceWithStakedB = (accountBalance(assetIdB) + stakedAmountB) | |
207 | 207 | ||
208 | 208 | let hasEnoughBalance = if ((accountBalanceWithStakedA >= balanceA)) | |
209 | 209 | then (accountBalanceWithStakedB >= balanceB) | |
210 | 210 | else false | |
211 | 211 | ||
212 | 212 | func getAssetInfo (assetId) = match assetId { | |
213 | 213 | case id: ByteVector => | |
214 | 214 | let stringId = toBase58String(id) | |
215 | 215 | let info = valueOrErrorMessage(assetInfo(id), (("Asset " + stringId) + " doesn't exist")) | |
216 | 216 | $Tuple3(stringId, info.name, info.decimals) | |
217 | 217 | case waves: Unit => | |
218 | 218 | $Tuple3("WAVES", "WAVES", 8) | |
219 | 219 | case _ => | |
220 | 220 | throw("Match error") | |
221 | 221 | } | |
222 | 222 | ||
223 | 223 | ||
224 | 224 | func getAssetInfoFromString (assetStr) = if ((assetStr == "WAVES")) | |
225 | 225 | then $Tuple3("WAVES", "WAVES", 8) | |
226 | 226 | else { | |
227 | 227 | let stringId = assetStr | |
228 | 228 | let id = fromBase58String(assetStr) | |
229 | 229 | let info = valueOrErrorMessage(assetInfo(id), (("Asset " + stringId) + " doesn't exist")) | |
230 | 230 | $Tuple3(stringId, info.name, info.decimals) | |
231 | 231 | } | |
232 | 232 | ||
233 | 233 | ||
234 | 234 | func suspend (cause) = [BooleanEntry(keyActive, false), StringEntry(keyCause, cause)] | |
235 | 235 | ||
236 | 236 | ||
237 | - | func deductStakingFee (amount,assetId,secondAssetId) = if (if ((assetId == USDN)) | |
238 | - | then true | |
239 | - | else (assetId == EURN)) | |
240 | - | then { | |
241 | - | let stakinFee = if ((assetId == USDN)) | |
242 | - | then (stakingFeeInUSDN * (if ((secondAssetId == NSBT)) | |
243 | - | then 2 | |
244 | - | else 1)) | |
245 | - | else if ((assetId == EURN)) | |
246 | - | then stakingFeeInEURN | |
247 | - | else 0 | |
248 | - | let result = (amount - stakinFee) | |
249 | - | if ((0 >= result)) | |
250 | - | then throw((((("Insufficient amount " + toString(amount)) + " to deduct staking fee ") + toString(stakinFee)) + "USDN/EURN")) | |
251 | - | else result | |
252 | - | } | |
253 | - | else amount | |
237 | + | func calcStakingFuncAndAddres (stake,assetId) = if (stake) | |
238 | + | then if ((assetId == USDN)) | |
239 | + | then $Tuple2("lockNeutrino", stakingUSDNNSBTAddress) | |
240 | + | else if ((assetId == NSBT)) | |
241 | + | then $Tuple2("lockNsbt", stakingUSDNNSBTAddress) | |
242 | + | else $Tuple2("startStaking", stakingEURNAddress) | |
243 | + | else if ((assetId == USDN)) | |
244 | + | then $Tuple2("unlockNeutrino", stakingUSDNNSBTAddress) | |
245 | + | else if ((assetId == NSBT)) | |
246 | + | then $Tuple2("unlockNsbt", stakingUSDNNSBTAddress) | |
247 | + | else $Tuple2("stopStaking", stakingEURNAddress) | |
254 | 248 | ||
255 | 249 | ||
256 | - | func getStakingFee (assetId,secondAssetId) = if ((assetId == USDN)) | |
257 | - | then (stakingFeeInUSDN * (if ((secondAssetId == NSBT)) | |
258 | - | then 2 | |
259 | - | else 1)) | |
260 | - | else if ((assetId == EURN)) | |
261 | - | then stakingFeeInEURN | |
262 | - | else 0 | |
250 | + | func calcStakingParams (stake,amount,assetId) = if (stake) | |
251 | + | then { | |
252 | + | let $t069306996 = calcStakingFuncAndAddres(stake, assetId) | |
253 | + | let call = $t069306996._1 | |
254 | + | let stakingAddr = $t069306996._2 | |
255 | + | $Tuple4(call, stakingAddr, nil, [AttachedPayment(assetId, amount)]) | |
256 | + | } | |
257 | + | else { | |
258 | + | let $t070827148 = calcStakingFuncAndAddres(stake, assetId) | |
259 | + | let call = $t070827148._1 | |
260 | + | let stakingAddr = $t070827148._2 | |
261 | + | $Tuple4(call, stakingAddr, [amount, toBase58String(assetId)], nil) | |
262 | + | } | |
263 | 263 | ||
264 | 264 | ||
265 | 265 | func throwInsufficientAvailableBalance (amount,available,assetName) = throw((((((((("Insufficient DApp balance to pay " + toString(amount)) + " ") + assetName) + " due to staking. Available: ") + toString(available)) + " ") + assetName) + ". Please contact support in Telegram: https://t.me/swopfisupport")) | |
266 | 266 | ||
267 | 267 | ||
268 | 268 | func throwInsufficientAvailableBalances (amountA,amountB) = throw((((((((((((((((("Insufficient DApp balance to pay " + toString(amountA)) + " ") + assetNameA) + " and ") + toString(amountB)) + " ") + assetNameB) + " due to staking. Available: ") + toString(availableBalanceA)) + " ") + assetNameA) + " and ") + toString(availableBalanceB)) + " ") + assetNameB) + ". Please contact support in Telegram: https://t.me/swopfisupport")) | |
269 | 269 | ||
270 | 270 | ||
271 | 271 | func suspendSuspicious () = suspend(((((((((((((((("Suspicious state. Actual balances: " + toString(accountBalanceWithStakedA)) + " ") + assetNameA) + ", ") + toString(accountBalanceWithStakedB)) + " ") + assetNameB) + ". State: ") + toString(balanceA)) + " ") + assetNameA) + ", ") + toString(balanceB)) + " ") + assetNameB)) | |
272 | 272 | ||
273 | 273 | ||
274 | 274 | @Callable(i) | |
275 | 275 | func init (firstHarvest) = { | |
276 | - | let $ | |
277 | - | let pmtAmountA = $ | |
278 | - | let pmtAssetIdA = $ | |
279 | - | let $ | |
280 | - | let pmtAmountB = $ | |
281 | - | let pmtAssetIdB = $ | |
282 | - | let $ | |
283 | - | let pmtStrAssetIdA = $ | |
284 | - | let pmtAssetNameA = $ | |
285 | - | let pmtDecimalsA = $ | |
286 | - | let $ | |
287 | - | let pmtStrAssetIdB = $ | |
288 | - | let pmtAssetNameB = $ | |
289 | - | let pmtDecimalsB = $ | |
276 | + | let $t083358412 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
277 | + | let pmtAmountA = $t083358412._1 | |
278 | + | let pmtAssetIdA = $t083358412._2 | |
279 | + | let $t084178494 = $Tuple2(i.payments[1].amount, i.payments[1].assetId) | |
280 | + | let pmtAmountB = $t084178494._1 | |
281 | + | let pmtAssetIdB = $t084178494._2 | |
282 | + | let $t084998576 = getAssetInfo(pmtAssetIdA) | |
283 | + | let pmtStrAssetIdA = $t084998576._1 | |
284 | + | let pmtAssetNameA = $t084998576._2 | |
285 | + | let pmtDecimalsA = $t084998576._3 | |
286 | + | let $t085818658 = getAssetInfo(pmtAssetIdB) | |
287 | + | let pmtStrAssetIdB = $t085818658._1 | |
288 | + | let pmtAssetNameB = $t085818658._2 | |
289 | + | let pmtDecimalsB = $t085818658._3 | |
290 | 290 | if (!(containsElement([adminPubKey1, adminPubKey2, adminPubKey3, adminPubKeyStaking], i.callerPublicKey))) | |
291 | 291 | then throw("Only admin can call this function") | |
292 | 292 | else if (isDefined(getBoolean(this, keyActive))) | |
293 | 293 | then throw("DApp is already active") | |
294 | 294 | else if ((pmtAssetIdA == pmtAssetIdB)) | |
295 | 295 | then throw("Assets must be different") | |
296 | 296 | else { | |
297 | 297 | let shareName = ((("s" + take(pmtAssetNameA, 7)) + "_") + take(pmtAssetNameB, 7)) | |
298 | 298 | let shareDescription = ((((("ShareToken of SwopFi protocol for " + pmtAssetNameA) + " and ") + pmtAssetNameB) + " at address ") + toString(this)) | |
299 | 299 | let shareDecimals = ((pmtDecimalsA + pmtDecimalsB) / 2) | |
300 | 300 | let arg1 = pow(pmtAmountA, pmtDecimalsA, 5, 1, pmtDecimalsA, DOWN) | |
301 | 301 | let arg2 = pow(pmtAmountB, pmtDecimalsB, 5, 1, pmtDecimalsB, DOWN) | |
302 | 302 | let arg3 = pow(10, 0, shareDecimals, 0, 0, DOWN) | |
303 | 303 | let shareInitialSupply = fraction(arg1, arg2, arg3) | |
304 | 304 | let shareIssue = Issue(shareName, shareDescription, shareInitialSupply, shareDecimals, true) | |
305 | 305 | let shareIssueId = calculateAssetId(shareIssue) | |
306 | - | let baseEntry = [StringEntry(keyVersion, version), BooleanEntry(keyActive, true), StringEntry(keyAssetIdA, pmtStrAssetIdA), StringEntry(keyAssetIdB, pmtStrAssetIdB), IntegerEntry(keyBalanceA, pmtAmountA), IntegerEntry(keyBalanceB, pmtAmountB), IntegerEntry(keyCommission, commission), IntegerEntry(keyCommissionScaleDelimiter, commissionScaleDelimiter), shareIssue, StringEntry(keyShareAssetId, toBase58String(shareIssueId)), IntegerEntry(keyShareAssetSupply, shareInitialSupply), ScriptTransfer(i.caller, shareInitialSupply, shareIssueId)] | |
307 | - | if (firstHarvest) | |
308 | - | then (baseEntry ++ [BooleanEntry(keyFirstHarvest, firstHarvest), IntegerEntry(keyFirstHarvestHeight, (startHeight + (firstHarvestEndPeriod * periodLength)))]) | |
309 | - | else baseEntry | |
306 | + | let stake1 = if (containsElement(stakingAssets, pmtStrAssetIdA)) | |
307 | + | then invoke(this, "stakeUnstake", [true, pmtAmountA, pmtStrAssetIdA], nil) | |
308 | + | else 0 | |
309 | + | if ((stake1 == stake1)) | |
310 | + | then { | |
311 | + | let stake2 = if (containsElement(stakingAssets, pmtStrAssetIdB)) | |
312 | + | then invoke(this, "stakeUnstake", [true, pmtAmountB, pmtStrAssetIdB], nil) | |
313 | + | else 0 | |
314 | + | if ((stake2 == stake2)) | |
315 | + | then { | |
316 | + | let baseEntry = [StringEntry(keyVersion, version), BooleanEntry(keyActive, true), StringEntry(keyAssetIdA, pmtStrAssetIdA), StringEntry(keyAssetIdB, pmtStrAssetIdB), IntegerEntry(keyBalanceA, pmtAmountA), IntegerEntry(keyBalanceB, pmtAmountB), IntegerEntry(keyCommission, commission), IntegerEntry(keyCommissionScaleDelimiter, commissionScaleDelimiter), shareIssue, StringEntry(keyShareAssetId, toBase58String(shareIssueId)), IntegerEntry(keyShareAssetSupply, shareInitialSupply), ScriptTransfer(i.caller, shareInitialSupply, shareIssueId)] | |
317 | + | if (firstHarvest) | |
318 | + | then (baseEntry ++ [BooleanEntry(keyFirstHarvest, firstHarvest), IntegerEntry(keyFirstHarvestHeight, (startHeight + (firstHarvestEndPeriod * periodLength)))]) | |
319 | + | else baseEntry | |
320 | + | } | |
321 | + | else throw("Strict value is not equal to itself.") | |
322 | + | } | |
323 | + | else throw("Strict value is not equal to itself.") | |
310 | 324 | } | |
311 | 325 | } | |
312 | 326 | ||
313 | 327 | ||
314 | 328 | ||
315 | 329 | @Callable(i) | |
316 | 330 | func initWithInitRatio (amtAssetA,amtAssetB,strAssetIdA,strAssetIdB,firstHarvest) = { | |
317 | - | let $ | |
318 | - | let pmtStrAssetIdA = $ | |
319 | - | let pmtAssetNameA = $ | |
320 | - | let pmtDecimalsA = $ | |
321 | - | let $ | |
322 | - | let pmtStrAssetIdB = $ | |
323 | - | let pmtAssetNameB = $ | |
324 | - | let pmtDecimalsB = $ | |
331 | + | let $t01124711334 = getAssetInfoFromString(strAssetIdA) | |
332 | + | let pmtStrAssetIdA = $t01124711334._1 | |
333 | + | let pmtAssetNameA = $t01124711334._2 | |
334 | + | let pmtDecimalsA = $t01124711334._3 | |
335 | + | let $t01133911426 = getAssetInfoFromString(strAssetIdB) | |
336 | + | let pmtStrAssetIdB = $t01133911426._1 | |
337 | + | let pmtAssetNameB = $t01133911426._2 | |
338 | + | let pmtDecimalsB = $t01133911426._3 | |
325 | 339 | if (!(containsElement([adminPubKey1, adminPubKey2, adminPubKey3, adminPubKeyStaking], i.callerPublicKey))) | |
326 | 340 | then throw("Only admin can call this function") | |
327 | 341 | else if (isDefined(getBoolean(this, keyActive))) | |
328 | 342 | then throw("DApp is already active") | |
329 | 343 | else if ((strAssetIdA == strAssetIdB)) | |
330 | 344 | then throw("Assets must be different") | |
331 | 345 | else { | |
332 | 346 | let shareName = ((("s" + take(pmtAssetNameA, 7)) + "_") + take(pmtAssetNameB, 7)) | |
333 | 347 | let shareDescription = ((((("ShareToken of SwopFi protocol for " + pmtAssetNameA) + " and ") + pmtAssetNameB) + " at address ") + toString(this)) | |
334 | 348 | let shareDecimals = ((pmtDecimalsA + pmtDecimalsB) / 2) | |
335 | 349 | let shareInitialSupply = 0 | |
336 | 350 | let shareIssue = Issue(shareName, shareDescription, shareInitialSupply, shareDecimals, true) | |
337 | 351 | let shareIssueId = calculateAssetId(shareIssue) | |
338 | 352 | let baseEntry = [StringEntry(keyVersion, version), BooleanEntry(keyActive, true), StringEntry(keyAssetIdA, pmtStrAssetIdA), StringEntry(keyAssetIdB, pmtStrAssetIdB), IntegerEntry(keyBalanceInitA, amtAssetA), IntegerEntry(keyBalanceInitB, amtAssetB), IntegerEntry(keyBalanceA, 0), IntegerEntry(keyBalanceB, 0), IntegerEntry(keyCommission, commission), IntegerEntry(keyCommissionScaleDelimiter, commissionScaleDelimiter), shareIssue, StringEntry(keyShareAssetId, toBase58String(shareIssueId)), IntegerEntry(keyShareAssetSupply, shareInitialSupply)] | |
339 | 353 | if (firstHarvest) | |
340 | 354 | then (baseEntry ++ [BooleanEntry(keyFirstHarvest, firstHarvest), IntegerEntry(keyFirstHarvestHeight, (startHeight + (firstHarvestEndPeriod * periodLength)))]) | |
341 | 355 | else baseEntry | |
342 | 356 | } | |
343 | 357 | } | |
344 | 358 | ||
345 | 359 | ||
346 | 360 | ||
347 | 361 | @Callable(i) | |
348 | 362 | func keepLimitForFirstHarvest (shareLimit) = if (!(isActive)) | |
349 | 363 | then throw("DApp is inactive at this moment") | |
350 | 364 | else if (!(containsElement([adminPubKey1, adminPubKey2, adminPubKey3, adminPubKeyStaking], i.callerPublicKey))) | |
351 | 365 | then throw("Only admin can call this function") | |
352 | 366 | else [IntegerEntry(kShareLimit, shareLimit)] | |
353 | 367 | ||
354 | 368 | ||
355 | 369 | ||
356 | 370 | @Callable(i) | |
357 | 371 | func replenishWithTwoTokens (slippageTolerance) = { | |
358 | 372 | let pmtAssetIdA = i.payments[0].assetId | |
359 | 373 | let pmtAssetIdB = i.payments[1].assetId | |
360 | - | let pmtAmountA = deductStakingFee(i.payments[0].amount, pmtAssetIdA, pmtAssetIdB) | |
361 | - | let pmtAmountB = deductStakingFee(i.payments[1].amount, pmtAssetIdB, pmtAssetIdA) | |
374 | + | let pmtAmountA = i.payments[0].amount | |
375 | + | let pmtAmountB = i.payments[1].amount | |
376 | + | let $t01392314000 = getAssetInfo(pmtAssetIdA) | |
377 | + | let pmtStrAssetIdA = $t01392314000._1 | |
378 | + | let pmtAssetNameA = $t01392314000._2 | |
379 | + | let pmtDecimalsA = $t01392314000._3 | |
380 | + | let $t01400514082 = getAssetInfo(pmtAssetIdB) | |
381 | + | let pmtStrAssetIdB = $t01400514082._1 | |
382 | + | let pmtAssetNameB = $t01400514082._2 | |
383 | + | let pmtDecimalsB = $t01400514082._3 | |
362 | 384 | if (if ((balanceA == 0)) | |
363 | 385 | then (balanceB == 0) | |
364 | 386 | else false) | |
365 | 387 | then { | |
366 | - | let $t01345913536 = getAssetInfo(pmtAssetIdA) | |
367 | - | let pmtStrAssetIdA = $t01345913536._1 | |
368 | - | let pmtAssetNameA = $t01345913536._2 | |
369 | - | let pmtDecimalsA = $t01345913536._3 | |
370 | - | let $t01354513622 = getAssetInfo(pmtAssetIdB) | |
371 | - | let pmtStrAssetIdB = $t01354513622._1 | |
372 | - | let pmtAssetNameB = $t01354513622._2 | |
373 | - | let pmtDecimalsB = $t01354513622._3 | |
374 | 388 | let tokenRatio = fraction(fraction(assetInitA, scaleValue8, pmtAmountA), scaleValue3, fraction(assetInitB, scaleValue8, pmtAmountB)) | |
375 | 389 | if ((pmtAssetIdA == pmtAssetIdB)) | |
376 | 390 | then throw("Assets must be different") | |
377 | 391 | else { | |
378 | 392 | let shareDecimals = ((pmtDecimalsA + pmtDecimalsB) / 2) | |
379 | 393 | let shareInitialSupply = fraction(pow(pmtAmountA, pmtDecimalsA, 5, 1, pmtDecimalsA, DOWN), pow(pmtAmountB, pmtDecimalsB, 5, 1, pmtDecimalsB, DOWN), pow(10, 0, shareDecimals, 0, 0, DOWN)) | |
380 | 394 | if (!(isActive)) | |
381 | 395 | then throw("DApp is inactive at this moment") | |
382 | 396 | else if (if ((0 > slippageTolerance)) | |
383 | 397 | then true | |
384 | 398 | else (slippageTolerance > slippageToleranceDelimiter)) | |
385 | 399 | then throw(((("Slippage tolerance must be between 0 and " + toString(slippageToleranceDelimiter)) + " inclusively. Actual: ") + toString(slippageTolerance))) | |
386 | 400 | else if ((size(i.payments) != 2)) | |
387 | 401 | then throw("Two attached assets expected") | |
388 | 402 | else if (if ((((scaleValue3 * (slippageToleranceDelimiter - slippageTolerance)) / slippageToleranceDelimiter) > tokenRatio)) | |
389 | 403 | then true | |
390 | 404 | else (tokenRatio > ((scaleValue3 * (slippageToleranceDelimiter + slippageTolerance)) / slippageToleranceDelimiter))) | |
391 | 405 | then throw("Incorrect assets amount: amounts must have the contract ratio") | |
392 | 406 | else if (if ((pmtAssetIdA != assetIdA)) | |
393 | 407 | then true | |
394 | 408 | else (pmtAssetIdB != assetIdB)) | |
395 | 409 | then throw(((("Incorrect assets attached. Expected: " + strAssetIdA) + " and ") + strAssetIdB)) | |
396 | 410 | else if ((shareInitialSupply == 0)) | |
397 | 411 | then throw("Too small amount to replenish") | |
398 | 412 | else if (!(hasEnoughBalance)) | |
399 | 413 | then ([ScriptTransfer(i.caller, pmtAmountA, pmtAssetIdA), ScriptTransfer(i.caller, pmtAmountB, pmtAssetIdB)] ++ suspendSuspicious()) | |
400 | - | else [Reissue(shareAssetId, shareInitialSupply, true), IntegerEntry(keyBalanceA, pmtAmountA), IntegerEntry(keyBalanceB, pmtAmountB), IntegerEntry(keyShareAssetSupply, shareInitialSupply), ScriptTransfer(i.caller, shareInitialSupply, shareAssetId)] | |
414 | + | else { | |
415 | + | let stake1 = if (containsElement(stakingAssets, pmtStrAssetIdA)) | |
416 | + | then invoke(this, "stakeUnstake", [true, pmtAmountA, pmtStrAssetIdA], nil) | |
417 | + | else 0 | |
418 | + | if ((stake1 == stake1)) | |
419 | + | then { | |
420 | + | let stake2 = if (containsElement(stakingAssets, pmtStrAssetIdB)) | |
421 | + | then invoke(this, "stakeUnstake", [true, pmtAmountB, pmtStrAssetIdB], nil) | |
422 | + | else 0 | |
423 | + | if ((stake2 == stake2)) | |
424 | + | then [Reissue(shareAssetId, shareInitialSupply, true), IntegerEntry(keyBalanceA, pmtAmountA), IntegerEntry(keyBalanceB, pmtAmountB), IntegerEntry(keyShareAssetSupply, shareInitialSupply), ScriptTransfer(i.caller, shareInitialSupply, shareAssetId)] | |
425 | + | else throw("Strict value is not equal to itself.") | |
426 | + | } | |
427 | + | else throw("Strict value is not equal to itself.") | |
428 | + | } | |
401 | 429 | } | |
402 | 430 | } | |
403 | 431 | else { | |
404 | 432 | let tokenRatio = fraction(fraction(balanceA, scaleValue8, pmtAmountA), scaleValue3, fraction(balanceB, scaleValue8, pmtAmountB)) | |
405 | 433 | let ratioShareTokensInA = fraction(pmtAmountA, scaleValue8, balanceA) | |
406 | 434 | let ratioShareTokensInB = fraction(pmtAmountB, scaleValue8, balanceB) | |
407 | 435 | let shareTokenToPayAmount = fraction(min([ratioShareTokensInA, ratioShareTokensInB]), shareAssetSupply, scaleValue8) | |
408 | 436 | if (!(isActive)) | |
409 | 437 | then throw("DApp is inactive at this moment") | |
410 | 438 | else if (if ((0 > slippageTolerance)) | |
411 | 439 | then true | |
412 | 440 | else (slippageTolerance > slippageToleranceDelimiter)) | |
413 | 441 | then throw(((("Slippage tolerance must be between 0 and " + toString(slippageToleranceDelimiter)) + " inclusively. Actual: ") + toString(slippageTolerance))) | |
414 | 442 | else if ((size(i.payments) != 2)) | |
415 | 443 | then throw("Two attached assets expected") | |
416 | 444 | else if (if ((pmtAssetIdA != assetIdA)) | |
417 | 445 | then true | |
418 | 446 | else (pmtAssetIdB != assetIdB)) | |
419 | 447 | then throw(((("Incorrect assets attached. Expected: " + strAssetIdA) + " and ") + strAssetIdB)) | |
420 | 448 | else if (if ((((scaleValue3 * (slippageToleranceDelimiter - slippageTolerance)) / slippageToleranceDelimiter) > tokenRatio)) | |
421 | 449 | then true | |
422 | 450 | else (tokenRatio > ((scaleValue3 * (slippageToleranceDelimiter + slippageTolerance)) / slippageToleranceDelimiter))) | |
423 | 451 | then throw("Incorrect assets amount: amounts must have the contract ratio") | |
424 | 452 | else if ((shareTokenToPayAmount == 0)) | |
425 | 453 | then throw("Too small amount to replenish") | |
426 | 454 | else if (!(hasEnoughBalance)) | |
427 | 455 | then ([ScriptTransfer(i.caller, pmtAmountA, pmtAssetIdA), ScriptTransfer(i.caller, pmtAmountB, pmtAssetIdB)] ++ suspendSuspicious()) | |
428 | - | else [IntegerEntry(keyBalanceA, (balanceA + pmtAmountA)), IntegerEntry(keyBalanceB, (balanceB + pmtAmountB)), IntegerEntry(keyShareAssetSupply, (shareAssetSupply + shareTokenToPayAmount)), Reissue(shareAssetId, shareTokenToPayAmount, true), ScriptTransfer(i.caller, shareTokenToPayAmount, shareAssetId)] | |
456 | + | else { | |
457 | + | let stake1 = if (containsElement(stakingAssets, pmtStrAssetIdA)) | |
458 | + | then invoke(this, "stakeUnstake", [true, pmtAmountA, pmtStrAssetIdA], nil) | |
459 | + | else 0 | |
460 | + | if ((stake1 == stake1)) | |
461 | + | then { | |
462 | + | let stake2 = if (containsElement(stakingAssets, pmtStrAssetIdB)) | |
463 | + | then invoke(this, "stakeUnstake", [true, pmtAmountB, pmtStrAssetIdB], nil) | |
464 | + | else 0 | |
465 | + | if ((stake2 == stake2)) | |
466 | + | then [IntegerEntry(keyBalanceA, (balanceA + pmtAmountA)), IntegerEntry(keyBalanceB, (balanceB + pmtAmountB)), IntegerEntry(keyShareAssetSupply, (shareAssetSupply + shareTokenToPayAmount)), Reissue(shareAssetId, shareTokenToPayAmount, true), ScriptTransfer(i.caller, shareTokenToPayAmount, shareAssetId)] | |
467 | + | else throw("Strict value is not equal to itself.") | |
468 | + | } | |
469 | + | else throw("Strict value is not equal to itself.") | |
470 | + | } | |
429 | 471 | } | |
430 | 472 | } | |
431 | 473 | ||
432 | 474 | ||
433 | 475 | ||
434 | 476 | @Callable(i) | |
435 | 477 | func withdraw () = { | |
436 | - | let $ | |
437 | - | let pmtAmount = $ | |
438 | - | let pmtAssetId = $ | |
439 | - | let amountToPayA = | |
440 | - | let amountToPayB = | |
478 | + | let $t01925119326 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
479 | + | let pmtAmount = $t01925119326._1 | |
480 | + | let pmtAssetId = $t01925119326._2 | |
481 | + | let amountToPayA = fraction(pmtAmount, balanceA, shareAssetSupply) | |
482 | + | let amountToPayB = fraction(pmtAmount, balanceB, shareAssetSupply) | |
441 | 483 | if (!(isActive)) | |
442 | 484 | then throw("DApp is inactive at this moment") | |
443 | 485 | else if ((size(i.payments) != 1)) | |
444 | 486 | then throw("One attached payment expected") | |
445 | 487 | else if ((pmtAssetId != shareAssetId)) | |
446 | 488 | then throw(("Incorrect asset attached. Expected: " + toBase58String(shareAssetId))) | |
447 | 489 | else if (!(hasEnoughBalance)) | |
448 | 490 | then ([ScriptTransfer(i.caller, pmtAmount, pmtAssetId)] ++ suspendSuspicious()) | |
449 | 491 | else if (if ((amountToPayA > availableBalanceA)) | |
450 | 492 | then true | |
451 | 493 | else (amountToPayB > availableBalanceB)) | |
452 | 494 | then throwInsufficientAvailableBalances(amountToPayA, amountToPayB) | |
453 | - | else [IntegerEntry(keyBalanceA, (balanceA - amountToPayA)), IntegerEntry(keyBalanceB, (balanceB - amountToPayB)), IntegerEntry(keyShareAssetSupply, (shareAssetSupply - pmtAmount)), Burn(shareAssetId, pmtAmount), ScriptTransfer(i.caller, amountToPayA, assetIdA), ScriptTransfer(i.caller, amountToPayB, assetIdB)] | |
495 | + | else { | |
496 | + | let stake1 = if (containsElement(stakingAssets, strAssetIdA)) | |
497 | + | then invoke(this, "stakeUnstake", [false, amountToPayA, strAssetIdA], nil) | |
498 | + | else 0 | |
499 | + | if ((stake1 == stake1)) | |
500 | + | then { | |
501 | + | let stake2 = if (containsElement(stakingAssets, strAssetIdB)) | |
502 | + | then invoke(this, "stakeUnstake", [false, amountToPayB, strAssetIdB], nil) | |
503 | + | else 0 | |
504 | + | if ((stake2 == stake2)) | |
505 | + | then [IntegerEntry(keyBalanceA, (balanceA - amountToPayA)), IntegerEntry(keyBalanceB, (balanceB - amountToPayB)), IntegerEntry(keyShareAssetSupply, (shareAssetSupply - pmtAmount)), Burn(shareAssetId, pmtAmount), ScriptTransfer(i.caller, amountToPayA, assetIdA), ScriptTransfer(i.caller, amountToPayB, assetIdB)] | |
506 | + | else throw("Strict value is not equal to itself.") | |
507 | + | } | |
508 | + | else throw("Strict value is not equal to itself.") | |
509 | + | } | |
454 | 510 | } | |
455 | 511 | ||
456 | 512 | ||
457 | 513 | ||
458 | 514 | @Callable(i) | |
459 | 515 | func exchange (minAmountToReceive) = { | |
460 | - | let $ | |
461 | - | let pmtAmount = $ | |
462 | - | let pmtAssetId = $ | |
516 | + | let $t02084120916 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
517 | + | let pmtAmount = $t02084120916._1 | |
518 | + | let pmtAssetId = $t02084120916._2 | |
463 | 519 | func calculateFees (tokenFrom,tokenTo) = { | |
464 | 520 | let amountWithoutFee = fraction(tokenTo, pmtAmount, (pmtAmount + tokenFrom)) | |
465 | 521 | let amountWithFee = fraction(amountWithoutFee, (commissionScaleDelimiter - commission), commissionScaleDelimiter) | |
466 | 522 | let governanceReward = fraction(amountWithoutFee, commissionGovernance, commissionScaleDelimiter) | |
467 | 523 | if ((minAmountToReceive > amountWithFee)) | |
468 | 524 | then throw(((("Calculated amount to receive " + toString(amountWithFee)) + " is less than specified minimum ") + toString(minAmountToReceive))) | |
469 | 525 | else $Tuple3(amountWithoutFee, amountWithFee, governanceReward) | |
470 | 526 | } | |
471 | 527 | ||
472 | 528 | if (!(isActive)) | |
473 | 529 | then throw("DApp is inactive at this moment") | |
474 | 530 | else if (if ((balanceA == 0)) | |
475 | 531 | then true | |
476 | 532 | else (balanceB == 0)) | |
477 | 533 | then throw("Can't exchange with zero balance") | |
478 | 534 | else if ((0 >= minAmountToReceive)) | |
479 | 535 | then throw(("Minimal amount to receive must be positive. Actual: " + toString(minAmountToReceive))) | |
480 | 536 | else if ((size(i.payments) != 1)) | |
481 | 537 | then throw("One attached payment expected") | |
482 | 538 | else if (!(hasEnoughBalance)) | |
483 | 539 | then ([ScriptTransfer(i.caller, pmtAmount, pmtAssetId)] ++ suspendSuspicious()) | |
484 | 540 | else if ((pmtAssetId == assetIdA)) | |
485 | 541 | then { | |
486 | 542 | let assetIdSend = assetIdB | |
487 | - | let $ | |
488 | - | let amountWithoutFee = $ | |
489 | - | let amountWithFee = $ | |
490 | - | let governanceReward = $ | |
543 | + | let $t02219022281 = calculateFees(balanceA, balanceB) | |
544 | + | let amountWithoutFee = $t02219022281._1 | |
545 | + | let amountWithFee = $t02219022281._2 | |
546 | + | let governanceReward = $t02219022281._3 | |
491 | 547 | let newBalanceA = (balanceA + pmtAmount) | |
492 | 548 | let newBalanceB = ((balanceB - amountWithFee) - governanceReward) | |
493 | - | if (if ((stakedAmountA >= newBalanceA)) | |
494 | - | then true | |
495 | - | else (stakedAmountB >= newBalanceB)) | |
496 | - | then throwInsufficientAvailableBalance(amountWithFee, availableBalanceB, assetNameB) | |
497 | - | else [IntegerEntry(keyBalanceA, newBalanceA), IntegerEntry(keyBalanceB, newBalanceB), ScriptTransfer(i.caller, amountWithFee, assetIdSend), ScriptTransfer(walletAddress, governanceReward, assetIdSend)] | |
549 | + | let stake1 = if (containsElement(stakingAssets, strAssetIdA)) | |
550 | + | then invoke(this, "stakeUnstake", [true, pmtAmount, strAssetIdA], nil) | |
551 | + | else 0 | |
552 | + | if ((stake1 == stake1)) | |
553 | + | then { | |
554 | + | let stake2 = if (containsElement(stakingAssets, strAssetIdB)) | |
555 | + | then invoke(this, "stakeUnstake", [false, (amountWithFee + governanceReward), strAssetIdB], nil) | |
556 | + | else 0 | |
557 | + | if ((stake2 == stake2)) | |
558 | + | then [IntegerEntry(keyBalanceA, newBalanceA), IntegerEntry(keyBalanceB, newBalanceB), ScriptTransfer(i.caller, amountWithFee, assetIdSend), ScriptTransfer(walletAddress, governanceReward, assetIdSend)] | |
559 | + | else throw("Strict value is not equal to itself.") | |
560 | + | } | |
561 | + | else throw("Strict value is not equal to itself.") | |
498 | 562 | } | |
499 | 563 | else if ((pmtAssetId == assetIdB)) | |
500 | 564 | then { | |
501 | 565 | let assetIdSend = assetIdA | |
502 | - | let $ | |
503 | - | let amountWithoutFee = $ | |
504 | - | let amountWithFee = $ | |
505 | - | let governanceReward = $ | |
566 | + | let $t02323623327 = calculateFees(balanceB, balanceA) | |
567 | + | let amountWithoutFee = $t02323623327._1 | |
568 | + | let amountWithFee = $t02323623327._2 | |
569 | + | let governanceReward = $t02323623327._3 | |
506 | 570 | let newBalanceA = ((balanceA - amountWithFee) - governanceReward) | |
507 | 571 | let newBalanceB = (balanceB + pmtAmount) | |
508 | 572 | if (if ((stakedAmountA >= newBalanceA)) | |
509 | 573 | then true | |
510 | 574 | else (stakedAmountB >= newBalanceB)) | |
511 | 575 | then throwInsufficientAvailableBalance(amountWithFee, availableBalanceA, assetNameA) | |
512 | - | else [IntegerEntry(keyBalanceA, newBalanceA), IntegerEntry(keyBalanceB, newBalanceB), ScriptTransfer(i.caller, amountWithFee, assetIdSend), ScriptTransfer(walletAddress, governanceReward, assetIdSend)] | |
576 | + | else { | |
577 | + | let stake1 = if (containsElement(stakingAssets, strAssetIdA)) | |
578 | + | then invoke(this, "stakeUnstake", [false, (amountWithFee + governanceReward), strAssetIdA], nil) | |
579 | + | else 0 | |
580 | + | if ((stake1 == stake1)) | |
581 | + | then { | |
582 | + | let stake2 = if (containsElement(stakingAssets, strAssetIdB)) | |
583 | + | then invoke(this, "stakeUnstake", [true, pmtAmount, strAssetIdB], nil) | |
584 | + | else 0 | |
585 | + | if ((stake2 == stake2)) | |
586 | + | then [IntegerEntry(keyBalanceA, newBalanceA), IntegerEntry(keyBalanceB, newBalanceB), ScriptTransfer(i.caller, amountWithFee, assetIdSend), ScriptTransfer(walletAddress, governanceReward, assetIdSend)] | |
587 | + | else throw("Strict value is not equal to itself.") | |
588 | + | } | |
589 | + | else throw("Strict value is not equal to itself.") | |
590 | + | } | |
513 | 591 | } | |
514 | 592 | else throw(((("Incorrect asset attached. Expected: " + strAssetIdA) + " or ") + strAssetIdB)) | |
515 | 593 | } | |
516 | 594 | ||
517 | 595 | ||
518 | 596 | ||
519 | 597 | @Callable(i) | |
520 | 598 | func shutdown () = if (!(isActive)) | |
521 | 599 | then throw(("DApp is already suspended. Cause: " + valueOrElse(getString(this, keyCause), "the cause wasn't specified"))) | |
522 | 600 | else if (!(containsElement([adminPubKey1, adminPubKey2, adminPubKey3, adminPubKeyStartStop], i.callerPublicKey))) | |
523 | 601 | then throw("Only admin can call this function") | |
524 | 602 | else suspend("Paused by admin") | |
525 | 603 | ||
526 | 604 | ||
527 | 605 | ||
528 | 606 | @Callable(i) | |
529 | 607 | func activate () = if (isActive) | |
530 | 608 | then throw("DApp is already active") | |
531 | 609 | else if (!(containsElement([adminPubKey1, adminPubKey2, adminPubKey3, adminPubKeyStartStop], i.callerPublicKey))) | |
532 | 610 | then throw("Only admin can call this function") | |
533 | 611 | else [BooleanEntry(keyActive, true), DeleteEntry(keyCause)] | |
534 | 612 | ||
535 | 613 | ||
536 | 614 | ||
537 | 615 | @Callable(i) | |
538 | 616 | func takeIntoAccountExtraFunds (amountLeave) = { | |
539 | 617 | let uncountableAmountEnrollAssetA = (accountBalanceWithStakedA - balanceA) | |
540 | 618 | let uncountableAmountEnrollAssetB = (accountBalanceWithStakedB - balanceB) | |
541 | 619 | let amountEnrollA = (uncountableAmountEnrollAssetA - (if ((assetIdA == unit)) | |
542 | 620 | then amountLeave | |
543 | 621 | else 0)) | |
544 | 622 | let amountEnrollB = (uncountableAmountEnrollAssetB - (if ((assetIdB == unit)) | |
545 | 623 | then amountLeave | |
546 | 624 | else 0)) | |
547 | 625 | if (!(isActive)) | |
548 | 626 | then throw("DApp is inactive at this moment") | |
549 | 627 | else if ((i.caller != this)) | |
550 | 628 | then throw("Only the DApp itself can call this function") | |
551 | 629 | else if ((0 > amountLeave)) | |
552 | 630 | then throw(("Argument 'amountLeave' cannot be negative. Actual: " + toString(amountLeave))) | |
553 | 631 | else if (if ((0 > uncountableAmountEnrollAssetA)) | |
554 | 632 | then true | |
555 | 633 | else (0 > uncountableAmountEnrollAssetB)) | |
556 | 634 | then suspend("Enroll amount negative") | |
557 | 635 | else if (if ((0 > amountEnrollA)) | |
558 | 636 | then true | |
559 | 637 | else (0 > amountEnrollB)) | |
560 | 638 | then throw("Too large amountLeave") | |
561 | - | else [IntegerEntry(keyBalanceA, (balanceA + amountEnrollA)), IntegerEntry(keyBalanceB, (balanceB + amountEnrollB)), IntegerEntry(("last_income_" + strAssetIdA), amountEnrollA), IntegerEntry(("last_income_" + strAssetIdB), amountEnrollB)] | |
639 | + | else { | |
640 | + | let stake1 = if (if (containsElement(stakingAssets, strAssetIdA)) | |
641 | + | then (amountEnrollA > 0) | |
642 | + | else false) | |
643 | + | then invoke(this, "stakeUnstake", [true, amountEnrollA, strAssetIdA], nil) | |
644 | + | else 0 | |
645 | + | if ((stake1 == stake1)) | |
646 | + | then { | |
647 | + | let stake2 = if (if (containsElement(stakingAssets, strAssetIdB)) | |
648 | + | then (amountEnrollB > 0) | |
649 | + | else false) | |
650 | + | then invoke(this, "stakeUnstake", [true, amountEnrollB, strAssetIdB], nil) | |
651 | + | else 0 | |
652 | + | if ((stake2 == stake2)) | |
653 | + | then [IntegerEntry(keyBalanceA, (balanceA + amountEnrollA)), IntegerEntry(keyBalanceB, (balanceB + amountEnrollB)), IntegerEntry(("last_income_" + strAssetIdA), amountEnrollA), IntegerEntry(("last_income_" + strAssetIdB), amountEnrollB)] | |
654 | + | else throw("Strict value is not equal to itself.") | |
655 | + | } | |
656 | + | else throw("Strict value is not equal to itself.") | |
657 | + | } | |
562 | 658 | } | |
659 | + | ||
660 | + | ||
661 | + | ||
662 | + | @Callable(i) | |
663 | + | func stakeUnstake (stake,amount,assetIdString) = if ((i.caller != this)) | |
664 | + | then throw("Only contract itself can invoke this function") | |
665 | + | else if ((assetIdString == "WAVES")) | |
666 | + | then { | |
667 | + | let pool = addressFromStringValue(valueOrErrorMessage(getString(oracle, keyLeasingPool), "No leasing pool in oracle")) | |
668 | + | let leasingId = getBinary(this, keyLeasingId) | |
669 | + | let leasingAmount = valueOrElse(getInteger(this, keyLeasingAmount), 0) | |
670 | + | let newLeaseAmount = if (stake) | |
671 | + | then (leasingAmount + amount) | |
672 | + | else (leasingAmount - amount) | |
673 | + | let newLease = Lease(pool, newLeaseAmount) | |
674 | + | let newLeaseId = calculateLeaseId(newLease) | |
675 | + | let baseEtry = [newLease, BinaryEntry(keyLeasingId, newLeaseId), IntegerEntry(keyLeasingAmount, newLeaseAmount)] | |
676 | + | match leasingId { | |
677 | + | case lId: ByteVector => | |
678 | + | ([LeaseCancel(lId)] ++ baseEtry) | |
679 | + | case _ => | |
680 | + | baseEtry | |
681 | + | } | |
682 | + | } | |
683 | + | else { | |
684 | + | let $t02793128034 = calcStakingParams(stake, amount, fromBase58String(assetIdString)) | |
685 | + | let call = $t02793128034._1 | |
686 | + | let addr = $t02793128034._2 | |
687 | + | let params = $t02793128034._3 | |
688 | + | let payments = $t02793128034._4 | |
689 | + | let inv = invoke(addr, call, params, payments) | |
690 | + | nil | |
691 | + | } | |
692 | + | ||
693 | + | ||
694 | + | ||
695 | + | @Callable(i) | |
696 | + | func stakeAll () = if (!(isActive)) | |
697 | + | then throw("DApp is inactive at this moment") | |
698 | + | else if (!(containsElement([adminPubKey1, adminPubKey2, adminPubKey3, adminPubKeyStartStop], i.callerPublicKey))) | |
699 | + | then throw("Only admin can call this function") | |
700 | + | else { | |
701 | + | let stake1 = if (containsElement(stakingAssets, strAssetIdA)) | |
702 | + | then { | |
703 | + | let amountA = (balanceA - stakedAmountA) | |
704 | + | if ((amountA > 0)) | |
705 | + | then invoke(this, "stakeUnstake", [true, amountA, strAssetIdA], nil) | |
706 | + | else 0 | |
707 | + | } | |
708 | + | else 0 | |
709 | + | if ((stake1 == stake1)) | |
710 | + | then { | |
711 | + | let stake2 = if (containsElement(stakingAssets, strAssetIdB)) | |
712 | + | then { | |
713 | + | let amountB = (balanceB - stakedAmountB) | |
714 | + | if ((amountB > 0)) | |
715 | + | then invoke(this, "stakeUnstake", [true, amountB, strAssetIdB], nil) | |
716 | + | else 0 | |
717 | + | } | |
718 | + | else 0 | |
719 | + | if ((stake2 == stake2)) | |
720 | + | then nil | |
721 | + | else throw("Strict value is not equal to itself.") | |
722 | + | } | |
723 | + | else throw("Strict value is not equal to itself.") | |
724 | + | } | |
563 | 725 | ||
564 | 726 | ||
565 | 727 | @Verifier(tx) | |
566 | 728 | func verify () = { | |
567 | 729 | let multiSignedByAdmins = { | |
568 | 730 | let adminPubKey1Signed = if (sigVerify(tx.bodyBytes, tx.proofs[0], adminPubKey1)) | |
569 | 731 | then 1 | |
570 | 732 | else 0 | |
571 | 733 | let adminPubKey2Signed = if (sigVerify(tx.bodyBytes, tx.proofs[1], adminPubKey2)) | |
572 | 734 | then 1 | |
573 | 735 | else 0 | |
574 | 736 | let adminPubKey3Signed = if (sigVerify(tx.bodyBytes, tx.proofs[2], adminPubKey3)) | |
575 | 737 | then 1 | |
576 | 738 | else 0 | |
577 | 739 | (((adminPubKey1Signed + adminPubKey2Signed) + adminPubKey3Signed) >= 2) | |
578 | 740 | } | |
579 | 741 | match tx { | |
580 | 742 | case inv: InvokeScriptTransaction => | |
581 | 743 | let callTakeIntoAccount = if ((inv.dApp == this)) | |
582 | 744 | then (inv.function == "takeIntoAccountExtraFunds") | |
583 | 745 | else false | |
584 | - | let callStaking = if (if ((inv.dApp == stakingUSDNNSBTAddress)) | |
585 | - | then if (if (if (containsElement(["lockNeutrino", "lockNsbt"], inv.function)) | |
586 | - | then (size(inv.payments) == 1) | |
587 | - | else false) | |
588 | - | then if ((inv.payments[0].assetId == USDN)) | |
589 | - | then true | |
590 | - | else (inv.payments[0].assetId == NSBT) | |
591 | - | else false) | |
592 | - | then true | |
593 | - | else if (containsElement(["unlockNeutrino", "unlockNsbt"], inv.function)) | |
594 | - | then (size(inv.payments) == 0) | |
595 | - | else false | |
596 | - | else false) | |
597 | - | then true | |
598 | - | else if ((inv.dApp == stakingEURNAddress)) | |
599 | - | then if (if (if ((inv.function == "startStaking")) | |
600 | - | then (size(inv.payments) == 1) | |
601 | - | else false) | |
602 | - | then (inv.payments[0].assetId == EURN) | |
603 | - | else false) | |
604 | - | then true | |
605 | - | else if ((inv.function == "stopStaking")) | |
606 | - | then (size(inv.payments) == 0) | |
607 | - | else false | |
608 | - | else false | |
609 | 746 | let exchangeToWaves = if (if (if ((inv.dApp == USDNToWavesExchanger)) | |
610 | 747 | then (inv.function == "exchange") | |
611 | 748 | else false) | |
612 | 749 | then (assetIdA == USDN) | |
613 | 750 | else false) | |
614 | 751 | then true | |
615 | 752 | else if (if ((assetIdB == USDN)) | |
616 | 753 | then (size(inv.payments) == 1) | |
617 | 754 | else false) | |
618 | 755 | then (inv.payments[0].assetId == USDN) | |
619 | 756 | else false | |
620 | 757 | let exchangeToNSBTs = if (if (if ((inv.dApp == USDNToNSBTExchanger)) | |
621 | 758 | then (inv.function == "exchange") | |
622 | 759 | else false) | |
623 | 760 | then (assetIdA == NSBT) | |
624 | 761 | else false) | |
625 | 762 | then true | |
626 | 763 | else if (if ((assetIdB == NSBT)) | |
627 | 764 | then (size(inv.payments) == 1) | |
628 | 765 | else false) | |
629 | 766 | then (inv.payments[0].assetId == USDN) | |
630 | 767 | else false | |
631 | 768 | let signedByAdmin = if (if (if (sigVerify(tx.bodyBytes, tx.proofs[0], adminPubKey1)) | |
632 | 769 | then true | |
633 | 770 | else sigVerify(tx.bodyBytes, tx.proofs[0], adminPubKey2)) | |
634 | 771 | then true | |
635 | 772 | else sigVerify(tx.bodyBytes, tx.proofs[0], adminPubKey3)) | |
636 | 773 | then true | |
637 | 774 | else sigVerify(tx.bodyBytes, tx.proofs[0], adminPubKeyStaking) | |
638 | - | if (if (if (if (if (callTakeIntoAccount) | |
639 | - | then true | |
640 | - | else callStaking) | |
775 | + | if (if (if (if (callTakeIntoAccount) | |
641 | 776 | then true | |
642 | 777 | else exchangeToWaves) | |
643 | 778 | then true | |
644 | 779 | else exchangeToNSBTs) | |
645 | 780 | then signedByAdmin | |
646 | 781 | else false) | |
647 | 782 | then true | |
648 | 783 | else multiSignedByAdmins | |
649 | 784 | case _ => | |
650 | 785 | multiSignedByAdmins | |
651 | 786 | } | |
652 | 787 | } | |
653 | 788 |
github/deemru/w8io/026f985 109.16 ms ◑