tx · 5VcTFsadP1yG7jQLodR4JdCTS5aH4cSA8cWzFC2Zq4JP 3N35UaaUfENekiyXtmv6aCU17bEtDbw4FHA: -0.01000000 Waves 2022.09.01 11:18 [2209818] smart account 3N35UaaUfENekiyXtmv6aCU17bEtDbw4FHA > SELF 0.00000000 Waves
{ "type": 13, "id": "5VcTFsadP1yG7jQLodR4JdCTS5aH4cSA8cWzFC2Zq4JP", "fee": 1000000, "feeAssetId": null, "timestamp": 1662020382433, "version": 2, "chainId": 84, "sender": "3N35UaaUfENekiyXtmv6aCU17bEtDbw4FHA", "senderPublicKey": "8YNHwg4gEH3zJALGrrm5hUt5iutQ1BGhZicDDSkUzNoH", "proofs": [ "2H6m6JfPAW7WcgpuJxqZmouXongZdpMb94a7UeZv5CT3EuE1TCWDQeY7tCJ6kVMPCcVwQAkyhSFos97MtmhU4nsq" ], "script": "base64:BgIjCAISABIAEgASAwoBBBIAEgASBAoCAQQSAwoBBBIDCgEIEgAmAAtrZXlNQWNjUEtleQIJbWFzdGVyX3BrAQxnZXRDRkFkZHJlc3MACQERQGV4dHJOYXRpdmUoMTA2MikBCQETdmFsdWVPckVycm9yTWVzc2FnZQIJAJ0IAgUEdGhpcwIKQ0ZfQUREUkVTUwIUQ0ZfQUREUkVTUyBub3QgZm91bmQACG1BY2NQS2V5CQDZBAEJARN2YWx1ZU9yRXJyb3JNZXNzYWdlAgkAnQgCCQEMZ2V0Q0ZBZGRyZXNzAAULa2V5TUFjY1BLZXkJAKwCAgULa2V5TUFjY1BLZXkCCiBub3QgZm91bmQACG1BY2NBZGRyCQCnCAEFCG1BY2NQS2V5ARFnZXRDb3Vwb25zQWRkcmVzcwAJARFAZXh0ck5hdGl2ZSgxMDYyKQEJARFAZXh0ck5hdGl2ZSgxMDUzKQIFCG1BY2NBZGRyAg9DT1VQT05TX0FERFJFU1MAEGtleVRvdGFsQ29tcG91bmQCDnRvdGFsX2NvbXBvdW5kABFrZXlTdGFrZWRDb21wb3VuZAIPc3Rha2VkX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2FsbGVyAGwCKsM=", "height": 2209818, "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("CV: 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("CV: 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 | + | let shareTokenId = getShareAssetId() | |
268 | + | if ((i.payments[0].assetId != eggAssetId)) | |
269 | + | then throw("CTUP: Wrong assetId, first payment should be EGG") | |
270 | + | else { | |
271 | + | let resHandleStaking = handleStakingTopUp(i.payments[0].amount) | |
272 | + | $Tuple2(resHandleStaking, true) | |
273 | + | } | |
274 | + | } | |
275 | + | ||
276 | + | ||
277 | + | ||
278 | + | @Callable(i) | |
279 | + | func withdrawFarmTokens (amount,compound) = if (isLiquidated()) | |
280 | + | then throw("CTUR: CF is liquidated!") | |
281 | + | else if ((size(i.payments) > 0)) | |
282 | + | then throw("CWFT: Please don't add payments") | |
283 | + | else { | |
284 | + | let shareTokenId = getShareAssetId() | |
285 | + | if (compound) | |
286 | + | then { | |
287 | + | let staked = tryGetInteger(keyStakedCompound) | |
288 | + | let total = tryGetInteger(keyTotalCompound) | |
289 | + | let vp = calcVirtualPrice(staked, total) | |
290 | + | let keyStakedCompoundU = keyStakedCompoundUser(i.caller) | |
291 | + | let personalStaked = tryGetInteger(keyStakedCompoundU) | |
292 | + | let virtualWd = if ((amount == -1)) | |
293 | + | then personalStaked | |
294 | + | else fraction(amount, VPScale, vp) | |
295 | + | let amountWd = if ((amount == -1)) | |
296 | + | then fraction(virtualWd, vp, VPScale) | |
297 | + | else amount | |
298 | + | if ((virtualWd > personalStaked)) | |
299 | + | then throw("CWFT: You don't have so much funds to withdraw") | |
300 | + | 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)] | |
301 | + | } | |
302 | + | else { | |
303 | + | let addressStr = toString(i.caller) | |
304 | + | let stakedAmount = tryGetInteger(keyStakedAmount(i.caller)) | |
305 | + | let wdAmount = if ((amount == -1)) | |
306 | + | then stakedAmount | |
307 | + | else amount | |
308 | + | if ((wdAmount > stakedAmount)) | |
309 | + | then throw("CWFT: you don't have tokens available") | |
310 | + | else { | |
311 | + | let votePower = adaptVotePowerStake(toString(i.caller), -(wdAmount)) | |
312 | + | ((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) | |
313 | + | } | |
314 | + | } | |
315 | + | } | |
316 | + | ||
317 | + | ||
318 | + | ||
319 | + | @Callable(i) | |
320 | + | func stakeFarmTokens (compound) = if (isLiquidated()) | |
321 | + | then throw("CSFT: CF is liquidated!") | |
322 | + | else { | |
323 | + | let shareTokenId = getShareAssetId() | |
324 | + | if ((size(i.payments) > 1)) | |
325 | + | then throw("CSFT: To many payments added") | |
326 | + | else if ((i.payments[0].assetId != shareTokenId)) | |
327 | + | then throw("CSFT: Wrong assetId") | |
328 | + | else { | |
329 | + | let amount = i.payments[0].amount | |
330 | + | if ((amount == 0)) | |
331 | + | then throw("CSFT: Please attach positive asset amount!") | |
332 | + | else if (compound) | |
333 | + | then throw("CSFT: Compound was disabled!") | |
334 | + | else { | |
335 | + | let addressStr = toString(i.caller) | |
336 | + | let totalStakedAmount = tryGetInteger(keyGlobalStaked) | |
337 | + | if ((i.payments[0].assetId != shareTokenId)) | |
338 | + | then throw("CSFT: wrong asset attached") | |
339 | + | else { | |
340 | + | let votePower = adaptVotePowerStake(toString(i.caller), amount) | |
341 | + | ((claimStakingResult(i.caller) ++ [IntegerEntry(keyGlobalStaked, (totalStakedAmount + amount)), IntegerEntry(keyStakedAmount(i.caller), (tryGetInteger(keyStakedAmount(i.caller)) + amount))]) ++ votePower) | |
342 | + | } | |
343 | + | } | |
344 | + | } | |
345 | + | } | |
346 | + | ||
347 | + | ||
348 | + | ||
349 | + | @Callable(i) | |
350 | + | func initiateDapp (address) = if (isLiquidated()) | |
351 | + | then throw("CID: CF is liquidated!") | |
352 | + | else if ((i.caller != this)) | |
353 | + | then throw("CID: Can be called only by the dapp-account") | |
354 | + | else setCFAddressAndInitiate(address) | |
355 | + | ||
356 | + | ||
357 | + | ||
358 | + | @Callable(i) | |
359 | + | func claimReward () = if (isLiquidated()) | |
360 | + | then throw("CCR: CF is liquidated!") | |
361 | + | else if ((size(i.payments) > 0)) | |
362 | + | then throw("CCR: Please don't add payments") | |
363 | + | else claimStakingResult(i.caller) | |
364 | + | ||
365 | + |
github/deemru/w8io/026f985 33.60 ms ◑