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/l41uNrAWrZd6aQ6EvFrsF8xq3h6XxxRgJAAIBAg1Vbmtub3duIGNoYWluABVkZWZhdWx0UmVzdEFkZHJlc3NTdHIEByRtYXRjaDAFBWNoYWluAwkAAAIBAVcFByRtYXRjaDACBTNQLi4uAwkAAAIBAVQFByRtYXRjaDACBTNNLi4uCQACAQINVW5rbm93biBjaGFpbgEPZ2V0U3RyaW5nT3JGYWlsAgdhZGRyZXNzA2tleQkBE3ZhbHVlT3JFcnJvck1lc3NhZ2UCCQCdCAIFB2FkZHJlc3MFA2tleQkAuQkCCQDMCAICCm1hbmRhdG9yeSA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B2FkZHJlc3MEB3RpbWVLZXkJARhrZXlBY3Jlc1N0YWtlZFRpbWVCeVVzZXIBBQdhZGRyZXNzBAlhbW91bnRLZXkJARprZXlBY3Jlc1N0YWtlZEFtb3VudEJ5VXNlcgEFB2FkZHJlc3MEC2FjcmVzQW1vdW50CQELdmFsdWVPckVsc2UCCQCfCAEFCWFtb3VudEtleQAABAhsYXN0VGltZQkBC3ZhbHVlT3JFbHNlAgkAnwgBBQd0aW1lS2V5AAAEDGNsYWltZWRBY3JlcwkBEmNsYWltQWNyZXNJbnRlcm5hbAMFB2FkZHJlc3MFC2FjcmVzQW1vdW50BQhsYXN0VGltZQkAlAoCBQNuaWwJAMwIAgUMY2xhaW1lZEFjcmVzCQDMCAIFCGxhc3RUaW1lBQNuaWwAceWSZg==", "height": 3264942, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: RyChEmEcJRAFXuTxqNJ7ijmhFb6RFCihta3D2iLDxRg Next: 9o6RQBmnKktY7PVY2spYEQLrsLeLGRdjUASy1UbziKmJ Diff:
OldNewDifferences
5858 func keyLastTxIdByUser (addr) = ("lastTxIdByUser_" + addr)
5959
6060
61+let acresIssuedAmountKey = "acresIssuedAmount"
62+
6163 let acresAssetIdKey = "acresAssetId"
6264
6365 let acresAssetId = valueOrErrorMessage(getBinary(stakingContract, acresAssetIdKey), "ACRES is not issued yet")
106108
107109
108110 @Callable(i)
109-func constructorV1 (restAddr) = if ((i.caller != this))
111+func constructorV1 (restAddr,oldAcrContract) = if ((i.caller != this))
110112 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+ }
112117
113118
114119
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let SEP = "__"
55
66 let MULT6 = 1000000
77
88 let chain = take(drop(this.bytes, 1), 1)
99
1010 let usdtAssetId = match chain {
1111 case _ =>
1212 if ((base58'2W' == $match0))
1313 then base58'9wc3LXNA4TEBsXyKtoLE9mrbDD7WMHXvXrCjZvabLAsi'
1414 else if ((base58'2T' == $match0))
1515 then base58'6mWwf9mZBjVgkC54idpyaZLQfAosD914wT8fGf2iiY63'
1616 else throw("Unknown chain")
1717 }
1818
1919 let defaultRestAddressStr = match chain {
2020 case _ =>
2121 if ((base58'2W' == $match0))
2222 then "3P..."
2323 else if ((base58'2T' == $match0))
2424 then "3M..."
2525 else throw("Unknown chain")
2626 }
2727
2828 func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], ""))
2929
3030
3131 let IdxCfgAcresDapp = 1
3232
3333 let IdxCfgWlgDapp = 2
3434
3535 func keyRestCfg () = "%s__restConfig"
3636
3737
3838 func keyRestAddress () = "%s__restAddr"
3939
4040
4141 func readRestCfgOrFail (rest) = split_4C(getStringOrFail(rest, keyRestCfg()), SEP)
4242
4343
4444 func getContractAddressOrFail (restCfg,idx) = valueOrErrorMessage(addressFromString(restCfg[idx]), ("Rest cfg doesn't contain address at index " + toString(idx)))
4545
4646
4747 let restContract = addressFromStringValue(valueOrElse(getString(this, keyRestAddress()), defaultRestAddressStr))
4848
4949 let restCfg = readRestCfgOrFail(restContract)
5050
5151 let stakingContract = getContractAddressOrFail(restCfg, IdxCfgAcresDapp)
5252
5353 let wlgContract = getContractAddressOrFail(restCfg, IdxCfgWlgDapp)
5454
5555 func keyBlocked () = "contractsBlocked"
5656
5757
5858 func keyLastTxIdByUser (addr) = ("lastTxIdByUser_" + addr)
5959
6060
61+let acresIssuedAmountKey = "acresIssuedAmount"
62+
6163 let acresAssetIdKey = "acresAssetId"
6264
6365 let acresAssetId = valueOrErrorMessage(getBinary(stakingContract, acresAssetIdKey), "ACRES is not issued yet")
6466
6567 func keyAcresStakedTimeByUser (addr) = ("acresStakedTimeByUser_" + addr)
6668
6769
6870 func fixedPoint (val,decimals) = {
6971 let tenPow = pow(10, 0, decimals, 0, 0, DOWN)
7072 let lowPart = toString((val % tenPow))
7173 let zeroes = drop(toString(tenPow), (1 + size(lowPart)))
7274 (((toString((val / tenPow)) + ".") + zeroes) + lowPart)
7375 }
7476
7577
7678 func keyAcresStakedAmountByUser (addr) = ("acresStakedAmountByUser_" + addr)
7779
7880
7981 func keyAcresLockedAmountByUser (addr) = ("acresLockedAmountByUser_" + addr)
8082
8183
8284 func keyAcresLockedEtaByUser (addr) = ("acresLockedEtaByUser_" + addr)
8385
8486
8587 let acresStakedTotalKey = "acresStakedAmountTotal"
8688
8789 func prolog (i) = if (if ((i.originCaller != restContract))
8890 then valueOrElse(getBoolean(keyBlocked()), false)
8991 else false)
9092 then throw("Contracts are under maintenance")
9193 else [StringEntry(keyLastTxIdByUser(toString(i.originCaller)), toBase58String(i.transactionId))]
9294
9395
9496 func claimAcresInternal (addr,acresAmount,lastClaimTime) = {
9597 let deltaTime = (lastBlock.timestamp - lastClaimTime)
9698 42
9799 }
98100
99101
100102 func claimInternal (addr,acresAmount,lastClaimTime) = {
101103 let deltaTime = (lastBlock.timestamp - lastClaimTime)
102104 if ((0 > deltaTime))
103105 then throw(((("Saved timestamp is in future, saved = " + toString(lastClaimTime)) + ", current = ") + toString(lastBlock.timestamp)))
104106 else 42
105107 }
106108
107109
108110 @Callable(i)
109-func constructorV1 (restAddr) = if ((i.caller != this))
111+func constructorV1 (restAddr,oldAcrContract) = if ((i.caller != this))
110112 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+ }
112117
113118
114119
115120 @Callable(i)
116121 func saveInteger (key,amount) = if ((i.caller != this))
117122 then throw("saveInteger is not public method")
118123 else [IntegerEntry(key, amount)]
119124
120125
121126
122127 @Callable(i)
123128 func setBlocked (isBlocked) = if ((i.caller != this))
124129 then throw("permission denied")
125130 else [BooleanEntry(keyBlocked(), isBlocked)]
126131
127132
128133
129134 @Callable(i)
130135 func unstakeAcres (amount) = {
131136 let prologResult = prolog(i)
132137 if ((prologResult == prologResult))
133138 then if ((0 >= amount))
134139 then throw("Amount should be positive")
135140 else {
136141 let address = toString(i.caller)
137142 if ((size(i.payments) != 0))
138143 then throw("No payments required")
139144 else {
140145 let timeKey = keyAcresStakedTimeByUser(address)
141146 let amountKey = keyAcresStakedAmountByUser(address)
142147 let oldAcresAmount = valueOrElse(getInteger(amountKey), 0)
143148 if ((amount > oldAcresAmount))
144149 then throw(((("You have only " + fixedPoint(oldAcresAmount, 8)) + " ACRES staked, tried to unstake ") + fixedPoint(amount, 8)))
145150 else {
146151 let lockedAmount = valueOrElse(getInteger(keyAcresLockedAmountByUser(address)), 0)
147152 let lockedETA = valueOrElse(getInteger(keyAcresLockedEtaByUser(address)), 0)
148153 let now = lastBlock.timestamp
149154 let unstakableAmount = (oldAcresAmount - lockedAmount)
150155 if (if ((lockedETA > now))
151156 then (amount > unstakableAmount)
152157 else false)
153158 then throw(((("Only " + fixedPoint(unstakableAmount, 8)) + " ACRES can be unstaked now, wait until ") + toString(lockedETA)))
154159 else {
155160 let oldTotal = valueOrElse(getInteger(acresStakedTotalKey), 0)
156161 let wlgResult = invoke(wlgContract, "onStakeUnstakeLand", [address], nil)
157162 let claimedAcres = claimInternal(address, oldAcresAmount, valueOrElse(getInteger(timeKey), 0))
158163 $Tuple2([IntegerEntry(timeKey, lastBlock.timestamp), IntegerEntry(amountKey, (oldAcresAmount - amount)), IntegerEntry(acresStakedTotalKey, (oldTotal - amount)), ScriptTransfer(i.caller, (amount + claimedAcres), acresAssetId)], $Tuple2(prologResult, wlgResult))
159164 }
160165 }
161166 }
162167 }
163168 else throw("Strict value is not equal to itself.")
164169 }
165170
166171
167172
168173 @Callable(i)
169174 func stakeAcres () = {
170175 let prologResult = prolog(i)
171176 if ((prologResult == prologResult))
172177 then {
173178 let address = toString(i.caller)
174179 if ((size(i.payments) != 1))
175180 then throw("exactly 1 payment must be attached")
176181 else {
177182 let pmt = i.payments[0]
178183 let amt = pmt.amount
179184 if (if (!(isDefined(pmt.assetId)))
180185 then true
181186 else (value(pmt.assetId) != acresAssetId))
182187 then throw("ACRES payments only!")
183188 else {
184189 let wlgResult = invoke(wlgContract, "onStakeUnstakeLand", [address], nil)
185190 if ((wlgResult == wlgResult))
186191 then {
187192 let now = lastBlock.timestamp
188193 let timeKey = keyAcresStakedTimeByUser(address)
189194 let amountKey = keyAcresStakedAmountByUser(address)
190195 let oldAcresAmount = valueOrElse(getInteger(amountKey), 0)
191196 let oldTotal = valueOrElse(getInteger(acresStakedTotalKey), 0)
192197 let claimedAcres = claimInternal(address, oldAcresAmount, valueOrElse(getInteger(timeKey), 0))
193198 $Tuple2(((((if ((claimedAcres == 0))
194199 then nil
195200 else [ScriptTransfer(i.caller, claimedAcres, acresAssetId)]) :+ IntegerEntry(timeKey, lastBlock.timestamp)) :+ IntegerEntry(amountKey, (oldAcresAmount + amt))) :+ IntegerEntry(acresStakedTotalKey, (oldTotal + amt))), $Tuple2(prologResult, wlgResult))
196201 }
197202 else throw("Strict value is not equal to itself.")
198203 }
199204 }
200205 }
201206 else throw("Strict value is not equal to itself.")
202207 }
203208
204209
205210
206211 @Callable(i)
207212 func buyAcres () = {
208213 let prologResult = prolog(i)
209214 if ((prologResult == prologResult))
210215 then {
211216 let address = toString(i.caller)
212217 if ((size(i.payments) != 1))
213218 then throw("exactly 1 payment must be attached")
214219 else {
215220 let pmt = i.payments[0]
216221 let amt = pmt.amount
217222 if (if (!(isDefined(pmt.assetId)))
218223 then true
219224 else (value(pmt.assetId) != usdtAssetId))
220225 then throw("USDT payments only!")
221226 else if ((MULT6 > amt))
222227 then throw((("Min payment should be " + fixedPoint(MULT6, 6)) + " USDT"))
223228 else $Tuple2(nil, prologResult)
224229 }
225230 }
226231 else throw("Strict value is not equal to itself.")
227232 }
228233
229234
230235
231236 @Callable(i)
232237 func claimAcres () = {
233238 let prologResult = prolog(i)
234239 if ((prologResult == prologResult))
235240 then {
236241 let address = toString(i.caller)
237242 if ((size(i.payments) != 0))
238243 then throw("No payments required")
239244 else {
240245 let timeKey = keyAcresStakedTimeByUser(address)
241246 let amountKey = keyAcresStakedAmountByUser(address)
242247 let acresAmount = valueOrElse(getInteger(amountKey), 0)
243248 let wlgResult = invoke(wlgContract, "onStakeUnstakeLand", [address], nil)
244249 let claimedAcres = claimInternal(address, acresAmount, valueOrElse(getInteger(timeKey), 0))
245250 $Tuple2([IntegerEntry(timeKey, lastBlock.timestamp), ScriptTransfer(i.caller, claimedAcres, acresAssetId)], $Tuple2(prologResult, wlgResult))
246251 }
247252 }
248253 else throw("Strict value is not equal to itself.")
249254 }
250255
251256
252257
253258 @Callable(i)
254259 func claimAcresREADONLY (address) = {
255260 let timeKey = keyAcresStakedTimeByUser(address)
256261 let amountKey = keyAcresStakedAmountByUser(address)
257262 let acresAmount = valueOrElse(getInteger(amountKey), 0)
258263 let lastTime = valueOrElse(getInteger(timeKey), 0)
259264 let claimedAcres = claimAcresInternal(address, acresAmount, lastTime)
260265 $Tuple2(nil, [claimedAcres, lastTime])
261266 }
262267
263268

github/deemru/w8io/026f985 
47.71 ms