tx · 7TVQfj8ojaYSeqXN5ezyjW3JNk6SfPuoLyo6j1n7yutg 3N7LYefWk1WhvCsY5A9nTq244SbVPmhCypi: -0.01400000 Waves 2022.03.16 11:34 [1966289] smart account 3N7LYefWk1WhvCsY5A9nTq244SbVPmhCypi > SELF 0.00000000 Waves
{ "type": 13, "id": "7TVQfj8ojaYSeqXN5ezyjW3JNk6SfPuoLyo6j1n7yutg", "fee": 1400000, "feeAssetId": null, "timestamp": 1647419751045, "version": 1, "sender": "3N7LYefWk1WhvCsY5A9nTq244SbVPmhCypi", "senderPublicKey": "4qGVXRFATZNzo2RZZ5UYHXojGyJgSRBwtgJcCU8rJe5A", "proofs": [ "4V6DzFEAXUcuiKPaHJsby94ZhR9zfbjksn12HuDtu3G3n5ZUjEVG2R9AkpAQAsCqtMKDxrWrdbSAzW66qAmDmzYQ" ], "script": "base64:AAIFAAAAAAAAADUIAhIFCgMICAESAwoBARIHCgUBAQEBARIDCgEBEgASAwoBARIAEgUKAwEBARIHCgUBAQEBAQAAAC8AAAAAB1dBVkVMRVQAAAAAAAX14QAAAAAABVBBVUxJAAAAAAAAD0JAAAAAAAhCSUdQQVVMSQkAATYAAAABAAAAAAAAD0JAAAAAAAhQUklDRUxFVAAAAAAAAA9CQAAAAAAETVVMVAAAAAAABfXhAAAAAAAJQklHTVVMVDE2CQABNgAAAAEAACOG8m/BAAAAAAAACU1VTFRTQ0FMRQAAAAAAAAAACAAAAAAHU0NBTEUxNgAAAAAAAAAAEAAAAAADU0VQAgAAAAJfXwAAAAAFSEFMRjgAAAAAAAL68IAAAAAAC0VVTEVSTlVNQkVSCQABNgAAAAEAAGCSoRPY1XQAAAAABnNjYWxlNgAAAAAAAA9CQAAAAAAMc2NhbGU2QmlnSW50CQABNgAAAAEAAAAAAAAPQkAAAAAADHNjYWxlOEJpZ0ludAkAATYAAAABAAAAAAAF9eEAAAAAAA1zY2FsZTEwQmlnSW50CQABNgAAAAEAAAAAAlQL5AABAAAAEmtleU5ldXRyaW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AAGsAAAADCQAAZQAAAAIFAAAAB2hlaWdodDIFAAAAB2hlaWdodDEFAAAABE1VTFQFAAAACGhhbGZMaWZlAAAAAAAAAAAIAAAAAAAAAAAIBQAAAAZIQUxGVVAFAAAABE1VTFQEAAAAAXYJAABrAAAAAwkAAGQAAAACBQAAAAdhbW91bnQxBQAAAAdhbW91bnQyBQAAAARNVUxUCQAAZAAAAAIFAAAAB2Ftb3VudDEFAAAAAXcJAAUUAAAAAgUAAAADbmlsCQAAZAAAAAIFAAAAB2hlaWdodDEJAABpAAAAAgkAAGUAAAACBQAAAAVIQUxGOAkAAGgAAAACBQAAAAhoYWxmTGlmZQkAAG0AAAAGBQAAAAF2AAAAAAAAAAAIAAAAAAAAAAACAAAAAAAAAAAAAAAAAAAAAAAIBQAAAAZIQUxGVVAFAAAABE1VTFQAAAAAeQmg5w==", "chainId": 84, "height": 1966289, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 8oTC6roBS3qrXv1qcmDGng34u5vzakvAMty4XZWqQrSt Next: EeMUW2dwaLTbNFfHdhtpuQJeDjY3VW9mSTgZfk74L5gJ Diff:
Old | New | Differences | |
---|---|---|---|
29 | 29 | ||
30 | 30 | let scale8BigInt = toBigInt(100000000) | |
31 | 31 | ||
32 | + | let scale10BigInt = toBigInt(10000000000) | |
33 | + | ||
32 | 34 | func keyNeutrinoAddress () = "%s%s__config__neutrinoAddress" | |
33 | 35 | ||
34 | 36 | ||
39 | 41 | ||
40 | 42 | ||
41 | 43 | func keyLiquidationContractAddress () = "liquidation_contract" | |
42 | - | ||
43 | - | ||
44 | - | func keyRPDContract () = "rpd_contract" | |
45 | 44 | ||
46 | 45 | ||
47 | 46 | func keyAuctionContract () = "auction_contract" | |
62 | 61 | func keyNeutrinoLockedBalance () = (keyBalanceLocked() + "neutrino") | |
63 | 62 | ||
64 | 63 | ||
65 | - | func keyMinWavesSwapAmount () = "min_waves_swap_amount" | |
66 | - | ||
67 | - | ||
68 | - | func keyMinNeutrinoSwapAmount () = "min_neutrino_swap_amount" | |
69 | - | ||
70 | - | ||
71 | - | func keyWavesOutFeePart () = "wavesOut_swap_feePart" | |
72 | - | ||
73 | - | ||
74 | - | func keyNeutrinoOutFeePart () = "neutrinoOut_swap_feePart" | |
75 | - | ||
76 | - | ||
77 | - | func keyNsbtLockContract () = "%s__nsbtLockContract" | |
78 | - | ||
79 | - | ||
80 | - | func keyQuickSwapLimitDuration () = "%s__quickSwapLimitDuration" | |
64 | + | func swapsTimeframeKEY () = "swaps_timeframe" | |
81 | 65 | ||
82 | 66 | ||
83 | 67 | func keyUserLastQuickSwapHeight (userAddress) = makeString(["%s%s", "userLastQuickSwapHeight", userAddress], SEP) | |
87 | 71 | ||
88 | 72 | ||
89 | 73 | func keyPrice () = "price" | |
90 | - | ||
91 | - | ||
92 | - | func keyHalfLife () = "%s__halfLife" | |
93 | - | ||
94 | - | ||
95 | - | func keyLockParamUserAmount (userAddress) = makeString(["%s%s%s", "paramByUser", userAddress, "amount"], SEP) | |
96 | 74 | ||
97 | 75 | ||
98 | 76 | func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], "")) | |
149 | 127 | ||
150 | 128 | let auctionContract = addressFromStringValue(getStringOrFail(neutrinoContract, keyAuctionContract())) | |
151 | 129 | ||
152 | - | let liquidationContract = getStringOrFail(neutrinoContract, keyLiquidationContractAddress()) | |
130 | + | let liquidationContract = addressFromStringValue(getStringOrFail(neutrinoContract, keyLiquidationContractAddress())) | |
153 | 131 | ||
154 | - | let | |
132 | + | let neutrinoAssetId = fromBase58String(getStringOrFail(neutrinoContract, keyNeutrinoAssetId())) | |
155 | 133 | ||
156 | - | let nsbtStakingContract = addressFromStringValue(getStringOrFail(this, keyNsbtLockContract())) | |
157 | - | ||
158 | - | let neutrinoAssetIdString = getStringOrFail(neutrinoContract, keyNeutrinoAssetId()) | |
159 | - | ||
160 | - | let neutrinoAssetId = fromBase58String(neutrinoAssetIdString) | |
161 | - | ||
162 | - | let nsbtAssetIdStr = getStringValue(neutrinoContract, keyBondAssetId()) | |
163 | - | ||
164 | - | let nsbtAssetId = fromBase58String(nsbtAssetIdStr) | |
134 | + | let nsbtAssetId = fromBase58String(getStringValue(neutrinoContract, keyBondAssetId())) | |
165 | 135 | ||
166 | 136 | func calcContractNsbtPriceInternal (nsbtSupplyOverride) = { | |
167 | 137 | let nsbtSupplyMAX = value(assetInfo(nsbtAssetId)).quantity | |
168 | - | let neutrinoMetrics = asAnyList(invoke(this, " | |
138 | + | let neutrinoMetrics = asAnyList(invoke(this, "calcNeutinoMetricsREADONLY", nil, nil)) | |
169 | 139 | if ((neutrinoMetrics == neutrinoMetrics)) | |
170 | 140 | then { | |
171 | 141 | let nsbtSupply = if ((nsbtSupplyOverride == unit)) | |
172 | 142 | then asInt(neutrinoMetrics[9]) | |
173 | 143 | else value(nsbtSupplyOverride) | |
174 | 144 | let currentPrice = asInt(neutrinoMetrics[0]) | |
175 | - | let kCalcArray = asAnyList(invoke(this, " | |
145 | + | let kCalcArray = asAnyList(invoke(this, "calculateKREADONLY", [asInt(neutrinoMetrics[4]), asInt(neutrinoMetrics[6]), currentPrice, nsbtSupplyMAX, nsbtSupply], nil)) | |
176 | 146 | if ((kCalcArray == kCalcArray)) | |
177 | 147 | then { | |
178 | 148 | let multK = parseBigIntValue(asString(kCalcArray[6])) | |
193 | 163 | @Callable(i) | |
194 | 164 | func constructor (neutrinoAddress,nsbtLockAddress,swapAmountAParam) = if ((i.caller != this)) | |
195 | 165 | then throw("not authorized") | |
196 | - | else [StringEntry(keyNeutrinoAddress(), neutrinoAddress), | |
166 | + | else [StringEntry(keyNeutrinoAddress(), neutrinoAddress), IntegerEntry(keySwapAmountAParam(), swapAmountAParam)] | |
197 | 167 | ||
198 | 168 | ||
199 | 169 | ||
200 | 170 | @Callable(i) | |
201 | - | func | |
202 | - | let limitParamA = toBigInt( | |
171 | + | func calcSwapLimitREADONLY (gNsbtAmount) = { | |
172 | + | let limitParamA = toBigInt(getIntOrFail(this, keySwapAmountAParam())) | |
203 | 173 | let gNsbtAmountScale16 = toX16(gNsbtAmount, scale6) | |
204 | 174 | let limitPowPart = pow(gNsbtAmountScale16, 16, EULERNUMBER, 16, 8, CEILING) | |
205 | - | let limit = fraction(limitParamA, limitPowPart, | |
175 | + | let limit = fraction(limitParamA, limitPowPart, scale10BigInt) | |
206 | 176 | $Tuple2(nil, toInt(limit)) | |
207 | 177 | } | |
208 | 178 | ||
209 | 179 | ||
210 | 180 | ||
211 | 181 | @Callable(i) | |
212 | - | func | |
182 | + | func calculateKREADONLY (wRaw,uRaw,price,mRaw,sRaw) = { | |
213 | 183 | let EXP = toBigInt(2718281) | |
214 | 184 | let EXPSCALE = 6 | |
215 | 185 | let a = valueOrElse(getInteger(auctionContract, "nsbtCurveParam_a"), 3) | |
229 | 199 | ||
230 | 200 | ||
231 | 201 | @Callable(i) | |
232 | - | func | |
233 | - | let | |
234 | - | if (( | |
202 | + | func curveFunctionREADONLY (wavesPayRaw) = { | |
203 | + | let neutrinoMetrics = asAnyList(invoke(this, "calcNeutinoMetricsREADONLY", nil, nil)) | |
204 | + | if ((neutrinoMetrics == neutrinoMetrics)) | |
235 | 205 | then { | |
236 | - | let multK = parseBigIntValue(asString(kCalcArray[6])) | |
237 | - | let usdnPay = convertWavesToNeutrino(wavesPayRaw, price) | |
238 | - | let bigMaxNsbtSupply = toBigInt(mRaw) | |
239 | - | let bigNsbtSupply = toBigInt((mRaw - sRaw)) | |
240 | - | let step1 = fraction(toBigInt(usdnPay), BIGMULT16, multK) | |
241 | - | let step2 = fraction(step1, bigNsbtSupply, bigMaxNsbtSupply) | |
242 | - | let step3 = toInt(fraction(bigNsbtSupply, bigMaxNsbtSupply, (step2 + bigMaxNsbtSupply))) | |
243 | - | let nsbtAmountRaw = ((mRaw - sRaw) - step3) | |
244 | - | $Tuple2(nil, [nsbtAmountRaw, usdnPay, wRaw, uRaw, mRaw, sRaw, asInt(kCalcArray[0]), asInt(kCalcArray[1]), asInt(kCalcArray[2]), price, asInt(kCalcArray[3]), asInt(kCalcArray[4]), kCalcArray[5], kCalcArray[6], toString(step1), toString(step2), step3]) | |
206 | + | let price = asInt(neutrinoMetrics[0]) | |
207 | + | let wRaw = asInt(neutrinoMetrics[3]) | |
208 | + | let uRaw = asInt(neutrinoMetrics[5]) | |
209 | + | let sRaw = asInt(neutrinoMetrics[9]) | |
210 | + | let mRaw = value(assetInfo(nsbtAssetId)).quantity | |
211 | + | let kCalcArray = asAnyList(invoke(this, "calculateKREADONLY", [wRaw, uRaw, price, mRaw, sRaw], nil)) | |
212 | + | if ((kCalcArray == kCalcArray)) | |
213 | + | then { | |
214 | + | let multK = parseBigIntValue(asString(kCalcArray[6])) | |
215 | + | let usdnPay = convertWavesToNeutrino(wavesPayRaw, price) | |
216 | + | let bigMaxNsbtSupply = toBigInt(mRaw) | |
217 | + | let bigNsbtSupply = toBigInt((mRaw - sRaw)) | |
218 | + | let step1 = fraction(toBigInt(usdnPay), BIGMULT16, multK) | |
219 | + | let step2 = fraction(step1, bigNsbtSupply, bigMaxNsbtSupply) | |
220 | + | let step3 = toInt(fraction(bigNsbtSupply, bigMaxNsbtSupply, (step2 + bigMaxNsbtSupply))) | |
221 | + | let nsbtAmountRaw = ((mRaw - sRaw) - step3) | |
222 | + | $Tuple2(nil, [nsbtAmountRaw, usdnPay, wRaw, uRaw, mRaw, sRaw, asInt(kCalcArray[0]), asInt(kCalcArray[1]), asInt(kCalcArray[2]), price, asInt(kCalcArray[3]), asInt(kCalcArray[4]), kCalcArray[5], kCalcArray[6], toString(step1), toString(step2), step3]) | |
223 | + | } | |
224 | + | else throw("Strict value is not equal to itself.") | |
245 | 225 | } | |
246 | 226 | else throw("Strict value is not equal to itself.") | |
247 | 227 | } | |
249 | 229 | ||
250 | 230 | ||
251 | 231 | @Callable(i) | |
252 | - | func | |
232 | + | func calcContractNsbtPriceREADONLY () = calcContractNsbtPriceInternal(unit) | |
253 | 233 | ||
254 | 234 | ||
255 | 235 | ||
256 | 236 | @Callable(i) | |
257 | - | func | |
237 | + | func calcContractNsbtPriceBySupplyREADONLY (nsbtSupply) = calcContractNsbtPriceInternal(nsbtSupply) | |
258 | 238 | ||
259 | 239 | ||
260 | 240 | ||
261 | 241 | @Callable(i) | |
262 | - | func calcUserSwapLimitsMATH (userAddressStr) = { | |
263 | - | let currentPrice = getIntegerValue(controlContract, keyPrice()) | |
264 | - | let userGNsbtAmount = valueOrElse(getInteger(nsbtStakingContract, keyLockParamUserAmount(userAddressStr)), 0) | |
265 | - | let usdnLmtMax = asInt(invoke(this, "calcSwapLimitMATH", [userGNsbtAmount], nil)) | |
266 | - | if ((usdnLmtMax == usdnLmtMax)) | |
267 | - | then { | |
268 | - | let quickSwapResetBlocks = getNumberByKey(neutrinoContract, keyQuickSwapLimitDuration()) | |
269 | - | let lastQuickSwapBlock = valueOrElse(getInteger(neutrinoContract, keyUserLastQuickSwapHeight(userAddressStr)), 0) | |
270 | - | let isNewQuickSwapPeriod = ((height - lastQuickSwapBlock) > quickSwapResetBlocks) | |
271 | - | let quickSwapUserSpent = if (isNewQuickSwapPeriod) | |
272 | - | then 0 | |
273 | - | else valueOrElse(getInteger(neutrinoContract, keyQuickSwapUserSpentInPeriod(userAddressStr)), 0) | |
274 | - | let blcks2LmtReset = if (isNewQuickSwapPeriod) | |
275 | - | then 0 | |
276 | - | else (quickSwapResetBlocks - (height - lastQuickSwapBlock)) | |
277 | - | let wavesLmtMax = convertNeutrinoToWaves(usdnLmtMax, currentPrice) | |
278 | - | $Tuple2(nil, [usdnLmtMax, quickSwapUserSpent, blcks2LmtReset, wavesLmtMax]) | |
279 | - | } | |
280 | - | else throw("Strict value is not equal to itself.") | |
281 | - | } | |
282 | - | ||
283 | - | ||
284 | - | ||
285 | - | @Callable(i) | |
286 | - | func calcNeutinoMetricsMATH () = { | |
242 | + | func calcNeutinoMetricsREADONLY () = { | |
287 | 243 | let currentPrice = getIntegerValue(controlContract, keyPrice()) | |
288 | 244 | let neutrinoLockedBalance = valueOrElse(getInteger(neutrinoContract, keyNeutrinoLockedBalance()), 0) | |
289 | 245 | let wavesLockedBalance = valueOrElse(getInteger(neutrinoContract, keyWavesLockedBalance()), 0) | |
290 | 246 | let reserve = (wavesBalance(neutrinoContract).regular - wavesLockedBalance) | |
291 | 247 | let reservesInUsdn = convertWavesToNeutrino(reserve, currentPrice) | |
292 | - | let neutrinoSupply = (((neutrinoLockedBalance + value(assetInfo(neutrinoAssetId)).quantity) - assetBalance(neutrinoContract, neutrinoAssetId)) - assetBalance( | |
248 | + | let neutrinoSupply = (((neutrinoLockedBalance + value(assetInfo(neutrinoAssetId)).quantity) - assetBalance(neutrinoContract, neutrinoAssetId)) - assetBalance(liquidationContract, neutrinoAssetId)) | |
293 | 249 | let surplus = (reservesInUsdn - neutrinoSupply) | |
294 | 250 | let deficit = (neutrinoSupply - reservesInUsdn) | |
295 | 251 | let surplusPercent = if ((neutrinoSupply == 0)) | |
306 | 262 | ||
307 | 263 | ||
308 | 264 | @Callable(i) | |
309 | - | func getUnstakeComissionAmountMATH (amount,startHeight) = { | |
310 | - | let halfLife = getIntOrFail(nsbtStakingContract, keyHalfLife()) | |
311 | - | $Tuple2(nil, fraction(amount, pow(2, 0, fraction(-((height - startHeight)), MULT, halfLife), 8, 8, HALFUP), MULT)) | |
312 | - | } | |
265 | + | func getUnstakeComissionAmountREADONLY (amount,startHeight,halfLife) = $Tuple2(nil, fraction(amount, pow(2, 0, fraction(-((height - startHeight)), MULT, halfLife), 8, 8, HALFUP), MULT)) | |
313 | 266 | ||
314 | 267 | ||
315 | 268 | ||
316 | 269 | @Callable(i) | |
317 | - | func mergeStakesMATH (amount1,height1,amount2,height2) = { | |
318 | - | let halfLife = getIntOrFail(nsbtStakingContract, keyHalfLife()) | |
270 | + | func mergeStakesREADONLY (amount1,height1,amount2,height2,halfLife) = { | |
319 | 271 | let w = fraction(amount2, pow(2, 0, fraction((height2 - height1), MULT, halfLife), 8, 8, HALFUP), MULT) | |
320 | 272 | let v = fraction((amount1 + amount2), MULT, (amount1 + w)) | |
321 | 273 | $Tuple2(nil, (height1 + ((HALF8 - (halfLife * log(v, 8, 2, 0, 8, HALFUP))) / MULT))) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let WAVELET = 100000000 | |
5 | 5 | ||
6 | 6 | let PAULI = 1000000 | |
7 | 7 | ||
8 | 8 | let BIGPAULI = toBigInt(1000000) | |
9 | 9 | ||
10 | 10 | let PRICELET = 1000000 | |
11 | 11 | ||
12 | 12 | let MULT = 100000000 | |
13 | 13 | ||
14 | 14 | let BIGMULT16 = toBigInt(10000000000000000) | |
15 | 15 | ||
16 | 16 | let MULTSCALE = 8 | |
17 | 17 | ||
18 | 18 | let SCALE16 = 16 | |
19 | 19 | ||
20 | 20 | let SEP = "__" | |
21 | 21 | ||
22 | 22 | let HALF8 = 50000000 | |
23 | 23 | ||
24 | 24 | let EULERNUMBER = toBigInt(27182818284590452) | |
25 | 25 | ||
26 | 26 | let scale6 = 1000000 | |
27 | 27 | ||
28 | 28 | let scale6BigInt = toBigInt(1000000) | |
29 | 29 | ||
30 | 30 | let scale8BigInt = toBigInt(100000000) | |
31 | 31 | ||
32 | + | let scale10BigInt = toBigInt(10000000000) | |
33 | + | ||
32 | 34 | func keyNeutrinoAddress () = "%s%s__config__neutrinoAddress" | |
33 | 35 | ||
34 | 36 | ||
35 | 37 | func keySwapAmountAParam () = "%s%s__config__swapAParam" | |
36 | 38 | ||
37 | 39 | ||
38 | 40 | func keyNeutrinoAssetId () = "neutrino_asset_id" | |
39 | 41 | ||
40 | 42 | ||
41 | 43 | func keyLiquidationContractAddress () = "liquidation_contract" | |
42 | - | ||
43 | - | ||
44 | - | func keyRPDContract () = "rpd_contract" | |
45 | 44 | ||
46 | 45 | ||
47 | 46 | func keyAuctionContract () = "auction_contract" | |
48 | 47 | ||
49 | 48 | ||
50 | 49 | func keyContolContract () = "control_contract" | |
51 | 50 | ||
52 | 51 | ||
53 | 52 | func keyBondAssetId () = "bond_asset_id" | |
54 | 53 | ||
55 | 54 | ||
56 | 55 | func keyBalanceLocked () = "balance_lock_" | |
57 | 56 | ||
58 | 57 | ||
59 | 58 | func keyWavesLockedBalance () = (keyBalanceLocked() + "waves") | |
60 | 59 | ||
61 | 60 | ||
62 | 61 | func keyNeutrinoLockedBalance () = (keyBalanceLocked() + "neutrino") | |
63 | 62 | ||
64 | 63 | ||
65 | - | func keyMinWavesSwapAmount () = "min_waves_swap_amount" | |
66 | - | ||
67 | - | ||
68 | - | func keyMinNeutrinoSwapAmount () = "min_neutrino_swap_amount" | |
69 | - | ||
70 | - | ||
71 | - | func keyWavesOutFeePart () = "wavesOut_swap_feePart" | |
72 | - | ||
73 | - | ||
74 | - | func keyNeutrinoOutFeePart () = "neutrinoOut_swap_feePart" | |
75 | - | ||
76 | - | ||
77 | - | func keyNsbtLockContract () = "%s__nsbtLockContract" | |
78 | - | ||
79 | - | ||
80 | - | func keyQuickSwapLimitDuration () = "%s__quickSwapLimitDuration" | |
64 | + | func swapsTimeframeKEY () = "swaps_timeframe" | |
81 | 65 | ||
82 | 66 | ||
83 | 67 | func keyUserLastQuickSwapHeight (userAddress) = makeString(["%s%s", "userLastQuickSwapHeight", userAddress], SEP) | |
84 | 68 | ||
85 | 69 | ||
86 | 70 | func keyQuickSwapUserSpentInPeriod (userAddress) = makeString(["%s%s", "quickSwapUserSpentInPeriod", userAddress], SEP) | |
87 | 71 | ||
88 | 72 | ||
89 | 73 | func keyPrice () = "price" | |
90 | - | ||
91 | - | ||
92 | - | func keyHalfLife () = "%s__halfLife" | |
93 | - | ||
94 | - | ||
95 | - | func keyLockParamUserAmount (userAddress) = makeString(["%s%s%s", "paramByUser", userAddress, "amount"], SEP) | |
96 | 74 | ||
97 | 75 | ||
98 | 76 | func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], "")) | |
99 | 77 | ||
100 | 78 | ||
101 | 79 | func getIntOrFail (address,key) = valueOrErrorMessage(getInteger(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], "")) | |
102 | 80 | ||
103 | 81 | ||
104 | 82 | func getNumberByKey (address,key) = valueOrElse(getInteger(address, key), 0) | |
105 | 83 | ||
106 | 84 | ||
107 | 85 | func getBoolOrFail (address,key) = valueOrErrorMessage(getBoolean(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], "")) | |
108 | 86 | ||
109 | 87 | ||
110 | 88 | func convertNeutrinoToWaves (amount,price) = fraction(fraction(amount, PRICELET, price), WAVELET, PAULI) | |
111 | 89 | ||
112 | 90 | ||
113 | 91 | func convertWavesToNeutrino (amount,price) = fraction(fraction(amount, price, PRICELET), PAULI, WAVELET) | |
114 | 92 | ||
115 | 93 | ||
116 | 94 | func toX16 (origVal,origScaleMult) = fraction(toBigInt(origVal), BIGMULT16, toBigInt(origScaleMult)) | |
117 | 95 | ||
118 | 96 | ||
119 | 97 | func fromX16 (val,resultScaleMult) = toInt(fraction(val, toBigInt(resultScaleMult), BIGMULT16)) | |
120 | 98 | ||
121 | 99 | ||
122 | 100 | func asAnyList (val) = match val { | |
123 | 101 | case valAnyLyst: List[Any] => | |
124 | 102 | valAnyLyst | |
125 | 103 | case _ => | |
126 | 104 | throw("fail to cast into List[Any]") | |
127 | 105 | } | |
128 | 106 | ||
129 | 107 | ||
130 | 108 | func asInt (val) = match val { | |
131 | 109 | case valInt: Int => | |
132 | 110 | valInt | |
133 | 111 | case _ => | |
134 | 112 | throw("fail to cast into Int") | |
135 | 113 | } | |
136 | 114 | ||
137 | 115 | ||
138 | 116 | func asString (val) = match val { | |
139 | 117 | case valStr: String => | |
140 | 118 | valStr | |
141 | 119 | case _ => | |
142 | 120 | throw("fail to cast into String") | |
143 | 121 | } | |
144 | 122 | ||
145 | 123 | ||
146 | 124 | let neutrinoContract = addressFromStringValue(getStringOrFail(this, keyNeutrinoAddress())) | |
147 | 125 | ||
148 | 126 | let controlContract = addressFromStringValue(getStringOrFail(neutrinoContract, keyContolContract())) | |
149 | 127 | ||
150 | 128 | let auctionContract = addressFromStringValue(getStringOrFail(neutrinoContract, keyAuctionContract())) | |
151 | 129 | ||
152 | - | let liquidationContract = getStringOrFail(neutrinoContract, keyLiquidationContractAddress()) | |
130 | + | let liquidationContract = addressFromStringValue(getStringOrFail(neutrinoContract, keyLiquidationContractAddress())) | |
153 | 131 | ||
154 | - | let | |
132 | + | let neutrinoAssetId = fromBase58String(getStringOrFail(neutrinoContract, keyNeutrinoAssetId())) | |
155 | 133 | ||
156 | - | let nsbtStakingContract = addressFromStringValue(getStringOrFail(this, keyNsbtLockContract())) | |
157 | - | ||
158 | - | let neutrinoAssetIdString = getStringOrFail(neutrinoContract, keyNeutrinoAssetId()) | |
159 | - | ||
160 | - | let neutrinoAssetId = fromBase58String(neutrinoAssetIdString) | |
161 | - | ||
162 | - | let nsbtAssetIdStr = getStringValue(neutrinoContract, keyBondAssetId()) | |
163 | - | ||
164 | - | let nsbtAssetId = fromBase58String(nsbtAssetIdStr) | |
134 | + | let nsbtAssetId = fromBase58String(getStringValue(neutrinoContract, keyBondAssetId())) | |
165 | 135 | ||
166 | 136 | func calcContractNsbtPriceInternal (nsbtSupplyOverride) = { | |
167 | 137 | let nsbtSupplyMAX = value(assetInfo(nsbtAssetId)).quantity | |
168 | - | let neutrinoMetrics = asAnyList(invoke(this, " | |
138 | + | let neutrinoMetrics = asAnyList(invoke(this, "calcNeutinoMetricsREADONLY", nil, nil)) | |
169 | 139 | if ((neutrinoMetrics == neutrinoMetrics)) | |
170 | 140 | then { | |
171 | 141 | let nsbtSupply = if ((nsbtSupplyOverride == unit)) | |
172 | 142 | then asInt(neutrinoMetrics[9]) | |
173 | 143 | else value(nsbtSupplyOverride) | |
174 | 144 | let currentPrice = asInt(neutrinoMetrics[0]) | |
175 | - | let kCalcArray = asAnyList(invoke(this, " | |
145 | + | let kCalcArray = asAnyList(invoke(this, "calculateKREADONLY", [asInt(neutrinoMetrics[4]), asInt(neutrinoMetrics[6]), currentPrice, nsbtSupplyMAX, nsbtSupply], nil)) | |
176 | 146 | if ((kCalcArray == kCalcArray)) | |
177 | 147 | then { | |
178 | 148 | let multK = parseBigIntValue(asString(kCalcArray[6])) | |
179 | 149 | let mK = fromX16(multK, MULT) | |
180 | 150 | let multStep1 = fraction(nsbtSupplyMAX, MULT, (nsbtSupplyMAX - nsbtSupply)) | |
181 | 151 | let multStep2 = fraction(multStep1, multStep1, MULT) | |
182 | 152 | let multNsbt2usdnPrice = fraction(mK, multStep2, MULT) | |
183 | 153 | let nsbt2usdnPrice = fraction(multNsbt2usdnPrice, PAULI, MULT) | |
184 | 154 | let nsbt2wavesPrice = fraction(nsbt2usdnPrice, PAULI, currentPrice) | |
185 | 155 | $Tuple2(nil, [nsbt2usdnPrice, nsbt2wavesPrice]) | |
186 | 156 | } | |
187 | 157 | else throw("Strict value is not equal to itself.") | |
188 | 158 | } | |
189 | 159 | else throw("Strict value is not equal to itself.") | |
190 | 160 | } | |
191 | 161 | ||
192 | 162 | ||
193 | 163 | @Callable(i) | |
194 | 164 | func constructor (neutrinoAddress,nsbtLockAddress,swapAmountAParam) = if ((i.caller != this)) | |
195 | 165 | then throw("not authorized") | |
196 | - | else [StringEntry(keyNeutrinoAddress(), neutrinoAddress), | |
166 | + | else [StringEntry(keyNeutrinoAddress(), neutrinoAddress), IntegerEntry(keySwapAmountAParam(), swapAmountAParam)] | |
197 | 167 | ||
198 | 168 | ||
199 | 169 | ||
200 | 170 | @Callable(i) | |
201 | - | func | |
202 | - | let limitParamA = toBigInt( | |
171 | + | func calcSwapLimitREADONLY (gNsbtAmount) = { | |
172 | + | let limitParamA = toBigInt(getIntOrFail(this, keySwapAmountAParam())) | |
203 | 173 | let gNsbtAmountScale16 = toX16(gNsbtAmount, scale6) | |
204 | 174 | let limitPowPart = pow(gNsbtAmountScale16, 16, EULERNUMBER, 16, 8, CEILING) | |
205 | - | let limit = fraction(limitParamA, limitPowPart, | |
175 | + | let limit = fraction(limitParamA, limitPowPart, scale10BigInt) | |
206 | 176 | $Tuple2(nil, toInt(limit)) | |
207 | 177 | } | |
208 | 178 | ||
209 | 179 | ||
210 | 180 | ||
211 | 181 | @Callable(i) | |
212 | - | func | |
182 | + | func calculateKREADONLY (wRaw,uRaw,price,mRaw,sRaw) = { | |
213 | 183 | let EXP = toBigInt(2718281) | |
214 | 184 | let EXPSCALE = 6 | |
215 | 185 | let a = valueOrElse(getInteger(auctionContract, "nsbtCurveParam_a"), 3) | |
216 | 186 | let paulB = valueOrElse(getInteger(auctionContract, "nsbtCurveParam_b"), ((3 * PAULI) / 10)) | |
217 | 187 | let wReservesInUsdn = convertWavesToNeutrino(wRaw, price) | |
218 | 188 | let multBR = fraction(wReservesInUsdn, MULT, uRaw) | |
219 | 189 | if ((multBR > 10678564816)) | |
220 | 190 | then throw("BR > 10678.564816% will overflow exponent") | |
221 | 191 | else { | |
222 | 192 | let multPower = (a * (multBR - MULT)) | |
223 | 193 | let multExpInPower = pow(EXP, EXPSCALE, toBigInt(multPower), MULTSCALE, SCALE16, DOWN) | |
224 | 194 | let multK = fraction(toBigInt(paulB), multExpInPower, BIGPAULI) | |
225 | 195 | $Tuple2(nil, [a, paulB, wReservesInUsdn, multBR, multPower, toString(multExpInPower), toString(multK)]) | |
226 | 196 | } | |
227 | 197 | } | |
228 | 198 | ||
229 | 199 | ||
230 | 200 | ||
231 | 201 | @Callable(i) | |
232 | - | func | |
233 | - | let | |
234 | - | if (( | |
202 | + | func curveFunctionREADONLY (wavesPayRaw) = { | |
203 | + | let neutrinoMetrics = asAnyList(invoke(this, "calcNeutinoMetricsREADONLY", nil, nil)) | |
204 | + | if ((neutrinoMetrics == neutrinoMetrics)) | |
235 | 205 | then { | |
236 | - | let multK = parseBigIntValue(asString(kCalcArray[6])) | |
237 | - | let usdnPay = convertWavesToNeutrino(wavesPayRaw, price) | |
238 | - | let bigMaxNsbtSupply = toBigInt(mRaw) | |
239 | - | let bigNsbtSupply = toBigInt((mRaw - sRaw)) | |
240 | - | let step1 = fraction(toBigInt(usdnPay), BIGMULT16, multK) | |
241 | - | let step2 = fraction(step1, bigNsbtSupply, bigMaxNsbtSupply) | |
242 | - | let step3 = toInt(fraction(bigNsbtSupply, bigMaxNsbtSupply, (step2 + bigMaxNsbtSupply))) | |
243 | - | let nsbtAmountRaw = ((mRaw - sRaw) - step3) | |
244 | - | $Tuple2(nil, [nsbtAmountRaw, usdnPay, wRaw, uRaw, mRaw, sRaw, asInt(kCalcArray[0]), asInt(kCalcArray[1]), asInt(kCalcArray[2]), price, asInt(kCalcArray[3]), asInt(kCalcArray[4]), kCalcArray[5], kCalcArray[6], toString(step1), toString(step2), step3]) | |
206 | + | let price = asInt(neutrinoMetrics[0]) | |
207 | + | let wRaw = asInt(neutrinoMetrics[3]) | |
208 | + | let uRaw = asInt(neutrinoMetrics[5]) | |
209 | + | let sRaw = asInt(neutrinoMetrics[9]) | |
210 | + | let mRaw = value(assetInfo(nsbtAssetId)).quantity | |
211 | + | let kCalcArray = asAnyList(invoke(this, "calculateKREADONLY", [wRaw, uRaw, price, mRaw, sRaw], nil)) | |
212 | + | if ((kCalcArray == kCalcArray)) | |
213 | + | then { | |
214 | + | let multK = parseBigIntValue(asString(kCalcArray[6])) | |
215 | + | let usdnPay = convertWavesToNeutrino(wavesPayRaw, price) | |
216 | + | let bigMaxNsbtSupply = toBigInt(mRaw) | |
217 | + | let bigNsbtSupply = toBigInt((mRaw - sRaw)) | |
218 | + | let step1 = fraction(toBigInt(usdnPay), BIGMULT16, multK) | |
219 | + | let step2 = fraction(step1, bigNsbtSupply, bigMaxNsbtSupply) | |
220 | + | let step3 = toInt(fraction(bigNsbtSupply, bigMaxNsbtSupply, (step2 + bigMaxNsbtSupply))) | |
221 | + | let nsbtAmountRaw = ((mRaw - sRaw) - step3) | |
222 | + | $Tuple2(nil, [nsbtAmountRaw, usdnPay, wRaw, uRaw, mRaw, sRaw, asInt(kCalcArray[0]), asInt(kCalcArray[1]), asInt(kCalcArray[2]), price, asInt(kCalcArray[3]), asInt(kCalcArray[4]), kCalcArray[5], kCalcArray[6], toString(step1), toString(step2), step3]) | |
223 | + | } | |
224 | + | else throw("Strict value is not equal to itself.") | |
245 | 225 | } | |
246 | 226 | else throw("Strict value is not equal to itself.") | |
247 | 227 | } | |
248 | 228 | ||
249 | 229 | ||
250 | 230 | ||
251 | 231 | @Callable(i) | |
252 | - | func | |
232 | + | func calcContractNsbtPriceREADONLY () = calcContractNsbtPriceInternal(unit) | |
253 | 233 | ||
254 | 234 | ||
255 | 235 | ||
256 | 236 | @Callable(i) | |
257 | - | func | |
237 | + | func calcContractNsbtPriceBySupplyREADONLY (nsbtSupply) = calcContractNsbtPriceInternal(nsbtSupply) | |
258 | 238 | ||
259 | 239 | ||
260 | 240 | ||
261 | 241 | @Callable(i) | |
262 | - | func calcUserSwapLimitsMATH (userAddressStr) = { | |
263 | - | let currentPrice = getIntegerValue(controlContract, keyPrice()) | |
264 | - | let userGNsbtAmount = valueOrElse(getInteger(nsbtStakingContract, keyLockParamUserAmount(userAddressStr)), 0) | |
265 | - | let usdnLmtMax = asInt(invoke(this, "calcSwapLimitMATH", [userGNsbtAmount], nil)) | |
266 | - | if ((usdnLmtMax == usdnLmtMax)) | |
267 | - | then { | |
268 | - | let quickSwapResetBlocks = getNumberByKey(neutrinoContract, keyQuickSwapLimitDuration()) | |
269 | - | let lastQuickSwapBlock = valueOrElse(getInteger(neutrinoContract, keyUserLastQuickSwapHeight(userAddressStr)), 0) | |
270 | - | let isNewQuickSwapPeriod = ((height - lastQuickSwapBlock) > quickSwapResetBlocks) | |
271 | - | let quickSwapUserSpent = if (isNewQuickSwapPeriod) | |
272 | - | then 0 | |
273 | - | else valueOrElse(getInteger(neutrinoContract, keyQuickSwapUserSpentInPeriod(userAddressStr)), 0) | |
274 | - | let blcks2LmtReset = if (isNewQuickSwapPeriod) | |
275 | - | then 0 | |
276 | - | else (quickSwapResetBlocks - (height - lastQuickSwapBlock)) | |
277 | - | let wavesLmtMax = convertNeutrinoToWaves(usdnLmtMax, currentPrice) | |
278 | - | $Tuple2(nil, [usdnLmtMax, quickSwapUserSpent, blcks2LmtReset, wavesLmtMax]) | |
279 | - | } | |
280 | - | else throw("Strict value is not equal to itself.") | |
281 | - | } | |
282 | - | ||
283 | - | ||
284 | - | ||
285 | - | @Callable(i) | |
286 | - | func calcNeutinoMetricsMATH () = { | |
242 | + | func calcNeutinoMetricsREADONLY () = { | |
287 | 243 | let currentPrice = getIntegerValue(controlContract, keyPrice()) | |
288 | 244 | let neutrinoLockedBalance = valueOrElse(getInteger(neutrinoContract, keyNeutrinoLockedBalance()), 0) | |
289 | 245 | let wavesLockedBalance = valueOrElse(getInteger(neutrinoContract, keyWavesLockedBalance()), 0) | |
290 | 246 | let reserve = (wavesBalance(neutrinoContract).regular - wavesLockedBalance) | |
291 | 247 | let reservesInUsdn = convertWavesToNeutrino(reserve, currentPrice) | |
292 | - | let neutrinoSupply = (((neutrinoLockedBalance + value(assetInfo(neutrinoAssetId)).quantity) - assetBalance(neutrinoContract, neutrinoAssetId)) - assetBalance( | |
248 | + | let neutrinoSupply = (((neutrinoLockedBalance + value(assetInfo(neutrinoAssetId)).quantity) - assetBalance(neutrinoContract, neutrinoAssetId)) - assetBalance(liquidationContract, neutrinoAssetId)) | |
293 | 249 | let surplus = (reservesInUsdn - neutrinoSupply) | |
294 | 250 | let deficit = (neutrinoSupply - reservesInUsdn) | |
295 | 251 | let surplusPercent = if ((neutrinoSupply == 0)) | |
296 | 252 | then 0 | |
297 | 253 | else (fraction(surplus, PAULI, neutrinoSupply) * 100) | |
298 | 254 | let BR = if ((neutrinoSupply == 0)) | |
299 | 255 | then 0 | |
300 | 256 | else fraction(reservesInUsdn, PAULI, neutrinoSupply) | |
301 | 257 | let nsbtSupplyMAX = value(assetInfo(nsbtAssetId)).quantity | |
302 | 258 | let nsbtSupply = (nsbtSupplyMAX - assetBalance(auctionContract, nsbtAssetId)) | |
303 | 259 | $Tuple2(nil, [currentPrice, neutrinoLockedBalance, wavesLockedBalance, reserve, reservesInUsdn, neutrinoSupply, surplus, surplusPercent, BR, nsbtSupply, nsbtSupplyMAX]) | |
304 | 260 | } | |
305 | 261 | ||
306 | 262 | ||
307 | 263 | ||
308 | 264 | @Callable(i) | |
309 | - | func getUnstakeComissionAmountMATH (amount,startHeight) = { | |
310 | - | let halfLife = getIntOrFail(nsbtStakingContract, keyHalfLife()) | |
311 | - | $Tuple2(nil, fraction(amount, pow(2, 0, fraction(-((height - startHeight)), MULT, halfLife), 8, 8, HALFUP), MULT)) | |
312 | - | } | |
265 | + | func getUnstakeComissionAmountREADONLY (amount,startHeight,halfLife) = $Tuple2(nil, fraction(amount, pow(2, 0, fraction(-((height - startHeight)), MULT, halfLife), 8, 8, HALFUP), MULT)) | |
313 | 266 | ||
314 | 267 | ||
315 | 268 | ||
316 | 269 | @Callable(i) | |
317 | - | func mergeStakesMATH (amount1,height1,amount2,height2) = { | |
318 | - | let halfLife = getIntOrFail(nsbtStakingContract, keyHalfLife()) | |
270 | + | func mergeStakesREADONLY (amount1,height1,amount2,height2,halfLife) = { | |
319 | 271 | let w = fraction(amount2, pow(2, 0, fraction((height2 - height1), MULT, halfLife), 8, 8, HALFUP), MULT) | |
320 | 272 | let v = fraction((amount1 + amount2), MULT, (amount1 + w)) | |
321 | 273 | $Tuple2(nil, (height1 + ((HALF8 - (halfLife * log(v, 8, 2, 0, 8, HALFUP))) / MULT))) | |
322 | 274 | } | |
323 | 275 | ||
324 | 276 |
github/deemru/w8io/026f985 55.35 ms ◑