1 | | - | {-# STDLIB_VERSION 5 #-} |
---|
2 | | - | {-# SCRIPT_TYPE ACCOUNT #-} |
---|
3 | | - | {-# CONTENT_TYPE DAPP #-} |
---|
4 | | - | let a = "__" |
---|
5 | | - | |
---|
6 | | - | func b (c,d) = valueOrErrorMessage(getString(c, d), (("mandatory this." + d) + " is not defined")) |
---|
7 | | - | |
---|
8 | | - | |
---|
9 | | - | func e () = "%s%s__config__factoryAddress" |
---|
10 | | - | |
---|
11 | | - | |
---|
12 | | - | let f = "%s%s__config__votingVerifiedContract" |
---|
13 | | - | |
---|
14 | | - | let g = "%s%s__config__votingEmissionCandidateContract" |
---|
15 | | - | |
---|
16 | | - | let h = "%s%s__config__userPoolsContract" |
---|
17 | | - | |
---|
18 | | - | let i = addressFromStringValue(b(this, f)) |
---|
19 | | - | |
---|
20 | | - | let j = addressFromStringValue(b(this, g)) |
---|
21 | | - | |
---|
22 | | - | let k = addressFromStringValue(b(this, h)) |
---|
23 | | - | |
---|
24 | | - | let l = 1 |
---|
25 | | - | |
---|
26 | | - | let m = 2 |
---|
27 | | - | |
---|
28 | | - | let n = 3 |
---|
29 | | - | |
---|
30 | | - | let o = 4 |
---|
31 | | - | |
---|
32 | | - | let p = 5 |
---|
33 | | - | |
---|
34 | | - | let q = 6 |
---|
35 | | - | |
---|
36 | | - | let r = 7 |
---|
37 | | - | |
---|
38 | | - | let s = 10 |
---|
39 | | - | |
---|
40 | | - | func t () = "%s__factoryConfig" |
---|
41 | | - | |
---|
42 | | - | |
---|
43 | | - | func u (v) = makeString(["%s%s%s", v, "mappings__lpAsset2PoolContract"], a) |
---|
44 | | - | |
---|
45 | | - | |
---|
46 | | - | func w () = "%s__lpTokensList" |
---|
47 | | - | |
---|
48 | | - | |
---|
49 | | - | func x (v) = makeString(["%s%s%s", v, "mappings__lpAsset2PoolContract"], a) |
---|
50 | | - | |
---|
51 | | - | |
---|
52 | | - | func y (z) = makeString(["%s%s", "poolWeight", z], a) |
---|
53 | | - | |
---|
54 | | - | |
---|
55 | | - | func A () = addressFromStringValue(b(this, e())) |
---|
56 | | - | |
---|
57 | | - | |
---|
58 | | - | func B () = split(valueOrElse(getString(A(), w()), ""), a) |
---|
59 | | - | |
---|
60 | | - | |
---|
61 | | - | func C (D) = split(b(D, t()), a) |
---|
62 | | - | |
---|
63 | | - | |
---|
64 | | - | func E (F) = addressFromStringValue(F[m]) |
---|
65 | | - | |
---|
66 | | - | |
---|
67 | | - | func G (F) = addressFromStringValue(F[p]) |
---|
68 | | - | |
---|
69 | | - | |
---|
70 | | - | func H (F) = addressFromStringValue(F[l]) |
---|
71 | | - | |
---|
72 | | - | |
---|
73 | | - | func I (F) = addressFromStringValue(F[s]) |
---|
74 | | - | |
---|
75 | | - | |
---|
76 | | - | func J () = "%s__config" |
---|
77 | | - | |
---|
78 | | - | |
---|
79 | | - | func K () = "%s%s__ratePerBlockMax__current" |
---|
80 | | - | |
---|
81 | | - | |
---|
82 | | - | func L (M,N) = makeString(["%s%s%d%d__ratePerBlockMax__start", toString(M), toString(N)], a) |
---|
83 | | - | |
---|
84 | | - | |
---|
85 | | - | func O () = "%s%s__ratePerBlock__current" |
---|
86 | | - | |
---|
87 | | - | |
---|
88 | | - | func P (M,N) = makeString(["%s%s%d%d__ratePerBlock__start", toString(M), toString(N)], a) |
---|
89 | | - | |
---|
90 | | - | |
---|
91 | | - | func Q () = "%s%s__emission__startBlock" |
---|
92 | | - | |
---|
93 | | - | |
---|
94 | | - | func R () = "%s%s__emission__duration" |
---|
95 | | - | |
---|
96 | | - | |
---|
97 | | - | func S () = "%s%s__emission__endBlock" |
---|
98 | | - | |
---|
99 | | - | |
---|
100 | | - | func T () = "%s__managerPublicKey" |
---|
101 | | - | |
---|
102 | | - | |
---|
103 | | - | func U () = "%s__pendingManagerPublicKey" |
---|
104 | | - | |
---|
105 | | - | |
---|
106 | | - | func V () = { |
---|
107 | | - | let W = getString(T()) |
---|
108 | | - | if ($isInstanceOf(W, "String")) |
---|
109 | | - | then { |
---|
110 | | - | let X = W |
---|
111 | | - | fromBase58String(X) |
---|
112 | | - | } |
---|
113 | | - | else if ($isInstanceOf(W, "Unit")) |
---|
114 | | - | then unit |
---|
115 | | - | else throw("Match error") |
---|
116 | | - | } |
---|
117 | | - | |
---|
118 | | - | |
---|
119 | | - | func Y () = { |
---|
120 | | - | let W = getString(U()) |
---|
121 | | - | if ($isInstanceOf(W, "String")) |
---|
122 | | - | then { |
---|
123 | | - | let X = W |
---|
124 | | - | fromBase58String(X) |
---|
125 | | - | } |
---|
126 | | - | else if ($isInstanceOf(W, "Unit")) |
---|
127 | | - | then unit |
---|
128 | | - | else throw("Match error") |
---|
129 | | - | } |
---|
130 | | - | |
---|
131 | | - | |
---|
132 | | - | func Z (aa) = { |
---|
133 | | - | let ab = throw("Permission denied") |
---|
134 | | - | let W = V() |
---|
135 | | - | if ($isInstanceOf(W, "ByteVector")) |
---|
136 | | - | then { |
---|
137 | | - | let ac = W |
---|
138 | | - | if ((aa.callerPublicKey == ac)) |
---|
139 | | - | then true |
---|
140 | | - | else ab |
---|
141 | | - | } |
---|
142 | | - | else if ($isInstanceOf(W, "Unit")) |
---|
143 | | - | then if ((aa.caller == this)) |
---|
144 | | - | then true |
---|
145 | | - | else ab |
---|
146 | | - | else throw("Match error") |
---|
147 | | - | } |
---|
148 | | - | |
---|
149 | | - | |
---|
150 | | - | @Callable(aa) |
---|
151 | | - | func constructor (ad,ae,af,ag,ah,ai,aj) = { |
---|
152 | | - | let ak = Z(aa) |
---|
153 | | - | if ((ak == ak)) |
---|
154 | | - | then [IntegerEntry(L(ai, ag), ae), IntegerEntry(K(), ae), IntegerEntry(P(ai, ag), af), IntegerEntry(O(), af), IntegerEntry(Q(), ag), IntegerEntry(R(), ah), IntegerEntry(S(), (ag + ah)), StringEntry(e(), ad), StringEntry(J(), ("%s__" + aj))] |
---|
155 | | - | else throw("Strict value is not equal to itself.") |
---|
156 | | - | } |
---|
157 | | - | |
---|
158 | | - | |
---|
159 | | - | |
---|
160 | | - | @Callable(aa) |
---|
161 | | - | func constructorV2 (al) = { |
---|
162 | | - | let ak = Z(aa) |
---|
163 | | - | if ((ak == ak)) |
---|
164 | | - | then $Tuple2([StringEntry(f, al)], unit) |
---|
165 | | - | else throw("Strict value is not equal to itself.") |
---|
166 | | - | } |
---|
167 | | - | |
---|
168 | | - | |
---|
169 | | - | |
---|
170 | | - | @Callable(aa) |
---|
171 | | - | func emit (am) = if ((0 >= am)) |
---|
172 | | - | then $Tuple2(nil, nil) |
---|
173 | | - | else { |
---|
174 | | - | let an = A() |
---|
175 | | - | let F = C(an) |
---|
176 | | - | let ao = H(F) |
---|
177 | | - | let ap = I(F) |
---|
178 | | - | let aq = aa.caller |
---|
179 | | - | if (if ((aq != ao)) |
---|
180 | | - | then (aq != ap) |
---|
181 | | - | else false) |
---|
182 | | - | then throw("permissions denied") |
---|
183 | | - | else { |
---|
184 | | - | let aj = split(b(this, J()), a)[1] |
---|
185 | | - | let ar = fromBase58String(aj) |
---|
186 | | - | $Tuple2([ScriptTransfer(aq, am, ar)], [ar]) |
---|
187 | | - | } |
---|
188 | | - | } |
---|
189 | | - | |
---|
190 | | - | |
---|
191 | | - | |
---|
192 | | - | @Callable(aa) |
---|
193 | | - | func burn () = { |
---|
194 | | - | let an = A() |
---|
195 | | - | let F = C(an) |
---|
196 | | - | let as = E(F) |
---|
197 | | - | if ((size(aa.payments) != 1)) |
---|
198 | | - | then throw("exact one payment is allowed") |
---|
199 | | - | else { |
---|
200 | | - | let at = aa.payments[0] |
---|
201 | | - | let au = value(at.assetId) |
---|
202 | | - | let av = at.amount |
---|
203 | | - | let ar = fromBase58String(split(b(this, J()), a)[1]) |
---|
204 | | - | if ((au != ar)) |
---|
205 | | - | then throw("invalid wxAssetId is passed") |
---|
206 | | - | else if (!(containsElement([as, i, j, k], aa.caller))) |
---|
207 | | - | then throw("permissions denied") |
---|
208 | | - | else [Burn(au, av), StringEntry(("%s%s%s__history__burn__" + toBase58String(aa.transactionId)), makeString(["%d%d%d", toString(height), toString(lastBlock.timestamp), toString(av)], a))] |
---|
209 | | - | } |
---|
210 | | - | } |
---|
211 | | - | |
---|
212 | | - | |
---|
213 | | - | |
---|
214 | | - | @Callable(aa) |
---|
215 | | - | func setManager (aw) = { |
---|
216 | | - | let ak = Z(aa) |
---|
217 | | - | if ((ak == ak)) |
---|
218 | | - | then { |
---|
219 | | - | let ax = fromBase58String(aw) |
---|
220 | | - | if ((ax == ax)) |
---|
221 | | - | then [StringEntry(U(), aw)] |
---|
222 | | - | else throw("Strict value is not equal to itself.") |
---|
223 | | - | } |
---|
224 | | - | else throw("Strict value is not equal to itself.") |
---|
225 | | - | } |
---|
226 | | - | |
---|
227 | | - | |
---|
228 | | - | |
---|
229 | | - | @Callable(aa) |
---|
230 | | - | func confirmManager () = { |
---|
231 | | - | let ay = Y() |
---|
232 | | - | let az = if (isDefined(ay)) |
---|
233 | | - | then true |
---|
234 | | - | else throw("No pending manager") |
---|
235 | | - | if ((az == az)) |
---|
236 | | - | then { |
---|
237 | | - | let aA = if ((aa.callerPublicKey == value(ay))) |
---|
238 | | - | then true |
---|
239 | | - | else throw("You are not pending manager") |
---|
240 | | - | if ((aA == aA)) |
---|
241 | | - | then [StringEntry(T(), toBase58String(value(ay))), DeleteEntry(U())] |
---|
242 | | - | else throw("Strict value is not equal to itself.") |
---|
243 | | - | } |
---|
244 | | - | else throw("Strict value is not equal to itself.") |
---|
245 | | - | } |
---|
246 | | - | |
---|
247 | | - | |
---|
248 | | - | @Verifier(aB) |
---|
249 | | - | func aC () = { |
---|
250 | | - | let aD = { |
---|
251 | | - | let W = V() |
---|
252 | | - | if ($isInstanceOf(W, "ByteVector")) |
---|
253 | | - | then { |
---|
254 | | - | let ac = W |
---|
255 | | - | ac |
---|
256 | | - | } |
---|
257 | | - | else if ($isInstanceOf(W, "Unit")) |
---|
258 | | - | then aB.senderPublicKey |
---|
259 | | - | else throw("Match error") |
---|
260 | | - | } |
---|
261 | | - | sigVerify(aB.bodyBytes, aB.proofs[0], aD) |
---|
262 | | - | } |
---|
263 | | - | |
---|
| 1 | + | # no script |
---|