tx · AwAPsXvM7a85MJqvyhaKeQHETwBc2HPFhuCgSFMBFdyU 3NBPx1Fciu3JQNEGZ21jSnTdutLNGGBUSXh: -0.01300000 Waves 2024.09.13 17:18 [3281976] smart account 3NBPx1Fciu3JQNEGZ21jSnTdutLNGGBUSXh > SELF 0.00000000 Waves
{ "type": 13, "id": "AwAPsXvM7a85MJqvyhaKeQHETwBc2HPFhuCgSFMBFdyU", "fee": 1300000, "feeAssetId": null, "timestamp": 1726237135039, "version": 2, "chainId": 84, "sender": "3NBPx1Fciu3JQNEGZ21jSnTdutLNGGBUSXh", "senderPublicKey": "3QtfC1XbLZXdeawMDeSERy9vvjUmj1XYd2GFmrvx7pWQ", "proofs": [ "Q2XsvZQXJkLhwDWakejKqvxV5TpAVwWSBRNnMtpcfUawAL6E3fKvKTdr9zDgro1YR3nfwKR7pam73zx5KpfEgFN" ], "script": "base64:BgIjCAISBAoCCAgSBAoCCAESAwoBBBIDCgEBEgASABIAEgMKAQgsAANTRVACAl9fAAVNVUxUOACAwtcvABRXTEcyQUNSRVNfTVVMVElQTElFUgDIAQAFY2hhaW4JAMkBAgkAygECCAUEdGhpcwVieXRlcwABAAEAFmRlZmF1bHRSZXN0MkFkZHJlc3NTdHIEByRtYXRjaDAFBWNoYWluAwkAAAIBAVcFByRtYXRjaDACIzNQRndZdGE4YmlFejMxenBlRmU1REpLOHdFNXRyU3BRVkY4AwkAAAIBAVQFByRtYXRjaDACIzNON1V1WWFyNjI2NFA1OEZCaFZXS1BRQWg0WXVhMmhnbmd2CQACAQINVW5rbm93biBjaGFpbgAVb2xkU3Rha2luZ0NvbnRyYWN0U3RyBAckbWF0Y2gwBQVjaGFpbgMJAAACAQFXBQckbWF0Y2gwAiMzUExuY1h0UzFVODNENmNRYkZEM0g4ckJIUExnenhTRktaMQMJAAACAQFUBQckbWF0Y2gwAiMzTkRDeUJHNXE4NUp1YVJpaWdVZUV0YWlueWpDUVQzWHBabQkAAgECDVVua25vd24gY2hhaW4BD2dldFN0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ADgAOQA6ADsAPAA9AD4APwBAAEEAQgBDAEQARQBGAEcASABJAEoASwBMAE0ATgBPAFAAUQBSAFMAVABVAFYAVwBYAFkAWgBbAFwAXQBeAF8AYABhAGIAYwBkCQCWCgQAAAAAAAAAAAkAlAoCBQNuaWwFC2xhbmRzUmVzdWx0AFyjVdA=", "height": 3281976, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 3ZvBNMGscMe4p9anH7ECxscfYEsvpKUBvE7UwtAAEy7T Next: AN5TD7JJW2AcHcCQAkeTMG1jeMxXvyBsod7zqmfkna8e Diff:
Old | New | Differences | |
---|---|---|---|
238 | 238 | else { | |
239 | 239 | let oldTotal = valueOrElse(getInteger(acresStakdTotalKey), 0) | |
240 | 240 | let wlgResult = invoke(wlgContract, "onStakeUnstakeLand", [address], nil) | |
241 | - | $Tuple2(([IntegerEntry(timeKey, lastBlock.timestamp), IntegerEntry(amountKey, (oldAcresAmount - amount)), IntegerEntry(acresStakdTotalKey, (oldTotal - amount)), ScriptTransfer(i.caller, amount, acresAssetId)] ++ prologActions), wlgResult) | |
241 | + | let newAcresAmount = (oldAcresAmount - amount) | |
242 | + | let userFpKey = keyFarmingPowerByUser(address) | |
243 | + | let oldFp = valueOrElse(getInteger(userFpKey), 0) | |
244 | + | let newFp = getFarmingPowerByAcres(newAcresAmount) | |
245 | + | let oldTotalFp = valueOrElse(getInteger(totalFarmingPowerKey), 0) | |
246 | + | $Tuple2(([IntegerEntry(timeKey, lastBlock.timestamp), IntegerEntry(amountKey, (oldAcresAmount - amount)), IntegerEntry(acresStakdTotalKey, (oldTotal - amount)), IntegerEntry(userFpKey, newFp), IntegerEntry(totalFarmingPowerKey, ((oldTotalFp - oldFp) + newFp)), ScriptTransfer(i.caller, amount, acresAssetId)] ++ prologActions), wlgResult) | |
242 | 247 | } | |
243 | 248 | } | |
244 | 249 | } | |
260 | 265 | else (value(pmt.assetId) != acresAssetId)) | |
261 | 266 | then throw("ACRES payments only!") | |
262 | 267 | else { | |
263 | - | let $ | |
264 | - | let actions = $ | |
265 | - | let wlgClaimedAmount = $ | |
268 | + | let $t038353901 = stakeAcresInternal(amt, address) | |
269 | + | let actions = $t038353901._1 | |
270 | + | let wlgClaimedAmount = $t038353901._2 | |
266 | 271 | $Tuple2((actions ++ prologActions), wlgClaimedAmount) | |
267 | 272 | } | |
268 | 273 | } | |
335 | 340 | let finalize = invoke(oldStakingAddress, "unstakeLandsFinalizeCallback", [address], nil) | |
336 | 341 | if ((finalize == finalize)) | |
337 | 342 | then { | |
338 | - | let req = invoke(oldAcresAddress, "requestAcresCallback", [(((rr._1 + rr._2) + rr._3) + rr._4) | |
343 | + | let req = invoke(oldAcresAddress, "requestAcresCallback", [(((rr._1 + rr._2) + rr._3) + rr._4)], nil) | |
339 | 344 | if ((req == req)) | |
340 | 345 | then { | |
341 | 346 | let issue = Issue("FPOWER10", "FarmingPower +10% NFT for WavesLands game", 1, 0, false) | |
350 | 355 | let duckResult = if ((duckAssetId != "")) | |
351 | 356 | then asTuple3Ints(invoke(oldStakingAddress, "unstakeDuckCallback", [duckAssetId, address], nil)) | |
352 | 357 | else $Tuple3(0, 0, 0) | |
353 | - | let x = stakeAcresInternal(((((((( | |
358 | + | let x = stakeAcresInternal((((((((gotAcres0._1 + landsResult._1) + landsResult._2) + landsResult._3) + landsResult._4) + duckResult._1) + duckResult._2) + duckResult._3), address) | |
354 | 359 | $Tuple2((landsResult._5 ++ x._1), x._2) | |
355 | 360 | } | |
356 | 361 | } |
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 MULT8 = 100000000 | |
7 | 7 | ||
8 | 8 | let WLG2ACRES_MULTIPLIER = 200 | |
9 | 9 | ||
10 | 10 | let chain = take(drop(this.bytes, 1), 1) | |
11 | 11 | ||
12 | 12 | let defaultRest2AddressStr = match chain { | |
13 | 13 | case _ => | |
14 | 14 | if ((base58'2W' == $match0)) | |
15 | 15 | then "3PFwYta8biEz31zpeFe5DJK8wE5trSpQVF8" | |
16 | 16 | else if ((base58'2T' == $match0)) | |
17 | 17 | then "3N7UuYar6264P58FBhVWKPQAh4Yua2hgngv" | |
18 | 18 | else throw("Unknown chain") | |
19 | 19 | } | |
20 | 20 | ||
21 | 21 | let oldStakingContractStr = match chain { | |
22 | 22 | case _ => | |
23 | 23 | if ((base58'2W' == $match0)) | |
24 | 24 | then "3PLncXtS1U83D6cQbFD3H8rBHPLgzxSFKZ1" | |
25 | 25 | else if ((base58'2T' == $match0)) | |
26 | 26 | then "3NDCyBG5q85JuaRiigUeEtainyjCQT3XpZm" | |
27 | 27 | else throw("Unknown chain") | |
28 | 28 | } | |
29 | 29 | ||
30 | 30 | func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], "")) | |
31 | 31 | ||
32 | 32 | ||
33 | 33 | let IdxCfgAcres2Dapp = 1 | |
34 | 34 | ||
35 | 35 | let IdxCfgWlgDapp = 2 | |
36 | 36 | ||
37 | 37 | func keyRestCfg () = "%s__restConfig" | |
38 | 38 | ||
39 | 39 | ||
40 | 40 | func keyRest2Address () = "%s__rest2Addr" | |
41 | 41 | ||
42 | 42 | ||
43 | 43 | func readRestCfgOrFail (rest) = split_4C(getStringOrFail(rest, keyRestCfg()), SEP) | |
44 | 44 | ||
45 | 45 | ||
46 | 46 | func getContractAddressOrFail (rest2Cfg,idx) = valueOrErrorMessage(addressFromString(rest2Cfg[idx]), ("Rest cfg doesn't contain address at index " + toString(idx))) | |
47 | 47 | ||
48 | 48 | ||
49 | 49 | let rest2Contract = addressFromStringValue(valueOrElse(getString(this, keyRest2Address()), defaultRest2AddressStr)) | |
50 | 50 | ||
51 | 51 | let rest2Cfg = readRestCfgOrFail(rest2Contract) | |
52 | 52 | ||
53 | 53 | let acres2Contract = getContractAddressOrFail(rest2Cfg, IdxCfgAcres2Dapp) | |
54 | 54 | ||
55 | 55 | let wlgContract = getContractAddressOrFail(rest2Cfg, IdxCfgWlgDapp) | |
56 | 56 | ||
57 | 57 | let oldAcresContractKey = "oldAcresContract" | |
58 | 58 | ||
59 | 59 | func keyBlocked () = "contractsBlocked" | |
60 | 60 | ||
61 | 61 | ||
62 | 62 | func keyLastTxIdByUser (addr) = ("lastTxIdByUser_" + addr) | |
63 | 63 | ||
64 | 64 | ||
65 | 65 | let wlgAssetIdKey = "wlg_assetId" | |
66 | 66 | ||
67 | 67 | let wlgAssetId = valueOrErrorMessage(getBinary(wlgContract, wlgAssetIdKey), "WLGOLD is not issued yet") | |
68 | 68 | ||
69 | 69 | let acresIssuedAmountKey = "acresIssuedAmount" | |
70 | 70 | ||
71 | 71 | let acresAssetIdKey = "acresAssetId" | |
72 | 72 | ||
73 | 73 | let acresAssetId = valueOrErrorMessage(getBinary(acres2Contract, acresAssetIdKey), "ACRES is not issued yet") | |
74 | 74 | ||
75 | 75 | func keyAcresStakedTimeByUser (addr) = ("acresStakedTimeByUser_" + addr) | |
76 | 76 | ||
77 | 77 | ||
78 | 78 | func keyStakedLandsByOwner (ownerAddr) = ("stakedLandsByOwner_" + ownerAddr) | |
79 | 79 | ||
80 | 80 | ||
81 | 81 | func keyStakedDuckByOwner (ownerAddr) = ("stakedDuckByOwner_" + ownerAddr) | |
82 | 82 | ||
83 | 83 | ||
84 | 84 | func asInt (v) = match v { | |
85 | 85 | case n: Int => | |
86 | 86 | n | |
87 | 87 | case _ => | |
88 | 88 | throw("fail to cast into Int") | |
89 | 89 | } | |
90 | 90 | ||
91 | 91 | ||
92 | 92 | func asTuple5Ints (val) = match val { | |
93 | 93 | case t: (Int, Int, Int, Int, Int) => | |
94 | 94 | t | |
95 | 95 | case _ => | |
96 | 96 | throw("fail to cast into (Int, Int, Int, Int, Int)") | |
97 | 97 | } | |
98 | 98 | ||
99 | 99 | ||
100 | 100 | func asTuple4Ints (val) = match val { | |
101 | 101 | case t: (Int, Int, Int, Int) => | |
102 | 102 | t | |
103 | 103 | case _ => | |
104 | 104 | throw("fail to cast into (Int, Int, Int, Int)") | |
105 | 105 | } | |
106 | 106 | ||
107 | 107 | ||
108 | 108 | func asTuple3Ints (val) = match val { | |
109 | 109 | case t: (Int, Int, Int) => | |
110 | 110 | t | |
111 | 111 | case _ => | |
112 | 112 | throw("fail to cast into (Int, Int, Int)") | |
113 | 113 | } | |
114 | 114 | ||
115 | 115 | ||
116 | 116 | func asTuple2Ints (val) = match val { | |
117 | 117 | case t: (Int, Int) => | |
118 | 118 | t | |
119 | 119 | case _ => | |
120 | 120 | throw("fail to cast into (Int, Int)") | |
121 | 121 | } | |
122 | 122 | ||
123 | 123 | ||
124 | 124 | func fixedPoint (val,decimals) = { | |
125 | 125 | let tenPow = pow(10, 0, decimals, 0, 0, DOWN) | |
126 | 126 | let lowPart = toString((val % tenPow)) | |
127 | 127 | let zeroes = drop(toString(tenPow), (1 + size(lowPart))) | |
128 | 128 | (((toString((val / tenPow)) + ".") + zeroes) + lowPart) | |
129 | 129 | } | |
130 | 130 | ||
131 | 131 | ||
132 | 132 | let M8_ = 100000000 | |
133 | 133 | ||
134 | 134 | func keyAcresStakedAmtByUser (addr) = ("acresStakedAmountByUser_" + addr) | |
135 | 135 | ||
136 | 136 | ||
137 | 137 | func keyFarmingPowerByUser (addr) = ("farmingPowerByUser_" + addr) | |
138 | 138 | ||
139 | 139 | ||
140 | 140 | let acresStakdTotalKey = "acresStakedAmountTotal" | |
141 | 141 | ||
142 | 142 | let totalFarmingPowerKey = "totalFarmingPower" | |
143 | 143 | ||
144 | 144 | let levels = [10, 20, 40, 80, 150, 250, 400, 700, 1000] | |
145 | 145 | ||
146 | 146 | func getLevelByAcres (acres) = { | |
147 | 147 | let acr = (acres / M8_) | |
148 | 148 | func checker (acc,item) = if ((item > acr)) | |
149 | 149 | then acc | |
150 | 150 | else (acc + 1) | |
151 | 151 | ||
152 | 152 | let idx = { | |
153 | 153 | let $l = levels | |
154 | 154 | let $s = size($l) | |
155 | 155 | let $acc0 = 0 | |
156 | 156 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
157 | 157 | then $a | |
158 | 158 | else checker($a, $l[$i]) | |
159 | 159 | ||
160 | 160 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
161 | 161 | then $a | |
162 | 162 | else throw("List size exceeds 10") | |
163 | 163 | ||
164 | 164 | $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) | |
165 | 165 | } | |
166 | 166 | (idx + 1) | |
167 | 167 | } | |
168 | 168 | ||
169 | 169 | ||
170 | 170 | func getFarmingPowerByAcres (acres) = ((acres * 20) * (getLevelByAcres(acres) + 4)) | |
171 | 171 | ||
172 | 172 | ||
173 | 173 | func prolog (i) = if (if ((i.originCaller != rest2Contract)) | |
174 | 174 | then valueOrElse(getBoolean(keyBlocked()), false) | |
175 | 175 | else false) | |
176 | 176 | then throw("Contracts are under maintenance") | |
177 | 177 | else [StringEntry(keyLastTxIdByUser(toString(i.originCaller)), toBase58String(i.transactionId))] | |
178 | 178 | ||
179 | 179 | ||
180 | 180 | func stakeAcresInternal (amt,address) = { | |
181 | 181 | let wlgResult = invoke(wlgContract, "onStakeUnstakeLand", [address], nil) | |
182 | 182 | if ((wlgResult == wlgResult)) | |
183 | 183 | then { | |
184 | 184 | let now = lastBlock.timestamp | |
185 | 185 | let timeKey = keyAcresStakedTimeByUser(address) | |
186 | 186 | let amountKey = keyAcresStakedAmtByUser(address) | |
187 | 187 | let newAcresAmount = (valueOrElse(getInteger(amountKey), 0) + amt) | |
188 | 188 | let oldTotal = valueOrElse(getInteger(acresStakdTotalKey), 0) | |
189 | 189 | let userFpKey = keyFarmingPowerByUser(address) | |
190 | 190 | let oldFp = valueOrElse(getInteger(userFpKey), 0) | |
191 | 191 | let newFp = getFarmingPowerByAcres(newAcresAmount) | |
192 | 192 | let oldTotalFp = valueOrElse(getInteger(totalFarmingPowerKey), 0) | |
193 | 193 | $Tuple2([IntegerEntry(timeKey, lastBlock.timestamp), IntegerEntry(amountKey, newAcresAmount), IntegerEntry(acresStakdTotalKey, (oldTotal + amt)), IntegerEntry(userFpKey, newFp), IntegerEntry(totalFarmingPowerKey, ((oldTotalFp - oldFp) + newFp))], wlgResult) | |
194 | 194 | } | |
195 | 195 | else throw("Strict value is not equal to itself.") | |
196 | 196 | } | |
197 | 197 | ||
198 | 198 | ||
199 | 199 | @Callable(i) | |
200 | 200 | func constructorV1 (rest2Addr,oldAcrContract) = if ((i.caller != this)) | |
201 | 201 | then throw("Permission denied") | |
202 | 202 | else { | |
203 | 203 | let oldAcrContAddr = addressFromStringValue(oldAcrContract) | |
204 | 204 | [IntegerEntry(acresIssuedAmountKey, getIntegerValue(oldAcrContAddr, acresIssuedAmountKey)), BinaryEntry(acresAssetIdKey, getBinaryValue(oldAcrContAddr, acresAssetIdKey)), StringEntry(keyRest2Address(), rest2Addr), StringEntry(oldAcresContractKey, oldAcrContract)] | |
205 | 205 | } | |
206 | 206 | ||
207 | 207 | ||
208 | 208 | ||
209 | 209 | @Callable(i) | |
210 | 210 | func saveInteger (key,amount) = if ((i.caller != this)) | |
211 | 211 | then throw("saveInteger is not public method") | |
212 | 212 | else [IntegerEntry(key, amount)] | |
213 | 213 | ||
214 | 214 | ||
215 | 215 | ||
216 | 216 | @Callable(i) | |
217 | 217 | func setBlocked (isBlocked) = if ((i.caller != this)) | |
218 | 218 | then throw("permission denied") | |
219 | 219 | else [BooleanEntry(keyBlocked(), isBlocked)] | |
220 | 220 | ||
221 | 221 | ||
222 | 222 | ||
223 | 223 | @Callable(i) | |
224 | 224 | func unstakeAcres (amount) = { | |
225 | 225 | let prologActions = prolog(i) | |
226 | 226 | if ((0 >= amount)) | |
227 | 227 | then throw("Amount should be positive") | |
228 | 228 | else { | |
229 | 229 | let address = toString(i.caller) | |
230 | 230 | if ((size(i.payments) != 0)) | |
231 | 231 | then throw("No payments required") | |
232 | 232 | else { | |
233 | 233 | let timeKey = keyAcresStakedTimeByUser(address) | |
234 | 234 | let amountKey = keyAcresStakedAmtByUser(address) | |
235 | 235 | let oldAcresAmount = valueOrElse(getInteger(amountKey), 0) | |
236 | 236 | if ((amount > oldAcresAmount)) | |
237 | 237 | then throw(((("You have only " + fixedPoint(oldAcresAmount, 8)) + " ACRES staked, tried to unstake ") + fixedPoint(amount, 8))) | |
238 | 238 | else { | |
239 | 239 | let oldTotal = valueOrElse(getInteger(acresStakdTotalKey), 0) | |
240 | 240 | let wlgResult = invoke(wlgContract, "onStakeUnstakeLand", [address], nil) | |
241 | - | $Tuple2(([IntegerEntry(timeKey, lastBlock.timestamp), IntegerEntry(amountKey, (oldAcresAmount - amount)), IntegerEntry(acresStakdTotalKey, (oldTotal - amount)), ScriptTransfer(i.caller, amount, acresAssetId)] ++ prologActions), wlgResult) | |
241 | + | let newAcresAmount = (oldAcresAmount - amount) | |
242 | + | let userFpKey = keyFarmingPowerByUser(address) | |
243 | + | let oldFp = valueOrElse(getInteger(userFpKey), 0) | |
244 | + | let newFp = getFarmingPowerByAcres(newAcresAmount) | |
245 | + | let oldTotalFp = valueOrElse(getInteger(totalFarmingPowerKey), 0) | |
246 | + | $Tuple2(([IntegerEntry(timeKey, lastBlock.timestamp), IntegerEntry(amountKey, (oldAcresAmount - amount)), IntegerEntry(acresStakdTotalKey, (oldTotal - amount)), IntegerEntry(userFpKey, newFp), IntegerEntry(totalFarmingPowerKey, ((oldTotalFp - oldFp) + newFp)), ScriptTransfer(i.caller, amount, acresAssetId)] ++ prologActions), wlgResult) | |
242 | 247 | } | |
243 | 248 | } | |
244 | 249 | } | |
245 | 250 | } | |
246 | 251 | ||
247 | 252 | ||
248 | 253 | ||
249 | 254 | @Callable(i) | |
250 | 255 | func stakeAcres () = { | |
251 | 256 | let prologActions = prolog(i) | |
252 | 257 | let address = toString(i.caller) | |
253 | 258 | if ((size(i.payments) != 1)) | |
254 | 259 | then throw("exactly 1 payment must be attached") | |
255 | 260 | else { | |
256 | 261 | let pmt = i.payments[0] | |
257 | 262 | let amt = pmt.amount | |
258 | 263 | if (if (!(isDefined(pmt.assetId))) | |
259 | 264 | then true | |
260 | 265 | else (value(pmt.assetId) != acresAssetId)) | |
261 | 266 | then throw("ACRES payments only!") | |
262 | 267 | else { | |
263 | - | let $ | |
264 | - | let actions = $ | |
265 | - | let wlgClaimedAmount = $ | |
268 | + | let $t038353901 = stakeAcresInternal(amt, address) | |
269 | + | let actions = $t038353901._1 | |
270 | + | let wlgClaimedAmount = $t038353901._2 | |
266 | 271 | $Tuple2((actions ++ prologActions), wlgClaimedAmount) | |
267 | 272 | } | |
268 | 273 | } | |
269 | 274 | } | |
270 | 275 | ||
271 | 276 | ||
272 | 277 | ||
273 | 278 | @Callable(i) | |
274 | 279 | func buyAcres () = { | |
275 | 280 | let prologActions = prolog(i) | |
276 | 281 | let address = toString(i.caller) | |
277 | 282 | if ((size(i.payments) != 1)) | |
278 | 283 | then throw("exactly 1 payment must be attached") | |
279 | 284 | else { | |
280 | 285 | let pmt = i.payments[0] | |
281 | 286 | let amt = pmt.amount | |
282 | 287 | if (if (!(isDefined(pmt.assetId))) | |
283 | 288 | then true | |
284 | 289 | else (value(pmt.assetId) != wlgAssetId)) | |
285 | 290 | then throw("WLGOLD payments only!") | |
286 | 291 | else if ((MULT8 > amt)) | |
287 | 292 | then throw((("Min payment should be " + fixedPoint(MULT8, 8)) + " WLGOLD")) | |
288 | 293 | else { | |
289 | 294 | let acresAmount = (amt * WLG2ACRES_MULTIPLIER) | |
290 | 295 | let wlgRemain = asInt(invoke(acres2Contract, "burnWlgold", nil, [AttachedPayment(wlgAssetId, amt)])) | |
291 | 296 | $Tuple2(([ScriptTransfer(i.caller, acresAmount, acresAssetId)] ++ prologActions), wlgRemain) | |
292 | 297 | } | |
293 | 298 | } | |
294 | 299 | } | |
295 | 300 | ||
296 | 301 | ||
297 | 302 | ||
298 | 303 | @Callable(i) | |
299 | 304 | func convertOldStakes () = { | |
300 | 305 | let address = toString(i.caller) | |
301 | 306 | if ((size(i.payments) != 0)) | |
302 | 307 | then throw("No payments required") | |
303 | 308 | else { | |
304 | 309 | let oldAcresAddress = addressFromStringValue(getStringValue(oldAcresContractKey)) | |
305 | 310 | let amount = valueOrElse(getInteger(oldAcresAddress, keyAcresStakedAmtByUser(address)), 0) | |
306 | 311 | let gotAcres0 = if ((amount > 0)) | |
307 | 312 | then asTuple2Ints(invoke(oldAcresAddress, "unstakeAcresCallback", [amount, address], nil)) | |
308 | 313 | else $Tuple2(0, 0) | |
309 | 314 | let oldStakingAddress = addressFromStringValue(oldStakingContractStr) | |
310 | 315 | let landsStr = getString(oldStakingAddress, keyStakedLandsByOwner(address)) | |
311 | 316 | let landsResult = if (isDefined(landsStr)) | |
312 | 317 | then { | |
313 | 318 | let lands = split_51C(value(landsStr), "_") | |
314 | 319 | func oneLand (acc,landAssetId) = if ((landAssetId == "")) | |
315 | 320 | then throw("landAssetId is required") | |
316 | 321 | else { | |
317 | 322 | let r = asTuple5Ints(invoke(oldStakingAddress, "unstakeLandCallback", [landAssetId, address], nil)) | |
318 | 323 | $Tuple4((acc._1 + r._1), (acc._2 + r._2), (acc._3 + r._3), (acc._4 + r._4)) | |
319 | 324 | } | |
320 | 325 | ||
321 | 326 | let rr = { | |
322 | 327 | let $l = lands | |
323 | 328 | let $s = size($l) | |
324 | 329 | let $acc0 = $Tuple4(0, 0, 0, 0) | |
325 | 330 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
326 | 331 | then $a | |
327 | 332 | else oneLand($a, $l[$i]) | |
328 | 333 | ||
329 | 334 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
330 | 335 | then $a | |
331 | 336 | else throw("List size exceeds 100") | |
332 | 337 | ||
333 | 338 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($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), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20), 21), 22), 23), 24), 25), 26), 27), 28), 29), 30), 31), 32), 33), 34), 35), 36), 37), 38), 39), 40), 41), 42), 43), 44), 45), 46), 47), 48), 49), 50), 51), 52), 53), 54), 55), 56), 57), 58), 59), 60), 61), 62), 63), 64), 65), 66), 67), 68), 69), 70), 71), 72), 73), 74), 75), 76), 77), 78), 79), 80), 81), 82), 83), 84), 85), 86), 87), 88), 89), 90), 91), 92), 93), 94), 95), 96), 97), 98), 99), 100) | |
334 | 339 | } | |
335 | 340 | let finalize = invoke(oldStakingAddress, "unstakeLandsFinalizeCallback", [address], nil) | |
336 | 341 | if ((finalize == finalize)) | |
337 | 342 | then { | |
338 | - | let req = invoke(oldAcresAddress, "requestAcresCallback", [(((rr._1 + rr._2) + rr._3) + rr._4) | |
343 | + | let req = invoke(oldAcresAddress, "requestAcresCallback", [(((rr._1 + rr._2) + rr._3) + rr._4)], nil) | |
339 | 344 | if ((req == req)) | |
340 | 345 | then { | |
341 | 346 | let issue = Issue("FPOWER10", "FarmingPower +10% NFT for WavesLands game", 1, 0, false) | |
342 | 347 | $Tuple5(rr._1, rr._2, rr._3, rr._4, [issue, ScriptTransfer(i.caller, 1, calculateAssetId(issue))]) | |
343 | 348 | } | |
344 | 349 | else throw("Strict value is not equal to itself.") | |
345 | 350 | } | |
346 | 351 | else throw("Strict value is not equal to itself.") | |
347 | 352 | } | |
348 | 353 | else $Tuple5(0, 0, 0, 0, nil) | |
349 | 354 | let duckAssetId = valueOrElse(getString(oldStakingAddress, keyStakedDuckByOwner(address)), "") | |
350 | 355 | let duckResult = if ((duckAssetId != "")) | |
351 | 356 | then asTuple3Ints(invoke(oldStakingAddress, "unstakeDuckCallback", [duckAssetId, address], nil)) | |
352 | 357 | else $Tuple3(0, 0, 0) | |
353 | - | let x = stakeAcresInternal(((((((( | |
358 | + | let x = stakeAcresInternal((((((((gotAcres0._1 + landsResult._1) + landsResult._2) + landsResult._3) + landsResult._4) + duckResult._1) + duckResult._2) + duckResult._3), address) | |
354 | 359 | $Tuple2((landsResult._5 ++ x._1), x._2) | |
355 | 360 | } | |
356 | 361 | } | |
357 | 362 | ||
358 | 363 | ||
359 | 364 | ||
360 | 365 | @Callable(i) | |
361 | 366 | func unstakeLandsREADONLY (address) = { | |
362 | 367 | let oldStakingAddress = addressFromStringValue(oldStakingContractStr) | |
363 | 368 | let landsStr = getString(oldStakingAddress, keyStakedLandsByOwner(address)) | |
364 | 369 | let landsResult = if (isDefined(landsStr)) | |
365 | 370 | then { | |
366 | 371 | let lands = split_51C(value(landsStr), "_") | |
367 | 372 | func oneLand (acc,landAssetId) = if ((landAssetId == "")) | |
368 | 373 | then throw("landAssetId is required") | |
369 | 374 | else { | |
370 | 375 | let r = asTuple4Ints(invoke(oldStakingAddress, "unstakeLandREADONLY", [landAssetId, address], nil)) | |
371 | 376 | $Tuple4((acc._1 + r._1), (acc._2 + r._2), (acc._3 + r._3), (acc._4 + r._4)) | |
372 | 377 | } | |
373 | 378 | ||
374 | 379 | let $l = lands | |
375 | 380 | let $s = size($l) | |
376 | 381 | let $acc0 = $Tuple4(0, 0, 0, 0) | |
377 | 382 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
378 | 383 | then $a | |
379 | 384 | else oneLand($a, $l[$i]) | |
380 | 385 | ||
381 | 386 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
382 | 387 | then $a | |
383 | 388 | else throw("List size exceeds 100") | |
384 | 389 | ||
385 | 390 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($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), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20), 21), 22), 23), 24), 25), 26), 27), 28), 29), 30), 31), 32), 33), 34), 35), 36), 37), 38), 39), 40), 41), 42), 43), 44), 45), 46), 47), 48), 49), 50), 51), 52), 53), 54), 55), 56), 57), 58), 59), 60), 61), 62), 63), 64), 65), 66), 67), 68), 69), 70), 71), 72), 73), 74), 75), 76), 77), 78), 79), 80), 81), 82), 83), 84), 85), 86), 87), 88), 89), 90), 91), 92), 93), 94), 95), 96), 97), 98), 99), 100) | |
386 | 391 | } | |
387 | 392 | else $Tuple4(0, 0, 0, 0) | |
388 | 393 | $Tuple2(nil, landsResult) | |
389 | 394 | } | |
390 | 395 | ||
391 | 396 |
github/deemru/w8io/026f985 56.29 ms ◑