4 | | - | let a = base58'Aa5tsh5uzQYAYpDYswmQko1c79PSYLrGbwRZ5sBViNx5' |
---|
5 | | - | |
---|
6 | | - | let b = Address(base58'3PPNhHYkkEy13gRWDCaruQyhNbX2GrjYSyV') |
---|
7 | | - | |
---|
8 | | - | let c = base58'Atqv59EYzjFGuitKVnMRk6H8FukjoV3ktPorbEys25on' |
---|
9 | | - | |
---|
10 | | - | let d = base58'Atqv59EYzjFGuitKVnMRk6H8FukjoV3ktPorbEys25on' |
---|
11 | | - | |
---|
12 | | - | let e = Address(base58'3PJL8Hn8LACaSBWLQ3UVhctA5cTQLBFwBAP') |
---|
13 | | - | |
---|
14 | | - | let f = Address(base58'3PH8NXNHpYR5gLn3cwtqnvmKVwQQWb7FrwY') |
---|
15 | | - | |
---|
16 | | - | @Callable(g) |
---|
17 | | - | func stakeLP () = { |
---|
18 | | - | let h = toString(g.caller) |
---|
19 | | - | let i = valueOrElse(getBoolean((h + "_whitelisted")), false) |
---|
20 | | - | let j = valueOrElse(getString((h + "_assetId")), "") |
---|
21 | | - | if (if (if (if (i) |
---|
22 | | - | then (size(g.payments) == 1) |
---|
23 | | - | else false) |
---|
24 | | - | then (g.payments[0].amount > 0) |
---|
25 | | - | else false) |
---|
26 | | - | then (g.payments[0].assetId == fromBase58String(j)) |
---|
27 | | - | else false) |
---|
28 | | - | then { |
---|
29 | | - | let k = invoke(b, "stake", nil, [AttachedPayment(g.payments[0].assetId, g.payments[0].amount)]) |
---|
30 | | - | if ((k == k)) |
---|
31 | | - | then { |
---|
32 | | - | let l = (valueOrElse(getInteger((((h + "_") + j) + "_balance")), 0) + g.payments[0].amount) |
---|
33 | | - | $Tuple2([IntegerEntry((((h + "_") + j) + "_balance"), l)], unit) |
---|
34 | | - | } |
---|
35 | | - | else throw("Strict value is not equal to itself.") |
---|
36 | | - | } |
---|
37 | | - | else throw("") |
---|
38 | | - | } |
---|
41 | | - | |
---|
42 | | - | @Callable(g) |
---|
43 | | - | func unstakeLP (m) = { |
---|
44 | | - | let h = toString(g.caller) |
---|
45 | | - | let i = valueOrElse(getBoolean((h + "_whitelisted")), false) |
---|
46 | | - | if (i) |
---|
47 | | - | then { |
---|
48 | | - | let j = valueOrElse(getString((h + "_assetId")), "") |
---|
49 | | - | let n = invoke(b, "unstake", [j, m], nil) |
---|
50 | | - | if ((n == n)) |
---|
51 | | - | then { |
---|
52 | | - | let l = (valueOrElse(getInteger((((h + "_") + j) + "_balance")), 0) - m) |
---|
53 | | - | $Tuple2([ScriptTransfer(g.caller, m, fromBase58String(j)), IntegerEntry((((h + "_") + j) + "_balance"), l)], unit) |
---|
54 | | - | } |
---|
55 | | - | else throw("Strict value is not equal to itself.") |
---|
56 | | - | } |
---|
57 | | - | else throw("") |
---|
58 | | - | } |
---|
| 6 | + | @Callable(a) |
---|
| 7 | + | func call () = $Tuple2([DeleteEntry("3PHi8kX9EqfvRwgzHWcpjLKQt1zBAH1bX7M_97zHFp1C3cB7qfvx8Xv5f2rWp9nUSG5UnAamfPcW6txf_balance"), DeleteEntry("3PHi8kX9EqfvRwgzHWcpjLKQt1zBAH1bX7M_assetId"), DeleteEntry("3PHi8kX9EqfvRwgzHWcpjLKQt1zBAH1bX7M_whitelisted"), DeleteEntry("fee"), DeleteEntry("it_all_started_in_this_block"), DeleteEntry("lock_duration"), DeleteEntry("total_locked_wx")], unit) |
---|
61 | | - | |
---|
62 | | - | @Callable(g) |
---|
63 | | - | func claim () = { |
---|
64 | | - | let h = toString(g.caller) |
---|
65 | | - | let i = valueOrElse(getBoolean((h + "_whitelisted")), false) |
---|
66 | | - | if (i) |
---|
67 | | - | then { |
---|
68 | | - | let j = valueOrElse(getString((h + "_assetId")), "") |
---|
69 | | - | let o = assetBalance(this, c) |
---|
70 | | - | if ((o == o)) |
---|
71 | | - | then { |
---|
72 | | - | let p = invoke(b, "claimWx", [j], nil) |
---|
73 | | - | if ((p == p)) |
---|
74 | | - | then { |
---|
75 | | - | let q = (assetBalance(this, c) - o) |
---|
76 | | - | if ((q == q)) |
---|
77 | | - | then { |
---|
78 | | - | let r = (valueOrElse(getInteger((j + "_total_claimed_wx")), 0) + q) |
---|
79 | | - | let s = (valueOrElse(getInteger(this, "total_claimed_wx"), 0) + q) |
---|
80 | | - | let t = getIntegerValue(this, "fee") |
---|
81 | | - | let u = fraction(q, t, 100) |
---|
82 | | - | let v = (valueOrElse(getInteger((j + "_total_collected_fee")), 0) + u) |
---|
83 | | - | let w = (valueOrElse(getInteger("total_collected_fee"), 0) + u) |
---|
84 | | - | $Tuple2([ScriptTransfer(g.caller, (q - u), c), ScriptTransfer(f, u, c), IntegerEntry((j + "_total_claimed_wx"), r), IntegerEntry("total_claimed_wx", s), IntegerEntry((j + "_total_collected_fee"), v), IntegerEntry("total_collected_fee", w)], unit) |
---|
85 | | - | } |
---|
86 | | - | else throw("Strict value is not equal to itself.") |
---|
87 | | - | } |
---|
88 | | - | else throw("Strict value is not equal to itself.") |
---|
89 | | - | } |
---|
90 | | - | else throw("Strict value is not equal to itself.") |
---|
91 | | - | } |
---|
92 | | - | else throw("") |
---|
93 | | - | } |
---|
94 | | - | |
---|
95 | | - | |
---|
96 | | - | |
---|
97 | | - | @Callable(g) |
---|
98 | | - | func whitelist (x,y) = if ((g.callerPublicKey == a)) |
---|
99 | | - | then $Tuple2([BooleanEntry((x + "_whitelisted"), true), StringEntry((x + "_assetId"), y)], unit) |
---|
100 | | - | else throw("") |
---|
101 | | - | |
---|
102 | | - | |
---|
103 | | - | |
---|
104 | | - | @Callable(g) |
---|
105 | | - | func setFee (u) = if ((g.callerPublicKey == a)) |
---|
106 | | - | then $Tuple2([IntegerEntry("fee", u)], unit) |
---|
107 | | - | else throw("") |
---|
108 | | - | |
---|
109 | | - | |
---|
110 | | - | |
---|
111 | | - | @Callable(g) |
---|
112 | | - | func giveaway () = { |
---|
113 | | - | let h = toString(g.caller) |
---|
114 | | - | let i = valueOrElse(getBoolean((h + "_whitelisted")), false) |
---|
115 | | - | if (if (if (if (i) |
---|
116 | | - | then (size(g.payments) == 1) |
---|
117 | | - | else false) |
---|
118 | | - | then (g.payments[0].assetId == d) |
---|
119 | | - | else false) |
---|
120 | | - | then (g.payments[0].amount > 0) |
---|
121 | | - | else false) |
---|
122 | | - | then { |
---|
123 | | - | let z = invoke(e, "increaseLock", [0], [AttachedPayment(d, g.payments[0].amount)]) |
---|
124 | | - | if ((z == z)) |
---|
125 | | - | then { |
---|
126 | | - | let A = (valueOrElse(getInteger("total_locked_wx"), 0) + g.payments[0].amount) |
---|
127 | | - | $Tuple2([IntegerEntry("total_locked_wx", A)], unit) |
---|
128 | | - | } |
---|
129 | | - | else throw("Strict value is not equal to itself.") |
---|
130 | | - | } |
---|
131 | | - | else throw("") |
---|
132 | | - | } |
---|
133 | | - | |
---|
134 | | - | |
---|
135 | | - | |
---|
136 | | - | @Callable(g) |
---|
137 | | - | func increaseLockDuration (B) = if ((g.callerPublicKey == a)) |
---|
138 | | - | then { |
---|
139 | | - | let C = invoke(e, "increaseLock", [B], nil) |
---|
140 | | - | if ((C == C)) |
---|
141 | | - | then { |
---|
142 | | - | let D = (valueOrElse(getInteger("lock_duration"), 0) + B) |
---|
143 | | - | $Tuple2([IntegerEntry("lock_duration", D)], unit) |
---|
144 | | - | } |
---|
145 | | - | else throw("Strict value is not equal to itself.") |
---|
146 | | - | } |
---|
147 | | - | else throw("") |
---|
148 | | - | |
---|
149 | | - | |
---|
150 | | - | |
---|
151 | | - | @Callable(g) |
---|
152 | | - | func forYou () = { |
---|
153 | | - | let E = { |
---|
154 | | - | let F = getInteger(this, "it_all_started_in_this_block") |
---|
155 | | - | if ($isInstanceOf(F, "Int")) |
---|
156 | | - | then { |
---|
157 | | - | let G = F |
---|
158 | | - | true |
---|
159 | | - | } |
---|
160 | | - | else if ($isInstanceOf(F, "Unit")) |
---|
161 | | - | then { |
---|
162 | | - | let H = F |
---|
163 | | - | false |
---|
164 | | - | } |
---|
165 | | - | else throw("Match error") |
---|
166 | | - | } |
---|
167 | | - | if (!(E)) |
---|
168 | | - | then { |
---|
169 | | - | let I = invoke(e, "lock", [2102400], [AttachedPayment(g.payments[0].assetId, g.payments[0].amount)]) |
---|
170 | | - | if ((I == I)) |
---|
171 | | - | then $Tuple2([IntegerEntry("it_all_started_in_this_block", height), IntegerEntry("total_locked_wx", g.payments[0].amount), IntegerEntry("lock_duration", 2102400), DeleteEntry("3PHi8kX9EqfvRwgzHWcpjLKQt1zBAH1bX7M_assetId"), DeleteEntry("3PHi8kX9EqfvRwgzHWcpjLKQt1zBAH1bX7M_whitelisted"), DeleteEntry("fee")], unit) |
---|
172 | | - | else throw("Strict value is not equal to itself.") |
---|
173 | | - | } |
---|
174 | | - | else throw("") |
---|
175 | | - | } |
---|
176 | | - | |
---|
177 | | - | |
---|
178 | | - | @Verifier(J) |
---|
179 | | - | func K () = sigVerify(J.bodyBytes, J.proofs[0], J.senderPublicKey) |
---|
| 10 | + | @Verifier(b) |
---|
| 11 | + | func c () = sigVerify(b.bodyBytes, b.proofs[0], b.senderPublicKey) |
---|