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