tx · 9nFkN9cAaP6JP4nE4HasH9i22D1swvkewz8zFJKLStZS 3MwLW8P5yh5T2xML9QqFuVxkVkm9RXqnzXh: -0.00800000 Waves 2022.11.30 20:32 [2340138] smart account 3MwLW8P5yh5T2xML9QqFuVxkVkm9RXqnzXh > SELF 0.00000000 Waves
{ "type": 13, "id": "9nFkN9cAaP6JP4nE4HasH9i22D1swvkewz8zFJKLStZS", "fee": 800000, "feeAssetId": null, "timestamp": 1669829531822, "version": 2, "chainId": 84, "sender": "3MwLW8P5yh5T2xML9QqFuVxkVkm9RXqnzXh", "senderPublicKey": "HscGVyJG5M3NMHWKfQbucCBsFLGPi8VmTxTAmcBbaWTa", "proofs": [ "5rYbrXRd3njLwbQqkSd1fiXCbNVwp5zDQokXn8biPBwmDpoyKZRChnMDRxHyQvTQJqTQK9RmDCjjSEus2fuE55GU" ], "script": "base64:BgIJCAISAwoBCBIAEgAGU2NhbGU2AMCEPQAGU2NhbGU4AIDC1y8AB1NjYWxlMTYJAGgCBQZTY2FsZTgFBlNjYWxlOAAKdmFsaWRhdG9ycwkAzAgCAgAFA25pbAAHYXNzZXRJZAIsSEhtYUZRcFVvYndLeHpqejRFQ2FCUHRvRjY5a3VqS3dVMmNvemFVelRzZ3YAC3B1enpsZVBvb2xzCQDMCAICIzNONlN0SmRnbVRmQVJzUk5uOVh0NXJEWUVzM3ByNEtHeTF2BQNuaWwBCmdldEJhbGFuY2UBB2Fzc2V0SWQEByRtYXRjaDAFB2Fzc2V0SWQDCQABAgUHJG1hdGNoMAIEVW5pdAQBeAUHJG1hdGNoMAgJAO8HAQUEdGhpcwlhdmFpbGFibGUJAPAHAgUEdGhpcwkBBXZhbHVlAQUHYXNzZXRJZAEJdHJ5R2V0SW50AgdhZGRyZXNzA2tleQQHJG1hdGNoMAkAmggCBQdhZGRyZXNzBQNrZXkDCQABAgUHJG1hdGNoMAIDSW50BAFiBQckbWF0Y2gwBQFiAAABCXRyeUdldFN0cgIHYWRkcmVzcwNrZXkEByR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BQFpBmNhbGxlcgUEdW5pdAkAAgECDUFjY2VzcyBkZW5pZWQDCQAAAgULY3VycmVudFBvb2wFBnBvb2xJZAkAAgEJAKwCAgITQWxyZWFkeSBzdXBwbGllZCB0bwULY3VycmVudFBvb2wECndpdGhkcmF3VHgJAQ53aXRoZHJhd1Jlc3VsdAADCQAAAgUKd2l0aGRyYXdUeAUKd2l0aGRyYXdUeAkAzggCCQEMc3VwcGx5UmVzdWx0AQUGcG9vbElkCQEMcmVjYWxjUmVzdWx0AQAACQACAQIkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuAWkBBXN0YWtlAAQEdXNlcgkApQgBCAUBaQZjYWxsZXIEBmFtb3VudAgJAJEDAggFAWkIcGF5bWVudHMAAAZhbW91bnQEC2N1cnJlbnRQb29sCQEJdHJ5R2V0U3RyAgUEdGhpcwILY3VycmVudFBvb2wDAwkAZwIAAAUGYW1vdW50BgkBAiE9AggJAJEDAggFAWkIcGF5bWVudHMAAAdhc3NldElkCQDZBAEFB2Fzc2V0SWQJAAIBAhZpbnZhbGlkIHRva2VuIGF0dGFjaGVkAwkAAAIFC2N1cnJlbnRQb29sAgAJAAIBAhRQb29sIG5vdCBpbml0aWFsaXplZAkAzggCCQELc3Rha2VSZXN1bHQCBQR1c2VyBQZhbW91bnQJAQxzdXBwbHlSZXN1bHQBBQtjdXJyZW50UG9vbAECdHgBBnZlcmlmeQAJAPQDAwgFAnR4CWJvZHlCeXRlcwkAkQMCCAUCdHgGcHJvb2ZzAAAIBQJ0eA9zZW5kZXJQdWJsaWNLZXkoB3hB", "height": 2340138, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: GJgHWHssEwXM3uEng789AxfCXnvBHtpa3oYkfh164TtW Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 6 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let a = 1000000 | |
5 | + | ||
6 | + | let b = 100000000 | |
7 | + | ||
8 | + | let c = (b * b) | |
9 | + | ||
10 | + | let d = [""] | |
11 | + | ||
12 | + | let e = "HHmaFQpUobwKxzjz4ECaBPtoF69kujKwU2cozaUzTsgv" | |
13 | + | ||
14 | + | let f = ["3N6StJdgmTfARsRNn9Xt5rDYEs3pr4KGy1v"] | |
15 | + | ||
16 | + | func g (e) = { | |
17 | + | let h = e | |
18 | + | if ($isInstanceOf(h, "Unit")) | |
19 | + | then { | |
20 | + | let i = h | |
21 | + | wavesBalance(this).available | |
22 | + | } | |
23 | + | else assetBalance(this, value(e)) | |
24 | + | } | |
25 | + | ||
26 | + | ||
27 | + | func j (k,l) = { | |
28 | + | let h = getInteger(k, l) | |
29 | + | if ($isInstanceOf(h, "Int")) | |
30 | + | then { | |
31 | + | let m = h | |
32 | + | m | |
33 | + | } | |
34 | + | else 0 | |
35 | + | } | |
36 | + | ||
37 | + | ||
38 | + | func n (k,l) = { | |
39 | + | let h = getString(k, l) | |
40 | + | if ($isInstanceOf(h, "String")) | |
41 | + | then { | |
42 | + | let m = h | |
43 | + | m | |
44 | + | } | |
45 | + | else "" | |
46 | + | } | |
47 | + | ||
48 | + | ||
49 | + | func o (e) = { | |
50 | + | let h = e | |
51 | + | if ($isInstanceOf(h, "ByteVector")) | |
52 | + | then { | |
53 | + | let m = h | |
54 | + | toBase58String(m) | |
55 | + | } | |
56 | + | else "WAVES" | |
57 | + | } | |
58 | + | ||
59 | + | ||
60 | + | func p (q) = { | |
61 | + | let r = assetBalance(Address(fromBase58String(q)), fromBase58String(e)) | |
62 | + | r | |
63 | + | } | |
64 | + | ||
65 | + | ||
66 | + | func s () = { | |
67 | + | let t = n(this, "currentPool") | |
68 | + | if ((t == "")) | |
69 | + | then throw(("Cannot find pool with id " + t)) | |
70 | + | else p(t) | |
71 | + | } | |
72 | + | ||
73 | + | ||
74 | + | func u (q,v) = { | |
75 | + | let w = Address(fromBase58String(q)) | |
76 | + | let x = if ((v > 0)) | |
77 | + | then invoke(w, "withdraw", [e, v], nil) | |
78 | + | else "" | |
79 | + | if ((x == x)) | |
80 | + | then x | |
81 | + | else throw("Strict value is not equal to itself.") | |
82 | + | } | |
83 | + | ||
84 | + | ||
85 | + | func y () = { | |
86 | + | let z = j(this, "global_lastCheckSRate") | |
87 | + | let A = j(this, "global_staked") | |
88 | + | let B = j(this, "global_lastCheckSRateHeight") | |
89 | + | let C = (height - B) | |
90 | + | let D = (s() - fraction(A, z, b)) | |
91 | + | if ((A == 0)) | |
92 | + | then b | |
93 | + | else { | |
94 | + | let E = (z + fraction((C * b), D, A)) | |
95 | + | if ((b > E)) | |
96 | + | then b | |
97 | + | else E | |
98 | + | } | |
99 | + | } | |
100 | + | ||
101 | + | ||
102 | + | func F (G) = { | |
103 | + | let A = j(this, "global_staked") | |
104 | + | let E = y() | |
105 | + | [IntegerEntry("global_staked", (A + G)), IntegerEntry("global_lastCheckSRate", E), IntegerEntry("global_lastCheckSRateHeight", height)] | |
106 | + | } | |
107 | + | ||
108 | + | ||
109 | + | func H (q) = if ((indexOf(f, q) == unit)) | |
110 | + | then throw(("Unknown poolId " + q)) | |
111 | + | else { | |
112 | + | let I = fromBase58String(e) | |
113 | + | let r = g(I) | |
114 | + | let J = invoke(Address(fromBase58String(q)), "supply", nil, [AttachedPayment(I, r)]) | |
115 | + | if ((J == J)) | |
116 | + | then [StringEntry("currentPool", q)] | |
117 | + | else throw("Strict value is not equal to itself.") | |
118 | + | } | |
119 | + | ||
120 | + | ||
121 | + | func K () = { | |
122 | + | let t = n(this, "currentPool") | |
123 | + | if ((t == "")) | |
124 | + | then throw(("Cannot find pool with id " + t)) | |
125 | + | else { | |
126 | + | let v = p(t) | |
127 | + | let L = u(t, v) | |
128 | + | if ((L == L)) | |
129 | + | then L | |
130 | + | else throw("Strict value is not equal to itself.") | |
131 | + | } | |
132 | + | } | |
133 | + | ||
134 | + | ||
135 | + | func M (N,v) = { | |
136 | + | let O = fraction(v, b, y()) | |
137 | + | (F(O) ++ [IntegerEntry((N + "_staked"), (j(this, (N + "_staked")) + O))]) | |
138 | + | } | |
139 | + | ||
140 | + | ||
141 | + | @Callable(P) | |
142 | + | func rebalance (q) = { | |
143 | + | let t = n(this, "currentPool") | |
144 | + | if ((indexOf(d, toString(P.caller)) == unit)) | |
145 | + | then throw("Access denied") | |
146 | + | else if ((t == q)) | |
147 | + | then throw(("Already supplied to" + t)) | |
148 | + | else { | |
149 | + | let x = K() | |
150 | + | if ((x == x)) | |
151 | + | then (H(q) ++ F(0)) | |
152 | + | else throw("Strict value is not equal to itself.") | |
153 | + | } | |
154 | + | } | |
155 | + | ||
156 | + | ||
157 | + | ||
158 | + | @Callable(P) | |
159 | + | func stake () = { | |
160 | + | let N = toString(P.caller) | |
161 | + | let v = P.payments[0].amount | |
162 | + | let t = n(this, "currentPool") | |
163 | + | if (if ((0 >= v)) | |
164 | + | then true | |
165 | + | else (P.payments[0].assetId != fromBase58String(e))) | |
166 | + | then throw("invalid token attached") | |
167 | + | else if ((t == "")) | |
168 | + | then throw("Pool not initialized") | |
169 | + | else (M(N, v) ++ H(t)) | |
170 | + | } | |
171 | + | ||
172 | + | ||
173 | + | @Verifier(L) | |
174 | + | func Q () = sigVerify(L.bodyBytes, L.proofs[0], L.senderPublicKey) | |
175 | + |
github/deemru/w8io/169f3d6 17.44 ms ◑