tx · BvNMntVJ1wdcRMCMXYeMDGSjHA9eDpcwknEGqwrjMBBD

3MxovCV2pBS5Z6YEcj3Gap5ish6dX3YERfP:  -0.01000000 Waves

2022.11.09 20:16 [2309889] smart account 3MxovCV2pBS5Z6YEcj3Gap5ish6dX3YERfP > SELF 0.00000000 Waves

{ "type": 13, "id": "BvNMntVJ1wdcRMCMXYeMDGSjHA9eDpcwknEGqwrjMBBD", "fee": 1000000, "feeAssetId": null, "timestamp": 1668014249572, "version": 2, "chainId": 84, "sender": "3MxovCV2pBS5Z6YEcj3Gap5ish6dX3YERfP", "senderPublicKey": "6aZUzHaTgW7zPizjKqNFNAaKdYXVUaNwstd6E3NsD3YF", "proofs": [ "2KP4wbAVTLAnYCtbn4ESsPJqX9zmrBZxCoCZpCGrHCpeSNWPN8Nr9JTqbpEseCXFHkA4M4mcZtaKJVGoXy1HcFaS" ], "script": "base64:AAIFAAAAAAAAAA0IAhIAEgMKAQgSABIAAAAAEwAAAAAJcHJlY2lzaW9uAA3gtrOnZAAAAQAAABNrZXlNYW5hZ2VyUHVibGljS2V5AAAAAAkABCIAAAABAgAAABBtYW5hZ2VyUHVibGljS2V5AQAAABZtYW5hZ2VyUHVibGljS2V5T3JVbml0AAAAAAQAAAAHJG1hdGNoMAkBAAAAE2tleU1hbmFnZXJQdWJsaWNLZXkAAAAAAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAAZTdHJpbmcEAAAAAXMFAAAAByRtYXRjaDAJAAJZAAAAAQUAAAABcwMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAEVW5pdAUAAAAEdW5pdAkAAAIAAAABAgAAAAtNYXRjaCBlcnJvcgEAAAALbXVzdE1hbmFnZXIAAAABAAAAAWkEAAAAAnBkCQAAAgAAAAECAAAAEXBlcm1pc3Npb24gZGVuaWVkBAAAAAckbWF0Y2gwCQEAAAAWbWFuYWdlclB1YmxpY0tleU9yVW5pdAAAAAADCQAAAQAAAAIFAAAAByRtYXRjaDACAAAACkJ5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IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuAAAAAQAAAAJ0eAEAAAAGdmVyaWZ5AAAAAAkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAIBQAAAAJ0eAAAAA9zZW5kZXJQdWJsaWNLZXm6Npjs", "height": 2309889, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: mKTDV39acEKVnuZwHoV7AFvZpFVAPPNkaT1MTBidUGL Full:
OldNewDifferences
1-# no script
1+{-# STDLIB_VERSION 5 #-}
2+{-# SCRIPT_TYPE ACCOUNT #-}
3+{-# CONTENT_TYPE DAPP #-}
4+let precision = 1000000000000000000
5+
6+func keyManagerPublicKey () = getString("managerPublicKey")
7+
8+
9+func managerPublicKeyOrUnit () = match keyManagerPublicKey() {
10+ case s: String =>
11+ fromBase58String(s)
12+ case _: Unit =>
13+ unit
14+ case _ =>
15+ throw("Match error")
16+}
17+
18+
19+func mustManager (i) = {
20+ let pd = throw("permission denied")
21+ match managerPublicKeyOrUnit() {
22+ case pk: ByteVector =>
23+ if ((i.callerPublicKey == pk))
24+ then true
25+ else pd
26+ case _: Unit =>
27+ if ((i.caller == this))
28+ then true
29+ else pd
30+ case _ =>
31+ throw("Match error")
32+ }
33+ }
34+
35+
36+func mustNotInited () = match getBoolean("inited") {
37+ case inited: Boolean =>
38+ if ((inited == false))
39+ then true
40+ else throw("Already inited")
41+ case _: Unit =>
42+ false
43+ case _ =>
44+ throw("Match error")
45+}
46+
47+
48+func cancelLease () = match getBinary("leaseId") {
49+ case id: ByteVector =>
50+[LeaseCancel(id), DeleteEntry("leaseId")]
51+ case _: Unit =>
52+ nil
53+ case _ =>
54+ throw("Match error")
55+}
56+
57+
58+func getBalance () = valueOrElse(getInteger("balance"), 0)
59+
60+
61+func setBalance (amount) = IntegerEntry("balance", amount)
62+
63+
64+func lease (amount) = if ((amount == 0))
65+ then nil
66+ else {
67+ let leaserAddress = Address(fromBase58String(getStringValue("leaserAddress")))
68+ let currentAmount = getBalance()
69+ let newAmount = (currentAmount + amount)
70+ let leaseActions = if ((newAmount > 0))
71+ then {
72+ let newLease = Lease(leaserAddress, newAmount)
73+ let newLeaseId = calculateLeaseId(newLease)
74+[newLease, BinaryEntry("leaseId", newLeaseId)]
75+ }
76+ else nil
77+ ((cancelLease() ++ leaseActions) :+ setBalance(newAmount))
78+ }
79+
80+
81+func issueSWaves (amount) = {
82+ let sWavesAssetId = fromBase58String(getStringValue("sWavesAssetId"))
83+ Reissue(sWavesAssetId, amount, true)
84+ }
85+
86+
87+func burnSWaves (amount) = {
88+ let sWavesAssetId = fromBase58String(getStringValue("sWavesAssetId"))
89+ Burn(sWavesAssetId, amount)
90+ }
91+
92+
93+func sendSWaves (recipient,amount) = {
94+ let sWavesAssetId = fromBase58String(getStringValue("sWavesAssetId"))
95+ ScriptTransfer(recipient, amount, sWavesAssetId)
96+ }
97+
98+
99+func sendWaves (recipient,amount) = ScriptTransfer(recipient, amount, unit)
100+
101+
102+func sWavesQuantity () = {
103+ let assetId = fromBase58String(getStringValue("sWavesAssetId"))
104+ match assetInfo(assetId) {
105+ case asset: Asset =>
106+ asset.quantity
107+ case _ =>
108+ throw("Can't find asset")
109+ }
110+ }
111+
112+
113+func getExcessWaves () = {
114+ let leaserAddress = Address(fromBase58String(getStringValue("leaserAddress")))
115+ wavesBalance(leaserAddress).regular
116+ }
117+
118+
119+func setRate (rate,growthRate) = [IntegerEntry("lastRate", rate), IntegerEntry("lastTimestamp", lastBlock.timestamp)]
120+
121+
122+func withdraw () = {
123+ let minerAddress = Address(fromBase58String(getStringValue("leaserAddress")))
124+ let result = invoke(minerAddress, "withdraw", nil, nil)
125+ if ((result == result))
126+ then result
127+ else throw("Strict value is not equal to itself.")
128+ }
129+
130+
131+func currentRate (dt) = (getIntegerValue("lastRate") + (getIntegerValue("growthRate") * dt))
132+
133+
134+func getCompoundTimestampDiff () = (lastBlock.timestamp - getIntegerValue("lastTimestamp"))
135+
136+
137+@Callable(i)
138+func compound () = {
139+ let dt = getCompoundTimestampDiff()
140+ if ((dt == 0))
141+ then nil
142+ else {
143+ let rate = currentRate(dt)
144+ let excessWaves = getExcessWaves()
145+ let sWavesTotal = sWavesQuantity()
146+ let growthRate = (fraction(excessWaves, precision, sWavesTotal) / dt)
147+ let withdrawResult = withdraw()
148+ if ((withdrawResult == withdrawResult))
149+ then (lease(excessWaves) ++ setRate(rate, growthRate))
150+ else throw("Strict value is not equal to itself.")
151+ }
152+ }
153+
154+
155+
156+@Callable(i)
157+func init (leaserAddress) = {
158+ let checks = [mustManager(i), mustNotInited()]
159+ if ((checks == checks))
160+ then {
161+ let sWaves = Issue("sWaves", "", 0, 8, true, unit, 0)
162+ let sWavesAssetId = calculateAssetId(sWaves)
163+[BooleanEntry("inited", true), StringEntry("sWavesAssetId", toBase58String(sWavesAssetId)), StringEntry("leaserAddress", leaserAddress), IntegerEntry("lastRate", precision), IntegerEntry("lastTimestamp", lastBlock.timestamp), IntegerEntry("growthRate", 0), IntegerEntry("balance", 0), sWaves]
164+ }
165+ else throw("Strict value is not equal to itself.")
166+ }
167+
168+
169+
170+@Callable(i)
171+func stake () = {
172+ let payment = i.payments[0]
173+ if ((payment.assetId != unit))
174+ then throw("Only WAVES supported")
175+ else if ((size(i.payments) != 1))
176+ then throw("Wrong payments amount")
177+ else {
178+ let dt = getCompoundTimestampDiff()
179+ let rate = currentRate(dt)
180+ let toReissue = fraction(payment.amount, precision, rate)
181+ let result = invoke(this, "compound", nil, nil)
182+ if ((result == result))
183+ then ((lease(payment.amount) :+ issueSWaves(toReissue)) :+ sendSWaves(i.caller, toReissue))
184+ else throw("Strict value is not equal to itself.")
185+ }
186+ }
187+
188+
189+
190+@Callable(i)
191+func unstake () = {
192+ let payment = i.payments[0]
193+ let sWavesAssetId = fromBase58String(getStringValue("sWavesAssetId"))
194+ if ((payment.assetId != sWavesAssetId))
195+ then throw("Only sWAVES supported")
196+ else if ((size(i.payments) != 1))
197+ then throw("Wrong payments amount")
198+ else {
199+ let dt = getCompoundTimestampDiff()
200+ let rate = currentRate(dt)
201+ let transferAmount = fraction(payment.amount, rate, precision)
202+ let result = invoke(this, "compound", nil, nil)
203+ if ((result == result))
204+ then ((lease(-(transferAmount)) :+ burnSWaves(payment.amount)) :+ sendWaves(i.caller, transferAmount))
205+ else throw("Strict value is not equal to itself.")
206+ }
207+ }
208+
209+
210+@Verifier(tx)
211+func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
212+

github/deemru/w8io/169f3d6 
23.07 ms