tx · 77v7xSUAowaXyBQEhJu9eXY5QzsV8EFEUHD9XrmQX9wJ 3N51YiaNJZWGxAPTF7bQ9U4WhKgaJKAwsxo: -0.01000000 Waves 2022.09.02 18:16 [2211682] smart account 3N51YiaNJZWGxAPTF7bQ9U4WhKgaJKAwsxo > SELF 0.00000000 Waves
{ "type": 13, "id": "77v7xSUAowaXyBQEhJu9eXY5QzsV8EFEUHD9XrmQX9wJ", "fee": 1000000, "feeAssetId": null, "timestamp": 1662131811957, "version": 2, "chainId": 84, "sender": "3N51YiaNJZWGxAPTF7bQ9U4WhKgaJKAwsxo", "senderPublicKey": "AHW69AvV4FCRoAsG4q4wGRCrLKi4QUbcErcWTW4cjb7h", "proofs": [ "X7RqBtwuRqAbxMdREh68nEs4h23TpiwKMqGbcoU9VSmNuS7ckiMDsNcdvcpm88ppC1yfnXGzN5vyJZQWBwm8Ke4" ], "script": "base64:BgIjCAISABIAEgASAwoBBBIAEgASBAoCAQQSAwoBBBIDCgEIEgAmAAtrZXlNQWNjUEtleQIJbWFzdGVyX3BrAQxnZXRDRkFkZHJlc3MACQERQGV4dHJOYXRpdmUoMTA2MikBCQETdmFsdWVPckVycm9yTWVzc2FnZQIJAJ0IAgUEdGhpcwIKQ0ZfQUREUkVTUwIUQ0ZfQUREUkVTUyBub3QgZm91bmQACG1BY2NQS2V5CQDZBAEJARN2YWx1ZU9yRXJyb3JNZXNzYWdlAgkAnQgCCQEMZ2V0Q0ZBZGRyZXNzAAULa2V5TUFjY1BLZXkJAKwCAgULa2V5TUFjY1BLZXkCCiBub3QgZm91bmQACG1BY2NBZGRyCQCnCAEFCG1BY2NQS2V5ARFnZXRDb3Vwb25zQWRkcmVzcwAJARFAZXh0ck5hdGl2ZSgxMDYyKQEJARFAZXh0ck5hdGl2ZSgxMDUzKQIFCG1BY2NBZGRyAg9DT1VQT05TX0FERFJFU1MAEGtleVRvdGFsQ29tcG91bmQCDnRvdGFsX2NvbXBvdW5kABFrZXlTdGFrZWRDb21wb3Vu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RCxWY", "height": 2211682, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 6 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let keyMAccPKey = "master_pk" | |
5 | + | ||
6 | + | func getCFAddress () = addressFromStringValue(valueOrErrorMessage(getString(this, "CF_ADDRESS"), "CF_ADDRESS not found")) | |
7 | + | ||
8 | + | ||
9 | + | let mAccPKey = fromBase58String(valueOrErrorMessage(getString(getCFAddress(), keyMAccPKey), (keyMAccPKey + " not found"))) | |
10 | + | ||
11 | + | let mAccAddr = addressFromPublicKey(mAccPKey) | |
12 | + | ||
13 | + | func getCouponsAddress () = addressFromStringValue(getStringValue(mAccAddr, "COUPONS_ADDRESS")) | |
14 | + | ||
15 | + | ||
16 | + | let keyTotalCompound = "total_compound" | |
17 | + | ||
18 | + | let keyStakedCompound = "staked_compound" | |
19 | + | ||
20 | + | let keyLastVP = "last_virtual_price" | |
21 | + | ||
22 | + | let VPScale = 100000000 | |
23 | + | ||
24 | + | func keyStakedCompoundUser (user) = ((toString(user) + "_") + keyStakedCompound) | |
25 | + | ||
26 | + | ||
27 | + | func calcVirtualPrice (totalStaked,total) = if ((total == 0)) | |
28 | + | then 1 | |
29 | + | else if ((totalStaked == 0)) | |
30 | + | then 1 | |
31 | + | else fraction(total, VPScale, totalStaked) | |
32 | + | ||
33 | + | ||
34 | + | let Scale = 100000000 | |
35 | + | ||
36 | + | func keyStakedAmount (address) = (toString(address) + "_farm_staked") | |
37 | + | ||
38 | + | ||
39 | + | func keyLastCheckInterest (address) = (toString(address) + "_lastCheck_interest") | |
40 | + | ||
41 | + | ||
42 | + | func keyEggClaimed (address) = (toString(address) + "_claimed") | |
43 | + | ||
44 | + | ||
45 | + | let keyGlobalLastInterest = "global_lastCheck_interest" | |
46 | + | ||
47 | + | let keyGlobalStaked = "global_staked" | |
48 | + | ||
49 | + | let keyGlobalEggEarned = "global_earnings" | |
50 | + | ||
51 | + | let kLockedInvestments = "locked_investments" | |
52 | + | ||
53 | + | func isCollectiveFarmLocked () = match getBoolean(getCFAddress(), kLockedInvestments) { | |
54 | + | case b: Boolean => | |
55 | + | b | |
56 | + | case _ => | |
57 | + | false | |
58 | + | } | |
59 | + | ||
60 | + | ||
61 | + | func getEggId () = fromBase58String(getStringValue(mAccAddr, "EGG_ASSET_ID")) | |
62 | + | ||
63 | + | ||
64 | + | func setCFAddressAndInitiate (address) = [StringEntry("CF_ADDRESS", address), IntegerEntry(keyGlobalLastInterest, 1)] | |
65 | + | ||
66 | + | ||
67 | + | func getShareAssetId () = fromBase58String(getStringValue(getCFAddress(), "SHARE_ASSET_ID")) | |
68 | + | ||
69 | + | ||
70 | + | func tryGetIntegerExternal (address,key) = match getInteger(address, key) { | |
71 | + | case b: Int => | |
72 | + | b | |
73 | + | case _ => | |
74 | + | 0 | |
75 | + | } | |
76 | + | ||
77 | + | ||
78 | + | func tryGetInteger (key) = tryGetIntegerExternal(this, key) | |
79 | + | ||
80 | + | ||
81 | + | func tryGetString (key) = match getString(this, key) { | |
82 | + | case a: String => | |
83 | + | a | |
84 | + | case _ => | |
85 | + | "" | |
86 | + | } | |
87 | + | ||
88 | + | ||
89 | + | func getVoteHeightKey () = "VOTE_HEIGHT_START" | |
90 | + | ||
91 | + | ||
92 | + | func getDuration () = if ((tryGetIntegerExternal(mAccAddr, "VOTE_DURATION") == 0)) | |
93 | + | then 10000 | |
94 | + | else tryGetIntegerExternal(mAccAddr, "VOTE_DURATION") | |
95 | + | ||
96 | + | ||
97 | + | func getVoteByUserKey (user,height) = ((("VOTE_" + user) + "_") + height) | |
98 | + | ||
99 | + | ||
100 | + | func getTotalVoteByTypeKey (type,height) = ((("VOTE_TOTAL_" + type) + "_") + height) | |
101 | + | ||
102 | + | ||
103 | + | func getTotalVoteKey (height) = ("VOTE_TOTAL_" + height) | |
104 | + | ||
105 | + | ||
106 | + | func resultVoteKey (height) = ("LIQUIDATED_" + height) | |
107 | + | ||
108 | + | ||
109 | + | func quorumVoteKey (height) = ("QUORUM_" + height) | |
110 | + | ||
111 | + | ||
112 | + | func claimStakingResult (address) = { | |
113 | + | let currentInterest = tryGetInteger(keyGlobalLastInterest) | |
114 | + | let lastCheckInterest = tryGetInteger(keyLastCheckInterest(address)) | |
115 | + | let stakedAmount = tryGetInteger(keyStakedAmount(address)) | |
116 | + | let reward = if ((lastCheckInterest > 0)) | |
117 | + | then fraction((currentInterest - lastCheckInterest), stakedAmount, Scale) | |
118 | + | else 0 | |
119 | + | let transfer = if ((reward > 0)) | |
120 | + | then [ScriptTransfer(address, reward, getEggId())] | |
121 | + | else nil | |
122 | + | (transfer ++ [IntegerEntry(keyLastCheckInterest(address), currentInterest), IntegerEntry(keyEggClaimed(address), (tryGetInteger(keyEggClaimed(address)) + reward))]) | |
123 | + | } | |
124 | + | ||
125 | + | ||
126 | + | func handleStakingTopUp (amount) = { | |
127 | + | let currentInterest = tryGetInteger(keyGlobalLastInterest) | |
128 | + | let totalStakedAmount = tryGetInteger(keyGlobalStaked) | |
129 | + | let interestDelta = if ((totalStakedAmount > 0)) | |
130 | + | then fraction(amount, Scale, totalStakedAmount) | |
131 | + | else 0 | |
132 | + | [IntegerEntry(keyGlobalEggEarned, (tryGetInteger(keyGlobalEggEarned) + amount)), IntegerEntry(keyGlobalLastInterest, (currentInterest + interestDelta))] | |
133 | + | } | |
134 | + | ||
135 | + | ||
136 | + | func addVotePower (caller,h,vote,votePower) = if (if ((h == 0)) | |
137 | + | then true | |
138 | + | else (vote == "")) | |
139 | + | then nil | |
140 | + | else if ((height > (h + getDuration()))) | |
141 | + | then throw((((((((("CAVP: Voting is finished, please finalize the vote;" + " Arguments: ") + caller) + ", ") + toString(h)) + ", ") + vote) + ", ") + toString(votePower))) | |
142 | + | else { | |
143 | + | let voteTotalByType = tryGetInteger(getTotalVoteByTypeKey(vote, toString(h))) | |
144 | + | let totalVote = tryGetInteger(getTotalVoteKey(toString(h))) | |
145 | + | [StringEntry(getVoteByUserKey(caller, toString(h)), vote), IntegerEntry(getTotalVoteByTypeKey(vote, toString(h)), (voteTotalByType + votePower)), IntegerEntry(getTotalVoteKey(toString(h)), (totalVote + votePower))] | |
146 | + | } | |
147 | + | ||
148 | + | ||
149 | + | func adaptVotePowerStake (caller,votePower) = { | |
150 | + | let voteHeight = tryGetInteger(getVoteHeightKey()) | |
151 | + | let voteByUserString = tryGetString(getVoteByUserKey(caller, toString(voteHeight))) | |
152 | + | addVotePower(caller, voteHeight, voteByUserString, votePower) | |
153 | + | } | |
154 | + | ||
155 | + | ||
156 | + | func isLiquidated () = { | |
157 | + | let voteHeight = tryGetInteger(getVoteHeightKey()) | |
158 | + | if ((voteHeight == 0)) | |
159 | + | then false | |
160 | + | else getBooleanValue(resultVoteKey(toString(voteHeight))) | |
161 | + | } | |
162 | + | ||
163 | + | ||
164 | + | @Callable(i) | |
165 | + | func claimRefundStaked () = { | |
166 | + | let addressStr = toString(i.caller) | |
167 | + | let stakedAmount = tryGetInteger(keyStakedAmount(i.caller)) | |
168 | + | let voteHeight = tryGetInteger(getVoteHeightKey()) | |
169 | + | let voteByUserString = tryGetString(getVoteByUserKey(addressStr, toString(voteHeight))) | |
170 | + | let multiplier = if ((voteByUserString == "")) | |
171 | + | then 7 | |
172 | + | else 10 | |
173 | + | let refund = ((stakedAmount / 10) * multiplier) | |
174 | + | let couponsCall = invoke(getCouponsAddress(), "CFRefund", [addressStr, refund], nil) | |
175 | + | if ((couponsCall == couponsCall)) | |
176 | + | then [IntegerEntry(keyStakedAmount(i.caller), 0), Burn(getShareAssetId(), stakedAmount)] | |
177 | + | else throw("Strict value is not equal to itself.") | |
178 | + | } | |
179 | + | ||
180 | + | ||
181 | + | ||
182 | + | @Callable(i) | |
183 | + | func claimRefundUnstaked () = { | |
184 | + | let shareTokenId = getShareAssetId() | |
185 | + | if ((size(i.payments) > 1)) | |
186 | + | then throw("CSFT: To many payments added") | |
187 | + | else if ((i.payments[0].assetId != shareTokenId)) | |
188 | + | then throw("CSFT: Wrong assetId") | |
189 | + | else { | |
190 | + | let amount = i.payments[0].amount | |
191 | + | if ((amount == 0)) | |
192 | + | then throw("CSFT: Please attach positive asset amount!") | |
193 | + | else { | |
194 | + | let addressStr = toString(i.caller) | |
195 | + | let multiplier = 7 | |
196 | + | let refund = ((amount / 10) * multiplier) | |
197 | + | let couponsCall = invoke(getCouponsAddress(), "CFRefund", [addressStr, refund], nil) | |
198 | + | if ((couponsCall == couponsCall)) | |
199 | + | then [Burn(getShareAssetId(), amount)] | |
200 | + | else throw("Strict value is not equal to itself.") | |
201 | + | } | |
202 | + | } | |
203 | + | } | |
204 | + | ||
205 | + | ||
206 | + | ||
207 | + | @Callable(i) | |
208 | + | func startVote () = if ((i.caller != mAccAddr)) | |
209 | + | then throw("CSV: Only the admin can start a liquidation vote for now!") | |
210 | + | else if ((tryGetInteger(getVoteHeightKey()) != 0)) | |
211 | + | then throw("CSV: There is already a vote running!") | |
212 | + | else [IntegerEntry("VOTE_HEIGHT_START", height)] | |
213 | + | ||
214 | + | ||
215 | + | ||
216 | + | @Callable(i) | |
217 | + | func voteToLiquidate (vote) = { | |
218 | + | let votePower = tryGetInteger(keyStakedAmount(i.caller)) | |
219 | + | if ((votePower == 0)) | |
220 | + | then throw("CVTL: Please stake some tokens before you can vote!") | |
221 | + | else { | |
222 | + | let voteAsString = toString(vote) | |
223 | + | let voteHeight = tryGetInteger(getVoteHeightKey()) | |
224 | + | if ((height > (voteHeight + getDuration()))) | |
225 | + | then throw("CVTL: Voting is finished, please finalize the vote!") | |
226 | + | else { | |
227 | + | let voteByUserString = tryGetString(getVoteByUserKey(toString(i.caller), toString(voteHeight))) | |
228 | + | if ((voteByUserString != "")) | |
229 | + | then throw("CVTL: You can not change your vote!") | |
230 | + | else addVotePower(toString(i.caller), voteHeight, voteAsString, votePower) | |
231 | + | } | |
232 | + | } | |
233 | + | } | |
234 | + | ||
235 | + | ||
236 | + | ||
237 | + | @Callable(i) | |
238 | + | func finalizeVote () = { | |
239 | + | let voteHeight = tryGetInteger(getVoteHeightKey()) | |
240 | + | if (((voteHeight + getDuration()) > height)) | |
241 | + | then throw("CFV: Voting is not finished!") | |
242 | + | else { | |
243 | + | let totalStakedAmount = tryGetInteger(keyGlobalStaked) | |
244 | + | let totalVote = tryGetInteger(getTotalVoteKey(toString(voteHeight))) | |
245 | + | let quorum = ((totalVote / totalStakedAmount) * 100) | |
246 | + | let voteTotalByYes = tryGetInteger(getTotalVoteByTypeKey("true", toString(voteHeight))) | |
247 | + | let voteTotalByNo = tryGetInteger(getTotalVoteByTypeKey("false", toString(voteHeight))) | |
248 | + | let liquidated = if ((20 > quorum)) | |
249 | + | then true | |
250 | + | else if ((voteTotalByYes > voteTotalByNo)) | |
251 | + | then true | |
252 | + | else false | |
253 | + | let resetKey = if (liquidated) | |
254 | + | then nil | |
255 | + | else [IntegerEntry(getVoteHeightKey(), 0)] | |
256 | + | ([IntegerEntry(quorumVoteKey(toString(voteHeight)), quorum), BooleanEntry(resultVoteKey(toString(voteHeight)), liquidated)] ++ resetKey) | |
257 | + | } | |
258 | + | } | |
259 | + | ||
260 | + | ||
261 | + | ||
262 | + | @Callable(i) | |
263 | + | func topUpReward () = if (isLiquidated()) | |
264 | + | then throw("CTUR: CF is liquidated!") | |
265 | + | else { | |
266 | + | let eggAssetId = getEggId() | |
267 | + | if ((i.payments[0].assetId != eggAssetId)) | |
268 | + | then throw("CTUP: Wrong assetId, payment should be EGG") | |
269 | + | else { | |
270 | + | let resHandleStaking = handleStakingTopUp(i.payments[0].amount) | |
271 | + | $Tuple2(resHandleStaking, true) | |
272 | + | } | |
273 | + | } | |
274 | + | ||
275 | + | ||
276 | + | ||
277 | + | @Callable(i) | |
278 | + | func withdrawFarmTokens (amount,compound) = if (isLiquidated()) | |
279 | + | then throw("CTUR: CF is liquidated!") | |
280 | + | else if ((size(i.payments) > 0)) | |
281 | + | then throw("CWFT: Please don't add payments") | |
282 | + | else { | |
283 | + | let shareTokenId = getShareAssetId() | |
284 | + | if (compound) | |
285 | + | then { | |
286 | + | let staked = tryGetInteger(keyStakedCompound) | |
287 | + | let total = tryGetInteger(keyTotalCompound) | |
288 | + | let vp = calcVirtualPrice(staked, total) | |
289 | + | let keyStakedCompoundU = keyStakedCompoundUser(i.caller) | |
290 | + | let personalStaked = tryGetInteger(keyStakedCompoundU) | |
291 | + | let virtualWd = if ((amount == -1)) | |
292 | + | then personalStaked | |
293 | + | else fraction(amount, VPScale, vp) | |
294 | + | let amountWd = if ((amount == -1)) | |
295 | + | then fraction(virtualWd, vp, VPScale) | |
296 | + | else amount | |
297 | + | if ((virtualWd > personalStaked)) | |
298 | + | then throw("CWFT: You don't have so much funds to withdraw") | |
299 | + | else [IntegerEntry(keyStakedCompoundU, (personalStaked - virtualWd)), IntegerEntry(keyStakedCompound, (staked - virtualWd)), IntegerEntry(keyTotalCompound, (total - amountWd)), ScriptTransfer(i.caller, amountWd, shareTokenId), IntegerEntry(keyLastVP, vp), IntegerEntry("last_virt_compound_wd", virtualWd), IntegerEntry("last_amount_compound_wd", amountWd)] | |
300 | + | } | |
301 | + | else { | |
302 | + | let addressStr = toString(i.caller) | |
303 | + | let stakedAmount = tryGetInteger(keyStakedAmount(i.caller)) | |
304 | + | let wdAmount = if ((amount == -1)) | |
305 | + | then stakedAmount | |
306 | + | else amount | |
307 | + | if ((wdAmount > stakedAmount)) | |
308 | + | then throw("CWFT: you don't have tokens available") | |
309 | + | else { | |
310 | + | let votePower = adaptVotePowerStake(toString(i.caller), -(wdAmount)) | |
311 | + | ((claimStakingResult(i.caller) ++ [IntegerEntry(keyStakedAmount(i.caller), (stakedAmount - wdAmount)), IntegerEntry(keyGlobalStaked, (tryGetInteger(keyGlobalStaked) - wdAmount)), ScriptTransfer(i.caller, wdAmount, shareTokenId), IntegerEntry("last_staking_wd", wdAmount)]) ++ votePower) | |
312 | + | } | |
313 | + | } | |
314 | + | } | |
315 | + | ||
316 | + | ||
317 | + | ||
318 | + | @Callable(i) | |
319 | + | func stakeFarmTokens (compound) = if (isLiquidated()) | |
320 | + | then throw("CSFT: CF is liquidated!") | |
321 | + | else { | |
322 | + | let shareTokenId = getShareAssetId() | |
323 | + | if ((size(i.payments) > 1)) | |
324 | + | then throw("CSFT: To many payments added") | |
325 | + | else if ((i.payments[0].assetId != shareTokenId)) | |
326 | + | then throw("CSFT: Wrong assetId") | |
327 | + | else { | |
328 | + | let amount = i.payments[0].amount | |
329 | + | if ((amount == 0)) | |
330 | + | then throw("CSFT: Please attach positive asset amount!") | |
331 | + | else if (compound) | |
332 | + | then throw("CSFT: Compound was disabled!") | |
333 | + | else { | |
334 | + | let addressStr = toString(i.caller) | |
335 | + | let totalStakedAmount = tryGetInteger(keyGlobalStaked) | |
336 | + | if ((i.payments[0].assetId != shareTokenId)) | |
337 | + | then throw("CSFT: wrong asset attached") | |
338 | + | else { | |
339 | + | let votePower = adaptVotePowerStake(toString(i.caller), amount) | |
340 | + | ((claimStakingResult(i.caller) ++ [IntegerEntry(keyGlobalStaked, (totalStakedAmount + amount)), IntegerEntry(keyStakedAmount(i.caller), (tryGetInteger(keyStakedAmount(i.caller)) + amount))]) ++ votePower) | |
341 | + | } | |
342 | + | } | |
343 | + | } | |
344 | + | } | |
345 | + | ||
346 | + | ||
347 | + | ||
348 | + | @Callable(i) | |
349 | + | func initiateDapp (address) = if (isLiquidated()) | |
350 | + | then throw("CID: CF is liquidated!") | |
351 | + | else if ((i.caller != this)) | |
352 | + | then throw("CID: Can be called only by the dapp-account") | |
353 | + | else setCFAddressAndInitiate(address) | |
354 | + | ||
355 | + | ||
356 | + | ||
357 | + | @Callable(i) | |
358 | + | func claimReward () = if (isLiquidated()) | |
359 | + | then throw("CCR: CF is liquidated!") | |
360 | + | else if ((size(i.payments) > 0)) | |
361 | + | then throw("CCR: Please don't add payments") | |
362 | + | else claimStakingResult(i.caller) | |
363 | + | ||
364 | + |
github/deemru/w8io/026f985 30.54 ms ◑