tx · H2eEyE6XiF9WsSJSg7NrMnWLJVToPR5CEpwGJ84hc7KJ

3N4kXZHGke6yRq3Z57q7BTgCrT2SCvQCYER:  -0.01400000 Waves

2022.11.23 17:28 [2329865] smart account 3N4kXZHGke6yRq3Z57q7BTgCrT2SCvQCYER > SELF 0.00000000 Waves

{ "type": 13, "id": "H2eEyE6XiF9WsSJSg7NrMnWLJVToPR5CEpwGJ84hc7KJ", "fee": 1400000, "feeAssetId": null, "timestamp": 1669213777795, "version": 2, "chainId": 84, "sender": "3N4kXZHGke6yRq3Z57q7BTgCrT2SCvQCYER", "senderPublicKey": "6sxdMr2xYPPACEJccwmgS7nWC2ez1c38Y1kDX49ne42b", "proofs": [ "2ySLxLU7HJK5D5WzYh6rv2iUz23QNRPu5j9ftXwm56hoQ9wZU7mNessmCkQ8Xmes9LcS4u5eLeL1knRgDudbDgEM" ], "script": "base64:BgIdCAISBgoECAgICBIAEgASABIECgIBARIAEgMKAQgfAAlTRVBBUkFUT1ICAl9fAAVXQVZFUwIFV0FWRVMADEtFWV9NVUxUSVNJRwIITVVMVElTSUcACktFWV9TVEFUVVMCBlNUQVRVUwAOS0VZX0JBU0VfQVNTRVQCCkJBU0VfQVNTRVQACUtFWV9BU1NFVAIFQVNTRVQAE0tFWV9TVEFLSU5HX0FEQVBURVICD1NUQUtJTkdfQURBUFRFUgASS0VZX1NUQUtJTkdfQU1PVU5UAg5TVEFLSU5HX0FNT1VOVAANS0VZX0xBU1RfUkFURQIJTEFTVF9SQVRFABBLRVlfQ1VSUkVOVF9SQVRFAgxDVVJSRU5UX1JBVEUAD0tFWV9MQVNUX0hFSUdIVAILTEFTVF9IRUlHSFQAEUtFWV9UQVJHRVRfSEVJR0hUAg1UQVJHRVRfSEVJR0hUAApGVU5DX1NUQUtFAgVzdGFrZQAMRlVOQ19VTlNUQUtFAgd1bnN0YWtlABFGVU5DX0NMQUlNX1JFV0FSRAILY2xhaW1SZXdhcmQADlBFUkNFTlRfRkFDVE9SCQC2AgE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wZGF0ZWQJAMwIAgkBDEludGVnZXJFbnRyeQIFD0tFWV9MQVNUX0hFSUdIVAURbGFzdEhlaWdodFVwZGF0ZWQFA25pbAUEdW5pdAkAAgECJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgkAAgECJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgFpAQtzZXRNdWx0aXNpZwEJbXVsdGlzaWdfBANlcnIDCQECIT0CCAUBaQZjYWxsZXIFBHRoaXMJAAIBAh5zZXRNdWx0aXNpZzogcGVybWlzc2lvbiBkZW5pZWQDCQEBIQEJARBfdmFsaWRhdGVBZGRyZXNzAQUJbXVsdGlzaWdfCQACAQIlc2V0TXVsdGlzaWc6IGludmFsaWQgbXVsdGlzaWcgYWRkcmVzcwUEdW5pdAMJAAACBQNlcnIFA2VycgkAlAoCCQDMCAIJAQtTdHJpbmdFbnRyeQIFDEtFWV9NVUxUSVNJRwUJbXVsdGlzaWdfBQNuaWwFBHVuaXQJAAIBAiRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4BAnR4AQZ2ZXJpZnkABAckbWF0Y2gwCQCiCAEFDEtFWV9NVUxUSVNJRwMJAAECBQckbWF0Y2gwAgZTdHJpbmcECG11bHRpc2lnBQckbWF0Y2gwCQELdmFsdWVPckVsc2UCCQCbCAIJARFAZXh0ck5hdGl2ZSgxMDYyKQEFCG11bHRpc2lnCQC5CQIJAMwIAgUKS0VZX1NUQVRVUwkAzAgCCQClCAEFBHRoaXMJAMwIAgkA2AQBCAUCdHgCaWQFA25pbAUJU0VQQVJBVE9SBwkA9AMDCAUCdHgJYm9keUJ5dGVzCQCRAwIIBQJ0eAZwcm9vZnMAAAgFAnR4D3NlbmRlclB1YmxpY0tledoXfVw=", "height": 2329865, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: HfJMuDyMmbbKywPzobke9UokeR2m9pcRkACZa1FowZfE Full:
OldNewDifferences
1-# no script
1+{-# STDLIB_VERSION 6 #-}
2+{-# SCRIPT_TYPE ACCOUNT #-}
3+{-# CONTENT_TYPE DAPP #-}
4+let SEPARATOR = "__"
5+
6+let WAVES = "WAVES"
7+
8+let KEY_MULTISIG = "MULTISIG"
9+
10+let KEY_STATUS = "STATUS"
11+
12+let KEY_BASE_ASSET = "BASE_ASSET"
13+
14+let KEY_ASSET = "ASSET"
15+
16+let KEY_STAKING_ADAPTER = "STAKING_ADAPTER"
17+
18+let KEY_STAKING_AMOUNT = "STAKING_AMOUNT"
19+
20+let KEY_LAST_RATE = "LAST_RATE"
21+
22+let KEY_CURRENT_RATE = "CURRENT_RATE"
23+
24+let KEY_LAST_HEIGHT = "LAST_HEIGHT"
25+
26+let KEY_TARGET_HEIGHT = "TARGET_HEIGHT"
27+
28+let FUNC_STAKE = "stake"
29+
30+let FUNC_UNSTAKE = "unstake"
31+
32+let FUNC_CLAIM_REWARD = "claimReward"
33+
34+let PERCENT_FACTOR = toBigInt(1000000000000)
35+
36+let ZERO_BIGINT = toBigInt(0)
37+
38+let ONE_BIGINT = toBigInt(1)
39+
40+func _validateAddress (address_) = match addressFromString(address_) {
41+ case a: Address =>
42+ true
43+ case _ =>
44+ false
45+}
46+
47+
48+func _validateAsset (asset_) = if ((asset_ == WAVES))
49+ then true
50+ else match assetInfo(fromBase58String(asset_)) {
51+ case a: Asset =>
52+ true
53+ case _ =>
54+ false
55+ }
56+
57+
58+func _toAssetVector (asset_) = if ((asset_ == WAVES))
59+ then unit
60+ else fromBase58String(asset_)
61+
62+
63+func _getAssetDecimals (asset_) = match asset_ {
64+ case a: ByteVector =>
65+ match assetInfo(a) {
66+ case asset: Asset =>
67+ asset.decimals
68+ case _ =>
69+ throw("_getAssetDecimals: no such asset")
70+ }
71+ case _ =>
72+ 8
73+}
74+
75+
76+func _getAssetQuantity (asset_) = match assetInfo(asset_) {
77+ case a: Asset =>
78+ a.quantity
79+ case _ =>
80+ throw("_getAssetQuantity: no such asset")
81+}
82+
83+
84+func _getAssetBalance (asset_,address) = match asset_ {
85+ case a: ByteVector =>
86+ assetBalance(address, a)
87+ case _ =>
88+ wavesBalance(address).regular
89+}
90+
91+
92+func _loadBaseAsset () = match getString(KEY_BASE_ASSET) {
93+ case a: String =>
94+ if ((a == WAVES))
95+ then unit
96+ else fromBase58String(a)
97+ case _ =>
98+ throw("_loadBaseAsset: no base asset")
99+}
100+
101+
102+func _loadStakingAdapter () = match getString(KEY_STAKING_ADAPTER) {
103+ case a: String =>
104+ addressFromStringValue(a)
105+ case _ =>
106+ throw("_loadStakingAdapter: no staking adapter")
107+}
108+
109+
110+func _loadInt (key_,default_) = match getInteger(key_) {
111+ case a: Int =>
112+ a
113+ case _ =>
114+ default_
115+}
116+
117+
118+func _loadBigInt (key_,default_) = match getBinary(key_) {
119+ case a: ByteVector =>
120+ toBigInt(a)
121+ case _ =>
122+ default_
123+}
124+
125+
126+func _loadAsset () = match getString(KEY_ASSET) {
127+ case a: String =>
128+ fromBase58String(a)
129+ case _ =>
130+ base58''
131+}
132+
133+
134+func _updateStaking (asset_,amount_,adapter_) = {
135+ let stakingAmount = _loadInt(KEY_STAKING_AMOUNT, 0)
136+ let newStakingAmount = (stakingAmount + amount_)
137+ let invocation = if ((amount_ > 0))
138+ then invoke(adapter_, FUNC_STAKE, nil, [AttachedPayment(asset_, amount_)])
139+ else invoke(adapter_, FUNC_UNSTAKE, [(-1 * amount_)], nil)
140+ if ((invocation == invocation))
141+ then [IntegerEntry(KEY_STAKING_AMOUNT, newStakingAmount)]
142+ else throw("Strict value is not equal to itself.")
143+ }
144+
145+
146+func _checkpoint (compensation) = {
147+ let invocation = invoke(_loadStakingAdapter(), FUNC_CLAIM_REWARD, nil, nil)
148+ if ((invocation == invocation))
149+ then match invocation {
150+ case reward: (Int, Int, Int) =>
151+ if (compensation)
152+ then {
153+ let stake = invoke(this, FUNC_STAKE, [reward._1, reward._3], nil)
154+ if ((stake == stake))
155+ then $Tuple2(true, reward._2)
156+ else throw("Strict value is not equal to itself.")
157+ }
158+ else {
159+ let stake = invoke(this, FUNC_STAKE, [(reward._1 + reward._2), reward._3], nil)
160+ if ((stake == stake))
161+ then $Tuple2(true, 0)
162+ else throw("Strict value is not equal to itself.")
163+ }
164+ case _ =>
165+ $Tuple2(false, 0)
166+ }
167+ else throw("Strict value is not equal to itself.")
168+ }
169+
170+
171+@Callable(i)
172+func init (tokenName_,tokenDescr_,baseAsset_,stakingAdapter_) = {
173+ let multisig = valueOrErrorMessage(getString(KEY_MULTISIG), "init: no multisig set")
174+ let asset = _loadAsset()
175+ let baseAsset = _toAssetVector(baseAsset_)
176+ let err = if ((i.caller != this))
177+ then throw("init: permission denied")
178+ else if ((asset != base58''))
179+ then throw("init: already initialized")
180+ else if (if ((4 > size(tokenName_)))
181+ then true
182+ else (size(tokenName_) > 16))
183+ then throw("init: invalid token name")
184+ else if ((size(tokenDescr_) > 1000))
185+ then throw("init: invalid token description")
186+ else if (!(_validateAsset(baseAsset_)))
187+ then throw("init: invalid base asset")
188+ else if (!(_validateAddress(stakingAdapter_)))
189+ then throw("init: invalid staking adapter")
190+ else if ((size(i.payments) != 1))
191+ then throw("init: payment is not present")
192+ else if ((i.payments[0].assetId != baseAsset))
193+ then throw("init: payment is not in base asset")
194+ else if ((0 >= i.payments[0].amount))
195+ then throw("init: invalid payment amount")
196+ else unit
197+ if ((err == err))
198+ then {
199+ let tokenDecimals = _getAssetDecimals(baseAsset)
200+ let issue = Issue(tokenName_, tokenDescr_, i.payments[0].amount, tokenDecimals, true)
201+ let assetId = calculateAssetId(issue)
202+ let stakeActions = _updateStaking(baseAsset, i.payments[0].amount, addressFromStringValue(stakingAdapter_))
203+ $Tuple2(([StringEntry(KEY_BASE_ASSET, baseAsset_), StringEntry(KEY_STAKING_ADAPTER, stakingAdapter_), StringEntry(KEY_ASSET, toBase58String(assetId)), issue] ++ stakeActions), unit)
204+ }
205+ else throw("Strict value is not equal to itself.")
206+ }
207+
208+
209+
210+@Callable(i)
211+func getRate () = {
212+ let lastRate = _loadBigInt(KEY_LAST_RATE, PERCENT_FACTOR)
213+ let currentRate = _loadBigInt(KEY_CURRENT_RATE, ZERO_BIGINT)
214+ let lastHeight = _loadInt(KEY_LAST_HEIGHT, 0)
215+ let targetHeight = min([_loadInt(KEY_TARGET_HEIGHT, 0), height])
216+ let rate = (lastRate + (currentRate * toBigInt((targetHeight - lastHeight))))
217+ $Tuple2(nil, toString(rate))
218+ }
219+
220+
221+
222+@Callable(i)
223+func checkpoint () = {
224+ let checkpoint = _checkpoint(true)
225+ if ((checkpoint == checkpoint))
226+ then if (!(checkpoint._1))
227+ then throw("checkpoint: no reward")
228+ else if ((checkpoint._2 > 0))
229+ then $Tuple2([ScriptTransfer(i.originCaller, checkpoint._2, _loadBaseAsset())], unit)
230+ else $Tuple2(nil, unit)
231+ else throw("Strict value is not equal to itself.")
232+ }
233+
234+
235+
236+@Callable(i)
237+func deposit () = {
238+ let caller = toString(i.caller)
239+ let baseAsset = _loadBaseAsset()
240+ let asset = _loadAsset()
241+ let assetQuantity = toBigInt(_getAssetQuantity(asset))
242+ let err = if ((size(i.payments) != 1))
243+ then throw("deposit: no payments")
244+ else if ((i.payments[0].assetId != baseAsset))
245+ then throw("deposit: payment is not in base asset")
246+ else if ((0 >= i.payments[0].amount))
247+ then throw("deposit: invalid payment amount")
248+ else unit
249+ if ((err == err))
250+ then {
251+ let checkpoint = _checkpoint(false)
252+ if ((checkpoint == checkpoint))
253+ then {
254+ let lastRate = _loadBigInt(KEY_LAST_RATE, PERCENT_FACTOR)
255+ let currentRate = _loadBigInt(KEY_CURRENT_RATE, ZERO_BIGINT)
256+ let lastHeight = _loadInt(KEY_LAST_HEIGHT, 0)
257+ let targetHeight = min([_loadInt(KEY_TARGET_HEIGHT, 0), height])
258+ let lastRateUpdated = (lastRate + (currentRate * toBigInt((targetHeight - lastHeight))))
259+ let issueAmount = toInt(fraction(toBigInt(i.payments[0].amount), PERCENT_FACTOR, lastRateUpdated, FLOOR))
260+ let currentRateUpdated = fraction(currentRate, assetQuantity, (assetQuantity + toBigInt(issueAmount)), FLOOR)
261+ let lastHeightUpdated = targetHeight
262+ let stakeActions = _updateStaking(baseAsset, i.payments[0].amount, _loadStakingAdapter())
263+ $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)
264+ }
265+ else throw("Strict value is not equal to itself.")
266+ }
267+ else throw("Strict value is not equal to itself.")
268+ }
269+
270+
271+
272+@Callable(i)
273+func stake (amount_,spreadBlocks_) = {
274+ let caller = toString(i.caller)
275+ let baseAsset = _loadBaseAsset()
276+ let asset = _loadAsset()
277+ let assetQuantity = toBigInt(_getAssetQuantity(asset))
278+ let err = if ((i.caller != this))
279+ then throw("stake: only this contract")
280+ else if ((0 >= amount_))
281+ then throw("stake: invalid stake amount")
282+ else if ((amount_ > _getAssetBalance(baseAsset, this)))
283+ then throw("stake: insufficient stake amount")
284+ else if ((assetQuantity == ZERO_BIGINT))
285+ then throw("stake: no deposits to stake for")
286+ else unit
287+ if ((err == err))
288+ then {
289+ let lastRate = _loadBigInt(KEY_LAST_RATE, PERCENT_FACTOR)
290+ let currentRate = _loadBigInt(KEY_CURRENT_RATE, ZERO_BIGINT)
291+ let lastHeight = _loadInt(KEY_LAST_HEIGHT, 0)
292+ let targetHeight = _loadInt(KEY_TARGET_HEIGHT, 0)
293+ let minTargetHeight = min([targetHeight, height])
294+ let actions = if ((minTargetHeight == height))
295+ then {
296+ let lastRateUpdated = (lastRate + (toBigInt((minTargetHeight - lastHeight)) * currentRate))
297+ let remainingReward = (currentRate * toBigInt((targetHeight - minTargetHeight)))
298+ let currentRateUpdated = fraction(((toBigInt(amount_) * PERCENT_FACTOR) + remainingReward), ONE_BIGINT, (assetQuantity * toBigInt(spreadBlocks_)))
299+ let lastHeightUpdated = height
300+ let targetHeightUpdated = (lastHeightUpdated + spreadBlocks_)
301+[BinaryEntry(KEY_LAST_RATE, toBytes(lastRateUpdated)), BinaryEntry(KEY_CURRENT_RATE, toBytes(currentRateUpdated)), IntegerEntry(KEY_LAST_HEIGHT, lastHeightUpdated), IntegerEntry(KEY_TARGET_HEIGHT, targetHeightUpdated)]
302+ }
303+ else if ((targetHeight > lastHeight))
304+ then {
305+ let lastRateUpdated = (lastRate + (toBigInt((targetHeight - lastHeight)) * currentRate))
306+ let currentRateUpdated = fraction(toBigInt(amount_), PERCENT_FACTOR, (assetQuantity * toBigInt(spreadBlocks_)))
307+ let lastHeightUpdated = height
308+ let targetHeightUpdated = (lastHeightUpdated + spreadBlocks_)
309+[BinaryEntry(KEY_LAST_RATE, toBytes(lastRateUpdated)), BinaryEntry(KEY_CURRENT_RATE, toBytes(currentRateUpdated)), IntegerEntry(KEY_LAST_HEIGHT, lastHeightUpdated), IntegerEntry(KEY_TARGET_HEIGHT, targetHeightUpdated)]
310+ }
311+ else {
312+ let currentRateUpdated = fraction(toBigInt(amount_), PERCENT_FACTOR, (assetQuantity * toBigInt(spreadBlocks_)))
313+ let lastHeightUpdated = height
314+ let targetHeightUpdated = (lastHeightUpdated + spreadBlocks_)
315+[BinaryEntry(KEY_CURRENT_RATE, toBytes(currentRateUpdated)), IntegerEntry(KEY_LAST_HEIGHT, lastHeightUpdated), IntegerEntry(KEY_TARGET_HEIGHT, targetHeightUpdated)]
316+ }
317+ let stakeActions = _updateStaking(baseAsset, amount_, _loadStakingAdapter())
318+ $Tuple2((actions ++ stakeActions), unit)
319+ }
320+ else throw("Strict value is not equal to itself.")
321+ }
322+
323+
324+
325+@Callable(i)
326+func withdraw () = {
327+ let caller = toString(i.caller)
328+ let baseAsset = _loadBaseAsset()
329+ let asset = _loadAsset()
330+ let assetQuantity = toBigInt(_getAssetQuantity(asset))
331+ let err = if ((1 > size(i.payments)))
332+ then throw("withdraw: no payments")
333+ else if ((i.payments[0].assetId != asset))
334+ then throw("withdraw: payment is not in correct asset")
335+ else if ((0 >= i.payments[0].amount))
336+ then throw("withdraw: invalid payment amount")
337+ else unit
338+ if ((err == err))
339+ then {
340+ let checkpoint = _checkpoint(false)
341+ if ((checkpoint == checkpoint))
342+ then {
343+ let lastRate = _loadBigInt(KEY_LAST_RATE, PERCENT_FACTOR)
344+ let currentRate = _loadBigInt(KEY_CURRENT_RATE, ZERO_BIGINT)
345+ let lastHeight = _loadInt(KEY_LAST_HEIGHT, 0)
346+ let targetHeight = min([_loadInt(KEY_TARGET_HEIGHT, 0), height])
347+ let lastRateUpdated = (lastRate + (currentRate * toBigInt((targetHeight - lastHeight))))
348+ let baseAmount = toInt(fraction(toBigInt(i.payments[0].amount), lastRateUpdated, PERCENT_FACTOR, FLOOR))
349+ let currentRateUpdated = fraction(currentRate, assetQuantity, (assetQuantity - toBigInt(i.payments[0].amount)), FLOOR)
350+ let lastHeightUpdated = targetHeight
351+ let stakeActions = _updateStaking(baseAsset, (-1 * baseAmount), _loadStakingAdapter())
352+ $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)
353+ }
354+ else throw("Strict value is not equal to itself.")
355+ }
356+ else throw("Strict value is not equal to itself.")
357+ }
358+
359+
360+
361+@Callable(i)
362+func setMultisig (multisig_) = {
363+ let err = if ((i.caller != this))
364+ then throw("setMultisig: permission denied")
365+ else if (!(_validateAddress(multisig_)))
366+ then throw("setMultisig: invalid multisig address")
367+ else unit
368+ if ((err == err))
369+ then $Tuple2([StringEntry(KEY_MULTISIG, multisig_)], unit)
370+ else throw("Strict value is not equal to itself.")
371+ }
372+
373+
374+@Verifier(tx)
375+func verify () = match getString(KEY_MULTISIG) {
376+ case multisig: String =>
377+ valueOrElse(getBoolean(addressFromStringValue(multisig), makeString([KEY_STATUS, toString(this), toBase58String(tx.id)], SEPARATOR)), false)
378+ case _ =>
379+ sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
380+}
381+

github/deemru/w8io/169f3d6 
39.50 ms