81 | | - | func J (K,L,M) = if ((K >= L)) |
---|
82 | | - | then (M >= K) |
---|
83 | | - | else false |
---|
84 | | - | |
---|
85 | | - | |
---|
86 | | - | func N (O,P) = ((O + d) + P) |
---|
87 | | - | |
---|
88 | | - | |
---|
89 | | - | func Q (R,S) = if ((R.issuer != this)) |
---|
90 | | - | then throw("Unknown issuer") |
---|
91 | | - | else { |
---|
92 | | - | let T = getStringValue(this, N(u, toBase58String(R.id))) |
---|
93 | | - | let U = if ((R.name == g)) |
---|
94 | | - | then (T == k) |
---|
95 | | - | else false |
---|
96 | | - | let V = if ((R.name == l)) |
---|
97 | | - | then (T == l) |
---|
98 | | - | else false |
---|
99 | | - | let W = S |
---|
100 | | - | if ($isInstanceOf(W, "String")) |
---|
101 | | - | then { |
---|
102 | | - | let X = W |
---|
103 | | - | if (if (if (U) |
---|
104 | | - | then (X == k) |
---|
105 | | - | else false) |
---|
106 | | - | then true |
---|
107 | | - | else if (V) |
---|
108 | | - | then (X == l) |
---|
109 | | - | else false) |
---|
110 | | - | then R |
---|
111 | | - | else throw("Unknown type") |
---|
112 | | - | } |
---|
113 | | - | else if (if (!(U)) |
---|
114 | | - | then !(V) |
---|
115 | | - | else false) |
---|
116 | | - | then throw("Unknown type") |
---|
117 | | - | else R |
---|
118 | | - | } |
---|
119 | | - | |
---|
120 | | - | |
---|
121 | | - | @Callable(Y) |
---|
122 | | - | func deposit () = valueOrElse(F(Y.caller), if (if ((size(Y.payments) != 1)) |
---|
123 | | - | then true |
---|
124 | | - | else !(J(Y.payments[0].amount, 1, f))) |
---|
125 | | - | then throw("Require one valid payment") |
---|
126 | | - | else { |
---|
127 | | - | let Z = { |
---|
128 | | - | let W = Y.payments[0].assetId |
---|
129 | | - | if ($isInstanceOf(W, "ByteVector")) |
---|
130 | | - | then { |
---|
131 | | - | let aa = W |
---|
132 | | - | toBase58String(valueOrErrorMessage(assetInfo(aa), "Unknown asset").id) |
---|
133 | | - | } |
---|
134 | | - | else if ($isInstanceOf(W, "Unit")) |
---|
135 | | - | then { |
---|
136 | | - | let ab = W |
---|
137 | | - | e |
---|
138 | | - | } |
---|
139 | | - | else throw("Unknown asset type") |
---|
140 | | - | } |
---|
141 | | - | let I = H() |
---|
142 | | - | let ac = toString(Y.caller) |
---|
143 | | - | let ad = makeString([b, g, "| Height:", toString(height), "| Signer:", ac, "| Asset ID:", Z, "| Amount:", toString(Y.payments[0].amount), "(includes decimals)"], " ") |
---|
144 | | - | let ae = Issue(g, ad, 1, 0, false, unit, I) |
---|
145 | | - | let af = calculateAssetId(ae) |
---|
146 | | - | let ag = toBase58String(af) |
---|
147 | | - | [IntegerEntry(o, I), ae, ScriptTransfer(Y.caller, 1, af), StringEntry(N(u, ag), k), IntegerEntry(N(v, ag), height), StringEntry(N(w, ag), ac), StringEntry(N(x, ag), Z), IntegerEntry(N(y, ag), Y.payments[0].amount)] |
---|
148 | | - | }) |
---|
149 | | - | |
---|
150 | | - | |
---|
151 | | - | |
---|
152 | | - | @Callable(Y) |
---|
153 | | - | func withdraw () = valueOrElse(F(Y.caller), if (if ((size(Y.payments) != 1)) |
---|
154 | | - | then true |
---|
155 | | - | else (Y.payments[0].amount != 1)) |
---|
156 | | - | then throw("Require one NFT payment") |
---|
157 | | - | else { |
---|
158 | | - | let ah = Q(valueOrErrorMessage(assetInfo(valueOrErrorMessage(Y.payments[0].assetId, "No Waves payment")), "Unknown asset"), k) |
---|
159 | | - | let af = toBase58String(ah.id) |
---|
160 | | - | let ai = getIntegerValue(this, N(v, af)) |
---|
161 | | - | let ac = getStringValue(this, N(w, af)) |
---|
162 | | - | let aj = getStringValue(this, N(x, af)) |
---|
163 | | - | let ak = getIntegerValue(this, N(y, af)) |
---|
164 | | - | let I = H() |
---|
165 | | - | let al = toString(Y.caller) |
---|
166 | | - | let am = makeString([b, h, "| Insurance Height:", toString(ai), "| Insurance Signer:", ac, "| Insurance ID:", af, "| Asset ID:", aj, "| Amount:", toString(ak), "(includes decimals)", "| Height:", toString(height), "| Signer:", al], " ") |
---|
167 | | - | let an = Issue(h, am, 1, 0, false, unit, I) |
---|
168 | | - | let ao = calculateAssetId(an) |
---|
169 | | - | let ag = toBase58String(ao) |
---|
170 | | - | let ap = { |
---|
171 | | - | let W = assetInfo(fromBase58String(aj)) |
---|
172 | | - | if ($isInstanceOf(W, "Asset")) |
---|
173 | | - | then { |
---|
174 | | - | let aa = W |
---|
175 | | - | ScriptTransfer(Y.caller, ak, aa.id) |
---|
176 | | - | } |
---|
177 | | - | else { |
---|
178 | | - | let aq = W |
---|
179 | | - | if ((aj == e)) |
---|
180 | | - | then ScriptTransfer(Y.caller, ak, unit) |
---|
181 | | - | else throw("Unknown asset") |
---|
182 | | - | } |
---|
183 | | - | } |
---|
184 | | - | [IntegerEntry(o, I), Burn(ah.id, 1), an, ScriptTransfer(Y.caller, 1, ao), ap, StringEntry(N(u, af), n), StringEntry(N(C, af), ag), StringEntry(N(u, ag), l), IntegerEntry(N(z, ag), ai), StringEntry(N(A, ag), ac), StringEntry(N(B, ag), af), StringEntry(N(x, ag), aj), IntegerEntry(N(y, ag), ak), IntegerEntry(N(v, ag), height), StringEntry(N(w, ag), al)] |
---|
185 | | - | }) |
---|
186 | | - | |
---|
187 | | - | |
---|
188 | | - | |
---|
189 | | - | @Callable(Y) |
---|
190 | | - | func claim (ar) = valueOrElse(F(Y.caller), if ((size(Y.payments) != 0)) |
---|
191 | | - | then throw("No need payment") |
---|
192 | | - | else { |
---|
193 | | - | let as = Q(valueOrErrorMessage(assetInfo(fromBase58String(ar)), "Unknown asset"), unit) |
---|
194 | | - | if ((assetBalance(this, as.id) != 1)) |
---|
195 | | - | then throw("Insuffisant balance") |
---|
196 | | - | else if ((toString(Y.caller) != getStringValue(this, N(w, ar)))) |
---|
197 | | - | then throw("Caller isn't last signer") |
---|
198 | | - | else [ScriptTransfer(Y.caller, 1, as.id)] |
---|
199 | | - | }) |
---|
200 | | - | |
---|
201 | | - | |
---|
202 | | - | |
---|
203 | | - | @Callable(Y) |
---|
204 | | - | func duplicate (at) = valueOrElse(F(Y.caller), if ((size(Y.payments) != 0)) |
---|
205 | | - | then throw("No need payment") |
---|
206 | | - | else { |
---|
207 | | - | let au = Q(valueOrErrorMessage(assetInfo(fromBase58String(at)), "Unknown asset"), unit) |
---|
208 | | - | let av = getStringValue(this, N(u, at)) |
---|
209 | | - | if ((assetBalance(Y.caller, au.id) != 1)) |
---|
210 | | - | then throw("Caller isn't owner") |
---|
211 | | - | else { |
---|
212 | | - | let I = H() |
---|
213 | | - | let aw = toString(Y.caller) |
---|
214 | | - | let ax = if ((av == k)) |
---|
215 | | - | then $Tuple2(i, makeString([b, i, "| Insurance ID:", at, "| Height:", toString(height), "| Duplicate Signer:", aw], " ")) |
---|
216 | | - | else $Tuple2(j, makeString([b, j, "| Receipt ID:", at, "| Height:", toString(height), "| Duplicate Signer:", aw], " ")) |
---|
217 | | - | let ay = ax._1 |
---|
218 | | - | let az = ax._2 |
---|
219 | | - | let aA = Issue(ay, az, 1, 0, false, unit, I) |
---|
220 | | - | let aB = calculateAssetId(aA) |
---|
221 | | - | let ag = toBase58String(aB) |
---|
222 | | - | [IntegerEntry(o, I), aA, ScriptTransfer(Y.caller, 1, aB), StringEntry(N(u, ag), m), IntegerEntry(N(v, ag), height), StringEntry(N(E, ag), av), StringEntry(N(D, ag), at), StringEntry(N(w, ag), aw)] |
---|
223 | | - | } |
---|
224 | | - | }) |
---|
225 | | - | |
---|
226 | | - | |
---|
227 | | - | |
---|
228 | | - | @Callable(Y) |
---|
229 | | - | func freedom (aC) = if (if ((this != Y.caller)) |
---|
230 | | - | then true |
---|
231 | | - | else valueOrElse(getBoolean(this, p), false)) |
---|
232 | | - | then throw("Access denied") |
---|
233 | | - | else [BooleanEntry(p, true), StringEntry(q, aC), IntegerEntry(r, a), StringEntry(t, b), IntegerEntry(s, height)] |
---|
234 | | - | |
---|
235 | | - | |
---|
236 | | - | @Verifier(aD) |
---|
237 | | - | func aE () = if (valueOrElse(getBoolean(this, p), false)) |
---|
238 | | - | then false |
---|
239 | | - | else { |
---|
240 | | - | let W = aD |
---|
241 | | - | if ($isInstanceOf(W, "SetScriptTransaction")) |
---|
242 | | - | then { |
---|
243 | | - | let aF = W |
---|
244 | | - | sigVerify(aD.bodyBytes, aD.proofs[0], aD.senderPublicKey) |
---|
245 | | - | } |
---|
246 | | - | else false |
---|
247 | | - | } |
---|
| 14 | + | @Verifier(d) |
---|
| 15 | + | func e () = sigVerify(d.bodyBytes, d.proofs[0], d.senderPublicKey) |
---|