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