tx · CP3B6voJ9BFaP5Jh1n1vU3yEQotepaAo51KovJSysVj 3N3UHNYQ8xwe2WWLKgXX628JyUtF6kYK4wS: -0.01400000 Waves 2020.11.03 11:10 [1248857] smart account 3N3UHNYQ8xwe2WWLKgXX628JyUtF6kYK4wS > SELF 0.00000000 Waves
{ "type": 13, "id": "CP3B6voJ9BFaP5Jh1n1vU3yEQotepaAo51KovJSysVj", "fee": 1400000, "feeAssetId": null, "timestamp": 1604391035133, "version": 1, "sender": "3N3UHNYQ8xwe2WWLKgXX628JyUtF6kYK4wS", "senderPublicKey": "Hxyif8HnnHh34SZ7PZewDcNUgrZfHNJsQvLNCcPbCW27", "proofs": [ "5tZNBLcY8WDP36hN1iTTqNaz8kfXvLvHFbxfN7s6Xsdmdh6Hh1YYcUbb7uAu3CgvA3VaSkMCmhL8BerLEj3QGAw7" ], "script": "base64:AAIEAAAAAAAAADwIAhIKCggICAEIAQEICBIRCg8ICAEIAQgBAQEBAQEBAQESAwoBCBIDCgEIEgQKAggBEgQKAggIEgMKAQgAAABpAQAAABZjb252ZXJ0SnNvbkFycmF5VG9MaXN0AAAAAgAAAAlqc29uQXJyYXkAAAALc3BsaXRTeW1ib2wJAAS1AAAAAgUAAAAJanNvbkFycmF5BQAAAAtzcGxpdFN5bWJvbAEAAAAYZ2V0U3RyaW5nQnlBZGRyZXNzQW5kS2V5AAAAAgAAAAdhZGRyZXNzAAAAA2tleQkBAAAAC3ZhbHVlT3JFbHNlAAAAAgkABB0AAAACBQAAAAdhZGRyZXNzBQAAAANrZXkCAAAAAAEAAAAMZ2V0Qm9vbEJ5S2V5AAAAAQAAAANrZXkJAQAAAAt2YWx1ZU9yRWxzZQAAAAIJAAQbAAAAAgUAAAAEdGhpcwUAAAADa2V5BwAAAAADU0VQAgAAAAJfXwAAAAAMa2V5QXNzZXRDb2RlAAAAAAAAAAABAAAAAAprZXlBc3NldElkAAAAAAAAAAACAAAAAA5rZXlBc3NldFN0YXR1cwAAAAAAAAAAAwAAAA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AAAkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADCQEAAAARQGV4dHJOYXRpdmUoMTA2MikAAAABBQAAAA1jYWxsZXJBZGRyZXNzBQAAABlyZWdpc3RlcmVkQW1vdW50NFdpdGhkcmF3BQAAAA9uZXV0cmlub0Fzc2V0SWQFAAAAA25pbAAAAABZPDXA", "chainId": 84, "height": 1248857, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 7PcvzfQ9UnNNZNHjvmxiZshdndexZF2Vt1CERk4o8Vq8 Next: 9MqbrqgMMp8aMDgXAZuv5wYQrBUcLtSd7CJFELKmgLHw Diff:
Old | New | Differences | |
---|---|---|---|
9 | 9 | ||
10 | 10 | func getBoolByKey (key) = valueOrElse(getBoolean(this, key), false) | |
11 | 11 | ||
12 | + | ||
13 | + | let SEP = "__" | |
12 | 14 | ||
13 | 15 | let keyAssetCode = 1 | |
14 | 16 | ||
64 | 66 | ||
65 | 67 | let defoStakingPacemakerPubKey = "%s%s__commonConfig__defoStakingPacemakerPub" | |
66 | 68 | ||
69 | + | let minPoolInvestAmountKey = "%s%s__commonConfig__minPoolInvestAmount" | |
70 | + | ||
67 | 71 | let neutrinoAssetIdKey = "neutrino_asset_id" | |
68 | 72 | ||
69 | 73 | let nsbtAssetIdKey = "bond_asset_id" | |
74 | + | ||
75 | + | let neutrinoRpdKey = "rpd_contract" | |
70 | 76 | ||
71 | 77 | let defoAssetIdKey = "%s__defoAssetId" | |
72 | 78 | ||
102 | 108 | func getAssetAddressByAssetIdKey (assetId) = (("%s%s%s__defoAsset__" + assetId) + "__addressByAssetId") | |
103 | 109 | ||
104 | 110 | ||
105 | - | func getPoolMakerParticipationAmountKey (assetAddress,poolMakerAddress) = ( | |
111 | + | func getPoolMakerParticipationAmountKey (assetAddress,poolMakerAddress) = makeString(["%s%s%s%s__pool", assetAddress, poolMakerAddress, "amount"], SEP) | |
106 | 112 | ||
107 | 113 | ||
108 | - | func getPoolMakerParticipationMaxAmountKey (assetAddress,poolMakerAddress) = ( | |
114 | + | func getPoolMakerParticipationMaxAmountKey (assetAddress,poolMakerAddress) = makeString(["%s%s%s%s__pool", assetAddress, poolMakerAddress, "maxAmount"], SEP) | |
109 | 115 | ||
110 | 116 | ||
111 | - | func getPoolMakerLockedAmountKey (assetAddress,poolMakerAddress) = ( | |
117 | + | func getPoolMakerLockedAmountKey (assetAddress,poolMakerAddress) = makeString(["%s%s%s%s__pool", assetAddress, poolMakerAddress, "lockedAmount"], SEP) | |
112 | 118 | ||
113 | 119 | ||
114 | - | func getPoolMakerUnlockHeightKey (assetAddress,poolMakerAddress) = (((("%s%s%s%s__pool__" + assetAddress) + "__") + poolMakerAddress) + "__unlockHeight") | |
120 | + | func getPoolMakerUnlockHeightKey (assetAddress,poolMakerAddress) = makeString(["%s%s%s%s__pool", assetAddress, poolMakerAddress, "unlockHeight"], SEP) | |
121 | + | ||
122 | + | ||
123 | + | func getPoolMakerLiquidityRequestKey (assetAddress,poolMakerAddress,h) = makeString(["%s%s%s%d%s__pool", assetAddress, poolMakerAddress, toString(h), "liquidityRequest"], SEP) | |
124 | + | ||
125 | + | ||
126 | + | func getPoolTotalLockedAmountKey (assetAddress) = makeString(["%s%s%s__pool", assetAddress, "totalLockedAmount"], SEP) | |
115 | 127 | ||
116 | 128 | ||
117 | 129 | func getAssetConfigArray (assetAddress) = convertJsonArrayToList(valueOrErrorMessage(getStringByAddressAndKey(this, getAssetConfigKey(assetAddress)), (("No DEFO Asset " + assetAddress) + "config present")), "__") | |
118 | 130 | ||
119 | 131 | ||
132 | + | let multiplicator = 1000000 | |
133 | + | ||
120 | 134 | let neutrinoContract = addressFromStringValue(valueOrErrorMessage(getString(this, neutrinoContractAddressKey), "No neutrino contract specified.")) | |
121 | 135 | ||
122 | - | let neutrinoAssetId = fromBase58String(valueOrErrorMessage(getString(neutrinoContract, neutrinoAssetIdKey), "No USDN asset id found.")) | |
136 | + | let neutrinoAssetIdStr = valueOrErrorMessage(getString(neutrinoContract, neutrinoAssetIdKey), "No USDN asset id found.") | |
137 | + | ||
138 | + | let neutrinoAssetId = fromBase58String(neutrinoAssetIdStr) | |
123 | 139 | ||
124 | 140 | let nsbtAssetId = fromBase58String(valueOrErrorMessage(getString(neutrinoContract, nsbtAssetIdKey), "No NSBT asset id found")) | |
125 | 141 | ||
126 | 142 | let minimumPoolFunding = valueOrErrorMessage(getInteger(this, minimunPoolFundingAmountKey), "Minimum pool funding amount is not specified.") | |
127 | 143 | ||
128 | - | let assetStatus = $Tuple3("PROPOSED", "READY", "ISSUED") | |
144 | + | let minPoolInvestAmount = valueOrElse(getInteger(this, minPoolInvestAmountKey), (10 * multiplicator)) | |
145 | + | ||
146 | + | let ASSEtPROPOSED = "PROPOSED" | |
147 | + | ||
148 | + | let ASSEtREADY = "READY" | |
149 | + | ||
150 | + | let ASSEtISSUED = "ISSUED" | |
151 | + | ||
152 | + | let assetStatus = $Tuple3(ASSEtPROPOSED, ASSEtREADY, ASSEtISSUED) | |
129 | 153 | ||
130 | 154 | let predefinedAssetContracts = valueOrErrorMessage(getString(this, assetsAddressListKey), "No pool of predeployed asset contracts found.") | |
131 | 155 | ||
135 | 159 | ||
136 | 160 | let debtToken = fromBase58String(valueOrErrorMessage(getString(this, debtTokenIdKey), "No debt token found")) | |
137 | 161 | ||
138 | - | let multiplicator = 1000000 | |
139 | - | ||
140 | 162 | let debtTokenReissueAmount = valueOrElse(getInteger(this, debtTokenEtalonBalanceKey), 0) | |
141 | 163 | ||
164 | + | let neutrinoRpdContract = addressFromStringValue(getStringValue(neutrinoContract, neutrinoRpdKey)) | |
165 | + | ||
166 | + | func getNeutrinoRpdBalance (userAddress) = { | |
167 | + | let userNeutrinoRpdBalance = makeString(["rpd_balance", neutrinoAssetIdStr, userAddress], "_") | |
168 | + | valueOrElse(getInteger(neutrinoRpdContract, userNeutrinoRpdBalance), 0) | |
169 | + | } | |
170 | + | ||
171 | + | ||
142 | 172 | func getAssetAddressByCode (assetSymbol) = valueOrElse(getString(this, getAssetAddressByCodeKey(assetSymbol)), "") | |
173 | + | ||
174 | + | ||
175 | + | func getAssetAddressByCodeOrFail (assetSymbol) = valueOrErrorMessage(getString(this, getAssetAddressByCodeKey(assetSymbol)), (("Cannot find asset address by " + assetSymbol) + " code")) | |
143 | 176 | ||
144 | 177 | ||
145 | 178 | func getAssetCode (assetConfig) = assetConfig[keyAssetCode] | |
223 | 256 | func getAssetPrice (priceOracleAddress,assetCode) = valueOrErrorMessage(getInteger(priceOracleAddress, getAssetPriceKey(assetCode)), "No Asset price found") | |
224 | 257 | ||
225 | 258 | ||
259 | + | func getPoolTotalLockedAmount (assetAddress) = valueOrElse(getInteger(this, getPoolTotalLockedAmountKey(assetAddress)), 0) | |
260 | + | ||
261 | + | ||
226 | 262 | func composeAssetConfigurationString (assetCode,assetId,assetStatus,priceDecimals,backingAssetId,overCollateralPercent,minPool,priceOracleAddress,minBuyPayment,minSellPayment,buyLockInterval,sellLockInterval,buyFee,sellFee,poolRedemptionTimeout,weekendsPriceChangeCoefficient) = makeString(["%s%s%s%d%s%d%d%s%d%d%d%d%d%d%d", assetCode, assetId, assetStatus, toString(priceDecimals), backingAssetId, toString(overCollateralPercent), toString(minPool), priceOracleAddress, toString(minBuyPayment), toString(minSellPayment), toString(buyLockInterval), toString(sellLockInterval), toString(buyFee), toString(sellFee), toString(poolRedemptionTimeout), toString(weekendsPriceChangeCoefficient)], "__") | |
227 | 263 | ||
228 | 264 | ||
243 | 279 | let aRedemptionTimeoutBlocks = getRedemptionTimeoutBlocks(assetConfigurationList) | |
244 | 280 | let weekendsPriceChangeCoefficient = getWeekendsPriceChangeCoefficient(assetConfigurationList) | |
245 | 281 | composeAssetConfigurationString(aCode, aID, newStatus, aPriceDecimals, aBakingAssetId, aOverCollateralPercent, aMinRequiredPool, aPriceOracleAddress, aMinBuyPayment, aMinSellPayment, aBuyLockInterval, aSellLockInterval, aBuyFee, aSellFee, aRedemptionTimeoutBlocks, weekendsPriceChangeCoefficient) | |
282 | + | } | |
283 | + | ||
284 | + | ||
285 | + | func calcAllowedAmountToRedeem (assetCode,poolMakerAddress) = { | |
286 | + | let assetAddressStr = getAssetAddressByCodeOrFail(assetCode) | |
287 | + | let assetAddress = addressFromStringValue(assetAddressStr) | |
288 | + | let assetConfigurationList = getAssetConfigArray(assetAddressStr) | |
289 | + | let assetIdStr = getAssetID(assetConfigurationList) | |
290 | + | let assetId = fromBase58String(assetIdStr) | |
291 | + | let poolActualSize = valueOrElse(getInteger(this, getAssetCurrrentPoolAmountKey(assetAddressStr)), 0) | |
292 | + | let poolMaxSize = valueOrElse(getInteger(this, getAssetMaxPoolAmountKey(assetAddressStr)), 0) | |
293 | + | let poolTotalLockedAmountKey = getPoolTotalLockedAmountKey(assetAddressStr) | |
294 | + | let poolTotalLocked = valueOrElse(getInteger(this, poolTotalLockedAmountKey), 0) | |
295 | + | let assetUsdnStakedAmount = getNeutrinoRpdBalance(assetAddressStr) | |
296 | + | let assetUsdnBalanceAmount = assetBalance(assetAddress, neutrinoAssetId) | |
297 | + | let assetTotalUsdnAmount = ((assetUsdnStakedAmount + assetUsdnBalanceAmount) - poolTotalLocked) | |
298 | + | let ucollateral = (assetTotalUsdnAmount - poolActualSize) | |
299 | + | let defoAssetBalance = assetBalance(assetAddress, assetId) | |
300 | + | let assetEmissionDirty = valueOrErrorMessage(assetInfo(assetId), ("Cannot find asset by id " + assetIdStr)).quantity | |
301 | + | let assetEmission = (assetEmissionDirty - defoAssetBalance) | |
302 | + | let priceOracleAddress = addressFromStringValue(getAssetPriceOracleAddress(assetConfigurationList)) | |
303 | + | let currentPrice = getAssetPrice(priceOracleAddress, assetCode) | |
304 | + | let priceWithOvercollateralRate = (((multiplicator + getAssetOverCollateralPercent(assetConfigurationList)) * currentPrice) / multiplicator) | |
305 | + | let usdnNeededToCoverEmission = (priceWithOvercollateralRate * assetEmission) | |
306 | + | let poolMakerMaxAmount = getPoolMakerParticipationMaxAmount(assetAddressStr, poolMakerAddress) | |
307 | + | let poolMakerParticipationAmountKey = getPoolMakerParticipationAmountKey(assetAddressStr, poolMakerAddress) | |
308 | + | let poolMakerActualAmount = valueOrElse(getInteger(this, poolMakerParticipationAmountKey), 0) | |
309 | + | let poolMakerLockedAmount = getPoolMakerLockedAmount(assetAddressStr, poolMakerAddress) | |
310 | + | let surplus = (ucollateral - usdnNeededToCoverEmission) | |
311 | + | let percentViaActual = fraction(poolMakerActualAmount, multiplicator, poolActualSize) | |
312 | + | let percentViaMax = fraction(poolMakerMaxAmount, multiplicator, poolMaxSize) | |
313 | + | let frozenPart = if ((surplus >= 0)) | |
314 | + | then 0 | |
315 | + | else max([percentViaActual, percentViaMax]) | |
316 | + | let allowedAmountToRedeem = fraction((multiplicator - frozenPart), poolMakerActualAmount, multiplicator) | |
317 | + | let withdrawHeight = (height + getRedemptionTimeoutBlocks(assetConfigurationList)) | |
318 | + | $Tuple8(assetAddressStr, allowedAmountToRedeem, poolTotalLocked, poolActualSize, poolMakerActualAmount, withdrawHeight, poolMakerLockedAmount, makeString([assetAddressStr, assetIdStr, poolMakerAddress, toString(assetUsdnStakedAmount), toString(assetUsdnBalanceAmount), toString(assetTotalUsdnAmount), toString(poolActualSize), toString(poolMaxSize), toString(ucollateral), toString(assetEmission), toString(currentPrice), toString(priceWithOvercollateralRate), toString(poolMakerMaxAmount), toString(poolMakerActualAmount), toString(poolMakerLockedAmount), toString(surplus), toString(percentViaActual), toString(percentViaMax), toString(frozenPart), toString(allowedAmountToRedeem)], SEP)) | |
246 | 319 | } | |
247 | 320 | ||
248 | 321 | ||
297 | 370 | ||
298 | 371 | @Callable(i) | |
299 | 372 | func fundLiquidityPool (assetCode) = { | |
300 | - | let | |
301 | - | let assetConfigurationList = getAssetConfigArray( | |
373 | + | let assetAddressStr = getAssetAddressByCodeOrFail(assetCode) | |
374 | + | let assetConfigurationList = getAssetConfigArray(assetAddressStr) | |
302 | 375 | let attachedPayment = value(i.payments[0]) | |
303 | - | if ((toBase58String(i.callerPublicKey) != adminPublicKey)) | |
304 | - | then throw("Only Admin can perform contract operation.") | |
305 | - | else if ((getBoolByKey(isInitializedKey) == false)) | |
306 | - | then throw("Contract is not yet ready.") | |
307 | - | else if ((attachedPayment.assetId != neutrinoAssetId)) | |
308 | - | then throw("Liquidity pool could be funded with USDN only.") | |
309 | - | else if ((attachedPayment.amount == 0)) | |
310 | - | then throw("Incorrect attached payment amount.") | |
311 | - | else if ((assetAddress == "")) | |
312 | - | then throw((("Cannot find liquidity pool for asset " + assetCode) + ".")) | |
313 | - | else { | |
314 | - | let finalPoolAmount = (attachedPayment.amount + getAssetCurrentPoolAmount(assetAddress)) | |
315 | - | let maxPoolAmount = getAssetMaxPoolAmount(assetAddress) | |
316 | - | let poolMakerAddress = toString(i.caller) | |
317 | - | let currentPoolMakerBalance = getPoolMakerParticipationAmount(assetAddress, poolMakerAddress) | |
318 | - | let maxPoolMakerBalance = getPoolMakerParticipationMaxAmount(assetAddress, poolMakerAddress) | |
319 | - | let currentPoolStatus = getAssetStatus(assetConfigurationList) | |
320 | - | let finalPoolStatus = if (if ((finalPoolAmount >= getAssetMinRequiredPoolAmount(assetConfigurationList))) | |
321 | - | then (currentPoolStatus == assetStatus._1) | |
322 | - | else false) | |
323 | - | then assetStatus._2 | |
324 | - | else currentPoolStatus | |
325 | - | let currentPoolMakers = getAssetPoolMakers(assetAddress) | |
326 | - | let newPoolMakers = if ((currentPoolMakers == "")) | |
327 | - | then poolMakerAddress | |
328 | - | else if (contains(currentPoolMakers, poolMakerAddress)) | |
329 | - | then currentPoolMakers | |
330 | - | else ((currentPoolMakers + ",") + toString(i.caller)) | |
331 | - | let newPoolMakerBalance = (currentPoolMakerBalance + i.payments[0].amount) | |
332 | - | let result = [IntegerEntry(getPoolMakerParticipationAmountKey(assetAddress, toString(i.caller)), newPoolMakerBalance), IntegerEntry(getPoolMakerParticipationMaxAmountKey(assetAddress, toString(i.caller)), if ((newPoolMakerBalance > maxPoolMakerBalance)) | |
333 | - | then newPoolMakerBalance | |
334 | - | else maxPoolMakerBalance), IntegerEntry(getAssetCurrrentPoolAmountKey(assetAddress), finalPoolAmount), IntegerEntry(getAssetMaxPoolAmountKey(assetAddress), if ((finalPoolAmount > maxPoolAmount)) | |
335 | - | then finalPoolAmount | |
336 | - | else maxPoolAmount), StringEntry(getAssetPoolMakersKey(assetAddress), newPoolMakers), StringEntry(getAssetConfigKey(assetAddress), updateAssetCfgStatus(finalPoolStatus, assetConfigurationList))] | |
337 | - | if ((currentPoolStatus == assetStatus._3)) | |
338 | - | then (result :+ ScriptTransfer(addressFromStringValue(assetAddress), attachedPayment.amount, neutrinoAssetId)) | |
339 | - | else result | |
340 | - | } | |
376 | + | let poolMakerAddress = toString(i.caller) | |
377 | + | if ((getBoolByKey(isInitializedKey) == false)) | |
378 | + | then throw("Contract is not yet ready.") | |
379 | + | else if ((attachedPayment.assetId != neutrinoAssetId)) | |
380 | + | then throw("Liquidity pool could be funded with USDN only.") | |
381 | + | else if ((minPoolInvestAmount > attachedPayment.amount)) | |
382 | + | then throw(("Attached payment amount is less tha min allowed: " + toString(minPoolInvestAmount))) | |
383 | + | else { | |
384 | + | let newCurrentPoolAmount = (attachedPayment.amount + getAssetCurrentPoolAmount(assetAddressStr)) | |
385 | + | let maxPoolAmount = getAssetMaxPoolAmount(assetAddressStr) | |
386 | + | let currentPoolMakerBalance = getPoolMakerParticipationAmount(assetAddressStr, poolMakerAddress) | |
387 | + | let maxPoolMakerBalance = getPoolMakerParticipationMaxAmount(assetAddressStr, poolMakerAddress) | |
388 | + | let currentAssetStatus = getAssetStatus(assetConfigurationList) | |
389 | + | let newAssetStatus = if (if ((currentAssetStatus == ASSEtPROPOSED)) | |
390 | + | then (newCurrentPoolAmount >= getAssetMinRequiredPoolAmount(assetConfigurationList)) | |
391 | + | else false) | |
392 | + | then ASSEtREADY | |
393 | + | else currentAssetStatus | |
394 | + | let newPoolMakerBalance = (currentPoolMakerBalance + attachedPayment.amount) | |
395 | + | let immediateTransferIfIssued = if ((currentAssetStatus == ASSEtISSUED)) | |
396 | + | then [ScriptTransfer(addressFromStringValue(assetAddressStr), attachedPayment.amount, neutrinoAssetId)] | |
397 | + | else nil | |
398 | + | ([IntegerEntry(getPoolMakerParticipationAmountKey(assetAddressStr, poolMakerAddress), newPoolMakerBalance), IntegerEntry(getPoolMakerParticipationMaxAmountKey(assetAddressStr, poolMakerAddress), max([newPoolMakerBalance, maxPoolMakerBalance])), IntegerEntry(getAssetCurrrentPoolAmountKey(assetAddressStr), newCurrentPoolAmount), IntegerEntry(getAssetMaxPoolAmountKey(assetAddressStr), max([maxPoolAmount, newCurrentPoolAmount])), StringEntry(getAssetConfigKey(assetAddressStr), updateAssetCfgStatus(newAssetStatus, assetConfigurationList))] ++ immediateTransferIfIssued) | |
399 | + | } | |
341 | 400 | } | |
342 | 401 | ||
343 | 402 | ||
368 | 427 | ||
369 | 428 | @Callable(i) | |
370 | 429 | func redeemFromPool (assetCode,amount) = { | |
371 | - | let assetAddress = getAssetAddressByCode(assetCode) | |
372 | - | let assetConfigurationList = getAssetConfigArray(assetAddress) | |
373 | 430 | let callerAddress = toString(i.caller) | |
374 | - | let totalAmountInPoolByCaller = getPoolMakerParticipationAmount(assetAddress, callerAddress) | |
375 | - | let lockedAmountByPoolMaker = getPoolMakerLockedAmount(assetAddress, callerAddress) | |
376 | - | if ((toBase58String(i.callerPublicKey) != adminPublicKey)) | |
377 | - | then throw("Only Admin can perform contract operation.") | |
378 | - | else if ((getBoolByKey(isInitializedKey) == false)) | |
379 | - | then throw("Contract is not yet ready.") | |
380 | - | else if ((assetAddress == "")) | |
381 | - | then throw((("Cannot find asset " + assetCode) + ".")) | |
382 | - | else if (if (if ((0 > amount)) | |
383 | - | then true | |
384 | - | else (totalAmountInPoolByCaller == 0)) | |
385 | - | then true | |
386 | - | else (amount > totalAmountInPoolByCaller)) | |
387 | - | then throw((("Cannot find pool maker by address " + callerAddress) + " or amount passed is not correct.")) | |
388 | - | else if ((lockedAmountByPoolMaker > 0)) | |
389 | - | then throw("Pool maker already has initiated redemption that is not withdrawn yet.") | |
390 | - | else [IntegerEntry(getPoolMakerLockedAmountKey(assetAddress, callerAddress), amount), IntegerEntry(getPoolMakerUnlockHeightKey(assetAddress, callerAddress), (height + getRedemptionTimeoutBlocks(assetConfigurationList)))] | |
431 | + | let redeemTuple = calcAllowedAmountToRedeem(assetCode, callerAddress) | |
432 | + | let assetAddressStr = redeemTuple._1 | |
433 | + | let allowedAmountToRedeem = redeemTuple._2 | |
434 | + | let poolTotalLocked = redeemTuple._3 | |
435 | + | let poolActualSize = redeemTuple._4 | |
436 | + | let poolMakerActualAmount = redeemTuple._5 | |
437 | + | let withdrawHeight = redeemTuple._6 | |
438 | + | let poolMakerLockedAmount = redeemTuple._7 | |
439 | + | let traceData = redeemTuple._8 | |
440 | + | let poolMakerLiquidityRequestKey = getPoolMakerLiquidityRequestKey(assetAddressStr, callerAddress, withdrawHeight) | |
441 | + | if ((getBoolByKey(isInitializedKey) == false)) | |
442 | + | then throw("Contract is not yet ready.") | |
443 | + | else if (if (if ((0 > amount)) | |
444 | + | then true | |
445 | + | else (0 >= poolMakerActualAmount)) | |
446 | + | then true | |
447 | + | else (amount > allowedAmountToRedeem)) | |
448 | + | then throw((("Cannot find pool maker by address " + callerAddress) + " or amount passed is not correct.")) | |
449 | + | else if (((1 * multiplicator) > amount)) | |
450 | + | then throw("Redeem amount is less then min allowed") | |
451 | + | else if ((poolMakerLockedAmount > 0)) | |
452 | + | then throw("Pool maker already has initiated redemption that is not withdrawn yet.") | |
453 | + | else if (isDefined(getInteger(this, poolMakerLiquidityRequestKey))) | |
454 | + | then throw((("Pool maker has already initiated redemption for " + toString(height)) + " height")) | |
455 | + | else [IntegerEntry(getPoolTotalLockedAmountKey(assetAddressStr), (poolTotalLocked + amount)), IntegerEntry(getAssetCurrrentPoolAmountKey(assetAddressStr), (poolActualSize - amount)), IntegerEntry(getPoolMakerParticipationAmountKey(assetAddressStr, callerAddress), (poolMakerActualAmount - amount)), IntegerEntry(poolMakerLiquidityRequestKey, amount), IntegerEntry(getPoolMakerLockedAmountKey(assetAddressStr, callerAddress), amount), IntegerEntry(getPoolMakerUnlockHeightKey(assetAddressStr, callerAddress), withdrawHeight), StringEntry("%s%s_trace_redeemFromPool", traceData)] | |
391 | 456 | } | |
392 | 457 | ||
393 | 458 | ||
394 | 459 | ||
395 | 460 | @Callable(i) | |
396 | - | func getMaxAllowedAmountToRedeem (assetCode,poolMaker) = throw((((("{allowedAmountToRedeem: 1000, assetCode: " + assetCode) + ", poolMaker: ") + poolMaker) + "}")) | |
461 | + | func getMaxAllowedAmountToRedeem (assetCode,poolMakerAddress) = { | |
462 | + | let redeemTuple = calcAllowedAmountToRedeem(assetCode, poolMakerAddress) | |
463 | + | let assetAddressStr = redeemTuple._1 | |
464 | + | let allowedAmountToRedeem = redeemTuple._2 | |
465 | + | let poolTotalLocked = redeemTuple._3 | |
466 | + | let poolActualSize = redeemTuple._4 | |
467 | + | let poolMakerActualAmount = redeemTuple._5 | |
468 | + | let withdrawHeight = redeemTuple._6 | |
469 | + | let poolMakerLockedAmount = redeemTuple._7 | |
470 | + | throw(((((((("{" + "allowedAmountToRedeem: ") + toString(allowedAmountToRedeem)) + ", assetCode: ") + assetCode) + ", poolMaker: ") + poolMakerAddress) + "}")) | |
471 | + | } | |
397 | 472 | ||
398 | 473 | ||
399 | 474 | ||
400 | 475 | @Callable(i) | |
401 | 476 | func withdraw (assetCode) = { | |
402 | - | let assetConfigurationList = getAssetConfigArray(assetCode) | |
403 | - | let assetAddress = getAssetAddressByCode(assetCode) | |
404 | - | let priceOracleAddress = addressFromStringValue(getAssetPriceOracleAddress(assetConfigurationList)) | |
405 | 477 | let callerAddress = toString(i.caller) | |
406 | - | let syntheticAssetInfo = valueOrErrorMessage(assetInfo(fromBase58String(assetAddress)), ("Cannot find asset by id " + assetAddress)) | |
407 | - | let totalUSDNBalanceOnContract = assetBalance(this, neutrinoAssetId) | |
408 | - | let totalAmountInPoolByPoolMaker = getPoolMakerParticipationAmount(assetAddress, callerAddress) | |
409 | - | let lockedAmountByPoolMaker = getPoolMakerLockedAmount(assetAddress, callerAddress) | |
410 | - | let minWithdrawHeight = getPoolMakerUnlockHeight(assetAddress, callerAddress) | |
411 | - | let poolMaketProportion = (getAssetMaxPoolAmount(assetAddress) / getPoolMakerParticipationMaxAmount(assetAddress, callerAddress)) | |
412 | - | if ((toBase58String(i.callerPublicKey) != adminPublicKey)) | |
413 | - | then throw("Only Admin can perform contract operation.") | |
414 | - | else if ((getBoolByKey(isInitializedKey) == false)) | |
415 | - | then throw("Contract is not yet ready.") | |
416 | - | else if ((getBoolByKey(isInitializedKey) == false)) | |
417 | - | then throw("Contract is not yet ready.") | |
418 | - | else if ((assetAddress == "")) | |
419 | - | then throw((("Cannot find asset " + assetCode) + ".")) | |
420 | - | else if ((totalAmountInPoolByPoolMaker == 0)) | |
421 | - | then throw((("Cannot find pool maker by address " + callerAddress) + " or no locked amount.")) | |
422 | - | else if ((height > minWithdrawHeight)) | |
423 | - | then throw((("Please wait " + toString(minWithdrawHeight)) + " before withdraw.")) | |
424 | - | else { | |
425 | - | let assetEmission = syntheticAssetInfo.quantity | |
426 | - | let currentPrice = getAssetPrice(priceOracleAddress, assetCode) | |
427 | - | let poolMakerLockedAmount = getPoolMakerLockedAmount(assetAddress, callerAddress) | |
428 | - | let priceWithOvercollateralRate = (getAssetOverCollateralPercent(assetConfigurationList) * currentPrice) | |
429 | - | let usdnNeededToCoverEmission = (priceWithOvercollateralRate * assetEmission) | |
430 | - | if ((totalUSDNBalanceOnContract > usdnNeededToCoverEmission)) | |
431 | - | then { | |
432 | - | let amoutAvailableToExitFromPool = (totalUSDNBalanceOnContract - usdnNeededToCoverEmission) | |
433 | - | let amountForWithdraw = (poolMaketProportion * amoutAvailableToExitFromPool) | |
434 | - | let finalLockedAmount = (getPoolMakerLockedAmount(assetAddress, callerAddress) - amountForWithdraw) | |
435 | - | [IntegerEntry(getAssetCurrrentPoolAmountKey(assetAddress), (getAssetCurrentPoolAmount(assetAddress) - amountForWithdraw)), IntegerEntry(getPoolMakerParticipationAmountKey(assetAddress, callerAddress), (getPoolMakerParticipationAmount(assetAddress, callerAddress) - amountForWithdraw)), IntegerEntry(getPoolMakerLockedAmountKey(assetAddress, callerAddress), finalLockedAmount), ScriptTransfer(addressFromStringValue(callerAddress), amountForWithdraw, neutrinoAssetId)] | |
436 | - | } | |
437 | - | else nil | |
438 | - | } | |
478 | + | let assetAddressStr = getAssetAddressByCodeOrFail(assetCode) | |
479 | + | let assetAddress = addressFromStringValue(assetAddressStr) | |
480 | + | let poolMakerLockedAmountKey = getPoolMakerLockedAmountKey(assetAddressStr, callerAddress) | |
481 | + | let registeredAmount4Withdraw = valueOrElse(getInteger(this, poolMakerLockedAmountKey), 0) | |
482 | + | let poolMakerUnlockHeightKey = getPoolMakerUnlockHeightKey(assetAddressStr, callerAddress) | |
483 | + | let withdrawHeight = valueOrElse(getInteger(this, poolMakerUnlockHeightKey), 0) | |
484 | + | let poolTotalLockedAmountKey = getPoolTotalLockedAmountKey(assetAddressStr) | |
485 | + | let poolTotalLocked = valueOrElse(getInteger(this, poolTotalLockedAmountKey), 0) | |
486 | + | let poolMakerLiquidityRequestKey = getPoolMakerLiquidityRequestKey(assetAddressStr, callerAddress, withdrawHeight) | |
487 | + | if ((getBoolByKey(isInitializedKey) == false)) | |
488 | + | then throw("Contract is not yet ready.") | |
489 | + | else if (!(isDefined(getInteger(assetAddress, poolMakerLiquidityRequestKey)))) | |
490 | + | then throw("Need to transfer liquidity from asset account first") | |
491 | + | else if ((0 >= registeredAmount4Withdraw)) | |
492 | + | then throw((("Cannot find pool maker by address " + callerAddress) + " or no locked amount.")) | |
493 | + | else if ((height > withdrawHeight)) | |
494 | + | then throw((("Please wait " + toString(withdrawHeight)) + " before withdraw.")) | |
495 | + | else [IntegerEntry(poolMakerLockedAmountKey, 0), IntegerEntry(poolTotalLockedAmountKey, (poolTotalLocked - registeredAmount4Withdraw)), IntegerEntry(poolMakerUnlockHeightKey, 0), ScriptTransfer(addressFromStringValue(callerAddress), registeredAmount4Withdraw, neutrinoAssetId)] | |
439 | 496 | } | |
440 | 497 | ||
441 | 498 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 4 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | func convertJsonArrayToList (jsonArray,splitSymbol) = split(jsonArray, splitSymbol) | |
5 | 5 | ||
6 | 6 | ||
7 | 7 | func getStringByAddressAndKey (address,key) = valueOrElse(getString(address, key), "") | |
8 | 8 | ||
9 | 9 | ||
10 | 10 | func getBoolByKey (key) = valueOrElse(getBoolean(this, key), false) | |
11 | 11 | ||
12 | + | ||
13 | + | let SEP = "__" | |
12 | 14 | ||
13 | 15 | let keyAssetCode = 1 | |
14 | 16 | ||
15 | 17 | let keyAssetId = 2 | |
16 | 18 | ||
17 | 19 | let keyAssetStatus = 3 | |
18 | 20 | ||
19 | 21 | let keyAssetPriceDecimals = 4 | |
20 | 22 | ||
21 | 23 | let keyAssetBakingAsset = 5 | |
22 | 24 | ||
23 | 25 | let keyOvercollateralPercentage = 6 | |
24 | 26 | ||
25 | 27 | let keyMinPool = 7 | |
26 | 28 | ||
27 | 29 | let keyPriceOracleAddress = 8 | |
28 | 30 | ||
29 | 31 | let keyMinBuyPayment = 9 | |
30 | 32 | ||
31 | 33 | let keyMinSellPayment = 10 | |
32 | 34 | ||
33 | 35 | let keyBuyLockInterval = 11 | |
34 | 36 | ||
35 | 37 | let keySellLockInterval = 12 | |
36 | 38 | ||
37 | 39 | let keyBuyFee = 13 | |
38 | 40 | ||
39 | 41 | let keySellFee = 14 | |
40 | 42 | ||
41 | 43 | let keyPoolRedemptionTimeout = 15 | |
42 | 44 | ||
43 | 45 | let keyWeekendsPriceChangeCoefficient = 16 | |
44 | 46 | ||
45 | 47 | let adminPublicKey = "G1Ebu5AMHaTJFEbZNkZQcJFUQ9KfiYUwupyLG857DcFr" | |
46 | 48 | ||
47 | 49 | let neutrinoContractAddressKey = "%s%s__commonConfig__neutrinoContractAddress" | |
48 | 50 | ||
49 | 51 | let neutrinoStakingAddressKey = "%s%s__commonConfig__neutrinoStakingAddress" | |
50 | 52 | ||
51 | 53 | let minimunPoolFundingAmountKey = "%s%s__commonConfig__minimumPoolFundingAmount" | |
52 | 54 | ||
53 | 55 | let isInitializedKey = "%s%s__commonConfig__initialized" | |
54 | 56 | ||
55 | 57 | let currentAssetIndexKey = "%s%s__commonConfig__predefinedAssetsActiveIndex" | |
56 | 58 | ||
57 | 59 | let assetsAddressListKey = "%s%s__commonConfig__predefinedAssetsList" | |
58 | 60 | ||
59 | 61 | let debtTokenIdKey = "%s%s__commonConfig__debtAssetId" | |
60 | 62 | ||
61 | 63 | let debtTokenEtalonBalanceKey = "%s%s__commonConfig__debtAssetEtalonBalance" | |
62 | 64 | ||
63 | 65 | let defoStakingAddressKey = "%s%s__commonConfig__defoStakingAddress" | |
64 | 66 | ||
65 | 67 | let defoStakingPacemakerPubKey = "%s%s__commonConfig__defoStakingPacemakerPub" | |
66 | 68 | ||
69 | + | let minPoolInvestAmountKey = "%s%s__commonConfig__minPoolInvestAmount" | |
70 | + | ||
67 | 71 | let neutrinoAssetIdKey = "neutrino_asset_id" | |
68 | 72 | ||
69 | 73 | let nsbtAssetIdKey = "bond_asset_id" | |
74 | + | ||
75 | + | let neutrinoRpdKey = "rpd_contract" | |
70 | 76 | ||
71 | 77 | let defoAssetIdKey = "%s__defoAssetId" | |
72 | 78 | ||
73 | 79 | let setAssetScriptTxIdKey = "%s__assetScriptTxId" | |
74 | 80 | ||
75 | 81 | func getAssetConfigKey (assetAddress) = (("%s%s%s__defoAsset__" + assetAddress) + "__config") | |
76 | 82 | ||
77 | 83 | ||
78 | 84 | func getAssetPriceKey (assetCode) = ("%s%s__assetPrice__" + assetCode) | |
79 | 85 | ||
80 | 86 | ||
81 | 87 | func getAssetInitHeightKey (assetAddress) = (("%s%s%s__defoAsset__" + assetAddress) + "__initHeight") | |
82 | 88 | ||
83 | 89 | ||
84 | 90 | func getAssetActivateHeightKey (assetAddress) = (("%s%s%s__defoAsset__" + assetAddress) + "__activateHeight") | |
85 | 91 | ||
86 | 92 | ||
87 | 93 | func getAssetCurrrentPoolAmountKey (assetAddress) = (("%s%s%s__defoAsset__" + assetAddress) + "__currentPool") | |
88 | 94 | ||
89 | 95 | ||
90 | 96 | func getAssetMaxPoolAmountKey (assetAddress) = (("%s%s%s__defoAsset__" + assetAddress) + "__maxPool") | |
91 | 97 | ||
92 | 98 | ||
93 | 99 | func getAssetMetaKey (assetAddress) = (("%s%s%s__defoAsset__" + assetAddress) + "__meta") | |
94 | 100 | ||
95 | 101 | ||
96 | 102 | func getAssetPoolMakersKey (assetAddress) = (("%s%s%s__defoAsset__" + assetAddress) + "__poolMakers") | |
97 | 103 | ||
98 | 104 | ||
99 | 105 | func getAssetAddressByCodeKey (assetCode) = (("%s%s%s__defoAsset__" + assetCode) + "__addressByAssetCode") | |
100 | 106 | ||
101 | 107 | ||
102 | 108 | func getAssetAddressByAssetIdKey (assetId) = (("%s%s%s__defoAsset__" + assetId) + "__addressByAssetId") | |
103 | 109 | ||
104 | 110 | ||
105 | - | func getPoolMakerParticipationAmountKey (assetAddress,poolMakerAddress) = ( | |
111 | + | func getPoolMakerParticipationAmountKey (assetAddress,poolMakerAddress) = makeString(["%s%s%s%s__pool", assetAddress, poolMakerAddress, "amount"], SEP) | |
106 | 112 | ||
107 | 113 | ||
108 | - | func getPoolMakerParticipationMaxAmountKey (assetAddress,poolMakerAddress) = ( | |
114 | + | func getPoolMakerParticipationMaxAmountKey (assetAddress,poolMakerAddress) = makeString(["%s%s%s%s__pool", assetAddress, poolMakerAddress, "maxAmount"], SEP) | |
109 | 115 | ||
110 | 116 | ||
111 | - | func getPoolMakerLockedAmountKey (assetAddress,poolMakerAddress) = ( | |
117 | + | func getPoolMakerLockedAmountKey (assetAddress,poolMakerAddress) = makeString(["%s%s%s%s__pool", assetAddress, poolMakerAddress, "lockedAmount"], SEP) | |
112 | 118 | ||
113 | 119 | ||
114 | - | func getPoolMakerUnlockHeightKey (assetAddress,poolMakerAddress) = (((("%s%s%s%s__pool__" + assetAddress) + "__") + poolMakerAddress) + "__unlockHeight") | |
120 | + | func getPoolMakerUnlockHeightKey (assetAddress,poolMakerAddress) = makeString(["%s%s%s%s__pool", assetAddress, poolMakerAddress, "unlockHeight"], SEP) | |
121 | + | ||
122 | + | ||
123 | + | func getPoolMakerLiquidityRequestKey (assetAddress,poolMakerAddress,h) = makeString(["%s%s%s%d%s__pool", assetAddress, poolMakerAddress, toString(h), "liquidityRequest"], SEP) | |
124 | + | ||
125 | + | ||
126 | + | func getPoolTotalLockedAmountKey (assetAddress) = makeString(["%s%s%s__pool", assetAddress, "totalLockedAmount"], SEP) | |
115 | 127 | ||
116 | 128 | ||
117 | 129 | func getAssetConfigArray (assetAddress) = convertJsonArrayToList(valueOrErrorMessage(getStringByAddressAndKey(this, getAssetConfigKey(assetAddress)), (("No DEFO Asset " + assetAddress) + "config present")), "__") | |
118 | 130 | ||
119 | 131 | ||
132 | + | let multiplicator = 1000000 | |
133 | + | ||
120 | 134 | let neutrinoContract = addressFromStringValue(valueOrErrorMessage(getString(this, neutrinoContractAddressKey), "No neutrino contract specified.")) | |
121 | 135 | ||
122 | - | let neutrinoAssetId = fromBase58String(valueOrErrorMessage(getString(neutrinoContract, neutrinoAssetIdKey), "No USDN asset id found.")) | |
136 | + | let neutrinoAssetIdStr = valueOrErrorMessage(getString(neutrinoContract, neutrinoAssetIdKey), "No USDN asset id found.") | |
137 | + | ||
138 | + | let neutrinoAssetId = fromBase58String(neutrinoAssetIdStr) | |
123 | 139 | ||
124 | 140 | let nsbtAssetId = fromBase58String(valueOrErrorMessage(getString(neutrinoContract, nsbtAssetIdKey), "No NSBT asset id found")) | |
125 | 141 | ||
126 | 142 | let minimumPoolFunding = valueOrErrorMessage(getInteger(this, minimunPoolFundingAmountKey), "Minimum pool funding amount is not specified.") | |
127 | 143 | ||
128 | - | let assetStatus = $Tuple3("PROPOSED", "READY", "ISSUED") | |
144 | + | let minPoolInvestAmount = valueOrElse(getInteger(this, minPoolInvestAmountKey), (10 * multiplicator)) | |
145 | + | ||
146 | + | let ASSEtPROPOSED = "PROPOSED" | |
147 | + | ||
148 | + | let ASSEtREADY = "READY" | |
149 | + | ||
150 | + | let ASSEtISSUED = "ISSUED" | |
151 | + | ||
152 | + | let assetStatus = $Tuple3(ASSEtPROPOSED, ASSEtREADY, ASSEtISSUED) | |
129 | 153 | ||
130 | 154 | let predefinedAssetContracts = valueOrErrorMessage(getString(this, assetsAddressListKey), "No pool of predeployed asset contracts found.") | |
131 | 155 | ||
132 | 156 | let predefinedAssetsList = convertJsonArrayToList(predefinedAssetContracts, ",") | |
133 | 157 | ||
134 | 158 | let currentAssetIndex = valueOrElse(getInteger(this, currentAssetIndexKey), 0) | |
135 | 159 | ||
136 | 160 | let debtToken = fromBase58String(valueOrErrorMessage(getString(this, debtTokenIdKey), "No debt token found")) | |
137 | 161 | ||
138 | - | let multiplicator = 1000000 | |
139 | - | ||
140 | 162 | let debtTokenReissueAmount = valueOrElse(getInteger(this, debtTokenEtalonBalanceKey), 0) | |
141 | 163 | ||
164 | + | let neutrinoRpdContract = addressFromStringValue(getStringValue(neutrinoContract, neutrinoRpdKey)) | |
165 | + | ||
166 | + | func getNeutrinoRpdBalance (userAddress) = { | |
167 | + | let userNeutrinoRpdBalance = makeString(["rpd_balance", neutrinoAssetIdStr, userAddress], "_") | |
168 | + | valueOrElse(getInteger(neutrinoRpdContract, userNeutrinoRpdBalance), 0) | |
169 | + | } | |
170 | + | ||
171 | + | ||
142 | 172 | func getAssetAddressByCode (assetSymbol) = valueOrElse(getString(this, getAssetAddressByCodeKey(assetSymbol)), "") | |
173 | + | ||
174 | + | ||
175 | + | func getAssetAddressByCodeOrFail (assetSymbol) = valueOrErrorMessage(getString(this, getAssetAddressByCodeKey(assetSymbol)), (("Cannot find asset address by " + assetSymbol) + " code")) | |
143 | 176 | ||
144 | 177 | ||
145 | 178 | func getAssetCode (assetConfig) = assetConfig[keyAssetCode] | |
146 | 179 | ||
147 | 180 | ||
148 | 181 | func getAssetID (assetConfig) = assetConfig[keyAssetId] | |
149 | 182 | ||
150 | 183 | ||
151 | 184 | func getAssetStatus (assetConfig) = assetConfig[keyAssetStatus] | |
152 | 185 | ||
153 | 186 | ||
154 | 187 | func getAssetPriceDecimals (assetConfig) = parseIntValue(assetConfig[keyAssetPriceDecimals]) | |
155 | 188 | ||
156 | 189 | ||
157 | 190 | func getAssetBakingAssetId (assetConfig) = assetConfig[keyAssetBakingAsset] | |
158 | 191 | ||
159 | 192 | ||
160 | 193 | func getAssetOverCollateralPercent (assetConfig) = parseIntValue(assetConfig[keyOvercollateralPercentage]) | |
161 | 194 | ||
162 | 195 | ||
163 | 196 | func getAssetMinRequiredPoolAmount (assetConfig) = parseIntValue(assetConfig[keyMinPool]) | |
164 | 197 | ||
165 | 198 | ||
166 | 199 | func getAssetPriceOracleAddress (assetConfig) = assetConfig[keyPriceOracleAddress] | |
167 | 200 | ||
168 | 201 | ||
169 | 202 | func getMinBuyPaymentPerAsset (assetConfig) = parseIntValue(assetConfig[keyMinBuyPayment]) | |
170 | 203 | ||
171 | 204 | ||
172 | 205 | func getMinSellPaymentPerAsset (assetConfig) = parseIntValue(assetConfig[keyMinSellPayment]) | |
173 | 206 | ||
174 | 207 | ||
175 | 208 | func getBuyLockIntervalPerAsset (assetConfig) = parseIntValue(assetConfig[keyBuyLockInterval]) | |
176 | 209 | ||
177 | 210 | ||
178 | 211 | func getSellLockIntervalPerAsset (assetConfig) = parseIntValue(assetConfig[keySellLockInterval]) | |
179 | 212 | ||
180 | 213 | ||
181 | 214 | func getBuyFeePerAsset (assetConfig) = parseIntValue(assetConfig[keyBuyFee]) | |
182 | 215 | ||
183 | 216 | ||
184 | 217 | func getSellFeePerAsset (assetConfig) = parseIntValue(assetConfig[keySellFee]) | |
185 | 218 | ||
186 | 219 | ||
187 | 220 | func getRedemptionTimeoutBlocks (assetConfig) = parseIntValue(assetConfig[keyPoolRedemptionTimeout]) | |
188 | 221 | ||
189 | 222 | ||
190 | 223 | func getWeekendsPriceChangeCoefficient (assetConfig) = parseIntValue(assetConfig[keyWeekendsPriceChangeCoefficient]) | |
191 | 224 | ||
192 | 225 | ||
193 | 226 | func getAssetPoolMakers (assetAddress) = valueOrElse(getString(this, getAssetPoolMakersKey(assetAddress)), "") | |
194 | 227 | ||
195 | 228 | ||
196 | 229 | func getAssetInitHeight (assetAddress) = valueOrElse(getInteger(this, getAssetInitHeightKey(assetAddress)), 0) | |
197 | 230 | ||
198 | 231 | ||
199 | 232 | func getAssetActivateHeight (assetAddress) = valueOrElse(getInteger(this, getAssetActivateHeightKey(assetAddress)), 0) | |
200 | 233 | ||
201 | 234 | ||
202 | 235 | func getAssetCurrentPoolAmount (assetAddress) = valueOrElse(getInteger(this, getAssetCurrrentPoolAmountKey(assetAddress)), 0) | |
203 | 236 | ||
204 | 237 | ||
205 | 238 | func getAssetMaxPoolAmount (assetAddress) = valueOrElse(getInteger(this, getAssetMaxPoolAmountKey(assetAddress)), 0) | |
206 | 239 | ||
207 | 240 | ||
208 | 241 | func getAssetMeta (assetAddress) = valueOrElse(getString(this, getAssetMetaKey(assetAddress)), "") | |
209 | 242 | ||
210 | 243 | ||
211 | 244 | func getPoolMakerParticipationAmount (assetAddress,poolMakerAddress) = valueOrElse(getInteger(this, getPoolMakerParticipationAmountKey(assetAddress, poolMakerAddress)), 0) | |
212 | 245 | ||
213 | 246 | ||
214 | 247 | func getPoolMakerParticipationMaxAmount (assetAddress,poolMakerAddress) = valueOrElse(getInteger(this, getPoolMakerParticipationMaxAmountKey(assetAddress, poolMakerAddress)), 0) | |
215 | 248 | ||
216 | 249 | ||
217 | 250 | func getPoolMakerLockedAmount (assetAddress,poolMakerAddress) = valueOrElse(getInteger(this, getPoolMakerLockedAmountKey(assetAddress, poolMakerAddress)), 0) | |
218 | 251 | ||
219 | 252 | ||
220 | 253 | func getPoolMakerUnlockHeight (assetAddress,poolMakerAddress) = valueOrElse(getInteger(this, getPoolMakerUnlockHeightKey(assetAddress, poolMakerAddress)), 0) | |
221 | 254 | ||
222 | 255 | ||
223 | 256 | func getAssetPrice (priceOracleAddress,assetCode) = valueOrErrorMessage(getInteger(priceOracleAddress, getAssetPriceKey(assetCode)), "No Asset price found") | |
224 | 257 | ||
225 | 258 | ||
259 | + | func getPoolTotalLockedAmount (assetAddress) = valueOrElse(getInteger(this, getPoolTotalLockedAmountKey(assetAddress)), 0) | |
260 | + | ||
261 | + | ||
226 | 262 | func composeAssetConfigurationString (assetCode,assetId,assetStatus,priceDecimals,backingAssetId,overCollateralPercent,minPool,priceOracleAddress,minBuyPayment,minSellPayment,buyLockInterval,sellLockInterval,buyFee,sellFee,poolRedemptionTimeout,weekendsPriceChangeCoefficient) = makeString(["%s%s%s%d%s%d%d%s%d%d%d%d%d%d%d", assetCode, assetId, assetStatus, toString(priceDecimals), backingAssetId, toString(overCollateralPercent), toString(minPool), priceOracleAddress, toString(minBuyPayment), toString(minSellPayment), toString(buyLockInterval), toString(sellLockInterval), toString(buyFee), toString(sellFee), toString(poolRedemptionTimeout), toString(weekendsPriceChangeCoefficient)], "__") | |
227 | 263 | ||
228 | 264 | ||
229 | 265 | func updateAssetCfgStatus (newStatus,assetConfigurationList) = { | |
230 | 266 | let aCode = getAssetCode(assetConfigurationList) | |
231 | 267 | let aID = getAssetID(assetConfigurationList) | |
232 | 268 | let aPriceDecimals = getAssetPriceDecimals(assetConfigurationList) | |
233 | 269 | let aBakingAssetId = getAssetBakingAssetId(assetConfigurationList) | |
234 | 270 | let aOverCollateralPercent = getAssetOverCollateralPercent(assetConfigurationList) | |
235 | 271 | let aMinRequiredPool = getAssetMinRequiredPoolAmount(assetConfigurationList) | |
236 | 272 | let aPriceOracleAddress = getAssetPriceOracleAddress(assetConfigurationList) | |
237 | 273 | let aMinBuyPayment = getMinBuyPaymentPerAsset(assetConfigurationList) | |
238 | 274 | let aMinSellPayment = getMinSellPaymentPerAsset(assetConfigurationList) | |
239 | 275 | let aBuyLockInterval = getBuyLockIntervalPerAsset(assetConfigurationList) | |
240 | 276 | let aSellLockInterval = getSellLockIntervalPerAsset(assetConfigurationList) | |
241 | 277 | let aBuyFee = getBuyFeePerAsset(assetConfigurationList) | |
242 | 278 | let aSellFee = getSellFeePerAsset(assetConfigurationList) | |
243 | 279 | let aRedemptionTimeoutBlocks = getRedemptionTimeoutBlocks(assetConfigurationList) | |
244 | 280 | let weekendsPriceChangeCoefficient = getWeekendsPriceChangeCoefficient(assetConfigurationList) | |
245 | 281 | composeAssetConfigurationString(aCode, aID, newStatus, aPriceDecimals, aBakingAssetId, aOverCollateralPercent, aMinRequiredPool, aPriceOracleAddress, aMinBuyPayment, aMinSellPayment, aBuyLockInterval, aSellLockInterval, aBuyFee, aSellFee, aRedemptionTimeoutBlocks, weekendsPriceChangeCoefficient) | |
282 | + | } | |
283 | + | ||
284 | + | ||
285 | + | func calcAllowedAmountToRedeem (assetCode,poolMakerAddress) = { | |
286 | + | let assetAddressStr = getAssetAddressByCodeOrFail(assetCode) | |
287 | + | let assetAddress = addressFromStringValue(assetAddressStr) | |
288 | + | let assetConfigurationList = getAssetConfigArray(assetAddressStr) | |
289 | + | let assetIdStr = getAssetID(assetConfigurationList) | |
290 | + | let assetId = fromBase58String(assetIdStr) | |
291 | + | let poolActualSize = valueOrElse(getInteger(this, getAssetCurrrentPoolAmountKey(assetAddressStr)), 0) | |
292 | + | let poolMaxSize = valueOrElse(getInteger(this, getAssetMaxPoolAmountKey(assetAddressStr)), 0) | |
293 | + | let poolTotalLockedAmountKey = getPoolTotalLockedAmountKey(assetAddressStr) | |
294 | + | let poolTotalLocked = valueOrElse(getInteger(this, poolTotalLockedAmountKey), 0) | |
295 | + | let assetUsdnStakedAmount = getNeutrinoRpdBalance(assetAddressStr) | |
296 | + | let assetUsdnBalanceAmount = assetBalance(assetAddress, neutrinoAssetId) | |
297 | + | let assetTotalUsdnAmount = ((assetUsdnStakedAmount + assetUsdnBalanceAmount) - poolTotalLocked) | |
298 | + | let ucollateral = (assetTotalUsdnAmount - poolActualSize) | |
299 | + | let defoAssetBalance = assetBalance(assetAddress, assetId) | |
300 | + | let assetEmissionDirty = valueOrErrorMessage(assetInfo(assetId), ("Cannot find asset by id " + assetIdStr)).quantity | |
301 | + | let assetEmission = (assetEmissionDirty - defoAssetBalance) | |
302 | + | let priceOracleAddress = addressFromStringValue(getAssetPriceOracleAddress(assetConfigurationList)) | |
303 | + | let currentPrice = getAssetPrice(priceOracleAddress, assetCode) | |
304 | + | let priceWithOvercollateralRate = (((multiplicator + getAssetOverCollateralPercent(assetConfigurationList)) * currentPrice) / multiplicator) | |
305 | + | let usdnNeededToCoverEmission = (priceWithOvercollateralRate * assetEmission) | |
306 | + | let poolMakerMaxAmount = getPoolMakerParticipationMaxAmount(assetAddressStr, poolMakerAddress) | |
307 | + | let poolMakerParticipationAmountKey = getPoolMakerParticipationAmountKey(assetAddressStr, poolMakerAddress) | |
308 | + | let poolMakerActualAmount = valueOrElse(getInteger(this, poolMakerParticipationAmountKey), 0) | |
309 | + | let poolMakerLockedAmount = getPoolMakerLockedAmount(assetAddressStr, poolMakerAddress) | |
310 | + | let surplus = (ucollateral - usdnNeededToCoverEmission) | |
311 | + | let percentViaActual = fraction(poolMakerActualAmount, multiplicator, poolActualSize) | |
312 | + | let percentViaMax = fraction(poolMakerMaxAmount, multiplicator, poolMaxSize) | |
313 | + | let frozenPart = if ((surplus >= 0)) | |
314 | + | then 0 | |
315 | + | else max([percentViaActual, percentViaMax]) | |
316 | + | let allowedAmountToRedeem = fraction((multiplicator - frozenPart), poolMakerActualAmount, multiplicator) | |
317 | + | let withdrawHeight = (height + getRedemptionTimeoutBlocks(assetConfigurationList)) | |
318 | + | $Tuple8(assetAddressStr, allowedAmountToRedeem, poolTotalLocked, poolActualSize, poolMakerActualAmount, withdrawHeight, poolMakerLockedAmount, makeString([assetAddressStr, assetIdStr, poolMakerAddress, toString(assetUsdnStakedAmount), toString(assetUsdnBalanceAmount), toString(assetTotalUsdnAmount), toString(poolActualSize), toString(poolMaxSize), toString(ucollateral), toString(assetEmission), toString(currentPrice), toString(priceWithOvercollateralRate), toString(poolMakerMaxAmount), toString(poolMakerActualAmount), toString(poolMakerLockedAmount), toString(surplus), toString(percentViaActual), toString(percentViaMax), toString(frozenPart), toString(allowedAmountToRedeem)], SEP)) | |
246 | 319 | } | |
247 | 320 | ||
248 | 321 | ||
249 | 322 | @Callable(i) | |
250 | 323 | func init (neutrinoContractAddress,neutrinoStakingAddress,minimunPoolFundingAmount,predefinedAssetList,currentAssetIndex,debtEthalonBalance,defoStakingAddress,defoStakingPacemakerPub) = if ((toBase58String(i.callerPublicKey) != adminPublicKey)) | |
251 | 324 | then throw("Only Admin can perform contract operation.") | |
252 | 325 | else if ((getBoolByKey(isInitializedKey) == true)) | |
253 | 326 | then throw("Contract was already initialized.") | |
254 | 327 | else { | |
255 | 328 | let issueDebt = Issue("DEFO_DEBT", "DEFO Debt Token.", 1, 6, true) | |
256 | 329 | let debtTokenId = calculateAssetId(issueDebt) | |
257 | 330 | [StringEntry(neutrinoContractAddressKey, neutrinoContractAddress), StringEntry(neutrinoStakingAddressKey, neutrinoStakingAddress), IntegerEntry(minimunPoolFundingAmountKey, minimunPoolFundingAmount), StringEntry(assetsAddressListKey, predefinedAssetList), IntegerEntry(currentAssetIndexKey, currentAssetIndex), IntegerEntry(debtTokenEtalonBalanceKey, debtEthalonBalance), StringEntry(debtTokenIdKey, toBase58String(debtTokenId)), StringEntry(defoStakingAddressKey, defoStakingAddress), StringEntry(defoStakingPacemakerPubKey, defoStakingPacemakerPub), BooleanEntry(isInitializedKey, true), issueDebt, Burn(debtTokenId, 1)] | |
258 | 331 | } | |
259 | 332 | ||
260 | 333 | ||
261 | 334 | ||
262 | 335 | @Callable(i) | |
263 | 336 | func proposeAsset (assetCode,meta,minPool,priceOracleAddress,overCollateralPercent,backingAssetId,priceDecimals,minBuyPayment,minSellPayment,buyLockInterval,sellLockInterval,buyFee,sellFee,poolRedemptionTimeout,weekendsPriceChangeCoefficient) = if ((toBase58String(i.callerPublicKey) != adminPublicKey)) | |
264 | 337 | then throw("Only Admin can perform contract operation.") | |
265 | 338 | else if ((getBoolByKey(isInitializedKey) == false)) | |
266 | 339 | then throw("Contract is not yet ready.") | |
267 | 340 | else if ((fromBase58String(backingAssetId) != neutrinoAssetId)) | |
268 | 341 | then throw("Baking asset id could be USDN only.") | |
269 | 342 | else if ((getAssetAddressByCode(assetCode) != "")) | |
270 | 343 | then throw((("Asset with passed code " + assetCode) + " has already been proposed.")) | |
271 | 344 | else if ((minimumPoolFunding > minPool)) | |
272 | 345 | then throw(("Minimum pool amount should be greater or equals to " + toString(minimumPoolFunding))) | |
273 | 346 | else if (if (if (if (if (if (if (if ((0 > overCollateralPercent)) | |
274 | 347 | then true | |
275 | 348 | else (0 > priceDecimals)) | |
276 | 349 | then true | |
277 | 350 | else (0 > minBuyPayment)) | |
278 | 351 | then true | |
279 | 352 | else (0 > minSellPayment)) | |
280 | 353 | then true | |
281 | 354 | else (0 > buyLockInterval)) | |
282 | 355 | then true | |
283 | 356 | else (0 > sellLockInterval)) | |
284 | 357 | then true | |
285 | 358 | else (0 > buyFee)) | |
286 | 359 | then true | |
287 | 360 | else (0 > sellFee)) | |
288 | 361 | then throw("One of the passed parameters is invalid.") | |
289 | 362 | else { | |
290 | 363 | let priceOracleAddressValid = valueOrErrorMessage(addressFromStringValue(priceOracleAddress), "Passed Price Oracle Address is not valid.") | |
291 | 364 | let assetAddress = predefinedAssetsList[currentAssetIndex] | |
292 | 365 | let defoAssetId = valueOrErrorMessage(getString(valueOrErrorMessage(addressFromString(assetAddress), ""), defoAssetIdKey), "No defo asset ID found.") | |
293 | 366 | [StringEntry(getAssetConfigKey(assetAddress), composeAssetConfigurationString(assetCode, defoAssetId, assetStatus._1, priceDecimals, backingAssetId, overCollateralPercent, minPool, priceOracleAddress, minBuyPayment, minSellPayment, buyLockInterval, sellLockInterval, buyFee, sellFee, poolRedemptionTimeout, weekendsPriceChangeCoefficient)), StringEntry(getAssetAddressByCodeKey(assetCode), assetAddress), StringEntry(getAssetMetaKey(assetAddress), meta), IntegerEntry(getAssetInitHeightKey(assetAddress), height), IntegerEntry(currentAssetIndexKey, (currentAssetIndex + 1)), StringEntry(getAssetAddressByAssetIdKey(defoAssetId), assetAddress)] | |
294 | 367 | } | |
295 | 368 | ||
296 | 369 | ||
297 | 370 | ||
298 | 371 | @Callable(i) | |
299 | 372 | func fundLiquidityPool (assetCode) = { | |
300 | - | let | |
301 | - | let assetConfigurationList = getAssetConfigArray( | |
373 | + | let assetAddressStr = getAssetAddressByCodeOrFail(assetCode) | |
374 | + | let assetConfigurationList = getAssetConfigArray(assetAddressStr) | |
302 | 375 | let attachedPayment = value(i.payments[0]) | |
303 | - | if ((toBase58String(i.callerPublicKey) != adminPublicKey)) | |
304 | - | then throw("Only Admin can perform contract operation.") | |
305 | - | else if ((getBoolByKey(isInitializedKey) == false)) | |
306 | - | then throw("Contract is not yet ready.") | |
307 | - | else if ((attachedPayment.assetId != neutrinoAssetId)) | |
308 | - | then throw("Liquidity pool could be funded with USDN only.") | |
309 | - | else if ((attachedPayment.amount == 0)) | |
310 | - | then throw("Incorrect attached payment amount.") | |
311 | - | else if ((assetAddress == "")) | |
312 | - | then throw((("Cannot find liquidity pool for asset " + assetCode) + ".")) | |
313 | - | else { | |
314 | - | let finalPoolAmount = (attachedPayment.amount + getAssetCurrentPoolAmount(assetAddress)) | |
315 | - | let maxPoolAmount = getAssetMaxPoolAmount(assetAddress) | |
316 | - | let poolMakerAddress = toString(i.caller) | |
317 | - | let currentPoolMakerBalance = getPoolMakerParticipationAmount(assetAddress, poolMakerAddress) | |
318 | - | let maxPoolMakerBalance = getPoolMakerParticipationMaxAmount(assetAddress, poolMakerAddress) | |
319 | - | let currentPoolStatus = getAssetStatus(assetConfigurationList) | |
320 | - | let finalPoolStatus = if (if ((finalPoolAmount >= getAssetMinRequiredPoolAmount(assetConfigurationList))) | |
321 | - | then (currentPoolStatus == assetStatus._1) | |
322 | - | else false) | |
323 | - | then assetStatus._2 | |
324 | - | else currentPoolStatus | |
325 | - | let currentPoolMakers = getAssetPoolMakers(assetAddress) | |
326 | - | let newPoolMakers = if ((currentPoolMakers == "")) | |
327 | - | then poolMakerAddress | |
328 | - | else if (contains(currentPoolMakers, poolMakerAddress)) | |
329 | - | then currentPoolMakers | |
330 | - | else ((currentPoolMakers + ",") + toString(i.caller)) | |
331 | - | let newPoolMakerBalance = (currentPoolMakerBalance + i.payments[0].amount) | |
332 | - | let result = [IntegerEntry(getPoolMakerParticipationAmountKey(assetAddress, toString(i.caller)), newPoolMakerBalance), IntegerEntry(getPoolMakerParticipationMaxAmountKey(assetAddress, toString(i.caller)), if ((newPoolMakerBalance > maxPoolMakerBalance)) | |
333 | - | then newPoolMakerBalance | |
334 | - | else maxPoolMakerBalance), IntegerEntry(getAssetCurrrentPoolAmountKey(assetAddress), finalPoolAmount), IntegerEntry(getAssetMaxPoolAmountKey(assetAddress), if ((finalPoolAmount > maxPoolAmount)) | |
335 | - | then finalPoolAmount | |
336 | - | else maxPoolAmount), StringEntry(getAssetPoolMakersKey(assetAddress), newPoolMakers), StringEntry(getAssetConfigKey(assetAddress), updateAssetCfgStatus(finalPoolStatus, assetConfigurationList))] | |
337 | - | if ((currentPoolStatus == assetStatus._3)) | |
338 | - | then (result :+ ScriptTransfer(addressFromStringValue(assetAddress), attachedPayment.amount, neutrinoAssetId)) | |
339 | - | else result | |
340 | - | } | |
376 | + | let poolMakerAddress = toString(i.caller) | |
377 | + | if ((getBoolByKey(isInitializedKey) == false)) | |
378 | + | then throw("Contract is not yet ready.") | |
379 | + | else if ((attachedPayment.assetId != neutrinoAssetId)) | |
380 | + | then throw("Liquidity pool could be funded with USDN only.") | |
381 | + | else if ((minPoolInvestAmount > attachedPayment.amount)) | |
382 | + | then throw(("Attached payment amount is less tha min allowed: " + toString(minPoolInvestAmount))) | |
383 | + | else { | |
384 | + | let newCurrentPoolAmount = (attachedPayment.amount + getAssetCurrentPoolAmount(assetAddressStr)) | |
385 | + | let maxPoolAmount = getAssetMaxPoolAmount(assetAddressStr) | |
386 | + | let currentPoolMakerBalance = getPoolMakerParticipationAmount(assetAddressStr, poolMakerAddress) | |
387 | + | let maxPoolMakerBalance = getPoolMakerParticipationMaxAmount(assetAddressStr, poolMakerAddress) | |
388 | + | let currentAssetStatus = getAssetStatus(assetConfigurationList) | |
389 | + | let newAssetStatus = if (if ((currentAssetStatus == ASSEtPROPOSED)) | |
390 | + | then (newCurrentPoolAmount >= getAssetMinRequiredPoolAmount(assetConfigurationList)) | |
391 | + | else false) | |
392 | + | then ASSEtREADY | |
393 | + | else currentAssetStatus | |
394 | + | let newPoolMakerBalance = (currentPoolMakerBalance + attachedPayment.amount) | |
395 | + | let immediateTransferIfIssued = if ((currentAssetStatus == ASSEtISSUED)) | |
396 | + | then [ScriptTransfer(addressFromStringValue(assetAddressStr), attachedPayment.amount, neutrinoAssetId)] | |
397 | + | else nil | |
398 | + | ([IntegerEntry(getPoolMakerParticipationAmountKey(assetAddressStr, poolMakerAddress), newPoolMakerBalance), IntegerEntry(getPoolMakerParticipationMaxAmountKey(assetAddressStr, poolMakerAddress), max([newPoolMakerBalance, maxPoolMakerBalance])), IntegerEntry(getAssetCurrrentPoolAmountKey(assetAddressStr), newCurrentPoolAmount), IntegerEntry(getAssetMaxPoolAmountKey(assetAddressStr), max([maxPoolAmount, newCurrentPoolAmount])), StringEntry(getAssetConfigKey(assetAddressStr), updateAssetCfgStatus(newAssetStatus, assetConfigurationList))] ++ immediateTransferIfIssued) | |
399 | + | } | |
341 | 400 | } | |
342 | 401 | ||
343 | 402 | ||
344 | 403 | ||
345 | 404 | @Callable(i) | |
346 | 405 | func activateAsset (assetCode) = { | |
347 | 406 | let assetAddress = getAssetAddressByCode(assetCode) | |
348 | 407 | let assetConfigurationList = getAssetConfigArray(assetAddress) | |
349 | 408 | let assetCurrentPoolAmount = getAssetCurrentPoolAmount(assetAddress) | |
350 | 409 | let aCurrentStatus = getAssetStatus(assetConfigurationList) | |
351 | 410 | if ((toBase58String(i.callerPublicKey) != adminPublicKey)) | |
352 | 411 | then throw("Only Admin can perform contract operation.") | |
353 | 412 | else if ((getBoolByKey(isInitializedKey) == false)) | |
354 | 413 | then throw("Contract is not yet ready.") | |
355 | 414 | else if ((aCurrentStatus != assetStatus._2)) | |
356 | 415 | then throw((("Asset is not in READY status. Current status is " + aCurrentStatus) + ".")) | |
357 | 416 | else if ((assetAddress == "")) | |
358 | 417 | then throw((("Cannot find asset " + assetCode) + ".")) | |
359 | 418 | else if ((minimumPoolFunding > assetCurrentPoolAmount)) | |
360 | 419 | then throw((((("Cannot issue asset as liquidity pool amount (" + toString(assetCurrentPoolAmount)) + ") is less than required (") + toString(minimumPoolFunding)) + ")")) | |
361 | 420 | else { | |
362 | 421 | let issueDebt = Reissue(debtToken, debtTokenReissueAmount, true) | |
363 | 422 | [IntegerEntry(getAssetActivateHeightKey(assetAddress), height), StringEntry(getAssetConfigKey(assetAddress), updateAssetCfgStatus(assetStatus._3, assetConfigurationList)), issueDebt, ScriptTransfer(addressFromStringValue(assetAddress), assetCurrentPoolAmount, neutrinoAssetId), ScriptTransfer(addressFromStringValue(assetAddress), debtTokenReissueAmount, debtToken)] | |
364 | 423 | } | |
365 | 424 | } | |
366 | 425 | ||
367 | 426 | ||
368 | 427 | ||
369 | 428 | @Callable(i) | |
370 | 429 | func redeemFromPool (assetCode,amount) = { | |
371 | - | let assetAddress = getAssetAddressByCode(assetCode) | |
372 | - | let assetConfigurationList = getAssetConfigArray(assetAddress) | |
373 | 430 | let callerAddress = toString(i.caller) | |
374 | - | let totalAmountInPoolByCaller = getPoolMakerParticipationAmount(assetAddress, callerAddress) | |
375 | - | let lockedAmountByPoolMaker = getPoolMakerLockedAmount(assetAddress, callerAddress) | |
376 | - | if ((toBase58String(i.callerPublicKey) != adminPublicKey)) | |
377 | - | then throw("Only Admin can perform contract operation.") | |
378 | - | else if ((getBoolByKey(isInitializedKey) == false)) | |
379 | - | then throw("Contract is not yet ready.") | |
380 | - | else if ((assetAddress == "")) | |
381 | - | then throw((("Cannot find asset " + assetCode) + ".")) | |
382 | - | else if (if (if ((0 > amount)) | |
383 | - | then true | |
384 | - | else (totalAmountInPoolByCaller == 0)) | |
385 | - | then true | |
386 | - | else (amount > totalAmountInPoolByCaller)) | |
387 | - | then throw((("Cannot find pool maker by address " + callerAddress) + " or amount passed is not correct.")) | |
388 | - | else if ((lockedAmountByPoolMaker > 0)) | |
389 | - | then throw("Pool maker already has initiated redemption that is not withdrawn yet.") | |
390 | - | else [IntegerEntry(getPoolMakerLockedAmountKey(assetAddress, callerAddress), amount), IntegerEntry(getPoolMakerUnlockHeightKey(assetAddress, callerAddress), (height + getRedemptionTimeoutBlocks(assetConfigurationList)))] | |
431 | + | let redeemTuple = calcAllowedAmountToRedeem(assetCode, callerAddress) | |
432 | + | let assetAddressStr = redeemTuple._1 | |
433 | + | let allowedAmountToRedeem = redeemTuple._2 | |
434 | + | let poolTotalLocked = redeemTuple._3 | |
435 | + | let poolActualSize = redeemTuple._4 | |
436 | + | let poolMakerActualAmount = redeemTuple._5 | |
437 | + | let withdrawHeight = redeemTuple._6 | |
438 | + | let poolMakerLockedAmount = redeemTuple._7 | |
439 | + | let traceData = redeemTuple._8 | |
440 | + | let poolMakerLiquidityRequestKey = getPoolMakerLiquidityRequestKey(assetAddressStr, callerAddress, withdrawHeight) | |
441 | + | if ((getBoolByKey(isInitializedKey) == false)) | |
442 | + | then throw("Contract is not yet ready.") | |
443 | + | else if (if (if ((0 > amount)) | |
444 | + | then true | |
445 | + | else (0 >= poolMakerActualAmount)) | |
446 | + | then true | |
447 | + | else (amount > allowedAmountToRedeem)) | |
448 | + | then throw((("Cannot find pool maker by address " + callerAddress) + " or amount passed is not correct.")) | |
449 | + | else if (((1 * multiplicator) > amount)) | |
450 | + | then throw("Redeem amount is less then min allowed") | |
451 | + | else if ((poolMakerLockedAmount > 0)) | |
452 | + | then throw("Pool maker already has initiated redemption that is not withdrawn yet.") | |
453 | + | else if (isDefined(getInteger(this, poolMakerLiquidityRequestKey))) | |
454 | + | then throw((("Pool maker has already initiated redemption for " + toString(height)) + " height")) | |
455 | + | else [IntegerEntry(getPoolTotalLockedAmountKey(assetAddressStr), (poolTotalLocked + amount)), IntegerEntry(getAssetCurrrentPoolAmountKey(assetAddressStr), (poolActualSize - amount)), IntegerEntry(getPoolMakerParticipationAmountKey(assetAddressStr, callerAddress), (poolMakerActualAmount - amount)), IntegerEntry(poolMakerLiquidityRequestKey, amount), IntegerEntry(getPoolMakerLockedAmountKey(assetAddressStr, callerAddress), amount), IntegerEntry(getPoolMakerUnlockHeightKey(assetAddressStr, callerAddress), withdrawHeight), StringEntry("%s%s_trace_redeemFromPool", traceData)] | |
391 | 456 | } | |
392 | 457 | ||
393 | 458 | ||
394 | 459 | ||
395 | 460 | @Callable(i) | |
396 | - | func getMaxAllowedAmountToRedeem (assetCode,poolMaker) = throw((((("{allowedAmountToRedeem: 1000, assetCode: " + assetCode) + ", poolMaker: ") + poolMaker) + "}")) | |
461 | + | func getMaxAllowedAmountToRedeem (assetCode,poolMakerAddress) = { | |
462 | + | let redeemTuple = calcAllowedAmountToRedeem(assetCode, poolMakerAddress) | |
463 | + | let assetAddressStr = redeemTuple._1 | |
464 | + | let allowedAmountToRedeem = redeemTuple._2 | |
465 | + | let poolTotalLocked = redeemTuple._3 | |
466 | + | let poolActualSize = redeemTuple._4 | |
467 | + | let poolMakerActualAmount = redeemTuple._5 | |
468 | + | let withdrawHeight = redeemTuple._6 | |
469 | + | let poolMakerLockedAmount = redeemTuple._7 | |
470 | + | throw(((((((("{" + "allowedAmountToRedeem: ") + toString(allowedAmountToRedeem)) + ", assetCode: ") + assetCode) + ", poolMaker: ") + poolMakerAddress) + "}")) | |
471 | + | } | |
397 | 472 | ||
398 | 473 | ||
399 | 474 | ||
400 | 475 | @Callable(i) | |
401 | 476 | func withdraw (assetCode) = { | |
402 | - | let assetConfigurationList = getAssetConfigArray(assetCode) | |
403 | - | let assetAddress = getAssetAddressByCode(assetCode) | |
404 | - | let priceOracleAddress = addressFromStringValue(getAssetPriceOracleAddress(assetConfigurationList)) | |
405 | 477 | let callerAddress = toString(i.caller) | |
406 | - | let syntheticAssetInfo = valueOrErrorMessage(assetInfo(fromBase58String(assetAddress)), ("Cannot find asset by id " + assetAddress)) | |
407 | - | let totalUSDNBalanceOnContract = assetBalance(this, neutrinoAssetId) | |
408 | - | let totalAmountInPoolByPoolMaker = getPoolMakerParticipationAmount(assetAddress, callerAddress) | |
409 | - | let lockedAmountByPoolMaker = getPoolMakerLockedAmount(assetAddress, callerAddress) | |
410 | - | let minWithdrawHeight = getPoolMakerUnlockHeight(assetAddress, callerAddress) | |
411 | - | let poolMaketProportion = (getAssetMaxPoolAmount(assetAddress) / getPoolMakerParticipationMaxAmount(assetAddress, callerAddress)) | |
412 | - | if ((toBase58String(i.callerPublicKey) != adminPublicKey)) | |
413 | - | then throw("Only Admin can perform contract operation.") | |
414 | - | else if ((getBoolByKey(isInitializedKey) == false)) | |
415 | - | then throw("Contract is not yet ready.") | |
416 | - | else if ((getBoolByKey(isInitializedKey) == false)) | |
417 | - | then throw("Contract is not yet ready.") | |
418 | - | else if ((assetAddress == "")) | |
419 | - | then throw((("Cannot find asset " + assetCode) + ".")) | |
420 | - | else if ((totalAmountInPoolByPoolMaker == 0)) | |
421 | - | then throw((("Cannot find pool maker by address " + callerAddress) + " or no locked amount.")) | |
422 | - | else if ((height > minWithdrawHeight)) | |
423 | - | then throw((("Please wait " + toString(minWithdrawHeight)) + " before withdraw.")) | |
424 | - | else { | |
425 | - | let assetEmission = syntheticAssetInfo.quantity | |
426 | - | let currentPrice = getAssetPrice(priceOracleAddress, assetCode) | |
427 | - | let poolMakerLockedAmount = getPoolMakerLockedAmount(assetAddress, callerAddress) | |
428 | - | let priceWithOvercollateralRate = (getAssetOverCollateralPercent(assetConfigurationList) * currentPrice) | |
429 | - | let usdnNeededToCoverEmission = (priceWithOvercollateralRate * assetEmission) | |
430 | - | if ((totalUSDNBalanceOnContract > usdnNeededToCoverEmission)) | |
431 | - | then { | |
432 | - | let amoutAvailableToExitFromPool = (totalUSDNBalanceOnContract - usdnNeededToCoverEmission) | |
433 | - | let amountForWithdraw = (poolMaketProportion * amoutAvailableToExitFromPool) | |
434 | - | let finalLockedAmount = (getPoolMakerLockedAmount(assetAddress, callerAddress) - amountForWithdraw) | |
435 | - | [IntegerEntry(getAssetCurrrentPoolAmountKey(assetAddress), (getAssetCurrentPoolAmount(assetAddress) - amountForWithdraw)), IntegerEntry(getPoolMakerParticipationAmountKey(assetAddress, callerAddress), (getPoolMakerParticipationAmount(assetAddress, callerAddress) - amountForWithdraw)), IntegerEntry(getPoolMakerLockedAmountKey(assetAddress, callerAddress), finalLockedAmount), ScriptTransfer(addressFromStringValue(callerAddress), amountForWithdraw, neutrinoAssetId)] | |
436 | - | } | |
437 | - | else nil | |
438 | - | } | |
478 | + | let assetAddressStr = getAssetAddressByCodeOrFail(assetCode) | |
479 | + | let assetAddress = addressFromStringValue(assetAddressStr) | |
480 | + | let poolMakerLockedAmountKey = getPoolMakerLockedAmountKey(assetAddressStr, callerAddress) | |
481 | + | let registeredAmount4Withdraw = valueOrElse(getInteger(this, poolMakerLockedAmountKey), 0) | |
482 | + | let poolMakerUnlockHeightKey = getPoolMakerUnlockHeightKey(assetAddressStr, callerAddress) | |
483 | + | let withdrawHeight = valueOrElse(getInteger(this, poolMakerUnlockHeightKey), 0) | |
484 | + | let poolTotalLockedAmountKey = getPoolTotalLockedAmountKey(assetAddressStr) | |
485 | + | let poolTotalLocked = valueOrElse(getInteger(this, poolTotalLockedAmountKey), 0) | |
486 | + | let poolMakerLiquidityRequestKey = getPoolMakerLiquidityRequestKey(assetAddressStr, callerAddress, withdrawHeight) | |
487 | + | if ((getBoolByKey(isInitializedKey) == false)) | |
488 | + | then throw("Contract is not yet ready.") | |
489 | + | else if (!(isDefined(getInteger(assetAddress, poolMakerLiquidityRequestKey)))) | |
490 | + | then throw("Need to transfer liquidity from asset account first") | |
491 | + | else if ((0 >= registeredAmount4Withdraw)) | |
492 | + | then throw((("Cannot find pool maker by address " + callerAddress) + " or no locked amount.")) | |
493 | + | else if ((height > withdrawHeight)) | |
494 | + | then throw((("Please wait " + toString(withdrawHeight)) + " before withdraw.")) | |
495 | + | else [IntegerEntry(poolMakerLockedAmountKey, 0), IntegerEntry(poolTotalLockedAmountKey, (poolTotalLocked - registeredAmount4Withdraw)), IntegerEntry(poolMakerUnlockHeightKey, 0), ScriptTransfer(addressFromStringValue(callerAddress), registeredAmount4Withdraw, neutrinoAssetId)] | |
439 | 496 | } | |
440 | 497 | ||
441 | 498 |
github/deemru/w8io/169f3d6 67.17 ms ◑