tx · 8RumJAyh4zLqXRY71uxucByWVHNgqQqFtxLKWAsKvtGn 3MyDtNTkCNyRCw3o2qv5BPPS7vvUosiQe6F: -0.01400000 Waves 2019.11.19 00:49 [771139] smart account 3MyDtNTkCNyRCw3o2qv5BPPS7vvUosiQe6F > SELF 0.00000000 Waves
{ "type": 13, "id": "8RumJAyh4zLqXRY71uxucByWVHNgqQqFtxLKWAsKvtGn", "fee": 1400000, "feeAssetId": null, "timestamp": 1574113749818, "version": 1, "sender": "3MyDtNTkCNyRCw3o2qv5BPPS7vvUosiQe6F", "senderPublicKey": "3z5txV1G5GKezwMRCHZDkLThqb1Yggepxvi2wq6iP6oz", "proofs": [ "3xGZ7hfzxg814jPacnVvV2fgyzZQcuJrqi7Lkiybs7Lagybkoz8xWhNRPQpkkZm9EokstSNXBkSHrdybJpGr3Tdz" ], "script": "base64:AAIDAAAAAAAAABUIARIAEgASBAoCCAESABIDCgEIEgAAAABpAQAAAA5nZXROdW1iZXJCeUtleQAAAAEAAAADa2V5BAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhAAAAAAAAAAAAAQAAAA5nZXRTdHJpbmdCeUtleQAAAAEAAAADa2V5BAAAAAckbWF0Y2gwCQAEHQAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAGU3RyaW5nBAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhAgAAAAABAAAADGdldEJvb2xCeUtleQAAAAEAAAADa2V5BAAAAAckbWF0Y2gwCQAEGwAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAHQm9vbGVhbgQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQcBAAAAGGdldE51bWJlckJ5QWRkcmVzc0FuZEtleQAAAAIAAAAHYWRkcmVzcw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c2VUcmFuc2FjdGlvbgQAAAAJbGVhc2luZ1R4BQAAAAckbWF0Y2gwAwkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAIBQAAAAJ0eAAAAA9zZW5kZXJQdWJsaWNLZXkJAAAAAAAAAgkBAAAAEWFkZHJlc3NGcm9tU3RyaW5nAAAAAQUAAAASbm9kZU9yYWNsZVByb3ZpZGVyCQEAAAAUYWRkcmVzc0Zyb21QdWJsaWNLZXkAAAABCAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V5BwkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAIBQAAAAJ0eAAAAA9zZW5kZXJQdWJsaWNLZXkjivit", "chainId": 84, "height": 771139, "spentComplexity": 0 } View: original | compacted Prev: Ak6Sw71rxMuS9tCgNnvEvpTEsAgwyvfvk99iYHHgFP1q Next: HHamjXGthfXmbd4g9usosegLtaR1rCDXzTmzTkj3GvK4 Diff:
Old | New | Differences | |
---|---|---|---|
104 | 104 | func getRPDContractBalanceKey (assetId) = ((RPDBalanceKey + "_") + toBase58String(assetId)) | |
105 | 105 | ||
106 | 106 | ||
107 | + | let TotalOrderbookKey = "total_orderbook" | |
108 | + | ||
109 | + | let TotalLiquidationOrderbookKey = "total_liquidation_orderbook" | |
110 | + | ||
107 | 111 | let PriceKey = "price" | |
108 | 112 | ||
109 | 113 | let PriceIndexKey = "price_index" | |
111 | 115 | let IsBlockedKey = "is_blocked" | |
112 | 116 | ||
113 | 117 | let LeasingExpireBlockKey = "leasing_expire_block" | |
114 | - | ||
115 | - | let IsRebalanceKey = "is_rebalance" | |
116 | 118 | ||
117 | 119 | let LeasingTxCountKey = "leasing_index" | |
118 | 120 | ||
126 | 128 | ||
127 | 129 | let RPDSyncIndexKey = "rpd_sync_index" | |
128 | 130 | ||
131 | + | let BalanceLocedkKey = "balance_lock_" | |
132 | + | ||
133 | + | let WavesLockedBalanceKey = (BalanceLocedkKey + "waves") | |
134 | + | ||
135 | + | let NeutrinoLockedBalanceKey = (BalanceLocedkKey + "neutrino") | |
136 | + | ||
129 | 137 | func getRPDSnapshotContractBalanceKey (count,assetId) = ((((RPDBalanceKey + "_") + toBase58String(assetId)) + "_") + toString(count)) | |
130 | 138 | ||
131 | 139 | ||
132 | 140 | func getCancelLeaseTxReserveFeeKey (hash) = (("cancel_lease_tx_reserve_fee" + "_") + hash) | |
133 | 141 | ||
134 | 142 | ||
135 | - | func | |
143 | + | func getWavesLockedBalanceKey (owner) = ((WavesLockedBalanceKey + "_") + owner) | |
136 | 144 | ||
137 | 145 | ||
138 | - | func getBalanceUnlockBlockKey (owner) = ("balance_block_" + owner) | |
146 | + | func getNeutrinoLockedBalanceKey (owner) = ((NeutrinoLockedBalanceKey + "_") + owner) | |
147 | + | ||
148 | + | ||
149 | + | func getBalanceUnlockBlockKey (owner) = ("balance_unlock_block_" + owner) | |
139 | 150 | ||
140 | 151 | ||
141 | 152 | func getRPDProfitKey (count) = (("rpd_profit" + "_") + toString(count)) | |
142 | - | ||
143 | - | ||
144 | - | func getLockedBalanceKey (assetId) = ("balance_" + assetId) | |
145 | 153 | ||
146 | 154 | ||
147 | 155 | func getLeaseTxStatusKey (hash) = (("lease_tx_status" + "_") + hash) | |
171 | 179 | func convertWavesToBond (amount,price) = convertNeutrinoToBond(convertWavesToNeutrino(amount, price)) | |
172 | 180 | ||
173 | 181 | ||
174 | - | ||
182 | + | let neutrinoLockedBalance = getNumberByKey(NeutrinoLockedBalanceKey) | |
175 | 183 | ||
184 | + | let wavesLockedBalance = getNumberByKey(WavesLockedBalanceKey) | |
176 | 185 | ||
177 | 186 | let liquidationContract = getStringByKey(LiquidationContractKey) | |
178 | 187 | ||
196 | 205 | ||
197 | 206 | let leasingTxCount = getNumberByKey(LeasingTxCountKey) | |
198 | 207 | ||
199 | - | let isRebalance = getBoolByKey(IsRebalanceKey) | |
200 | - | ||
201 | 208 | let leasingInterval = getNumberByKey(LeasingIntervalKey) | |
202 | 209 | ||
203 | 210 | let leasingExpireBlock = getNumberByKey(LeasingExpireBlockKey) | |
206 | 213 | ||
207 | 214 | let nodeAddress = getStringByKey(NodeAddressKey) | |
208 | 215 | ||
209 | - | let | |
216 | + | let nodeOracleProvider = getStringByKey(NodeOracleProviderKey) | |
210 | 217 | ||
211 | 218 | let rpdSyncIndex = getNumberByKey(RPDSyncIndexKey) | |
212 | 219 | ||
216 | 223 | ||
217 | 224 | let minNeutrinoSwapAmount = getNumberByKey(MinNeutrinoSwapAmountKey) | |
218 | 225 | ||
219 | - | let reserve = (wavesBalance(this) - | |
226 | + | let reserve = (wavesBalance(this) - wavesLockedBalance) | |
220 | 227 | ||
221 | 228 | let reserveWithoutLeasing = (reserve - leasingAmount) | |
222 | 229 | ||
224 | 231 | ||
225 | 232 | let bondSupply = (extract(assetInfo(bondAssetId)).quantity - assetBalance(this, bondAssetId)) | |
226 | 233 | ||
227 | - | let neutrinoSupply = ((extract(assetInfo(neutrinoAssetId)).quantity - assetBalance(this, neutrinoAssetId)) + | |
234 | + | let neutrinoSupply = ((extract(assetInfo(neutrinoAssetId)).quantity - assetBalance(this, neutrinoAssetId)) + neutrinoLockedBalance) | |
228 | 235 | ||
229 | 236 | let surplus = (convertWavesToNeutrino(reserve, currentPrice) - neutrinoSupply) | |
230 | 237 | ||
232 | 239 | ||
233 | 240 | func getRPDContractBalance (assetId) = getNumberByAddressAndKey(rpdContract, getRPDContractBalanceKey(assetId)) | |
234 | 241 | ||
242 | + | ||
243 | + | let totalLiquidationOrderbook = getNumberByAddressAndKey(auctionContract, TotalLiquidationOrderbookKey) | |
244 | + | ||
245 | + | let totalOrderbook = getNumberByAddressAndKey(auctionContract, TotalOrderbookKey) | |
235 | 246 | ||
236 | 247 | func getPriceHistory (block) = getNumberByAddressAndKey(controlContract, getPriceHistoryKey(block)) | |
237 | 248 | ||
242 | 253 | func getCancelLeaseTxReserveFee (hash) = getNumberByKey(getCancelLeaseTxReserveFeeKey(hash)) | |
243 | 254 | ||
244 | 255 | ||
245 | - | func getAccountLockedBalance (owner,assetId) = getNumberByKey(getAccountLockedBalanceKey(owner, assetId)) | |
256 | + | func getWavesLockedBalance (owner) = getNumberByKey(getWavesLockedBalanceKey(owner)) | |
257 | + | ||
258 | + | ||
259 | + | func getNeutrinoLockedBalance (owner) = getNumberByKey(getNeutrinoLockedBalanceKey(owner)) | |
246 | 260 | ||
247 | 261 | ||
248 | 262 | func getUnlockBalanceBlock (owner) = getNumberByKey(getBalanceUnlockBlockKey(owner)) | |
275 | 289 | then throw("contract is blocked by EMERGENCY SHUTDOWN actions untill reactivation by emergency oracles") | |
276 | 290 | else if ((getUnlockBalanceBlock(account) > height)) | |
277 | 291 | then throw((("await " + toString((getUnlockBalanceBlock(account) - height))) + " blocks")) | |
278 | - | else if ((getAccountLockedBalance(account, WAVESASSETID) != 0)) | |
292 | + | else if (if ((getNeutrinoLockedBalance(account) != 0)) | |
293 | + | then true | |
294 | + | else (getWavesLockedBalance(account) != 0)) | |
279 | 295 | then throw("please withdraw locked funds first") | |
280 | - | else WriteSet([DataEntry( | |
296 | + | else WriteSet([DataEntry(getWavesLockedBalanceKey(account), pmt.amount), DataEntry(getBalanceUnlockBlockKey(account), (height + balanceLockInterval)), DataEntry(WavesLockedBalanceKey, (wavesLockedBalance + pmt.amount))]) | |
281 | 297 | } | |
282 | 298 | ||
283 | 299 | ||
294 | 310 | then throw("can use appropriate neutrino tokens only") | |
295 | 311 | else if ((getUnlockBalanceBlock(account) > height)) | |
296 | 312 | then throw((("await " + toString((getUnlockBalanceBlock(account) - height))) + " blocks")) | |
297 | - | else if ((getAccountLockedBalance(account, neutrinoAssetIdString) != 0)) | |
313 | + | else if (if ((getNeutrinoLockedBalance(account) != 0)) | |
314 | + | then true | |
315 | + | else (getWavesLockedBalance(account) != 0)) | |
298 | 316 | then throw("please withdraw locked funds first") | |
299 | - | else { | |
300 | - | let newLockedBalance = (getLockedBalance(neutrinoAssetIdString) + pmt.amount) | |
301 | - | WriteSet([DataEntry(getAccountLockedBalanceKey(account, neutrinoAssetIdString), pmt.amount), DataEntry(getBalanceUnlockBlockKey(account), (height + balanceLockInterval)), DataEntry(getLockedBalanceKey(neutrinoAssetIdString), newLockedBalance), DataEntry(IsRebalanceKey, if ((reserveWithoutLeasing >= convertNeutrinoToWaves(newLockedBalance, currentPrice))) | |
302 | - | then false | |
303 | - | else true)]) | |
304 | - | } | |
317 | + | else WriteSet([DataEntry(getNeutrinoLockedBalanceKey(account), pmt.amount), DataEntry(getWavesLockedBalanceKey(account), (height + balanceLockInterval)), DataEntry(NeutrinoLockedBalanceKey, (neutrinoLockedBalance + pmt.amount))]) | |
305 | 318 | } | |
306 | 319 | ||
307 | 320 | ||
308 | 321 | ||
309 | 322 | @Callable(i) | |
310 | - | func withdraw (account,index | |
323 | + | func withdraw (account,index) = { | |
311 | 324 | let unlockHeight = getUnlockBalanceBlock(account) | |
312 | - | let lockedBalance = getAccountLockedBalance(account, lockedAssetId) | |
325 | + | let userWavesLockedBalance = getWavesLockedBalance(account) | |
326 | + | let userNeutrinoLockedBalance = getNeutrinoLockedBalance(account) | |
313 | 327 | let indexHeight = getHeightPriceByIndex(index) | |
314 | 328 | let nextIndexHeight = getHeightPriceByIndex((index + 1)) | |
315 | 329 | let priceByIndex = getPriceHistory(indexHeight) | |
316 | - | let amount = if ((lockedAssetId == neutrinoAssetIdString)) | |
317 | - | then convertNeutrinoToWaves(lockedBalance, priceByIndex) | |
318 | - | else convertWavesToNeutrino(lockedBalance, priceByIndex) | |
330 | + | let neutrinoAmount = convertWavesToNeutrino(userWavesLockedBalance, priceByIndex) | |
331 | + | let wavesAmount = convertNeutrinoToWaves(userNeutrinoLockedBalance, priceByIndex) | |
319 | 332 | if (isBlocked) | |
320 | 333 | then throw("contract is blocked by EMERGENCY SHUTDOWN actions untill reactivation by emergency oracles") | |
321 | - | else if (( | |
322 | - | then throw(((" | |
323 | - | else if (( | |
324 | - | then | |
325 | - | else | |
326 | - | ||
327 | - | ||
328 | - | then | |
329 | - | else | |
330 | - | ||
331 | - | ||
332 | - | then | |
333 | - | else | |
334 | - | ||
335 | - | ||
334 | + | else if ((unlockHeight > height)) | |
335 | + | then throw((("please wait for: " + toString(unlockHeight)) + " block height to withdraw WAVES funds")) | |
336 | + | else if (if (if ((index > priceIndex)) | |
337 | + | then true | |
338 | + | else (indexHeight > unlockHeight)) | |
339 | + | then true | |
340 | + | else if ((nextIndexHeight != 0)) | |
341 | + | then (unlockHeight >= nextIndexHeight) | |
342 | + | else false) | |
343 | + | then throw("invalid price history index") | |
344 | + | else if (if ((0 >= neutrinoAmount)) | |
345 | + | then (0 >= wavesAmount) | |
346 | + | else false) | |
347 | + | then throw("balance equals zero") | |
348 | + | else ScriptResult(WriteSet([DataEntry(getWavesLockedBalanceKey(account), 0), DataEntry(getNeutrinoLockedBalanceKey(account), 0), DataEntry(WavesLockedBalanceKey, (wavesLockedBalance - userWavesLockedBalance)), DataEntry(NeutrinoLockedBalanceKey, (neutrinoLockedBalance - userNeutrinoLockedBalance))]), TransferSet([ScriptTransfer(addressFromStringValue(account), wavesAmount, unit), ScriptTransfer(addressFromStringValue(account), neutrinoAmount, neutrinoAssetId)])) | |
336 | 349 | } | |
337 | 350 | ||
338 | 351 | ||
339 | 352 | ||
340 | 353 | @Callable(i) | |
341 | 354 | func transferToAuction () = { | |
342 | - | let deficitBondAmount = (convertNeutrinoToBond(deficit) - assetBalance(addressFromStringValue(auctionContract), bondAssetId)) | |
343 | - | let surplusBond = (convertNeutrinoToBond(surplus) - assetBalance(addressFromStringValue(auctionContract), neutrinoAssetId)) | |
355 | + | let deficitBondAmount = ((convertNeutrinoToBond(deficit) - assetBalance(addressFromStringValue(auctionContract), bondAssetId)) - totalLiquidationOrderbook) | |
356 | + | let surplusBond = ((convertNeutrinoToBond(surplus) - assetBalance(addressFromStringValue(auctionContract), neutrinoAssetId)) - totalOrderbook) | |
344 | 357 | if (isBlocked) | |
345 | 358 | then throw("contract is blocked by EMERGENCY SHUTDOWN actions untill reactivation by emergency oracles") | |
346 | 359 | else if ((deficitBondAmount >= ((convertNeutrinoToBond(neutrinoSupply) * DEFICITOFFSET) / 100))) | |
347 | 360 | then TransferSet([ScriptTransfer(addressFromStringValue(auctionContract), deficitBondAmount, bondAssetId)]) | |
348 | 361 | else if ((surplusBond > 0)) | |
349 | 362 | then TransferSet([ScriptTransfer(addressFromStringValue(liquidationContract), convertBondToNeutrino(surplusBond), neutrinoAssetId)]) | |
350 | - | else throw("bond were generated or do not need it") | |
363 | + | else throw(((((("bond were generated or do not need it. Deficit:" + toString(deficitBondAmount)) + "|") + toString(((neutrinoSupply * DEFICITOFFSET) / 100))) + ". Surplus:") + toString(surplusBond))) | |
351 | 364 | } | |
352 | 365 | ||
353 | 366 | ||
375 | 388 | } | |
376 | 389 | ||
377 | 390 | ||
378 | - | ||
379 | - | @Callable(i) | |
380 | - | func registrationLeaseTx (senderPublicKey,fee,timestamp,leaseTxHash) = { | |
381 | - | let totalFreeReserve = (((reserve * LEASINGSHARE) / 100) - convertNeutrinoToWaves(getLockedBalance(neutrinoAssetIdString), currentPrice)) | |
382 | - | let amount = (totalFreeReserve / LEASINTXCOUNT) | |
383 | - | let txBytes = (((((base58'3h1H' + fromBase58String(senderPublicKey)) + fromBase58String(nodeAddress)) + toBytes(amount)) + toBytes(fee)) + toBytes(timestamp)) | |
384 | - | let txHashBytes = blake2b256(txBytes) | |
385 | - | let txHash = toBase58String(txHashBytes) | |
386 | - | let pmt = extract(i.payment) | |
387 | - | if ((toString(i.caller) == nodeOracleProviderKey)) | |
388 | - | then throw("invalid caller") | |
389 | - | else if (isDefined(pmt.assetId)) | |
390 | - | then throw("invalid paymtn asset") | |
391 | - | else if ((leaseTxHash != txHash)) | |
392 | - | then throw((("invalid tx hash(amount:" + toString(amount)) + ")")) | |
393 | - | else if ((leasingTxCount >= LEASINTXCOUNT)) | |
394 | - | then throw("the number of leasing transactions is equal to the maximum") | |
395 | - | else if ((this != addressFromPublicKey(fromBase58String(senderPublicKey)))) | |
396 | - | then throw("invalid pubKey") | |
397 | - | else if (if ((lastBlock.timestamp > timestamp)) | |
398 | - | then true | |
399 | - | else (timestamp > (lastBlock.timestamp + 5400000))) | |
400 | - | then throw((("invalid timestamp(lastBlock: " + toString(lastBlock.timestamp)) + ")")) | |
401 | - | else if ((getLeaseTxStatus(txHash) != "")) | |
402 | - | then throw("tx is exist") | |
403 | - | else if ((pmt.amount != (fee * 2))) | |
404 | - | then throw("invalid payment amount") | |
405 | - | else if (if ((fee > 1000000)) | |
406 | - | then true | |
407 | - | else (500000 > fee)) | |
408 | - | then throw("invalid fee") | |
409 | - | else if (((totalFreeReserve - (leasingAmount + amount)) > reserveWithoutLeasing)) | |
410 | - | then throw((("invalid amount(result:" + toString(((totalFreeReserve - (leasingAmount + amount)) > reserveWithoutLeasing))) + ")")) | |
411 | - | else WriteSet([DataEntry(getCancelLeaseTxReserveFeeKey(txHash), fee), DataEntry(LeasingTxCountKey, if ((getLeaseTxStatus(txHash) == "")) | |
412 | - | then (leasingTxCount + 1) | |
413 | - | else leasingTxCount), DataEntry(LeasingAmountKey, (leasingAmount + amount)), DataEntry(LeasingExpireBlockKey, if ((height > leasingExpireBlock)) | |
414 | - | then (height + leasingInterval) | |
415 | - | else leasingExpireBlock), DataEntry(getLeaseTxStatusKey(txHash), NEW), DataEntry(getLeaseTxExpireSendBlockKey(txHash), (height + SENDTXEXPIRE)), DataEntry(getLeaseTxAmountByHashKey(txHash), amount), DataEntry(getLeaseTxBytesByHashKey(txHash), toBase64String(txBytes))]) | |
416 | - | } | |
417 | - | ||
418 | - | ||
419 | - | ||
420 | - | @Callable(i) | |
421 | - | func cancelStuckLeaseTx (txHash) = if (if (if ((getLeaseTxStatus(txHash) == NEW)) | |
422 | - | then !(isDefined(transactionHeightById(fromBase58String(txHash)))) | |
423 | - | else false) | |
424 | - | then (height > getLeaseTxExpireSendBlock(txHash)) | |
425 | - | else false) | |
426 | - | then { | |
427 | - | let amount = getLeaseTxAmountByHash(txHash) | |
428 | - | WriteSet([DataEntry(LeasingTxCountKey, (leasingTxCount - 1)), DataEntry(LeasingAmountKey, (leasingAmount - amount)), DataEntry(getLeaseTxStatusKey(txHash), CANCELED), DataEntry(IsRebalanceKey, if (((reserveWithoutLeasing - amount) >= convertNeutrinoToWaves(getLockedBalance(neutrinoAssetIdString), currentPrice))) | |
429 | - | then false | |
430 | - | else true)]) | |
431 | - | } | |
432 | - | else throw("invalid tx hash") | |
433 | - | ||
434 | - | ||
435 | - | ||
436 | - | @Callable(i) | |
437 | - | func registrationUnleaseTx (chainIdString,senderPublicKey,fee,timestamp,leaseTxHash) = { | |
438 | - | let txBytes = (((((base58'gm' + toBytes(chainIdString)) + fromBase58String(senderPublicKey)) + toBytes(fee)) + toBytes(timestamp)) + fromBase58String(leaseTxHash)) | |
439 | - | let txHash = blake2b256(txBytes) | |
440 | - | if ((getLeaseTxStatus(leaseTxHash) != NEW)) | |
441 | - | then throw("invalid tx status") | |
442 | - | else if ((this != addressFromPublicKey(fromBase58String(senderPublicKey)))) | |
443 | - | then throw("invalid pubKey") | |
444 | - | else if (!(isDefined(transactionHeightById(txHash)))) | |
445 | - | then throw("blockchain does not contain this transaction") | |
446 | - | else { | |
447 | - | let amount = getLeaseTxAmountByHash(leaseTxHash) | |
448 | - | WriteSet([DataEntry(LeasingTxCountKey, (leasingTxCount - 1)), DataEntry(LeasingAmountKey, (leasingAmount - amount)), DataEntry(getLeaseTxStatusKey(leaseTxHash), CANCELED), DataEntry(IsRebalanceKey, if (((reserveWithoutLeasing - amount) >= convertNeutrinoToWaves(getLockedBalance(neutrinoAssetIdString), currentPrice))) | |
449 | - | then false | |
450 | - | else true)]) | |
451 | - | } | |
452 | - | } | |
453 | - | ||
454 | - | ||
455 | 391 | @Verifier(tx) | |
456 | 392 | func verify () = { | |
457 | 393 | let id = toBase58String(tx.id) | |
458 | 394 | match tx { | |
459 | - | case leaseTx: LeaseTransaction => | |
460 | - | if (if ((leasingExpireBlock >= height)) | |
461 | - | then (getLeaseTxExpireSendBlock(id) >= height) | |
462 | - | else false) | |
463 | - | then (getLeaseTxStatus(id) == NEW) | |
464 | - | else false | |
465 | - | case unleaseTx: LeaseCancelTransaction => | |
466 | - | let leaseId = toBase58String(unleaseTx.leaseId) | |
467 | - | if (if (if ((height > leasingExpireBlock)) | |
468 | - | then true | |
469 | - | else isRebalance) | |
470 | - | then (unleaseTx.fee == getCancelLeaseTxReserveFee(leaseId)) | |
471 | - | else false) | |
472 | - | then (getLeaseTxStatus(leaseId) == NEW) | |
395 | + | case leasingTx: LeaseCancelTransaction|LeaseTransaction => | |
396 | + | if (sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)) | |
397 | + | then (addressFromString(nodeOracleProvider) == addressFromPublicKey(tx.senderPublicKey)) | |
473 | 398 | else false | |
474 | 399 | case _ => | |
475 | 400 | sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | func getNumberByKey (key) = match getInteger(this, key) { | |
5 | 5 | case a: Int => | |
6 | 6 | a | |
7 | 7 | case _ => | |
8 | 8 | 0 | |
9 | 9 | } | |
10 | 10 | ||
11 | 11 | ||
12 | 12 | func getStringByKey (key) = match getString(this, key) { | |
13 | 13 | case a: String => | |
14 | 14 | a | |
15 | 15 | case _ => | |
16 | 16 | "" | |
17 | 17 | } | |
18 | 18 | ||
19 | 19 | ||
20 | 20 | func getBoolByKey (key) = match getBoolean(this, key) { | |
21 | 21 | case a: Boolean => | |
22 | 22 | a | |
23 | 23 | case _ => | |
24 | 24 | false | |
25 | 25 | } | |
26 | 26 | ||
27 | 27 | ||
28 | 28 | func getNumberByAddressAndKey (address,key) = match getInteger(addressFromStringValue(address), key) { | |
29 | 29 | case a: Int => | |
30 | 30 | a | |
31 | 31 | case _ => | |
32 | 32 | 0 | |
33 | 33 | } | |
34 | 34 | ||
35 | 35 | ||
36 | 36 | func getStringByAddressAndKey (address,key) = match getString(addressFromStringValue(address), key) { | |
37 | 37 | case a: String => | |
38 | 38 | a | |
39 | 39 | case _ => | |
40 | 40 | "" | |
41 | 41 | } | |
42 | 42 | ||
43 | 43 | ||
44 | 44 | func getBoolByAddressAndKey (address,key) = match getBoolean(addressFromStringValue(address), key) { | |
45 | 45 | case a: Boolean => | |
46 | 46 | a | |
47 | 47 | case _ => | |
48 | 48 | false | |
49 | 49 | } | |
50 | 50 | ||
51 | 51 | ||
52 | 52 | let SENDTXEXPIRE = 30 | |
53 | 53 | ||
54 | 54 | let LISTSPLITSYMBOL = "_" | |
55 | 55 | ||
56 | 56 | let LISTDATASYMBOL = "+" | |
57 | 57 | ||
58 | 58 | let WAVELET = 100000000 | |
59 | 59 | ||
60 | 60 | let PAULI = 100 | |
61 | 61 | ||
62 | 62 | let CRYTICALSHARE = 20 | |
63 | 63 | ||
64 | 64 | let LEASINGSHARE = 90 | |
65 | 65 | ||
66 | 66 | let LEASINTXCOUNT = 10 | |
67 | 67 | ||
68 | 68 | let DEFICITOFFSET = 10 | |
69 | 69 | ||
70 | 70 | let WAVESASSETID = "waves" | |
71 | 71 | ||
72 | 72 | let CANCELED = "canceled" | |
73 | 73 | ||
74 | 74 | let NEW = "new" | |
75 | 75 | ||
76 | 76 | let NeutrinoAssetIdKey = "neutrino_asset_id" | |
77 | 77 | ||
78 | 78 | let BondAssetIdKey = "bond_asset_id" | |
79 | 79 | ||
80 | 80 | let ReserveContractKey = "reserve_contract" | |
81 | 81 | ||
82 | 82 | let AuctionContractKey = "auction_contract" | |
83 | 83 | ||
84 | 84 | let LiquidationContractKey = "liquidation_contract" | |
85 | 85 | ||
86 | 86 | let RPDContractKey = "rpd_contract" | |
87 | 87 | ||
88 | 88 | let ContolContractKey = "control_contract" | |
89 | 89 | ||
90 | 90 | let BalanceLockIntervalKey = "balance_lock_interval" | |
91 | 91 | ||
92 | 92 | let MinWavesSwapAmountKey = "min_waves_swap_amount" | |
93 | 93 | ||
94 | 94 | let MinNeutrinoSwapAmountKey = "min_neutrino_swap_amount" | |
95 | 95 | ||
96 | 96 | let NodeAddressKey = "node_address" | |
97 | 97 | ||
98 | 98 | let NodeOracleProviderKey = "oracle_node_provider" | |
99 | 99 | ||
100 | 100 | let LeasingIntervalKey = "leasing_interval" | |
101 | 101 | ||
102 | 102 | let RPDBalanceKey = "rpd_balance" | |
103 | 103 | ||
104 | 104 | func getRPDContractBalanceKey (assetId) = ((RPDBalanceKey + "_") + toBase58String(assetId)) | |
105 | 105 | ||
106 | 106 | ||
107 | + | let TotalOrderbookKey = "total_orderbook" | |
108 | + | ||
109 | + | let TotalLiquidationOrderbookKey = "total_liquidation_orderbook" | |
110 | + | ||
107 | 111 | let PriceKey = "price" | |
108 | 112 | ||
109 | 113 | let PriceIndexKey = "price_index" | |
110 | 114 | ||
111 | 115 | let IsBlockedKey = "is_blocked" | |
112 | 116 | ||
113 | 117 | let LeasingExpireBlockKey = "leasing_expire_block" | |
114 | - | ||
115 | - | let IsRebalanceKey = "is_rebalance" | |
116 | 118 | ||
117 | 119 | let LeasingTxCountKey = "leasing_index" | |
118 | 120 | ||
119 | 121 | let LeasingAmountKey = "leasing_amount" | |
120 | 122 | ||
121 | 123 | func getPriceHistoryKey (block) = ((PriceKey + "_") + toString(block)) | |
122 | 124 | ||
123 | 125 | ||
124 | 126 | func getHeightPriceByIndexKey (index) = ((PriceIndexKey + "_") + toString(index)) | |
125 | 127 | ||
126 | 128 | ||
127 | 129 | let RPDSyncIndexKey = "rpd_sync_index" | |
128 | 130 | ||
131 | + | let BalanceLocedkKey = "balance_lock_" | |
132 | + | ||
133 | + | let WavesLockedBalanceKey = (BalanceLocedkKey + "waves") | |
134 | + | ||
135 | + | let NeutrinoLockedBalanceKey = (BalanceLocedkKey + "neutrino") | |
136 | + | ||
129 | 137 | func getRPDSnapshotContractBalanceKey (count,assetId) = ((((RPDBalanceKey + "_") + toBase58String(assetId)) + "_") + toString(count)) | |
130 | 138 | ||
131 | 139 | ||
132 | 140 | func getCancelLeaseTxReserveFeeKey (hash) = (("cancel_lease_tx_reserve_fee" + "_") + hash) | |
133 | 141 | ||
134 | 142 | ||
135 | - | func | |
143 | + | func getWavesLockedBalanceKey (owner) = ((WavesLockedBalanceKey + "_") + owner) | |
136 | 144 | ||
137 | 145 | ||
138 | - | func getBalanceUnlockBlockKey (owner) = ("balance_block_" + owner) | |
146 | + | func getNeutrinoLockedBalanceKey (owner) = ((NeutrinoLockedBalanceKey + "_") + owner) | |
147 | + | ||
148 | + | ||
149 | + | func getBalanceUnlockBlockKey (owner) = ("balance_unlock_block_" + owner) | |
139 | 150 | ||
140 | 151 | ||
141 | 152 | func getRPDProfitKey (count) = (("rpd_profit" + "_") + toString(count)) | |
142 | - | ||
143 | - | ||
144 | - | func getLockedBalanceKey (assetId) = ("balance_" + assetId) | |
145 | 153 | ||
146 | 154 | ||
147 | 155 | func getLeaseTxStatusKey (hash) = (("lease_tx_status" + "_") + hash) | |
148 | 156 | ||
149 | 157 | ||
150 | 158 | func getLeaseTxAmountByHashKey (hash) = ((LeasingAmountKey + "_") + hash) | |
151 | 159 | ||
152 | 160 | ||
153 | 161 | func getLeaseTxBytesByHashKey (hash) = (("lease_tx" + "_") + hash) | |
154 | 162 | ||
155 | 163 | ||
156 | 164 | func getLeaseTxExpireSendBlockKey (hash) = (("leasing_expire_send" + "_") + hash) | |
157 | 165 | ||
158 | 166 | ||
159 | 167 | func convertNeutrinoToWaves (amount,price) = ((((amount * 100) / price) * WAVELET) / PAULI) | |
160 | 168 | ||
161 | 169 | ||
162 | 170 | func convertWavesToNeutrino (amount,price) = ((((amount * price) / 100) * PAULI) / WAVELET) | |
163 | 171 | ||
164 | 172 | ||
165 | 173 | func convertNeutrinoToBond (amount) = (amount / PAULI) | |
166 | 174 | ||
167 | 175 | ||
168 | 176 | func convertBondToNeutrino (amount) = (amount * PAULI) | |
169 | 177 | ||
170 | 178 | ||
171 | 179 | func convertWavesToBond (amount,price) = convertNeutrinoToBond(convertWavesToNeutrino(amount, price)) | |
172 | 180 | ||
173 | 181 | ||
174 | - | ||
182 | + | let neutrinoLockedBalance = getNumberByKey(NeutrinoLockedBalanceKey) | |
175 | 183 | ||
184 | + | let wavesLockedBalance = getNumberByKey(WavesLockedBalanceKey) | |
176 | 185 | ||
177 | 186 | let liquidationContract = getStringByKey(LiquidationContractKey) | |
178 | 187 | ||
179 | 188 | let neutrinoAssetIdString = getStringByKey(NeutrinoAssetIdKey) | |
180 | 189 | ||
181 | 190 | let neutrinoAssetId = fromBase58String(neutrinoAssetIdString) | |
182 | 191 | ||
183 | 192 | let reserveContract = getStringByKey(ReserveContractKey) | |
184 | 193 | ||
185 | 194 | let auctionContract = getStringByKey(AuctionContractKey) | |
186 | 195 | ||
187 | 196 | let rpdContract = getStringByKey(RPDContractKey) | |
188 | 197 | ||
189 | 198 | let controlContract = getStringByKey(ContolContractKey) | |
190 | 199 | ||
191 | 200 | let currentPrice = getNumberByAddressAndKey(controlContract, PriceKey) | |
192 | 201 | ||
193 | 202 | let priceIndex = getNumberByAddressAndKey(controlContract, PriceIndexKey) | |
194 | 203 | ||
195 | 204 | let isBlocked = getBoolByAddressAndKey(controlContract, IsBlockedKey) | |
196 | 205 | ||
197 | 206 | let leasingTxCount = getNumberByKey(LeasingTxCountKey) | |
198 | 207 | ||
199 | - | let isRebalance = getBoolByKey(IsRebalanceKey) | |
200 | - | ||
201 | 208 | let leasingInterval = getNumberByKey(LeasingIntervalKey) | |
202 | 209 | ||
203 | 210 | let leasingExpireBlock = getNumberByKey(LeasingExpireBlockKey) | |
204 | 211 | ||
205 | 212 | let leasingAmount = getNumberByKey(LeasingAmountKey) | |
206 | 213 | ||
207 | 214 | let nodeAddress = getStringByKey(NodeAddressKey) | |
208 | 215 | ||
209 | - | let | |
216 | + | let nodeOracleProvider = getStringByKey(NodeOracleProviderKey) | |
210 | 217 | ||
211 | 218 | let rpdSyncIndex = getNumberByKey(RPDSyncIndexKey) | |
212 | 219 | ||
213 | 220 | let balanceLockInterval = getNumberByKey(BalanceLockIntervalKey) | |
214 | 221 | ||
215 | 222 | let minWavesSwapAmount = getNumberByKey(MinWavesSwapAmountKey) | |
216 | 223 | ||
217 | 224 | let minNeutrinoSwapAmount = getNumberByKey(MinNeutrinoSwapAmountKey) | |
218 | 225 | ||
219 | - | let reserve = (wavesBalance(this) - | |
226 | + | let reserve = (wavesBalance(this) - wavesLockedBalance) | |
220 | 227 | ||
221 | 228 | let reserveWithoutLeasing = (reserve - leasingAmount) | |
222 | 229 | ||
223 | 230 | let bondAssetId = fromBase58String(getStringByKey(BondAssetIdKey)) | |
224 | 231 | ||
225 | 232 | let bondSupply = (extract(assetInfo(bondAssetId)).quantity - assetBalance(this, bondAssetId)) | |
226 | 233 | ||
227 | - | let neutrinoSupply = ((extract(assetInfo(neutrinoAssetId)).quantity - assetBalance(this, neutrinoAssetId)) + | |
234 | + | let neutrinoSupply = ((extract(assetInfo(neutrinoAssetId)).quantity - assetBalance(this, neutrinoAssetId)) + neutrinoLockedBalance) | |
228 | 235 | ||
229 | 236 | let surplus = (convertWavesToNeutrino(reserve, currentPrice) - neutrinoSupply) | |
230 | 237 | ||
231 | 238 | let deficit = (neutrinoSupply - convertWavesToNeutrino(reserve, currentPrice)) | |
232 | 239 | ||
233 | 240 | func getRPDContractBalance (assetId) = getNumberByAddressAndKey(rpdContract, getRPDContractBalanceKey(assetId)) | |
234 | 241 | ||
242 | + | ||
243 | + | let totalLiquidationOrderbook = getNumberByAddressAndKey(auctionContract, TotalLiquidationOrderbookKey) | |
244 | + | ||
245 | + | let totalOrderbook = getNumberByAddressAndKey(auctionContract, TotalOrderbookKey) | |
235 | 246 | ||
236 | 247 | func getPriceHistory (block) = getNumberByAddressAndKey(controlContract, getPriceHistoryKey(block)) | |
237 | 248 | ||
238 | 249 | ||
239 | 250 | func getHeightPriceByIndex (index) = getNumberByAddressAndKey(controlContract, getHeightPriceByIndexKey(index)) | |
240 | 251 | ||
241 | 252 | ||
242 | 253 | func getCancelLeaseTxReserveFee (hash) = getNumberByKey(getCancelLeaseTxReserveFeeKey(hash)) | |
243 | 254 | ||
244 | 255 | ||
245 | - | func getAccountLockedBalance (owner,assetId) = getNumberByKey(getAccountLockedBalanceKey(owner, assetId)) | |
256 | + | func getWavesLockedBalance (owner) = getNumberByKey(getWavesLockedBalanceKey(owner)) | |
257 | + | ||
258 | + | ||
259 | + | func getNeutrinoLockedBalance (owner) = getNumberByKey(getNeutrinoLockedBalanceKey(owner)) | |
246 | 260 | ||
247 | 261 | ||
248 | 262 | func getUnlockBalanceBlock (owner) = getNumberByKey(getBalanceUnlockBlockKey(owner)) | |
249 | 263 | ||
250 | 264 | ||
251 | 265 | func getRPDProfit (count) = getNumberByKey(getRPDProfitKey(count)) | |
252 | 266 | ||
253 | 267 | ||
254 | 268 | func getLeaseTxStatus (hash) = getStringByKey(getLeaseTxStatusKey(hash)) | |
255 | 269 | ||
256 | 270 | ||
257 | 271 | func getLeaseTxAmountByHash (hash) = getNumberByKey(getLeaseTxAmountByHashKey(hash)) | |
258 | 272 | ||
259 | 273 | ||
260 | 274 | func getLeaseTxBytesByHash (hash) = getStringByKey(getLeaseTxBytesByHashKey(hash)) | |
261 | 275 | ||
262 | 276 | ||
263 | 277 | func getLeaseTxExpireSendBlock (hash) = getNumberByKey(getLeaseTxExpireSendBlockKey(hash)) | |
264 | 278 | ||
265 | 279 | ||
266 | 280 | @Callable(i) | |
267 | 281 | func swapWavesToNeutrino () = { | |
268 | 282 | let pmt = extract(i.payment) | |
269 | 283 | let account = toString(i.caller) | |
270 | 284 | if ((minWavesSwapAmount > pmt.amount)) | |
271 | 285 | then throw((("an amount is less than min available amount: " + toString(minWavesSwapAmount)) + " wavelets")) | |
272 | 286 | else if (isDefined(pmt.assetId)) | |
273 | 287 | then throw("can use waves only") | |
274 | 288 | else if (isBlocked) | |
275 | 289 | then throw("contract is blocked by EMERGENCY SHUTDOWN actions untill reactivation by emergency oracles") | |
276 | 290 | else if ((getUnlockBalanceBlock(account) > height)) | |
277 | 291 | then throw((("await " + toString((getUnlockBalanceBlock(account) - height))) + " blocks")) | |
278 | - | else if ((getAccountLockedBalance(account, WAVESASSETID) != 0)) | |
292 | + | else if (if ((getNeutrinoLockedBalance(account) != 0)) | |
293 | + | then true | |
294 | + | else (getWavesLockedBalance(account) != 0)) | |
279 | 295 | then throw("please withdraw locked funds first") | |
280 | - | else WriteSet([DataEntry( | |
296 | + | else WriteSet([DataEntry(getWavesLockedBalanceKey(account), pmt.amount), DataEntry(getBalanceUnlockBlockKey(account), (height + balanceLockInterval)), DataEntry(WavesLockedBalanceKey, (wavesLockedBalance + pmt.amount))]) | |
281 | 297 | } | |
282 | 298 | ||
283 | 299 | ||
284 | 300 | ||
285 | 301 | @Callable(i) | |
286 | 302 | func swapNeutrinoToWaves () = { | |
287 | 303 | let pmt = extract(i.payment) | |
288 | 304 | let account = toString(i.caller) | |
289 | 305 | if ((minNeutrinoSwapAmount > pmt.amount)) | |
290 | 306 | then throw((("an amount is less than min available amount: " + toString(minNeutrinoSwapAmount)) + " neutrino cents")) | |
291 | 307 | else if (isBlocked) | |
292 | 308 | then throw("contract is blocked by EMERGENCY SHUTDOWN actions untill reactivation by emergency oracles") | |
293 | 309 | else if ((pmt.assetId != neutrinoAssetId)) | |
294 | 310 | then throw("can use appropriate neutrino tokens only") | |
295 | 311 | else if ((getUnlockBalanceBlock(account) > height)) | |
296 | 312 | then throw((("await " + toString((getUnlockBalanceBlock(account) - height))) + " blocks")) | |
297 | - | else if ((getAccountLockedBalance(account, neutrinoAssetIdString) != 0)) | |
313 | + | else if (if ((getNeutrinoLockedBalance(account) != 0)) | |
314 | + | then true | |
315 | + | else (getWavesLockedBalance(account) != 0)) | |
298 | 316 | then throw("please withdraw locked funds first") | |
299 | - | else { | |
300 | - | let newLockedBalance = (getLockedBalance(neutrinoAssetIdString) + pmt.amount) | |
301 | - | WriteSet([DataEntry(getAccountLockedBalanceKey(account, neutrinoAssetIdString), pmt.amount), DataEntry(getBalanceUnlockBlockKey(account), (height + balanceLockInterval)), DataEntry(getLockedBalanceKey(neutrinoAssetIdString), newLockedBalance), DataEntry(IsRebalanceKey, if ((reserveWithoutLeasing >= convertNeutrinoToWaves(newLockedBalance, currentPrice))) | |
302 | - | then false | |
303 | - | else true)]) | |
304 | - | } | |
317 | + | else WriteSet([DataEntry(getNeutrinoLockedBalanceKey(account), pmt.amount), DataEntry(getWavesLockedBalanceKey(account), (height + balanceLockInterval)), DataEntry(NeutrinoLockedBalanceKey, (neutrinoLockedBalance + pmt.amount))]) | |
305 | 318 | } | |
306 | 319 | ||
307 | 320 | ||
308 | 321 | ||
309 | 322 | @Callable(i) | |
310 | - | func withdraw (account,index | |
323 | + | func withdraw (account,index) = { | |
311 | 324 | let unlockHeight = getUnlockBalanceBlock(account) | |
312 | - | let lockedBalance = getAccountLockedBalance(account, lockedAssetId) | |
325 | + | let userWavesLockedBalance = getWavesLockedBalance(account) | |
326 | + | let userNeutrinoLockedBalance = getNeutrinoLockedBalance(account) | |
313 | 327 | let indexHeight = getHeightPriceByIndex(index) | |
314 | 328 | let nextIndexHeight = getHeightPriceByIndex((index + 1)) | |
315 | 329 | let priceByIndex = getPriceHistory(indexHeight) | |
316 | - | let amount = if ((lockedAssetId == neutrinoAssetIdString)) | |
317 | - | then convertNeutrinoToWaves(lockedBalance, priceByIndex) | |
318 | - | else convertWavesToNeutrino(lockedBalance, priceByIndex) | |
330 | + | let neutrinoAmount = convertWavesToNeutrino(userWavesLockedBalance, priceByIndex) | |
331 | + | let wavesAmount = convertNeutrinoToWaves(userNeutrinoLockedBalance, priceByIndex) | |
319 | 332 | if (isBlocked) | |
320 | 333 | then throw("contract is blocked by EMERGENCY SHUTDOWN actions untill reactivation by emergency oracles") | |
321 | - | else if (( | |
322 | - | then throw(((" | |
323 | - | else if (( | |
324 | - | then | |
325 | - | else | |
326 | - | ||
327 | - | ||
328 | - | then | |
329 | - | else | |
330 | - | ||
331 | - | ||
332 | - | then | |
333 | - | else | |
334 | - | ||
335 | - | ||
334 | + | else if ((unlockHeight > height)) | |
335 | + | then throw((("please wait for: " + toString(unlockHeight)) + " block height to withdraw WAVES funds")) | |
336 | + | else if (if (if ((index > priceIndex)) | |
337 | + | then true | |
338 | + | else (indexHeight > unlockHeight)) | |
339 | + | then true | |
340 | + | else if ((nextIndexHeight != 0)) | |
341 | + | then (unlockHeight >= nextIndexHeight) | |
342 | + | else false) | |
343 | + | then throw("invalid price history index") | |
344 | + | else if (if ((0 >= neutrinoAmount)) | |
345 | + | then (0 >= wavesAmount) | |
346 | + | else false) | |
347 | + | then throw("balance equals zero") | |
348 | + | else ScriptResult(WriteSet([DataEntry(getWavesLockedBalanceKey(account), 0), DataEntry(getNeutrinoLockedBalanceKey(account), 0), DataEntry(WavesLockedBalanceKey, (wavesLockedBalance - userWavesLockedBalance)), DataEntry(NeutrinoLockedBalanceKey, (neutrinoLockedBalance - userNeutrinoLockedBalance))]), TransferSet([ScriptTransfer(addressFromStringValue(account), wavesAmount, unit), ScriptTransfer(addressFromStringValue(account), neutrinoAmount, neutrinoAssetId)])) | |
336 | 349 | } | |
337 | 350 | ||
338 | 351 | ||
339 | 352 | ||
340 | 353 | @Callable(i) | |
341 | 354 | func transferToAuction () = { | |
342 | - | let deficitBondAmount = (convertNeutrinoToBond(deficit) - assetBalance(addressFromStringValue(auctionContract), bondAssetId)) | |
343 | - | let surplusBond = (convertNeutrinoToBond(surplus) - assetBalance(addressFromStringValue(auctionContract), neutrinoAssetId)) | |
355 | + | let deficitBondAmount = ((convertNeutrinoToBond(deficit) - assetBalance(addressFromStringValue(auctionContract), bondAssetId)) - totalLiquidationOrderbook) | |
356 | + | let surplusBond = ((convertNeutrinoToBond(surplus) - assetBalance(addressFromStringValue(auctionContract), neutrinoAssetId)) - totalOrderbook) | |
344 | 357 | if (isBlocked) | |
345 | 358 | then throw("contract is blocked by EMERGENCY SHUTDOWN actions untill reactivation by emergency oracles") | |
346 | 359 | else if ((deficitBondAmount >= ((convertNeutrinoToBond(neutrinoSupply) * DEFICITOFFSET) / 100))) | |
347 | 360 | then TransferSet([ScriptTransfer(addressFromStringValue(auctionContract), deficitBondAmount, bondAssetId)]) | |
348 | 361 | else if ((surplusBond > 0)) | |
349 | 362 | then TransferSet([ScriptTransfer(addressFromStringValue(liquidationContract), convertBondToNeutrino(surplusBond), neutrinoAssetId)]) | |
350 | - | else throw("bond were generated or do not need it") | |
363 | + | else throw(((((("bond were generated or do not need it. Deficit:" + toString(deficitBondAmount)) + "|") + toString(((neutrinoSupply * DEFICITOFFSET) / 100))) + ". Surplus:") + toString(surplusBond))) | |
351 | 364 | } | |
352 | 365 | ||
353 | 366 | ||
354 | 367 | ||
355 | 368 | @Callable(i) | |
356 | 369 | func transfer (account) = { | |
357 | 370 | let pmt = extract(i.payment) | |
358 | 371 | TransferSet([ScriptTransfer(addressFromStringValue(account), pmt.amount, pmt.assetId)]) | |
359 | 372 | } | |
360 | 373 | ||
361 | 374 | ||
362 | 375 | ||
363 | 376 | @Callable(i) | |
364 | 377 | func nodeReward () = { | |
365 | 378 | let pmt = value(i.payment) | |
366 | 379 | if ((i.caller != addressFromStringValue(nodeAddress))) | |
367 | 380 | then throw("only node account is able to transfer staking rewards from main account") | |
368 | 381 | else if (isDefined(pmt.assetId)) | |
369 | 382 | then throw("waves tokens only allowed") | |
370 | 383 | else { | |
371 | 384 | let amount = convertWavesToNeutrino(pmt.amount, currentPrice) | |
372 | 385 | let newRpdSyncIndex = (rpdSyncIndex + 1) | |
373 | 386 | ScriptResult(WriteSet([DataEntry(RPDSyncIndexKey, newRpdSyncIndex), DataEntry(getRPDProfitKey(rpdSyncIndex), amount), DataEntry(getRPDSnapshotContractBalanceKey(rpdSyncIndex, neutrinoAssetId), getRPDContractBalance(neutrinoAssetId))]), TransferSet([ScriptTransfer(addressFromStringValue(rpdContract), amount, neutrinoAssetId)])) | |
374 | 387 | } | |
375 | 388 | } | |
376 | 389 | ||
377 | 390 | ||
378 | - | ||
379 | - | @Callable(i) | |
380 | - | func registrationLeaseTx (senderPublicKey,fee,timestamp,leaseTxHash) = { | |
381 | - | let totalFreeReserve = (((reserve * LEASINGSHARE) / 100) - convertNeutrinoToWaves(getLockedBalance(neutrinoAssetIdString), currentPrice)) | |
382 | - | let amount = (totalFreeReserve / LEASINTXCOUNT) | |
383 | - | let txBytes = (((((base58'3h1H' + fromBase58String(senderPublicKey)) + fromBase58String(nodeAddress)) + toBytes(amount)) + toBytes(fee)) + toBytes(timestamp)) | |
384 | - | let txHashBytes = blake2b256(txBytes) | |
385 | - | let txHash = toBase58String(txHashBytes) | |
386 | - | let pmt = extract(i.payment) | |
387 | - | if ((toString(i.caller) == nodeOracleProviderKey)) | |
388 | - | then throw("invalid caller") | |
389 | - | else if (isDefined(pmt.assetId)) | |
390 | - | then throw("invalid paymtn asset") | |
391 | - | else if ((leaseTxHash != txHash)) | |
392 | - | then throw((("invalid tx hash(amount:" + toString(amount)) + ")")) | |
393 | - | else if ((leasingTxCount >= LEASINTXCOUNT)) | |
394 | - | then throw("the number of leasing transactions is equal to the maximum") | |
395 | - | else if ((this != addressFromPublicKey(fromBase58String(senderPublicKey)))) | |
396 | - | then throw("invalid pubKey") | |
397 | - | else if (if ((lastBlock.timestamp > timestamp)) | |
398 | - | then true | |
399 | - | else (timestamp > (lastBlock.timestamp + 5400000))) | |
400 | - | then throw((("invalid timestamp(lastBlock: " + toString(lastBlock.timestamp)) + ")")) | |
401 | - | else if ((getLeaseTxStatus(txHash) != "")) | |
402 | - | then throw("tx is exist") | |
403 | - | else if ((pmt.amount != (fee * 2))) | |
404 | - | then throw("invalid payment amount") | |
405 | - | else if (if ((fee > 1000000)) | |
406 | - | then true | |
407 | - | else (500000 > fee)) | |
408 | - | then throw("invalid fee") | |
409 | - | else if (((totalFreeReserve - (leasingAmount + amount)) > reserveWithoutLeasing)) | |
410 | - | then throw((("invalid amount(result:" + toString(((totalFreeReserve - (leasingAmount + amount)) > reserveWithoutLeasing))) + ")")) | |
411 | - | else WriteSet([DataEntry(getCancelLeaseTxReserveFeeKey(txHash), fee), DataEntry(LeasingTxCountKey, if ((getLeaseTxStatus(txHash) == "")) | |
412 | - | then (leasingTxCount + 1) | |
413 | - | else leasingTxCount), DataEntry(LeasingAmountKey, (leasingAmount + amount)), DataEntry(LeasingExpireBlockKey, if ((height > leasingExpireBlock)) | |
414 | - | then (height + leasingInterval) | |
415 | - | else leasingExpireBlock), DataEntry(getLeaseTxStatusKey(txHash), NEW), DataEntry(getLeaseTxExpireSendBlockKey(txHash), (height + SENDTXEXPIRE)), DataEntry(getLeaseTxAmountByHashKey(txHash), amount), DataEntry(getLeaseTxBytesByHashKey(txHash), toBase64String(txBytes))]) | |
416 | - | } | |
417 | - | ||
418 | - | ||
419 | - | ||
420 | - | @Callable(i) | |
421 | - | func cancelStuckLeaseTx (txHash) = if (if (if ((getLeaseTxStatus(txHash) == NEW)) | |
422 | - | then !(isDefined(transactionHeightById(fromBase58String(txHash)))) | |
423 | - | else false) | |
424 | - | then (height > getLeaseTxExpireSendBlock(txHash)) | |
425 | - | else false) | |
426 | - | then { | |
427 | - | let amount = getLeaseTxAmountByHash(txHash) | |
428 | - | WriteSet([DataEntry(LeasingTxCountKey, (leasingTxCount - 1)), DataEntry(LeasingAmountKey, (leasingAmount - amount)), DataEntry(getLeaseTxStatusKey(txHash), CANCELED), DataEntry(IsRebalanceKey, if (((reserveWithoutLeasing - amount) >= convertNeutrinoToWaves(getLockedBalance(neutrinoAssetIdString), currentPrice))) | |
429 | - | then false | |
430 | - | else true)]) | |
431 | - | } | |
432 | - | else throw("invalid tx hash") | |
433 | - | ||
434 | - | ||
435 | - | ||
436 | - | @Callable(i) | |
437 | - | func registrationUnleaseTx (chainIdString,senderPublicKey,fee,timestamp,leaseTxHash) = { | |
438 | - | let txBytes = (((((base58'gm' + toBytes(chainIdString)) + fromBase58String(senderPublicKey)) + toBytes(fee)) + toBytes(timestamp)) + fromBase58String(leaseTxHash)) | |
439 | - | let txHash = blake2b256(txBytes) | |
440 | - | if ((getLeaseTxStatus(leaseTxHash) != NEW)) | |
441 | - | then throw("invalid tx status") | |
442 | - | else if ((this != addressFromPublicKey(fromBase58String(senderPublicKey)))) | |
443 | - | then throw("invalid pubKey") | |
444 | - | else if (!(isDefined(transactionHeightById(txHash)))) | |
445 | - | then throw("blockchain does not contain this transaction") | |
446 | - | else { | |
447 | - | let amount = getLeaseTxAmountByHash(leaseTxHash) | |
448 | - | WriteSet([DataEntry(LeasingTxCountKey, (leasingTxCount - 1)), DataEntry(LeasingAmountKey, (leasingAmount - amount)), DataEntry(getLeaseTxStatusKey(leaseTxHash), CANCELED), DataEntry(IsRebalanceKey, if (((reserveWithoutLeasing - amount) >= convertNeutrinoToWaves(getLockedBalance(neutrinoAssetIdString), currentPrice))) | |
449 | - | then false | |
450 | - | else true)]) | |
451 | - | } | |
452 | - | } | |
453 | - | ||
454 | - | ||
455 | 391 | @Verifier(tx) | |
456 | 392 | func verify () = { | |
457 | 393 | let id = toBase58String(tx.id) | |
458 | 394 | match tx { | |
459 | - | case leaseTx: LeaseTransaction => | |
460 | - | if (if ((leasingExpireBlock >= height)) | |
461 | - | then (getLeaseTxExpireSendBlock(id) >= height) | |
462 | - | else false) | |
463 | - | then (getLeaseTxStatus(id) == NEW) | |
464 | - | else false | |
465 | - | case unleaseTx: LeaseCancelTransaction => | |
466 | - | let leaseId = toBase58String(unleaseTx.leaseId) | |
467 | - | if (if (if ((height > leasingExpireBlock)) | |
468 | - | then true | |
469 | - | else isRebalance) | |
470 | - | then (unleaseTx.fee == getCancelLeaseTxReserveFee(leaseId)) | |
471 | - | else false) | |
472 | - | then (getLeaseTxStatus(leaseId) == NEW) | |
395 | + | case leasingTx: LeaseCancelTransaction|LeaseTransaction => | |
396 | + | if (sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)) | |
397 | + | then (addressFromString(nodeOracleProvider) == addressFromPublicKey(tx.senderPublicKey)) | |
473 | 398 | else false | |
474 | 399 | case _ => | |
475 | 400 | sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
476 | 401 | } | |
477 | 402 | } | |
478 | 403 |
github/deemru/w8io/026f985 81.09 ms ◑