32 | | - | func i (j) = { |
---|
33 | | - | let f = j |
---|
34 | | - | if ($isInstanceOf(f, "ByteVector")) |
---|
35 | | - | then { |
---|
36 | | - | let g = f |
---|
37 | | - | toBase58String(g) |
---|
38 | | - | } |
---|
39 | | - | else "WAVES" |
---|
40 | | - | } |
---|
41 | | - | |
---|
42 | | - | |
---|
43 | | - | func k (l) = if ((l == "WAVES")) |
---|
44 | | - | then unit |
---|
45 | | - | else fromBase58String(l) |
---|
46 | | - | |
---|
47 | | - | |
---|
48 | | - | func m (n) = { |
---|
49 | | - | let o = d((("boosting_" + n) + "_lastHeight")) |
---|
50 | | - | let p = d((("boosting_" + n) + "_finishHeight")) |
---|
51 | | - | if (if ((o != 0)) |
---|
52 | | - | then (p > o) |
---|
53 | | - | else false) |
---|
54 | | - | then { |
---|
55 | | - | let q = (d((("boosting_" + n) + "_totalAmount")) / ((d((("boosting_" + n) + "_days")) * b) * c)) |
---|
56 | | - | let r = fraction((min([p, height]) - o), q, 1) |
---|
57 | | - | let s = h((("boosting_" + n) + "_poolId")) |
---|
58 | | - | let t = h((("pool_" + s) + "_boostings")) |
---|
59 | | - | let u = size(t) |
---|
60 | | - | let v = value(indexOf(t, n)) |
---|
61 | | - | let w = (take(t, (u - (u - v))) + takeRight(t, (u - (v + 1)))) |
---|
62 | | - | [IntegerEntry((("boosting_" + n) + "_lastHeight"), height), ScriptTransfer(addressFromStringValue(h((("boosting_" + n) + "_poolId"))), r, k(h((("boosting_" + n) + "_assetId")))), StringEntry("getFinishedPoolId", s), StringEntry("getPoolBoostings", t), IntegerEntry("findIndex", v), IntegerEntry("sizeStr", u), StringEntry("left string", take(t, (u - (u - v)))), StringEntry("right string", takeRight(t, (u - (v + 1)))), StringEntry((("pool_" + s) + "_boostings"), w)] |
---|
63 | | - | } |
---|
64 | | - | else nil |
---|
65 | | - | } |
---|
66 | | - | |
---|
67 | | - | |
---|
68 | | - | func x (n) = { |
---|
69 | | - | let o = d((("boosting_" + n) + "_lastHeight")) |
---|
70 | | - | let p = d((("boosting_" + n) + "_finishHeight")) |
---|
71 | | - | if ((o >= p)) |
---|
72 | | - | then [StringEntry((("list ended " + toString(height)) + " boostingIds"), ((h((("list ended " + toString(height)) + " boostingIds")) + n) + ","))] |
---|
73 | | - | else [StringEntry((("list ongoing boosts " + toString(height)) + " boostingIds"), ((h((("list ongoing boosts " + toString(height)) + " boostingIds")) + n) + ","))] |
---|
74 | | - | } |
---|
75 | | - | |
---|
76 | | - | |
---|
77 | | - | @Callable(y) |
---|
78 | | - | func addBoosting (z,A) = if ((1 > A)) |
---|
79 | | - | then throw("amount of days has to be between 1 and 365") |
---|
80 | | - | else if ((A > 365)) |
---|
81 | | - | then throw("amount of days has to be between 1 and 365") |
---|
82 | | - | else if (false) |
---|
83 | | - | then throw("under maintenance until further notice") |
---|
84 | | - | else { |
---|
85 | | - | let B = y.payments[0].amount |
---|
86 | | - | if ((1440 > (B / A))) |
---|
87 | | - | then throw((("boosting amount too small, minimum is " + toString((1440 * A))) + " of the smallest unit of payment asset")) |
---|
88 | | - | else { |
---|
89 | | - | let j = i(y.payments[0].assetId) |
---|
90 | | - | if ((height == d("height"))) |
---|
91 | | - | then throw("wait 1 minute") |
---|
92 | | - | else { |
---|
93 | | - | let C = if ((size(h((("pool_" + z) + "_boostings"))) > 11)) |
---|
94 | | - | then throw("max 5 boosts per pool") |
---|
95 | | - | else invoke(this, "entryEnded", nil, nil) |
---|
96 | | - | if ((C == C)) |
---|
97 | | - | then { |
---|
98 | | - | let n = if ((size((("list ongoing boosts " + toString(height)) + " boostingIds")) > 112)) |
---|
99 | | - | then throw("wait till other boosts are finished") |
---|
100 | | - | else take(h((("list ended " + toString(height)) + " boostingIds")), 1) |
---|
101 | | - | if ((addressFromString(z) == unit)) |
---|
102 | | - | then throw("incorrect pool address") |
---|
103 | | - | else [IntegerEntry((("boosting_" + n) + "_days"), A), IntegerEntry((("boosting_" + n) + "_totalAmount"), B), IntegerEntry((("boosting_" + n) + "_dailyAmount"), (B / A)), IntegerEntry((("boosting_" + n) + "_startHeight"), height), IntegerEntry((("boosting_" + n) + "_finishHeight"), (height + ((A * b) * c))), IntegerEntry((("boosting_" + n) + "_finishTimestamp"), (lastBlock.timestamp + ((((A * b) * c) * 60) * 1000))), IntegerEntry((("boosting_" + n) + "_lastHeight"), height), StringEntry((("boosting_" + n) + "_assetId"), j), StringEntry((("boosting_" + n) + "_owner"), toString(y.caller)), StringEntry((("boosting_" + n) + "_poolId"), z), StringEntry((("pool_" + z) + "_boostings"), ((h((("pool_" + z) + "_boostings")) + n) + ","))] |
---|
104 | | - | } |
---|
105 | | - | else throw("Strict value is not equal to itself.") |
---|
106 | | - | } |
---|
107 | | - | } |
---|
108 | | - | } |
---|
109 | | - | |
---|
110 | | - | |
---|
111 | | - | |
---|
112 | | - | @Callable(y) |
---|
113 | | - | func payBoosting (n) = m(n) |
---|
114 | | - | |
---|
115 | | - | |
---|
116 | | - | |
---|
117 | | - | @Callable(y) |
---|
118 | | - | func payBoostings () = { |
---|
119 | | - | func D (E,F) = { |
---|
120 | | - | let G = invoke(this, "payBoosting", [F], nil) |
---|
121 | | - | if ((G == G)) |
---|
122 | | - | then G |
---|
123 | | - | else throw("Strict value is not equal to itself.") |
---|
124 | | - | } |
---|
125 | | - | |
---|
126 | | - | let H = { |
---|
127 | | - | let I = a |
---|
128 | | - | let J = size(I) |
---|
129 | | - | let K = 0 |
---|
130 | | - | func L (M,N) = if ((N >= J)) |
---|
131 | | - | then M |
---|
132 | | - | else D(M, I[N]) |
---|
133 | | - | |
---|
134 | | - | func O (M,N) = if ((N >= J)) |
---|
135 | | - | then M |
---|
136 | | - | else throw("List size exceeds 56") |
---|
137 | | - | |
---|
138 | | - | O(L(L(L(L(L(L(L(L(L(L(L(L(L(L(L(L(L(L(L(L(L(L(L(L(L(L(L(L(L(L(L(L(L(L(L(L(L(L(L(L(L(L(L(L(L(L(L(L(L(L(L(L(L(L(L(L(K, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20), 21), 22), 23), 24), 25), 26), 27), 28), 29), 30), 31), 32), 33), 34), 35), 36), 37), 38), 39), 40), 41), 42), 43), 44), 45), 46), 47), 48), 49), 50), 51), 52), 53), 54), 55), 56) |
---|
139 | | - | } |
---|
140 | | - | if ((H == H)) |
---|
141 | | - | then nil |
---|
142 | | - | else throw("Strict value is not equal to itself.") |
---|
143 | | - | } |
---|
144 | | - | |
---|
145 | | - | |
---|
146 | | - | |
---|
147 | | - | @Callable(y) |
---|
148 | | - | func endedBoostings (n) = x(n) |
---|
149 | | - | |
---|
150 | | - | |
---|
151 | | - | |
---|
152 | | - | @Callable(y) |
---|
153 | | - | func entryEnded () = { |
---|
154 | | - | func D (E,F) = { |
---|
155 | | - | let G = invoke(this, "endedBoostings", [F], nil) |
---|
156 | | - | if ((G == G)) |
---|
157 | | - | then G |
---|
158 | | - | else throw("Strict value is not equal to itself.") |
---|
159 | | - | } |
---|
160 | | - | |
---|
161 | | - | let P = { |
---|
162 | | - | let I = a |
---|
163 | | - | let J = size(I) |
---|
164 | | - | let K = 0 |
---|
165 | | - | func L (M,N) = if ((N >= J)) |
---|
166 | | - | then M |
---|
167 | | - | else D(M, I[N]) |
---|
168 | | - | |
---|
169 | | - | func O (M,N) = if ((N >= J)) |
---|
170 | | - | then M |
---|
171 | | - | else throw("List size exceeds 56") |
---|
172 | | - | |
---|
173 | | - | O(L(L(L(L(L(L(L(L(L(L(L(L(L(L(L(L(L(L(L(L(L(L(L(L(L(L(L(L(L(L(L(L(L(L(L(L(L(L(L(L(L(L(L(L(L(L(L(L(L(L(L(L(L(L(L(L(K, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20), 21), 22), 23), 24), 25), 26), 27), 28), 29), 30), 31), 32), 33), 34), 35), 36), 37), 38), 39), 40), 41), 42), 43), 44), 45), 46), 47), 48), 49), 50), 51), 52), 53), 54), 55), 56) |
---|
174 | | - | } |
---|
175 | | - | if ((P == P)) |
---|
176 | | - | then [IntegerEntry("height", height)] |
---|
177 | | - | else throw("Strict value is not equal to itself.") |
---|
178 | | - | } |
---|
179 | | - | |
---|
180 | | - | |
---|
181 | | - | |
---|
182 | | - | @Callable(y) |
---|
183 | | - | func deleteEntr (z) = [DeleteEntry((("pool_" + z) + "_boostings"))] |
---|
184 | | - | |
---|
185 | | - | |
---|
186 | | - | |
---|
187 | | - | @Callable(y) |
---|
188 | | - | func checkStr (n) = { |
---|
189 | | - | let Q = h((("boosting_" + n) + "_poolId")) |
---|
190 | | - | let t = h((("pool_" + Q) + "_boostings")) |
---|
191 | | - | let u = size(t) |
---|
192 | | - | if ((indexOf(t, n) == unit)) |
---|
193 | | - | then nil |
---|
194 | | - | else { |
---|
195 | | - | let v = value(indexOf(t, n)) |
---|
196 | | - | let w = (take(t, (u - (u - v))) + takeRight(t, (u - (v + 1)))) |
---|
197 | | - | [StringEntry("getFinishedPoolId", Q), StringEntry("getPoolBoostings", t), IntegerEntry("findIndex", v), IntegerEntry("sizeStr", u), StringEntry("left string", take(t, (u - (u - v)))), StringEntry("right string", takeRight(t, (u - (v + 2)))), StringEntry((("pool_" + Q) + "_boostings"), w)] |
---|
198 | | - | } |
---|
199 | | - | } |
---|
| 26 | + | @Callable(f) |
---|
| 27 | + | func register () = [IntegerEntry("Amount Registered", (a("Amount Registered") + 1)), StringEntry(("Register address" + toString((a("Amount Registered") + 1))), toString(f.caller)), StringEntry((toString(f.caller) + "Address registered"), toString(f.caller))] |
---|