tx · EsKWbvZopS9vYW7hTSmuSK5Dm2YD4LEYD7qnrSLWTXW1

3N4kXZHGke6yRq3Z57q7BTgCrT2SCvQCYER:  -0.01400000 Waves

2022.11.23 17:52 [2329891] smart account 3N4kXZHGke6yRq3Z57q7BTgCrT2SCvQCYER > SELF 0.00000000 Waves

{ "type": 13, "id": "EsKWbvZopS9vYW7hTSmuSK5Dm2YD4LEYD7qnrSLWTXW1", "fee": 1400000, "feeAssetId": null, "timestamp": 1669215130843, "version": 2, "chainId": 84, "sender": "3N4kXZHGke6yRq3Z57q7BTgCrT2SCvQCYER", "senderPublicKey": "6sxdMr2xYPPACEJccwmgS7nWC2ez1c38Y1kDX49ne42b", "proofs": [ "4J3sAuqZkZqm4bgYe6VSohYkt9onPdGwFnjfbp7qZCuavmuM1DsJUMFSnfAmaaXrx5GdXWeqksfA5kcoF2qJxNPm" ], "script": "base64:BgIdCAISBgoECAgICBIAEgASABIECgIBARIAEgMKAQggAAlTRVBBUkFUT1ICAl9fAAVXQVZFUwIFV0FWRVMADEtFWV9NVUxUSVNJRwIITVVMVElTSUcACktFWV9TVEFUVVMCBlNUQVRVUwAOS0VZX0JBU0VfQVNTRVQCCkJBU0VfQVNTRVQACUtFWV9BU1NFVAIFQVNTRVQAE0tFWV9TVEFLSU5HX0FEQVBURVICD1NUQUtJTkdfQURBUFRFUgASS0VZX1NUQUtJTkdfQU1PVU5UAg5TVEFLSU5HX0FNT1VOVAANS0VZX0xBU1RfUkFURQIJTEFTVF9SQVRFABBLRVlfQ1VSUkVOVF9SQVRFAgxDVVJSRU5UX1JBVEUAD0tFWV9MQVNUX0hFSUdIVAILTEFTVF9IRUlHSFQAEUtFWV9UQVJHRVRfSEVJR0hUAg1UQVJHRVRfSEVJR0hUAApGVU5DX1NUQUtFAgVzdGFrZQAMRlVOQ19VTlNUQUtFAgd1bnN0YWtlABFGVU5DX0NMQUlNX1JFV0FSRAILY2xhaW1SZXdhcmQADlBFUkNFTlRfRkFDVE9SCQC2AgEA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kAAgECHnNldE11bHRpc2lnOiBwZXJtaXNzaW9uIGRlbmllZAMJAQEhAQkBEF92YWxpZGF0ZUFkZHJlc3MBBQltdWx0aXNpZ18JAAIBAiVzZXRNdWx0aXNpZzogaW52YWxpZCBtdWx0aXNpZyBhZGRyZXNzBQR1bml0AwkAAAIFA2VycgUDZXJyCQCUCgIJAMwIAgkBC1N0cmluZ0VudHJ5AgUMS0VZX01VTFRJU0lHBQltdWx0aXNpZ18FA25pbAUEdW5pdAkAAgECJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgECdHgBBnZlcmlmeQAEByRtYXRjaDAJAKIIAQUMS0VZX01VTFRJU0lHAwkAAQIFByRtYXRjaDACBlN0cmluZwQIbXVsdGlzaWcFByRtYXRjaDAJAQt2YWx1ZU9yRWxzZQIJAJsIAgkBEUBleHRyTmF0aXZlKDEwNjIpAQUIbXVsdGlzaWcJALkJAgkAzAgCBQpLRVlfU1RBVFVTCQDMCAIJAKUIAQUEdGhpcwkAzAgCCQDYBAEIBQJ0eAJpZAUDbmlsBQlTRVBBUkFUT1IHCQD0AwMIBQJ0eAlib2R5Qnl0ZXMJAJEDAggFAnR4BnByb29mcwAACAUCdHgPc2VuZGVyUHVibGljS2V53t0L+A==", "height": 2329891, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: HfJMuDyMmbbKywPzobke9UokeR2m9pcRkACZa1FowZfE Next: DRBLYCxLW4PHy7YBZhkUcrfmMcjeiCKHwNDpLzKY8fUw Diff:
OldNewDifferences
3636 let ZERO_BIGINT = toBigInt(0)
3737
3838 let ONE_BIGINT = toBigInt(1)
39+
40+let ONE_WAVES = 100000000
3941
4042 func _validateAddress (address_) = match addressFromString(address_) {
4143 case a: Address =>
187189 then throw("init: invalid base asset")
188190 else if (!(_validateAddress(stakingAdapter_)))
189191 then throw("init: invalid staking adapter")
190- else if ((0 >= wavesBalance(this).regular))
191- then throw("init: no waves at this contract")
192- else unit
192+ else unit
193193 if ((err == err))
194194 then {
195195 let tokenDecimals = _getAssetDecimals(baseAsset)
196- let issue = Issue(tokenName_, tokenDescr_, wavesBalance(this).regular, tokenDecimals, true)
196+ let issue = Issue(tokenName_, tokenDescr_, ONE_WAVES, tokenDecimals, true)
197197 let assetId = calculateAssetId(issue)
198- let stakeActions = _updateStaking(baseAsset, wavesBalance(this).regular, addressFromStringValue(stakingAdapter_))
198+ let stakeActions = _updateStaking(baseAsset, ONE_WAVES, addressFromStringValue(stakingAdapter_))
199199 $Tuple2(([StringEntry(KEY_BASE_ASSET, baseAsset_), StringEntry(KEY_STAKING_ADAPTER, stakingAdapter_), StringEntry(KEY_ASSET, toBase58String(assetId)), issue] ++ stakeActions), unit)
200200 }
201201 else throw("Strict value is not equal to itself.")
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let SEPARATOR = "__"
55
66 let WAVES = "WAVES"
77
88 let KEY_MULTISIG = "MULTISIG"
99
1010 let KEY_STATUS = "STATUS"
1111
1212 let KEY_BASE_ASSET = "BASE_ASSET"
1313
1414 let KEY_ASSET = "ASSET"
1515
1616 let KEY_STAKING_ADAPTER = "STAKING_ADAPTER"
1717
1818 let KEY_STAKING_AMOUNT = "STAKING_AMOUNT"
1919
2020 let KEY_LAST_RATE = "LAST_RATE"
2121
2222 let KEY_CURRENT_RATE = "CURRENT_RATE"
2323
2424 let KEY_LAST_HEIGHT = "LAST_HEIGHT"
2525
2626 let KEY_TARGET_HEIGHT = "TARGET_HEIGHT"
2727
2828 let FUNC_STAKE = "stake"
2929
3030 let FUNC_UNSTAKE = "unstake"
3131
3232 let FUNC_CLAIM_REWARD = "claimReward"
3333
3434 let PERCENT_FACTOR = toBigInt(1000000000000)
3535
3636 let ZERO_BIGINT = toBigInt(0)
3737
3838 let ONE_BIGINT = toBigInt(1)
39+
40+let ONE_WAVES = 100000000
3941
4042 func _validateAddress (address_) = match addressFromString(address_) {
4143 case a: Address =>
4244 true
4345 case _ =>
4446 false
4547 }
4648
4749
4850 func _validateAsset (asset_) = if ((asset_ == WAVES))
4951 then true
5052 else match assetInfo(fromBase58String(asset_)) {
5153 case a: Asset =>
5254 true
5355 case _ =>
5456 false
5557 }
5658
5759
5860 func _toAssetVector (asset_) = if ((asset_ == WAVES))
5961 then unit
6062 else fromBase58String(asset_)
6163
6264
6365 func _getAssetDecimals (asset_) = match asset_ {
6466 case a: ByteVector =>
6567 match assetInfo(a) {
6668 case asset: Asset =>
6769 asset.decimals
6870 case _ =>
6971 throw("_getAssetDecimals: no such asset")
7072 }
7173 case _ =>
7274 8
7375 }
7476
7577
7678 func _getAssetQuantity (asset_) = match assetInfo(asset_) {
7779 case a: Asset =>
7880 a.quantity
7981 case _ =>
8082 throw("_getAssetQuantity: no such asset")
8183 }
8284
8385
8486 func _getAssetBalance (asset_,address) = match asset_ {
8587 case a: ByteVector =>
8688 assetBalance(address, a)
8789 case _ =>
8890 wavesBalance(address).regular
8991 }
9092
9193
9294 func _loadBaseAsset () = match getString(KEY_BASE_ASSET) {
9395 case a: String =>
9496 if ((a == WAVES))
9597 then unit
9698 else fromBase58String(a)
9799 case _ =>
98100 throw("_loadBaseAsset: no base asset")
99101 }
100102
101103
102104 func _loadStakingAdapter () = match getString(KEY_STAKING_ADAPTER) {
103105 case a: String =>
104106 addressFromStringValue(a)
105107 case _ =>
106108 throw("_loadStakingAdapter: no staking adapter")
107109 }
108110
109111
110112 func _loadInt (key_,default_) = match getInteger(key_) {
111113 case a: Int =>
112114 a
113115 case _ =>
114116 default_
115117 }
116118
117119
118120 func _loadBigInt (key_,default_) = match getBinary(key_) {
119121 case a: ByteVector =>
120122 toBigInt(a)
121123 case _ =>
122124 default_
123125 }
124126
125127
126128 func _loadAsset () = match getString(KEY_ASSET) {
127129 case a: String =>
128130 fromBase58String(a)
129131 case _ =>
130132 base58''
131133 }
132134
133135
134136 func _updateStaking (asset_,amount_,adapter_) = {
135137 let stakingAmount = _loadInt(KEY_STAKING_AMOUNT, 0)
136138 let newStakingAmount = (stakingAmount + amount_)
137139 let invocation = if ((amount_ > 0))
138140 then invoke(adapter_, FUNC_STAKE, nil, [AttachedPayment(asset_, amount_)])
139141 else invoke(adapter_, FUNC_UNSTAKE, [(-1 * amount_)], nil)
140142 if ((invocation == invocation))
141143 then [IntegerEntry(KEY_STAKING_AMOUNT, newStakingAmount)]
142144 else throw("Strict value is not equal to itself.")
143145 }
144146
145147
146148 func _checkpoint (compensation) = {
147149 let invocation = invoke(_loadStakingAdapter(), FUNC_CLAIM_REWARD, nil, nil)
148150 if ((invocation == invocation))
149151 then match invocation {
150152 case reward: (Int, Int, Int) =>
151153 if (compensation)
152154 then {
153155 let stake = invoke(this, FUNC_STAKE, [reward._1, reward._3], nil)
154156 if ((stake == stake))
155157 then $Tuple2(true, reward._2)
156158 else throw("Strict value is not equal to itself.")
157159 }
158160 else {
159161 let stake = invoke(this, FUNC_STAKE, [(reward._1 + reward._2), reward._3], nil)
160162 if ((stake == stake))
161163 then $Tuple2(true, 0)
162164 else throw("Strict value is not equal to itself.")
163165 }
164166 case _ =>
165167 $Tuple2(false, 0)
166168 }
167169 else throw("Strict value is not equal to itself.")
168170 }
169171
170172
171173 @Callable(i)
172174 func init (tokenName_,tokenDescr_,baseAsset_,stakingAdapter_) = {
173175 let multisig = valueOrErrorMessage(getString(KEY_MULTISIG), "init: no multisig set")
174176 let asset = _loadAsset()
175177 let baseAsset = _toAssetVector(baseAsset_)
176178 let err = if ((i.caller != this))
177179 then throw("init: permission denied")
178180 else if ((asset != base58''))
179181 then throw("init: already initialized")
180182 else if (if ((4 > size(tokenName_)))
181183 then true
182184 else (size(tokenName_) > 16))
183185 then throw("init: invalid token name")
184186 else if ((size(tokenDescr_) > 1000))
185187 then throw("init: invalid token description")
186188 else if (!(_validateAsset(baseAsset_)))
187189 then throw("init: invalid base asset")
188190 else if (!(_validateAddress(stakingAdapter_)))
189191 then throw("init: invalid staking adapter")
190- else if ((0 >= wavesBalance(this).regular))
191- then throw("init: no waves at this contract")
192- else unit
192+ else unit
193193 if ((err == err))
194194 then {
195195 let tokenDecimals = _getAssetDecimals(baseAsset)
196- let issue = Issue(tokenName_, tokenDescr_, wavesBalance(this).regular, tokenDecimals, true)
196+ let issue = Issue(tokenName_, tokenDescr_, ONE_WAVES, tokenDecimals, true)
197197 let assetId = calculateAssetId(issue)
198- let stakeActions = _updateStaking(baseAsset, wavesBalance(this).regular, addressFromStringValue(stakingAdapter_))
198+ let stakeActions = _updateStaking(baseAsset, ONE_WAVES, addressFromStringValue(stakingAdapter_))
199199 $Tuple2(([StringEntry(KEY_BASE_ASSET, baseAsset_), StringEntry(KEY_STAKING_ADAPTER, stakingAdapter_), StringEntry(KEY_ASSET, toBase58String(assetId)), issue] ++ stakeActions), unit)
200200 }
201201 else throw("Strict value is not equal to itself.")
202202 }
203203
204204
205205
206206 @Callable(i)
207207 func getRate () = {
208208 let lastRate = _loadBigInt(KEY_LAST_RATE, PERCENT_FACTOR)
209209 let currentRate = _loadBigInt(KEY_CURRENT_RATE, ZERO_BIGINT)
210210 let lastHeight = _loadInt(KEY_LAST_HEIGHT, 0)
211211 let targetHeight = min([_loadInt(KEY_TARGET_HEIGHT, 0), height])
212212 let rate = (lastRate + (currentRate * toBigInt((targetHeight - lastHeight))))
213213 $Tuple2(nil, toString(rate))
214214 }
215215
216216
217217
218218 @Callable(i)
219219 func checkpoint () = {
220220 let checkpoint = _checkpoint(true)
221221 if ((checkpoint == checkpoint))
222222 then if (!(checkpoint._1))
223223 then throw("checkpoint: no reward")
224224 else if ((checkpoint._2 > 0))
225225 then $Tuple2([ScriptTransfer(i.originCaller, checkpoint._2, _loadBaseAsset())], unit)
226226 else $Tuple2(nil, unit)
227227 else throw("Strict value is not equal to itself.")
228228 }
229229
230230
231231
232232 @Callable(i)
233233 func deposit () = {
234234 let caller = toString(i.caller)
235235 let baseAsset = _loadBaseAsset()
236236 let asset = _loadAsset()
237237 let assetQuantity = toBigInt(_getAssetQuantity(asset))
238238 let err = if ((size(i.payments) != 1))
239239 then throw("deposit: no payments")
240240 else if ((i.payments[0].assetId != baseAsset))
241241 then throw("deposit: payment is not in base asset")
242242 else if ((0 >= i.payments[0].amount))
243243 then throw("deposit: invalid payment amount")
244244 else unit
245245 if ((err == err))
246246 then {
247247 let checkpoint = _checkpoint(false)
248248 if ((checkpoint == checkpoint))
249249 then {
250250 let lastRate = _loadBigInt(KEY_LAST_RATE, PERCENT_FACTOR)
251251 let currentRate = _loadBigInt(KEY_CURRENT_RATE, ZERO_BIGINT)
252252 let lastHeight = _loadInt(KEY_LAST_HEIGHT, 0)
253253 let targetHeight = min([_loadInt(KEY_TARGET_HEIGHT, 0), height])
254254 let lastRateUpdated = (lastRate + (currentRate * toBigInt((targetHeight - lastHeight))))
255255 let issueAmount = toInt(fraction(toBigInt(i.payments[0].amount), PERCENT_FACTOR, lastRateUpdated, FLOOR))
256256 let currentRateUpdated = fraction(currentRate, assetQuantity, (assetQuantity + toBigInt(issueAmount)), FLOOR)
257257 let lastHeightUpdated = targetHeight
258258 let stakeActions = _updateStaking(baseAsset, i.payments[0].amount, _loadStakingAdapter())
259259 $Tuple2(([Reissue(asset, issueAmount, true), ScriptTransfer(i.caller, issueAmount, asset), BinaryEntry(KEY_LAST_RATE, toBytes(lastRateUpdated)), BinaryEntry(KEY_CURRENT_RATE, toBytes(currentRateUpdated)), IntegerEntry(KEY_LAST_HEIGHT, lastHeightUpdated)] ++ stakeActions), unit)
260260 }
261261 else throw("Strict value is not equal to itself.")
262262 }
263263 else throw("Strict value is not equal to itself.")
264264 }
265265
266266
267267
268268 @Callable(i)
269269 func stake (amount_,spreadBlocks_) = {
270270 let caller = toString(i.caller)
271271 let baseAsset = _loadBaseAsset()
272272 let asset = _loadAsset()
273273 let assetQuantity = toBigInt(_getAssetQuantity(asset))
274274 let err = if ((i.caller != this))
275275 then throw("stake: only this contract")
276276 else if ((0 >= amount_))
277277 then throw("stake: invalid stake amount")
278278 else if ((amount_ > _getAssetBalance(baseAsset, this)))
279279 then throw("stake: insufficient stake amount")
280280 else if ((assetQuantity == ZERO_BIGINT))
281281 then throw("stake: no deposits to stake for")
282282 else unit
283283 if ((err == err))
284284 then {
285285 let lastRate = _loadBigInt(KEY_LAST_RATE, PERCENT_FACTOR)
286286 let currentRate = _loadBigInt(KEY_CURRENT_RATE, ZERO_BIGINT)
287287 let lastHeight = _loadInt(KEY_LAST_HEIGHT, 0)
288288 let targetHeight = _loadInt(KEY_TARGET_HEIGHT, 0)
289289 let minTargetHeight = min([targetHeight, height])
290290 let actions = if ((minTargetHeight == height))
291291 then {
292292 let lastRateUpdated = (lastRate + (toBigInt((minTargetHeight - lastHeight)) * currentRate))
293293 let remainingReward = (currentRate * toBigInt((targetHeight - minTargetHeight)))
294294 let currentRateUpdated = fraction(((toBigInt(amount_) * PERCENT_FACTOR) + remainingReward), ONE_BIGINT, (assetQuantity * toBigInt(spreadBlocks_)))
295295 let lastHeightUpdated = height
296296 let targetHeightUpdated = (lastHeightUpdated + spreadBlocks_)
297297 [BinaryEntry(KEY_LAST_RATE, toBytes(lastRateUpdated)), BinaryEntry(KEY_CURRENT_RATE, toBytes(currentRateUpdated)), IntegerEntry(KEY_LAST_HEIGHT, lastHeightUpdated), IntegerEntry(KEY_TARGET_HEIGHT, targetHeightUpdated)]
298298 }
299299 else if ((targetHeight > lastHeight))
300300 then {
301301 let lastRateUpdated = (lastRate + (toBigInt((targetHeight - lastHeight)) * currentRate))
302302 let currentRateUpdated = fraction(toBigInt(amount_), PERCENT_FACTOR, (assetQuantity * toBigInt(spreadBlocks_)))
303303 let lastHeightUpdated = height
304304 let targetHeightUpdated = (lastHeightUpdated + spreadBlocks_)
305305 [BinaryEntry(KEY_LAST_RATE, toBytes(lastRateUpdated)), BinaryEntry(KEY_CURRENT_RATE, toBytes(currentRateUpdated)), IntegerEntry(KEY_LAST_HEIGHT, lastHeightUpdated), IntegerEntry(KEY_TARGET_HEIGHT, targetHeightUpdated)]
306306 }
307307 else {
308308 let currentRateUpdated = fraction(toBigInt(amount_), PERCENT_FACTOR, (assetQuantity * toBigInt(spreadBlocks_)))
309309 let lastHeightUpdated = height
310310 let targetHeightUpdated = (lastHeightUpdated + spreadBlocks_)
311311 [BinaryEntry(KEY_CURRENT_RATE, toBytes(currentRateUpdated)), IntegerEntry(KEY_LAST_HEIGHT, lastHeightUpdated), IntegerEntry(KEY_TARGET_HEIGHT, targetHeightUpdated)]
312312 }
313313 let stakeActions = _updateStaking(baseAsset, amount_, _loadStakingAdapter())
314314 $Tuple2((actions ++ stakeActions), unit)
315315 }
316316 else throw("Strict value is not equal to itself.")
317317 }
318318
319319
320320
321321 @Callable(i)
322322 func withdraw () = {
323323 let caller = toString(i.caller)
324324 let baseAsset = _loadBaseAsset()
325325 let asset = _loadAsset()
326326 let assetQuantity = toBigInt(_getAssetQuantity(asset))
327327 let err = if ((1 > size(i.payments)))
328328 then throw("withdraw: no payments")
329329 else if ((i.payments[0].assetId != asset))
330330 then throw("withdraw: payment is not in correct asset")
331331 else if ((0 >= i.payments[0].amount))
332332 then throw("withdraw: invalid payment amount")
333333 else unit
334334 if ((err == err))
335335 then {
336336 let checkpoint = _checkpoint(false)
337337 if ((checkpoint == checkpoint))
338338 then {
339339 let lastRate = _loadBigInt(KEY_LAST_RATE, PERCENT_FACTOR)
340340 let currentRate = _loadBigInt(KEY_CURRENT_RATE, ZERO_BIGINT)
341341 let lastHeight = _loadInt(KEY_LAST_HEIGHT, 0)
342342 let targetHeight = min([_loadInt(KEY_TARGET_HEIGHT, 0), height])
343343 let lastRateUpdated = (lastRate + (currentRate * toBigInt((targetHeight - lastHeight))))
344344 let baseAmount = toInt(fraction(toBigInt(i.payments[0].amount), lastRateUpdated, PERCENT_FACTOR, FLOOR))
345345 let currentRateUpdated = fraction(currentRate, assetQuantity, (assetQuantity - toBigInt(i.payments[0].amount)), FLOOR)
346346 let lastHeightUpdated = targetHeight
347347 let stakeActions = _updateStaking(baseAsset, (-1 * baseAmount), _loadStakingAdapter())
348348 $Tuple2((stakeActions ++ [Burn(asset, i.payments[0].amount), ScriptTransfer(i.caller, baseAmount, unit), BinaryEntry(KEY_LAST_RATE, toBytes(lastRateUpdated)), BinaryEntry(KEY_CURRENT_RATE, toBytes(currentRateUpdated)), IntegerEntry(KEY_LAST_HEIGHT, lastHeightUpdated)]), unit)
349349 }
350350 else throw("Strict value is not equal to itself.")
351351 }
352352 else throw("Strict value is not equal to itself.")
353353 }
354354
355355
356356
357357 @Callable(i)
358358 func setMultisig (multisig_) = {
359359 let err = if ((i.caller != this))
360360 then throw("setMultisig: permission denied")
361361 else if (!(_validateAddress(multisig_)))
362362 then throw("setMultisig: invalid multisig address")
363363 else unit
364364 if ((err == err))
365365 then $Tuple2([StringEntry(KEY_MULTISIG, multisig_)], unit)
366366 else throw("Strict value is not equal to itself.")
367367 }
368368
369369
370370 @Verifier(tx)
371371 func verify () = match getString(KEY_MULTISIG) {
372372 case multisig: String =>
373373 valueOrElse(getBoolean(addressFromStringValue(multisig), makeString([KEY_STATUS, toString(this), toBase58String(tx.id)], SEPARATOR)), false)
374374 case _ =>
375375 sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
376376 }
377377

github/deemru/w8io/169f3d6 
81.68 ms