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