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