tx · 5pwWcoU3pzyfZZhwvXPwLesUkuGpjdRN8fm5vysaoJY 3N4BmTUvKFXdHoLL61NZs5dR8z5nxoD4KSg: -0.01000000 Waves 2022.03.09 22:19 [1956822] smart account 3N4BmTUvKFXdHoLL61NZs5dR8z5nxoD4KSg > SELF 0.00000000 Waves
{ "type": 13, "id": "5pwWcoU3pzyfZZhwvXPwLesUkuGpjdRN8fm5vysaoJY", "fee": 1000000, "feeAssetId": null, "timestamp": 1646853564420, "version": 1, "sender": "3N4BmTUvKFXdHoLL61NZs5dR8z5nxoD4KSg", "senderPublicKey": "2udg7wHurBjNERLZSz89BiVo7hCYKppKN5hVS9p3hybr", "proofs": [ "3aeMGBqbLR584ELwpNbNaVwf66bzhCqRfPFrwBopJ9HLeFmm3mS35xXb6Jri64pVXACQBvJBU2KGpixGXLwcAsy" ], "script": "base64:AAIFAAAAAAAAAD0IAhIFCgMICAESAwoBARIHCgUBAQEBARIICgYBAQEBAQESABIDCgEBEgMKAQgSABIECgIBARIGCgQBAQEBAAAAOgAAAAAHV0FWRUxFVAAAAAAABfXhAAAAAAAFUEFVTEkAAAAAAAAPQkAAAAAACEJJR1BBVUxJCQABNgAAAAEAAAAAAAAPQkAAAAAACFBSSUNFTEVUAAAAAAAAD0JAAAAAAARNVUxUAAAAAAAF9eEAAAAAAAlCSUdNVUxUMTYJAAE2AAAAAQAAI4byb8EAAAAAAAAJTVVMVFNDQUxFAAAAAAAAAAAIAAAAAAdTQ0FMRTE2AAAAAAAAAAAQAAAAAANTRVACAAAAAl9fAAAAAAVIQUxGOAAAAAAAAvrwgAAAAAALRVVMRVJOVU1CRVIJAAE2AAAAAQAAYJKhE9jVdAAAAAAGc2NhbGU2AAAAAAAAD0JAAAAAAAxzY2FsZTZCaWdJbnQJAAE2AAAAAQAAAAAAAA9CQAAAAAAMc2NhbGU4QmlnSW50CQABNgAAAAEAAAAAAAX14QABAAAAEmtleU5ldXRyaW5vQWRkcmVzcwAAAAACAAAAHSVzJXNfX2Nv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naHQyBAAAAAhoYWxmTGlmZQkBAAAADGdldEludE9yRmFpbAAAAAIFAAAAE25zYnRTdGFraW5nQ29udHJhY3QJAQAAAAtrZXlIYWxmTGlmZQAAAAAEAAAAAXcJAABrAAAAAwUAAAAHYW1vdW50MgkAAGwAAAAGAAAAAAAAAAACAAAAAAAAAAAACQAAawAAAAMJAABlAAAAAgUAAAAHaGVpZ2h0MgUAAAAHaGVpZ2h0MQUAAAAETVVMVAUAAAAIaGFsZkxpZmUAAAAAAAAAAAgAAAAAAAAAAAgFAAAABkhBTEZVUAUAAAAETVVMVAQAAAABdgkAAGsAAAADCQAAZAAAAAIFAAAAB2Ftb3VudDEFAAAAB2Ftb3VudDIFAAAABE1VTFQJAABkAAAAAgUAAAAHYW1vdW50MQUAAAABdwkABRQAAAACBQAAAANuaWwJAABkAAAAAgUAAAAHaGVpZ2h0MQkAAGkAAAACCQAAZQAAAAIFAAAABUhBTEY4CQAAaAAAAAIFAAAACGhhbGZMaWZlCQAAbQAAAAYFAAAAAXYAAAAAAAAAAAgAAAAAAAAAAAIAAAAAAAAAAAAAAAAAAAAAAAgFAAAABkhBTEZVUAUAAAAETVVMVAAAAAC45Koj", "chainId": 84, "height": 1956822, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 5 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let WAVELET = 100000000 | |
5 | + | ||
6 | + | let PAULI = 1000000 | |
7 | + | ||
8 | + | let BIGPAULI = toBigInt(1000000) | |
9 | + | ||
10 | + | let PRICELET = 1000000 | |
11 | + | ||
12 | + | let MULT = 100000000 | |
13 | + | ||
14 | + | let BIGMULT16 = toBigInt(10000000000000000) | |
15 | + | ||
16 | + | let MULTSCALE = 8 | |
17 | + | ||
18 | + | let SCALE16 = 16 | |
19 | + | ||
20 | + | let SEP = "__" | |
21 | + | ||
22 | + | let HALF8 = 50000000 | |
23 | + | ||
24 | + | let EULERNUMBER = toBigInt(27182818284590452) | |
25 | + | ||
26 | + | let scale6 = 1000000 | |
27 | + | ||
28 | + | let scale6BigInt = toBigInt(1000000) | |
29 | + | ||
30 | + | let scale8BigInt = toBigInt(100000000) | |
31 | + | ||
32 | + | func keyNeutrinoAddress () = "%s%s__config__neutrinoAddress" | |
33 | + | ||
34 | + | ||
35 | + | func keySwapAmountAParam () = "%s%s__config__swapAParam" | |
36 | + | ||
37 | + | ||
38 | + | func keyNeutrinoAssetId () = "neutrino_asset_id" | |
39 | + | ||
40 | + | ||
41 | + | func keyLiquidationContractAddress () = "liquidation_contract" | |
42 | + | ||
43 | + | ||
44 | + | func keyRPDContract () = "rpd_contract" | |
45 | + | ||
46 | + | ||
47 | + | func keyAuctionContract () = "auction_contract" | |
48 | + | ||
49 | + | ||
50 | + | func keyContolContract () = "control_contract" | |
51 | + | ||
52 | + | ||
53 | + | func keyBondAssetId () = "bond_asset_id" | |
54 | + | ||
55 | + | ||
56 | + | func keyBalanceLocked () = "balance_lock_" | |
57 | + | ||
58 | + | ||
59 | + | func keyWavesLockedBalance () = (keyBalanceLocked() + "waves") | |
60 | + | ||
61 | + | ||
62 | + | func keyNeutrinoLockedBalance () = (keyBalanceLocked() + "neutrino") | |
63 | + | ||
64 | + | ||
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" | |
81 | + | ||
82 | + | ||
83 | + | func keyUserLastQuickSwapHeight (userAddress) = makeString(["%s%s", "userLastQuickSwapHeight", userAddress], SEP) | |
84 | + | ||
85 | + | ||
86 | + | func keyQuickSwapUserSpentInPeriod (userAddress) = makeString(["%s%s", "quickSwapUserSpentInPeriod", userAddress], SEP) | |
87 | + | ||
88 | + | ||
89 | + | 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 | + | ||
97 | + | ||
98 | + | func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], "")) | |
99 | + | ||
100 | + | ||
101 | + | func getIntOrFail (address,key) = valueOrErrorMessage(getInteger(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], "")) | |
102 | + | ||
103 | + | ||
104 | + | func getNumberByKey (address,key) = valueOrElse(getInteger(address, key), 0) | |
105 | + | ||
106 | + | ||
107 | + | func getBoolOrFail (address,key) = valueOrErrorMessage(getBoolean(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], "")) | |
108 | + | ||
109 | + | ||
110 | + | func convertNeutrinoToWaves (amount,price) = fraction(fraction(amount, PRICELET, price), WAVELET, PAULI) | |
111 | + | ||
112 | + | ||
113 | + | func convertWavesToNeutrino (amount,price) = fraction(fraction(amount, price, PRICELET), PAULI, WAVELET) | |
114 | + | ||
115 | + | ||
116 | + | func toX16 (origVal,origScaleMult) = fraction(toBigInt(origVal), BIGMULT16, toBigInt(origScaleMult)) | |
117 | + | ||
118 | + | ||
119 | + | func fromX16 (val,resultScaleMult) = toInt(fraction(val, toBigInt(resultScaleMult), BIGMULT16)) | |
120 | + | ||
121 | + | ||
122 | + | func asAnyList (val) = match val { | |
123 | + | case valAnyLyst: List[Any] => | |
124 | + | valAnyLyst | |
125 | + | case _ => | |
126 | + | throw("fail to cast into List[Any]") | |
127 | + | } | |
128 | + | ||
129 | + | ||
130 | + | func asInt (val) = match val { | |
131 | + | case valInt: Int => | |
132 | + | valInt | |
133 | + | case _ => | |
134 | + | throw("fail to cast into Int") | |
135 | + | } | |
136 | + | ||
137 | + | ||
138 | + | func asString (val) = match val { | |
139 | + | case valStr: String => | |
140 | + | valStr | |
141 | + | case _ => | |
142 | + | throw("fail to cast into String") | |
143 | + | } | |
144 | + | ||
145 | + | ||
146 | + | let neutrinoContract = addressFromStringValue(getStringOrFail(this, keyNeutrinoAddress())) | |
147 | + | ||
148 | + | let controlContract = addressFromStringValue(getStringOrFail(neutrinoContract, keyContolContract())) | |
149 | + | ||
150 | + | let auctionContract = addressFromStringValue(getStringOrFail(neutrinoContract, keyAuctionContract())) | |
151 | + | ||
152 | + | let liquidationContract = getStringOrFail(neutrinoContract, keyLiquidationContractAddress()) | |
153 | + | ||
154 | + | let rpdContract = getStringOrFail(neutrinoContract, keyRPDContract()) | |
155 | + | ||
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) | |
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 | + | ||
193 | + | @Callable(i) | |
194 | + | func constructor (neutrinoAddress,nsbtLockAddress,swapAmountAParam) = if ((i.caller != this)) | |
195 | + | then throw("not authorized") | |
196 | + | else [StringEntry(keyNeutrinoAddress(), neutrinoAddress), StringEntry(keyNsbtLockContract(), nsbtLockAddress), IntegerEntry(keySwapAmountAParam(), swapAmountAParam)] | |
197 | + | ||
198 | + | ||
199 | + | ||
200 | + | @Callable(i) | |
201 | + | func calcSwapLimitMATH (gNsbtAmount) = { | |
202 | + | let limitParamA = toBigInt(3) | |
203 | + | let gNsbtAmountScale16 = toX16(gNsbtAmount, scale6) | |
204 | + | let limitPowPart = pow(gNsbtAmountScale16, 16, EULERNUMBER, 16, 8, CEILING) | |
205 | + | let limit = fraction(limitParamA, limitPowPart, scale8BigInt) | |
206 | + | $Tuple2(nil, toInt(limit)) | |
207 | + | } | |
208 | + | ||
209 | + | ||
210 | + | ||
211 | + | @Callable(i) | |
212 | + | func calculateKMATH (wRaw,uRaw,price,mRaw,sRaw) = { | |
213 | + | let EXP = toBigInt(2718281) | |
214 | + | let EXPSCALE = 6 | |
215 | + | let a = valueOrElse(getInteger(auctionContract, "nsbtCurveParam_a"), 3) | |
216 | + | let paulB = valueOrElse(getInteger(auctionContract, "nsbtCurveParam_b"), ((3 * PAULI) / 10)) | |
217 | + | let wReservesInUsdn = convertWavesToNeutrino(wRaw, price) | |
218 | + | let multBR = fraction(wReservesInUsdn, MULT, uRaw) | |
219 | + | if ((multBR > 10678564816)) | |
220 | + | then throw("BR > 10678.564816% will overflow exponent") | |
221 | + | else { | |
222 | + | let multPower = (a * (multBR - MULT)) | |
223 | + | let multExpInPower = pow(EXP, EXPSCALE, toBigInt(multPower), MULTSCALE, SCALE16, DOWN) | |
224 | + | let multK = fraction(toBigInt(paulB), multExpInPower, BIGPAULI) | |
225 | + | $Tuple2(nil, [a, paulB, wReservesInUsdn, multBR, multPower, toString(multExpInPower), toString(multK)]) | |
226 | + | } | |
227 | + | } | |
228 | + | ||
229 | + | ||
230 | + | ||
231 | + | @Callable(i) | |
232 | + | func curveFunctionMATH (wRaw,uRaw,price,mRaw,sRaw,wavesPayRaw) = { | |
233 | + | let kCalcArray = asAnyList(invoke(this, "calculateKMATH", [wRaw, uRaw, price, mRaw, sRaw], nil)) | |
234 | + | if ((kCalcArray == kCalcArray)) | |
235 | + | 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]) | |
245 | + | } | |
246 | + | else throw("Strict value is not equal to itself.") | |
247 | + | } | |
248 | + | ||
249 | + | ||
250 | + | ||
251 | + | @Callable(i) | |
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)) | |
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 () = { | |
287 | + | let currentPrice = getIntegerValue(controlContract, keyPrice()) | |
288 | + | let neutrinoLockedBalance = valueOrElse(getInteger(neutrinoContract, keyNeutrinoLockedBalance()), 0) | |
289 | + | let wavesLockedBalance = valueOrElse(getInteger(neutrinoContract, keyWavesLockedBalance()), 0) | |
290 | + | let reserve = (wavesBalance(neutrinoContract).regular - wavesLockedBalance) | |
291 | + | let reservesInUsdn = convertWavesToNeutrino(reserve, currentPrice) | |
292 | + | let neutrinoSupply = (((neutrinoLockedBalance + value(assetInfo(neutrinoAssetId)).quantity) - assetBalance(neutrinoContract, neutrinoAssetId)) - assetBalance(addressFromStringValue(liquidationContract), neutrinoAssetId)) | |
293 | + | let surplus = (reservesInUsdn - neutrinoSupply) | |
294 | + | let deficit = (neutrinoSupply - reservesInUsdn) | |
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) | |
301 | + | let nsbtSupplyMAX = value(assetInfo(nsbtAssetId)).quantity | |
302 | + | let nsbtSupply = (nsbtSupplyMAX - assetBalance(auctionContract, nsbtAssetId)) | |
303 | + | $Tuple2(nil, [currentPrice, neutrinoLockedBalance, wavesLockedBalance, reserve, reservesInUsdn, neutrinoSupply, surplus, surplusPercent, BR, nsbtSupply, nsbtSupplyMAX]) | |
304 | + | } | |
305 | + | ||
306 | + | ||
307 | + | ||
308 | + | @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 | + | } | |
313 | + | ||
314 | + | ||
315 | + | ||
316 | + | @Callable(i) | |
317 | + | func mergeStakesMATH (amount1,height1,amount2,height2) = { | |
318 | + | let halfLife = getIntOrFail(nsbtStakingContract, keyHalfLife()) | |
319 | + | let w = fraction(amount2, pow(2, 0, fraction((height2 - height1), MULT, halfLife), 8, 8, HALFUP), MULT) | |
320 | + | let v = fraction((amount1 + amount2), MULT, (amount1 + w)) | |
321 | + | $Tuple2(nil, (height1 + ((HALF8 - (halfLife * log(v, 8, 2, 0, 8, HALFUP))) / MULT))) | |
322 | + | } | |
323 | + | ||
324 | + |
github/deemru/w8io/169f3d6 30.65 ms ◑