tx · 6QoWLHuwmreHtGSqvVqffhK3ycJ1mAynKFhPt2eA5Yt 3N7UuYar6264P58FBhVWKPQAh4Yua2hgngv: -0.00600000 Waves 2024.09.12 20:47 [3280734] smart account 3N7UuYar6264P58FBhVWKPQAh4Yua2hgngv > SELF 0.00000000 Waves
{ "type": 13, "id": "6QoWLHuwmreHtGSqvVqffhK3ycJ1mAynKFhPt2eA5Yt", "fee": 600000, "feeAssetId": null, "timestamp": 1726163253745, "version": 2, "chainId": 84, "sender": "3N7UuYar6264P58FBhVWKPQAh4Yua2hgngv", "senderPublicKey": "2fNSk5gmWbXBDTkSYSKd66xSgVvAYzrJnP9YSAFNvTwC", "proofs": [ "aaPGsJ55V8Np44saEv8aUDUycFAaGqt6mej7ct7jG25cDcYaL797R5N8qbexEu1mTuGohsKtGpZHhheCkdM6htQ" ], "script": "base64:BgIRCAISAwoBGBIDCgEIEgMKAQghAANTRVACAl9fAAVjaGFpbgkAyQECCQDKAQIIBQR0aGlzBWJ5dGVzAAEAAQAWZGVmYXVsdFJlc3QyQWRkcmVzc1N0cgQHJG1hdGNoMAUFY2hhaW4DCQAAAgEBVwUHJG1hdGNoMAIjM1BGd1l0YThiaUV6MzF6cGVGZTVESks4d0U1dHJTcFFWRjgDCQAAAgEBVAUHJG1hdGNoMAIjM043VXVZYXI2MjY0UDU4RkJoVldLUFFBaDRZdWEyaGduZ3YJAAIBAg1Vbmtub3duIGNoYWluABVvbGRTdGFraW5nQ29udHJhY3RTdHIEByRtYXRjaDAFBWNoYWluAwkAAAIBAVcFByRtYXRjaDACIzNQTG5jWHRTMVU4M0Q2Y1FiRkQzSDhyQkhQTGd6eFNGS1oxAwkAAAIBAVQFByRtYXRjaDACIzNOREN5Qkc1cTg1SnVhUmlpZ1VlRXRhaW55akNRVDNYcFptCQACAQINVW5rbm93biBjaGFpbgEPZ2V0U3RyaW5nT3JGYWlsAgdhZGRyZXNzA2tleQkBE3ZhbHVlT3JFcnJvck1lc3NhZ2UCCQCdCAIFB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gfYDFdrUW1uLVVzQGXZcsbNPymDn9WVSZMztvZ Diff:
Old | New | Differences | |
---|---|---|---|
184 | 184 | ||
185 | 185 | @Callable(i) | |
186 | 186 | func conversionInfoREADONLY (userAddressOpt) = { | |
187 | - | let oldAcresAddress = addressFromStringValue(getStringValue(oldAcresContractKey)) | |
188 | - | let $ | |
189 | - | let unstakedAcres = $ | |
190 | - | let claimedAcres = $ | |
191 | - | let $ | |
192 | - | let acresFromPieces = $ | |
193 | - | let acresFromRes = $ | |
194 | - | let acresFromMat = $ | |
195 | - | let acresFromProd = $ | |
187 | + | let oldAcresAddress = addressFromStringValue(getStringValue(acres2Contract, oldAcresContractKey)) | |
188 | + | let $t040504172 = asTuple2Ints(invoke(oldAcresAddress, "unstakeAllAcresREADONLY", [userAddressOpt], nil)) | |
189 | + | let unstakedAcres = $t040504172._1 | |
190 | + | let claimedAcres = $t040504172._2 | |
191 | + | let $t041754324 = asTuple4Ints(invoke(acres2Contract, "unstakeLandsREADONLY", [userAddressOpt], nil)) | |
192 | + | let acresFromPieces = $t041754324._1 | |
193 | + | let acresFromRes = $t041754324._2 | |
194 | + | let acresFromMat = $t041754324._3 | |
195 | + | let acresFromProd = $t041754324._4 | |
196 | 196 | let oldStakingAddress = addressFromStringValue(oldStakingContractStr) | |
197 | 197 | let duckAssetId = valueOrElse(getString(oldStakingAddress, keyStakedDuckByOwner(userAddressOpt)), "") | |
198 | - | let $ | |
198 | + | let $t045024724 = if ((duckAssetId != "")) | |
199 | 199 | then asTuple3Ints(invoke(oldStakingAddress, "unstakeDuckREADONLY", [duckAssetId, userAddressOpt], nil)) | |
200 | 200 | else $Tuple3(0, 0, 0) | |
201 | - | let acresFromDuckRes = $ | |
202 | - | let acresFromDuckMat = $ | |
203 | - | let acresFromDuckProd = $ | |
201 | + | let acresFromDuckRes = $t045024724._1 | |
202 | + | let acresFromDuckMat = $t045024724._2 | |
203 | + | let acresFromDuckProd = $t045024724._3 | |
204 | 204 | $Tuple2(nil, [("%s%d__unstakedAcres__" + toString(unstakedAcres)), ("%s%d__claimedAcres__" + toString(claimedAcres)), ("%s%d__acresFromPieces__" + toString(acresFromPieces)), ("%s%d__acresFromRes__" + toString(acresFromRes)), ("%s%d__acresFromMat__" + toString(acresFromMat)), ("%s%d__acresFromProd__" + toString(acresFromProd)), ("%s%d__acresFromDuckRes__" + toString(acresFromDuckRes)), ("%s%d__acresFromDuckMat__" + toString(acresFromDuckMat)), ("%s%d__acresFromDuckProd__" + toString(acresFromDuckProd))]) | |
205 | 205 | } | |
206 | 206 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let SEP = "__" | |
5 | 5 | ||
6 | 6 | let chain = take(drop(this.bytes, 1), 1) | |
7 | 7 | ||
8 | 8 | let defaultRest2AddressStr = match chain { | |
9 | 9 | case _ => | |
10 | 10 | if ((base58'2W' == $match0)) | |
11 | 11 | then "3PFwYta8biEz31zpeFe5DJK8wE5trSpQVF8" | |
12 | 12 | else if ((base58'2T' == $match0)) | |
13 | 13 | then "3N7UuYar6264P58FBhVWKPQAh4Yua2hgngv" | |
14 | 14 | else throw("Unknown chain") | |
15 | 15 | } | |
16 | 16 | ||
17 | 17 | let oldStakingContractStr = match chain { | |
18 | 18 | case _ => | |
19 | 19 | if ((base58'2W' == $match0)) | |
20 | 20 | then "3PLncXtS1U83D6cQbFD3H8rBHPLgzxSFKZ1" | |
21 | 21 | else if ((base58'2T' == $match0)) | |
22 | 22 | then "3NDCyBG5q85JuaRiigUeEtainyjCQT3XpZm" | |
23 | 23 | else throw("Unknown chain") | |
24 | 24 | } | |
25 | 25 | ||
26 | 26 | func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], "")) | |
27 | 27 | ||
28 | 28 | ||
29 | 29 | let IdxCfgAcres2Dapp = 1 | |
30 | 30 | ||
31 | 31 | let IdxCfgWlgDapp = 2 | |
32 | 32 | ||
33 | 33 | func keyRestCfg () = "%s__restConfig" | |
34 | 34 | ||
35 | 35 | ||
36 | 36 | func keyRest2Address () = "%s__rest2Addr" | |
37 | 37 | ||
38 | 38 | ||
39 | 39 | func readRestCfgOrFail (rest) = split_4C(getStringOrFail(rest, keyRestCfg()), SEP) | |
40 | 40 | ||
41 | 41 | ||
42 | 42 | func getContractAddressOrFail (rest2Cfg,idx) = valueOrErrorMessage(addressFromString(rest2Cfg[idx]), ("Rest cfg doesn't contain address at index " + toString(idx))) | |
43 | 43 | ||
44 | 44 | ||
45 | 45 | let rest2Contract = addressFromStringValue(valueOrElse(getString(this, keyRest2Address()), defaultRest2AddressStr)) | |
46 | 46 | ||
47 | 47 | let rest2Cfg = readRestCfgOrFail(rest2Contract) | |
48 | 48 | ||
49 | 49 | let acres2Contract = getContractAddressOrFail(rest2Cfg, IdxCfgAcres2Dapp) | |
50 | 50 | ||
51 | 51 | let wlgContract = getContractAddressOrFail(rest2Cfg, IdxCfgWlgDapp) | |
52 | 52 | ||
53 | 53 | let oldAcresContractKey = "oldAcresContract" | |
54 | 54 | ||
55 | 55 | func keyLastTxIdByUser (addr) = ("lastTxIdByUser_" + addr) | |
56 | 56 | ||
57 | 57 | ||
58 | 58 | let wlgAssetIdKey = "wlg_assetId" | |
59 | 59 | ||
60 | 60 | let wlgAssetId = valueOrErrorMessage(getBinary(wlgContract, wlgAssetIdKey), "WLGOLD is not issued yet") | |
61 | 61 | ||
62 | 62 | let acresAssetIdKey = "acresAssetId" | |
63 | 63 | ||
64 | 64 | let acresAssetId = valueOrErrorMessage(getBinary(acres2Contract, acresAssetIdKey), "ACRES is not issued yet") | |
65 | 65 | ||
66 | 66 | func keyStakedDuckByOwner (ownerAddr) = ("stakedDuckByOwner_" + ownerAddr) | |
67 | 67 | ||
68 | 68 | ||
69 | 69 | func keyAddressToCustomName (addr) = ("accountCustomNameByAddr_" + addr) | |
70 | 70 | ||
71 | 71 | ||
72 | 72 | func keyAddressRefBy (addr) = ("accRefBy_" + addr) | |
73 | 73 | ||
74 | 74 | ||
75 | 75 | func keyAddressReferrals (addr) = ("accReferrals_" + addr) | |
76 | 76 | ||
77 | 77 | ||
78 | 78 | func asTuple4Ints (val) = match val { | |
79 | 79 | case t: (Int, Int, Int, Int) => | |
80 | 80 | t | |
81 | 81 | case _ => | |
82 | 82 | throw("fail to cast into (Int, Int, Int, Int)") | |
83 | 83 | } | |
84 | 84 | ||
85 | 85 | ||
86 | 86 | func asTuple3Ints (val) = match val { | |
87 | 87 | case t: (Int, Int, Int) => | |
88 | 88 | t | |
89 | 89 | case _ => | |
90 | 90 | throw("fail to cast into (Int, Int, Int)") | |
91 | 91 | } | |
92 | 92 | ||
93 | 93 | ||
94 | 94 | func asTuple2Ints (val) = match val { | |
95 | 95 | case t: (Int, Int) => | |
96 | 96 | t | |
97 | 97 | case _ => | |
98 | 98 | throw("fail to cast into (Int, Int)") | |
99 | 99 | } | |
100 | 100 | ||
101 | 101 | ||
102 | 102 | let M8_ = 100000000 | |
103 | 103 | ||
104 | 104 | func keyAcresStakedAmtByUser (addr) = ("acresStakedAmountByUser_" + addr) | |
105 | 105 | ||
106 | 106 | ||
107 | 107 | let levels = [10, 20, 40, 80, 150, 250, 400, 700, 1000] | |
108 | 108 | ||
109 | 109 | func getLevelByAcres (acres) = { | |
110 | 110 | let acr = (acres / M8_) | |
111 | 111 | func checker (acc,item) = if ((item > acr)) | |
112 | 112 | then acc | |
113 | 113 | else (acc + 1) | |
114 | 114 | ||
115 | 115 | let idx = { | |
116 | 116 | let $l = levels | |
117 | 117 | let $s = size($l) | |
118 | 118 | let $acc0 = 0 | |
119 | 119 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
120 | 120 | then $a | |
121 | 121 | else checker($a, $l[$i]) | |
122 | 122 | ||
123 | 123 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
124 | 124 | then $a | |
125 | 125 | else throw("List size exceeds 10") | |
126 | 126 | ||
127 | 127 | $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) | |
128 | 128 | } | |
129 | 129 | (idx + 1) | |
130 | 130 | } | |
131 | 131 | ||
132 | 132 | ||
133 | 133 | func walletInternal (userAddressOpt) = { | |
134 | 134 | let addr = addressFromString(userAddressOpt) | |
135 | 135 | let balance = if (isDefined(addr)) | |
136 | 136 | then wavesBalance(value(addr)) | |
137 | 137 | else BalanceDetails(0, 0, 0, 0) | |
138 | 138 | let wlgoldBalance = if (isDefined(addr)) | |
139 | 139 | then assetBalance(value(addr), wlgAssetId) | |
140 | 140 | else 0 | |
141 | 141 | let customName = valueOrElse(getString(acres2Contract, keyAddressToCustomName(userAddressOpt)), userAddressOpt) | |
142 | 142 | let refByKey = keyAddressRefBy(userAddressOpt) | |
143 | 143 | let refBy = getString(acres2Contract, refByKey) | |
144 | 144 | let refs = valueOrElse(getString(acres2Contract, keyAddressReferrals(userAddressOpt)), "") | |
145 | 145 | let lastTxId = valueOrElse(getString(acres2Contract, keyLastTxIdByUser(userAddressOpt)), "") | |
146 | 146 | let acresBalance = if (isDefined(addr)) | |
147 | 147 | then assetBalance(value(addr), acresAssetId) | |
148 | 148 | else 0 | |
149 | 149 | let stakedAcres = valueOrElse(getInteger(acres2Contract, keyAcresStakedAmtByUser(userAddressOpt)), 0) | |
150 | 150 | let lvl = getLevelByAcres(acresBalance) | |
151 | 151 | [("%s%s__customName__" + customName), ("%s%s__referredBy__" + valueOrElse(refBy, "")), ("%s%s__referrals__" + refs), ("%s%s__lastTxId__" + lastTxId), ("%s%d__wavesBalance__" + toString(balance.available)), ("%s%d__wlgoldBalance__" + toString(wlgoldBalance)), ("%s%d__acresBalance__" + toString(acresBalance)), ("%s%d__stakedAcres__" + toString(stakedAcres)), ("%s%d__currentLvl__" + toString(lvl))] | |
152 | 152 | } | |
153 | 153 | ||
154 | 154 | ||
155 | 155 | @Callable(i) | |
156 | 156 | func constructorV1 (contracts) = if ((i.caller != this)) | |
157 | 157 | then throw("permissions denied") | |
158 | 158 | else { | |
159 | 159 | func descriptor (acc,ignoredItem) = (acc + "%s") | |
160 | 160 | ||
161 | 161 | let descr = { | |
162 | 162 | let $l = contracts | |
163 | 163 | let $s = size($l) | |
164 | 164 | let $acc0 = "" | |
165 | 165 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
166 | 166 | then $a | |
167 | 167 | else descriptor($a, $l[$i]) | |
168 | 168 | ||
169 | 169 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
170 | 170 | then $a | |
171 | 171 | else throw("List size exceeds 10") | |
172 | 172 | ||
173 | 173 | $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) | |
174 | 174 | } | |
175 | 175 | [StringEntry(keyRestCfg(), makeString(descr :: contracts, SEP)), StringEntry(keyRest2Address(), toString(this))] | |
176 | 176 | } | |
177 | 177 | ||
178 | 178 | ||
179 | 179 | ||
180 | 180 | @Callable(i) | |
181 | 181 | func walletInfoREADONLY (userAddressOpt) = $Tuple2(nil, walletInternal(userAddressOpt)) | |
182 | 182 | ||
183 | 183 | ||
184 | 184 | ||
185 | 185 | @Callable(i) | |
186 | 186 | func conversionInfoREADONLY (userAddressOpt) = { | |
187 | - | let oldAcresAddress = addressFromStringValue(getStringValue(oldAcresContractKey)) | |
188 | - | let $ | |
189 | - | let unstakedAcres = $ | |
190 | - | let claimedAcres = $ | |
191 | - | let $ | |
192 | - | let acresFromPieces = $ | |
193 | - | let acresFromRes = $ | |
194 | - | let acresFromMat = $ | |
195 | - | let acresFromProd = $ | |
187 | + | let oldAcresAddress = addressFromStringValue(getStringValue(acres2Contract, oldAcresContractKey)) | |
188 | + | let $t040504172 = asTuple2Ints(invoke(oldAcresAddress, "unstakeAllAcresREADONLY", [userAddressOpt], nil)) | |
189 | + | let unstakedAcres = $t040504172._1 | |
190 | + | let claimedAcres = $t040504172._2 | |
191 | + | let $t041754324 = asTuple4Ints(invoke(acres2Contract, "unstakeLandsREADONLY", [userAddressOpt], nil)) | |
192 | + | let acresFromPieces = $t041754324._1 | |
193 | + | let acresFromRes = $t041754324._2 | |
194 | + | let acresFromMat = $t041754324._3 | |
195 | + | let acresFromProd = $t041754324._4 | |
196 | 196 | let oldStakingAddress = addressFromStringValue(oldStakingContractStr) | |
197 | 197 | let duckAssetId = valueOrElse(getString(oldStakingAddress, keyStakedDuckByOwner(userAddressOpt)), "") | |
198 | - | let $ | |
198 | + | let $t045024724 = if ((duckAssetId != "")) | |
199 | 199 | then asTuple3Ints(invoke(oldStakingAddress, "unstakeDuckREADONLY", [duckAssetId, userAddressOpt], nil)) | |
200 | 200 | else $Tuple3(0, 0, 0) | |
201 | - | let acresFromDuckRes = $ | |
202 | - | let acresFromDuckMat = $ | |
203 | - | let acresFromDuckProd = $ | |
201 | + | let acresFromDuckRes = $t045024724._1 | |
202 | + | let acresFromDuckMat = $t045024724._2 | |
203 | + | let acresFromDuckProd = $t045024724._3 | |
204 | 204 | $Tuple2(nil, [("%s%d__unstakedAcres__" + toString(unstakedAcres)), ("%s%d__claimedAcres__" + toString(claimedAcres)), ("%s%d__acresFromPieces__" + toString(acresFromPieces)), ("%s%d__acresFromRes__" + toString(acresFromRes)), ("%s%d__acresFromMat__" + toString(acresFromMat)), ("%s%d__acresFromProd__" + toString(acresFromProd)), ("%s%d__acresFromDuckRes__" + toString(acresFromDuckRes)), ("%s%d__acresFromDuckMat__" + toString(acresFromDuckMat)), ("%s%d__acresFromDuckProd__" + toString(acresFromDuckProd))]) | |
205 | 205 | } | |
206 | 206 | ||
207 | 207 |
github/deemru/w8io/169f3d6 103.59 ms ◑