tx · 2HNTzCbMmBfoSiWQfwFCkXqjKv7sR1rnmvE4dt6WbtMZ 3MpMuGN8rW9EpPwzETAQz88Pe9TQhSwiriq: -0.01600000 Waves 2023.07.31 18:08 [2690211] smart account 3MpMuGN8rW9EpPwzETAQz88Pe9TQhSwiriq > SELF 0.00000000 Waves
{ "type": 13, "id": "2HNTzCbMmBfoSiWQfwFCkXqjKv7sR1rnmvE4dt6WbtMZ", "fee": 1600000, "feeAssetId": null, "timestamp": 1690816088224, "version": 2, "chainId": 84, "sender": "3MpMuGN8rW9EpPwzETAQz88Pe9TQhSwiriq", "senderPublicKey": "57SkjQUEwC1ayCqLbXLuzBqifK6B6SR6rfxtGsbAo3zW", "proofs": [ "4RGPLbu8u9T3JvkgkgoZtdQvZwRjnReZ3Pbko87CiqbeJuNYFYoZCToS5xQQgQyBh3wcLDnStnLVi1wtvcFKosax" ], "script": "base64:BgIkCAISAwoBARIDCgEBEgASAwoBCBIDCgEBEgMKAQgSABIDCgEIMgAMY29udHJhY3RGaWxlAhFsMm1wX3N0YWtpbmcucmlkZQADU0VQAgJfXwAGc2NhbGU4AIDC1y8AB3NjYWxlMTgAgICQu7rWrfANAA1zY2FsZTE4QmlnSW50CQC2AgEFB3NjYWxlMTgAEkFERFJFU1NfQllURVNfU0laRQAaAA1CTE9DS1NfSU5fREFZAKALAQh0aHJvd0VycgEDbXNnCQACAQkArAICCQCsAgIFDGNvbnRyYWN0RmlsZQICOiAFA21zZwAKa2V5QXNzZXRJZAkAuQkCCQDMCAICAiVzCQDMCAICB2Fzc2V0SWQFA25pbAUDU0VQABNrZXlFbWlzc2lvblBlckJsb2NrCQC5CQIJAMwIAgICJXMJAMwIAgIQZW1pc3Npb25QZXJCbG9jawUDbmlsBQNTRVAAGWtleUVtaXNzaW9uUGVyaW9kSW5CbG9ja3MJALkJAgkAzAgCAgIlcwkAzAgCAhZlbWlzc2lvblBlcmlvZEluQmxvY2tzBQNuaWwFA1NFUAANa2V5U3RhcnRCbG9jawkAu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Jvb2ZzAAAIBQJ0eA9zZW5kZXJQdWJsaWNLZXkDBQhieUFkbWlucwYFB2J5T3duZXL43dw2", "height": 2690211, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: BD2pjjSvvBKXnBRmASh3Fm8Z3w8SYor5yjN4cshkV7gB Next: none Diff:
Old | New | Differences | |
---|---|---|---|
42 | 42 | func keyHistory (type,userAddress,txId) = makeString(["%s%s%s", type, userAddress, toBase58String(txId)], SEP) | |
43 | 43 | ||
44 | 44 | ||
45 | - | func formatHistory (totalProfit,price,totalAssetAmount,totalLpAmount) = makeString(["%d%d", toString(totalProfit), toString(price), toString(totalAssetAmount), toString(totalLpAmount)], SEP) | |
45 | + | func formatHistory (totalProfit,price,totalAssetAmount,totalLpAmount) = makeString(["%d%d%d%d", toString(totalProfit), toString(price), toString(totalAssetAmount), toString(totalLpAmount)], SEP) | |
46 | 46 | ||
47 | 47 | ||
48 | 48 | let totalLpAmount = valueOrElse(getInteger(this, keyTotalLpAmount), 0) | |
95 | 95 | ||
96 | 96 | ||
97 | 97 | func genVotesKeysHelper (a,adminAddress) = { | |
98 | - | let $ | |
99 | - | let result = $ | |
100 | - | let prefix = $ | |
98 | + | let $t030493073 = a | |
99 | + | let result = $t030493073._1 | |
100 | + | let prefix = $t030493073._2 | |
101 | 101 | $Tuple2((result :+ keyFullAdminVote(prefix, adminAddress)), prefix) | |
102 | 102 | } | |
103 | 103 | ||
104 | 104 | ||
105 | 105 | func genVotesKeys (keyPrefix) = { | |
106 | 106 | let adminList = keyAdminAddressList() | |
107 | - | let $ | |
107 | + | let $t032203304 = { | |
108 | 108 | let $l = getAdminsList() | |
109 | 109 | let $s = size($l) | |
110 | 110 | let $acc0 = $Tuple2(nil, keyPrefix) | |
118 | 118 | ||
119 | 119 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5) | |
120 | 120 | } | |
121 | - | let result = $ | |
122 | - | let prefix = $ | |
121 | + | let result = $t032203304._1 | |
122 | + | let prefix = $t032203304._2 | |
123 | 123 | result | |
124 | 124 | } | |
125 | 125 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let contractFile = "l2mp_staking.ride" | |
5 | 5 | ||
6 | 6 | let SEP = "__" | |
7 | 7 | ||
8 | 8 | let scale8 = 100000000 | |
9 | 9 | ||
10 | 10 | let scale18 = 1000000000000000000 | |
11 | 11 | ||
12 | 12 | let scale18BigInt = toBigInt(scale18) | |
13 | 13 | ||
14 | 14 | let ADDRESS_BYTES_SIZE = 26 | |
15 | 15 | ||
16 | 16 | let BLOCKS_IN_DAY = 1440 | |
17 | 17 | ||
18 | 18 | func throwErr (msg) = throw(((contractFile + ": ") + msg)) | |
19 | 19 | ||
20 | 20 | ||
21 | 21 | let keyAssetId = makeString(["%s", "assetId"], SEP) | |
22 | 22 | ||
23 | 23 | let keyEmissionPerBlock = makeString(["%s", "emissionPerBlock"], SEP) | |
24 | 24 | ||
25 | 25 | let keyEmissionPeriodInBlocks = makeString(["%s", "emissionPeriodInBlocks"], SEP) | |
26 | 26 | ||
27 | 27 | let keyStartBlock = makeString(["%s", "startBlock"], SEP) | |
28 | 28 | ||
29 | 29 | let keyTotalLpAmount = makeString(["%s", "totalLpAmount"], SEP) | |
30 | 30 | ||
31 | 31 | let keyTotalAssetAmount = makeString(["%s", "totalAssetAmount"], SEP) | |
32 | 32 | ||
33 | 33 | func keyUserLpAmount (userAddress) = makeString(["%s%s", "userLpAmount", userAddress], SEP) | |
34 | 34 | ||
35 | 35 | ||
36 | 36 | func keyUserTotalAssetWithdrawn (userAddress) = makeString(["%s%s", "totalAssetWithdrawn", userAddress], SEP) | |
37 | 37 | ||
38 | 38 | ||
39 | 39 | func keyUserTotalAssetStaked (userAddress) = makeString(["%s%s", "totalAssetStaked", userAddress], SEP) | |
40 | 40 | ||
41 | 41 | ||
42 | 42 | func keyHistory (type,userAddress,txId) = makeString(["%s%s%s", type, userAddress, toBase58String(txId)], SEP) | |
43 | 43 | ||
44 | 44 | ||
45 | - | func formatHistory (totalProfit,price,totalAssetAmount,totalLpAmount) = makeString(["%d%d", toString(totalProfit), toString(price), toString(totalAssetAmount), toString(totalLpAmount)], SEP) | |
45 | + | func formatHistory (totalProfit,price,totalAssetAmount,totalLpAmount) = makeString(["%d%d%d%d", toString(totalProfit), toString(price), toString(totalAssetAmount), toString(totalLpAmount)], SEP) | |
46 | 46 | ||
47 | 47 | ||
48 | 48 | let totalLpAmount = valueOrElse(getInteger(this, keyTotalLpAmount), 0) | |
49 | 49 | ||
50 | 50 | let totalAssetAmount = valueOrElse(getInteger(this, keyTotalAssetAmount), 0) | |
51 | 51 | ||
52 | 52 | let assetIdString = valueOrElse(getString(this, keyAssetId), "WAVES") | |
53 | 53 | ||
54 | 54 | let assetIdBytes = if ((assetIdString == "WAVES")) | |
55 | 55 | then unit | |
56 | 56 | else fromBase58String(assetIdString) | |
57 | 57 | ||
58 | 58 | let emissionPeriodInBlocks = valueOrElse(getInteger(this, keyEmissionPeriodInBlocks), BLOCKS_IN_DAY) | |
59 | 59 | ||
60 | 60 | let emissionPerPeriod = (valueOrElse(getInteger(this, keyEmissionPerBlock), 0) * emissionPeriodInBlocks) | |
61 | 61 | ||
62 | 62 | let ADMIN_LIST_SIZE = 5 | |
63 | 63 | ||
64 | 64 | let QUORUM = 3 | |
65 | 65 | ||
66 | 66 | let TXID_BYTES_LENGTH = 32 | |
67 | 67 | ||
68 | 68 | func keyAllowedTxIdVotePrefix (txId) = makeString(["%s%s%s", "allowTxId", txId], SEP) | |
69 | 69 | ||
70 | 70 | ||
71 | 71 | func keyFullAdminVote (prefix,adminAddress) = makeString([prefix, adminAddress], SEP) | |
72 | 72 | ||
73 | 73 | ||
74 | 74 | func keyAdminAddressList () = makeString(["%s", "adminAddressList"], SEP) | |
75 | 75 | ||
76 | 76 | ||
77 | 77 | func keyAllowedTxId () = makeString(["%s", "txId"], SEP) | |
78 | 78 | ||
79 | 79 | ||
80 | 80 | func getAdminVote (prefix,admin) = { | |
81 | 81 | let voteKey = keyFullAdminVote(prefix, admin) | |
82 | 82 | valueOrElse(getInteger(voteKey), 0) | |
83 | 83 | } | |
84 | 84 | ||
85 | 85 | ||
86 | 86 | func getAdminsList () = match getString(this, keyAdminAddressList()) { | |
87 | 87 | case s: String => | |
88 | 88 | split(s, SEP) | |
89 | 89 | case _ => | |
90 | 90 | nil | |
91 | 91 | } | |
92 | 92 | ||
93 | 93 | ||
94 | 94 | func isInAdminList (address) = containsElement(getAdminsList(), address) | |
95 | 95 | ||
96 | 96 | ||
97 | 97 | func genVotesKeysHelper (a,adminAddress) = { | |
98 | - | let $ | |
99 | - | let result = $ | |
100 | - | let prefix = $ | |
98 | + | let $t030493073 = a | |
99 | + | let result = $t030493073._1 | |
100 | + | let prefix = $t030493073._2 | |
101 | 101 | $Tuple2((result :+ keyFullAdminVote(prefix, adminAddress)), prefix) | |
102 | 102 | } | |
103 | 103 | ||
104 | 104 | ||
105 | 105 | func genVotesKeys (keyPrefix) = { | |
106 | 106 | let adminList = keyAdminAddressList() | |
107 | - | let $ | |
107 | + | let $t032203304 = { | |
108 | 108 | let $l = getAdminsList() | |
109 | 109 | let $s = size($l) | |
110 | 110 | let $acc0 = $Tuple2(nil, keyPrefix) | |
111 | 111 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
112 | 112 | then $a | |
113 | 113 | else genVotesKeysHelper($a, $l[$i]) | |
114 | 114 | ||
115 | 115 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
116 | 116 | then $a | |
117 | 117 | else throw("List size exceeds 5") | |
118 | 118 | ||
119 | 119 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5) | |
120 | 120 | } | |
121 | - | let result = $ | |
122 | - | let prefix = $ | |
121 | + | let result = $t032203304._1 | |
122 | + | let prefix = $t032203304._2 | |
123 | 123 | result | |
124 | 124 | } | |
125 | 125 | ||
126 | 126 | ||
127 | 127 | func countVotesHelper (result,voteKey) = (result + valueOrElse(getInteger(voteKey), 0)) | |
128 | 128 | ||
129 | 129 | ||
130 | 130 | func countVotes (prefix) = { | |
131 | 131 | let votes = genVotesKeys(prefix) | |
132 | 132 | let $l = votes | |
133 | 133 | let $s = size($l) | |
134 | 134 | let $acc0 = 0 | |
135 | 135 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
136 | 136 | then $a | |
137 | 137 | else countVotesHelper($a, $l[$i]) | |
138 | 138 | ||
139 | 139 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
140 | 140 | then $a | |
141 | 141 | else throw("List size exceeds 5") | |
142 | 142 | ||
143 | 143 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5) | |
144 | 144 | } | |
145 | 145 | ||
146 | 146 | ||
147 | 147 | func clearVotesHelper (result,key) = (result :+ DeleteEntry(key)) | |
148 | 148 | ||
149 | 149 | ||
150 | 150 | func getClearVoteEntries (prefix) = { | |
151 | 151 | let votes = genVotesKeys(prefix) | |
152 | 152 | let $l = votes | |
153 | 153 | let $s = size($l) | |
154 | 154 | let $acc0 = nil | |
155 | 155 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
156 | 156 | then $a | |
157 | 157 | else clearVotesHelper($a, $l[$i]) | |
158 | 158 | ||
159 | 159 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
160 | 160 | then $a | |
161 | 161 | else throw("List size exceeds 5") | |
162 | 162 | ||
163 | 163 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5) | |
164 | 164 | } | |
165 | 165 | ||
166 | 166 | ||
167 | 167 | func voteINTERNAL (callerAddressString,keyPrefix,minVotes,voteResult) = { | |
168 | 168 | let voteKey = keyFullAdminVote(keyPrefix, callerAddressString) | |
169 | 169 | let adminCurrentVote = getAdminVote(keyPrefix, callerAddressString) | |
170 | 170 | let err = if (!(isInAdminList(callerAddressString))) | |
171 | 171 | then throwErr((("Address: " + callerAddressString) + " not in Admin list")) | |
172 | 172 | else if ((adminCurrentVote == 1)) | |
173 | 173 | then throwErr((voteKey + " you already voted")) | |
174 | 174 | else unit | |
175 | 175 | if ((err == err)) | |
176 | 176 | then { | |
177 | 177 | let votes = countVotes(keyPrefix) | |
178 | 178 | if (((votes + 1) >= minVotes)) | |
179 | 179 | then { | |
180 | 180 | let clearVoteEntries = getClearVoteEntries(keyPrefix) | |
181 | 181 | (clearVoteEntries ++ voteResult) | |
182 | 182 | } | |
183 | 183 | else [IntegerEntry(voteKey, 1)] | |
184 | 184 | } | |
185 | 185 | else throw("Strict value is not equal to itself.") | |
186 | 186 | } | |
187 | 187 | ||
188 | 188 | ||
189 | 189 | func calcTotalProfitForHeight (h) = { | |
190 | 190 | let startBlock = valueOrElse(getInteger(this, keyStartBlock), 0) | |
191 | 191 | let startPeriod = fraction(startBlock, 1, emissionPeriodInBlocks) | |
192 | 192 | let elapsedPeriods = ((h / emissionPeriodInBlocks) - startPeriod) | |
193 | 193 | max([0, (emissionPerPeriod * elapsedPeriods)]) | |
194 | 194 | } | |
195 | 195 | ||
196 | 196 | ||
197 | 197 | func calcTotalProfit () = calcTotalProfitForHeight(height) | |
198 | 198 | ||
199 | 199 | ||
200 | 200 | func getTotalAssetAmountWithProfitOrMaxAvailable () = { | |
201 | 201 | let totalAssetAmountWithProfit = (totalAssetAmount + calcTotalProfit()) | |
202 | 202 | let totalAmount = match assetIdBytes { | |
203 | 203 | case u: Unit => | |
204 | 204 | min([totalAssetAmountWithProfit, wavesBalance(this).available]) | |
205 | 205 | case b: ByteVector => | |
206 | 206 | min([totalAssetAmountWithProfit, assetBalance(this, b)]) | |
207 | 207 | case _ => | |
208 | 208 | throw("Match error") | |
209 | 209 | } | |
210 | 210 | if ((totalLpAmount == 0)) | |
211 | 211 | then 0 | |
212 | 212 | else totalAmount | |
213 | 213 | } | |
214 | 214 | ||
215 | 215 | ||
216 | 216 | func getCurrentPrice () = if ((totalLpAmount != 0)) | |
217 | 217 | then fraction(toBigInt(getTotalAssetAmountWithProfitOrMaxAvailable()), scale18BigInt, toBigInt(totalLpAmount)) | |
218 | 218 | else scale18BigInt | |
219 | 219 | ||
220 | 220 | ||
221 | 221 | func getUserLpAmount (userAddress) = valueOrElse(getInteger(this, keyUserLpAmount(userAddress)), 0) | |
222 | 222 | ||
223 | 223 | ||
224 | 224 | func getUserAvailableAssetsToWithdraw (userAddress) = { | |
225 | 225 | let userLpAmount = getUserLpAmount(userAddress) | |
226 | 226 | let userAvailableAssetToWithdraw = toInt(fraction(toBigInt(userLpAmount), getCurrentPrice(), scale18BigInt)) | |
227 | 227 | if ((0 > userAvailableAssetToWithdraw)) | |
228 | 228 | then 0 | |
229 | 229 | else userAvailableAssetToWithdraw | |
230 | 230 | } | |
231 | 231 | ||
232 | 232 | ||
233 | 233 | func getStakeActions (i,userAddress) = { | |
234 | 234 | let checks = [if ((size(i.payments) == 1)) | |
235 | 235 | then true | |
236 | 236 | else throwErr("should include 1 payment"), if ((i.payments[0].assetId == assetIdBytes)) | |
237 | 237 | then true | |
238 | 238 | else throwErr(("payment should be in " + assetIdString)), if ((i.payments[0].amount > 0)) | |
239 | 239 | then true | |
240 | 240 | else "payment amount should be greater than 0"] | |
241 | 241 | if ((checks == checks)) | |
242 | 242 | then { | |
243 | 243 | let paymentAmount = i.payments[0].amount | |
244 | 244 | let paymentLpAmount = toInt(fraction(toBigInt(paymentAmount), scale18BigInt, getCurrentPrice())) | |
245 | 245 | let userLpAmount = getUserLpAmount(userAddress) | |
246 | 246 | let userTotalStakedAmount = valueOrElse(getInteger(this, keyUserTotalAssetStaked(userAddress)), 0) | |
247 | 247 | let newTotalLpAmount = (totalLpAmount + paymentLpAmount) | |
248 | 248 | let newTotalAssetAmount = (totalAssetAmount + paymentAmount) | |
249 | 249 | let newUserLpAmount = (userLpAmount + paymentLpAmount) | |
250 | 250 | let newUserTotalStakedAmount = (userTotalStakedAmount + paymentAmount) | |
251 | 251 | let updateStartHeightAction = if ((totalLpAmount == 0)) | |
252 | 252 | then [IntegerEntry(keyStartBlock, height)] | |
253 | 253 | else nil | |
254 | 254 | ([StringEntry(keyHistory("stake", userAddress, i.transactionId), formatHistory(calcTotalProfit(), getCurrentPrice(), totalLpAmount, totalAssetAmount)), IntegerEntry(keyTotalLpAmount, newTotalLpAmount), IntegerEntry(keyTotalAssetAmount, newTotalAssetAmount), IntegerEntry(keyUserLpAmount(userAddress), newUserLpAmount), IntegerEntry(keyUserTotalAssetStaked(userAddress), newUserTotalStakedAmount)] ++ updateStartHeightAction) | |
255 | 255 | } | |
256 | 256 | else throw("Strict value is not equal to itself.") | |
257 | 257 | } | |
258 | 258 | ||
259 | 259 | ||
260 | 260 | func getWithdrawActions (i,lpAssetWithdrawAmount) = { | |
261 | 261 | let userAddress = toString(i.caller) | |
262 | 262 | let userLpAmount = getUserLpAmount(userAddress) | |
263 | 263 | let check = [if ((lpAssetWithdrawAmount > 0)) | |
264 | 264 | then true | |
265 | 265 | else throwErr("LP amount should be more than 0"), if ((userLpAmount >= lpAssetWithdrawAmount)) | |
266 | 266 | then true | |
267 | 267 | else throwErr((("cannot withdraw more than available LP (" + toString(userLpAmount)) + ")"))] | |
268 | 268 | if ((check == check)) | |
269 | 269 | then { | |
270 | 270 | let newUserLpAmount = (userLpAmount - lpAssetWithdrawAmount) | |
271 | 271 | let withdrawAssetAmount = toInt(fraction(toBigInt(lpAssetWithdrawAmount), getCurrentPrice(), scale18BigInt)) | |
272 | 272 | let newTotalLpAmount = (totalLpAmount - lpAssetWithdrawAmount) | |
273 | 273 | let newTotalAssetAmount = toInt(fraction(toBigInt(newTotalLpAmount), getCurrentPrice(), scale18BigInt)) | |
274 | 274 | let userTotalAssetWithdrawn = valueOrElse(getInteger(this, keyUserTotalAssetWithdrawn(userAddress)), 0) | |
275 | 275 | let newUserTotalAssetWithdrawn = (userTotalAssetWithdrawn + withdrawAssetAmount) | |
276 | 276 | [StringEntry(keyHistory("withdraw", userAddress, i.transactionId), formatHistory(calcTotalProfit(), getCurrentPrice(), totalLpAmount, totalAssetAmount)), IntegerEntry(keyTotalLpAmount, newTotalLpAmount), IntegerEntry(keyTotalAssetAmount, newTotalAssetAmount), IntegerEntry(keyUserLpAmount(userAddress), newUserLpAmount), IntegerEntry(keyUserTotalAssetWithdrawn(userAddress), newUserTotalAssetWithdrawn), IntegerEntry(keyStartBlock, height), ScriptTransfer(i.caller, withdrawAssetAmount, assetIdBytes)] | |
277 | 277 | } | |
278 | 278 | else throw("Strict value is not equal to itself.") | |
279 | 279 | } | |
280 | 280 | ||
281 | 281 | ||
282 | 282 | @Callable(i) | |
283 | 283 | func setEmissionPerBlock (emissionPerBlock) = { | |
284 | 284 | let check = [if ((i.caller == this)) | |
285 | 285 | then true | |
286 | 286 | else throwErr("permission denied")] | |
287 | 287 | if ((check == check)) | |
288 | 288 | then [IntegerEntry(keyTotalAssetAmount, getTotalAssetAmountWithProfitOrMaxAvailable()), IntegerEntry(keyStartBlock, height), IntegerEntry(keyEmissionPerBlock, max([0, emissionPerBlock]))] | |
289 | 289 | else throw("Strict value is not equal to itself.") | |
290 | 290 | } | |
291 | 291 | ||
292 | 292 | ||
293 | 293 | ||
294 | 294 | @Callable(i) | |
295 | 295 | func setEmissionPeriodInBlocks (p) = { | |
296 | 296 | let check = [if ((p > 0)) | |
297 | 297 | then true | |
298 | 298 | else throwErr("emission period should be greater than 0"), if ((i.caller == this)) | |
299 | 299 | then true | |
300 | 300 | else throwErr("permission denied")] | |
301 | 301 | if ((check == check)) | |
302 | 302 | then [IntegerEntry(keyTotalAssetAmount, getTotalAssetAmountWithProfitOrMaxAvailable()), IntegerEntry(keyStartBlock, height), IntegerEntry(keyEmissionPeriodInBlocks, p)] | |
303 | 303 | else throw("Strict value is not equal to itself.") | |
304 | 304 | } | |
305 | 305 | ||
306 | 306 | ||
307 | 307 | ||
308 | 308 | @Callable(i) | |
309 | 309 | func stake () = getStakeActions(i, toString(i.caller)) | |
310 | 310 | ||
311 | 311 | ||
312 | 312 | ||
313 | 313 | @Callable(i) | |
314 | 314 | func stakeFor (userAddress) = { | |
315 | 315 | let check = [if ((size(fromBase58String(userAddress)) == ADDRESS_BYTES_SIZE)) | |
316 | 316 | then true | |
317 | 317 | else throwErr("address is not valid")] | |
318 | 318 | if ((check == check)) | |
319 | 319 | then getStakeActions(i, userAddress) | |
320 | 320 | else throw("Strict value is not equal to itself.") | |
321 | 321 | } | |
322 | 322 | ||
323 | 323 | ||
324 | 324 | ||
325 | 325 | @Callable(i) | |
326 | 326 | func withdraw (withdrawAssetAmount) = { | |
327 | 327 | let userAddress = toString(i.caller) | |
328 | 328 | let userLpAmount = getUserLpAmount(userAddress) | |
329 | 329 | let lpAmountToWithdraw = toInt(fraction(toBigInt(withdrawAssetAmount), scale18BigInt, getCurrentPrice())) | |
330 | 330 | let userAvailableAssetToWithdraw = getUserAvailableAssetsToWithdraw(userAddress) | |
331 | 331 | let minWithdrawAssetAmount = toInt(fraction(getCurrentPrice(), toBigInt(1), scale18BigInt, CEILING)) | |
332 | 332 | let check = [if ((withdrawAssetAmount > 0)) | |
333 | 333 | then true | |
334 | 334 | else throwErr("withdraw amount should be more than 0"), if ((userAvailableAssetToWithdraw >= withdrawAssetAmount)) | |
335 | 335 | then true | |
336 | 336 | else throwErr((("cannot withdraw more than available (" + toString(userAvailableAssetToWithdraw)) + ")")), if ((withdrawAssetAmount >= minWithdrawAssetAmount)) | |
337 | 337 | then true | |
338 | 338 | else throwErr((("withdraw amount is too small. Min: (" + toString(minWithdrawAssetAmount)) + ")"))] | |
339 | 339 | if ((check == check)) | |
340 | 340 | then getWithdrawActions(i, min([userLpAmount, (lpAmountToWithdraw + 1)])) | |
341 | 341 | else throw("Strict value is not equal to itself.") | |
342 | 342 | } | |
343 | 343 | ||
344 | 344 | ||
345 | 345 | ||
346 | 346 | @Callable(i) | |
347 | 347 | func getUserAssetsREADONLY (userAddress) = { | |
348 | 348 | let userLpAmount = getUserLpAmount(userAddress) | |
349 | 349 | let userAvailableAssetToWithdraw = getUserAvailableAssetsToWithdraw(userAddress) | |
350 | 350 | let userTotalStakedAmount = valueOrElse(getInteger(this, keyUserTotalAssetStaked(userAddress)), 0) | |
351 | 351 | let userTotalAssetWithdrawn = valueOrElse(getInteger(this, keyUserTotalAssetWithdrawn(userAddress)), 0) | |
352 | 352 | $Tuple2(nil, $Tuple5(userLpAmount, userAvailableAssetToWithdraw, getCurrentPrice(), userTotalStakedAmount, userTotalAssetWithdrawn)) | |
353 | 353 | } | |
354 | 354 | ||
355 | 355 | ||
356 | 356 | ||
357 | 357 | @Callable(i) | |
358 | 358 | func getTotalAssetsREADONLY () = $Tuple2(nil, $Tuple3(totalLpAmount, getTotalAssetAmountWithProfitOrMaxAvailable(), getCurrentPrice())) | |
359 | 359 | ||
360 | 360 | ||
361 | 361 | ||
362 | 362 | @Callable(i) | |
363 | 363 | func voteForTxId (txId) = { | |
364 | 364 | let callerAddressString = toBase58String(i.caller.bytes) | |
365 | 365 | let keyPrefix = keyAllowedTxIdVotePrefix(txId) | |
366 | 366 | let result = [StringEntry(keyAllowedTxId(), txId)] | |
367 | 367 | let allowedTxIdOption = getString(this, keyAllowedTxId()) | |
368 | 368 | let err = [if ((size(fromBase58String(txId)) == TXID_BYTES_LENGTH)) | |
369 | 369 | then true | |
370 | 370 | else throwErr((txId + " is not valid txId")), if (if ((allowedTxIdOption == unit)) | |
371 | 371 | then true | |
372 | 372 | else (value(allowedTxIdOption) != txId)) | |
373 | 373 | then true | |
374 | 374 | else throwErr((txId + " is already allowed"))] | |
375 | 375 | if ((err == err)) | |
376 | 376 | then voteINTERNAL(callerAddressString, keyPrefix, QUORUM, result) | |
377 | 377 | else throw("Strict value is not equal to itself.") | |
378 | 378 | } | |
379 | 379 | ||
380 | 380 | ||
381 | 381 | @Verifier(tx) | |
382 | 382 | func verify () = { | |
383 | 383 | let byAdmins = (tx.id == fromBase58String(valueOrElse(getString(this, keyAllowedTxId()), ""))) | |
384 | 384 | let byOwner = if ((size(getAdminsList()) >= QUORUM)) | |
385 | 385 | then false | |
386 | 386 | else sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
387 | 387 | if (byAdmins) | |
388 | 388 | then true | |
389 | 389 | else byOwner | |
390 | 390 | } | |
391 | 391 |
github/deemru/w8io/026f985 88.39 ms ◑