6 | | - | @Callable(a) |
---|
7 | | - | func sponsorDeposit (b,c,d) = { |
---|
8 | | - | let e = toString(d) |
---|
9 | | - | let f = toString(b) |
---|
10 | | - | let g = extract(a.payment) |
---|
11 | | - | let h = g.assetId |
---|
12 | | - | let i = toBase58String(a.caller.bytes) |
---|
13 | | - | let j = { |
---|
14 | | - | let k = getInteger(this, (((e + c) + f) + i)) |
---|
15 | | - | if ($isInstanceOf(k, "Int")) |
---|
16 | | - | then { |
---|
17 | | - | let l = k |
---|
18 | | - | l |
---|
19 | | - | } |
---|
20 | | - | else 0 |
---|
21 | | - | } |
---|
22 | | - | let m = (j + g.amount) |
---|
23 | | - | WriteSet([DataEntry((((e + c) + f) + i), m), DataEntry((((e + f) + c) + i), b)]) |
---|
| 8 | + | @Callable(c) |
---|
| 9 | + | func issueAsset (d,e,f,g,h) = { |
---|
| 10 | + | let i = c.payments[0] |
---|
| 11 | + | if ((i.assetId != a)) |
---|
| 12 | + | then throw("works with PAR7 only") |
---|
| 13 | + | else { |
---|
| 14 | + | let j = (i.amount * b) |
---|
| 15 | + | let k = Issue(d, e, f, g, h) |
---|
| 16 | + | let l = calculateAssetId(k) |
---|
| 17 | + | [k, ScriptTransfer(c.caller, k.quantity, l)] |
---|
| 18 | + | } |
---|
27 | | - | |
---|
28 | | - | @Callable(a) |
---|
29 | | - | func sponsorWithdraw (n,c,d,o,p,q) = { |
---|
30 | | - | let b = toString(n) |
---|
31 | | - | let e = toString(d) |
---|
32 | | - | let r = fromBase58String(p) |
---|
33 | | - | let i = toBase58String(a.caller.bytes) |
---|
34 | | - | let f = { |
---|
35 | | - | let k = getInteger(this, (((e + b) + c) + i)) |
---|
36 | | - | if ($isInstanceOf(k, "Int")) |
---|
37 | | - | then { |
---|
38 | | - | let l = k |
---|
39 | | - | l |
---|
40 | | - | } |
---|
41 | | - | else 0 |
---|
42 | | - | } |
---|
43 | | - | let j = { |
---|
44 | | - | let k = getInteger(this, (((e + c) + b) + i)) |
---|
45 | | - | if ($isInstanceOf(k, "Int")) |
---|
46 | | - | then { |
---|
47 | | - | let l = k |
---|
48 | | - | l |
---|
49 | | - | } |
---|
50 | | - | else 0 |
---|
51 | | - | } |
---|
52 | | - | let m = (j - o) |
---|
53 | | - | if ((q > n)) |
---|
54 | | - | then throw("Can't withdraw compe start") |
---|
55 | | - | else if ((0 > o)) |
---|
56 | | - | then throw("Can't withdraw negative amount") |
---|
57 | | - | else if ((0 > m)) |
---|
58 | | - | then throw("Not enough balance") |
---|
59 | | - | else if ((p == "WAVES")) |
---|
60 | | - | then ScriptResult(WriteSet([DataEntry((((e + c) + b) + i), m)]), TransferSet([ScriptTransfer(a.caller, o, unit)])) |
---|
61 | | - | else ScriptResult(WriteSet([DataEntry((((e + c) + b) + i), m)]), TransferSet([ScriptTransfer(a.caller, o, r)])) |
---|
62 | | - | } |
---|
63 | | - | |
---|
64 | | - | |
---|
65 | | - | |
---|
66 | | - | @Callable(a) |
---|
67 | | - | func paymentDeposit (s,t,u) = { |
---|
68 | | - | let v = toString(t) |
---|
69 | | - | let g = extract(a.payment) |
---|
70 | | - | let w = g.assetId |
---|
71 | | - | let i = toBase58String(a.caller.bytes) |
---|
72 | | - | let j = { |
---|
73 | | - | let k = getInteger(this, (((("pd_" + u) + s) + v) + i)) |
---|
74 | | - | if ($isInstanceOf(k, "Int")) |
---|
75 | | - | then { |
---|
76 | | - | let l = k |
---|
77 | | - | l |
---|
78 | | - | } |
---|
79 | | - | else 0 |
---|
80 | | - | } |
---|
81 | | - | let m = (j + g.amount) |
---|
82 | | - | WriteSet([DataEntry((((("pd_" + u) + s) + v) + i), m), DataEntry((((("pw_" + u) + s) + v) + i), true), DataEntry((((("cw_" + u) + s) + v) + i), false)]) |
---|
83 | | - | } |
---|
84 | | - | |
---|
85 | | - | |
---|
86 | | - | |
---|
87 | | - | @Callable(a) |
---|
88 | | - | func paymentWithdraw (s,t,u,x,o) = { |
---|
89 | | - | let v = toString(t) |
---|
90 | | - | let r = fromBase58String(x) |
---|
91 | | - | let i = toBase58String(a.caller.bytes) |
---|
92 | | - | let y = { |
---|
93 | | - | let k = getBoolean(this, (((("pw_" + u) + s) + v) + i)) |
---|
94 | | - | if ($isInstanceOf(k, "Boolean")) |
---|
95 | | - | then { |
---|
96 | | - | let l = k |
---|
97 | | - | l |
---|
98 | | - | } |
---|
99 | | - | else 0 |
---|
100 | | - | } |
---|
101 | | - | let j = { |
---|
102 | | - | let k = getInteger(this, (((("pd_" + u) + s) + v) + i)) |
---|
103 | | - | if ($isInstanceOf(k, "Int")) |
---|
104 | | - | then { |
---|
105 | | - | let l = k |
---|
106 | | - | l |
---|
107 | | - | } |
---|
108 | | - | else 0 |
---|
109 | | - | } |
---|
110 | | - | let m = (j - o) |
---|
111 | | - | if ((y == false)) |
---|
112 | | - | then throw("Can't withdraw") |
---|
113 | | - | else if ((0 > o)) |
---|
114 | | - | then throw("Can't withdraw negative amount") |
---|
115 | | - | else if ((0 > m)) |
---|
116 | | - | then throw("Not enough balance") |
---|
117 | | - | else if ((x == "WAVES")) |
---|
118 | | - | then ScriptResult(WriteSet([DataEntry((((("pd_" + u) + s) + v) + i), m)]), TransferSet([ScriptTransfer(a.caller, o, unit)])) |
---|
119 | | - | else ScriptResult(WriteSet([DataEntry((((("pd_" + u) + s) + v) + i), m)]), TransferSet([ScriptTransfer(a.caller, o, r)])) |
---|
120 | | - | } |
---|
121 | | - | |
---|
122 | | - | |
---|
123 | | - | |
---|
124 | | - | @Callable(a) |
---|
125 | | - | func golferAuth (s,t,u) = { |
---|
126 | | - | let v = toString(t) |
---|
127 | | - | let i = toBase58String(a.caller.bytes) |
---|
128 | | - | WriteSet([DataEntry((((("pw_" + u) + s) + v) + i), false)]) |
---|
129 | | - | } |
---|
130 | | - | |
---|
131 | | - | |
---|
132 | | - | |
---|
133 | | - | @Callable(a) |
---|
134 | | - | func courseAuth (z,t,u) = { |
---|
135 | | - | let v = toString(t) |
---|
136 | | - | let i = toBase58String(a.caller.bytes) |
---|
137 | | - | WriteSet([DataEntry((((("cw_" + u) + i) + v) + z), true)]) |
---|
138 | | - | } |
---|
139 | | - | |
---|
140 | | - | |
---|
141 | | - | |
---|
142 | | - | @Callable(a) |
---|
143 | | - | func courseWithdraw (z,t,u,x,o) = { |
---|
144 | | - | let v = toString(t) |
---|
145 | | - | let r = fromBase58String(x) |
---|
146 | | - | let i = toBase58String(a.caller.bytes) |
---|
147 | | - | let y = { |
---|
148 | | - | let k = getBoolean(this, (((("pw_" + u) + i) + v) + z)) |
---|
149 | | - | if ($isInstanceOf(k, "Boolean")) |
---|
150 | | - | then { |
---|
151 | | - | let l = k |
---|
152 | | - | l |
---|
153 | | - | } |
---|
154 | | - | else 0 |
---|
155 | | - | } |
---|
156 | | - | let A = { |
---|
157 | | - | let k = getBoolean(this, (((("cw_" + u) + i) + v) + z)) |
---|
158 | | - | if ($isInstanceOf(k, "Boolean")) |
---|
159 | | - | then { |
---|
160 | | - | let l = k |
---|
161 | | - | l |
---|
162 | | - | } |
---|
163 | | - | else 0 |
---|
164 | | - | } |
---|
165 | | - | let j = { |
---|
166 | | - | let k = getInteger(this, (((("pd_" + u) + i) + v) + z)) |
---|
167 | | - | if ($isInstanceOf(k, "Int")) |
---|
168 | | - | then { |
---|
169 | | - | let l = k |
---|
170 | | - | l |
---|
171 | | - | } |
---|
172 | | - | else 0 |
---|
173 | | - | } |
---|
174 | | - | let m = (j - o) |
---|
175 | | - | if ((y == true)) |
---|
176 | | - | then throw("Can't golfer auth") |
---|
177 | | - | else if ((A == false)) |
---|
178 | | - | then throw("Can't golfcourse auth") |
---|
179 | | - | else if ((0 > o)) |
---|
180 | | - | then throw("Can't withdraw negative amount") |
---|
181 | | - | else if ((0 > m)) |
---|
182 | | - | then throw("Not enough balance") |
---|
183 | | - | else if ((x == "WAVES")) |
---|
184 | | - | then ScriptResult(WriteSet([DataEntry((((("pd_" + u) + i) + v) + z), m)]), TransferSet([ScriptTransfer(a.caller, o, unit)])) |
---|
185 | | - | else ScriptResult(WriteSet([DataEntry((((("pd_" + u) + i) + v) + z), m)]), TransferSet([ScriptTransfer(a.caller, o, r)])) |
---|
186 | | - | } |
---|
187 | | - | |
---|
188 | | - | |
---|
189 | | - | @Verifier(B) |
---|
190 | | - | func C () = { |
---|
191 | | - | let k = B |
---|
192 | | - | if ($isInstanceOf(k, "TransferTransaction")) |
---|
193 | | - | then { |
---|
194 | | - | let D = k |
---|
195 | | - | sigVerify(D.bodyBytes, D.proofs[0], D.senderPublicKey) |
---|
196 | | - | } |
---|
197 | | - | else if ($isInstanceOf(k, "SetScriptTransaction")) |
---|
198 | | - | then { |
---|
199 | | - | let E = k |
---|
200 | | - | sigVerify(E.bodyBytes, E.proofs[0], E.senderPublicKey) |
---|
201 | | - | } |
---|
202 | | - | else true |
---|
203 | | - | } |
---|
| 22 | + | @Verifier(m) |
---|
| 23 | + | func n () = sigVerify(m.bodyBytes, m.proofs[0], m.senderPublicKey) |
---|