tx · HA3ycgx84Pc3o6HhH924uAFc8abfC89Vp9PxnF5CD4a2 3MxQPEhyQMQL5C4JN29toSkF9amf8iQSCPc: -0.05000000 Waves 2020.03.20 12:04 [917455] smart account 3MxQPEhyQMQL5C4JN29toSkF9amf8iQSCPc > SELF 0.00000000 Waves
{ "type": 13, "id": "HA3ycgx84Pc3o6HhH924uAFc8abfC89Vp9PxnF5CD4a2", "fee": 5000000, "feeAssetId": null, "timestamp": 1584695045798, "version": 1, "sender": "3MxQPEhyQMQL5C4JN29toSkF9amf8iQSCPc", "senderPublicKey": "3n7vYRqT664Gwk9F1i5yM11opnuaH4yABXXnsxP6kxUQ", "proofs": [ "3WHX3mWLyJYE2PhCiKfowjg44RvUjZ4vtkR5KzR9uNqpBjLPprscsnaH8EktBTEhywr4WRFK7tF7G6RkmZKK914v" ], "script": "base64:AAIDAAAAAAAAABwIARIECgIIARIAEgQKAgEIEgQKAggBEgQKAggBAAAAHgEAAAAOZ2V0TnVtYmVyQnlLZXkAAAABAAAAA2tleQQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQAAAAAAAAAAAAEAAAAOZ2V0U3RyaW5nQnlLZXkAAAABAAAAA2tleQQAAAAHJG1hdGNoMAkABB0AAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAABlN0cmluZwQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQIAAAAAAQAAAAxnZXRCb29sQnlLZXkAAAABAAAAA2tleQQAAAAHJG1hdGNoMAkABBsAAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAB0Jvb2xlYW4EAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEHAQAAABhnZXROdW1iZXJCeUFkZHJlc3NBbmRLZXkAAAACAAAAB2FkZHJlc3MA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ABBQAAAARoYXNoAgAAAAAJAAACAAAAAQIAAAARcHJvcG9zYWwgaXMgZXhpc3QJAQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAQAAABRnZXRFeHBpcmVQcm9wb3NhbEtleQAAAAEFAAAABGhhc2gFAAAADGV4cGFpckhlaWdodAkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkBAAAAE2dldE93bmVyUHJvcG9zYWxLZXkAAAABBQAAAARoYXNoCQAEJQAAAAEIBQAAAAFpAAAABmNhbGxlcgkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkBAAAAF2dldEFyZ3VtZW50c1Byb3Bvc2FsS2V5AAAAAQUAAAAEaGFzaAUAAAAJYXJndW1lbnRzBQAAAANuaWwAAAAAOjMLFw==", "chainId": 84, "height": 917455, "spentComplexity": 0 } View: original | compacted Prev: ADtAH7WeiUBvWZKApwzgc6BvosAMN8AhHqhVA6BuFNzc Next: none Diff:
Old | New | Differences | |
---|---|---|---|
89 | 89 | ||
90 | 90 | let z = addressFromStringValue(e(k)) | |
91 | 91 | ||
92 | - | let A = | |
92 | + | let A = addressFromStringValue(i(z, m)) | |
93 | 93 | ||
94 | - | func B (q) = a(r(q)) | |
94 | + | let B = fromBase58String(i(z, j)) | |
95 | + | ||
96 | + | func C (q) = a(r(q)) | |
95 | 97 | ||
96 | 98 | ||
97 | - | func | |
99 | + | func D (p,q) = a(o(p, q)) | |
98 | 100 | ||
99 | 101 | ||
100 | - | func | |
102 | + | func E (t) = a(s(t)) | |
101 | 103 | ||
102 | 104 | ||
103 | - | func | |
105 | + | func F (t) = e(u(t)) | |
104 | 106 | ||
105 | 107 | ||
106 | - | func | |
108 | + | func G (t) = e(v(t)) | |
107 | 109 | ||
108 | 110 | ||
109 | - | func | |
111 | + | func H (p,t) = e(w(p, t)) | |
110 | 112 | ||
111 | 113 | ||
112 | - | @Callable(H) | |
113 | - | func lockNeutrino () = { | |
114 | - | let I = extract(H.payment) | |
115 | - | if ((I.assetId != A)) | |
116 | - | then throw("can use neutrino") | |
117 | - | else { | |
118 | - | let J = toString(H.caller) | |
119 | - | let K = toBase58String(valueOrErrorMessage(I.assetId, "parse value error")) | |
120 | - | WriteSet([DataEntry(r(K), (B(K) + I.amount)), DataEntry(o(J, K), (C(J, K) + I.amount))]) | |
121 | - | } | |
114 | + | func I (p,J,K) = ((((("stakingconfig_" + p) + "_") + toString(J)) + "_") + K) | |
115 | + | ||
116 | + | ||
117 | + | func L (p) = ("stakingconfig_current_" + p) | |
118 | + | ||
119 | + | ||
120 | + | func M (N,O) = (N + (if (O) | |
121 | + | then "_start" | |
122 | + | else "_end")) | |
123 | + | ||
124 | + | ||
125 | + | func P (Q,K,J) = { | |
126 | + | let R = extract(Q.payment) | |
127 | + | if (!(isDefined(addressFromString(K)))) | |
128 | + | then throw(("Invalid address format " + K)) | |
129 | + | else if ((R.assetId != B)) | |
130 | + | then throw("can use usd only") | |
131 | + | else if ((J > 100)) | |
132 | + | then throw("staking rewards share cannot be higher than 100%") | |
133 | + | else if ((1 > J)) | |
134 | + | then throw("staking rewards share cannot be lower than 1%") | |
135 | + | else { | |
136 | + | let S = toString(Q.caller) | |
137 | + | let T = toBase58String(value(R.assetId)) | |
138 | + | let U = e(L(S)) | |
139 | + | let V = I(S, J, K) | |
140 | + | let W = !((U == V)) | |
141 | + | let X = if (W) | |
142 | + | then height | |
143 | + | else 0 | |
144 | + | let Y = if (W) | |
145 | + | then height | |
146 | + | else a(M(V, true)) | |
147 | + | WriteSet([DataEntry(r(T), (C(T) + R.amount)), DataEntry(o(S, T), (D(S, T) + R.amount)), DataEntry(M(U, false), X), DataEntry(M(V, true), Y), DataEntry(L(S), V)]) | |
148 | + | } | |
149 | + | } | |
150 | + | ||
151 | + | ||
152 | + | @Callable(Q) | |
153 | + | func lockNeutrinoSP (K,J) = P(Q, K, J) | |
154 | + | ||
155 | + | ||
156 | + | ||
157 | + | @Callable(Q) | |
158 | + | func lockNeutrino () = P(Q, toString(Q.caller), 100) | |
159 | + | ||
160 | + | ||
161 | + | ||
162 | + | @Callable(Q) | |
163 | + | func unlockNeutrino (Z,T) = { | |
164 | + | let S = toString(Q.caller) | |
165 | + | let q = fromBase58String(T) | |
166 | + | let aa = (D(S, T) - Z) | |
167 | + | if ((0 > aa)) | |
168 | + | then throw("invalid amount") | |
169 | + | else if ((q != B)) | |
170 | + | then throw("can use neutrino") | |
171 | + | else ScriptResult(WriteSet([DataEntry(r(T), (C(T) - Z)), DataEntry(o(S, T), aa)]), TransferSet([ScriptTransfer(addressFromStringValue(S), Z, B)])) | |
122 | 172 | } | |
123 | 173 | ||
124 | 174 | ||
125 | 175 | ||
126 | - | @Callable(H) | |
127 | - | func unlockNeutrino (L,K) = { | |
128 | - | let J = toString(H.caller) | |
129 | - | let q = fromBase58String(K) | |
130 | - | let M = (C(J, K) - L) | |
131 | - | if ((0 > M)) | |
132 | - | then throw("invalid amount") | |
133 | - | else if ((q != A)) | |
134 | - | then throw("can use neutrino") | |
135 | - | else ScriptResult(WriteSet([DataEntry(r(K), (B(K) - L)), DataEntry(o(J, K), M)]), TransferSet([ScriptTransfer(addressFromStringValue(J), L, A)])) | |
176 | + | @Callable(Q) | |
177 | + | func vote (t,ab) = { | |
178 | + | let ac = split(G(t), ",") | |
179 | + | let ad = ac[ab] | |
180 | + | if ((height > E(t))) | |
181 | + | then throw("proposal is expired") | |
182 | + | else WriteSet([DataEntry(w(toString(Q.caller), t), ad)]) | |
136 | 183 | } | |
137 | 184 | ||
138 | 185 | ||
139 | 186 | ||
140 | - | @Callable(H) | |
141 | - | func vote (t,N) = { | |
142 | - | let O = split(F(t), ",") | |
143 | - | let P = O[N] | |
144 | - | if ((height > D(t))) | |
145 | - | then throw("proposal is expired") | |
146 | - | else WriteSet([DataEntry(w(toString(H.caller), t), P)]) | |
147 | - | } | |
148 | - | ||
149 | - | ||
150 | - | ||
151 | - | @Callable(H) | |
152 | - | func createProposal (O,Q) = { | |
153 | - | let t = toBase58String(keccak256(((toBytes(O) + toBytes(Q)) + H.callerPublicKey))) | |
154 | - | if ((E(t) != "")) | |
187 | + | @Callable(Q) | |
188 | + | func createProposal (ac,ae) = { | |
189 | + | let t = toBase58String(keccak256(((toBytes(ac) + toBytes(ae)) + Q.callerPublicKey))) | |
190 | + | if ((F(t) != "")) | |
155 | 191 | then throw("proposal is exist") | |
156 | - | else WriteSet([DataEntry(s(t), | |
192 | + | else WriteSet([DataEntry(s(t), ae), DataEntry(u(t), toString(Q.caller)), DataEntry(v(t), ac)]) | |
157 | 193 | } | |
158 | 194 | ||
159 | 195 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | func a (b) = { | |
5 | 5 | let c = getInteger(this, b) | |
6 | 6 | if ($isInstanceOf(c, "Int")) | |
7 | 7 | then { | |
8 | 8 | let d = c | |
9 | 9 | d | |
10 | 10 | } | |
11 | 11 | else 0 | |
12 | 12 | } | |
13 | 13 | ||
14 | 14 | ||
15 | 15 | func e (b) = { | |
16 | 16 | let c = getString(this, b) | |
17 | 17 | if ($isInstanceOf(c, "String")) | |
18 | 18 | then { | |
19 | 19 | let d = c | |
20 | 20 | d | |
21 | 21 | } | |
22 | 22 | else "" | |
23 | 23 | } | |
24 | 24 | ||
25 | 25 | ||
26 | 26 | func f (b) = { | |
27 | 27 | let c = getBoolean(this, b) | |
28 | 28 | if ($isInstanceOf(c, "Boolean")) | |
29 | 29 | then { | |
30 | 30 | let d = c | |
31 | 31 | d | |
32 | 32 | } | |
33 | 33 | else false | |
34 | 34 | } | |
35 | 35 | ||
36 | 36 | ||
37 | 37 | func g (h,b) = { | |
38 | 38 | let c = getInteger(addressFromStringValue(h), b) | |
39 | 39 | if ($isInstanceOf(c, "Int")) | |
40 | 40 | then { | |
41 | 41 | let d = c | |
42 | 42 | d | |
43 | 43 | } | |
44 | 44 | else 0 | |
45 | 45 | } | |
46 | 46 | ||
47 | 47 | ||
48 | 48 | func i (h,b) = { | |
49 | 49 | let c = getString(h, b) | |
50 | 50 | if ($isInstanceOf(c, "String")) | |
51 | 51 | then { | |
52 | 52 | let d = c | |
53 | 53 | d | |
54 | 54 | } | |
55 | 55 | else "" | |
56 | 56 | } | |
57 | 57 | ||
58 | 58 | ||
59 | 59 | let j = "neutrino_asset_id" | |
60 | 60 | ||
61 | 61 | let k = "neutrino_contract" | |
62 | 62 | ||
63 | 63 | let l = "rpd_balance" | |
64 | 64 | ||
65 | 65 | let m = "control_contract" | |
66 | 66 | ||
67 | 67 | let n = "admins" | |
68 | 68 | ||
69 | 69 | func o (p,q) = ((((l + "_") + q) + "_") + p) | |
70 | 70 | ||
71 | 71 | ||
72 | 72 | func r (q) = ((l + "_") + q) | |
73 | 73 | ||
74 | 74 | ||
75 | 75 | func s (t) = (("proposal_expire" + "_") + t) | |
76 | 76 | ||
77 | 77 | ||
78 | 78 | func u (t) = (("proposal_owner" + "_") + t) | |
79 | 79 | ||
80 | 80 | ||
81 | 81 | func v (t) = (("proposal_arguments" + "_") + t) | |
82 | 82 | ||
83 | 83 | ||
84 | 84 | func w (p,t) = (((("proposal_vote" + "_") + p) + "_") + t) | |
85 | 85 | ||
86 | 86 | ||
87 | 87 | func x (y) = split(y, ",") | |
88 | 88 | ||
89 | 89 | ||
90 | 90 | let z = addressFromStringValue(e(k)) | |
91 | 91 | ||
92 | - | let A = | |
92 | + | let A = addressFromStringValue(i(z, m)) | |
93 | 93 | ||
94 | - | func B (q) = a(r(q)) | |
94 | + | let B = fromBase58String(i(z, j)) | |
95 | + | ||
96 | + | func C (q) = a(r(q)) | |
95 | 97 | ||
96 | 98 | ||
97 | - | func | |
99 | + | func D (p,q) = a(o(p, q)) | |
98 | 100 | ||
99 | 101 | ||
100 | - | func | |
102 | + | func E (t) = a(s(t)) | |
101 | 103 | ||
102 | 104 | ||
103 | - | func | |
105 | + | func F (t) = e(u(t)) | |
104 | 106 | ||
105 | 107 | ||
106 | - | func | |
108 | + | func G (t) = e(v(t)) | |
107 | 109 | ||
108 | 110 | ||
109 | - | func | |
111 | + | func H (p,t) = e(w(p, t)) | |
110 | 112 | ||
111 | 113 | ||
112 | - | @Callable(H) | |
113 | - | func lockNeutrino () = { | |
114 | - | let I = extract(H.payment) | |
115 | - | if ((I.assetId != A)) | |
116 | - | then throw("can use neutrino") | |
117 | - | else { | |
118 | - | let J = toString(H.caller) | |
119 | - | let K = toBase58String(valueOrErrorMessage(I.assetId, "parse value error")) | |
120 | - | WriteSet([DataEntry(r(K), (B(K) + I.amount)), DataEntry(o(J, K), (C(J, K) + I.amount))]) | |
121 | - | } | |
114 | + | func I (p,J,K) = ((((("stakingconfig_" + p) + "_") + toString(J)) + "_") + K) | |
115 | + | ||
116 | + | ||
117 | + | func L (p) = ("stakingconfig_current_" + p) | |
118 | + | ||
119 | + | ||
120 | + | func M (N,O) = (N + (if (O) | |
121 | + | then "_start" | |
122 | + | else "_end")) | |
123 | + | ||
124 | + | ||
125 | + | func P (Q,K,J) = { | |
126 | + | let R = extract(Q.payment) | |
127 | + | if (!(isDefined(addressFromString(K)))) | |
128 | + | then throw(("Invalid address format " + K)) | |
129 | + | else if ((R.assetId != B)) | |
130 | + | then throw("can use usd only") | |
131 | + | else if ((J > 100)) | |
132 | + | then throw("staking rewards share cannot be higher than 100%") | |
133 | + | else if ((1 > J)) | |
134 | + | then throw("staking rewards share cannot be lower than 1%") | |
135 | + | else { | |
136 | + | let S = toString(Q.caller) | |
137 | + | let T = toBase58String(value(R.assetId)) | |
138 | + | let U = e(L(S)) | |
139 | + | let V = I(S, J, K) | |
140 | + | let W = !((U == V)) | |
141 | + | let X = if (W) | |
142 | + | then height | |
143 | + | else 0 | |
144 | + | let Y = if (W) | |
145 | + | then height | |
146 | + | else a(M(V, true)) | |
147 | + | WriteSet([DataEntry(r(T), (C(T) + R.amount)), DataEntry(o(S, T), (D(S, T) + R.amount)), DataEntry(M(U, false), X), DataEntry(M(V, true), Y), DataEntry(L(S), V)]) | |
148 | + | } | |
149 | + | } | |
150 | + | ||
151 | + | ||
152 | + | @Callable(Q) | |
153 | + | func lockNeutrinoSP (K,J) = P(Q, K, J) | |
154 | + | ||
155 | + | ||
156 | + | ||
157 | + | @Callable(Q) | |
158 | + | func lockNeutrino () = P(Q, toString(Q.caller), 100) | |
159 | + | ||
160 | + | ||
161 | + | ||
162 | + | @Callable(Q) | |
163 | + | func unlockNeutrino (Z,T) = { | |
164 | + | let S = toString(Q.caller) | |
165 | + | let q = fromBase58String(T) | |
166 | + | let aa = (D(S, T) - Z) | |
167 | + | if ((0 > aa)) | |
168 | + | then throw("invalid amount") | |
169 | + | else if ((q != B)) | |
170 | + | then throw("can use neutrino") | |
171 | + | else ScriptResult(WriteSet([DataEntry(r(T), (C(T) - Z)), DataEntry(o(S, T), aa)]), TransferSet([ScriptTransfer(addressFromStringValue(S), Z, B)])) | |
122 | 172 | } | |
123 | 173 | ||
124 | 174 | ||
125 | 175 | ||
126 | - | @Callable(H) | |
127 | - | func unlockNeutrino (L,K) = { | |
128 | - | let J = toString(H.caller) | |
129 | - | let q = fromBase58String(K) | |
130 | - | let M = (C(J, K) - L) | |
131 | - | if ((0 > M)) | |
132 | - | then throw("invalid amount") | |
133 | - | else if ((q != A)) | |
134 | - | then throw("can use neutrino") | |
135 | - | else ScriptResult(WriteSet([DataEntry(r(K), (B(K) - L)), DataEntry(o(J, K), M)]), TransferSet([ScriptTransfer(addressFromStringValue(J), L, A)])) | |
176 | + | @Callable(Q) | |
177 | + | func vote (t,ab) = { | |
178 | + | let ac = split(G(t), ",") | |
179 | + | let ad = ac[ab] | |
180 | + | if ((height > E(t))) | |
181 | + | then throw("proposal is expired") | |
182 | + | else WriteSet([DataEntry(w(toString(Q.caller), t), ad)]) | |
136 | 183 | } | |
137 | 184 | ||
138 | 185 | ||
139 | 186 | ||
140 | - | @Callable(H) | |
141 | - | func vote (t,N) = { | |
142 | - | let O = split(F(t), ",") | |
143 | - | let P = O[N] | |
144 | - | if ((height > D(t))) | |
145 | - | then throw("proposal is expired") | |
146 | - | else WriteSet([DataEntry(w(toString(H.caller), t), P)]) | |
147 | - | } | |
148 | - | ||
149 | - | ||
150 | - | ||
151 | - | @Callable(H) | |
152 | - | func createProposal (O,Q) = { | |
153 | - | let t = toBase58String(keccak256(((toBytes(O) + toBytes(Q)) + H.callerPublicKey))) | |
154 | - | if ((E(t) != "")) | |
187 | + | @Callable(Q) | |
188 | + | func createProposal (ac,ae) = { | |
189 | + | let t = toBase58String(keccak256(((toBytes(ac) + toBytes(ae)) + Q.callerPublicKey))) | |
190 | + | if ((F(t) != "")) | |
155 | 191 | then throw("proposal is exist") | |
156 | - | else WriteSet([DataEntry(s(t), | |
192 | + | else WriteSet([DataEntry(s(t), ae), DataEntry(u(t), toString(Q.caller)), DataEntry(v(t), ac)]) | |
157 | 193 | } | |
158 | 194 | ||
159 | 195 |
github/deemru/w8io/169f3d6 34.70 ms ◑