tx · 62zA3erjkHtszfmhDVFqw3m4MmgxT4B1gYLGR9nZd6w5 3NBPx1Fciu3JQNEGZ21jSnTdutLNGGBUSXh: -0.00700000 Waves 2024.09.01 22:57 [3264942] smart account 3NBPx1Fciu3JQNEGZ21jSnTdutLNGGBUSXh > SELF 0.00000000 Waves
{ "type": 13, "id": "62zA3erjkHtszfmhDVFqw3m4MmgxT4B1gYLGR9nZd6w5", "fee": 700000, "feeAssetId": null, "timestamp": 1725220701703, "version": 2, "chainId": 84, "sender": "3NBPx1Fciu3JQNEGZ21jSnTdutLNGGBUSXh", "senderPublicKey": "3QtfC1XbLZXdeawMDeSERy9vvjUmj1XYd2GFmrvx7pWQ", "proofs": [ "5pozPYWhv7qyWmXFtRaVnuBMn4jZVQq4zmP1KYBHSMn9Z4sNjomNbPksywMLLcXfFfpKxHWgdPSD8fyM4MQcqDWy" ], "script": "base64:BgIjCAISBAoCCAgSBAoCCAESAwoBBBIDCgEBEgASABIAEgMKAQgeAANTRVACAl9fAAVNVUxUNgDAhD0ABWNoYWluCQDJAQIJAMoBAggFBHRoaXMFYnl0ZXMAAQABAAt1c2R0QXNzZXRJZAQHJG1hdGNoMAUFY2hhaW4DCQAAAgEBVwUHJG1hdGNoMAEghNp6sggDP07Ru8qO7ouTvMmC3Qtd+geWqNQj+agP/7kDCQAAAgEBVAUHJG1hdGNoMAEgVbHYn3KHgu/l41uNrAWrZd6aQ6EvFrsF8xq3h6XxxRgJAAIBAg1Vbmtub3duIGNoYWluABVkZWZhdWx0UmVzdEFkZHJlc3NTdHIEByRtYXRjaDAFBWNoYWluAwkAAAIBAVcFByRtYXRjaDACBTNQLi4uAwkAAAIBAVQFByRtYXRjaDACBTNNLi4uCQACAQINVW5rbm93biBjaGFpbgEPZ2V0U3RyaW5nT3JGYWlsAgdhZGRyZXNzA2tleQkBE3ZhbHVlT3JFcnJvck1lc3NhZ2UCCQCdCAIFB2FkZHJlc3MFA2tleQkAuQkCCQDMCAICCm1hbmRhdG9yeSAJ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2FkZHJlc3MEB3RpbWVLZXkJARhrZXlBY3Jlc1N0YWtlZFRpbWVCeVVzZXIBBQdhZGRyZXNzBAlhbW91bnRLZXkJARprZXlBY3Jlc1N0YWtlZEFtb3VudEJ5VXNlcgEFB2FkZHJlc3MEC2FjcmVzQW1vdW50CQELdmFsdWVPckVsc2UCCQCfCAEFCWFtb3VudEtleQAABAhsYXN0VGltZQkBC3ZhbHVlT3JFbHNlAgkAnwgBBQd0aW1lS2V5AAAEDGNsYWltZWRBY3JlcwkBEmNsYWltQWNyZXNJbnRlcm5hbAMFB2FkZHJlc3MFC2FjcmVzQW1vdW50BQhsYXN0VGltZQkAlAoCBQNuaWwJAMwIAgUMY2xhaW1lZEFjcmVzCQDMCAIFCGxhc3RUaW1lBQNuaWwAceWSZg==", "height": 3264942, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: RyChEmEcJRAFXuTxqNJ7ijmhFb6RFCihta3D2iLDxRg Next: 9o6RQBmnKktY7PVY2spYEQLrsLeLGRdjUASy1UbziKmJ Diff:
Old | New | Differences | |
---|---|---|---|
58 | 58 | func keyLastTxIdByUser (addr) = ("lastTxIdByUser_" + addr) | |
59 | 59 | ||
60 | 60 | ||
61 | + | let acresIssuedAmountKey = "acresIssuedAmount" | |
62 | + | ||
61 | 63 | let acresAssetIdKey = "acresAssetId" | |
62 | 64 | ||
63 | 65 | let acresAssetId = valueOrErrorMessage(getBinary(stakingContract, acresAssetIdKey), "ACRES is not issued yet") | |
106 | 108 | ||
107 | 109 | ||
108 | 110 | @Callable(i) | |
109 | - | func constructorV1 (restAddr) = if ((i.caller != this)) | |
111 | + | func constructorV1 (restAddr,oldAcrContract) = if ((i.caller != this)) | |
110 | 112 | then throw("Permission denied") | |
111 | - | else [StringEntry(keyRestAddress(), restAddr)] | |
113 | + | else { | |
114 | + | let oldAcrContAddr = addressFromStringValue(oldAcrContract) | |
115 | + | [IntegerEntry(acresIssuedAmountKey, getIntegerValue(oldAcrContAddr, acresIssuedAmountKey)), BinaryEntry(acresAssetIdKey, getBinaryValue(oldAcrContAddr, acresAssetIdKey)), StringEntry(keyRestAddress(), restAddr)] | |
116 | + | } | |
112 | 117 | ||
113 | 118 | ||
114 | 119 |
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 MULT6 = 1000000 | |
7 | 7 | ||
8 | 8 | let chain = take(drop(this.bytes, 1), 1) | |
9 | 9 | ||
10 | 10 | let usdtAssetId = match chain { | |
11 | 11 | case _ => | |
12 | 12 | if ((base58'2W' == $match0)) | |
13 | 13 | then base58'9wc3LXNA4TEBsXyKtoLE9mrbDD7WMHXvXrCjZvabLAsi' | |
14 | 14 | else if ((base58'2T' == $match0)) | |
15 | 15 | then base58'6mWwf9mZBjVgkC54idpyaZLQfAosD914wT8fGf2iiY63' | |
16 | 16 | else throw("Unknown chain") | |
17 | 17 | } | |
18 | 18 | ||
19 | 19 | let defaultRestAddressStr = match chain { | |
20 | 20 | case _ => | |
21 | 21 | if ((base58'2W' == $match0)) | |
22 | 22 | then "3P..." | |
23 | 23 | else if ((base58'2T' == $match0)) | |
24 | 24 | then "3M..." | |
25 | 25 | else throw("Unknown chain") | |
26 | 26 | } | |
27 | 27 | ||
28 | 28 | func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], "")) | |
29 | 29 | ||
30 | 30 | ||
31 | 31 | let IdxCfgAcresDapp = 1 | |
32 | 32 | ||
33 | 33 | let IdxCfgWlgDapp = 2 | |
34 | 34 | ||
35 | 35 | func keyRestCfg () = "%s__restConfig" | |
36 | 36 | ||
37 | 37 | ||
38 | 38 | func keyRestAddress () = "%s__restAddr" | |
39 | 39 | ||
40 | 40 | ||
41 | 41 | func readRestCfgOrFail (rest) = split_4C(getStringOrFail(rest, keyRestCfg()), SEP) | |
42 | 42 | ||
43 | 43 | ||
44 | 44 | func getContractAddressOrFail (restCfg,idx) = valueOrErrorMessage(addressFromString(restCfg[idx]), ("Rest cfg doesn't contain address at index " + toString(idx))) | |
45 | 45 | ||
46 | 46 | ||
47 | 47 | let restContract = addressFromStringValue(valueOrElse(getString(this, keyRestAddress()), defaultRestAddressStr)) | |
48 | 48 | ||
49 | 49 | let restCfg = readRestCfgOrFail(restContract) | |
50 | 50 | ||
51 | 51 | let stakingContract = getContractAddressOrFail(restCfg, IdxCfgAcresDapp) | |
52 | 52 | ||
53 | 53 | let wlgContract = getContractAddressOrFail(restCfg, IdxCfgWlgDapp) | |
54 | 54 | ||
55 | 55 | func keyBlocked () = "contractsBlocked" | |
56 | 56 | ||
57 | 57 | ||
58 | 58 | func keyLastTxIdByUser (addr) = ("lastTxIdByUser_" + addr) | |
59 | 59 | ||
60 | 60 | ||
61 | + | let acresIssuedAmountKey = "acresIssuedAmount" | |
62 | + | ||
61 | 63 | let acresAssetIdKey = "acresAssetId" | |
62 | 64 | ||
63 | 65 | let acresAssetId = valueOrErrorMessage(getBinary(stakingContract, acresAssetIdKey), "ACRES is not issued yet") | |
64 | 66 | ||
65 | 67 | func keyAcresStakedTimeByUser (addr) = ("acresStakedTimeByUser_" + addr) | |
66 | 68 | ||
67 | 69 | ||
68 | 70 | func fixedPoint (val,decimals) = { | |
69 | 71 | let tenPow = pow(10, 0, decimals, 0, 0, DOWN) | |
70 | 72 | let lowPart = toString((val % tenPow)) | |
71 | 73 | let zeroes = drop(toString(tenPow), (1 + size(lowPart))) | |
72 | 74 | (((toString((val / tenPow)) + ".") + zeroes) + lowPart) | |
73 | 75 | } | |
74 | 76 | ||
75 | 77 | ||
76 | 78 | func keyAcresStakedAmountByUser (addr) = ("acresStakedAmountByUser_" + addr) | |
77 | 79 | ||
78 | 80 | ||
79 | 81 | func keyAcresLockedAmountByUser (addr) = ("acresLockedAmountByUser_" + addr) | |
80 | 82 | ||
81 | 83 | ||
82 | 84 | func keyAcresLockedEtaByUser (addr) = ("acresLockedEtaByUser_" + addr) | |
83 | 85 | ||
84 | 86 | ||
85 | 87 | let acresStakedTotalKey = "acresStakedAmountTotal" | |
86 | 88 | ||
87 | 89 | func prolog (i) = if (if ((i.originCaller != restContract)) | |
88 | 90 | then valueOrElse(getBoolean(keyBlocked()), false) | |
89 | 91 | else false) | |
90 | 92 | then throw("Contracts are under maintenance") | |
91 | 93 | else [StringEntry(keyLastTxIdByUser(toString(i.originCaller)), toBase58String(i.transactionId))] | |
92 | 94 | ||
93 | 95 | ||
94 | 96 | func claimAcresInternal (addr,acresAmount,lastClaimTime) = { | |
95 | 97 | let deltaTime = (lastBlock.timestamp - lastClaimTime) | |
96 | 98 | 42 | |
97 | 99 | } | |
98 | 100 | ||
99 | 101 | ||
100 | 102 | func claimInternal (addr,acresAmount,lastClaimTime) = { | |
101 | 103 | let deltaTime = (lastBlock.timestamp - lastClaimTime) | |
102 | 104 | if ((0 > deltaTime)) | |
103 | 105 | then throw(((("Saved timestamp is in future, saved = " + toString(lastClaimTime)) + ", current = ") + toString(lastBlock.timestamp))) | |
104 | 106 | else 42 | |
105 | 107 | } | |
106 | 108 | ||
107 | 109 | ||
108 | 110 | @Callable(i) | |
109 | - | func constructorV1 (restAddr) = if ((i.caller != this)) | |
111 | + | func constructorV1 (restAddr,oldAcrContract) = if ((i.caller != this)) | |
110 | 112 | then throw("Permission denied") | |
111 | - | else [StringEntry(keyRestAddress(), restAddr)] | |
113 | + | else { | |
114 | + | let oldAcrContAddr = addressFromStringValue(oldAcrContract) | |
115 | + | [IntegerEntry(acresIssuedAmountKey, getIntegerValue(oldAcrContAddr, acresIssuedAmountKey)), BinaryEntry(acresAssetIdKey, getBinaryValue(oldAcrContAddr, acresAssetIdKey)), StringEntry(keyRestAddress(), restAddr)] | |
116 | + | } | |
112 | 117 | ||
113 | 118 | ||
114 | 119 | ||
115 | 120 | @Callable(i) | |
116 | 121 | func saveInteger (key,amount) = if ((i.caller != this)) | |
117 | 122 | then throw("saveInteger is not public method") | |
118 | 123 | else [IntegerEntry(key, amount)] | |
119 | 124 | ||
120 | 125 | ||
121 | 126 | ||
122 | 127 | @Callable(i) | |
123 | 128 | func setBlocked (isBlocked) = if ((i.caller != this)) | |
124 | 129 | then throw("permission denied") | |
125 | 130 | else [BooleanEntry(keyBlocked(), isBlocked)] | |
126 | 131 | ||
127 | 132 | ||
128 | 133 | ||
129 | 134 | @Callable(i) | |
130 | 135 | func unstakeAcres (amount) = { | |
131 | 136 | let prologResult = prolog(i) | |
132 | 137 | if ((prologResult == prologResult)) | |
133 | 138 | then if ((0 >= amount)) | |
134 | 139 | then throw("Amount should be positive") | |
135 | 140 | else { | |
136 | 141 | let address = toString(i.caller) | |
137 | 142 | if ((size(i.payments) != 0)) | |
138 | 143 | then throw("No payments required") | |
139 | 144 | else { | |
140 | 145 | let timeKey = keyAcresStakedTimeByUser(address) | |
141 | 146 | let amountKey = keyAcresStakedAmountByUser(address) | |
142 | 147 | let oldAcresAmount = valueOrElse(getInteger(amountKey), 0) | |
143 | 148 | if ((amount > oldAcresAmount)) | |
144 | 149 | then throw(((("You have only " + fixedPoint(oldAcresAmount, 8)) + " ACRES staked, tried to unstake ") + fixedPoint(amount, 8))) | |
145 | 150 | else { | |
146 | 151 | let lockedAmount = valueOrElse(getInteger(keyAcresLockedAmountByUser(address)), 0) | |
147 | 152 | let lockedETA = valueOrElse(getInteger(keyAcresLockedEtaByUser(address)), 0) | |
148 | 153 | let now = lastBlock.timestamp | |
149 | 154 | let unstakableAmount = (oldAcresAmount - lockedAmount) | |
150 | 155 | if (if ((lockedETA > now)) | |
151 | 156 | then (amount > unstakableAmount) | |
152 | 157 | else false) | |
153 | 158 | then throw(((("Only " + fixedPoint(unstakableAmount, 8)) + " ACRES can be unstaked now, wait until ") + toString(lockedETA))) | |
154 | 159 | else { | |
155 | 160 | let oldTotal = valueOrElse(getInteger(acresStakedTotalKey), 0) | |
156 | 161 | let wlgResult = invoke(wlgContract, "onStakeUnstakeLand", [address], nil) | |
157 | 162 | let claimedAcres = claimInternal(address, oldAcresAmount, valueOrElse(getInteger(timeKey), 0)) | |
158 | 163 | $Tuple2([IntegerEntry(timeKey, lastBlock.timestamp), IntegerEntry(amountKey, (oldAcresAmount - amount)), IntegerEntry(acresStakedTotalKey, (oldTotal - amount)), ScriptTransfer(i.caller, (amount + claimedAcres), acresAssetId)], $Tuple2(prologResult, wlgResult)) | |
159 | 164 | } | |
160 | 165 | } | |
161 | 166 | } | |
162 | 167 | } | |
163 | 168 | else throw("Strict value is not equal to itself.") | |
164 | 169 | } | |
165 | 170 | ||
166 | 171 | ||
167 | 172 | ||
168 | 173 | @Callable(i) | |
169 | 174 | func stakeAcres () = { | |
170 | 175 | let prologResult = prolog(i) | |
171 | 176 | if ((prologResult == prologResult)) | |
172 | 177 | then { | |
173 | 178 | let address = toString(i.caller) | |
174 | 179 | if ((size(i.payments) != 1)) | |
175 | 180 | then throw("exactly 1 payment must be attached") | |
176 | 181 | else { | |
177 | 182 | let pmt = i.payments[0] | |
178 | 183 | let amt = pmt.amount | |
179 | 184 | if (if (!(isDefined(pmt.assetId))) | |
180 | 185 | then true | |
181 | 186 | else (value(pmt.assetId) != acresAssetId)) | |
182 | 187 | then throw("ACRES payments only!") | |
183 | 188 | else { | |
184 | 189 | let wlgResult = invoke(wlgContract, "onStakeUnstakeLand", [address], nil) | |
185 | 190 | if ((wlgResult == wlgResult)) | |
186 | 191 | then { | |
187 | 192 | let now = lastBlock.timestamp | |
188 | 193 | let timeKey = keyAcresStakedTimeByUser(address) | |
189 | 194 | let amountKey = keyAcresStakedAmountByUser(address) | |
190 | 195 | let oldAcresAmount = valueOrElse(getInteger(amountKey), 0) | |
191 | 196 | let oldTotal = valueOrElse(getInteger(acresStakedTotalKey), 0) | |
192 | 197 | let claimedAcres = claimInternal(address, oldAcresAmount, valueOrElse(getInteger(timeKey), 0)) | |
193 | 198 | $Tuple2(((((if ((claimedAcres == 0)) | |
194 | 199 | then nil | |
195 | 200 | else [ScriptTransfer(i.caller, claimedAcres, acresAssetId)]) :+ IntegerEntry(timeKey, lastBlock.timestamp)) :+ IntegerEntry(amountKey, (oldAcresAmount + amt))) :+ IntegerEntry(acresStakedTotalKey, (oldTotal + amt))), $Tuple2(prologResult, wlgResult)) | |
196 | 201 | } | |
197 | 202 | else throw("Strict value is not equal to itself.") | |
198 | 203 | } | |
199 | 204 | } | |
200 | 205 | } | |
201 | 206 | else throw("Strict value is not equal to itself.") | |
202 | 207 | } | |
203 | 208 | ||
204 | 209 | ||
205 | 210 | ||
206 | 211 | @Callable(i) | |
207 | 212 | func buyAcres () = { | |
208 | 213 | let prologResult = prolog(i) | |
209 | 214 | if ((prologResult == prologResult)) | |
210 | 215 | then { | |
211 | 216 | let address = toString(i.caller) | |
212 | 217 | if ((size(i.payments) != 1)) | |
213 | 218 | then throw("exactly 1 payment must be attached") | |
214 | 219 | else { | |
215 | 220 | let pmt = i.payments[0] | |
216 | 221 | let amt = pmt.amount | |
217 | 222 | if (if (!(isDefined(pmt.assetId))) | |
218 | 223 | then true | |
219 | 224 | else (value(pmt.assetId) != usdtAssetId)) | |
220 | 225 | then throw("USDT payments only!") | |
221 | 226 | else if ((MULT6 > amt)) | |
222 | 227 | then throw((("Min payment should be " + fixedPoint(MULT6, 6)) + " USDT")) | |
223 | 228 | else $Tuple2(nil, prologResult) | |
224 | 229 | } | |
225 | 230 | } | |
226 | 231 | else throw("Strict value is not equal to itself.") | |
227 | 232 | } | |
228 | 233 | ||
229 | 234 | ||
230 | 235 | ||
231 | 236 | @Callable(i) | |
232 | 237 | func claimAcres () = { | |
233 | 238 | let prologResult = prolog(i) | |
234 | 239 | if ((prologResult == prologResult)) | |
235 | 240 | then { | |
236 | 241 | let address = toString(i.caller) | |
237 | 242 | if ((size(i.payments) != 0)) | |
238 | 243 | then throw("No payments required") | |
239 | 244 | else { | |
240 | 245 | let timeKey = keyAcresStakedTimeByUser(address) | |
241 | 246 | let amountKey = keyAcresStakedAmountByUser(address) | |
242 | 247 | let acresAmount = valueOrElse(getInteger(amountKey), 0) | |
243 | 248 | let wlgResult = invoke(wlgContract, "onStakeUnstakeLand", [address], nil) | |
244 | 249 | let claimedAcres = claimInternal(address, acresAmount, valueOrElse(getInteger(timeKey), 0)) | |
245 | 250 | $Tuple2([IntegerEntry(timeKey, lastBlock.timestamp), ScriptTransfer(i.caller, claimedAcres, acresAssetId)], $Tuple2(prologResult, wlgResult)) | |
246 | 251 | } | |
247 | 252 | } | |
248 | 253 | else throw("Strict value is not equal to itself.") | |
249 | 254 | } | |
250 | 255 | ||
251 | 256 | ||
252 | 257 | ||
253 | 258 | @Callable(i) | |
254 | 259 | func claimAcresREADONLY (address) = { | |
255 | 260 | let timeKey = keyAcresStakedTimeByUser(address) | |
256 | 261 | let amountKey = keyAcresStakedAmountByUser(address) | |
257 | 262 | let acresAmount = valueOrElse(getInteger(amountKey), 0) | |
258 | 263 | let lastTime = valueOrElse(getInteger(timeKey), 0) | |
259 | 264 | let claimedAcres = claimAcresInternal(address, acresAmount, lastTime) | |
260 | 265 | $Tuple2(nil, [claimedAcres, lastTime]) | |
261 | 266 | } | |
262 | 267 | ||
263 | 268 |
github/deemru/w8io/026f985 33.40 ms ◑