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