1 | | - | {-# STDLIB_VERSION 7 #-} |
---|
2 | | - | {-# SCRIPT_TYPE ACCOUNT #-} |
---|
3 | | - | {-# CONTENT_TYPE DAPP #-} |
---|
4 | | - | let a = "__" |
---|
5 | | - | |
---|
6 | | - | let b = "WAVES" |
---|
7 | | - | |
---|
8 | | - | let c = "meme_im_factory.ride" |
---|
9 | | - | |
---|
10 | | - | let d = "%s__shutdown" |
---|
11 | | - | |
---|
12 | | - | let e = valueOrElse(getBoolean(d), false) |
---|
13 | | - | |
---|
14 | | - | func f (g) = ((c + ": ") + g) |
---|
15 | | - | |
---|
16 | | - | |
---|
17 | | - | func h (g) = throw(f(g)) |
---|
18 | | - | |
---|
19 | | - | |
---|
20 | | - | func i (j) = isDefined(addressFromString(j)) |
---|
21 | | - | |
---|
22 | | - | |
---|
23 | | - | let k = "calculator__address" |
---|
24 | | - | |
---|
25 | | - | let l = { |
---|
26 | | - | let m = getString(this, k) |
---|
27 | | - | if ($isInstanceOf(m, "String")) |
---|
28 | | - | then { |
---|
29 | | - | let g = m |
---|
30 | | - | addressFromString(g) |
---|
31 | | - | } |
---|
32 | | - | else if ($isInstanceOf(m, "Unit")) |
---|
33 | | - | then unit |
---|
34 | | - | else throw("Match error") |
---|
35 | | - | } |
---|
36 | | - | |
---|
37 | | - | let n = valueOrErrorMessage(l, f("invalid calculator address")) |
---|
38 | | - | |
---|
39 | | - | func o (p,j) = if ((p.caller == j)) |
---|
40 | | - | then true |
---|
41 | | - | else h("permission denied") |
---|
42 | | - | |
---|
43 | | - | |
---|
44 | | - | func q (p) = o(p, this) |
---|
45 | | - | |
---|
46 | | - | |
---|
47 | | - | func r (p) = o(p, n) |
---|
48 | | - | |
---|
49 | | - | |
---|
50 | | - | func s (t) = if ((t == b)) |
---|
51 | | - | then unit |
---|
52 | | - | else fromBase58String(t) |
---|
53 | | - | |
---|
54 | | - | |
---|
55 | | - | func u (t) = if ((t == unit)) |
---|
56 | | - | then b |
---|
57 | | - | else toBase58String(value(t)) |
---|
58 | | - | |
---|
59 | | - | |
---|
60 | | - | @Callable(p) |
---|
61 | | - | func init (v) = { |
---|
62 | | - | let w = q(p) |
---|
63 | | - | if ((w == w)) |
---|
64 | | - | then $Tuple2([StringEntry(k, v)], unit) |
---|
65 | | - | else throw("Strict value is not equal to itself.") |
---|
66 | | - | } |
---|
67 | | - | |
---|
68 | | - | |
---|
69 | | - | |
---|
70 | | - | @Callable(p) |
---|
71 | | - | func stringEntry (x,y) = if (if (!(e)) |
---|
72 | | - | then r(p) |
---|
73 | | - | else false) |
---|
74 | | - | then $Tuple2([StringEntry(x, y)], x) |
---|
75 | | - | else h("not allowed") |
---|
76 | | - | |
---|
77 | | - | |
---|
78 | | - | |
---|
79 | | - | @Callable(p) |
---|
80 | | - | func integerEntry (x,y) = if (if (!(e)) |
---|
81 | | - | then r(p) |
---|
82 | | - | else false) |
---|
83 | | - | then $Tuple2([IntegerEntry(x, y)], x) |
---|
84 | | - | else h("not allowed") |
---|
85 | | - | |
---|
86 | | - | |
---|
87 | | - | |
---|
88 | | - | @Callable(p) |
---|
89 | | - | func booleanEntry (x,y) = if (if (!(e)) |
---|
90 | | - | then r(p) |
---|
91 | | - | else false) |
---|
92 | | - | then $Tuple2([BooleanEntry(x, y)], x) |
---|
93 | | - | else h("not allowed") |
---|
94 | | - | |
---|
95 | | - | |
---|
96 | | - | |
---|
97 | | - | @Callable(p) |
---|
98 | | - | func binaryEntry (x,y) = if (if (!(e)) |
---|
99 | | - | then r(p) |
---|
100 | | - | else false) |
---|
101 | | - | then $Tuple2([BinaryEntry(x, y)], x) |
---|
102 | | - | else h("not allowed") |
---|
103 | | - | |
---|
104 | | - | |
---|
105 | | - | |
---|
106 | | - | @Callable(p) |
---|
107 | | - | func deleteEntry (x) = if (if (!(e)) |
---|
108 | | - | then r(p) |
---|
109 | | - | else false) |
---|
110 | | - | then $Tuple2([DeleteEntry(x)], x) |
---|
111 | | - | else h("not allowed") |
---|
112 | | - | |
---|
113 | | - | |
---|
114 | | - | |
---|
115 | | - | @Callable(p) |
---|
116 | | - | func reissue (z,A,B) = if (if (!(e)) |
---|
117 | | - | then r(p) |
---|
118 | | - | else false) |
---|
119 | | - | then $Tuple2([Reissue(z, A, B)], A) |
---|
120 | | - | else h("not allowed") |
---|
121 | | - | |
---|
122 | | - | |
---|
123 | | - | |
---|
124 | | - | @Callable(p) |
---|
125 | | - | func burn (z,A) = if (if (!(e)) |
---|
126 | | - | then r(p) |
---|
127 | | - | else false) |
---|
128 | | - | then $Tuple2([Burn(z, A)], A) |
---|
129 | | - | else h("not allowed") |
---|
130 | | - | |
---|
131 | | - | |
---|
132 | | - | |
---|
133 | | - | @Callable(p) |
---|
134 | | - | func transferAsset (C,A,z) = if (if (!(e)) |
---|
135 | | - | then r(p) |
---|
136 | | - | else false) |
---|
137 | | - | then $Tuple2([ScriptTransfer(Address(C), A, z)], A) |
---|
138 | | - | else h("not allowed") |
---|
139 | | - | |
---|
140 | | - | |
---|
141 | | - | |
---|
142 | | - | @Callable(p) |
---|
143 | | - | func transferAssets (C,D,E) = if (if (!(e)) |
---|
144 | | - | then r(p) |
---|
145 | | - | else false) |
---|
146 | | - | then { |
---|
147 | | - | func F (G,H) = { |
---|
148 | | - | let I = G |
---|
149 | | - | let J = I._1 |
---|
150 | | - | let K = I._2 |
---|
151 | | - | let L = ScriptTransfer(Address(C), E[K], D[K]) |
---|
152 | | - | let M = (J :+ L) |
---|
153 | | - | $Tuple2(M, (K + 1)) |
---|
154 | | - | } |
---|
155 | | - | |
---|
156 | | - | let N = { |
---|
157 | | - | let O = D |
---|
158 | | - | let P = size(O) |
---|
159 | | - | let Q = $Tuple2(nil, 0) |
---|
160 | | - | func R (S,T) = if ((T >= P)) |
---|
161 | | - | then S |
---|
162 | | - | else F(S, O[T]) |
---|
163 | | - | |
---|
164 | | - | func U (S,T) = if ((T >= P)) |
---|
165 | | - | then S |
---|
166 | | - | else throw("List size exceeds 10") |
---|
167 | | - | |
---|
168 | | - | U(R(R(R(R(R(R(R(R(R(R(Q, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10) |
---|
169 | | - | } |
---|
170 | | - | let V = N._1 |
---|
171 | | - | let W = N._2 |
---|
172 | | - | $Tuple2(V, unit) |
---|
173 | | - | } |
---|
174 | | - | else h("not allowed") |
---|
175 | | - | |
---|
176 | | - | |
---|
177 | | - | |
---|
178 | | - | @Callable(p) |
---|
179 | | - | func transferWaves (C,A) = if (if (!(e)) |
---|
180 | | - | then r(p) |
---|
181 | | - | else false) |
---|
182 | | - | then $Tuple2([ScriptTransfer(Address(C), A, unit)], A) |
---|
183 | | - | else h("not allowed") |
---|
184 | | - | |
---|
185 | | - | |
---|
186 | | - | |
---|
187 | | - | @Callable(p) |
---|
188 | | - | func call (X,Y) = { |
---|
189 | | - | let Z = if ((p.callerPublicKey == base58'11111111111111111111111111111111')) |
---|
190 | | - | then nil |
---|
191 | | - | else p.payments |
---|
192 | | - | let aa = reentrantInvoke(n, X, [p.callerPublicKey, Y], Z) |
---|
193 | | - | $Tuple2(nil, aa) |
---|
194 | | - | } |
---|
195 | | - | |
---|
196 | | - | |
---|
| 1 | + | # no script |
---|