tx · 3ZvBNMGscMe4p9anH7ECxscfYEsvpKUBvE7UwtAAEy7T 3NBPx1Fciu3JQNEGZ21jSnTdutLNGGBUSXh: -0.01200000 Waves 2024.09.12 22:00 [3280812] smart account 3NBPx1Fciu3JQNEGZ21jSnTdutLNGGBUSXh > SELF 0.00000000 Waves
{ "type": 13, "id": "3ZvBNMGscMe4p9anH7ECxscfYEsvpKUBvE7UwtAAEy7T", "fee": 1200000, "feeAssetId": null, "timestamp": 1726167648344, "version": 2, "chainId": 84, "sender": "3NBPx1Fciu3JQNEGZ21jSnTdutLNGGBUSXh", "senderPublicKey": "3QtfC1XbLZXdeawMDeSERy9vvjUmj1XYd2GFmrvx7pWQ", "proofs": [ "5fPtzCpt26U3NzbUm23uP4x5Uia4TEeHGkAk5hTamYEd2z6yuAFRUAJPtBKJ95NMprabHzGEtVFt8d4hMXojKFBT" ], "script": "base64:BgIjCAISBAoCCAgSBAoCCAESAwoBBBIDCgEBEgASABIAEgMKAQgsAANTRVACAl9fAAVNVUxUOACAwtcvABRXTEcyQUNSRVNfTVVMVElQTElFUgDIAQAFY2hhaW4JAMkBAgkAygECCAUEdGhpcwVieXRlcwABAAEAFmRlZmF1bHRSZXN0MkFkZHJlc3NTdHIEByRtYXRjaDAFBWNoYWluAwkAAAIBAVcFByRtYXRjaDACIzNQRndZdGE4YmlFejMxenBlRmU1REpLOHdFNXRyU3BRVkY4AwkAAAIBAVQFByRtYXRjaDACIzNON1V1WWFyNjI2NFA1OEZCaFZXS1BRQWg0WXVhMmhnbmd2CQACAQINVW5rbm93biBjaGFpbgAVb2xkU3Rha2luZ0NvbnRyYWN0U3RyBAckbWF0Y2gwBQVjaGFpbgMJAAACAQFXBQckbWF0Y2gwAiMzUExuY1h0UzFVODNENmNRYkZEM0g4ckJIUExnenhTRktaMQMJAAACAQFUBQckbWF0Y2gwAiMzTkRDeUJHNXE4NUp1YVJpaWdVZUV0YWlueWpDUVQzWHBabQkAAgECDVVua25vd24gY2hhaW4BD2dldFN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IJAQUkZjBfMQIJAQUkZjBfMQIJAQUkZjBfMQIJAQUkZjBfMQIJAQUkZjBfMQIJAQUkZjBfMQIJAQUkZjBfMQIJAQUkZjBfMQIJAQUkZjBfMQIJAQUkZjBfMQIJAQUkZjBfMQIJAQUkZjBfMQIJAQUkZjBfMQIJAQUkZjBfMQIJAQUkZjBfMQIJAQUkZjBfMQIJAQUkZjBfMQIJAQUkZjBfMQIJAQUkZjBfMQIJAQUkZjBfMQIJAQUkZjBfMQIJAQUkZjBfMQIJAQUkZjBfMQIJAQUkZjBfMQIJAQUkZjBfMQIJAQUkZjBfMQIJAQUkZjBfMQIJAQUkZjBfMQIJAQUkZjBfMQIJAQUkZjBfMQIFBSRhY2MwAAAAAQACAAMABAAFAAYABwAIAAkACgALAAwADQAOAA8AEAARABIAEwAUABUAFgAXABgAGQAaABsAHAAdAB4AHwAgACEAIgAjACQAJQAmACcAKAApACoAKwAsAC0ALgAvADAAMQAyADMANAA1ADYANwA4ADkAOgA7ADwAPQA+AD8AQABBAEIAQwBEAEUARgBHAEgASQBKAEsATABNAE4ATwBQAFEAUgBTAFQAVQBWAFcAWABZAFoAWwBcAF0AXgBfAGAAYQBiAGMAZAkAlgoEAAAAAAAAAAAJAJQKAgUDbmlsBQtsYW5kc1Jlc3VsdAB60REz", "height": 3280812, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 2SFwhzQcmyifc9R4pTxhQE7gxp823tV6Exq8LGtGxndX Next: AwAPsXvM7a85MJqvyhaKeQHETwBc2HPFhuCgSFMBFdyU Diff:
Old | New | Differences | |
---|---|---|---|
129 | 129 | } | |
130 | 130 | ||
131 | 131 | ||
132 | + | let M8_ = 100000000 | |
133 | + | ||
132 | 134 | func keyAcresStakedAmtByUser (addr) = ("acresStakedAmountByUser_" + addr) | |
133 | 135 | ||
134 | 136 | ||
137 | + | func keyFarmingPowerByUser (addr) = ("farmingPowerByUser_" + addr) | |
138 | + | ||
139 | + | ||
135 | 140 | let acresStakdTotalKey = "acresStakedAmountTotal" | |
141 | + | ||
142 | + | let totalFarmingPowerKey = "totalFarmingPower" | |
143 | + | ||
144 | + | let levels = [10, 20, 40, 80, 150, 250, 400, 700, 1000] | |
145 | + | ||
146 | + | func getLevelByAcres (acres) = { | |
147 | + | let acr = (acres / M8_) | |
148 | + | func checker (acc,item) = if ((item > acr)) | |
149 | + | then acc | |
150 | + | else (acc + 1) | |
151 | + | ||
152 | + | let idx = { | |
153 | + | let $l = levels | |
154 | + | let $s = size($l) | |
155 | + | let $acc0 = 0 | |
156 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
157 | + | then $a | |
158 | + | else checker($a, $l[$i]) | |
159 | + | ||
160 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
161 | + | then $a | |
162 | + | else throw("List size exceeds 10") | |
163 | + | ||
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 | + | } | |
166 | + | (idx + 1) | |
167 | + | } | |
168 | + | ||
169 | + | ||
170 | + | func getFarmingPowerByAcres (acres) = ((acres * 20) * (getLevelByAcres(acres) + 4)) | |
171 | + | ||
136 | 172 | ||
137 | 173 | func prolog (i) = if (if ((i.originCaller != rest2Contract)) | |
138 | 174 | then valueOrElse(getBoolean(keyBlocked()), false) | |
148 | 184 | let now = lastBlock.timestamp | |
149 | 185 | let timeKey = keyAcresStakedTimeByUser(address) | |
150 | 186 | let amountKey = keyAcresStakedAmtByUser(address) | |
151 | - | let | |
187 | + | let newAcresAmount = (valueOrElse(getInteger(amountKey), 0) + amt) | |
152 | 188 | let oldTotal = valueOrElse(getInteger(acresStakdTotalKey), 0) | |
153 | - | $Tuple2([IntegerEntry(timeKey, lastBlock.timestamp), IntegerEntry(amountKey, (oldAcresAmount + amt)), IntegerEntry(acresStakdTotalKey, (oldTotal + amt))], wlgResult) | |
189 | + | let userFpKey = keyFarmingPowerByUser(address) | |
190 | + | let oldFp = valueOrElse(getInteger(userFpKey), 0) | |
191 | + | let newFp = getFarmingPowerByAcres(newAcresAmount) | |
192 | + | let oldTotalFp = valueOrElse(getInteger(totalFarmingPowerKey), 0) | |
193 | + | $Tuple2([IntegerEntry(timeKey, lastBlock.timestamp), IntegerEntry(amountKey, newAcresAmount), IntegerEntry(acresStakdTotalKey, (oldTotal + amt)), IntegerEntry(userFpKey, newFp), IntegerEntry(totalFarmingPowerKey, ((oldTotalFp - oldFp) + newFp))], wlgResult) | |
154 | 194 | } | |
155 | 195 | else throw("Strict value is not equal to itself.") | |
156 | 196 | } | |
220 | 260 | else (value(pmt.assetId) != acresAssetId)) | |
221 | 261 | then throw("ACRES payments only!") | |
222 | 262 | else { | |
223 | - | let $ | |
224 | - | let actions = $ | |
225 | - | let wlgClaimedAmount = $ | |
263 | + | let $t034623528 = stakeAcresInternal(amt, address) | |
264 | + | let actions = $t034623528._1 | |
265 | + | let wlgClaimedAmount = $t034623528._2 | |
226 | 266 | $Tuple2((actions ++ prologActions), wlgClaimedAmount) | |
227 | 267 | } | |
228 | 268 | } |
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 | + | let M8_ = 100000000 | |
133 | + | ||
132 | 134 | func keyAcresStakedAmtByUser (addr) = ("acresStakedAmountByUser_" + addr) | |
133 | 135 | ||
134 | 136 | ||
137 | + | func keyFarmingPowerByUser (addr) = ("farmingPowerByUser_" + addr) | |
138 | + | ||
139 | + | ||
135 | 140 | let acresStakdTotalKey = "acresStakedAmountTotal" | |
141 | + | ||
142 | + | let totalFarmingPowerKey = "totalFarmingPower" | |
143 | + | ||
144 | + | let levels = [10, 20, 40, 80, 150, 250, 400, 700, 1000] | |
145 | + | ||
146 | + | func getLevelByAcres (acres) = { | |
147 | + | let acr = (acres / M8_) | |
148 | + | func checker (acc,item) = if ((item > acr)) | |
149 | + | then acc | |
150 | + | else (acc + 1) | |
151 | + | ||
152 | + | let idx = { | |
153 | + | let $l = levels | |
154 | + | let $s = size($l) | |
155 | + | let $acc0 = 0 | |
156 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
157 | + | then $a | |
158 | + | else checker($a, $l[$i]) | |
159 | + | ||
160 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
161 | + | then $a | |
162 | + | else throw("List size exceeds 10") | |
163 | + | ||
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 | + | } | |
166 | + | (idx + 1) | |
167 | + | } | |
168 | + | ||
169 | + | ||
170 | + | func getFarmingPowerByAcres (acres) = ((acres * 20) * (getLevelByAcres(acres) + 4)) | |
171 | + | ||
136 | 172 | ||
137 | 173 | func prolog (i) = if (if ((i.originCaller != rest2Contract)) | |
138 | 174 | then valueOrElse(getBoolean(keyBlocked()), false) | |
139 | 175 | else false) | |
140 | 176 | then throw("Contracts are under maintenance") | |
141 | 177 | else [StringEntry(keyLastTxIdByUser(toString(i.originCaller)), toBase58String(i.transactionId))] | |
142 | 178 | ||
143 | 179 | ||
144 | 180 | func stakeAcresInternal (amt,address) = { | |
145 | 181 | let wlgResult = invoke(wlgContract, "onStakeUnstakeLand", [address], nil) | |
146 | 182 | if ((wlgResult == wlgResult)) | |
147 | 183 | then { | |
148 | 184 | let now = lastBlock.timestamp | |
149 | 185 | let timeKey = keyAcresStakedTimeByUser(address) | |
150 | 186 | let amountKey = keyAcresStakedAmtByUser(address) | |
151 | - | let | |
187 | + | let newAcresAmount = (valueOrElse(getInteger(amountKey), 0) + amt) | |
152 | 188 | let oldTotal = valueOrElse(getInteger(acresStakdTotalKey), 0) | |
153 | - | $Tuple2([IntegerEntry(timeKey, lastBlock.timestamp), IntegerEntry(amountKey, (oldAcresAmount + amt)), IntegerEntry(acresStakdTotalKey, (oldTotal + amt))], wlgResult) | |
189 | + | let userFpKey = keyFarmingPowerByUser(address) | |
190 | + | let oldFp = valueOrElse(getInteger(userFpKey), 0) | |
191 | + | let newFp = getFarmingPowerByAcres(newAcresAmount) | |
192 | + | let oldTotalFp = valueOrElse(getInteger(totalFarmingPowerKey), 0) | |
193 | + | $Tuple2([IntegerEntry(timeKey, lastBlock.timestamp), IntegerEntry(amountKey, newAcresAmount), IntegerEntry(acresStakdTotalKey, (oldTotal + amt)), IntegerEntry(userFpKey, newFp), IntegerEntry(totalFarmingPowerKey, ((oldTotalFp - oldFp) + newFp))], wlgResult) | |
154 | 194 | } | |
155 | 195 | else throw("Strict value is not equal to itself.") | |
156 | 196 | } | |
157 | 197 | ||
158 | 198 | ||
159 | 199 | @Callable(i) | |
160 | 200 | func constructorV1 (rest2Addr,oldAcrContract) = if ((i.caller != this)) | |
161 | 201 | then throw("Permission denied") | |
162 | 202 | else { | |
163 | 203 | let oldAcrContAddr = addressFromStringValue(oldAcrContract) | |
164 | 204 | [IntegerEntry(acresIssuedAmountKey, getIntegerValue(oldAcrContAddr, acresIssuedAmountKey)), BinaryEntry(acresAssetIdKey, getBinaryValue(oldAcrContAddr, acresAssetIdKey)), StringEntry(keyRest2Address(), rest2Addr), StringEntry(oldAcresContractKey, oldAcrContract)] | |
165 | 205 | } | |
166 | 206 | ||
167 | 207 | ||
168 | 208 | ||
169 | 209 | @Callable(i) | |
170 | 210 | func saveInteger (key,amount) = if ((i.caller != this)) | |
171 | 211 | then throw("saveInteger is not public method") | |
172 | 212 | else [IntegerEntry(key, amount)] | |
173 | 213 | ||
174 | 214 | ||
175 | 215 | ||
176 | 216 | @Callable(i) | |
177 | 217 | func setBlocked (isBlocked) = if ((i.caller != this)) | |
178 | 218 | then throw("permission denied") | |
179 | 219 | else [BooleanEntry(keyBlocked(), isBlocked)] | |
180 | 220 | ||
181 | 221 | ||
182 | 222 | ||
183 | 223 | @Callable(i) | |
184 | 224 | func unstakeAcres (amount) = { | |
185 | 225 | let prologActions = prolog(i) | |
186 | 226 | if ((0 >= amount)) | |
187 | 227 | then throw("Amount should be positive") | |
188 | 228 | else { | |
189 | 229 | let address = toString(i.caller) | |
190 | 230 | if ((size(i.payments) != 0)) | |
191 | 231 | then throw("No payments required") | |
192 | 232 | else { | |
193 | 233 | let timeKey = keyAcresStakedTimeByUser(address) | |
194 | 234 | let amountKey = keyAcresStakedAmtByUser(address) | |
195 | 235 | let oldAcresAmount = valueOrElse(getInteger(amountKey), 0) | |
196 | 236 | if ((amount > oldAcresAmount)) | |
197 | 237 | then throw(((("You have only " + fixedPoint(oldAcresAmount, 8)) + " ACRES staked, tried to unstake ") + fixedPoint(amount, 8))) | |
198 | 238 | else { | |
199 | 239 | let oldTotal = valueOrElse(getInteger(acresStakdTotalKey), 0) | |
200 | 240 | let wlgResult = invoke(wlgContract, "onStakeUnstakeLand", [address], nil) | |
201 | 241 | $Tuple2(([IntegerEntry(timeKey, lastBlock.timestamp), IntegerEntry(amountKey, (oldAcresAmount - amount)), IntegerEntry(acresStakdTotalKey, (oldTotal - amount)), ScriptTransfer(i.caller, amount, acresAssetId)] ++ prologActions), wlgResult) | |
202 | 242 | } | |
203 | 243 | } | |
204 | 244 | } | |
205 | 245 | } | |
206 | 246 | ||
207 | 247 | ||
208 | 248 | ||
209 | 249 | @Callable(i) | |
210 | 250 | func stakeAcres () = { | |
211 | 251 | let prologActions = prolog(i) | |
212 | 252 | let address = toString(i.caller) | |
213 | 253 | if ((size(i.payments) != 1)) | |
214 | 254 | then throw("exactly 1 payment must be attached") | |
215 | 255 | else { | |
216 | 256 | let pmt = i.payments[0] | |
217 | 257 | let amt = pmt.amount | |
218 | 258 | if (if (!(isDefined(pmt.assetId))) | |
219 | 259 | then true | |
220 | 260 | else (value(pmt.assetId) != acresAssetId)) | |
221 | 261 | then throw("ACRES payments only!") | |
222 | 262 | else { | |
223 | - | let $ | |
224 | - | let actions = $ | |
225 | - | let wlgClaimedAmount = $ | |
263 | + | let $t034623528 = stakeAcresInternal(amt, address) | |
264 | + | let actions = $t034623528._1 | |
265 | + | let wlgClaimedAmount = $t034623528._2 | |
226 | 266 | $Tuple2((actions ++ prologActions), wlgClaimedAmount) | |
227 | 267 | } | |
228 | 268 | } | |
229 | 269 | } | |
230 | 270 | ||
231 | 271 | ||
232 | 272 | ||
233 | 273 | @Callable(i) | |
234 | 274 | func buyAcres () = { | |
235 | 275 | let prologActions = prolog(i) | |
236 | 276 | let address = toString(i.caller) | |
237 | 277 | if ((size(i.payments) != 1)) | |
238 | 278 | then throw("exactly 1 payment must be attached") | |
239 | 279 | else { | |
240 | 280 | let pmt = i.payments[0] | |
241 | 281 | let amt = pmt.amount | |
242 | 282 | if (if (!(isDefined(pmt.assetId))) | |
243 | 283 | then true | |
244 | 284 | else (value(pmt.assetId) != wlgAssetId)) | |
245 | 285 | then throw("WLGOLD payments only!") | |
246 | 286 | else if ((MULT8 > amt)) | |
247 | 287 | then throw((("Min payment should be " + fixedPoint(MULT8, 8)) + " WLGOLD")) | |
248 | 288 | else { | |
249 | 289 | let acresAmount = (amt * WLG2ACRES_MULTIPLIER) | |
250 | 290 | let wlgRemain = asInt(invoke(acres2Contract, "burnWlgold", nil, [AttachedPayment(wlgAssetId, amt)])) | |
251 | 291 | $Tuple2(([ScriptTransfer(i.caller, acresAmount, acresAssetId)] ++ prologActions), wlgRemain) | |
252 | 292 | } | |
253 | 293 | } | |
254 | 294 | } | |
255 | 295 | ||
256 | 296 | ||
257 | 297 | ||
258 | 298 | @Callable(i) | |
259 | 299 | func convertOldStakes () = { | |
260 | 300 | let address = toString(i.caller) | |
261 | 301 | if ((size(i.payments) != 0)) | |
262 | 302 | then throw("No payments required") | |
263 | 303 | else { | |
264 | 304 | let oldAcresAddress = addressFromStringValue(getStringValue(oldAcresContractKey)) | |
265 | 305 | let amount = valueOrElse(getInteger(oldAcresAddress, keyAcresStakedAmtByUser(address)), 0) | |
266 | 306 | let gotAcres0 = if ((amount > 0)) | |
267 | 307 | then asTuple2Ints(invoke(oldAcresAddress, "unstakeAcresCallback", [amount, address], nil)) | |
268 | 308 | else $Tuple2(0, 0) | |
269 | 309 | let oldStakingAddress = addressFromStringValue(oldStakingContractStr) | |
270 | 310 | let landsStr = getString(oldStakingAddress, keyStakedLandsByOwner(address)) | |
271 | 311 | let landsResult = if (isDefined(landsStr)) | |
272 | 312 | then { | |
273 | 313 | let lands = split_51C(value(landsStr), "_") | |
274 | 314 | func oneLand (acc,landAssetId) = if ((landAssetId == "")) | |
275 | 315 | then throw("landAssetId is required") | |
276 | 316 | else { | |
277 | 317 | let r = asTuple5Ints(invoke(oldStakingAddress, "unstakeLandCallback", [landAssetId, address], nil)) | |
278 | 318 | $Tuple4((acc._1 + r._1), (acc._2 + r._2), (acc._3 + r._3), (acc._4 + r._4)) | |
279 | 319 | } | |
280 | 320 | ||
281 | 321 | let rr = { | |
282 | 322 | let $l = lands | |
283 | 323 | let $s = size($l) | |
284 | 324 | let $acc0 = $Tuple4(0, 0, 0, 0) | |
285 | 325 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
286 | 326 | then $a | |
287 | 327 | else oneLand($a, $l[$i]) | |
288 | 328 | ||
289 | 329 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
290 | 330 | then $a | |
291 | 331 | else throw("List size exceeds 100") | |
292 | 332 | ||
293 | 333 | $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) | |
294 | 334 | } | |
295 | 335 | let finalize = invoke(oldStakingAddress, "unstakeLandsFinalizeCallback", [address], nil) | |
296 | 336 | if ((finalize == finalize)) | |
297 | 337 | then { | |
298 | 338 | let req = invoke(oldAcresAddress, "requestAcresCallback", [(((rr._1 + rr._2) + rr._3) + rr._4), address], nil) | |
299 | 339 | if ((req == req)) | |
300 | 340 | then { | |
301 | 341 | let issue = Issue("FPOWER10", "FarmingPower +10% NFT for WavesLands game", 1, 0, false) | |
302 | 342 | $Tuple5(rr._1, rr._2, rr._3, rr._4, [issue, ScriptTransfer(i.caller, 1, calculateAssetId(issue))]) | |
303 | 343 | } | |
304 | 344 | else throw("Strict value is not equal to itself.") | |
305 | 345 | } | |
306 | 346 | else throw("Strict value is not equal to itself.") | |
307 | 347 | } | |
308 | 348 | else $Tuple5(0, 0, 0, 0, nil) | |
309 | 349 | let duckAssetId = valueOrElse(getString(oldStakingAddress, keyStakedDuckByOwner(address)), "") | |
310 | 350 | let duckResult = if ((duckAssetId != "")) | |
311 | 351 | then asTuple3Ints(invoke(oldStakingAddress, "unstakeDuckCallback", [duckAssetId, address], nil)) | |
312 | 352 | else $Tuple3(0, 0, 0) | |
313 | 353 | let x = stakeAcresInternal(((((((((gotAcres0._1 + gotAcres0._2) + landsResult._1) + landsResult._2) + landsResult._3) + landsResult._4) + duckResult._1) + duckResult._2) + duckResult._3), address) | |
314 | 354 | $Tuple2((landsResult._5 ++ x._1), x._2) | |
315 | 355 | } | |
316 | 356 | } | |
317 | 357 | ||
318 | 358 | ||
319 | 359 | ||
320 | 360 | @Callable(i) | |
321 | 361 | func unstakeLandsREADONLY (address) = { | |
322 | 362 | let oldStakingAddress = addressFromStringValue(oldStakingContractStr) | |
323 | 363 | let landsStr = getString(oldStakingAddress, keyStakedLandsByOwner(address)) | |
324 | 364 | let landsResult = if (isDefined(landsStr)) | |
325 | 365 | then { | |
326 | 366 | let lands = split_51C(value(landsStr), "_") | |
327 | 367 | func oneLand (acc,landAssetId) = if ((landAssetId == "")) | |
328 | 368 | then throw("landAssetId is required") | |
329 | 369 | else { | |
330 | 370 | let r = asTuple4Ints(invoke(oldStakingAddress, "unstakeLandREADONLY", [landAssetId, address], nil)) | |
331 | 371 | $Tuple4((acc._1 + r._1), (acc._2 + r._2), (acc._3 + r._3), (acc._4 + r._4)) | |
332 | 372 | } | |
333 | 373 | ||
334 | 374 | let $l = lands | |
335 | 375 | let $s = size($l) | |
336 | 376 | let $acc0 = $Tuple4(0, 0, 0, 0) | |
337 | 377 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
338 | 378 | then $a | |
339 | 379 | else oneLand($a, $l[$i]) | |
340 | 380 | ||
341 | 381 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
342 | 382 | then $a | |
343 | 383 | else throw("List size exceeds 100") | |
344 | 384 | ||
345 | 385 | $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) | |
346 | 386 | } | |
347 | 387 | else $Tuple4(0, 0, 0, 0) | |
348 | 388 | $Tuple2(nil, landsResult) | |
349 | 389 | } | |
350 | 390 | ||
351 | 391 |
github/deemru/w8io/026f985 56.22 ms ◑