tx · HCUkraKw7BiYJp6rQ3rRi2P5mpg6Y7UarD1RWHeSefNY

3N7LYefWk1WhvCsY5A9nTq244SbVPmhCypi:  -0.01400000 Waves

2022.03.22 12:31 [1974953] smart account 3N7LYefWk1WhvCsY5A9nTq244SbVPmhCypi > SELF 0.00000000 Waves

{ "type": 13, "id": "HCUkraKw7BiYJp6rQ3rRi2P5mpg6Y7UarD1RWHeSefNY", "fee": 1400000, "feeAssetId": null, "timestamp": 1647941485019, "version": 1, "sender": "3N7LYefWk1WhvCsY5A9nTq244SbVPmhCypi", "senderPublicKey": "4qGVXRFATZNzo2RZZ5UYHXojGyJgSRBwtgJcCU8rJe5A", "proofs": [ "2Lt4GeDo2dSt4AuroE4jUxReF4hgvyUoVyHX6Y8fhY9qGZzUn2JzSFbvWP7WyHJEMWNLa39KtjyiKJAt3t113hym" ], "script": "base64:AAIFAAAAAAAAADMIAhIFCgMICAESAwoBARIHCgUBAQEBARIDCgEBEgMKAQESABIFCgMBAQESBwoFAQEBAQEAAABBAAAAAAdXQVZFTEVUAAAAAAAF9eEAAAAAAAVQQVVMSQAAAAAAAA9CQAAAAAAIQklHUEFVTEkJAAE2AAAAAQAAAAAAAA9CQAAAAAAIUFJJQ0VMRVQAAAAAAAAPQkAAAAAABE1VTFQAAAAAAAX14QAAAAAACUJJR01VTFQxNgkAATYAAAABAAAjhvJvwQAAAAAAAAlNVUxUU0NBTEUAAAAAAAAAAAgAAAAAB1NDQUxFMTYAAAAAAAAAABAAAAAAA1NFUAIAAAACX18AAAAABUhBTEY4AAAAAAAC+vCAAAAAAAtFVUxFUk5VTUJFUgkAATYAAAABAABgkqET2NV0AAAAAAZzY2FsZTYAAAAAAAAPQkAAAAAADHNjYWxlNkJpZ0ludAkAATYAAAABAAAAAAAAD0JAAAAAAAxzY2FsZThCaWdJbnQJAAE2AAAAAQAAAAAABfXhAAAAAAANc2NhbGUxMEJpZ0ludAkAATYAAAABAAAAAAJUC+QAAAAAAAtrUmVzdWx0SWR4QQA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View: original | compacted Prev: CDRkiBJfw7ETkATcfUYJhhoEuWj26Bm2RZsjHw9X3Tau Next: 5LQET3pBXKVNvZRW6v9Gjt9EyMRGBB9ndrPrrrP2kmaV Diff:
OldNewDifferences
3030 let scale8BigInt = toBigInt(100000000)
3131
3232 let scale10BigInt = toBigInt(10000000000)
33+
34+let kResultIdxA = 0
35+
36+let kResultIdxPaulB = 1
37+
38+let kResultIdxWReservesInUsdn = 2
39+
40+let kResultIdxMultBR = 3
41+
42+let kResultIdxMultPower = 4
43+
44+let kResultIdxMultExpInPowerStr = 5
45+
46+let kResultIdxMultKStr = 6
47+
48+let nMetricIdxPrice = 0
49+
50+let nMetricIdxUsdnLockedBalance = 1
51+
52+let nMetricIdxWavesLockedBalance = 2
53+
54+let nMetricIdxReserve = 3
55+
56+let nMetricIdxReserveInUsdn = 4
57+
58+let nMetricIdxUsdnSupply = 5
59+
60+let nMetricIdxSurplus = 6
61+
62+let nMetricIdxSurplusPercent = 7
63+
64+let nMetricIdxBR = 8
65+
66+let nMetricIdxNsbtSupply = 9
67+
68+let nMetricIdxMaxNsbtSupply = 10
3369
3470 func keyNeutrinoAddress () = "%s%s__config__neutrinoAddress"
3571
135171
136172 func calcContractNsbtPriceInternal (nsbtSupplyDELTA) = {
137173 let neutrinoMetrics = asAnyList(invoke(this, "calcNeutinoMetricsREADONLY", nil, nil))
138- let price = asInt(neutrinoMetrics[0])
139- let wRaw = asInt(neutrinoMetrics[3])
140- let uRaw = asInt(neutrinoMetrics[5])
141- let sRaw = (asInt(neutrinoMetrics[9]) + nsbtSupplyDELTA)
142- let mRaw = asInt(neutrinoMetrics[10])
174+ let price = asInt(neutrinoMetrics[nMetricIdxPrice])
175+ let wRaw = asInt(neutrinoMetrics[nMetricIdxReserve])
176+ let uRaw = (asInt(neutrinoMetrics[nMetricIdxUsdnSupply]) - nsbtSupplyDELTA)
177+ let sRaw = (asInt(neutrinoMetrics[nMetricIdxNsbtSupply]) + nsbtSupplyDELTA)
178+ let mRaw = asInt(neutrinoMetrics[nMetricIdxMaxNsbtSupply])
143179 let kCalcArray = asAnyList(invoke(this, "calculateKREADONLY", [wRaw, uRaw, price, mRaw, sRaw], nil))
144- let multKX16 = parseBigIntValue(asString(kCalcArray[6]))
180+ let multKX16 = parseBigIntValue(asString(kCalcArray[kResultIdxMultKStr]))
145181 let multStep1X16 = fraction(toBigInt(mRaw), BIGMULT16, toBigInt((mRaw - sRaw)))
146182 let multStep2X16 = fraction(multStep1X16, multStep1X16, BIGMULT16)
147183 let multNsbt2usdnPriceX16 = fraction(multKX16, multStep2X16, BIGMULT16)
192228 @Callable(i)
193229 func curveFunctionREADONLY (wavesPayRaw) = {
194230 let neutrinoMetrics = asAnyList(invoke(this, "calcNeutinoMetricsREADONLY", nil, nil))
195- let price = asInt(neutrinoMetrics[0])
196- let wRaw = asInt(neutrinoMetrics[3])
197- let uRaw = asInt(neutrinoMetrics[5])
198- let sRaw = asInt(neutrinoMetrics[9])
199- let mRaw = asInt(neutrinoMetrics[10])
231+ let price = asInt(neutrinoMetrics[nMetricIdxPrice])
232+ let wRaw = asInt(neutrinoMetrics[nMetricIdxReserve])
233+ let uRaw = asInt(neutrinoMetrics[nMetricIdxUsdnSupply])
234+ let sRaw = asInt(neutrinoMetrics[nMetricIdxNsbtSupply])
235+ let mRaw = asInt(neutrinoMetrics[nMetricIdxMaxNsbtSupply])
200236 let kCalcArray = asAnyList(invoke(this, "calculateKREADONLY", [wRaw, uRaw, price, mRaw, sRaw], nil))
201- let multK = parseBigIntValue(asString(kCalcArray[6]))
237+ let multK = parseBigIntValue(asString(kCalcArray[kResultIdxMultKStr]))
202238 let usdnPay = convertWavesToNeutrino(wavesPayRaw, price)
203239 let bigMaxNsbtSupply = toBigInt(mRaw)
204240 let bigNsbtSupply = toBigInt((mRaw - sRaw))
206242 let step2 = fraction(step1, bigNsbtSupply, bigMaxNsbtSupply)
207243 let step3 = toInt(fraction(bigNsbtSupply, bigMaxNsbtSupply, (step2 + bigMaxNsbtSupply)))
208244 let nsbtAmountRaw = ((mRaw - sRaw) - step3)
209- $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+ $Tuple2(nil, [nsbtAmountRaw, usdnPay, wRaw, uRaw, mRaw, sRaw, asInt(kCalcArray[kResultIdxA]), asInt(kCalcArray[kResultIdxPaulB]), asInt(kCalcArray[kResultIdxWReservesInUsdn]), price, asInt(kCalcArray[kResultIdxMultBR]), asInt(kCalcArray[kResultIdxMultPower]), kCalcArray[kResultIdxMultExpInPowerStr], kCalcArray[kResultIdxMultKStr], toString(step1), toString(step2), step3])
210246 }
211247
212248
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let WAVELET = 100000000
55
66 let PAULI = 1000000
77
88 let BIGPAULI = toBigInt(1000000)
99
1010 let PRICELET = 1000000
1111
1212 let MULT = 100000000
1313
1414 let BIGMULT16 = toBigInt(10000000000000000)
1515
1616 let MULTSCALE = 8
1717
1818 let SCALE16 = 16
1919
2020 let SEP = "__"
2121
2222 let HALF8 = 50000000
2323
2424 let EULERNUMBER = toBigInt(27182818284590452)
2525
2626 let scale6 = 1000000
2727
2828 let scale6BigInt = toBigInt(1000000)
2929
3030 let scale8BigInt = toBigInt(100000000)
3131
3232 let scale10BigInt = toBigInt(10000000000)
33+
34+let kResultIdxA = 0
35+
36+let kResultIdxPaulB = 1
37+
38+let kResultIdxWReservesInUsdn = 2
39+
40+let kResultIdxMultBR = 3
41+
42+let kResultIdxMultPower = 4
43+
44+let kResultIdxMultExpInPowerStr = 5
45+
46+let kResultIdxMultKStr = 6
47+
48+let nMetricIdxPrice = 0
49+
50+let nMetricIdxUsdnLockedBalance = 1
51+
52+let nMetricIdxWavesLockedBalance = 2
53+
54+let nMetricIdxReserve = 3
55+
56+let nMetricIdxReserveInUsdn = 4
57+
58+let nMetricIdxUsdnSupply = 5
59+
60+let nMetricIdxSurplus = 6
61+
62+let nMetricIdxSurplusPercent = 7
63+
64+let nMetricIdxBR = 8
65+
66+let nMetricIdxNsbtSupply = 9
67+
68+let nMetricIdxMaxNsbtSupply = 10
3369
3470 func keyNeutrinoAddress () = "%s%s__config__neutrinoAddress"
3571
3672
3773 func keySwapAmountAParam () = "%s%s__config__swapAParam"
3874
3975
4076 func keyNeutrinoAssetId () = "neutrino_asset_id"
4177
4278
4379 func keyLiquidationContractAddress () = "liquidation_contract"
4480
4581
4682 func keyAuctionContract () = "auction_contract"
4783
4884
4985 func keyContolContract () = "control_contract"
5086
5187
5288 func keyBondAssetId () = "bond_asset_id"
5389
5490
5591 func keyBalanceLocked () = "balance_lock_"
5692
5793
5894 func keyWavesLockedBalance () = (keyBalanceLocked() + "waves")
5995
6096
6197 func keyNeutrinoLockedBalance () = (keyBalanceLocked() + "neutrino")
6298
6399
64100 func swapsTimeframeKEY () = "swaps_timeframe"
65101
66102
67103 func keyUserLastQuickSwapHeight (userAddress) = makeString(["%s%s", "userLastQuickSwapHeight", userAddress], SEP)
68104
69105
70106 func keyQuickSwapUserSpentInPeriod (userAddress) = makeString(["%s%s", "quickSwapUserSpentInPeriod", userAddress], SEP)
71107
72108
73109 func keyPrice () = "price"
74110
75111
76112 func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], ""))
77113
78114
79115 func getIntOrFail (address,key) = valueOrErrorMessage(getInteger(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], ""))
80116
81117
82118 func getNumberByKey (address,key) = valueOrElse(getInteger(address, key), 0)
83119
84120
85121 func getBoolOrFail (address,key) = valueOrErrorMessage(getBoolean(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], ""))
86122
87123
88124 func convertNeutrinoToWaves (amount,price) = fraction(fraction(amount, PRICELET, price), WAVELET, PAULI)
89125
90126
91127 func convertWavesToNeutrino (amount,price) = fraction(fraction(amount, price, PRICELET), PAULI, WAVELET)
92128
93129
94130 func toX16 (origVal,origScaleMult) = fraction(toBigInt(origVal), BIGMULT16, toBigInt(origScaleMult))
95131
96132
97133 func fromX16 (val,resultScaleMult) = toInt(fraction(val, toBigInt(resultScaleMult), BIGMULT16))
98134
99135
100136 func asAnyList (val) = match val {
101137 case valAnyLyst: List[Any] =>
102138 valAnyLyst
103139 case _ =>
104140 throw("fail to cast into List[Any]")
105141 }
106142
107143
108144 func asInt (val) = match val {
109145 case valInt: Int =>
110146 valInt
111147 case _ =>
112148 throw("fail to cast into Int")
113149 }
114150
115151
116152 func asString (val) = match val {
117153 case valStr: String =>
118154 valStr
119155 case _ =>
120156 throw("fail to cast into String")
121157 }
122158
123159
124160 let neutrinoContract = addressFromStringValue(getStringOrFail(this, keyNeutrinoAddress()))
125161
126162 let controlContract = addressFromStringValue(getStringOrFail(neutrinoContract, keyContolContract()))
127163
128164 let auctionContract = addressFromStringValue(getStringOrFail(neutrinoContract, keyAuctionContract()))
129165
130166 let liquidationContract = addressFromStringValue(getStringOrFail(neutrinoContract, keyLiquidationContractAddress()))
131167
132168 let neutrinoAssetId = fromBase58String(getStringOrFail(neutrinoContract, keyNeutrinoAssetId()))
133169
134170 let nsbtAssetId = fromBase58String(getStringValue(neutrinoContract, keyBondAssetId()))
135171
136172 func calcContractNsbtPriceInternal (nsbtSupplyDELTA) = {
137173 let neutrinoMetrics = asAnyList(invoke(this, "calcNeutinoMetricsREADONLY", nil, nil))
138- let price = asInt(neutrinoMetrics[0])
139- let wRaw = asInt(neutrinoMetrics[3])
140- let uRaw = asInt(neutrinoMetrics[5])
141- let sRaw = (asInt(neutrinoMetrics[9]) + nsbtSupplyDELTA)
142- let mRaw = asInt(neutrinoMetrics[10])
174+ let price = asInt(neutrinoMetrics[nMetricIdxPrice])
175+ let wRaw = asInt(neutrinoMetrics[nMetricIdxReserve])
176+ let uRaw = (asInt(neutrinoMetrics[nMetricIdxUsdnSupply]) - nsbtSupplyDELTA)
177+ let sRaw = (asInt(neutrinoMetrics[nMetricIdxNsbtSupply]) + nsbtSupplyDELTA)
178+ let mRaw = asInt(neutrinoMetrics[nMetricIdxMaxNsbtSupply])
143179 let kCalcArray = asAnyList(invoke(this, "calculateKREADONLY", [wRaw, uRaw, price, mRaw, sRaw], nil))
144- let multKX16 = parseBigIntValue(asString(kCalcArray[6]))
180+ let multKX16 = parseBigIntValue(asString(kCalcArray[kResultIdxMultKStr]))
145181 let multStep1X16 = fraction(toBigInt(mRaw), BIGMULT16, toBigInt((mRaw - sRaw)))
146182 let multStep2X16 = fraction(multStep1X16, multStep1X16, BIGMULT16)
147183 let multNsbt2usdnPriceX16 = fraction(multKX16, multStep2X16, BIGMULT16)
148184 let nsbt2usdnPrice = toInt(fraction(multNsbt2usdnPriceX16, toBigInt(PAULI), BIGMULT16))
149185 let nsbt2wavesPrice = fraction(nsbt2usdnPrice, PAULI, price)
150186 $Tuple2(nil, [nsbt2usdnPrice, nsbt2wavesPrice])
151187 }
152188
153189
154190 @Callable(i)
155191 func constructor (neutrinoAddress,nsbtLockAddress,swapAmountAParam) = if ((i.caller != this))
156192 then throw("not authorized")
157193 else [StringEntry(keyNeutrinoAddress(), neutrinoAddress), IntegerEntry(keySwapAmountAParam(), swapAmountAParam)]
158194
159195
160196
161197 @Callable(i)
162198 func calcSwapLimitREADONLY (gNsbtAmount) = {
163199 let limitParamA = toBigInt(getIntOrFail(this, keySwapAmountAParam()))
164200 let gNsbtAmountScale16 = toX16(gNsbtAmount, scale6)
165201 let limitPowPart = pow(gNsbtAmountScale16, 16, EULERNUMBER, 16, 8, CEILING)
166202 let limit = fraction(limitParamA, limitPowPart, scale10BigInt)
167203 $Tuple2(nil, toInt(limit))
168204 }
169205
170206
171207
172208 @Callable(i)
173209 func calculateKREADONLY (wRaw,uRaw,price,mRaw,sRaw) = {
174210 let EXP = toBigInt(2718281)
175211 let EXPSCALE = 6
176212 let a = valueOrElse(getInteger(auctionContract, "nsbtCurveParam_a"), 3)
177213 let paulB = valueOrElse(getInteger(auctionContract, "nsbtCurveParam_b"), ((3 * PAULI) / 10))
178214 let wReservesInUsdn = convertWavesToNeutrino(wRaw, price)
179215 let multBR = fraction(wReservesInUsdn, MULT, uRaw)
180216 if ((multBR > 10678564816))
181217 then throw("BR > 10678.564816% will overflow exponent")
182218 else {
183219 let multPower = (a * (multBR - MULT))
184220 let multExpInPower = pow(EXP, EXPSCALE, toBigInt(multPower), MULTSCALE, SCALE16, DOWN)
185221 let multK = fraction(toBigInt(paulB), multExpInPower, BIGPAULI)
186222 $Tuple2(nil, [a, paulB, wReservesInUsdn, multBR, multPower, toString(multExpInPower), toString(multK)])
187223 }
188224 }
189225
190226
191227
192228 @Callable(i)
193229 func curveFunctionREADONLY (wavesPayRaw) = {
194230 let neutrinoMetrics = asAnyList(invoke(this, "calcNeutinoMetricsREADONLY", nil, nil))
195- let price = asInt(neutrinoMetrics[0])
196- let wRaw = asInt(neutrinoMetrics[3])
197- let uRaw = asInt(neutrinoMetrics[5])
198- let sRaw = asInt(neutrinoMetrics[9])
199- let mRaw = asInt(neutrinoMetrics[10])
231+ let price = asInt(neutrinoMetrics[nMetricIdxPrice])
232+ let wRaw = asInt(neutrinoMetrics[nMetricIdxReserve])
233+ let uRaw = asInt(neutrinoMetrics[nMetricIdxUsdnSupply])
234+ let sRaw = asInt(neutrinoMetrics[nMetricIdxNsbtSupply])
235+ let mRaw = asInt(neutrinoMetrics[nMetricIdxMaxNsbtSupply])
200236 let kCalcArray = asAnyList(invoke(this, "calculateKREADONLY", [wRaw, uRaw, price, mRaw, sRaw], nil))
201- let multK = parseBigIntValue(asString(kCalcArray[6]))
237+ let multK = parseBigIntValue(asString(kCalcArray[kResultIdxMultKStr]))
202238 let usdnPay = convertWavesToNeutrino(wavesPayRaw, price)
203239 let bigMaxNsbtSupply = toBigInt(mRaw)
204240 let bigNsbtSupply = toBigInt((mRaw - sRaw))
205241 let step1 = fraction(toBigInt(usdnPay), BIGMULT16, multK)
206242 let step2 = fraction(step1, bigNsbtSupply, bigMaxNsbtSupply)
207243 let step3 = toInt(fraction(bigNsbtSupply, bigMaxNsbtSupply, (step2 + bigMaxNsbtSupply)))
208244 let nsbtAmountRaw = ((mRaw - sRaw) - step3)
209- $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+ $Tuple2(nil, [nsbtAmountRaw, usdnPay, wRaw, uRaw, mRaw, sRaw, asInt(kCalcArray[kResultIdxA]), asInt(kCalcArray[kResultIdxPaulB]), asInt(kCalcArray[kResultIdxWReservesInUsdn]), price, asInt(kCalcArray[kResultIdxMultBR]), asInt(kCalcArray[kResultIdxMultPower]), kCalcArray[kResultIdxMultExpInPowerStr], kCalcArray[kResultIdxMultKStr], toString(step1), toString(step2), step3])
210246 }
211247
212248
213249
214250 @Callable(i)
215251 func calcContractNsbtPriceSYSREADONLY (nsbtSupplyDELTA) = calcContractNsbtPriceInternal(nsbtSupplyDELTA)
216252
217253
218254
219255 @Callable(i)
220256 func calcNeutinoMetricsREADONLY () = {
221257 let currentPrice = getIntegerValue(controlContract, keyPrice())
222258 let neutrinoLockedBalance = valueOrElse(getInteger(neutrinoContract, keyNeutrinoLockedBalance()), 0)
223259 let wavesLockedBalance = valueOrElse(getInteger(neutrinoContract, keyWavesLockedBalance()), 0)
224260 let reserve = (wavesBalance(neutrinoContract).regular - wavesLockedBalance)
225261 let reservesInUsdn = convertWavesToNeutrino(reserve, currentPrice)
226262 let neutrinoSupply = (((neutrinoLockedBalance + value(assetInfo(neutrinoAssetId)).quantity) - assetBalance(neutrinoContract, neutrinoAssetId)) - assetBalance(liquidationContract, neutrinoAssetId))
227263 let surplus = (reservesInUsdn - neutrinoSupply)
228264 let deficit = (neutrinoSupply - reservesInUsdn)
229265 let surplusPercent = if ((neutrinoSupply == 0))
230266 then 0
231267 else (fraction(surplus, PAULI, neutrinoSupply) * 100)
232268 let BR = if ((neutrinoSupply == 0))
233269 then 0
234270 else fraction(reservesInUsdn, PAULI, neutrinoSupply)
235271 let nsbtSupplyMAX = value(assetInfo(nsbtAssetId)).quantity
236272 let nsbtSupply = (nsbtSupplyMAX - assetBalance(auctionContract, nsbtAssetId))
237273 $Tuple2(nil, [currentPrice, neutrinoLockedBalance, wavesLockedBalance, reserve, reservesInUsdn, neutrinoSupply, surplus, surplusPercent, BR, nsbtSupply, nsbtSupplyMAX])
238274 }
239275
240276
241277
242278 @Callable(i)
243279 func getUnstakeComissionAmountREADONLY (amount,startHeight,halfLife) = $Tuple2(nil, fraction(amount, pow(2, 0, fraction(-((height - startHeight)), MULT, halfLife), 8, 8, HALFUP), MULT))
244280
245281
246282
247283 @Callable(i)
248284 func mergeStakesREADONLY (amount1,height1,amount2,height2,halfLife) = {
249285 let w = fraction(amount2, pow(2, 0, fraction((height2 - height1), MULT, halfLife), 8, 8, HALFUP), MULT)
250286 let v = fraction((amount1 + amount2), MULT, (amount1 + w))
251287 $Tuple2(nil, (height1 + ((HALF8 - (halfLife * log(v, 8, 2, 0, 8, HALFUP))) / MULT)))
252288 }
253289
254290

github/deemru/w8io/026f985 
46.78 ms