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:AAIFAAAAAAAAAA0IAhIAEgMKAQgSABIAAAAAEwAAAAAJcHJlY2lzaW9uAA3gtrOnZAAAAQAAABNrZXlNYW5hZ2VyUHVibGljS2V5AAAAAAkABCIAAAABAgAAABBtYW5hZ2VyUHVibGljS2V5AQAAABZtYW5hZ2VyUHVibGljS2V5T3JVbml0AAAAAAQAAAAHJG1hdGNoMAkBAAAAE2tleU1hbmFnZXJQdWJsaWNLZXkAAAAAAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAAZTdHJpbmcEAAAAAXMFAAAAByRtYXRjaDAJAAJZAAAAAQUAAAABcwMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAEVW5pdAUAAAAEdW5pdAkAAAIAAAABAgAAAAtNYXRjaCBlcnJvcgEAAAALbXVzdE1hbmFnZXIAAAABAAAAAWkEAAAAAnBkCQAAAgAAAAECAAAAEXBlcm1pc3Npb24gZGVuaWVkBAAAAAckbWF0Y2gwCQEAAAAWbWFuYWdlclB1YmxpY0tleU9yVW5pdAAAAAADCQAAAQAAAAIFAAAAByRtYXRjaDACAAAACkJ5d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HZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuAAAAAQAAAAJ0eAEAAAAGdmVyaWZ5AAAAAAkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAIBQAAAAJ0eAAAAA9zZW5kZXJQdWJsaWNLZXm6Npjs", "height": 2309889, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: mKTDV39acEKVnuZwHoV7AFvZpFVAPPNkaT1MTBidUGL Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 5 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let a = 1000000000000000000 | |
5 | + | ||
6 | + | func b () = getString("managerPublicKey") | |
7 | + | ||
8 | + | ||
9 | + | func c () = { | |
10 | + | let d = b() | |
11 | + | if ($isInstanceOf(d, "String")) | |
12 | + | then { | |
13 | + | let e = d | |
14 | + | fromBase58String(e) | |
15 | + | } | |
16 | + | else if ($isInstanceOf(d, "Unit")) | |
17 | + | then unit | |
18 | + | else throw("Match error") | |
19 | + | } | |
20 | + | ||
21 | + | ||
22 | + | func f (g) = { | |
23 | + | let h = throw("permission denied") | |
24 | + | let d = c() | |
25 | + | if ($isInstanceOf(d, "ByteVector")) | |
26 | + | then { | |
27 | + | let i = d | |
28 | + | if ((g.callerPublicKey == i)) | |
29 | + | then true | |
30 | + | else h | |
31 | + | } | |
32 | + | else if ($isInstanceOf(d, "Unit")) | |
33 | + | then if ((g.caller == this)) | |
34 | + | then true | |
35 | + | else h | |
36 | + | else throw("Match error") | |
37 | + | } | |
38 | + | ||
39 | + | ||
40 | + | func j () = { | |
41 | + | let d = getBoolean("inited") | |
42 | + | if ($isInstanceOf(d, "Boolean")) | |
43 | + | then { | |
44 | + | let k = d | |
45 | + | if ((k == false)) | |
46 | + | then true | |
47 | + | else throw("Already inited") | |
48 | + | } | |
49 | + | else if ($isInstanceOf(d, "Unit")) | |
50 | + | then false | |
51 | + | else throw("Match error") | |
52 | + | } | |
53 | + | ||
54 | + | ||
55 | + | func l () = { | |
56 | + | let d = getBinary("leaseId") | |
57 | + | if ($isInstanceOf(d, "ByteVector")) | |
58 | + | then { | |
59 | + | let m = d | |
60 | + | [LeaseCancel(m), DeleteEntry("leaseId")] | |
61 | + | } | |
62 | + | else if ($isInstanceOf(d, "Unit")) | |
63 | + | then nil | |
64 | + | else throw("Match error") | |
65 | + | } | |
66 | + | ||
67 | + | ||
68 | + | func n () = valueOrElse(getInteger("balance"), 0) | |
69 | + | ||
70 | + | ||
71 | + | func o (p) = IntegerEntry("balance", p) | |
72 | + | ||
73 | + | ||
74 | + | func q (p) = if ((p == 0)) | |
75 | + | then nil | |
76 | + | else { | |
77 | + | let r = Address(fromBase58String(getStringValue("leaserAddress"))) | |
78 | + | let s = n() | |
79 | + | let t = (s + p) | |
80 | + | let u = if ((t > 0)) | |
81 | + | then { | |
82 | + | let v = Lease(r, t) | |
83 | + | let w = calculateLeaseId(v) | |
84 | + | [v, BinaryEntry("leaseId", w)] | |
85 | + | } | |
86 | + | else nil | |
87 | + | ((l() ++ u) :+ o(t)) | |
88 | + | } | |
89 | + | ||
90 | + | ||
91 | + | func x (p) = { | |
92 | + | let y = fromBase58String(getStringValue("sWavesAssetId")) | |
93 | + | Reissue(y, p, true) | |
94 | + | } | |
95 | + | ||
96 | + | ||
97 | + | func z (p) = { | |
98 | + | let y = fromBase58String(getStringValue("sWavesAssetId")) | |
99 | + | Burn(y, p) | |
100 | + | } | |
101 | + | ||
102 | + | ||
103 | + | func A (B,p) = { | |
104 | + | let y = fromBase58String(getStringValue("sWavesAssetId")) | |
105 | + | ScriptTransfer(B, p, y) | |
106 | + | } | |
107 | + | ||
108 | + | ||
109 | + | func C (B,p) = ScriptTransfer(B, p, unit) | |
110 | + | ||
111 | + | ||
112 | + | func D () = { | |
113 | + | let E = fromBase58String(getStringValue("sWavesAssetId")) | |
114 | + | let d = assetInfo(E) | |
115 | + | if ($isInstanceOf(d, "Asset")) | |
116 | + | then { | |
117 | + | let F = d | |
118 | + | F.quantity | |
119 | + | } | |
120 | + | else throw("Can't find asset") | |
121 | + | } | |
122 | + | ||
123 | + | ||
124 | + | func G () = { | |
125 | + | let r = Address(fromBase58String(getStringValue("leaserAddress"))) | |
126 | + | wavesBalance(r).regular | |
127 | + | } | |
128 | + | ||
129 | + | ||
130 | + | func H (I,J) = [IntegerEntry("lastRate", I), IntegerEntry("lastTimestamp", lastBlock.timestamp)] | |
131 | + | ||
132 | + | ||
133 | + | func K () = { | |
134 | + | let L = Address(fromBase58String(getStringValue("leaserAddress"))) | |
135 | + | let M = invoke(L, "withdraw", nil, nil) | |
136 | + | if ((M == M)) | |
137 | + | then M | |
138 | + | else throw("Strict value is not equal to itself.") | |
139 | + | } | |
140 | + | ||
141 | + | ||
142 | + | func N (O) = (getIntegerValue("lastRate") + (getIntegerValue("growthRate") * O)) | |
143 | + | ||
144 | + | ||
145 | + | func P () = (lastBlock.timestamp - getIntegerValue("lastTimestamp")) | |
146 | + | ||
147 | + | ||
148 | + | @Callable(g) | |
149 | + | func compound () = { | |
150 | + | let O = P() | |
151 | + | if ((O == 0)) | |
152 | + | then nil | |
153 | + | else { | |
154 | + | let I = N(O) | |
155 | + | let Q = G() | |
156 | + | let R = D() | |
157 | + | let J = (fraction(Q, a, R) / O) | |
158 | + | let S = K() | |
159 | + | if ((S == S)) | |
160 | + | then (q(Q) ++ H(I, J)) | |
161 | + | else throw("Strict value is not equal to itself.") | |
162 | + | } | |
163 | + | } | |
164 | + | ||
165 | + | ||
166 | + | ||
167 | + | @Callable(g) | |
168 | + | func init (r) = { | |
169 | + | let T = [f(g), j()] | |
170 | + | if ((T == T)) | |
171 | + | then { | |
172 | + | let U = Issue("sWaves", "", 0, 8, true, unit, 0) | |
173 | + | let y = calculateAssetId(U) | |
174 | + | [BooleanEntry("inited", true), StringEntry("sWavesAssetId", toBase58String(y)), StringEntry("leaserAddress", r), IntegerEntry("lastRate", a), IntegerEntry("lastTimestamp", lastBlock.timestamp), IntegerEntry("growthRate", 0), IntegerEntry("balance", 0), U] | |
175 | + | } | |
176 | + | else throw("Strict value is not equal to itself.") | |
177 | + | } | |
178 | + | ||
179 | + | ||
180 | + | ||
181 | + | @Callable(g) | |
182 | + | func stake () = { | |
183 | + | let V = g.payments[0] | |
184 | + | if ((V.assetId != unit)) | |
185 | + | then throw("Only WAVES supported") | |
186 | + | else if ((size(g.payments) != 1)) | |
187 | + | then throw("Wrong payments amount") | |
188 | + | else { | |
189 | + | let O = P() | |
190 | + | let I = N(O) | |
191 | + | let W = fraction(V.amount, a, I) | |
192 | + | let M = invoke(this, "compound", nil, nil) | |
193 | + | if ((M == M)) | |
194 | + | then ((q(V.amount) :+ x(W)) :+ A(g.caller, W)) | |
195 | + | else throw("Strict value is not equal to itself.") | |
196 | + | } | |
197 | + | } | |
198 | + | ||
199 | + | ||
200 | + | ||
201 | + | @Callable(g) | |
202 | + | func unstake () = { | |
203 | + | let V = g.payments[0] | |
204 | + | let y = fromBase58String(getStringValue("sWavesAssetId")) | |
205 | + | if ((V.assetId != y)) | |
206 | + | then throw("Only sWAVES supported") | |
207 | + | else if ((size(g.payments) != 1)) | |
208 | + | then throw("Wrong payments amount") | |
209 | + | else { | |
210 | + | let O = P() | |
211 | + | let I = N(O) | |
212 | + | let X = fraction(V.amount, I, a) | |
213 | + | let M = invoke(this, "compound", nil, nil) | |
214 | + | if ((M == M)) | |
215 | + | then ((q(-(X)) :+ z(V.amount)) :+ C(g.caller, X)) | |
216 | + | else throw("Strict value is not equal to itself.") | |
217 | + | } | |
218 | + | } | |
219 | + | ||
220 | + | ||
221 | + | @Verifier(Y) | |
222 | + | func Z () = sigVerify(Y.bodyBytes, Y.proofs[0], Y.senderPublicKey) | |
223 | + |
github/deemru/w8io/169f3d6 22.29 ms ◑