tx · FC2xqgkk5T7ZHr9vJXzEHX1sMGDfdVmoBxGswLoaL1W7 3Mzep1R5kHeC1ecKFkWjuhU3Gw4LAdCib9N: -0.01500000 Waves 2024.02.05 17:06 [2963057] smart account 3Mzep1R5kHeC1ecKFkWjuhU3Gw4LAdCib9N > SELF 0.00000000 Waves
{ "type": 13, "id": "FC2xqgkk5T7ZHr9vJXzEHX1sMGDfdVmoBxGswLoaL1W7", "fee": 1500000, "feeAssetId": null, "timestamp": 1707141952214, "version": 2, "chainId": 84, "sender": "3Mzep1R5kHeC1ecKFkWjuhU3Gw4LAdCib9N", "senderPublicKey": "41THq9VrFxHEvVGJyz2oMpJQErnSkkqJXpBypSDxa5Mv", "proofs": [ "32hmuAv2rM99pmdnQjoLHogxDVM6QPRhv9zx5LQ7bDZuAcxrsqoFT7TQXVybmMo8z3pdorcfBD1tcc331QB4BwRy" ], "script": "base64:BwIkCAISAwoBGBIDCgEYEgQKAgIYEgQKAgIYEgQKAgIYEgQKAgIYJwAHY2hhaW5JZAkAyQECCQDKAQIIBQR0aGlzBWJ5dGVzAAEAAQAIY2hhaW5JZFQBAVQACGNoYWluSWRXAQFXAANTRVACAl9fAAVXQVZFUwIFV0FWRVMAEGNvbnRyYWN0RmlsZW5hbWUCFXd4ZGFvX2NhbGN1bGF0b3IucmlkZQAFbXVsdDgAgMLXLwAGbXVsdDE4CQC2AgEAgICQu7rWrfANAA13YXZlc0RlY2ltYWxzAAgADHVzZHREZWNpbWFscwAGAQV0b1gxOAIHb3JpZ1ZhbA1vcmlnU2NhbGVNdWx0CQC8AgMJALYCAQUHb3JpZ1ZhbAUGbXVsdDE4CQC2AgEFDW9yaWdTY2FsZU11bHQBB2Zyb21YMTgCA3ZhbA9yZXN1bHRTY2FsZU11bHQJAKADAQkAvAIDBQN2YWwJALYCAQUPcmVzdWx0U2NhbGVNdWx0BQZtdWx0MTgBB3dyYXBFcnIBAXMJAKwCAgkArAICBRBjb250cmFjdEZpbGVuYW1lAgI6IAUBcw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CQEEQnVybgIFDnBheW1lbnRBc3NldElkCAUHcGF5bWVudAZhbW91bnQFA25pbAUOZmFjdG9yeUFjdGlvbnMJAAIBAiRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4JAAIBAiRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4JAAIBAiRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4BaQEFcHJpY2UCD2NhbGxlclB1YmxpY0tleQRhcmdzBA5mYWN0b3J5QWRkcmVzcwgFAWkGY2FsbGVyCQCUCgIFA25pbAgJAQljYWxjUHJpY2UBBQ5mYWN0b3J5QWRkcmVzcwJfMQFpAQpwcmljZURlYnVnAg9jYWxsZXJQdWJsaWNLZXkEYXJncwQOZmFjdG9yeUFkZHJlc3MIBQFpBmNhbGxlcgkAlAoCBQNuaWwICQEJY2FsY1ByaWNlAQUOZmFjdG9yeUFkZHJlc3MCXzIBaQEQZ2V0VHJlYXN1cnlWYWx1ZQIPY2FsbGVyUHVibGljS2V5BGFyZ3MEDmZhY3RvcnlBZGRyZXNzCAUBaQZjYWxsZXIEDXRyZWFzdXJ5VmFsdWUJAQdmcm9tWDE4AgkBEWNhbGNUcmVhc3VyeVZhbHVlAQUOZmFjdG9yeUFkZHJlc3MJAGwGAAoAAAUMdXNkdERlY2ltYWxzAAAAAAUERE9XTgkAlAoCBQNuaWwFDXRyZWFzdXJ5VmFsdWUBAnR4AQZ2ZXJpZnkACQAAAgUHY2hhaW5JZAUIY2hhaW5JZFQhdi4z", "height": 2963057, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: Ao1D6kXB1VYukfrWXx1rb9qsJ27WMaSiE2QBc1BBcv2y Next: 2oJsntcxnVq5Kag446GkvE8aDPKHpvRumR4amMFP3NiF Diff:
Old | New | Differences | |
---|---|---|---|
378 | 378 | else throwErr("invalid wx price") | |
379 | 379 | let wxdaoQuantity = getAssetInfoOrFail(getLpAssetId(factoryAddress)).quantity | |
380 | 380 | let wxDaoPrice = (((pwrPrice + fraction((factoryAddressWxBalance * 100), wxPrice, wxdaoQuantity)) + fraction(max([treasuryValueDiff, 0]), 2, (10 * pwrAmount))) / 100) | |
381 | - | $Tuple2(wxDaoPrice, [["wxDaoPrice", wxDaoPrice], ["pwrPrice", pwrPrice], ["factoryAddressWxBalance", factoryAddressWxBalance], ["wxPrice", wxPrice], ["wxdaoQuantity", wxdaoQuantity], ["treasuryValueDiff", treasuryValueDiff], ["pwrAmount", pwrAmount]]) | |
381 | + | $Tuple2(wxDaoPrice, [["wxDaoPrice", wxDaoPrice], ["pwrPrice", pwrPrice], ["factoryAddressWxBalance", factoryAddressWxBalance], ["wxPrice", wxPrice], ["wxdaoQuantity", wxdaoQuantity], ["treasuryValueDiff", treasuryValueDiff], ["pwrAmount", pwrAmount], ["skinTotal", skinTotal], ["pwrRemaining", pwrRemaining]]) | |
382 | 382 | } | |
383 | 383 | ||
384 | 384 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 7 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let chainId = take(drop(this.bytes, 1), 1) | |
5 | 5 | ||
6 | 6 | let chainIdT = base58'2T' | |
7 | 7 | ||
8 | 8 | let chainIdW = base58'2W' | |
9 | 9 | ||
10 | 10 | let SEP = "__" | |
11 | 11 | ||
12 | 12 | let WAVES = "WAVES" | |
13 | 13 | ||
14 | 14 | let contractFilename = "wxdao_calculator.ride" | |
15 | 15 | ||
16 | 16 | let mult8 = 100000000 | |
17 | 17 | ||
18 | 18 | let mult18 = toBigInt(1000000000000000000) | |
19 | 19 | ||
20 | 20 | let wavesDecimals = 8 | |
21 | 21 | ||
22 | 22 | let usdtDecimals = 6 | |
23 | 23 | ||
24 | 24 | func toX18 (origVal,origScaleMult) = fraction(toBigInt(origVal), mult18, toBigInt(origScaleMult)) | |
25 | 25 | ||
26 | 26 | ||
27 | 27 | func fromX18 (val,resultScaleMult) = toInt(fraction(val, toBigInt(resultScaleMult), mult18)) | |
28 | 28 | ||
29 | 29 | ||
30 | 30 | func wrapErr (s) = ((contractFilename + ": ") + s) | |
31 | 31 | ||
32 | 32 | ||
33 | 33 | func throwErr (s) = throw(wrapErr(s)) | |
34 | 34 | ||
35 | 35 | ||
36 | 36 | let wxAssetId = if ((chainId == chainIdW)) | |
37 | 37 | then base58'Atqv59EYzjFGuitKVnMRk6H8FukjoV3ktPorbEys25on' | |
38 | 38 | else if ((chainId == chainIdT)) | |
39 | 39 | then base58'EMAMLxDnv3xiz8RXg8Btj33jcEw3wLczL3JKYYmuubpc' | |
40 | 40 | else throwErr("invalid chain id") | |
41 | 41 | ||
42 | 42 | func keyCurrentPeriod () = makeString(["%s", "currentPeriod"], SEP) | |
43 | 43 | ||
44 | 44 | ||
45 | 45 | func keyStartHeightByPeriod (period) = makeString(["%s%d", "startHeight", toString(period)], SEP) | |
46 | 46 | ||
47 | 47 | ||
48 | 48 | func keyPeriodLength () = makeString(["%s", "periodLength"], SEP) | |
49 | 49 | ||
50 | 50 | ||
51 | 51 | func keyTreasuryValueByPeriod (period) = makeString(["%s%d", "treasuryValue", toString(period)], SEP) | |
52 | 52 | ||
53 | 53 | ||
54 | 54 | func keySkinTotal (treasuryAddress) = ("skin_total_" + toString(treasuryAddress)) | |
55 | 55 | ||
56 | 56 | ||
57 | 57 | func keyPowerConfigAddress () = "%s__powerConfigAddress" | |
58 | 58 | ||
59 | 59 | ||
60 | 60 | func powerConfigAddress (factoryAddress) = valueOrErrorMessage(match getString(factoryAddress, keyPowerConfigAddress()) { | |
61 | 61 | case s: String => | |
62 | 62 | addressFromString(s) | |
63 | 63 | case _: Unit => | |
64 | 64 | unit | |
65 | 65 | case _ => | |
66 | 66 | throw("Match error") | |
67 | 67 | }, wrapErr("invalid power config address")) | |
68 | 68 | ||
69 | 69 | ||
70 | 70 | func keyPowerAssetId () = "powerAssetId" | |
71 | 71 | ||
72 | 72 | ||
73 | 73 | func getPowerAssetId (factoryAddress) = fromBase58String(valueOrErrorMessage(getString(powerConfigAddress(factoryAddress), keyPowerAssetId()), wrapErr("invalid power asset id"))) | |
74 | 74 | ||
75 | 75 | ||
76 | 76 | func keyPowerContractAddress () = "%s__powerContractAddress" | |
77 | 77 | ||
78 | 78 | ||
79 | 79 | func powerContractAddress (factoryAddress) = valueOrErrorMessage(match getString(factoryAddress, keyPowerContractAddress()) { | |
80 | 80 | case s: String => | |
81 | 81 | addressFromString(s) | |
82 | 82 | case _: Unit => | |
83 | 83 | unit | |
84 | 84 | case _ => | |
85 | 85 | throw("Match error") | |
86 | 86 | }, wrapErr("invalid power contract address")) | |
87 | 87 | ||
88 | 88 | ||
89 | 89 | func keyPoolsFactoryAddress () = "%s__poolsFactoryAddress" | |
90 | 90 | ||
91 | 91 | ||
92 | 92 | func getPoolsFactoryAddress (factoryAddress) = valueOrErrorMessage(match getString(factoryAddress, keyPoolsFactoryAddress()) { | |
93 | 93 | case s: String => | |
94 | 94 | addressFromString(s) | |
95 | 95 | case _: Unit => | |
96 | 96 | unit | |
97 | 97 | case _ => | |
98 | 98 | throw("Match error") | |
99 | 99 | }, wrapErr("invalid pools factory address")) | |
100 | 100 | ||
101 | 101 | ||
102 | 102 | func keyTreasuryAddress () = "%s__treasuryAddress" | |
103 | 103 | ||
104 | 104 | ||
105 | 105 | func getTreasuryAddress (factoryAddress) = valueOrErrorMessage(match getString(factoryAddress, keyTreasuryAddress()) { | |
106 | 106 | case s: String => | |
107 | 107 | addressFromString(s) | |
108 | 108 | case _: Unit => | |
109 | 109 | unit | |
110 | 110 | case _ => | |
111 | 111 | throw("Match error") | |
112 | 112 | }, wrapErr("invalid treasury address")) | |
113 | 113 | ||
114 | 114 | ||
115 | 115 | func keyAssets () = "%s__assets" | |
116 | 116 | ||
117 | 117 | ||
118 | 118 | func getAssetsStr (factoryAddress) = valueOrErrorMessage(getString(factoryAddress, keyAssets()), wrapErr("invalid assets")) | |
119 | 119 | ||
120 | 120 | ||
121 | 121 | func keyLpAssetId () = "%s__lpAssetId" | |
122 | 122 | ||
123 | 123 | ||
124 | 124 | func getLpAssetId (factoryAddress) = fromBase58String(valueOrErrorMessage(getString(factoryAddress, keyLpAssetId()), wrapErr("invalid lp asset id"))) | |
125 | 125 | ||
126 | 126 | ||
127 | 127 | func getAssetInfoOrFail (assetId) = valueOrErrorMessage(assetInfo(assetId), wrapErr("invalid asset info")) | |
128 | 128 | ||
129 | 129 | ||
130 | 130 | func getAssetsBalances (targetAddress,assetIdList) = { | |
131 | 131 | func map (acc,nextAssetIdStr) = { | |
132 | 132 | let balance = if ((nextAssetIdStr == WAVES)) | |
133 | 133 | then toX18(wavesBalance(targetAddress).available, pow(10, 0, wavesDecimals, 0, 0, DOWN)) | |
134 | 134 | else { | |
135 | 135 | let assetId = fromBase58String(nextAssetIdStr) | |
136 | 136 | let assetDecimals = getAssetInfoOrFail(assetId).decimals | |
137 | 137 | toX18(assetBalance(targetAddress, assetId), pow(10, 0, assetDecimals, 0, 0, DOWN)) | |
138 | 138 | } | |
139 | 139 | (acc :+ balance) | |
140 | 140 | } | |
141 | 141 | ||
142 | 142 | let $l = assetIdList | |
143 | 143 | let $s = size($l) | |
144 | 144 | let $acc0 = nil | |
145 | 145 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
146 | 146 | then $a | |
147 | 147 | else map($a, $l[$i]) | |
148 | 148 | ||
149 | 149 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
150 | 150 | then $a | |
151 | 151 | else throw("List size exceeds 10") | |
152 | 152 | ||
153 | 153 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10) | |
154 | 154 | } | |
155 | 155 | ||
156 | 156 | ||
157 | 157 | func getAssetsPrices (poolsFactoryAddress,assetIdList) = if ((chainId == chainIdW)) | |
158 | 158 | then { | |
159 | 159 | let wavesUsdtAddressStr = "3PKfrupEydU2nZAghVjZAfvCwMBkzuR1F52" | |
160 | 160 | let wavesUsdtPrice = parseBigIntValue({ | |
161 | 161 | let @ = invoke(poolsFactoryAddress, "getPrice", [wavesUsdtAddressStr], nil) | |
162 | 162 | if ($isInstanceOf(@, "String")) | |
163 | 163 | then @ | |
164 | 164 | else throw(($getType(@) + " couldn't be cast to String")) | |
165 | 165 | }) | |
166 | 166 | let wavesXtnAddressStr = "3PPZWgFNRKHLvM51pwS934C8VZ7d2F4Z58g" | |
167 | 167 | let wavesXtnPrice = parseBigIntValue({ | |
168 | 168 | let @ = invoke(poolsFactoryAddress, "getPrice", [wavesXtnAddressStr], nil) | |
169 | 169 | if ($isInstanceOf(@, "String")) | |
170 | 170 | then @ | |
171 | 171 | else throw(($getType(@) + " couldn't be cast to String")) | |
172 | 172 | }) | |
173 | 173 | let xtnUsdtPrice = fraction(wavesUsdtPrice, mult18, wavesXtnPrice) | |
174 | 174 | func map (acc,nextAssetId) = { | |
175 | 175 | let price = match nextAssetId { | |
176 | 176 | case _ => | |
177 | 177 | if (("2thsACuHmzDMuNezPM32wg9a3BwUzBWDeSKakgz3cw21" == $match0)) | |
178 | 178 | then { | |
179 | 179 | let pwrWavesAddressStr = "3PDi7Qq8pLQYvtKyTfQuqqPUWyhoYbU957t" | |
180 | 180 | let pwrWavesPrice = parseBigIntValue({ | |
181 | 181 | let @ = invoke(poolsFactoryAddress, "getPrice", [pwrWavesAddressStr], nil) | |
182 | 182 | if ($isInstanceOf(@, "String")) | |
183 | 183 | then @ | |
184 | 184 | else throw(($getType(@) + " couldn't be cast to String")) | |
185 | 185 | }) | |
186 | 186 | fraction(pwrWavesPrice, wavesUsdtPrice, mult18) | |
187 | 187 | } | |
188 | 188 | else if (("Atqv59EYzjFGuitKVnMRk6H8FukjoV3ktPorbEys25on" == $match0)) | |
189 | 189 | then { | |
190 | 190 | let wxWavesAddressStr = "3PFzaH2ghpwANHFgjeva83N1yxzErELx2eh" | |
191 | 191 | let wxWavesPrice = parseBigIntValue({ | |
192 | 192 | let @ = invoke(poolsFactoryAddress, "getPrice", [wxWavesAddressStr], nil) | |
193 | 193 | if ($isInstanceOf(@, "String")) | |
194 | 194 | then @ | |
195 | 195 | else throw(($getType(@) + " couldn't be cast to String")) | |
196 | 196 | }) | |
197 | 197 | fraction(wxWavesPrice, wavesUsdtPrice, mult18) | |
198 | 198 | } | |
199 | 199 | else if (("34N9YcEETLWn93qYQ64EsP1x89tSruJU44RrEMSXXEPJ" == $match0)) | |
200 | 200 | then { | |
201 | 201 | let wavesUsdtwxgAddressStr = "3PKMVZ7kQeaREajYi8Yc25Ro6mcNw5D6QSa" | |
202 | 202 | let wavesUsdtwxgPrice = parseBigIntValue({ | |
203 | 203 | let @ = invoke(poolsFactoryAddress, "getPrice", [wavesUsdtwxgAddressStr], nil) | |
204 | 204 | if ($isInstanceOf(@, "String")) | |
205 | 205 | then @ | |
206 | 206 | else throw(($getType(@) + " couldn't be cast to String")) | |
207 | 207 | }) | |
208 | 208 | fraction(wavesUsdtPrice, mult18, wavesUsdtwxgPrice) | |
209 | 209 | } | |
210 | 210 | else if (("6XtHjpXbs9RRJP2Sr9GUyVqzACcby9TkThHXnjVC5CDJ" == $match0)) | |
211 | 211 | then { | |
212 | 212 | let wavesUsdcwxgAddressStr = "3P3g3eipfG2NZKKQE8DZXt2E9tRJqii9jcX" | |
213 | 213 | let wavesUsdcwxgPrice = parseBigIntValue({ | |
214 | 214 | let @ = invoke(poolsFactoryAddress, "getPrice", [wavesUsdcwxgAddressStr], nil) | |
215 | 215 | if ($isInstanceOf(@, "String")) | |
216 | 216 | then @ | |
217 | 217 | else throw(($getType(@) + " couldn't be cast to String")) | |
218 | 218 | }) | |
219 | 219 | fraction(wavesUsdtPrice, mult18, wavesUsdcwxgPrice) | |
220 | 220 | } | |
221 | 221 | else if (("HZk1mbfuJpmxU1Fs4AX5MWLVYtctsNcg6e2C6VKqK8zk" == $match0)) | |
222 | 222 | then { | |
223 | 223 | let ltcwxgXtnAddressStr = "3P94wvu5gA7VhjPgAB3twaeqdwHCwNK2vsn" | |
224 | 224 | let ltcwxgXtnPrice = parseBigIntValue({ | |
225 | 225 | let @ = invoke(poolsFactoryAddress, "getPrice", [ltcwxgXtnAddressStr], nil) | |
226 | 226 | if ($isInstanceOf(@, "String")) | |
227 | 227 | then @ | |
228 | 228 | else throw(($getType(@) + " couldn't be cast to String")) | |
229 | 229 | }) | |
230 | 230 | fraction(ltcwxgXtnPrice, xtnUsdtPrice, mult18) | |
231 | 231 | } | |
232 | 232 | else if (("474jTeYx2r2Va35794tCScAXWJG9hU2HcgxzMowaZUnu" == $match0)) | |
233 | 233 | then { | |
234 | 234 | let ethwxgWavesAddressStr = "3P3XGTN6s292g9iwYhs3TEqJqHiffQYojuE" | |
235 | 235 | let ethwxgWavesPrice = parseBigIntValue({ | |
236 | 236 | let @ = invoke(poolsFactoryAddress, "getPrice", [ethwxgWavesAddressStr], nil) | |
237 | 237 | if ($isInstanceOf(@, "String")) | |
238 | 238 | then @ | |
239 | 239 | else throw(($getType(@) + " couldn't be cast to String")) | |
240 | 240 | }) | |
241 | 241 | fraction(ethwxgWavesPrice, wavesUsdtPrice, mult18) | |
242 | 242 | } | |
243 | 243 | else if (("8LQW8f7P5d5PZM7GtZEBgaqRPGSzS3DfPuiXrURJ4AJS" == $match0)) | |
244 | 244 | then { | |
245 | 245 | let btcwxgXtnAddressStr = "3PCBWDTA6jrFswd7gQgaE3Xk7gLM5RKofvp" | |
246 | 246 | let btcwxgXtnPrice = parseBigIntValue({ | |
247 | 247 | let @ = invoke(poolsFactoryAddress, "getPrice", [btcwxgXtnAddressStr], nil) | |
248 | 248 | if ($isInstanceOf(@, "String")) | |
249 | 249 | then @ | |
250 | 250 | else throw(($getType(@) + " couldn't be cast to String")) | |
251 | 251 | }) | |
252 | 252 | fraction(btcwxgXtnPrice, xtnUsdtPrice, mult18) | |
253 | 253 | } | |
254 | 254 | else throwErr("invalid asset id") | |
255 | 255 | } | |
256 | 256 | (acc :+ price) | |
257 | 257 | } | |
258 | 258 | ||
259 | 259 | let $l = assetIdList | |
260 | 260 | let $s = size($l) | |
261 | 261 | let $acc0 = nil | |
262 | 262 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
263 | 263 | then $a | |
264 | 264 | else map($a, $l[$i]) | |
265 | 265 | ||
266 | 266 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
267 | 267 | then $a | |
268 | 268 | else throw("List size exceeds 10") | |
269 | 269 | ||
270 | 270 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10) | |
271 | 271 | } | |
272 | 272 | else if ((chainId == chainIdT)) | |
273 | 273 | then { | |
274 | 274 | func map (acc,nextAssetId) = { | |
275 | 275 | let price = match nextAssetId { | |
276 | 276 | case _ => | |
277 | 277 | if (("EMAMLxDnv3xiz8RXg8Btj33jcEw3wLczL3JKYYmuubpc" == $match0)) | |
278 | 278 | then { | |
279 | 279 | let wxUsdtAddressStr = "3MrULQRLc52GWrJF1tMcAm4M78fPe57o9Kt" | |
280 | 280 | let wxUsdtPrice = parseBigIntValue({ | |
281 | 281 | let @ = invoke(poolsFactoryAddress, "getPrice", [wxUsdtAddressStr], nil) | |
282 | 282 | if ($isInstanceOf(@, "String")) | |
283 | 283 | then @ | |
284 | 284 | else throw(($getType(@) + " couldn't be cast to String")) | |
285 | 285 | }) | |
286 | 286 | wxUsdtPrice | |
287 | 287 | } | |
288 | 288 | else if (("A7Ksh7fXyqm1KhKAiK3bAB2aiPSitQQF6v1pyu9SS3FR" == $match0)) | |
289 | 289 | then { | |
290 | 290 | let usdcUsdtAddressStr = "3MzKSdTH2jFbypLsoNfrH7QgkzSbx3EYwCA" | |
291 | 291 | let usdcUsdtPrice = parseBigIntValue({ | |
292 | 292 | let @ = invoke(poolsFactoryAddress, "getPrice", [usdcUsdtAddressStr], nil) | |
293 | 293 | if ($isInstanceOf(@, "String")) | |
294 | 294 | then @ | |
295 | 295 | else throw(($getType(@) + " couldn't be cast to String")) | |
296 | 296 | }) | |
297 | 297 | usdcUsdtPrice | |
298 | 298 | } | |
299 | 299 | else if (("8Q6SE2ANebufw8JuPjJVRjZD6drD8ihjNjM8xaGUSfdR" == $match0)) | |
300 | 300 | then { | |
301 | 301 | let price = toX18(150000000, pow(10, 0, usdtDecimals, 0, 0, DOWN)) | |
302 | 302 | price | |
303 | 303 | } | |
304 | 304 | else throwErr("invalid asset id") | |
305 | 305 | } | |
306 | 306 | (acc :+ price) | |
307 | 307 | } | |
308 | 308 | ||
309 | 309 | let $l = assetIdList | |
310 | 310 | let $s = size($l) | |
311 | 311 | let $acc0 = nil | |
312 | 312 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
313 | 313 | then $a | |
314 | 314 | else map($a, $l[$i]) | |
315 | 315 | ||
316 | 316 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
317 | 317 | then $a | |
318 | 318 | else throw("List size exceeds 10") | |
319 | 319 | ||
320 | 320 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10) | |
321 | 321 | } | |
322 | 322 | else throwErr("invalid chain id") | |
323 | 323 | ||
324 | 324 | ||
325 | 325 | func calcTreasuryValue (factoryAddress) = { | |
326 | 326 | let treasuryAddress = getTreasuryAddress(factoryAddress) | |
327 | 327 | let poolsFactoryAddress = getPoolsFactoryAddress(factoryAddress) | |
328 | 328 | let assetsStr = split(getAssetsStr(factoryAddress), SEP) | |
329 | 329 | let assetsBalances = getAssetsBalances(treasuryAddress, assetsStr) | |
330 | 330 | let assetsPrices = getAssetsPrices(poolsFactoryAddress, assetsStr) | |
331 | 331 | func reduce (acc,nextAssetIdStr) = { | |
332 | 332 | let assetId = fromBase58String(nextAssetIdStr) | |
333 | 333 | let index = valueOrErrorMessage(indexOf(assetsStr, nextAssetIdStr), wrapErr("invalid asset id")) | |
334 | 334 | let balance = assetsBalances[index] | |
335 | 335 | let price = assetsPrices[index] | |
336 | 336 | let assetValue = fraction(balance, price, mult18) | |
337 | 337 | (acc + assetValue) | |
338 | 338 | } | |
339 | 339 | ||
340 | 340 | let treasuryValue = { | |
341 | 341 | let $l = assetsStr | |
342 | 342 | let $s = size($l) | |
343 | 343 | let $acc0 = toBigInt(0) | |
344 | 344 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
345 | 345 | then $a | |
346 | 346 | else reduce($a, $l[$i]) | |
347 | 347 | ||
348 | 348 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
349 | 349 | then $a | |
350 | 350 | else throw("List size exceeds 10") | |
351 | 351 | ||
352 | 352 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10) | |
353 | 353 | } | |
354 | 354 | treasuryValue | |
355 | 355 | } | |
356 | 356 | ||
357 | 357 | ||
358 | 358 | func calcPrice (factoryAddress) = { | |
359 | 359 | let poolsFactoryAddress = getPoolsFactoryAddress(factoryAddress) | |
360 | 360 | let currentPeriod = valueOrErrorMessage(getInteger(factoryAddress, keyCurrentPeriod()), wrapErr("invalid current period")) | |
361 | 361 | let startTreasuryValue = valueOrErrorMessage(getInteger(factoryAddress, keyTreasuryValueByPeriod(currentPeriod)), wrapErr(("invalid treasury value for period " + toString(currentPeriod)))) | |
362 | 362 | let treasuryValue = fromX18(calcTreasuryValue(factoryAddress), pow(10, 0, usdtDecimals, 0, 0, DOWN)) | |
363 | 363 | let treasuryValueDiff = (treasuryValue - startTreasuryValue) | |
364 | 364 | let pwrAssetId = getPowerAssetId(factoryAddress) | |
365 | 365 | let pwrPriceRaw = getAssetsPrices(poolsFactoryAddress, [toBase58String(pwrAssetId)])[0] | |
366 | 366 | let pwrPrice = if ((pwrPriceRaw > toBigInt(0))) | |
367 | 367 | then fromX18(pwrPriceRaw, pow(10, 0, usdtDecimals, 0, 0, DOWN)) | |
368 | 368 | else throwErr("invalid PWR price") | |
369 | 369 | let treasuryAddress = getTreasuryAddress(factoryAddress) | |
370 | 370 | let skinTotal = valueOrElse(getInteger(powerContractAddress(factoryAddress), keySkinTotal(treasuryAddress)), 0) | |
371 | 371 | let pwrRemaining = (getAssetInfoOrFail(getLpAssetId(factoryAddress)).quantity / 100) | |
372 | 372 | let pwrAmount = (skinTotal + pwrRemaining) | |
373 | 373 | let factoryAddressWxBalanceRaw = getAssetsBalances(factoryAddress, [toBase58String(wxAssetId)])[0] | |
374 | 374 | let factoryAddressWxBalance = fromX18(factoryAddressWxBalanceRaw, pow(10, 0, usdtDecimals, 0, 0, DOWN)) | |
375 | 375 | let wxPriceRaw = getAssetsPrices(poolsFactoryAddress, [toBase58String(wxAssetId)])[0] | |
376 | 376 | let wxPrice = if ((wxPriceRaw > toBigInt(0))) | |
377 | 377 | then fromX18(wxPriceRaw, pow(10, 0, usdtDecimals, 0, 0, DOWN)) | |
378 | 378 | else throwErr("invalid wx price") | |
379 | 379 | let wxdaoQuantity = getAssetInfoOrFail(getLpAssetId(factoryAddress)).quantity | |
380 | 380 | let wxDaoPrice = (((pwrPrice + fraction((factoryAddressWxBalance * 100), wxPrice, wxdaoQuantity)) + fraction(max([treasuryValueDiff, 0]), 2, (10 * pwrAmount))) / 100) | |
381 | - | $Tuple2(wxDaoPrice, [["wxDaoPrice", wxDaoPrice], ["pwrPrice", pwrPrice], ["factoryAddressWxBalance", factoryAddressWxBalance], ["wxPrice", wxPrice], ["wxdaoQuantity", wxdaoQuantity], ["treasuryValueDiff", treasuryValueDiff], ["pwrAmount", pwrAmount]]) | |
381 | + | $Tuple2(wxDaoPrice, [["wxDaoPrice", wxDaoPrice], ["pwrPrice", pwrPrice], ["factoryAddressWxBalance", factoryAddressWxBalance], ["wxPrice", wxPrice], ["wxdaoQuantity", wxdaoQuantity], ["treasuryValueDiff", treasuryValueDiff], ["pwrAmount", pwrAmount], ["skinTotal", skinTotal], ["pwrRemaining", pwrRemaining]]) | |
382 | 382 | } | |
383 | 383 | ||
384 | 384 | ||
385 | 385 | @Callable(i) | |
386 | 386 | func withdraw (args) = { | |
387 | 387 | let recipient = addressFromStringValue(args[0]) | |
388 | 388 | let amount = parseIntValue(args[1]) | |
389 | 389 | let result = invoke(i.caller, "transferWaves", [recipient.bytes, amount], nil) | |
390 | 390 | $Tuple2(nil, result) | |
391 | 391 | } | |
392 | 392 | ||
393 | 393 | ||
394 | 394 | ||
395 | 395 | @Callable(i) | |
396 | 396 | func setIntParam (args) = { | |
397 | 397 | let key = args[0] | |
398 | 398 | let val = parseIntValue(args[1]) | |
399 | 399 | let result = invoke(i.caller, "integerEntry", [key, val], nil) | |
400 | 400 | $Tuple2(nil, result) | |
401 | 401 | } | |
402 | 402 | ||
403 | 403 | ||
404 | 404 | ||
405 | 405 | @Callable(i) | |
406 | 406 | func swap (callerPublicKey,args) = { | |
407 | 407 | let factoryAddress = i.caller | |
408 | 408 | let userAddress = addressFromPublicKey(callerPublicKey) | |
409 | 409 | let payment = if ((size(i.payments) == 1)) | |
410 | 410 | then i.payments[0] | |
411 | 411 | else throwErr("1 payment is required") | |
412 | 412 | let err = wrapErr("invalid payment asset id") | |
413 | 413 | let paymentAssetId = if ((valueOrErrorMessage(payment.assetId, err) == getLpAssetId(factoryAddress))) | |
414 | 414 | then value(payment.assetId) | |
415 | 415 | else throwErr(err) | |
416 | 416 | let pwrPrice = 100 | |
417 | 417 | let pwrAmount = (payment.amount / pwrPrice) | |
418 | 418 | let assetsStr = split(getAssetsStr(factoryAddress), SEP) | |
419 | 419 | let pwrBalance = assetBalance(factoryAddress, getPowerAssetId(factoryAddress)) | |
420 | 420 | if ((pwrBalance == pwrBalance)) | |
421 | 421 | then { | |
422 | 422 | let wxdaoQuantity = getAssetInfoOrFail(getLpAssetId(factoryAddress)).quantity | |
423 | 423 | if ((wxdaoQuantity == wxdaoQuantity)) | |
424 | 424 | then { | |
425 | 425 | let assetsBalances = getAssetsBalances(factoryAddress, assetsStr) | |
426 | 426 | func map (acc,nextAssetIdStr) = { | |
427 | 427 | let assetId = fromBase58String(nextAssetIdStr) | |
428 | 428 | let index = valueOrErrorMessage(indexOf(assetsStr, nextAssetIdStr), wrapErr("invalid asset balance")) | |
429 | 429 | let assetDecimals = getAssetInfoOrFail(assetId).decimals | |
430 | 430 | let balance = fromX18(assetsBalances[index], pow(10, 0, assetDecimals, 0, 0, DOWN)) | |
431 | 431 | let amount = fraction(balance, payment.amount, wxdaoQuantity) | |
432 | 432 | if ((amount > 0)) | |
433 | 433 | then $Tuple2((acc._1 :+ assetId), (acc._2 :+ amount)) | |
434 | 434 | else acc | |
435 | 435 | } | |
436 | 436 | ||
437 | 437 | let transfers = { | |
438 | 438 | let $l = assetsStr | |
439 | 439 | let $s = size($l) | |
440 | 440 | let $acc0 = $Tuple2(nil, nil) | |
441 | 441 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
442 | 442 | then $a | |
443 | 443 | else map($a, $l[$i]) | |
444 | 444 | ||
445 | 445 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
446 | 446 | then $a | |
447 | 447 | else throw("List size exceeds 6") | |
448 | 448 | ||
449 | 449 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6) | |
450 | 450 | } | |
451 | 451 | if ((transfers == transfers)) | |
452 | 452 | then { | |
453 | 453 | let additionalLockRounds = 0 | |
454 | 454 | let factoryActions = ([invoke(factoryAddress, "commitAfterStartWithLockRoundFor", [toString(powerContractAddress(factoryAddress)), toString(factoryAddress), toString(userAddress), additionalLockRounds, getPowerAssetId(factoryAddress), pwrAmount], nil)] ++ (if ((size(transfers._1) == 0)) | |
455 | 455 | then nil | |
456 | 456 | else [invoke(factoryAddress, "transferAssets", [userAddress.bytes, transfers._1, transfers._2], nil)])) | |
457 | 457 | $Tuple2([Burn(paymentAssetId, payment.amount)], factoryActions) | |
458 | 458 | } | |
459 | 459 | else throw("Strict value is not equal to itself.") | |
460 | 460 | } | |
461 | 461 | else throw("Strict value is not equal to itself.") | |
462 | 462 | } | |
463 | 463 | else throw("Strict value is not equal to itself.") | |
464 | 464 | } | |
465 | 465 | ||
466 | 466 | ||
467 | 467 | ||
468 | 468 | @Callable(i) | |
469 | 469 | func price (callerPublicKey,args) = { | |
470 | 470 | let factoryAddress = i.caller | |
471 | 471 | $Tuple2(nil, calcPrice(factoryAddress)._1) | |
472 | 472 | } | |
473 | 473 | ||
474 | 474 | ||
475 | 475 | ||
476 | 476 | @Callable(i) | |
477 | 477 | func priceDebug (callerPublicKey,args) = { | |
478 | 478 | let factoryAddress = i.caller | |
479 | 479 | $Tuple2(nil, calcPrice(factoryAddress)._2) | |
480 | 480 | } | |
481 | 481 | ||
482 | 482 | ||
483 | 483 | ||
484 | 484 | @Callable(i) | |
485 | 485 | func getTreasuryValue (callerPublicKey,args) = { | |
486 | 486 | let factoryAddress = i.caller | |
487 | 487 | let treasuryValue = fromX18(calcTreasuryValue(factoryAddress), pow(10, 0, usdtDecimals, 0, 0, DOWN)) | |
488 | 488 | $Tuple2(nil, treasuryValue) | |
489 | 489 | } | |
490 | 490 | ||
491 | 491 | ||
492 | 492 | @Verifier(tx) | |
493 | 493 | func verify () = (chainId == chainIdT) | |
494 | 494 |
github/deemru/w8io/026f985 59.27 ms ◑