tx · BrkV6ZnB28fo3AMKbuDLP5GHPgzyrbBBVsRxAjqjnbJw 3MpMuGN8rW9EpPwzETAQz88Pe9TQhSwiriq: -0.01000000 Waves 2023.07.19 12:33 [2672569] smart account 3MpMuGN8rW9EpPwzETAQz88Pe9TQhSwiriq > SELF 0.00000000 Waves
{ "type": 13, "id": "BrkV6ZnB28fo3AMKbuDLP5GHPgzyrbBBVsRxAjqjnbJw", "fee": 1000000, "feeAssetId": null, "timestamp": 1689759240288, "version": 2, "chainId": 84, "sender": "3MpMuGN8rW9EpPwzETAQz88Pe9TQhSwiriq", "senderPublicKey": "57SkjQUEwC1ayCqLbXLuzBqifK6B6SR6rfxtGsbAo3zW", "proofs": [ "5UoiXpLcGrQBKDT5vtdDkQgo3crmvpiNXZxAJw5ELx2xomJhiX6zGRTPpAq2m7m6aXrq1ykxmAwcxQeXgrpGLaiD" ], "script": "base64:BgIaCAISAwoBARIAEgMKAQgSAwoBARIDCgEIEgAWAAxjb250cmFjdEZpbGUCEG1ydF9zdGFraW5nLnJpZGUAA1NFUAICX18ABnNjYWxlOACAwtcvABJBRERSRVNTX0JZVEVTX1NJWkUAGgEIdGhyb3dFcnIBA21zZwkAAgEJAKwCAgkArAICBQxjb250cmFjdEZpbGUCAjogBQNtc2cACmtleUFzc2V0SWQJALkJAgkAzAgCAgIlcwkAzAgCAgdhc3NldElkBQNuaWwFA1NFUAATa2V5RW1pc3Npb25QZXJCbG9jawkAuQkCCQDMCAICAiVzCQDMCAICEGVtaXNzaW9uUGVyQmxvY2sFA25pbAUDU0VQAA1rZXlTdGFydEJsb2NrCQC5CQIJAMwIAgICJXMJAMwIAgIKc3RhcnRCbG9jawUDbmlsBQNTRVAAEGtleVRvdGFsTHBBbW91bnQJALkJAgkAzAgCAgIlcwkAzAgCAg10b3RhbExwQW1vdW50BQNuaWwFA1NFUAATa2V5VG90YWxBc3NldEFtb3VudAkAuQkCCQDMCAICAiVzCQDMCAICEHRvdGFsQXNzZXRBbW91bnQFA25pb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RhbEFzc2V0QW1vdW50V2l0aFByb2ZpdE9yTWF4QXZhaWxhYmxlAAkBD2dldEN1cnJlbnRQcmljZQAAYFOd7g==", "height": 2672569, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 9afHXwHh2UxoJQFxqLuw6zqfYFiaKnxC7Q9DZj31CpK9 Next: 9VSJDAE3AHniSi75bSKhCVmtHkc9WfD5jg2kNLKT1KBf Diff:
Old | New | Differences | |
---|---|---|---|
7 | 7 | ||
8 | 8 | let c = 100000000 | |
9 | 9 | ||
10 | - | func d (e) = throw(((a + ": ") + e)) | |
10 | + | let d = 26 | |
11 | + | ||
12 | + | func e (f) = throw(((a + ": ") + f)) | |
11 | 13 | ||
12 | 14 | ||
13 | - | let | |
15 | + | let g = makeString(["%s", "assetId"], b) | |
14 | 16 | ||
15 | - | let | |
17 | + | let h = makeString(["%s", "emissionPerBlock"], b) | |
16 | 18 | ||
17 | - | let | |
19 | + | let i = makeString(["%s", "startBlock"], b) | |
18 | 20 | ||
19 | - | let | |
21 | + | let j = makeString(["%s", "totalLpAmount"], b) | |
20 | 22 | ||
21 | - | let | |
23 | + | let k = makeString(["%s", "totalAssetAmount"], b) | |
22 | 24 | ||
23 | - | func | |
25 | + | func l (m) = makeString(["%s%s", "userLpAmount", m], b) | |
24 | 26 | ||
25 | 27 | ||
26 | - | func | |
28 | + | func n (m) = makeString(["%s%s", "totalAssetWithdrawn", m], b) | |
27 | 29 | ||
28 | 30 | ||
29 | - | func | |
31 | + | func o (m) = makeString(["%s%s", "totalAssetStaked", m], b) | |
30 | 32 | ||
31 | - | ||
32 | - | let o = valueOrElse(getInteger(this, i), 0) | |
33 | 33 | ||
34 | 34 | let p = valueOrElse(getInteger(this, j), 0) | |
35 | 35 | ||
36 | - | let q = valueOrElse( | |
36 | + | let q = valueOrElse(getInteger(this, k), 0) | |
37 | 37 | ||
38 | - | let r = if ((q == "WAVES")) | |
38 | + | let r = valueOrElse(getString(this, g), "WAVES") | |
39 | + | ||
40 | + | let s = if ((r == "WAVES")) | |
39 | 41 | then unit | |
40 | - | else fromBase58String( | |
42 | + | else fromBase58String(r) | |
41 | 43 | ||
42 | - | func | |
44 | + | func t (m) = valueOrElse(getInteger(this, l(m)), 0) | |
43 | 45 | ||
44 | 46 | ||
45 | - | func t () = { | |
46 | - | let u = valueOrElse(getInteger(this, g), 0) | |
47 | + | func u () = { | |
47 | 48 | let v = valueOrElse(getInteger(this, h), 0) | |
48 | - | let w = (height - v) | |
49 | - | max([0, (u * w)]) | |
49 | + | let w = valueOrElse(getInteger(this, i), 0) | |
50 | + | let x = (height - w) | |
51 | + | max([0, (v * x)]) | |
50 | 52 | } | |
51 | 53 | ||
52 | 54 | ||
53 | - | func | |
54 | - | let | |
55 | - | let | |
56 | - | if ($isInstanceOf( | |
55 | + | func y () = { | |
56 | + | let z = (q + u()) | |
57 | + | let A = s | |
58 | + | if ($isInstanceOf(A, "Unit")) | |
57 | 59 | then { | |
58 | - | let | |
59 | - | min([ | |
60 | + | let B = A | |
61 | + | min([z, wavesBalance(this).available]) | |
60 | 62 | } | |
61 | - | else if ($isInstanceOf( | |
63 | + | else if ($isInstanceOf(A, "ByteVector")) | |
62 | 64 | then { | |
63 | - | let | |
64 | - | min([ | |
65 | + | let C = A | |
66 | + | min([z, assetBalance(this, C)]) | |
65 | 67 | } | |
66 | 68 | else throw("Match error") | |
67 | 69 | } | |
68 | 70 | ||
69 | 71 | ||
70 | - | func | |
71 | - | then fraction( | |
72 | + | func D () = if ((p != 0)) | |
73 | + | then fraction(y(), c, p) | |
72 | 74 | else (1 * c) | |
73 | 75 | ||
74 | 76 | ||
75 | - | func | |
76 | - | let | |
77 | + | func E (F,m) = { | |
78 | + | let G = [if ((size(F.payments) == 1)) | |
77 | 79 | then true | |
78 | - | else | |
80 | + | else e("should include 1 payment"), if ((F.payments[0].assetId == s)) | |
79 | 81 | then true | |
80 | - | else | |
82 | + | else e(("payment should be in " + r)), if ((F.payments[0].amount > 0)) | |
81 | 83 | then true | |
82 | 84 | else "payment amount should be greater than 0"] | |
83 | - | if (( | |
85 | + | if ((G == G)) | |
84 | 86 | then { | |
85 | - | let | |
86 | - | let | |
87 | - | let | |
88 | - | let | |
89 | - | let | |
90 | - | let | |
91 | - | let | |
92 | - | let | |
93 | - | let | |
94 | - | then [IntegerEntry( | |
87 | + | let H = F.payments[0].amount | |
88 | + | let I = fraction(H, c, D()) | |
89 | + | let J = t(m) | |
90 | + | let K = valueOrElse(getInteger(this, o(m)), 0) | |
91 | + | let L = (p + I) | |
92 | + | let M = (q + H) | |
93 | + | let N = (J + I) | |
94 | + | let O = (K + H) | |
95 | + | let P = if ((p == 0)) | |
96 | + | then [IntegerEntry(i, height)] | |
95 | 97 | else nil | |
96 | - | ([IntegerEntry( | |
98 | + | ([IntegerEntry(j, L), IntegerEntry(k, M), IntegerEntry(l(m), N), IntegerEntry(o(m), O)] ++ P) | |
97 | 99 | } | |
98 | 100 | else throw("Strict value is not equal to itself.") | |
99 | 101 | } | |
100 | 102 | ||
101 | 103 | ||
102 | - | @Callable( | |
103 | - | func setEmissionPerBlock ( | |
104 | - | let | |
104 | + | @Callable(F) | |
105 | + | func setEmissionPerBlock (v) = { | |
106 | + | let Q = [if ((F.caller == this)) | |
105 | 107 | then true | |
106 | - | else | |
107 | - | if (( | |
108 | - | then [IntegerEntry( | |
108 | + | else e("permission denied")] | |
109 | + | if ((Q == Q)) | |
110 | + | then [IntegerEntry(k, y()), IntegerEntry(i, height), IntegerEntry(h, max([0, v]))] | |
109 | 111 | else throw("Strict value is not equal to itself.") | |
110 | 112 | } | |
111 | 113 | ||
112 | 114 | ||
113 | 115 | ||
114 | - | @Callable( | |
115 | - | func stake () = | |
116 | + | @Callable(F) | |
117 | + | func stake () = E(F, toString(F.caller)) | |
116 | 118 | ||
117 | 119 | ||
118 | 120 | ||
119 | - | @Callable(E) | |
120 | - | func stakeFor (l) = D(E, l) | |
121 | + | @Callable(F) | |
122 | + | func stakeFor (m) = { | |
123 | + | let Q = [if ((size(fromBase58String(m)) == d)) | |
124 | + | then true | |
125 | + | else e("address is not valid")] | |
126 | + | if ((Q == Q)) | |
127 | + | then E(F, m) | |
128 | + | else throw("Strict value is not equal to itself.") | |
129 | + | } | |
121 | 130 | ||
122 | 131 | ||
123 | 132 | ||
124 | - | @Callable( | |
125 | - | func withdraw ( | |
126 | - | let | |
127 | - | let | |
128 | - | let | |
133 | + | @Callable(F) | |
134 | + | func withdraw (R) = { | |
135 | + | let m = toString(F.caller) | |
136 | + | let J = t(m) | |
137 | + | let Q = [if ((R > 0)) | |
129 | 138 | then true | |
130 | - | else | |
139 | + | else e("amount should be more than 0"), if ((J >= R)) | |
131 | 140 | then true | |
132 | - | else | |
133 | - | if (( | |
141 | + | else e((("cannot withdraw more than available (" + toString(J)) + ")"))] | |
142 | + | if ((Q == Q)) | |
134 | 143 | then { | |
135 | - | let | |
136 | - | let | |
137 | - | let | |
138 | - | let | |
139 | - | let | |
140 | - | let | |
141 | - | [ | |
144 | + | let N = (J - R) | |
145 | + | let S = fraction(R, D(), c) | |
146 | + | let L = (p - R) | |
147 | + | let M = fraction(L, D(), c) | |
148 | + | let T = valueOrElse(getInteger(this, n(m)), 0) | |
149 | + | let U = (T + S) | |
150 | + | [IntegerEntry(j, L), IntegerEntry(k, M), IntegerEntry(l(m), N), IntegerEntry(n(m), U), IntegerEntry(i, height), ScriptTransfer(F.caller, S, s)] | |
142 | 151 | } | |
143 | 152 | else throw("Strict value is not equal to itself.") | |
144 | 153 | } | |
145 | 154 | ||
146 | 155 | ||
147 | 156 | ||
148 | - | @Callable( | |
149 | - | func getUserAssetsREADONLY ( | |
150 | - | let | |
151 | - | let | |
152 | - | $Tuple2(nil, $Tuple3( | |
157 | + | @Callable(F) | |
158 | + | func getUserAssetsREADONLY (m) = { | |
159 | + | let J = t(m) | |
160 | + | let V = fraction(J, D(), c) | |
161 | + | $Tuple2(nil, $Tuple3(J, V, D())) | |
153 | 162 | } | |
154 | 163 | ||
155 | 164 | ||
156 | 165 | ||
157 | - | @Callable( | |
158 | - | func getTotalAssetsREADONLY () = $Tuple2(nil, $Tuple3( | |
166 | + | @Callable(F) | |
167 | + | func getTotalAssetsREADONLY () = $Tuple2(nil, $Tuple3(p, y(), D())) | |
159 | 168 | ||
160 | 169 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let a = "mrt_staking.ride" | |
5 | 5 | ||
6 | 6 | let b = "__" | |
7 | 7 | ||
8 | 8 | let c = 100000000 | |
9 | 9 | ||
10 | - | func d (e) = throw(((a + ": ") + e)) | |
10 | + | let d = 26 | |
11 | + | ||
12 | + | func e (f) = throw(((a + ": ") + f)) | |
11 | 13 | ||
12 | 14 | ||
13 | - | let | |
15 | + | let g = makeString(["%s", "assetId"], b) | |
14 | 16 | ||
15 | - | let | |
17 | + | let h = makeString(["%s", "emissionPerBlock"], b) | |
16 | 18 | ||
17 | - | let | |
19 | + | let i = makeString(["%s", "startBlock"], b) | |
18 | 20 | ||
19 | - | let | |
21 | + | let j = makeString(["%s", "totalLpAmount"], b) | |
20 | 22 | ||
21 | - | let | |
23 | + | let k = makeString(["%s", "totalAssetAmount"], b) | |
22 | 24 | ||
23 | - | func | |
25 | + | func l (m) = makeString(["%s%s", "userLpAmount", m], b) | |
24 | 26 | ||
25 | 27 | ||
26 | - | func | |
28 | + | func n (m) = makeString(["%s%s", "totalAssetWithdrawn", m], b) | |
27 | 29 | ||
28 | 30 | ||
29 | - | func | |
31 | + | func o (m) = makeString(["%s%s", "totalAssetStaked", m], b) | |
30 | 32 | ||
31 | - | ||
32 | - | let o = valueOrElse(getInteger(this, i), 0) | |
33 | 33 | ||
34 | 34 | let p = valueOrElse(getInteger(this, j), 0) | |
35 | 35 | ||
36 | - | let q = valueOrElse( | |
36 | + | let q = valueOrElse(getInteger(this, k), 0) | |
37 | 37 | ||
38 | - | let r = if ((q == "WAVES")) | |
38 | + | let r = valueOrElse(getString(this, g), "WAVES") | |
39 | + | ||
40 | + | let s = if ((r == "WAVES")) | |
39 | 41 | then unit | |
40 | - | else fromBase58String( | |
42 | + | else fromBase58String(r) | |
41 | 43 | ||
42 | - | func | |
44 | + | func t (m) = valueOrElse(getInteger(this, l(m)), 0) | |
43 | 45 | ||
44 | 46 | ||
45 | - | func t () = { | |
46 | - | let u = valueOrElse(getInteger(this, g), 0) | |
47 | + | func u () = { | |
47 | 48 | let v = valueOrElse(getInteger(this, h), 0) | |
48 | - | let w = (height - v) | |
49 | - | max([0, (u * w)]) | |
49 | + | let w = valueOrElse(getInteger(this, i), 0) | |
50 | + | let x = (height - w) | |
51 | + | max([0, (v * x)]) | |
50 | 52 | } | |
51 | 53 | ||
52 | 54 | ||
53 | - | func | |
54 | - | let | |
55 | - | let | |
56 | - | if ($isInstanceOf( | |
55 | + | func y () = { | |
56 | + | let z = (q + u()) | |
57 | + | let A = s | |
58 | + | if ($isInstanceOf(A, "Unit")) | |
57 | 59 | then { | |
58 | - | let | |
59 | - | min([ | |
60 | + | let B = A | |
61 | + | min([z, wavesBalance(this).available]) | |
60 | 62 | } | |
61 | - | else if ($isInstanceOf( | |
63 | + | else if ($isInstanceOf(A, "ByteVector")) | |
62 | 64 | then { | |
63 | - | let | |
64 | - | min([ | |
65 | + | let C = A | |
66 | + | min([z, assetBalance(this, C)]) | |
65 | 67 | } | |
66 | 68 | else throw("Match error") | |
67 | 69 | } | |
68 | 70 | ||
69 | 71 | ||
70 | - | func | |
71 | - | then fraction( | |
72 | + | func D () = if ((p != 0)) | |
73 | + | then fraction(y(), c, p) | |
72 | 74 | else (1 * c) | |
73 | 75 | ||
74 | 76 | ||
75 | - | func | |
76 | - | let | |
77 | + | func E (F,m) = { | |
78 | + | let G = [if ((size(F.payments) == 1)) | |
77 | 79 | then true | |
78 | - | else | |
80 | + | else e("should include 1 payment"), if ((F.payments[0].assetId == s)) | |
79 | 81 | then true | |
80 | - | else | |
82 | + | else e(("payment should be in " + r)), if ((F.payments[0].amount > 0)) | |
81 | 83 | then true | |
82 | 84 | else "payment amount should be greater than 0"] | |
83 | - | if (( | |
85 | + | if ((G == G)) | |
84 | 86 | then { | |
85 | - | let | |
86 | - | let | |
87 | - | let | |
88 | - | let | |
89 | - | let | |
90 | - | let | |
91 | - | let | |
92 | - | let | |
93 | - | let | |
94 | - | then [IntegerEntry( | |
87 | + | let H = F.payments[0].amount | |
88 | + | let I = fraction(H, c, D()) | |
89 | + | let J = t(m) | |
90 | + | let K = valueOrElse(getInteger(this, o(m)), 0) | |
91 | + | let L = (p + I) | |
92 | + | let M = (q + H) | |
93 | + | let N = (J + I) | |
94 | + | let O = (K + H) | |
95 | + | let P = if ((p == 0)) | |
96 | + | then [IntegerEntry(i, height)] | |
95 | 97 | else nil | |
96 | - | ([IntegerEntry( | |
98 | + | ([IntegerEntry(j, L), IntegerEntry(k, M), IntegerEntry(l(m), N), IntegerEntry(o(m), O)] ++ P) | |
97 | 99 | } | |
98 | 100 | else throw("Strict value is not equal to itself.") | |
99 | 101 | } | |
100 | 102 | ||
101 | 103 | ||
102 | - | @Callable( | |
103 | - | func setEmissionPerBlock ( | |
104 | - | let | |
104 | + | @Callable(F) | |
105 | + | func setEmissionPerBlock (v) = { | |
106 | + | let Q = [if ((F.caller == this)) | |
105 | 107 | then true | |
106 | - | else | |
107 | - | if (( | |
108 | - | then [IntegerEntry( | |
108 | + | else e("permission denied")] | |
109 | + | if ((Q == Q)) | |
110 | + | then [IntegerEntry(k, y()), IntegerEntry(i, height), IntegerEntry(h, max([0, v]))] | |
109 | 111 | else throw("Strict value is not equal to itself.") | |
110 | 112 | } | |
111 | 113 | ||
112 | 114 | ||
113 | 115 | ||
114 | - | @Callable( | |
115 | - | func stake () = | |
116 | + | @Callable(F) | |
117 | + | func stake () = E(F, toString(F.caller)) | |
116 | 118 | ||
117 | 119 | ||
118 | 120 | ||
119 | - | @Callable(E) | |
120 | - | func stakeFor (l) = D(E, l) | |
121 | + | @Callable(F) | |
122 | + | func stakeFor (m) = { | |
123 | + | let Q = [if ((size(fromBase58String(m)) == d)) | |
124 | + | then true | |
125 | + | else e("address is not valid")] | |
126 | + | if ((Q == Q)) | |
127 | + | then E(F, m) | |
128 | + | else throw("Strict value is not equal to itself.") | |
129 | + | } | |
121 | 130 | ||
122 | 131 | ||
123 | 132 | ||
124 | - | @Callable( | |
125 | - | func withdraw ( | |
126 | - | let | |
127 | - | let | |
128 | - | let | |
133 | + | @Callable(F) | |
134 | + | func withdraw (R) = { | |
135 | + | let m = toString(F.caller) | |
136 | + | let J = t(m) | |
137 | + | let Q = [if ((R > 0)) | |
129 | 138 | then true | |
130 | - | else | |
139 | + | else e("amount should be more than 0"), if ((J >= R)) | |
131 | 140 | then true | |
132 | - | else | |
133 | - | if (( | |
141 | + | else e((("cannot withdraw more than available (" + toString(J)) + ")"))] | |
142 | + | if ((Q == Q)) | |
134 | 143 | then { | |
135 | - | let | |
136 | - | let | |
137 | - | let | |
138 | - | let | |
139 | - | let | |
140 | - | let | |
141 | - | [ | |
144 | + | let N = (J - R) | |
145 | + | let S = fraction(R, D(), c) | |
146 | + | let L = (p - R) | |
147 | + | let M = fraction(L, D(), c) | |
148 | + | let T = valueOrElse(getInteger(this, n(m)), 0) | |
149 | + | let U = (T + S) | |
150 | + | [IntegerEntry(j, L), IntegerEntry(k, M), IntegerEntry(l(m), N), IntegerEntry(n(m), U), IntegerEntry(i, height), ScriptTransfer(F.caller, S, s)] | |
142 | 151 | } | |
143 | 152 | else throw("Strict value is not equal to itself.") | |
144 | 153 | } | |
145 | 154 | ||
146 | 155 | ||
147 | 156 | ||
148 | - | @Callable( | |
149 | - | func getUserAssetsREADONLY ( | |
150 | - | let | |
151 | - | let | |
152 | - | $Tuple2(nil, $Tuple3( | |
157 | + | @Callable(F) | |
158 | + | func getUserAssetsREADONLY (m) = { | |
159 | + | let J = t(m) | |
160 | + | let V = fraction(J, D(), c) | |
161 | + | $Tuple2(nil, $Tuple3(J, V, D())) | |
153 | 162 | } | |
154 | 163 | ||
155 | 164 | ||
156 | 165 | ||
157 | - | @Callable( | |
158 | - | func getTotalAssetsREADONLY () = $Tuple2(nil, $Tuple3( | |
166 | + | @Callable(F) | |
167 | + | func getTotalAssetsREADONLY () = $Tuple2(nil, $Tuple3(p, y(), D())) | |
159 | 168 | ||
160 | 169 |
github/deemru/w8io/169f3d6 59.46 ms ◑