tx · 4G6GZo7sucHyRPB4SLjmriLKDCARZMbA3eZLdqa1QdyS 3MsXpzisJAwnzUr7XrEoW1BZo4U6rw4tsYK: -0.14000000 Waves 2022.10.18 17:24 [2277953] smart account 3MsXpzisJAwnzUr7XrEoW1BZo4U6rw4tsYK > SELF 0.00000000 Waves
{ "type": 13, "id": "4G6GZo7sucHyRPB4SLjmriLKDCARZMbA3eZLdqa1QdyS", "fee": 14000000, "feeAssetId": null, "timestamp": 1666103036465, "version": 2, "chainId": 84, "sender": "3MsXpzisJAwnzUr7XrEoW1BZo4U6rw4tsYK", "senderPublicKey": "FFdBua5rzzMkZebvsvmN7sAdU7XhFK8QNJ3hiwwxAYRA", "proofs": [ "4xkTMK5N3KMAy1C9MzYQQd6GYzKkwUs71xB5hdmPPDkZf9JwsHWyrsCgkZExDhtqmfLoy42DQC3nSA85F4N6AJVz", "2A8vtUpG4pgpMSxk4Ktt5ttJfbo6F42mwYxA53LqwrrDk2UrsSprkTPw4CGyA6sY9e9Rvjb4htzUugVsvfJs41bS" ], "script": "base64:BgJICAISAwoBCBIDCgEIEgMKAQgSBAoCCAESBQoDCAEBEgQKAggIEgQKAggBEgMKAQgSAwoBCBIDCgEYEgMKARgSBAoCCAgSABIAWAAHa0FjdGl2ZQIGYWN0aXZlAAZrQ2F1c2UCDnNodXRkb3duX2NhdXNlABprUmV3YXJkUG9vbEZyYWN0aW9uQ3VycmVudAIdX2N1cnJlbnRfcG9vbF9mcmFjdGlvbl9yZXdhcmQAG2tSZXdhcmRQb29sRnJhY3Rpb25QcmV2aW91cwIeX3ByZXZpb3VzX3Bvb2xfZnJhY3Rpb25fcmV3YXJkABNrSGVpZ2h0UG9vbEZyYWN0aW9uAhpfcG9vbF9yZXdhcmRfdXBkYXRlX2hlaWdodAAba1RvdGFsUmV3YXJkUGVyQmxvY2tDdXJyZW50Ah50b3RhbF9yZXdhcmRfcGVyX2Jsb2NrX2N1cnJlbnQAHGtUb3RhbFJld2FyZFBlckJsb2NrUHJld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DYWxsAQUBaQMJAQEhAQUGYWN0aXZlCQACAQkArAICAiJEQXBwIGlzIGFscmVhZHkgc3VzcGVuZGVkLiBDYXVzZTogCQELdmFsdWVPckVsc2UCCQCdCAIFBHRoaXMFBmtDYXVzZQIadGhlIGNhdXNlIHdhc24ndCBzcGVjaWZpZWQJAQdzdXNwZW5kAQIPUGF1c2VkIGJ5IGFkbWluAWkBCGFjdGl2YXRlAAkBC3ZhbHVlT3JFbHNlAgkBC2lzQWRtaW5DYWxsAQUBaQMFBmFjdGl2ZQkAAgECFkRBcHAgaXMgYWxyZWFkeSBhY3RpdmUJAMwIAgkBDEJvb2xlYW5FbnRyeQIFB2tBY3RpdmUGCQDMCAIJAQtEZWxldGVFbnRyeQEFBmtDYXVzZQUDbmlsAQJ0eAEGdmVyaWZ5AAQHJG1hdGNoMAUCdHgEEmFkbWluUHViS2V5MVNpZ25lZAMJAPQDAwgFAnR4CWJvZHlCeXRlcwkAkQMCCAUCdHgGcHJvb2ZzAAAFDGFkbWluUHViS2V5MQABAAAEEmFkbWluUHViS2V5MlNpZ25lZAMJAPQDAwgFAnR4CWJvZHlCeXRlcwkAkQMCCAUCdHgGcHJvb2ZzAAEFDGFkbWluUHViS2V5MgABAAAEEmFkbWluUHViS2V5M1NpZ25lZAMJAPQDAwgFAnR4CWJvZHlCeXRlcwkAkQMCCAUCdHgGcHJvb2ZzAAIFDGFkbWluUHViS2V5MwABAAAJAGcCCQBkAgkAZAIFEmFkbWluUHViS2V5MVNpZ25lZAUSYWRtaW5QdWJLZXkyU2lnbmVkBRJhZG1pblB1YktleTNTaWduZWQAAtOm7ms=", "height": 2277953, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 7NXR58diaiVszBSE7KAcn8TYT2ai7odPTAt3zd4BFT2m Next: Yat37uPdCqfD1maLiPe6WR4HQcVLmeyMY48afutrdGq Diff:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let | |
4 | + | let kActive = "active" | |
5 | 5 | ||
6 | - | let | |
6 | + | let kCause = "shutdown_cause" | |
7 | 7 | ||
8 | - | let | |
8 | + | let kRewardPoolFractionCurrent = "_current_pool_fraction_reward" | |
9 | 9 | ||
10 | - | let | |
10 | + | let kRewardPoolFractionPrevious = "_previous_pool_fraction_reward" | |
11 | 11 | ||
12 | - | let | |
12 | + | let kHeightPoolFraction = "_pool_reward_update_height" | |
13 | 13 | ||
14 | - | let | |
14 | + | let kTotalRewardPerBlockCurrent = "total_reward_per_block_current" | |
15 | 15 | ||
16 | - | let | |
16 | + | let kTotalRewardPerBlockPrevious = "total_reward_per_block_previous" | |
17 | 17 | ||
18 | - | let | |
18 | + | let kRewardUpdateHeight = "reward_update_height" | |
19 | 19 | ||
20 | - | let | |
20 | + | let kUserShareTokensStaked = "_share_tokens_locked" | |
21 | 21 | ||
22 | - | let | |
22 | + | let kUserShareTokensLocked = "_share_tokens_blocked" | |
23 | 23 | ||
24 | - | let | |
24 | + | let kUserShareTokensLockedType = "_share_tokens_blocked_type" | |
25 | 25 | ||
26 | - | let | |
26 | + | let kUserShareTokensLockedHeight = "_share_tokens_blocked_height" | |
27 | 27 | ||
28 | - | let | |
28 | + | let kUserShareTokensVirtual = "_share_tokens_virtual" | |
29 | 29 | ||
30 | - | let | |
30 | + | let kShareTotalShareTokens = "_total_share_tokens_locked" | |
31 | 31 | ||
32 | - | let | |
32 | + | let kShareTokensVirtual = "_total_share_tokens_virtual" | |
33 | 33 | ||
34 | - | let | |
34 | + | let kLockParams = "_lock_params" | |
35 | 35 | ||
36 | - | let | |
36 | + | let kLockWavesFee = "lock_waves_fee" | |
37 | 37 | ||
38 | - | let | |
38 | + | let kPoolBoostCoef = "_boost_coef" | |
39 | 39 | ||
40 | - | let | |
40 | + | let kFarmLastInterest = "_last_interest" | |
41 | 41 | ||
42 | - | let | |
42 | + | let kFarmUserLastInterest = "_last_interest" | |
43 | 43 | ||
44 | - | let | |
44 | + | let kBoostLastInterest = "_last_interest_b" | |
45 | 45 | ||
46 | - | let | |
46 | + | let kBoostUserLastInterest = "_last_interest_u_b" | |
47 | 47 | ||
48 | - | let | |
48 | + | let kBoostLPLastInterest = "_last_interest_lpb" | |
49 | 49 | ||
50 | - | let | |
50 | + | let kBoostLPUserLastInterest = "_last_interest_u_lpb" | |
51 | 51 | ||
52 | - | let | |
52 | + | let kLastInterestHeight = "_last_interest_height" | |
53 | 53 | ||
54 | - | let | |
54 | + | let kSWOPid = "SWOP_id" | |
55 | 55 | ||
56 | - | let | |
56 | + | let kAvailableSWOP = "_available_SWOP" | |
57 | 57 | ||
58 | - | let | |
58 | + | let kSwopYearEmission = "swop_year_emission" | |
59 | 59 | ||
60 | - | let | |
60 | + | let kHarvestPoolVote = "_harvest_pool_vote_gSWOP" | |
61 | 61 | ||
62 | - | let | |
62 | + | let kPoolVote = "_pool_vote_gSWOP" | |
63 | 63 | ||
64 | - | let | |
64 | + | let kUserPoolVote = "_user_vote_gSWOP" | |
65 | 65 | ||
66 | - | let | |
66 | + | let kHarvestUserPoolVote = "_harvest_user_pool_vote_gSWOP" | |
67 | 67 | ||
68 | - | let | |
68 | + | let kBasePeriod = "base_period" | |
69 | 69 | ||
70 | - | let | |
70 | + | let kPeriodLength = "period_length" | |
71 | 71 | ||
72 | - | let | |
72 | + | let kStartHeight = "start_height" | |
73 | 73 | ||
74 | - | let | |
74 | + | let kFirstHarvestHeight = "first_harvest_height" | |
75 | 75 | ||
76 | - | let scaleValue3 = 1000 | |
77 | - | ||
78 | - | let scaleValue5 = 100000 | |
79 | - | ||
80 | - | let scaleValue6 = 1000000 | |
81 | - | ||
82 | - | let scaleValue8 = 100000000 | |
83 | - | ||
84 | - | let scaleValue11 = 100000000000 | |
76 | + | let kShareLimitFH = "share_limit_on_first_harvest" | |
85 | 77 | ||
86 | 78 | let kAdminPubKey1 = "admin_pub_1" | |
87 | 79 | ||
99 | 91 | ||
100 | 92 | let kLPFarmingAddress = "lp_farming" | |
101 | 93 | ||
94 | + | let kAirdropMoneyBoxAddr = "airdrop_fee_money_box" | |
95 | + | ||
102 | 96 | let oracle = Address(base58'3MvVBtsXroQpy1tsPw21TU2ET9A8WfmrNjz') | |
97 | + | ||
98 | + | let totalVoteShare = 10000000000 | |
99 | + | ||
100 | + | let lockBoostCoefScale = 1000 | |
101 | + | ||
102 | + | let defPoolBoostCoef = 500 | |
103 | 103 | ||
104 | 104 | func getBase58FromOracle (key) = match getString(oracle, key) { | |
105 | 105 | case string: String => | |
125 | 125 | ||
126 | 126 | let lpFarmingAddress = Address(getBase58FromOracle(kLPFarmingAddress)) | |
127 | 127 | ||
128 | - | func strAssetIdA (pool) = getStringValue(pool, keyAssetIdA) | |
129 | - | ||
130 | - | ||
131 | - | func strAssetIdB (pool) = getStringValue(pool, keyAssetIdB) | |
132 | - | ||
133 | - | ||
134 | - | func assetIdA (pool) = if ((strAssetIdA(pool) == "WAVES")) | |
135 | - | then unit | |
136 | - | else fromBase58String(strAssetIdA(pool)) | |
137 | - | ||
138 | - | ||
139 | - | func assetIdB (pool) = if ((strAssetIdB(pool) == "WAVES")) | |
140 | - | then unit | |
141 | - | else fromBase58String(strAssetIdB(pool)) | |
142 | - | ||
143 | - | ||
144 | - | let kBasePeriod = "base_period" | |
145 | - | ||
146 | - | let kPeriodLength = "period_length" | |
147 | - | ||
148 | - | let kStartHeight = "start_height" | |
149 | - | ||
150 | - | let kFirstHarvestHeight = "first_harvest_height" | |
151 | - | ||
152 | - | let kDurationFullVotePower = "duration_full_vote_power" | |
153 | - | ||
154 | - | let kMinVotePower = "min_vote_power" | |
128 | + | let airdropMoneyBoxAddr = Address(getBase58FromOracle(kAirdropMoneyBoxAddr)) | |
155 | 129 | ||
156 | 130 | let basePeriod = valueOrErrorMessage(getInteger(votingAddress, kBasePeriod), "Empty kBasePeriod") | |
157 | 131 | ||
159 | 133 | ||
160 | 134 | let periodLength = valueOrErrorMessage(getInteger(votingAddress, kPeriodLength), "Empty kPeriodLength") | |
161 | 135 | ||
162 | - | let durationFullVotePower = valueOrErrorMessage(getInteger(votingAddress, kDurationFullVotePower), "Empty kDurationFullVotePower") | |
163 | - | ||
164 | - | let minVotePower = valueOrErrorMessage(getInteger(votingAddress, kMinVotePower), "Empty kMinVotePower") | |
165 | - | ||
166 | - | let isActive = getBooleanValue(this, keyActive) | |
167 | - | ||
168 | 136 | let currPeriod = (basePeriod + ((height - startHeight) / periodLength)) | |
169 | 137 | ||
170 | - | func getLimitToken (pool) = valueOrElse(getIntegerValue(pool, keyLimitShareFirstHarvest), 0) | |
138 | + | let active = getBooleanValue(this, kActive) | |
139 | + | ||
140 | + | let SwopYearEmission = getIntegerValue(this, kSwopYearEmission) | |
141 | + | ||
142 | + | let SWOP = fromBase58String(getStringValue(this, kSWOPid)) | |
143 | + | ||
144 | + | func getHeightFirstHarvest (pool) = valueOrElse(getInteger(Address(fromBase58String(pool)), kFirstHarvestHeight), 0) | |
171 | 145 | ||
172 | 146 | ||
173 | - | let APY = getIntegerValue(this, keyAPY) | |
174 | - | ||
175 | - | let SwopYearEmission = getIntegerValue(this, keySwopYearEmission) | |
176 | - | ||
177 | - | func assetNameA (pool) = match assetIdA(pool) { | |
178 | - | case id: ByteVector => | |
179 | - | value(assetInfo(id)).name | |
180 | - | case waves: Unit => | |
181 | - | "WAVES" | |
182 | - | case _ => | |
183 | - | throw("Match error") | |
184 | - | } | |
147 | + | func getFHShareLimitToken (pool) = valueOrErrorMessage(getInteger(pool, kShareLimitFH), ("No data on the key: " + kShareLimitFH)) | |
185 | 148 | ||
186 | 149 | ||
187 | - | func assetNameB (pool) = match assetIdB(pool) { | |
188 | - | case id: ByteVector => | |
189 | - | value(assetInfo(id)).name | |
190 | - | case waves: Unit => | |
191 | - | "WAVES" | |
192 | - | case _ => | |
193 | - | throw("Match error") | |
194 | - | } | |
150 | + | func getTotalShareTokenStaked (pool) = valueOrErrorMessage(getInteger(this, (pool + kShareTotalShareTokens)), (("No data on the key: " + pool) + kShareTotalShareTokens)) | |
195 | 151 | ||
196 | 152 | ||
197 | - | let SWOP = fromBase58String(getStringValue(this, keySWOPid)) | |
198 | - | ||
199 | - | func isFirstHarvest (pool) = valueOrElse(getBoolean(pool, keyfirstHarvestCpmm), false) | |
153 | + | func getPoolVoted (pool) = valueOrElse(getInteger(votingAddress, (pool + kPoolVote)), 0) | |
200 | 154 | ||
201 | 155 | ||
202 | - | func getHeightFirstHarvest (pool) = valueOrElse(getInteger(pool, keyFirstHarvestHeight), 0) | |
203 | - | ||
204 | - | ||
205 | - | func getBalanceA (pool) = valueOrErrorMessage(getInteger(pool, keyBalancecpmmA), ("No data on the key: " + keyBalancecpmmA)) | |
206 | - | ||
207 | - | ||
208 | - | func getBalanceB (pool) = valueOrErrorMessage(getInteger(pool, keyBalancecpmmB), ("No data on the key: " + keyBalancecpmmB)) | |
209 | - | ||
210 | - | ||
211 | - | func getShareLimitToken (pool) = valueOrErrorMessage(getInteger(pool, kShareLimit), ("No data on the key: " + kShareLimit)) | |
212 | - | ||
213 | - | ||
214 | - | func getTotalShareTokenLocked (pool) = valueOrErrorMessage(getInteger(this, (pool + keyShareTokensLocked)), (("No data on the key: " + pool) + keyShareTokensLocked)) | |
156 | + | func getUserPoolVoted (pool,user) = valueOrElse(getInteger(votingAddress, (((user + "_") + pool) + kPoolVote)), 0) | |
215 | 157 | ||
216 | 158 | ||
217 | 159 | func getShareAssetId (pool) = fromBase58String(getStringValue(value(addressFromString(pool)), "share_asset_id")) | |
247 | 189 | } | |
248 | 190 | ||
249 | 191 | ||
250 | - | func userAvailableSWOP (pool,user) = valueOrElse(getInteger(this, (((pool + "_") + toString(user)) + | |
192 | + | func userAvailableSWOP (pool,user) = valueOrElse(getInteger(this, (((pool + "_") + toString(user)) + kAvailableSWOP)), 0) | |
251 | 193 | ||
252 | 194 | ||
253 | 195 | func rewardInfo (pool) = { | |
254 | - | let totalRewardPerBlockCurrent = valueOrErrorMessage(getInteger(govAddress, | |
255 | - | let totalRewardPerBlockPrevious = valueOrErrorMessage(getInteger(govAddress, | |
256 | - | let rewardPoolFractionCurrent = valueOrErrorMessage(getInteger(govAddress, (pool + | |
257 | - | let rewardUpdateHeight = valueOrErrorMessage(getInteger(govAddress, | |
258 | - | let poolRewardUpdateHeight = valueOrElse(getInteger(govAddress, (pool + | |
259 | - | let rewardPoolFractionPrevious = valueOrErrorMessage(getInteger(govAddress, (pool + | |
196 | + | let totalRewardPerBlockCurrent = valueOrErrorMessage(getInteger(govAddress, kTotalRewardPerBlockCurrent), ((("No data on the key: " + kTotalRewardPerBlockCurrent) + " at address ") + toString(govAddress))) | |
197 | + | let totalRewardPerBlockPrevious = valueOrErrorMessage(getInteger(govAddress, kTotalRewardPerBlockPrevious), ((("No data on the key: " + kTotalRewardPerBlockPrevious) + " at address ") + toString(govAddress))) | |
198 | + | let rewardPoolFractionCurrent = valueOrErrorMessage(getInteger(govAddress, (pool + kRewardPoolFractionCurrent)), (((("No data on the key: " + pool) + kRewardPoolFractionCurrent) + " at address ") + toString(govAddress))) | |
199 | + | let rewardUpdateHeight = valueOrErrorMessage(getInteger(govAddress, kRewardUpdateHeight), ((("No data on the key: " + kRewardUpdateHeight) + " at address ") + toString(govAddress))) | |
200 | + | let poolRewardUpdateHeight = valueOrElse(getInteger(govAddress, (pool + kHeightPoolFraction)), rewardUpdateHeight) | |
201 | + | let rewardPoolFractionPrevious = valueOrErrorMessage(getInteger(govAddress, (pool + kRewardPoolFractionPrevious)), (((("No data on the key: " + pool) + kRewardPoolFractionPrevious) + " at address ") + toString(govAddress))) | |
260 | 202 | let rewardPoolCurrent = fraction(totalRewardPerBlockCurrent, rewardPoolFractionCurrent, totalVoteShare) | |
261 | - | let rewardPoolPrevious = fraction( | |
203 | + | let rewardPoolPrevious = fraction(totalRewardPerBlockCurrent, rewardPoolFractionPrevious, totalVoteShare) | |
262 | 204 | if (if ((rewardPoolCurrent > totalRewardPerBlockCurrent)) | |
263 | 205 | then true | |
264 | 206 | else (rewardPoolPrevious > totalRewardPerBlockPrevious)) | |
268 | 210 | ||
269 | 211 | ||
270 | 212 | func getLastInterestInfo (pool) = { | |
271 | - | let lastInterest = valueOrErrorMessage(getInteger(this, (pool + keyLastInterest)), (("No data on the key: " + pool) + keyLastInterest)) | |
272 | - | let lastInterestHeight = valueOrElse(getInteger(this, (pool + keyLastInterestHeight)), height) | |
273 | - | $Tuple2(lastInterestHeight, lastInterest) | |
213 | + | let farmInterest = valueOrErrorMessage(getInteger(this, (pool + kFarmLastInterest)), (("No data on the key: " + pool) + kFarmLastInterest)) | |
214 | + | let boostInterest = valueOrErrorMessage(getInteger(this, (pool + kFarmLastInterest)), (("No data on the key: " + pool) + kBoostLastInterest)) | |
215 | + | let boostLPInterest = valueOrErrorMessage(getInteger(this, (pool + kFarmLastInterest)), (("No data on the key: " + pool) + kBoostLPLastInterest)) | |
216 | + | let lastInterestHeight = valueOrElse(getInteger(this, (pool + kLastInterestHeight)), height) | |
217 | + | $Tuple4(lastInterestHeight, farmInterest, boostInterest, boostLPInterest) | |
274 | 218 | } | |
275 | 219 | ||
276 | 220 | ||
277 | - | func getUserInterestInfo (pool,userAddress) = { | |
278 | - | let userLastInterest = getInteger(this, (((pool + "_") + toString(userAddress)) + keyUserLastInterest)) | |
279 | - | let userShare = getInteger(this, (((pool + "_") + toString(userAddress)) + keyUserShareTokensLocked)) | |
280 | - | let lastInterest = valueOrErrorMessage(getInteger(this, (pool + keyLastInterest)), (("No data on the key: " + pool) + keyLastInterest)) | |
281 | - | let userLastInterestValue = match userLastInterest { | |
282 | - | case userLastInterest: Int => | |
283 | - | userLastInterest | |
284 | - | case _ => | |
285 | - | lastInterest | |
286 | - | } | |
287 | - | let userShareTokensAmount = match userShare { | |
288 | - | case userShare: Int => | |
289 | - | userShare | |
290 | - | case _ => | |
291 | - | 0 | |
292 | - | } | |
293 | - | $Tuple2(userLastInterestValue, userShareTokensAmount) | |
221 | + | func calcFarmRwd (pool,curTotalReward) = { | |
222 | + | let poolBoostCoef = valueOrElse(getInteger(this, (pool + kPoolBoostCoef)), defPoolBoostCoef) | |
223 | + | ((curTotalReward / (poolBoostCoef + 1)) / lockBoostCoefScale) | |
294 | 224 | } | |
295 | 225 | ||
296 | 226 | ||
297 | - | func calcInterest (lastInterestHeight,rewardUpdateHeight,poolRewardUpdateHeight,lastInterest,currentRewardPerBlock,shareTokenLocked,previousRewardPerBlock,shareAssetId,scaleValue,pmtAmount) = if ((shareTokenLocked == 0)) | |
298 | - | then 0 | |
299 | - | else if ((poolRewardUpdateHeight != 0)) | |
300 | - | then if (if ((rewardUpdateHeight > height)) | |
301 | - | then (rewardUpdateHeight == poolRewardUpdateHeight) | |
227 | + | func calcBoostRwd (pool,curTotalReward) = { | |
228 | + | let poolBoostCoef = valueOrElse(getInteger(this, (pool + kPoolBoostCoef)), defPoolBoostCoef) | |
229 | + | (fraction(curTotalReward, poolBoostCoef, (poolBoostCoef + 1)) / lockBoostCoefScale) | |
230 | + | } | |
231 | + | ||
232 | + | ||
233 | + | func calcInterest (pool,lastInterestHeight,rewardUpdateHeight,poolRewardUpdateHeight,farmInterest,boostInterest,poolVoted,boostLpInterest,currentRewardPerBlock,shareTokenLocked,previousRewardPerBlock,scaleValue) = if ((shareTokenLocked == 0)) | |
234 | + | then $Tuple3(0, 0, 0) | |
235 | + | else if (if ((rewardUpdateHeight > height)) | |
236 | + | then (rewardUpdateHeight == poolRewardUpdateHeight) | |
237 | + | else false) | |
238 | + | then { | |
239 | + | let reward = (previousRewardPerBlock * (height - lastInterestHeight)) | |
240 | + | let newFarmInterest = (farmInterest + fraction(calcFarmRwd(pool, reward), scaleValue, shareTokenLocked)) | |
241 | + | let newBoostInterest = (boostInterest + (if ((poolVoted > 0)) | |
242 | + | then fraction(calcBoostRwd(pool, reward), scaleValue, poolVoted) | |
243 | + | else 0)) | |
244 | + | let newBoostLPInterest = (boostLpInterest + (if (if ((poolVoted > 0)) | |
245 | + | then (shareTokenLocked > 0) | |
246 | + | else false) | |
247 | + | then (fraction(calcBoostRwd(pool, reward), scaleValue, shareTokenLocked) / poolVoted) | |
248 | + | else 0)) | |
249 | + | $Tuple3(newFarmInterest, newBoostInterest, newBoostLPInterest) | |
250 | + | } | |
251 | + | else if (if ((height > rewardUpdateHeight)) | |
252 | + | then (rewardUpdateHeight != poolRewardUpdateHeight) | |
302 | 253 | else false) | |
303 | 254 | then { | |
304 | 255 | let reward = (previousRewardPerBlock * (height - lastInterestHeight)) | |
305 | - | (lastInterest + fraction(reward, scaleValue, shareTokenLocked)) | |
256 | + | let newFarmInterest = (farmInterest + fraction(calcFarmRwd(pool, reward), scaleValue, shareTokenLocked)) | |
257 | + | let newBoostInterest = (boostInterest + (if ((poolVoted > 0)) | |
258 | + | then fraction(calcBoostRwd(pool, reward), scaleValue, poolVoted) | |
259 | + | else 0)) | |
260 | + | let newBoostLPInterest = (boostLpInterest + (if (if ((poolVoted > 0)) | |
261 | + | then (shareTokenLocked > 0) | |
262 | + | else false) | |
263 | + | then (fraction(calcBoostRwd(pool, reward), scaleValue, shareTokenLocked) / poolVoted) | |
264 | + | else 0)) | |
265 | + | $Tuple3(newFarmInterest, newBoostInterest, newBoostLPInterest) | |
306 | 266 | } | |
307 | - | else if (if ((height > rewardUpdateHeight)) | |
308 | - | then (rewardUpdateHeight != poolRewardUpdateHeight) | |
267 | + | else if (if (if ((height > rewardUpdateHeight)) | |
268 | + | then (rewardUpdateHeight == poolRewardUpdateHeight) | |
269 | + | else false) | |
270 | + | then (lastInterestHeight > rewardUpdateHeight) | |
309 | 271 | else false) | |
310 | 272 | then { | |
311 | - | let reward = (previousRewardPerBlock * (height - lastInterestHeight)) | |
312 | - | (lastInterest + fraction(reward, scaleValue, shareTokenLocked)) | |
313 | - | } | |
314 | - | else if (if (if ((height > rewardUpdateHeight)) | |
315 | - | then (rewardUpdateHeight == poolRewardUpdateHeight) | |
316 | - | else false) | |
317 | - | then (lastInterestHeight > rewardUpdateHeight) | |
318 | - | else false) | |
319 | - | then { | |
320 | - | let reward = (currentRewardPerBlock * (height - lastInterestHeight)) | |
321 | - | (lastInterest + fraction(reward, scaleValue, shareTokenLocked)) | |
322 | - | } | |
323 | - | else { | |
324 | - | let rewardAfterLastInterestBeforeReawardUpdate = (previousRewardPerBlock * (rewardUpdateHeight - lastInterestHeight)) | |
325 | - | let interestAfterUpdate = (lastInterest + fraction(rewardAfterLastInterestBeforeReawardUpdate, scaleValue, shareTokenLocked)) | |
326 | - | let reward = (currentRewardPerBlock * (height - rewardUpdateHeight)) | |
327 | - | (interestAfterUpdate + fraction(reward, scaleValue, shareTokenLocked)) | |
328 | - | } | |
329 | - | else if ((rewardUpdateHeight > height)) | |
330 | - | then { | |
331 | - | let reward = (previousRewardPerBlock * (height - lastInterestHeight)) | |
332 | - | (lastInterest + fraction(reward, scaleValue, shareTokenLocked)) | |
333 | - | } | |
334 | - | else if ((lastInterestHeight > rewardUpdateHeight)) | |
335 | - | then { | |
336 | 273 | let reward = (currentRewardPerBlock * (height - lastInterestHeight)) | |
337 | - | (lastInterest + fraction(reward, scaleValue, shareTokenLocked)) | |
274 | + | let newFarmInterest = (farmInterest + fraction(calcFarmRwd(pool, reward), scaleValue, shareTokenLocked)) | |
275 | + | let newBoostInterest = (boostInterest + (if ((poolVoted > 0)) | |
276 | + | then fraction(calcBoostRwd(pool, reward), scaleValue, poolVoted) | |
277 | + | else 0)) | |
278 | + | let newBoostLPInterest = (boostLpInterest + (if (if ((poolVoted > 0)) | |
279 | + | then (shareTokenLocked > 0) | |
280 | + | else false) | |
281 | + | then (fraction(calcBoostRwd(pool, reward), scaleValue, shareTokenLocked) / poolVoted) | |
282 | + | else 0)) | |
283 | + | $Tuple3(newFarmInterest, newBoostInterest, newBoostLPInterest) | |
338 | 284 | } | |
339 | 285 | else { | |
340 | - | let rewardAfterLastInterestBeforeReawardUpdate = (previousRewardPerBlock * (rewardUpdateHeight - lastInterestHeight)) | |
341 | - | let interestAfterUpdate = (lastInterest + fraction(rewardAfterLastInterestBeforeReawardUpdate, scaleValue, shareTokenLocked)) | |
286 | + | let rwdBfrUpd = (previousRewardPerBlock * (rewardUpdateHeight - lastInterestHeight)) | |
287 | + | let framIntrAftrUp = (farmInterest + fraction(calcFarmRwd(pool, rwdBfrUpd), scaleValue, shareTokenLocked)) | |
288 | + | let boostIntrAftrUp = (boostInterest + (if ((poolVoted > 0)) | |
289 | + | then fraction(calcBoostRwd(pool, rwdBfrUpd), scaleValue, poolVoted) | |
290 | + | else 0)) | |
291 | + | let bostLPIntrAftrUp = (farmInterest + (if (if ((poolVoted > 0)) | |
292 | + | then (shareTokenLocked > 0) | |
293 | + | else false) | |
294 | + | then fraction(calcBoostRwd(pool, rwdBfrUpd), scaleValue, poolVoted) | |
295 | + | else 0)) | |
342 | 296 | let reward = (currentRewardPerBlock * (height - rewardUpdateHeight)) | |
343 | - | (interestAfterUpdate + fraction(reward, scaleValue, shareTokenLocked)) | |
297 | + | let newFarmInterest = (framIntrAftrUp + fraction(calcFarmRwd(pool, reward), scaleValue, shareTokenLocked)) | |
298 | + | let newBoostInterest = (boostIntrAftrUp + (if ((poolVoted > 0)) | |
299 | + | then fraction(calcBoostRwd(pool, reward), scaleValue, poolVoted) | |
300 | + | else 0)) | |
301 | + | let newBoostLPInterest = (bostLPIntrAftrUp + (if (if ((poolVoted > 0)) | |
302 | + | then (shareTokenLocked > 0) | |
303 | + | else false) | |
304 | + | then (fraction(calcBoostRwd(pool, reward), scaleValue, shareTokenLocked) / poolVoted) | |
305 | + | else 0)) | |
306 | + | $Tuple3(newFarmInterest, newBoostInterest, newBoostLPInterest) | |
344 | 307 | } | |
345 | 308 | ||
346 | 309 | ||
347 | - | func claimCalc (pool,caller,pmtAmount) = { | |
348 | - | let shareAssetId = getShareAssetId(pool) | |
349 | - | let scaleValue = calcScaleValue(SWOP, shareAssetId) | |
350 | - | let shareTokenLocked = getTotalShareTokenLocked(pool) | |
351 | - | let $t01352213587 = getLastInterestInfo(pool) | |
352 | - | let lastInterestHeight = $t01352213587._1 | |
353 | - | let lastInterest = $t01352213587._2 | |
354 | - | let $t01359213704 = rewardInfo(pool) | |
355 | - | let currentRewardPerBlock = $t01359213704._1 | |
356 | - | let rewardUpdateHeight = $t01359213704._2 | |
357 | - | let previousRewardPerBlock = $t01359213704._3 | |
358 | - | let poolRewardUpdateHeight = $t01359213704._4 | |
359 | - | let $t01370913788 = getUserInterestInfo(pool, caller) | |
360 | - | let userLastInterest = $t01370913788._1 | |
361 | - | let userShareTokensAmount = $t01370913788._2 | |
362 | - | let currentInterest = calcInterest(lastInterestHeight, rewardUpdateHeight, poolRewardUpdateHeight, lastInterest, currentRewardPerBlock, shareTokenLocked, previousRewardPerBlock, shareAssetId, scaleValue, pmtAmount) | |
363 | - | let claimAmount = fraction(userShareTokensAmount, (currentInterest - userLastInterest), scaleValue) | |
364 | - | let userNewInterest = currentInterest | |
365 | - | $Tuple4(userNewInterest, currentInterest, claimAmount, userShareTokensAmount) | |
310 | + | func claimCalc (pool,user) = { | |
311 | + | let scaleValue = calcScaleValue(SWOP, getShareAssetId(pool)) | |
312 | + | let poolVoted = getPoolVoted(pool) | |
313 | + | let uPoolVoted = getUserPoolVoted(pool, user) | |
314 | + | let shareTokenStaked = getTotalShareTokenStaked(pool) | |
315 | + | let totalShareVirtual = valueOrElse(getInteger(this, (pool + kShareTokensVirtual)), shareTokenStaked) | |
316 | + | let $t01420114299 = getLastInterestInfo(pool) | |
317 | + | let lastInterestHeight = $t01420114299._1 | |
318 | + | let farmInterest = $t01420114299._2 | |
319 | + | let boostInterest = $t01420114299._3 | |
320 | + | let boostLPInterest = $t01420114299._4 | |
321 | + | let $t01430414418 = rewardInfo(pool) | |
322 | + | let currentRewardPerBlock = $t01430414418._1 | |
323 | + | let rewardUpdateHeight = $t01430414418._2 | |
324 | + | let previousRewardPerBlock = $t01430414418._3 | |
325 | + | let poolRewardUpdateHeight = $t01430414418._4 | |
326 | + | let uFarmInterest = valueOrElse(getInteger(this, (((pool + "_") + user) + kFarmUserLastInterest)), farmInterest) | |
327 | + | let uBoostInterest = valueOrElse(getInteger(this, (((pool + "_") + user) + kBoostUserLastInterest)), boostInterest) | |
328 | + | let uBoostLPInterest = valueOrElse(getInteger(this, (((pool + "_") + user) + kBoostLPUserLastInterest)), boostLPInterest) | |
329 | + | let uShareTokensStaked = valueOrElse(getInteger(this, (((pool + "_") + user) + kUserShareTokensStaked)), 0) | |
330 | + | let uShareTokensVirt = valueOrElse(getInteger(this, (((pool + "_") + user) + kUserShareTokensVirtual)), uShareTokensStaked) | |
331 | + | let $t01498615378 = calcInterest(pool, lastInterestHeight, rewardUpdateHeight, poolRewardUpdateHeight, farmInterest, boostInterest, poolVoted, boostLPInterest, currentRewardPerBlock, shareTokenStaked, previousRewardPerBlock, scaleValue) | |
332 | + | let newFarmInterest = $t01498615378._1 | |
333 | + | let newBoostInterest = $t01498615378._2 | |
334 | + | let newBoostLPInterest = $t01498615378._3 | |
335 | + | let claimFarming = fraction(uShareTokensVirt, (newFarmInterest - uFarmInterest), scaleValue) | |
336 | + | let claimBoostingMax = fraction(uPoolVoted, (newBoostInterest - uBoostInterest), scaleValue) | |
337 | + | let claimBoosting = fraction((uShareTokensVirt * uPoolVoted), (newBoostLPInterest - uBoostLPInterest), scaleValue) | |
338 | + | let toTreasury = (claimBoostingMax - claimBoosting) | |
339 | + | $Tuple5(newFarmInterest, newBoostInterest, newBoostLPInterest, (claimFarming + claimBoosting), toTreasury) | |
366 | 340 | } | |
367 | 341 | ||
368 | 342 | ||
369 | - | func calculateProtocolReward (pool) = { | |
370 | - | let $t01430614371 = getLastInterestInfo(pool) | |
371 | - | let lastInterestHeight = $t01430614371._1 | |
372 | - | let lastInterest = $t01430614371._2 | |
373 | - | let $t01437614487 = rewardInfo(pool) | |
374 | - | let currentRewardPerBlock = $t01437614487._1 | |
375 | - | let rewardUpdateHeight = $t01437614487._2 | |
376 | - | let previousRewardPerBlock = $t01437614487._3 | |
377 | - | let poolRewardUpdateHeight = $t01437614487._4 | |
378 | - | let shareTokenLocked = getTotalShareTokenLocked(pool) | |
379 | - | if (if ((shareTokenLocked == 0)) | |
380 | - | then (poolRewardUpdateHeight == 0) | |
381 | - | else false) | |
382 | - | then if ((rewardUpdateHeight > height)) | |
383 | - | then { | |
384 | - | let reward = (previousRewardPerBlock * (height - lastInterestHeight)) | |
385 | - | reward | |
386 | - | } | |
387 | - | else if ((lastInterestHeight > rewardUpdateHeight)) | |
388 | - | then { | |
389 | - | let reward = (currentRewardPerBlock * (height - lastInterestHeight)) | |
390 | - | reward | |
391 | - | } | |
392 | - | else { | |
393 | - | let rewardAfterLastInterestBeforeReawardUpdate = (previousRewardPerBlock * (rewardUpdateHeight - lastInterestHeight)) | |
394 | - | let reward = (currentRewardPerBlock * (height - rewardUpdateHeight)) | |
395 | - | (reward + rewardAfterLastInterestBeforeReawardUpdate) | |
396 | - | } | |
397 | - | else if (if ((shareTokenLocked == 0)) | |
398 | - | then (poolRewardUpdateHeight != 0) | |
399 | - | else false) | |
400 | - | then if (if ((rewardUpdateHeight > height)) | |
401 | - | then (rewardUpdateHeight == poolRewardUpdateHeight) | |
402 | - | else false) | |
403 | - | then { | |
404 | - | let reward = (previousRewardPerBlock * (height - lastInterestHeight)) | |
405 | - | reward | |
406 | - | } | |
407 | - | else if (if ((height > rewardUpdateHeight)) | |
408 | - | then (rewardUpdateHeight != poolRewardUpdateHeight) | |
409 | - | else false) | |
410 | - | then { | |
411 | - | let reward = (previousRewardPerBlock * (height - lastInterestHeight)) | |
412 | - | reward | |
413 | - | } | |
414 | - | else if (if (if ((height > rewardUpdateHeight)) | |
415 | - | then (rewardUpdateHeight == poolRewardUpdateHeight) | |
416 | - | else false) | |
417 | - | then (lastInterestHeight > rewardUpdateHeight) | |
418 | - | else false) | |
419 | - | then { | |
420 | - | let reward = (currentRewardPerBlock * (height - lastInterestHeight)) | |
421 | - | reward | |
422 | - | } | |
423 | - | else { | |
424 | - | let rewardAfterLastInterestBeforeReawardUpdate = (previousRewardPerBlock * (rewardUpdateHeight - lastInterestHeight)) | |
425 | - | let reward = (currentRewardPerBlock * (height - rewardUpdateHeight)) | |
426 | - | (reward + rewardAfterLastInterestBeforeReawardUpdate) | |
427 | - | } | |
428 | - | else 0 | |
343 | + | func canLockInFirstHarvest (pool,user,userShareTokensStaked,pmtAmount,lockType) = if ((height > getHeightFirstHarvest(pool))) | |
344 | + | then { | |
345 | + | let totalVoteAmount = valueOrElse(getInteger(votingAddress, (pool + kHarvestPoolVote)), 0) | |
346 | + | let userVoteAmount = valueOrElse(getInteger(votingAddress, (((user + "_") + pool) + kHarvestPoolVote)), 0) | |
347 | + | let FHShareTokenLimit = getFHShareLimitToken(addressFromStringValue(pool)) | |
348 | + | let FHShareTokenUserLimit = (fraction(FHShareTokenLimit, userVoteAmount, totalVoteAmount) - userShareTokensStaked) | |
349 | + | if ((lockType > 0)) | |
350 | + | then throw("You can't lock shareTokens till first harvest end.") | |
351 | + | else if ((userVoteAmount == 0)) | |
352 | + | then throw("You can't lock shareTokens because you didn't vote in first harvest") | |
353 | + | else if ((pmtAmount > FHShareTokenUserLimit)) | |
354 | + | then throw(("You can't lock more than you vote in first harvest. Your can lock " + toString(FHShareTokenUserLimit))) | |
355 | + | else true | |
356 | + | } | |
357 | + | else true | |
358 | + | ||
359 | + | ||
360 | + | func getLockParams (type) = { | |
361 | + | let lockParams = split(valueOrErrorMessage(getString(this, (toString(type) + kLockParams)), ("There are no key for lock type" + toString(type))), "_") | |
362 | + | $Tuple2(parseIntValue(lockParams[0]), parseIntValue(lockParams[1])) | |
429 | 363 | } | |
430 | 364 | ||
431 | 365 | ||
432 | - | func checkPmtAssetIdCorrect (pool,pmtAssetId) = { | |
433 | - | let poolShareAssetId = fromBase58String(getStringValue(value(addressFromString(pool)), "share_asset_id")) | |
434 | - | if ((pmtAssetId == poolShareAssetId)) | |
435 | - | then true | |
436 | - | else false | |
437 | - | } | |
366 | + | func suspend (cause) = [BooleanEntry(kActive, false), StringEntry(kCause, cause)] | |
438 | 367 | ||
439 | 368 | ||
440 | - | func getUserSWOPClaimedAmount (pool,user) = valueOrElse(getInteger(this, (((pool + "_") + toString(user)) + keyUserSWOPClaimedAmount)), 0) | |
369 | + | func isActive () = if (active) | |
370 | + | then unit | |
371 | + | else throw("DApp is inactive at this moment") | |
441 | 372 | ||
442 | 373 | ||
443 | - | func suspend (cause) = [BooleanEntry(keyActive, false), StringEntry(keyCause, cause)] | |
374 | + | func isAdminCall (i) = if (containsElement([adminPubKey1, adminPubKey2, adminPubKey3], i.callerPublicKey)) | |
375 | + | then unit | |
376 | + | else throw("Only admin can call this function") | |
444 | 377 | ||
445 | 378 | ||
446 | 379 | @Callable(i) | |
447 | - | func init (earlyLP) = if (isDefined(getString(this, | |
380 | + | func init (earlyLP) = if (isDefined(getString(this, kSWOPid))) | |
448 | 381 | then throw("SWOP already initialized") | |
449 | 382 | else { | |
450 | 383 | let initAmount = 100000000000000 | |
451 | 384 | let SWOPissue = Issue("SWOP", "SWOP protocol token", initAmount, 8, true) | |
452 | 385 | let SWOPid = calculateAssetId(SWOPissue) | |
453 | - | [BooleanEntry( | |
386 | + | [BooleanEntry(kActive, true), Issue("SWOP", "SWOP protocol token", initAmount, 8, true), StringEntry(kSWOPid, toBase58String(SWOPid))] | |
454 | 387 | } | |
455 | 388 | ||
456 | 389 | ||
457 | 390 | ||
458 | 391 | @Callable(i) | |
459 | - | func initPoolShareFarming (pool) = if ((i.caller != this)) | |
460 | - | then throw("Only the DApp itself can call this function") | |
461 | - | else { | |
462 | - | let $t01746917572 = rewardInfo(pool) | |
463 | - | let currentReward = $t01746917572._1 | |
464 | - | let rewardUpdateHeight = $t01746917572._2 | |
465 | - | let previousRewardPerBlock = $t01746917572._3 | |
466 | - | let poolRewardUpdateHeight = $t01746917572._4 | |
467 | - | [IntegerEntry((pool + keyShareTokensLocked), 0), IntegerEntry((pool + keyLastInterest), 0), IntegerEntry((pool + keyLastInterestHeight), height)] | |
468 | - | } | |
392 | + | func initPoolShareFarming (pool) = valueOrElse(isAdminCall(i), [IntegerEntry((pool + kShareTotalShareTokens), 0), IntegerEntry((pool + kFarmLastInterest), 0), IntegerEntry((pool + kBoostLastInterest), 0), IntegerEntry((pool + kBoostLPLastInterest), 0), IntegerEntry((pool + kLastInterestHeight), height)]) | |
469 | 393 | ||
470 | 394 | ||
471 | 395 | ||
472 | 396 | @Callable(i) | |
473 | - | func updatePoolInterest (pool) = if ((i.caller != moneyBoxAddress)) | |
474 | - | then throw("Only the Admin itself can call this function") | |
475 | - | else if (!(isActive)) | |
476 | - | then throw("DApp is inactive at this moment") | |
477 | - | else { | |
478 | - | let $t01799018123 = claimCalc(pool, addressFromPublicKey(adminInvokePubKey), 0) | |
479 | - | let userNewInterest = $t01799018123._1 | |
480 | - | let currentInterest = $t01799018123._2 | |
481 | - | let claimAmount = $t01799018123._3 | |
482 | - | let userShareTokensAmount = $t01799018123._4 | |
483 | - | let $t01812818231 = rewardInfo(pool) | |
484 | - | let currentReward = $t01812818231._1 | |
485 | - | let rewardUpdateHeight = $t01812818231._2 | |
486 | - | let previousRewardPerBlock = $t01812818231._3 | |
487 | - | let poolRewardUpdateHeight = $t01812818231._4 | |
488 | - | [IntegerEntry((pool + keyLastInterest), userNewInterest), IntegerEntry((pool + keyLastInterestHeight), height)] | |
489 | - | } | |
397 | + | func updatePoolInterest (pool) = valueOrElse(isActive(), if ((i.caller != govAddress)) | |
398 | + | then throw("Only Governance can call this function") | |
399 | + | else { | |
400 | + | let user = toString(addressFromPublicKey(adminInvokePubKey)) | |
401 | + | let $t01853818612 = claimCalc(pool, user) | |
402 | + | let farmInterest = $t01853818612._1 | |
403 | + | let boostInterest = $t01853818612._2 | |
404 | + | let boostLPinterest = $t01853818612._3 | |
405 | + | [IntegerEntry((pool + kFarmLastInterest), farmInterest), IntegerEntry((pool + kBoostLastInterest), boostInterest), IntegerEntry((pool + kBoostLPLastInterest), boostLPinterest), IntegerEntry((pool + kLastInterestHeight), height)] | |
406 | + | }) | |
490 | 407 | ||
491 | 408 | ||
492 | 409 | ||
493 | 410 | @Callable(i) | |
494 | - | func lockShareTokens (pool) = { | |
495 | - | let $t01842318498 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
496 | - | let pmtAmount = $t01842318498._1 | |
497 | - | let pmtAssetId = $t01842318498._2 | |
498 | - | let $t01850318576 = getAssetInfo(pmtAssetId) | |
499 | - | let pmtStrAssetId = $t01850318576._1 | |
500 | - | let pmtAssetName = $t01850318576._2 | |
501 | - | let pmtDecimals = $t01850318576._3 | |
502 | - | let $t01858118698 = claimCalc(pool, i.originCaller, pmtAmount) | |
503 | - | let userNewInterest = $t01858118698._1 | |
504 | - | let currentInterest = $t01858118698._2 | |
505 | - | let claimAmount = $t01858118698._3 | |
506 | - | let userShareTokensAmount = $t01858118698._4 | |
507 | - | let userShareAmountNew = (userShareTokensAmount + pmtAmount) | |
508 | - | let availableFundsNew = (userAvailableSWOP(pool, i.originCaller) + claimAmount) | |
509 | - | let totalShareAmount = getTotalShareTokenLocked(pool) | |
510 | - | let totalShareAmountNew = (totalShareAmount + pmtAmount) | |
511 | - | let userClaimedAmount = getUserSWOPClaimedAmount(pool, i.originCaller) | |
512 | - | let userClaimedAmountNew = (userClaimedAmount + claimAmount) | |
513 | - | let baseEntry = [IntegerEntry((((pool + "_") + toString(i.originCaller)) + keyUserLastInterest), userNewInterest), IntegerEntry((((pool + "_") + toString(i.originCaller)) + keyUserShareTokensLocked), userShareAmountNew), IntegerEntry((pool + keyShareTokensLocked), totalShareAmountNew), IntegerEntry((pool + keyLastInterest), currentInterest), IntegerEntry((pool + keyLastInterestHeight), height), IntegerEntry((((pool + "_") + toString(i.originCaller)) + keyUserSWOPClaimedAmount), userClaimedAmountNew), IntegerEntry((((pool + "_") + toString(i.originCaller)) + keyUserSWOPLastClaimedAmount), claimAmount), IntegerEntry((((pool + "_") + toString(i.originCaller)) + keyAvailableSWOP), availableFundsNew)] | |
514 | - | let uplp = if ((getString(Address(fromBase58String(pool)), "version") == "3.0.0")) | |
515 | - | then invoke(lpFarmingAddress, "updateUserInterest", [pool, userShareAmountNew], nil) | |
516 | - | else 0 | |
517 | - | if ((uplp == uplp)) | |
518 | - | then if ((0 >= pmtAmount)) | |
519 | - | then throw("You can't lock token") | |
520 | - | else if (!(isActive)) | |
521 | - | then throw("DApp is inactive at this moment") | |
522 | - | else if (!(checkPmtAssetIdCorrect(pool, pmtAssetId))) | |
523 | - | then throw("Incorrect pmtAssetId") | |
524 | - | else if (if (isFirstHarvest(Address(fromBase58String(pool)))) | |
525 | - | then (getHeightFirstHarvest(Address(fromBase58String(pool))) > height) | |
526 | - | else false) | |
527 | - | then { | |
528 | - | let harvestPeriod = ((((getHeightFirstHarvest(Address(fromBase58String(pool))) - startHeight) + 1) / periodLength) - 1) | |
529 | - | let amountOfVoting = split(getStringValue(votingAddress, (((toString(i.originCaller) + "_") + pool) + "_user_pool_struc")), "_") | |
530 | - | let amountPoolStract = split(getStringValue(votingAddress, (pool + "_pool_struc")), "_") | |
531 | - | let amountActiveVoteUserPoolStract = split(valueOrElse(getString(votingAddress, (((toString(i.originCaller) + "_") + pool) + kHarvestUserPoolActiveVoteStrucVoting)), ""), "_") | |
532 | - | let amountPoolActiveVoteStract = split(valueOrElse(getString(votingAddress, (pool + kHarvestPoolActiveVoteStrucVoting)), ""), "_") | |
533 | - | let userShareTokenLocked = userShareTokensAmount | |
534 | - | let userPoolActiveVote = if ((toString(currPeriod) == amountOfVoting[2])) | |
535 | - | then valueOrElse(parseInt(amountActiveVoteUserPoolStract[0]), 0) | |
536 | - | else valueOrElse(parseInt(amountOfVoting[1]), 0) | |
537 | - | let poolActiveVote = if ((toString(currPeriod) == amountPoolStract[2])) | |
538 | - | then valueOrElse(parseInt(amountPoolActiveVoteStract[0]), 0) | |
539 | - | else valueOrElse(parseInt(amountPoolStract[1]), 0) | |
540 | - | let protocolReward = calculateProtocolReward(pool) | |
541 | - | if ((userPoolActiveVote != 0)) | |
542 | - | then { | |
543 | - | let limitShareToken = getShareLimitToken(addressFromStringValue(pool)) | |
544 | - | let shareToken = (fraction(limitShareToken, userPoolActiveVote, poolActiveVote) - userShareTokenLocked) | |
545 | - | if (if ((size(amountActiveVoteUserPoolStract) > 1)) | |
546 | - | then (valueOrElse(parseInt(amountActiveVoteUserPoolStract[1]), 0) >= harvestPeriod) | |
547 | - | else false) | |
548 | - | then throw("You can't share token") | |
549 | - | else if ((pmtAmount > limitShareToken)) | |
550 | - | then throw(("You can't share token more than " + toString(limitShareToken))) | |
551 | - | else if ((shareToken > 0)) | |
552 | - | then if ((fraction(99, accountBalance(pmtAssetId), 100) > totalShareAmountNew)) | |
553 | - | then throw("Balance of share-token is greater than totalAmount") | |
554 | - | else if ((totalShareAmount == 0)) | |
555 | - | then (baseEntry ++ [Reissue(SWOP, protocolReward, true), ScriptTransfer(moneyBoxAddress, protocolReward, SWOP)]) | |
556 | - | else if ((shareToken >= pmtAmount)) | |
557 | - | then baseEntry | |
558 | - | else throw(("Your maximum share token is " + toString(shareToken))) | |
559 | - | else throw("You can't share token") | |
560 | - | } | |
561 | - | else throw("Your amount of token less than 0") | |
562 | - | } | |
563 | - | else baseEntry | |
564 | - | else throw("Strict value is not equal to itself.") | |
565 | - | } | |
411 | + | func lockShareTokens (pool,lockType) = valueOrElse(isActive(), { | |
412 | + | let shareAssetId = getShareAssetId(pool) | |
413 | + | let user = toString(i.originCaller) | |
414 | + | let totalShareStaked = getTotalShareTokenStaked(pool) | |
415 | + | let totalShareVirtual = valueOrElse(getInteger(this, (pool + kShareTokensVirtual)), totalShareStaked) | |
416 | + | let userStakedAmount = valueOrElse(getInteger(this, (((pool + "_") + user) + kUserShareTokensStaked)), 0) | |
417 | + | let userLockedHeigt = valueOrElse(getInteger(this, (((pool + "_") + user) + kUserShareTokensLockedHeight)), 0) | |
418 | + | let userLockedAmount = valueOrElse(getInteger(this, (((pool + "_") + user) + kUserShareTokensLocked)), 0) | |
419 | + | let userAmountVirtual = valueOrElse(getInteger(this, (((pool + "_") + user) + kUserShareTokensVirtual)), userStakedAmount) | |
420 | + | let totalShareStakedNew = (totalShareStaked + i.payments[0].amount) | |
421 | + | let totalUserShareTokens = ((userStakedAmount + userLockedAmount) + i.payments[0].amount) | |
422 | + | let $t01980919861 = getLockParams(lockType) | |
423 | + | let lockPeriod = $t01980919861._1 | |
424 | + | let lockCoef = $t01980919861._2 | |
425 | + | let lockWavesFee = getIntegerValue(this, kLockWavesFee) | |
426 | + | if ((0 >= i.payments[0].amount)) | |
427 | + | then throw("Payment amount must be greater than 0") | |
428 | + | else if ((0 > lockType)) | |
429 | + | then throw("lockType must be >= 0") | |
430 | + | else if ((accountBalance(shareAssetId) > totalShareStakedNew)) | |
431 | + | then throw("Balance of share-token is lower than totalAmount") | |
432 | + | else if (!(canLockInFirstHarvest(pool, user, userStakedAmount, i.payments[0].amount, lockType))) | |
433 | + | then throw() | |
434 | + | else { | |
435 | + | let $t02031321949 = if ((lockType == 0)) | |
436 | + | then { | |
437 | + | let userAmountVirtualNew = (userAmountVirtual + i.payments[0].amount) | |
438 | + | $Tuple2([IntegerEntry((((pool + "_") + user) + kUserShareTokensStaked), (userStakedAmount + i.payments[0].amount)), IntegerEntry((pool + kShareTokensVirtual), (totalShareVirtual + i.payments[0].amount))], userAmountVirtualNew) | |
439 | + | } | |
440 | + | else if (if ((userLockedHeigt == 0)) | |
441 | + | then if (if ((2 > size(i.payments))) | |
442 | + | then true | |
443 | + | else (i.payments[1].assetId != unit)) | |
444 | + | then true | |
445 | + | else (lockWavesFee > i.payments[1].amount) | |
446 | + | else false) | |
447 | + | then throw((("You need to pay additional waves comission " + toString(lockWavesFee)) + "WAVES")) | |
448 | + | else if ((userLockedHeigt > (height + lockPeriod))) | |
449 | + | then throw("You cannot lock sharetokens for a period less than what you have already locked") | |
450 | + | else { | |
451 | + | let userLockedAmountNew = (userLockedAmount + i.payments[0].amount) | |
452 | + | let userLockedHeigtNew = (height + lockPeriod) | |
453 | + | let userAmountVirtualNew = (fraction(userLockedAmountNew, lockCoef, lockBoostCoefScale) + userStakedAmount) | |
454 | + | $Tuple2([IntegerEntry((((pool + "_") + user) + kUserShareTokensLocked), userLockedAmountNew), IntegerEntry((((pool + "_") + user) + kUserShareTokensLockedHeight), userLockedHeigtNew), IntegerEntry((((pool + "_") + user) + kUserShareTokensLockedType), lockType), IntegerEntry((((pool + "_") + user) + kUserShareTokensVirtual), userAmountVirtualNew), IntegerEntry((pool + kShareTokensVirtual), ((totalShareVirtual - userAmountVirtual) + userAmountVirtualNew))], userAmountVirtualNew) | |
455 | + | } | |
456 | + | let lockEntries = $t02031321949._1 | |
457 | + | let userAmountVirtualNew = $t02031321949._2 | |
458 | + | let $t02195522054 = claimCalc(pool, user) | |
459 | + | let farmInterest = $t02195522054._1 | |
460 | + | let boostInterest = $t02195522054._2 | |
461 | + | let boostLPinterest = $t02195522054._3 | |
462 | + | let claimAmount = $t02195522054._4 | |
463 | + | let toTreasure = $t02195522054._5 | |
464 | + | let availableFundsNew = (userAvailableSWOP(pool, i.originCaller) + claimAmount) | |
465 | + | let uplp = if ((getString(Address(fromBase58String(pool)), "version") == "3.0.0")) | |
466 | + | then invoke(lpFarmingAddress, "updateUserInterest", [pool, totalUserShareTokens], nil) | |
467 | + | else 0 | |
468 | + | if ((uplp == uplp)) | |
469 | + | then ([IntegerEntry((((pool + "_") + user) + kFarmUserLastInterest), farmInterest), IntegerEntry((((pool + "_") + user) + kBoostUserLastInterest), boostInterest), IntegerEntry((((pool + "_") + user) + kBoostLPLastInterest), boostLPinterest), IntegerEntry((pool + kFarmLastInterest), farmInterest), IntegerEntry((pool + kBoostLastInterest), boostInterest), IntegerEntry((pool + kBoostLPLastInterest), boostLPinterest), IntegerEntry((pool + kLastInterestHeight), height), IntegerEntry((pool + kShareTotalShareTokens), totalShareStakedNew), IntegerEntry((((pool + "_") + user) + kAvailableSWOP), availableFundsNew), Reissue(SWOP, toTreasure, true), ScriptTransfer(airdropMoneyBoxAddr, toTreasure, SWOP)] ++ lockEntries) | |
470 | + | else throw("Strict value is not equal to itself.") | |
471 | + | } | |
472 | + | }) | |
566 | 473 | ||
567 | 474 | ||
568 | 475 | ||
569 | 476 | @Callable(i) | |
570 | - | func withdrawShareTokens (pool,shareTokensWithdrawAmount) = { | |
571 | - | let shareTokensId = fromBase58String(getStringValue(value(addressFromString(pool)), "share_asset_id")) | |
572 | - | let $t02331023421 = claimCalc(pool, i.originCaller, 1) | |
573 | - | let userNewInterest = $t02331023421._1 | |
574 | - | let currentInterest = $t02331023421._2 | |
575 | - | let claimAmount = $t02331023421._3 | |
576 | - | let userShareTokensAmount = $t02331023421._4 | |
577 | - | let userShareAmountNew = (userShareTokensAmount - shareTokensWithdrawAmount) | |
578 | - | let availableFundsNew = (userAvailableSWOP(pool, i.originCaller) + claimAmount) | |
579 | - | let totalShareAmount = getTotalShareTokenLocked(pool) | |
580 | - | let totalShareAmountNew = (totalShareAmount - shareTokensWithdrawAmount) | |
581 | - | let userClaimedAmount = getUserSWOPClaimedAmount(pool, i.originCaller) | |
582 | - | let userClaimedAmountNew = (userClaimedAmount + claimAmount) | |
583 | - | if ((shareTokensWithdrawAmount > userShareTokensAmount)) | |
584 | - | then throw("Withdraw amount more then user locked amount") | |
585 | - | else if (!(isActive)) | |
586 | - | then throw("DApp is inactive at this moment") | |
587 | - | else if ((shareTokensWithdrawAmount > userShareTokensAmount)) | |
588 | - | then throw("Withdraw amount more then user locked amount") | |
589 | - | else if ((fraction(99, (accountBalance(shareTokensId) - shareTokensWithdrawAmount), 100) > totalShareAmountNew)) | |
590 | - | then throw("Balance of share-token is greater than totalAmount") | |
591 | - | else { | |
592 | - | let uplp = if ((getString(Address(fromBase58String(pool)), "version") == "3.0.0")) | |
593 | - | then invoke(lpFarmingAddress, "updateUserInterest", [pool, userShareAmountNew], nil) | |
594 | - | else 0 | |
595 | - | if ((uplp == uplp)) | |
596 | - | then [IntegerEntry((((pool + "_") + toString(i.originCaller)) + keyUserLastInterest), userNewInterest), IntegerEntry((((pool + "_") + toString(i.originCaller)) + keyUserShareTokensLocked), userShareAmountNew), IntegerEntry((pool + keyLastInterest), currentInterest), IntegerEntry((pool + keyLastInterestHeight), height), IntegerEntry((pool + keyShareTokensLocked), totalShareAmountNew), IntegerEntry((((pool + "_") + toString(i.originCaller)) + keyAvailableSWOP), availableFundsNew), IntegerEntry((((pool + "_") + toString(i.originCaller)) + keyUserSWOPClaimedAmount), userClaimedAmountNew), IntegerEntry((((pool + "_") + toString(i.originCaller)) + keyUserSWOPLastClaimedAmount), claimAmount), ScriptTransfer(i.caller, shareTokensWithdrawAmount, shareTokensId)] | |
597 | - | else throw("Strict value is not equal to itself.") | |
598 | - | } | |
599 | - | } | |
477 | + | func lockStakedShareTokens (pool,lockType,lockAmount) = valueOrElse(isActive(), { | |
478 | + | let shareAssetId = getShareAssetId(pool) | |
479 | + | let user = toString(i.originCaller) | |
480 | + | let totalShareStaked = getTotalShareTokenStaked(pool) | |
481 | + | let totalShareVirtual = valueOrElse(getInteger(this, (pool + kShareTokensVirtual)), totalShareStaked) | |
482 | + | let userStakedAmount = valueOrElse(getInteger(this, (((pool + "_") + user) + kUserShareTokensStaked)), 0) | |
483 | + | let userLockedHeigt = valueOrElse(getInteger(this, (((pool + "_") + user) + kUserShareTokensLockedHeight)), 0) | |
484 | + | let userLockedAmount = valueOrElse(getInteger(this, (((pool + "_") + user) + kUserShareTokensLocked)), 0) | |
485 | + | let userAmountVirtual = valueOrElse(getInteger(this, (((pool + "_") + user) + kUserShareTokensVirtual)), userStakedAmount) | |
486 | + | let totalUserShareTokens = (userStakedAmount + userLockedAmount) | |
487 | + | let $t02398624038 = getLockParams(lockType) | |
488 | + | let lockPeriod = $t02398624038._1 | |
489 | + | let lockCoef = $t02398624038._2 | |
490 | + | let lockWavesFee = getIntegerValue(this, kLockWavesFee) | |
491 | + | if ((height > getHeightFirstHarvest(pool))) | |
492 | + | then throw("You can't lock shareTokens till first harvest end.") | |
493 | + | else if ((lockType > 0)) | |
494 | + | then throw("lockType must be > 0") | |
495 | + | else if ((lockAmount > userStakedAmount)) | |
496 | + | then throw(("You can't lock more than " + toString(userStakedAmount))) | |
497 | + | else if ((accountBalance(shareAssetId) > totalShareStaked)) | |
498 | + | then throw("Balance of share-token is lower than totalAmount") | |
499 | + | else if (if ((userLockedHeigt == 0)) | |
500 | + | then if (if ((1 > size(i.payments))) | |
501 | + | then true | |
502 | + | else (i.payments[0].assetId != unit)) | |
503 | + | then true | |
504 | + | else (lockWavesFee > i.payments[0].amount) | |
505 | + | else false) | |
506 | + | then throw((("You need to pay additional waves comission " + toString(lockWavesFee)) + "WAVES")) | |
507 | + | else if ((userLockedHeigt > (height + lockPeriod))) | |
508 | + | then throw("You cannot lock sharetokens for a period less than what you have already locked") | |
509 | + | else { | |
510 | + | let userLockedAmountNew = (userLockedAmount + lockAmount) | |
511 | + | let userStakedAmountNew = (userStakedAmount - lockAmount) | |
512 | + | let userLockedHeigtNew = (height + lockPeriod) | |
513 | + | let userAmountVirtualNew = (fraction(userLockedAmountNew, lockCoef, lockBoostCoefScale) + userStakedAmount) | |
514 | + | let lockEntries = [IntegerEntry((((pool + "_") + user) + kUserShareTokensStaked), userStakedAmountNew), IntegerEntry((((pool + "_") + user) + kUserShareTokensLocked), userLockedAmountNew), IntegerEntry((((pool + "_") + user) + kUserShareTokensLockedHeight), userLockedHeigtNew), IntegerEntry((((pool + "_") + user) + kUserShareTokensLockedType), lockType), IntegerEntry((((pool + "_") + user) + kUserShareTokensVirtual), userAmountVirtualNew), IntegerEntry((pool + kShareTokensVirtual), ((totalShareVirtual - userAmountVirtual) + userAmountVirtualNew))] | |
515 | + | let $t02573825837 = claimCalc(pool, user) | |
516 | + | let farmInterest = $t02573825837._1 | |
517 | + | let boostInterest = $t02573825837._2 | |
518 | + | let boostLPinterest = $t02573825837._3 | |
519 | + | let claimAmount = $t02573825837._4 | |
520 | + | let toTreasure = $t02573825837._5 | |
521 | + | let availableFundsNew = (userAvailableSWOP(pool, i.originCaller) + claimAmount) | |
522 | + | [IntegerEntry((((pool + "_") + user) + kFarmUserLastInterest), farmInterest), IntegerEntry((((pool + "_") + user) + kBoostUserLastInterest), boostInterest), IntegerEntry((((pool + "_") + user) + kBoostLPLastInterest), boostLPinterest), IntegerEntry((pool + kFarmLastInterest), farmInterest), IntegerEntry((pool + kBoostLastInterest), boostInterest), IntegerEntry((pool + kBoostLPLastInterest), boostLPinterest), IntegerEntry((pool + kLastInterestHeight), height), IntegerEntry((((pool + "_") + user) + kAvailableSWOP), availableFundsNew), Reissue(SWOP, toTreasure, true), ScriptTransfer(airdropMoneyBoxAddr, toTreasure, SWOP)] | |
523 | + | } | |
524 | + | }) | |
600 | 525 | ||
601 | 526 | ||
602 | 527 | ||
603 | 528 | @Callable(i) | |
604 | - | func claim (pool) = { | |
605 | - | let shareTokensId = fromBase58String(getStringValue(value(addressFromString(pool)), "share_asset_id")) | |
606 | - | let shareTokenLocked = getTotalShareTokenLocked(pool) | |
607 | - | let $t02568925755 = getLastInterestInfo(pool) | |
608 | - | let lastInterestHeight = $t02568925755._1 | |
609 | - | let lastInterest = $t02568925755._2 | |
610 | - | let $t02576025874 = rewardInfo(pool) | |
611 | - | let currentRewardPerBlock = $t02576025874._1 | |
612 | - | let rewardUpdateHeight = $t02576025874._2 | |
613 | - | let previousRewardPerBlock = $t02576025874._3 | |
614 | - | let poolRewardUpdateHeight = $t02576025874._4 | |
615 | - | let $t02587925984 = claimCalc(pool, i.caller, 1) | |
616 | - | let userNewInterest = $t02587925984._1 | |
617 | - | let currentInterest = $t02587925984._2 | |
618 | - | let claimAmount = $t02587925984._3 | |
619 | - | let userShareTokensAmount = $t02587925984._4 | |
620 | - | let availableFund = (userAvailableSWOP(pool, i.caller) + claimAmount) | |
621 | - | let userClaimedAmount = getUserSWOPClaimedAmount(pool, i.caller) | |
622 | - | let userClaimedAmountNew = (userClaimedAmount + claimAmount) | |
623 | - | if ((availableFund == 0)) | |
624 | - | then throw("You have 0 available SWOP") | |
625 | - | else if (!(isActive)) | |
626 | - | then throw("DApp is inactive at this moment") | |
627 | - | else if ((availableFund == 0)) | |
628 | - | then throw("You have 0 available SWOP") | |
629 | - | else if ((fraction(99, accountBalance(shareTokensId), 100) > shareTokenLocked)) | |
630 | - | then throw("Balance of share-token is greater than totalAmount") | |
631 | - | else [IntegerEntry((((pool + "_") + toString(i.caller)) + keyUserLastInterest), userNewInterest), IntegerEntry((pool + keyLastInterest), currentInterest), IntegerEntry((pool + keyLastInterestHeight), height), IntegerEntry((((pool + "_") + toString(i.caller)) + keyAvailableSWOP), 0), Reissue(SWOP, availableFund, true), IntegerEntry((((pool + "_") + toString(i.caller)) + keyUserSWOPClaimedAmount), userClaimedAmountNew), IntegerEntry((((pool + "_") + toString(i.caller)) + keyUserSWOPLastClaimedAmount), claimAmount), ScriptTransfer(i.caller, availableFund, SWOP)] | |
632 | - | } | |
529 | + | func unlockUserLock (pool,user) = valueOrElse(isActive(), { | |
530 | + | let lockWavesFee = getIntegerValue(this, kLockWavesFee) | |
531 | + | let userLockedHeigt = valueOrErrorMessage(getInteger(this, (((pool + "_") + user) + kUserShareTokensLockedHeight)), (((("There is no pool " + pool) + " or user ") + user) + "with lock")) | |
532 | + | let totalShareVirtual = getIntegerValue(this, (pool + kShareTokensVirtual)) | |
533 | + | let userStakedAmount = valueOrElse(getInteger(this, (((pool + "_") + user) + kUserShareTokensStaked)), 0) | |
534 | + | let userLockedAmount = valueOrElse(getInteger(this, (((pool + "_") + user) + kUserShareTokensLocked)), 0) | |
535 | + | let userAmountVirtual = valueOrElse(getInteger(this, (((pool + "_") + user) + kUserShareTokensVirtual)), userStakedAmount) | |
536 | + | if ((userLockedHeigt > height)) | |
537 | + | then throw(("You can't unlock sharetokens till " + toString(userLockedHeigt))) | |
538 | + | else { | |
539 | + | let userStakedAmountNew = (userStakedAmount + userLockedAmount) | |
540 | + | let $t02752527624 = claimCalc(pool, user) | |
541 | + | let farmInterest = $t02752527624._1 | |
542 | + | let boostInterest = $t02752527624._2 | |
543 | + | let boostLPinterest = $t02752527624._3 | |
544 | + | let claimAmount = $t02752527624._4 | |
545 | + | let toTreasure = $t02752527624._5 | |
546 | + | let availableFundsNew = (userAvailableSWOP(pool, i.originCaller) + claimAmount) | |
547 | + | [IntegerEntry((((pool + "_") + user) + kFarmUserLastInterest), farmInterest), IntegerEntry((((pool + "_") + user) + kBoostUserLastInterest), boostInterest), IntegerEntry((((pool + "_") + user) + kBoostLPLastInterest), boostLPinterest), IntegerEntry((pool + kFarmLastInterest), farmInterest), IntegerEntry((pool + kBoostLastInterest), boostInterest), IntegerEntry((pool + kBoostLPLastInterest), boostLPinterest), IntegerEntry((pool + kLastInterestHeight), height), IntegerEntry((((pool + "_") + user) + kUserShareTokensStaked), userStakedAmountNew), IntegerEntry((((pool + "_") + user) + kUserShareTokensVirtual), userStakedAmountNew), IntegerEntry((pool + kShareTokensVirtual), ((totalShareVirtual - userAmountVirtual) + userStakedAmountNew)), DeleteEntry((((pool + "_") + user) + kUserShareTokensLocked)), DeleteEntry((((pool + "_") + user) + kUserShareTokensLockedHeight)), DeleteEntry((((pool + "_") + user) + kUserShareTokensLockedType)), Reissue(SWOP, toTreasure, true), ScriptTransfer(airdropMoneyBoxAddr, toTreasure, SWOP), ScriptTransfer(i.caller, lockWavesFee, unit)] | |
548 | + | } | |
549 | + | }) | |
633 | 550 | ||
634 | 551 | ||
635 | 552 | ||
636 | 553 | @Callable(i) | |
637 | - | func shutdown () = if (!(isActive)) | |
638 | - | then throw(("DApp is already suspended. Cause: " + valueOrElse(getString(this, keyCause), "the cause wasn't specified"))) | |
639 | - | else if (!(containsElement([adminPubKey1, adminPubKey2, adminPubKey3], i.callerPublicKey))) | |
640 | - | then throw("Only admin can call this function") | |
641 | - | else suspend("Paused by admin") | |
554 | + | func withdrawShareTokens (pool,shareTokensWithdrawAmount) = valueOrElse(isActive(), { | |
555 | + | let shareTokensId = fromBase58String(getStringValue(value(addressFromString(pool)), "share_asset_id")) | |
556 | + | let user = toString(i.originCaller) | |
557 | + | let $t02912829227 = claimCalc(pool, user) | |
558 | + | let farmInterest = $t02912829227._1 | |
559 | + | let boostInterest = $t02912829227._2 | |
560 | + | let boostLPinterest = $t02912829227._3 | |
561 | + | let claimAmount = $t02912829227._4 | |
562 | + | let toTreasure = $t02912829227._5 | |
563 | + | let userStakedAmount = valueOrElse(getInteger(this, (((pool + "_") + user) + kUserShareTokensStaked)), 0) | |
564 | + | let userLockedAmount = valueOrElse(getInteger(this, (((pool + "_") + user) + kUserShareTokensLocked)), 0) | |
565 | + | let userStakedAmountNew = (userStakedAmount - shareTokensWithdrawAmount) | |
566 | + | let availableFundsNew = (userAvailableSWOP(pool, i.originCaller) + claimAmount) | |
567 | + | let totalShareAmount = getTotalShareTokenStaked(pool) | |
568 | + | let totalShareAmountNew = (totalShareAmount - shareTokensWithdrawAmount) | |
569 | + | if ((shareTokensWithdrawAmount > userStakedAmountNew)) | |
570 | + | then throw("Withdraw amount more then user locked amount") | |
571 | + | else if ((accountBalance(shareTokensId) > totalShareAmount)) | |
572 | + | then throw("Balance of share-token is lower than totalAmount") | |
573 | + | else { | |
574 | + | let uplp = if ((getString(Address(fromBase58String(pool)), "version") == "3.0.0")) | |
575 | + | then invoke(lpFarmingAddress, "updateUserInterest", [pool, (userStakedAmount + userLockedAmount)], nil) | |
576 | + | else 0 | |
577 | + | if ((uplp == uplp)) | |
578 | + | then [IntegerEntry((((pool + "_") + user) + kFarmUserLastInterest), farmInterest), IntegerEntry((((pool + "_") + user) + kBoostUserLastInterest), boostInterest), IntegerEntry((((pool + "_") + user) + kBoostLPLastInterest), boostLPinterest), IntegerEntry((pool + kFarmLastInterest), farmInterest), IntegerEntry((pool + kBoostLastInterest), boostInterest), IntegerEntry((pool + kBoostLPLastInterest), boostLPinterest), IntegerEntry((pool + kLastInterestHeight), height), IntegerEntry((((pool + "_") + user) + kUserShareTokensStaked), userStakedAmountNew), IntegerEntry((pool + kShareTotalShareTokens), totalShareAmountNew), IntegerEntry((((pool + "_") + user) + kAvailableSWOP), availableFundsNew), Reissue(SWOP, toTreasure, true), ScriptTransfer(airdropMoneyBoxAddr, toTreasure, SWOP), ScriptTransfer(i.caller, shareTokensWithdrawAmount, shareTokensId)] | |
579 | + | else throw("Strict value is not equal to itself.") | |
580 | + | } | |
581 | + | }) | |
642 | 582 | ||
643 | 583 | ||
644 | 584 | ||
645 | 585 | @Callable(i) | |
646 | - | func activate () = if (isActive) | |
586 | + | func claim (pool) = valueOrElse(isActive(), { | |
587 | + | let shareTokensId = fromBase58String(getStringValue(value(addressFromString(pool)), "share_asset_id")) | |
588 | + | let user = toString(i.caller) | |
589 | + | let shareTokenLocked = getTotalShareTokenStaked(pool) | |
590 | + | let $t03137331472 = claimCalc(pool, user) | |
591 | + | let farmInterest = $t03137331472._1 | |
592 | + | let boostInterest = $t03137331472._2 | |
593 | + | let boostLPinterest = $t03137331472._3 | |
594 | + | let claimAmount = $t03137331472._4 | |
595 | + | let toTreasure = $t03137331472._5 | |
596 | + | let availableFund = (userAvailableSWOP(pool, i.caller) + claimAmount) | |
597 | + | if ((availableFund == 0)) | |
598 | + | then throw("You have 0 available SWOP") | |
599 | + | else if ((accountBalance(shareTokensId) > shareTokenLocked)) | |
600 | + | then throw("Balance of share-token is lower than totalAmount") | |
601 | + | else $Tuple2([IntegerEntry((((pool + "_") + user) + kFarmUserLastInterest), farmInterest), IntegerEntry((((pool + "_") + user) + kBoostUserLastInterest), boostInterest), IntegerEntry((((pool + "_") + user) + kBoostLPLastInterest), boostLPinterest), IntegerEntry((pool + kFarmLastInterest), farmInterest), IntegerEntry((pool + kBoostLastInterest), boostInterest), IntegerEntry((pool + kBoostLPLastInterest), boostLPinterest), IntegerEntry((pool + kLastInterestHeight), height), IntegerEntry((((pool + "_") + user) + kAvailableSWOP), 0), Reissue(SWOP, (toTreasure + availableFund), true), ScriptTransfer(airdropMoneyBoxAddr, toTreasure, SWOP), ScriptTransfer(i.caller, availableFund, SWOP)], availableFund) | |
602 | + | }) | |
603 | + | ||
604 | + | ||
605 | + | ||
606 | + | @Callable(i) | |
607 | + | func claimAndStake (pool) = valueOrElse(isActive(), { | |
608 | + | let claimAmount = { | |
609 | + | let @ = invoke(this, "claim", [pool], nil) | |
610 | + | if ($isInstanceOf(@, "Int")) | |
611 | + | then @ | |
612 | + | else throw(($getType(@) + " couldn't be cast to Int")) | |
613 | + | } | |
614 | + | if ((claimAmount == claimAmount)) | |
615 | + | then { | |
616 | + | let stakeToGov = invoke(govAddress, "lockSWOPFromFarming", nil, [AttachedPayment(SWOP, claimAmount)]) | |
617 | + | if ((stakeToGov == stakeToGov)) | |
618 | + | then nil | |
619 | + | else throw("Strict value is not equal to itself.") | |
620 | + | } | |
621 | + | else throw("Strict value is not equal to itself.") | |
622 | + | }) | |
623 | + | ||
624 | + | ||
625 | + | ||
626 | + | @Callable(i) | |
627 | + | func claimAll (pools) = valueOrElse(isActive(), { | |
628 | + | func claimInv (claimTotal,pool) = { | |
629 | + | let claimAmount = { | |
630 | + | let @ = invoke(this, "claim", [pool], nil) | |
631 | + | if ($isInstanceOf(@, "Int")) | |
632 | + | then @ | |
633 | + | else throw(($getType(@) + " couldn't be cast to Int")) | |
634 | + | } | |
635 | + | if ((claimAmount == claimAmount)) | |
636 | + | then (claimTotal + claimAmount) | |
637 | + | else throw("Strict value is not equal to itself.") | |
638 | + | } | |
639 | + | ||
640 | + | let claimTotal = { | |
641 | + | let $l = pools | |
642 | + | let $s = size($l) | |
643 | + | let $acc0 = 0 | |
644 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
645 | + | then $a | |
646 | + | else claimInv($a, $l[$i]) | |
647 | + | ||
648 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
649 | + | then $a | |
650 | + | else throw("List size exceeds 60") | |
651 | + | ||
652 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 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), 57), 58), 59), 60) | |
653 | + | } | |
654 | + | if ((claimTotal == 0)) | |
655 | + | then throw("You have 0 available SWOP") | |
656 | + | else [ScriptTransfer(i.caller, claimTotal, SWOP)] | |
657 | + | }) | |
658 | + | ||
659 | + | ||
660 | + | ||
661 | + | @Callable(i) | |
662 | + | func claimAllAndStake (pools) = valueOrElse(isActive(), { | |
663 | + | func claimInv (claimTotal,pool) = { | |
664 | + | let claimAmount = { | |
665 | + | let @ = invoke(this, "claim", [pool], nil) | |
666 | + | if ($isInstanceOf(@, "Int")) | |
667 | + | then @ | |
668 | + | else throw(($getType(@) + " couldn't be cast to Int")) | |
669 | + | } | |
670 | + | if ((claimAmount == claimAmount)) | |
671 | + | then (claimTotal + claimAmount) | |
672 | + | else throw("Strict value is not equal to itself.") | |
673 | + | } | |
674 | + | ||
675 | + | let claimTotal = { | |
676 | + | let $l = pools | |
677 | + | let $s = size($l) | |
678 | + | let $acc0 = 0 | |
679 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
680 | + | then $a | |
681 | + | else claimInv($a, $l[$i]) | |
682 | + | ||
683 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
684 | + | then $a | |
685 | + | else throw("List size exceeds 60") | |
686 | + | ||
687 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 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), 57), 58), 59), 60) | |
688 | + | } | |
689 | + | if ((claimTotal == 0)) | |
690 | + | then throw("You have 0 available SWOP") | |
691 | + | else { | |
692 | + | let stakeToGov = invoke(govAddress, "lockSWOPFromFarming", nil, [AttachedPayment(SWOP, claimTotal)]) | |
693 | + | if ((stakeToGov == stakeToGov)) | |
694 | + | then nil | |
695 | + | else throw("Strict value is not equal to itself.") | |
696 | + | } | |
697 | + | }) | |
698 | + | ||
699 | + | ||
700 | + | ||
701 | + | @Callable(i) | |
702 | + | func updateUserBoostInterest (pool,user) = valueOrElse(isActive(), if ((i.caller != votingAddress)) | |
703 | + | then throw("Only voiting can call this function") | |
704 | + | else { | |
705 | + | let $t03385233951 = claimCalc(pool, user) | |
706 | + | let farmInterest = $t03385233951._1 | |
707 | + | let boostInterest = $t03385233951._2 | |
708 | + | let boostLPinterest = $t03385233951._3 | |
709 | + | let claimAmount = $t03385233951._4 | |
710 | + | let toTreasure = $t03385233951._5 | |
711 | + | let availableFundsNew = (userAvailableSWOP(pool, i.originCaller) + claimAmount) | |
712 | + | [IntegerEntry((((pool + "_") + user) + kFarmUserLastInterest), farmInterest), IntegerEntry((((pool + "_") + user) + kBoostUserLastInterest), boostInterest), IntegerEntry((((pool + "_") + user) + kBoostLPLastInterest), boostLPinterest), IntegerEntry((pool + kFarmLastInterest), farmInterest), IntegerEntry((pool + kBoostLastInterest), boostInterest), IntegerEntry((pool + kBoostLPLastInterest), boostLPinterest), IntegerEntry((pool + kLastInterestHeight), height), IntegerEntry((((pool + "_") + user) + kAvailableSWOP), availableFundsNew), Reissue(SWOP, toTreasure, true), ScriptTransfer(airdropMoneyBoxAddr, toTreasure, SWOP)] | |
713 | + | }) | |
714 | + | ||
715 | + | ||
716 | + | ||
717 | + | @Callable(i) | |
718 | + | func shutdown () = valueOrElse(isAdminCall(i), if (!(active)) | |
719 | + | then throw(("DApp is already suspended. Cause: " + valueOrElse(getString(this, kCause), "the cause wasn't specified"))) | |
720 | + | else suspend("Paused by admin")) | |
721 | + | ||
722 | + | ||
723 | + | ||
724 | + | @Callable(i) | |
725 | + | func activate () = valueOrElse(isAdminCall(i), if (active) | |
647 | 726 | then throw("DApp is already active") | |
648 | - | else if (!(containsElement([adminPubKey1, adminPubKey2, adminPubKey3], i.callerPublicKey))) | |
649 | - | then throw("Only admin can call this function") | |
650 | - | else [BooleanEntry(keyActive, true), DeleteEntry(keyCause)] | |
727 | + | else [BooleanEntry(kActive, true), DeleteEntry(kCause)]) | |
651 | 728 | ||
652 | 729 | ||
653 | 730 | @Verifier(tx) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let | |
4 | + | let kActive = "active" | |
5 | 5 | ||
6 | - | let | |
6 | + | let kCause = "shutdown_cause" | |
7 | 7 | ||
8 | - | let | |
8 | + | let kRewardPoolFractionCurrent = "_current_pool_fraction_reward" | |
9 | 9 | ||
10 | - | let | |
10 | + | let kRewardPoolFractionPrevious = "_previous_pool_fraction_reward" | |
11 | 11 | ||
12 | - | let | |
12 | + | let kHeightPoolFraction = "_pool_reward_update_height" | |
13 | 13 | ||
14 | - | let | |
14 | + | let kTotalRewardPerBlockCurrent = "total_reward_per_block_current" | |
15 | 15 | ||
16 | - | let | |
16 | + | let kTotalRewardPerBlockPrevious = "total_reward_per_block_previous" | |
17 | 17 | ||
18 | - | let | |
18 | + | let kRewardUpdateHeight = "reward_update_height" | |
19 | 19 | ||
20 | - | let | |
20 | + | let kUserShareTokensStaked = "_share_tokens_locked" | |
21 | 21 | ||
22 | - | let | |
22 | + | let kUserShareTokensLocked = "_share_tokens_blocked" | |
23 | 23 | ||
24 | - | let | |
24 | + | let kUserShareTokensLockedType = "_share_tokens_blocked_type" | |
25 | 25 | ||
26 | - | let | |
26 | + | let kUserShareTokensLockedHeight = "_share_tokens_blocked_height" | |
27 | 27 | ||
28 | - | let | |
28 | + | let kUserShareTokensVirtual = "_share_tokens_virtual" | |
29 | 29 | ||
30 | - | let | |
30 | + | let kShareTotalShareTokens = "_total_share_tokens_locked" | |
31 | 31 | ||
32 | - | let | |
32 | + | let kShareTokensVirtual = "_total_share_tokens_virtual" | |
33 | 33 | ||
34 | - | let | |
34 | + | let kLockParams = "_lock_params" | |
35 | 35 | ||
36 | - | let | |
36 | + | let kLockWavesFee = "lock_waves_fee" | |
37 | 37 | ||
38 | - | let | |
38 | + | let kPoolBoostCoef = "_boost_coef" | |
39 | 39 | ||
40 | - | let | |
40 | + | let kFarmLastInterest = "_last_interest" | |
41 | 41 | ||
42 | - | let | |
42 | + | let kFarmUserLastInterest = "_last_interest" | |
43 | 43 | ||
44 | - | let | |
44 | + | let kBoostLastInterest = "_last_interest_b" | |
45 | 45 | ||
46 | - | let | |
46 | + | let kBoostUserLastInterest = "_last_interest_u_b" | |
47 | 47 | ||
48 | - | let | |
48 | + | let kBoostLPLastInterest = "_last_interest_lpb" | |
49 | 49 | ||
50 | - | let | |
50 | + | let kBoostLPUserLastInterest = "_last_interest_u_lpb" | |
51 | 51 | ||
52 | - | let | |
52 | + | let kLastInterestHeight = "_last_interest_height" | |
53 | 53 | ||
54 | - | let | |
54 | + | let kSWOPid = "SWOP_id" | |
55 | 55 | ||
56 | - | let | |
56 | + | let kAvailableSWOP = "_available_SWOP" | |
57 | 57 | ||
58 | - | let | |
58 | + | let kSwopYearEmission = "swop_year_emission" | |
59 | 59 | ||
60 | - | let | |
60 | + | let kHarvestPoolVote = "_harvest_pool_vote_gSWOP" | |
61 | 61 | ||
62 | - | let | |
62 | + | let kPoolVote = "_pool_vote_gSWOP" | |
63 | 63 | ||
64 | - | let | |
64 | + | let kUserPoolVote = "_user_vote_gSWOP" | |
65 | 65 | ||
66 | - | let | |
66 | + | let kHarvestUserPoolVote = "_harvest_user_pool_vote_gSWOP" | |
67 | 67 | ||
68 | - | let | |
68 | + | let kBasePeriod = "base_period" | |
69 | 69 | ||
70 | - | let | |
70 | + | let kPeriodLength = "period_length" | |
71 | 71 | ||
72 | - | let | |
72 | + | let kStartHeight = "start_height" | |
73 | 73 | ||
74 | - | let | |
74 | + | let kFirstHarvestHeight = "first_harvest_height" | |
75 | 75 | ||
76 | - | let scaleValue3 = 1000 | |
77 | - | ||
78 | - | let scaleValue5 = 100000 | |
79 | - | ||
80 | - | let scaleValue6 = 1000000 | |
81 | - | ||
82 | - | let scaleValue8 = 100000000 | |
83 | - | ||
84 | - | let scaleValue11 = 100000000000 | |
76 | + | let kShareLimitFH = "share_limit_on_first_harvest" | |
85 | 77 | ||
86 | 78 | let kAdminPubKey1 = "admin_pub_1" | |
87 | 79 | ||
88 | 80 | let kAdminPubKey2 = "admin_pub_2" | |
89 | 81 | ||
90 | 82 | let kAdminPubKey3 = "admin_pub_3" | |
91 | 83 | ||
92 | 84 | let kAdminInvokePubKey = "admin_invoke_pub" | |
93 | 85 | ||
94 | 86 | let kMoneyBoxAddress = "money_box_address" | |
95 | 87 | ||
96 | 88 | let kVotingAddress = "voting_address" | |
97 | 89 | ||
98 | 90 | let kGovAddress = "governance_address" | |
99 | 91 | ||
100 | 92 | let kLPFarmingAddress = "lp_farming" | |
101 | 93 | ||
94 | + | let kAirdropMoneyBoxAddr = "airdrop_fee_money_box" | |
95 | + | ||
102 | 96 | let oracle = Address(base58'3MvVBtsXroQpy1tsPw21TU2ET9A8WfmrNjz') | |
97 | + | ||
98 | + | let totalVoteShare = 10000000000 | |
99 | + | ||
100 | + | let lockBoostCoefScale = 1000 | |
101 | + | ||
102 | + | let defPoolBoostCoef = 500 | |
103 | 103 | ||
104 | 104 | func getBase58FromOracle (key) = match getString(oracle, key) { | |
105 | 105 | case string: String => | |
106 | 106 | fromBase58String(string) | |
107 | 107 | case nothing => | |
108 | 108 | throw((key + "is empty")) | |
109 | 109 | } | |
110 | 110 | ||
111 | 111 | ||
112 | 112 | let adminPubKey1 = getBase58FromOracle(kAdminPubKey1) | |
113 | 113 | ||
114 | 114 | let adminPubKey2 = getBase58FromOracle(kAdminPubKey2) | |
115 | 115 | ||
116 | 116 | let adminPubKey3 = getBase58FromOracle(kAdminPubKey3) | |
117 | 117 | ||
118 | 118 | let moneyBoxAddress = Address(getBase58FromOracle(kMoneyBoxAddress)) | |
119 | 119 | ||
120 | 120 | let votingAddress = Address(getBase58FromOracle(kVotingAddress)) | |
121 | 121 | ||
122 | 122 | let govAddress = Address(getBase58FromOracle(kGovAddress)) | |
123 | 123 | ||
124 | 124 | let adminInvokePubKey = getBase58FromOracle(kAdminInvokePubKey) | |
125 | 125 | ||
126 | 126 | let lpFarmingAddress = Address(getBase58FromOracle(kLPFarmingAddress)) | |
127 | 127 | ||
128 | - | func strAssetIdA (pool) = getStringValue(pool, keyAssetIdA) | |
129 | - | ||
130 | - | ||
131 | - | func strAssetIdB (pool) = getStringValue(pool, keyAssetIdB) | |
132 | - | ||
133 | - | ||
134 | - | func assetIdA (pool) = if ((strAssetIdA(pool) == "WAVES")) | |
135 | - | then unit | |
136 | - | else fromBase58String(strAssetIdA(pool)) | |
137 | - | ||
138 | - | ||
139 | - | func assetIdB (pool) = if ((strAssetIdB(pool) == "WAVES")) | |
140 | - | then unit | |
141 | - | else fromBase58String(strAssetIdB(pool)) | |
142 | - | ||
143 | - | ||
144 | - | let kBasePeriod = "base_period" | |
145 | - | ||
146 | - | let kPeriodLength = "period_length" | |
147 | - | ||
148 | - | let kStartHeight = "start_height" | |
149 | - | ||
150 | - | let kFirstHarvestHeight = "first_harvest_height" | |
151 | - | ||
152 | - | let kDurationFullVotePower = "duration_full_vote_power" | |
153 | - | ||
154 | - | let kMinVotePower = "min_vote_power" | |
128 | + | let airdropMoneyBoxAddr = Address(getBase58FromOracle(kAirdropMoneyBoxAddr)) | |
155 | 129 | ||
156 | 130 | let basePeriod = valueOrErrorMessage(getInteger(votingAddress, kBasePeriod), "Empty kBasePeriod") | |
157 | 131 | ||
158 | 132 | let startHeight = valueOrErrorMessage(getInteger(votingAddress, kStartHeight), "Empty kStartHeight") | |
159 | 133 | ||
160 | 134 | let periodLength = valueOrErrorMessage(getInteger(votingAddress, kPeriodLength), "Empty kPeriodLength") | |
161 | 135 | ||
162 | - | let durationFullVotePower = valueOrErrorMessage(getInteger(votingAddress, kDurationFullVotePower), "Empty kDurationFullVotePower") | |
163 | - | ||
164 | - | let minVotePower = valueOrErrorMessage(getInteger(votingAddress, kMinVotePower), "Empty kMinVotePower") | |
165 | - | ||
166 | - | let isActive = getBooleanValue(this, keyActive) | |
167 | - | ||
168 | 136 | let currPeriod = (basePeriod + ((height - startHeight) / periodLength)) | |
169 | 137 | ||
170 | - | func getLimitToken (pool) = valueOrElse(getIntegerValue(pool, keyLimitShareFirstHarvest), 0) | |
138 | + | let active = getBooleanValue(this, kActive) | |
139 | + | ||
140 | + | let SwopYearEmission = getIntegerValue(this, kSwopYearEmission) | |
141 | + | ||
142 | + | let SWOP = fromBase58String(getStringValue(this, kSWOPid)) | |
143 | + | ||
144 | + | func getHeightFirstHarvest (pool) = valueOrElse(getInteger(Address(fromBase58String(pool)), kFirstHarvestHeight), 0) | |
171 | 145 | ||
172 | 146 | ||
173 | - | let APY = getIntegerValue(this, keyAPY) | |
174 | - | ||
175 | - | let SwopYearEmission = getIntegerValue(this, keySwopYearEmission) | |
176 | - | ||
177 | - | func assetNameA (pool) = match assetIdA(pool) { | |
178 | - | case id: ByteVector => | |
179 | - | value(assetInfo(id)).name | |
180 | - | case waves: Unit => | |
181 | - | "WAVES" | |
182 | - | case _ => | |
183 | - | throw("Match error") | |
184 | - | } | |
147 | + | func getFHShareLimitToken (pool) = valueOrErrorMessage(getInteger(pool, kShareLimitFH), ("No data on the key: " + kShareLimitFH)) | |
185 | 148 | ||
186 | 149 | ||
187 | - | func assetNameB (pool) = match assetIdB(pool) { | |
188 | - | case id: ByteVector => | |
189 | - | value(assetInfo(id)).name | |
190 | - | case waves: Unit => | |
191 | - | "WAVES" | |
192 | - | case _ => | |
193 | - | throw("Match error") | |
194 | - | } | |
150 | + | func getTotalShareTokenStaked (pool) = valueOrErrorMessage(getInteger(this, (pool + kShareTotalShareTokens)), (("No data on the key: " + pool) + kShareTotalShareTokens)) | |
195 | 151 | ||
196 | 152 | ||
197 | - | let SWOP = fromBase58String(getStringValue(this, keySWOPid)) | |
198 | - | ||
199 | - | func isFirstHarvest (pool) = valueOrElse(getBoolean(pool, keyfirstHarvestCpmm), false) | |
153 | + | func getPoolVoted (pool) = valueOrElse(getInteger(votingAddress, (pool + kPoolVote)), 0) | |
200 | 154 | ||
201 | 155 | ||
202 | - | func getHeightFirstHarvest (pool) = valueOrElse(getInteger(pool, keyFirstHarvestHeight), 0) | |
203 | - | ||
204 | - | ||
205 | - | func getBalanceA (pool) = valueOrErrorMessage(getInteger(pool, keyBalancecpmmA), ("No data on the key: " + keyBalancecpmmA)) | |
206 | - | ||
207 | - | ||
208 | - | func getBalanceB (pool) = valueOrErrorMessage(getInteger(pool, keyBalancecpmmB), ("No data on the key: " + keyBalancecpmmB)) | |
209 | - | ||
210 | - | ||
211 | - | func getShareLimitToken (pool) = valueOrErrorMessage(getInteger(pool, kShareLimit), ("No data on the key: " + kShareLimit)) | |
212 | - | ||
213 | - | ||
214 | - | func getTotalShareTokenLocked (pool) = valueOrErrorMessage(getInteger(this, (pool + keyShareTokensLocked)), (("No data on the key: " + pool) + keyShareTokensLocked)) | |
156 | + | func getUserPoolVoted (pool,user) = valueOrElse(getInteger(votingAddress, (((user + "_") + pool) + kPoolVote)), 0) | |
215 | 157 | ||
216 | 158 | ||
217 | 159 | func getShareAssetId (pool) = fromBase58String(getStringValue(value(addressFromString(pool)), "share_asset_id")) | |
218 | 160 | ||
219 | 161 | ||
220 | 162 | func accountBalance (assetId) = match assetId { | |
221 | 163 | case id: ByteVector => | |
222 | 164 | assetBalance(this, id) | |
223 | 165 | case waves: Unit => | |
224 | 166 | wavesBalance(this).available | |
225 | 167 | case _ => | |
226 | 168 | throw("Match error") | |
227 | 169 | } | |
228 | 170 | ||
229 | 171 | ||
230 | 172 | func getAssetInfo (assetId) = match assetId { | |
231 | 173 | case id: ByteVector => | |
232 | 174 | let stringId = toBase58String(id) | |
233 | 175 | let info = valueOrErrorMessage(assetInfo(id), (("Asset " + stringId) + " doesn't exist")) | |
234 | 176 | $Tuple3(stringId, info.name, info.decimals) | |
235 | 177 | case waves: Unit => | |
236 | 178 | $Tuple3("WAVES", "WAVES", 8) | |
237 | 179 | case _ => | |
238 | 180 | throw("Match error") | |
239 | 181 | } | |
240 | 182 | ||
241 | 183 | ||
242 | 184 | func calcScaleValue (assetId1,assetId2) = { | |
243 | 185 | let assetId1Decimals = value(assetInfo(assetId1)).decimals | |
244 | 186 | let assetId2Decimals = value(assetInfo(assetId2)).decimals | |
245 | 187 | let scaleDigits = ((assetId2Decimals - assetId1Decimals) + 8) | |
246 | 188 | pow(10, 0, scaleDigits, 0, 0, DOWN) | |
247 | 189 | } | |
248 | 190 | ||
249 | 191 | ||
250 | - | func userAvailableSWOP (pool,user) = valueOrElse(getInteger(this, (((pool + "_") + toString(user)) + | |
192 | + | func userAvailableSWOP (pool,user) = valueOrElse(getInteger(this, (((pool + "_") + toString(user)) + kAvailableSWOP)), 0) | |
251 | 193 | ||
252 | 194 | ||
253 | 195 | func rewardInfo (pool) = { | |
254 | - | let totalRewardPerBlockCurrent = valueOrErrorMessage(getInteger(govAddress, | |
255 | - | let totalRewardPerBlockPrevious = valueOrErrorMessage(getInteger(govAddress, | |
256 | - | let rewardPoolFractionCurrent = valueOrErrorMessage(getInteger(govAddress, (pool + | |
257 | - | let rewardUpdateHeight = valueOrErrorMessage(getInteger(govAddress, | |
258 | - | let poolRewardUpdateHeight = valueOrElse(getInteger(govAddress, (pool + | |
259 | - | let rewardPoolFractionPrevious = valueOrErrorMessage(getInteger(govAddress, (pool + | |
196 | + | let totalRewardPerBlockCurrent = valueOrErrorMessage(getInteger(govAddress, kTotalRewardPerBlockCurrent), ((("No data on the key: " + kTotalRewardPerBlockCurrent) + " at address ") + toString(govAddress))) | |
197 | + | let totalRewardPerBlockPrevious = valueOrErrorMessage(getInteger(govAddress, kTotalRewardPerBlockPrevious), ((("No data on the key: " + kTotalRewardPerBlockPrevious) + " at address ") + toString(govAddress))) | |
198 | + | let rewardPoolFractionCurrent = valueOrErrorMessage(getInteger(govAddress, (pool + kRewardPoolFractionCurrent)), (((("No data on the key: " + pool) + kRewardPoolFractionCurrent) + " at address ") + toString(govAddress))) | |
199 | + | let rewardUpdateHeight = valueOrErrorMessage(getInteger(govAddress, kRewardUpdateHeight), ((("No data on the key: " + kRewardUpdateHeight) + " at address ") + toString(govAddress))) | |
200 | + | let poolRewardUpdateHeight = valueOrElse(getInteger(govAddress, (pool + kHeightPoolFraction)), rewardUpdateHeight) | |
201 | + | let rewardPoolFractionPrevious = valueOrErrorMessage(getInteger(govAddress, (pool + kRewardPoolFractionPrevious)), (((("No data on the key: " + pool) + kRewardPoolFractionPrevious) + " at address ") + toString(govAddress))) | |
260 | 202 | let rewardPoolCurrent = fraction(totalRewardPerBlockCurrent, rewardPoolFractionCurrent, totalVoteShare) | |
261 | - | let rewardPoolPrevious = fraction( | |
203 | + | let rewardPoolPrevious = fraction(totalRewardPerBlockCurrent, rewardPoolFractionPrevious, totalVoteShare) | |
262 | 204 | if (if ((rewardPoolCurrent > totalRewardPerBlockCurrent)) | |
263 | 205 | then true | |
264 | 206 | else (rewardPoolPrevious > totalRewardPerBlockPrevious)) | |
265 | 207 | then throw("rewardPoolCurrent > totalRewardPerBlockCurrent or rewardPoolPrevious > totalRewardPerBlockPrevious") | |
266 | 208 | else $Tuple4(rewardPoolCurrent, rewardUpdateHeight, rewardPoolPrevious, poolRewardUpdateHeight) | |
267 | 209 | } | |
268 | 210 | ||
269 | 211 | ||
270 | 212 | func getLastInterestInfo (pool) = { | |
271 | - | let lastInterest = valueOrErrorMessage(getInteger(this, (pool + keyLastInterest)), (("No data on the key: " + pool) + keyLastInterest)) | |
272 | - | let lastInterestHeight = valueOrElse(getInteger(this, (pool + keyLastInterestHeight)), height) | |
273 | - | $Tuple2(lastInterestHeight, lastInterest) | |
213 | + | let farmInterest = valueOrErrorMessage(getInteger(this, (pool + kFarmLastInterest)), (("No data on the key: " + pool) + kFarmLastInterest)) | |
214 | + | let boostInterest = valueOrErrorMessage(getInteger(this, (pool + kFarmLastInterest)), (("No data on the key: " + pool) + kBoostLastInterest)) | |
215 | + | let boostLPInterest = valueOrErrorMessage(getInteger(this, (pool + kFarmLastInterest)), (("No data on the key: " + pool) + kBoostLPLastInterest)) | |
216 | + | let lastInterestHeight = valueOrElse(getInteger(this, (pool + kLastInterestHeight)), height) | |
217 | + | $Tuple4(lastInterestHeight, farmInterest, boostInterest, boostLPInterest) | |
274 | 218 | } | |
275 | 219 | ||
276 | 220 | ||
277 | - | func getUserInterestInfo (pool,userAddress) = { | |
278 | - | let userLastInterest = getInteger(this, (((pool + "_") + toString(userAddress)) + keyUserLastInterest)) | |
279 | - | let userShare = getInteger(this, (((pool + "_") + toString(userAddress)) + keyUserShareTokensLocked)) | |
280 | - | let lastInterest = valueOrErrorMessage(getInteger(this, (pool + keyLastInterest)), (("No data on the key: " + pool) + keyLastInterest)) | |
281 | - | let userLastInterestValue = match userLastInterest { | |
282 | - | case userLastInterest: Int => | |
283 | - | userLastInterest | |
284 | - | case _ => | |
285 | - | lastInterest | |
286 | - | } | |
287 | - | let userShareTokensAmount = match userShare { | |
288 | - | case userShare: Int => | |
289 | - | userShare | |
290 | - | case _ => | |
291 | - | 0 | |
292 | - | } | |
293 | - | $Tuple2(userLastInterestValue, userShareTokensAmount) | |
221 | + | func calcFarmRwd (pool,curTotalReward) = { | |
222 | + | let poolBoostCoef = valueOrElse(getInteger(this, (pool + kPoolBoostCoef)), defPoolBoostCoef) | |
223 | + | ((curTotalReward / (poolBoostCoef + 1)) / lockBoostCoefScale) | |
294 | 224 | } | |
295 | 225 | ||
296 | 226 | ||
297 | - | func calcInterest (lastInterestHeight,rewardUpdateHeight,poolRewardUpdateHeight,lastInterest,currentRewardPerBlock,shareTokenLocked,previousRewardPerBlock,shareAssetId,scaleValue,pmtAmount) = if ((shareTokenLocked == 0)) | |
298 | - | then 0 | |
299 | - | else if ((poolRewardUpdateHeight != 0)) | |
300 | - | then if (if ((rewardUpdateHeight > height)) | |
301 | - | then (rewardUpdateHeight == poolRewardUpdateHeight) | |
227 | + | func calcBoostRwd (pool,curTotalReward) = { | |
228 | + | let poolBoostCoef = valueOrElse(getInteger(this, (pool + kPoolBoostCoef)), defPoolBoostCoef) | |
229 | + | (fraction(curTotalReward, poolBoostCoef, (poolBoostCoef + 1)) / lockBoostCoefScale) | |
230 | + | } | |
231 | + | ||
232 | + | ||
233 | + | func calcInterest (pool,lastInterestHeight,rewardUpdateHeight,poolRewardUpdateHeight,farmInterest,boostInterest,poolVoted,boostLpInterest,currentRewardPerBlock,shareTokenLocked,previousRewardPerBlock,scaleValue) = if ((shareTokenLocked == 0)) | |
234 | + | then $Tuple3(0, 0, 0) | |
235 | + | else if (if ((rewardUpdateHeight > height)) | |
236 | + | then (rewardUpdateHeight == poolRewardUpdateHeight) | |
237 | + | else false) | |
238 | + | then { | |
239 | + | let reward = (previousRewardPerBlock * (height - lastInterestHeight)) | |
240 | + | let newFarmInterest = (farmInterest + fraction(calcFarmRwd(pool, reward), scaleValue, shareTokenLocked)) | |
241 | + | let newBoostInterest = (boostInterest + (if ((poolVoted > 0)) | |
242 | + | then fraction(calcBoostRwd(pool, reward), scaleValue, poolVoted) | |
243 | + | else 0)) | |
244 | + | let newBoostLPInterest = (boostLpInterest + (if (if ((poolVoted > 0)) | |
245 | + | then (shareTokenLocked > 0) | |
246 | + | else false) | |
247 | + | then (fraction(calcBoostRwd(pool, reward), scaleValue, shareTokenLocked) / poolVoted) | |
248 | + | else 0)) | |
249 | + | $Tuple3(newFarmInterest, newBoostInterest, newBoostLPInterest) | |
250 | + | } | |
251 | + | else if (if ((height > rewardUpdateHeight)) | |
252 | + | then (rewardUpdateHeight != poolRewardUpdateHeight) | |
302 | 253 | else false) | |
303 | 254 | then { | |
304 | 255 | let reward = (previousRewardPerBlock * (height - lastInterestHeight)) | |
305 | - | (lastInterest + fraction(reward, scaleValue, shareTokenLocked)) | |
256 | + | let newFarmInterest = (farmInterest + fraction(calcFarmRwd(pool, reward), scaleValue, shareTokenLocked)) | |
257 | + | let newBoostInterest = (boostInterest + (if ((poolVoted > 0)) | |
258 | + | then fraction(calcBoostRwd(pool, reward), scaleValue, poolVoted) | |
259 | + | else 0)) | |
260 | + | let newBoostLPInterest = (boostLpInterest + (if (if ((poolVoted > 0)) | |
261 | + | then (shareTokenLocked > 0) | |
262 | + | else false) | |
263 | + | then (fraction(calcBoostRwd(pool, reward), scaleValue, shareTokenLocked) / poolVoted) | |
264 | + | else 0)) | |
265 | + | $Tuple3(newFarmInterest, newBoostInterest, newBoostLPInterest) | |
306 | 266 | } | |
307 | - | else if (if ((height > rewardUpdateHeight)) | |
308 | - | then (rewardUpdateHeight != poolRewardUpdateHeight) | |
267 | + | else if (if (if ((height > rewardUpdateHeight)) | |
268 | + | then (rewardUpdateHeight == poolRewardUpdateHeight) | |
269 | + | else false) | |
270 | + | then (lastInterestHeight > rewardUpdateHeight) | |
309 | 271 | else false) | |
310 | 272 | then { | |
311 | - | let reward = (previousRewardPerBlock * (height - lastInterestHeight)) | |
312 | - | (lastInterest + fraction(reward, scaleValue, shareTokenLocked)) | |
313 | - | } | |
314 | - | else if (if (if ((height > rewardUpdateHeight)) | |
315 | - | then (rewardUpdateHeight == poolRewardUpdateHeight) | |
316 | - | else false) | |
317 | - | then (lastInterestHeight > rewardUpdateHeight) | |
318 | - | else false) | |
319 | - | then { | |
320 | - | let reward = (currentRewardPerBlock * (height - lastInterestHeight)) | |
321 | - | (lastInterest + fraction(reward, scaleValue, shareTokenLocked)) | |
322 | - | } | |
323 | - | else { | |
324 | - | let rewardAfterLastInterestBeforeReawardUpdate = (previousRewardPerBlock * (rewardUpdateHeight - lastInterestHeight)) | |
325 | - | let interestAfterUpdate = (lastInterest + fraction(rewardAfterLastInterestBeforeReawardUpdate, scaleValue, shareTokenLocked)) | |
326 | - | let reward = (currentRewardPerBlock * (height - rewardUpdateHeight)) | |
327 | - | (interestAfterUpdate + fraction(reward, scaleValue, shareTokenLocked)) | |
328 | - | } | |
329 | - | else if ((rewardUpdateHeight > height)) | |
330 | - | then { | |
331 | - | let reward = (previousRewardPerBlock * (height - lastInterestHeight)) | |
332 | - | (lastInterest + fraction(reward, scaleValue, shareTokenLocked)) | |
333 | - | } | |
334 | - | else if ((lastInterestHeight > rewardUpdateHeight)) | |
335 | - | then { | |
336 | 273 | let reward = (currentRewardPerBlock * (height - lastInterestHeight)) | |
337 | - | (lastInterest + fraction(reward, scaleValue, shareTokenLocked)) | |
274 | + | let newFarmInterest = (farmInterest + fraction(calcFarmRwd(pool, reward), scaleValue, shareTokenLocked)) | |
275 | + | let newBoostInterest = (boostInterest + (if ((poolVoted > 0)) | |
276 | + | then fraction(calcBoostRwd(pool, reward), scaleValue, poolVoted) | |
277 | + | else 0)) | |
278 | + | let newBoostLPInterest = (boostLpInterest + (if (if ((poolVoted > 0)) | |
279 | + | then (shareTokenLocked > 0) | |
280 | + | else false) | |
281 | + | then (fraction(calcBoostRwd(pool, reward), scaleValue, shareTokenLocked) / poolVoted) | |
282 | + | else 0)) | |
283 | + | $Tuple3(newFarmInterest, newBoostInterest, newBoostLPInterest) | |
338 | 284 | } | |
339 | 285 | else { | |
340 | - | let rewardAfterLastInterestBeforeReawardUpdate = (previousRewardPerBlock * (rewardUpdateHeight - lastInterestHeight)) | |
341 | - | let interestAfterUpdate = (lastInterest + fraction(rewardAfterLastInterestBeforeReawardUpdate, scaleValue, shareTokenLocked)) | |
286 | + | let rwdBfrUpd = (previousRewardPerBlock * (rewardUpdateHeight - lastInterestHeight)) | |
287 | + | let framIntrAftrUp = (farmInterest + fraction(calcFarmRwd(pool, rwdBfrUpd), scaleValue, shareTokenLocked)) | |
288 | + | let boostIntrAftrUp = (boostInterest + (if ((poolVoted > 0)) | |
289 | + | then fraction(calcBoostRwd(pool, rwdBfrUpd), scaleValue, poolVoted) | |
290 | + | else 0)) | |
291 | + | let bostLPIntrAftrUp = (farmInterest + (if (if ((poolVoted > 0)) | |
292 | + | then (shareTokenLocked > 0) | |
293 | + | else false) | |
294 | + | then fraction(calcBoostRwd(pool, rwdBfrUpd), scaleValue, poolVoted) | |
295 | + | else 0)) | |
342 | 296 | let reward = (currentRewardPerBlock * (height - rewardUpdateHeight)) | |
343 | - | (interestAfterUpdate + fraction(reward, scaleValue, shareTokenLocked)) | |
297 | + | let newFarmInterest = (framIntrAftrUp + fraction(calcFarmRwd(pool, reward), scaleValue, shareTokenLocked)) | |
298 | + | let newBoostInterest = (boostIntrAftrUp + (if ((poolVoted > 0)) | |
299 | + | then fraction(calcBoostRwd(pool, reward), scaleValue, poolVoted) | |
300 | + | else 0)) | |
301 | + | let newBoostLPInterest = (bostLPIntrAftrUp + (if (if ((poolVoted > 0)) | |
302 | + | then (shareTokenLocked > 0) | |
303 | + | else false) | |
304 | + | then (fraction(calcBoostRwd(pool, reward), scaleValue, shareTokenLocked) / poolVoted) | |
305 | + | else 0)) | |
306 | + | $Tuple3(newFarmInterest, newBoostInterest, newBoostLPInterest) | |
344 | 307 | } | |
345 | 308 | ||
346 | 309 | ||
347 | - | func claimCalc (pool,caller,pmtAmount) = { | |
348 | - | let shareAssetId = getShareAssetId(pool) | |
349 | - | let scaleValue = calcScaleValue(SWOP, shareAssetId) | |
350 | - | let shareTokenLocked = getTotalShareTokenLocked(pool) | |
351 | - | let $t01352213587 = getLastInterestInfo(pool) | |
352 | - | let lastInterestHeight = $t01352213587._1 | |
353 | - | let lastInterest = $t01352213587._2 | |
354 | - | let $t01359213704 = rewardInfo(pool) | |
355 | - | let currentRewardPerBlock = $t01359213704._1 | |
356 | - | let rewardUpdateHeight = $t01359213704._2 | |
357 | - | let previousRewardPerBlock = $t01359213704._3 | |
358 | - | let poolRewardUpdateHeight = $t01359213704._4 | |
359 | - | let $t01370913788 = getUserInterestInfo(pool, caller) | |
360 | - | let userLastInterest = $t01370913788._1 | |
361 | - | let userShareTokensAmount = $t01370913788._2 | |
362 | - | let currentInterest = calcInterest(lastInterestHeight, rewardUpdateHeight, poolRewardUpdateHeight, lastInterest, currentRewardPerBlock, shareTokenLocked, previousRewardPerBlock, shareAssetId, scaleValue, pmtAmount) | |
363 | - | let claimAmount = fraction(userShareTokensAmount, (currentInterest - userLastInterest), scaleValue) | |
364 | - | let userNewInterest = currentInterest | |
365 | - | $Tuple4(userNewInterest, currentInterest, claimAmount, userShareTokensAmount) | |
310 | + | func claimCalc (pool,user) = { | |
311 | + | let scaleValue = calcScaleValue(SWOP, getShareAssetId(pool)) | |
312 | + | let poolVoted = getPoolVoted(pool) | |
313 | + | let uPoolVoted = getUserPoolVoted(pool, user) | |
314 | + | let shareTokenStaked = getTotalShareTokenStaked(pool) | |
315 | + | let totalShareVirtual = valueOrElse(getInteger(this, (pool + kShareTokensVirtual)), shareTokenStaked) | |
316 | + | let $t01420114299 = getLastInterestInfo(pool) | |
317 | + | let lastInterestHeight = $t01420114299._1 | |
318 | + | let farmInterest = $t01420114299._2 | |
319 | + | let boostInterest = $t01420114299._3 | |
320 | + | let boostLPInterest = $t01420114299._4 | |
321 | + | let $t01430414418 = rewardInfo(pool) | |
322 | + | let currentRewardPerBlock = $t01430414418._1 | |
323 | + | let rewardUpdateHeight = $t01430414418._2 | |
324 | + | let previousRewardPerBlock = $t01430414418._3 | |
325 | + | let poolRewardUpdateHeight = $t01430414418._4 | |
326 | + | let uFarmInterest = valueOrElse(getInteger(this, (((pool + "_") + user) + kFarmUserLastInterest)), farmInterest) | |
327 | + | let uBoostInterest = valueOrElse(getInteger(this, (((pool + "_") + user) + kBoostUserLastInterest)), boostInterest) | |
328 | + | let uBoostLPInterest = valueOrElse(getInteger(this, (((pool + "_") + user) + kBoostLPUserLastInterest)), boostLPInterest) | |
329 | + | let uShareTokensStaked = valueOrElse(getInteger(this, (((pool + "_") + user) + kUserShareTokensStaked)), 0) | |
330 | + | let uShareTokensVirt = valueOrElse(getInteger(this, (((pool + "_") + user) + kUserShareTokensVirtual)), uShareTokensStaked) | |
331 | + | let $t01498615378 = calcInterest(pool, lastInterestHeight, rewardUpdateHeight, poolRewardUpdateHeight, farmInterest, boostInterest, poolVoted, boostLPInterest, currentRewardPerBlock, shareTokenStaked, previousRewardPerBlock, scaleValue) | |
332 | + | let newFarmInterest = $t01498615378._1 | |
333 | + | let newBoostInterest = $t01498615378._2 | |
334 | + | let newBoostLPInterest = $t01498615378._3 | |
335 | + | let claimFarming = fraction(uShareTokensVirt, (newFarmInterest - uFarmInterest), scaleValue) | |
336 | + | let claimBoostingMax = fraction(uPoolVoted, (newBoostInterest - uBoostInterest), scaleValue) | |
337 | + | let claimBoosting = fraction((uShareTokensVirt * uPoolVoted), (newBoostLPInterest - uBoostLPInterest), scaleValue) | |
338 | + | let toTreasury = (claimBoostingMax - claimBoosting) | |
339 | + | $Tuple5(newFarmInterest, newBoostInterest, newBoostLPInterest, (claimFarming + claimBoosting), toTreasury) | |
366 | 340 | } | |
367 | 341 | ||
368 | 342 | ||
369 | - | func calculateProtocolReward (pool) = { | |
370 | - | let $t01430614371 = getLastInterestInfo(pool) | |
371 | - | let lastInterestHeight = $t01430614371._1 | |
372 | - | let lastInterest = $t01430614371._2 | |
373 | - | let $t01437614487 = rewardInfo(pool) | |
374 | - | let currentRewardPerBlock = $t01437614487._1 | |
375 | - | let rewardUpdateHeight = $t01437614487._2 | |
376 | - | let previousRewardPerBlock = $t01437614487._3 | |
377 | - | let poolRewardUpdateHeight = $t01437614487._4 | |
378 | - | let shareTokenLocked = getTotalShareTokenLocked(pool) | |
379 | - | if (if ((shareTokenLocked == 0)) | |
380 | - | then (poolRewardUpdateHeight == 0) | |
381 | - | else false) | |
382 | - | then if ((rewardUpdateHeight > height)) | |
383 | - | then { | |
384 | - | let reward = (previousRewardPerBlock * (height - lastInterestHeight)) | |
385 | - | reward | |
386 | - | } | |
387 | - | else if ((lastInterestHeight > rewardUpdateHeight)) | |
388 | - | then { | |
389 | - | let reward = (currentRewardPerBlock * (height - lastInterestHeight)) | |
390 | - | reward | |
391 | - | } | |
392 | - | else { | |
393 | - | let rewardAfterLastInterestBeforeReawardUpdate = (previousRewardPerBlock * (rewardUpdateHeight - lastInterestHeight)) | |
394 | - | let reward = (currentRewardPerBlock * (height - rewardUpdateHeight)) | |
395 | - | (reward + rewardAfterLastInterestBeforeReawardUpdate) | |
396 | - | } | |
397 | - | else if (if ((shareTokenLocked == 0)) | |
398 | - | then (poolRewardUpdateHeight != 0) | |
399 | - | else false) | |
400 | - | then if (if ((rewardUpdateHeight > height)) | |
401 | - | then (rewardUpdateHeight == poolRewardUpdateHeight) | |
402 | - | else false) | |
403 | - | then { | |
404 | - | let reward = (previousRewardPerBlock * (height - lastInterestHeight)) | |
405 | - | reward | |
406 | - | } | |
407 | - | else if (if ((height > rewardUpdateHeight)) | |
408 | - | then (rewardUpdateHeight != poolRewardUpdateHeight) | |
409 | - | else false) | |
410 | - | then { | |
411 | - | let reward = (previousRewardPerBlock * (height - lastInterestHeight)) | |
412 | - | reward | |
413 | - | } | |
414 | - | else if (if (if ((height > rewardUpdateHeight)) | |
415 | - | then (rewardUpdateHeight == poolRewardUpdateHeight) | |
416 | - | else false) | |
417 | - | then (lastInterestHeight > rewardUpdateHeight) | |
418 | - | else false) | |
419 | - | then { | |
420 | - | let reward = (currentRewardPerBlock * (height - lastInterestHeight)) | |
421 | - | reward | |
422 | - | } | |
423 | - | else { | |
424 | - | let rewardAfterLastInterestBeforeReawardUpdate = (previousRewardPerBlock * (rewardUpdateHeight - lastInterestHeight)) | |
425 | - | let reward = (currentRewardPerBlock * (height - rewardUpdateHeight)) | |
426 | - | (reward + rewardAfterLastInterestBeforeReawardUpdate) | |
427 | - | } | |
428 | - | else 0 | |
343 | + | func canLockInFirstHarvest (pool,user,userShareTokensStaked,pmtAmount,lockType) = if ((height > getHeightFirstHarvest(pool))) | |
344 | + | then { | |
345 | + | let totalVoteAmount = valueOrElse(getInteger(votingAddress, (pool + kHarvestPoolVote)), 0) | |
346 | + | let userVoteAmount = valueOrElse(getInteger(votingAddress, (((user + "_") + pool) + kHarvestPoolVote)), 0) | |
347 | + | let FHShareTokenLimit = getFHShareLimitToken(addressFromStringValue(pool)) | |
348 | + | let FHShareTokenUserLimit = (fraction(FHShareTokenLimit, userVoteAmount, totalVoteAmount) - userShareTokensStaked) | |
349 | + | if ((lockType > 0)) | |
350 | + | then throw("You can't lock shareTokens till first harvest end.") | |
351 | + | else if ((userVoteAmount == 0)) | |
352 | + | then throw("You can't lock shareTokens because you didn't vote in first harvest") | |
353 | + | else if ((pmtAmount > FHShareTokenUserLimit)) | |
354 | + | then throw(("You can't lock more than you vote in first harvest. Your can lock " + toString(FHShareTokenUserLimit))) | |
355 | + | else true | |
356 | + | } | |
357 | + | else true | |
358 | + | ||
359 | + | ||
360 | + | func getLockParams (type) = { | |
361 | + | let lockParams = split(valueOrErrorMessage(getString(this, (toString(type) + kLockParams)), ("There are no key for lock type" + toString(type))), "_") | |
362 | + | $Tuple2(parseIntValue(lockParams[0]), parseIntValue(lockParams[1])) | |
429 | 363 | } | |
430 | 364 | ||
431 | 365 | ||
432 | - | func checkPmtAssetIdCorrect (pool,pmtAssetId) = { | |
433 | - | let poolShareAssetId = fromBase58String(getStringValue(value(addressFromString(pool)), "share_asset_id")) | |
434 | - | if ((pmtAssetId == poolShareAssetId)) | |
435 | - | then true | |
436 | - | else false | |
437 | - | } | |
366 | + | func suspend (cause) = [BooleanEntry(kActive, false), StringEntry(kCause, cause)] | |
438 | 367 | ||
439 | 368 | ||
440 | - | func getUserSWOPClaimedAmount (pool,user) = valueOrElse(getInteger(this, (((pool + "_") + toString(user)) + keyUserSWOPClaimedAmount)), 0) | |
369 | + | func isActive () = if (active) | |
370 | + | then unit | |
371 | + | else throw("DApp is inactive at this moment") | |
441 | 372 | ||
442 | 373 | ||
443 | - | func suspend (cause) = [BooleanEntry(keyActive, false), StringEntry(keyCause, cause)] | |
374 | + | func isAdminCall (i) = if (containsElement([adminPubKey1, adminPubKey2, adminPubKey3], i.callerPublicKey)) | |
375 | + | then unit | |
376 | + | else throw("Only admin can call this function") | |
444 | 377 | ||
445 | 378 | ||
446 | 379 | @Callable(i) | |
447 | - | func init (earlyLP) = if (isDefined(getString(this, | |
380 | + | func init (earlyLP) = if (isDefined(getString(this, kSWOPid))) | |
448 | 381 | then throw("SWOP already initialized") | |
449 | 382 | else { | |
450 | 383 | let initAmount = 100000000000000 | |
451 | 384 | let SWOPissue = Issue("SWOP", "SWOP protocol token", initAmount, 8, true) | |
452 | 385 | let SWOPid = calculateAssetId(SWOPissue) | |
453 | - | [BooleanEntry( | |
386 | + | [BooleanEntry(kActive, true), Issue("SWOP", "SWOP protocol token", initAmount, 8, true), StringEntry(kSWOPid, toBase58String(SWOPid))] | |
454 | 387 | } | |
455 | 388 | ||
456 | 389 | ||
457 | 390 | ||
458 | 391 | @Callable(i) | |
459 | - | func initPoolShareFarming (pool) = if ((i.caller != this)) | |
460 | - | then throw("Only the DApp itself can call this function") | |
461 | - | else { | |
462 | - | let $t01746917572 = rewardInfo(pool) | |
463 | - | let currentReward = $t01746917572._1 | |
464 | - | let rewardUpdateHeight = $t01746917572._2 | |
465 | - | let previousRewardPerBlock = $t01746917572._3 | |
466 | - | let poolRewardUpdateHeight = $t01746917572._4 | |
467 | - | [IntegerEntry((pool + keyShareTokensLocked), 0), IntegerEntry((pool + keyLastInterest), 0), IntegerEntry((pool + keyLastInterestHeight), height)] | |
468 | - | } | |
392 | + | func initPoolShareFarming (pool) = valueOrElse(isAdminCall(i), [IntegerEntry((pool + kShareTotalShareTokens), 0), IntegerEntry((pool + kFarmLastInterest), 0), IntegerEntry((pool + kBoostLastInterest), 0), IntegerEntry((pool + kBoostLPLastInterest), 0), IntegerEntry((pool + kLastInterestHeight), height)]) | |
469 | 393 | ||
470 | 394 | ||
471 | 395 | ||
472 | 396 | @Callable(i) | |
473 | - | func updatePoolInterest (pool) = if ((i.caller != moneyBoxAddress)) | |
474 | - | then throw("Only the Admin itself can call this function") | |
475 | - | else if (!(isActive)) | |
476 | - | then throw("DApp is inactive at this moment") | |
477 | - | else { | |
478 | - | let $t01799018123 = claimCalc(pool, addressFromPublicKey(adminInvokePubKey), 0) | |
479 | - | let userNewInterest = $t01799018123._1 | |
480 | - | let currentInterest = $t01799018123._2 | |
481 | - | let claimAmount = $t01799018123._3 | |
482 | - | let userShareTokensAmount = $t01799018123._4 | |
483 | - | let $t01812818231 = rewardInfo(pool) | |
484 | - | let currentReward = $t01812818231._1 | |
485 | - | let rewardUpdateHeight = $t01812818231._2 | |
486 | - | let previousRewardPerBlock = $t01812818231._3 | |
487 | - | let poolRewardUpdateHeight = $t01812818231._4 | |
488 | - | [IntegerEntry((pool + keyLastInterest), userNewInterest), IntegerEntry((pool + keyLastInterestHeight), height)] | |
489 | - | } | |
397 | + | func updatePoolInterest (pool) = valueOrElse(isActive(), if ((i.caller != govAddress)) | |
398 | + | then throw("Only Governance can call this function") | |
399 | + | else { | |
400 | + | let user = toString(addressFromPublicKey(adminInvokePubKey)) | |
401 | + | let $t01853818612 = claimCalc(pool, user) | |
402 | + | let farmInterest = $t01853818612._1 | |
403 | + | let boostInterest = $t01853818612._2 | |
404 | + | let boostLPinterest = $t01853818612._3 | |
405 | + | [IntegerEntry((pool + kFarmLastInterest), farmInterest), IntegerEntry((pool + kBoostLastInterest), boostInterest), IntegerEntry((pool + kBoostLPLastInterest), boostLPinterest), IntegerEntry((pool + kLastInterestHeight), height)] | |
406 | + | }) | |
490 | 407 | ||
491 | 408 | ||
492 | 409 | ||
493 | 410 | @Callable(i) | |
494 | - | func lockShareTokens (pool) = { | |
495 | - | let $t01842318498 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
496 | - | let pmtAmount = $t01842318498._1 | |
497 | - | let pmtAssetId = $t01842318498._2 | |
498 | - | let $t01850318576 = getAssetInfo(pmtAssetId) | |
499 | - | let pmtStrAssetId = $t01850318576._1 | |
500 | - | let pmtAssetName = $t01850318576._2 | |
501 | - | let pmtDecimals = $t01850318576._3 | |
502 | - | let $t01858118698 = claimCalc(pool, i.originCaller, pmtAmount) | |
503 | - | let userNewInterest = $t01858118698._1 | |
504 | - | let currentInterest = $t01858118698._2 | |
505 | - | let claimAmount = $t01858118698._3 | |
506 | - | let userShareTokensAmount = $t01858118698._4 | |
507 | - | let userShareAmountNew = (userShareTokensAmount + pmtAmount) | |
508 | - | let availableFundsNew = (userAvailableSWOP(pool, i.originCaller) + claimAmount) | |
509 | - | let totalShareAmount = getTotalShareTokenLocked(pool) | |
510 | - | let totalShareAmountNew = (totalShareAmount + pmtAmount) | |
511 | - | let userClaimedAmount = getUserSWOPClaimedAmount(pool, i.originCaller) | |
512 | - | let userClaimedAmountNew = (userClaimedAmount + claimAmount) | |
513 | - | let baseEntry = [IntegerEntry((((pool + "_") + toString(i.originCaller)) + keyUserLastInterest), userNewInterest), IntegerEntry((((pool + "_") + toString(i.originCaller)) + keyUserShareTokensLocked), userShareAmountNew), IntegerEntry((pool + keyShareTokensLocked), totalShareAmountNew), IntegerEntry((pool + keyLastInterest), currentInterest), IntegerEntry((pool + keyLastInterestHeight), height), IntegerEntry((((pool + "_") + toString(i.originCaller)) + keyUserSWOPClaimedAmount), userClaimedAmountNew), IntegerEntry((((pool + "_") + toString(i.originCaller)) + keyUserSWOPLastClaimedAmount), claimAmount), IntegerEntry((((pool + "_") + toString(i.originCaller)) + keyAvailableSWOP), availableFundsNew)] | |
514 | - | let uplp = if ((getString(Address(fromBase58String(pool)), "version") == "3.0.0")) | |
515 | - | then invoke(lpFarmingAddress, "updateUserInterest", [pool, userShareAmountNew], nil) | |
516 | - | else 0 | |
517 | - | if ((uplp == uplp)) | |
518 | - | then if ((0 >= pmtAmount)) | |
519 | - | then throw("You can't lock token") | |
520 | - | else if (!(isActive)) | |
521 | - | then throw("DApp is inactive at this moment") | |
522 | - | else if (!(checkPmtAssetIdCorrect(pool, pmtAssetId))) | |
523 | - | then throw("Incorrect pmtAssetId") | |
524 | - | else if (if (isFirstHarvest(Address(fromBase58String(pool)))) | |
525 | - | then (getHeightFirstHarvest(Address(fromBase58String(pool))) > height) | |
526 | - | else false) | |
527 | - | then { | |
528 | - | let harvestPeriod = ((((getHeightFirstHarvest(Address(fromBase58String(pool))) - startHeight) + 1) / periodLength) - 1) | |
529 | - | let amountOfVoting = split(getStringValue(votingAddress, (((toString(i.originCaller) + "_") + pool) + "_user_pool_struc")), "_") | |
530 | - | let amountPoolStract = split(getStringValue(votingAddress, (pool + "_pool_struc")), "_") | |
531 | - | let amountActiveVoteUserPoolStract = split(valueOrElse(getString(votingAddress, (((toString(i.originCaller) + "_") + pool) + kHarvestUserPoolActiveVoteStrucVoting)), ""), "_") | |
532 | - | let amountPoolActiveVoteStract = split(valueOrElse(getString(votingAddress, (pool + kHarvestPoolActiveVoteStrucVoting)), ""), "_") | |
533 | - | let userShareTokenLocked = userShareTokensAmount | |
534 | - | let userPoolActiveVote = if ((toString(currPeriod) == amountOfVoting[2])) | |
535 | - | then valueOrElse(parseInt(amountActiveVoteUserPoolStract[0]), 0) | |
536 | - | else valueOrElse(parseInt(amountOfVoting[1]), 0) | |
537 | - | let poolActiveVote = if ((toString(currPeriod) == amountPoolStract[2])) | |
538 | - | then valueOrElse(parseInt(amountPoolActiveVoteStract[0]), 0) | |
539 | - | else valueOrElse(parseInt(amountPoolStract[1]), 0) | |
540 | - | let protocolReward = calculateProtocolReward(pool) | |
541 | - | if ((userPoolActiveVote != 0)) | |
542 | - | then { | |
543 | - | let limitShareToken = getShareLimitToken(addressFromStringValue(pool)) | |
544 | - | let shareToken = (fraction(limitShareToken, userPoolActiveVote, poolActiveVote) - userShareTokenLocked) | |
545 | - | if (if ((size(amountActiveVoteUserPoolStract) > 1)) | |
546 | - | then (valueOrElse(parseInt(amountActiveVoteUserPoolStract[1]), 0) >= harvestPeriod) | |
547 | - | else false) | |
548 | - | then throw("You can't share token") | |
549 | - | else if ((pmtAmount > limitShareToken)) | |
550 | - | then throw(("You can't share token more than " + toString(limitShareToken))) | |
551 | - | else if ((shareToken > 0)) | |
552 | - | then if ((fraction(99, accountBalance(pmtAssetId), 100) > totalShareAmountNew)) | |
553 | - | then throw("Balance of share-token is greater than totalAmount") | |
554 | - | else if ((totalShareAmount == 0)) | |
555 | - | then (baseEntry ++ [Reissue(SWOP, protocolReward, true), ScriptTransfer(moneyBoxAddress, protocolReward, SWOP)]) | |
556 | - | else if ((shareToken >= pmtAmount)) | |
557 | - | then baseEntry | |
558 | - | else throw(("Your maximum share token is " + toString(shareToken))) | |
559 | - | else throw("You can't share token") | |
560 | - | } | |
561 | - | else throw("Your amount of token less than 0") | |
562 | - | } | |
563 | - | else baseEntry | |
564 | - | else throw("Strict value is not equal to itself.") | |
565 | - | } | |
411 | + | func lockShareTokens (pool,lockType) = valueOrElse(isActive(), { | |
412 | + | let shareAssetId = getShareAssetId(pool) | |
413 | + | let user = toString(i.originCaller) | |
414 | + | let totalShareStaked = getTotalShareTokenStaked(pool) | |
415 | + | let totalShareVirtual = valueOrElse(getInteger(this, (pool + kShareTokensVirtual)), totalShareStaked) | |
416 | + | let userStakedAmount = valueOrElse(getInteger(this, (((pool + "_") + user) + kUserShareTokensStaked)), 0) | |
417 | + | let userLockedHeigt = valueOrElse(getInteger(this, (((pool + "_") + user) + kUserShareTokensLockedHeight)), 0) | |
418 | + | let userLockedAmount = valueOrElse(getInteger(this, (((pool + "_") + user) + kUserShareTokensLocked)), 0) | |
419 | + | let userAmountVirtual = valueOrElse(getInteger(this, (((pool + "_") + user) + kUserShareTokensVirtual)), userStakedAmount) | |
420 | + | let totalShareStakedNew = (totalShareStaked + i.payments[0].amount) | |
421 | + | let totalUserShareTokens = ((userStakedAmount + userLockedAmount) + i.payments[0].amount) | |
422 | + | let $t01980919861 = getLockParams(lockType) | |
423 | + | let lockPeriod = $t01980919861._1 | |
424 | + | let lockCoef = $t01980919861._2 | |
425 | + | let lockWavesFee = getIntegerValue(this, kLockWavesFee) | |
426 | + | if ((0 >= i.payments[0].amount)) | |
427 | + | then throw("Payment amount must be greater than 0") | |
428 | + | else if ((0 > lockType)) | |
429 | + | then throw("lockType must be >= 0") | |
430 | + | else if ((accountBalance(shareAssetId) > totalShareStakedNew)) | |
431 | + | then throw("Balance of share-token is lower than totalAmount") | |
432 | + | else if (!(canLockInFirstHarvest(pool, user, userStakedAmount, i.payments[0].amount, lockType))) | |
433 | + | then throw() | |
434 | + | else { | |
435 | + | let $t02031321949 = if ((lockType == 0)) | |
436 | + | then { | |
437 | + | let userAmountVirtualNew = (userAmountVirtual + i.payments[0].amount) | |
438 | + | $Tuple2([IntegerEntry((((pool + "_") + user) + kUserShareTokensStaked), (userStakedAmount + i.payments[0].amount)), IntegerEntry((pool + kShareTokensVirtual), (totalShareVirtual + i.payments[0].amount))], userAmountVirtualNew) | |
439 | + | } | |
440 | + | else if (if ((userLockedHeigt == 0)) | |
441 | + | then if (if ((2 > size(i.payments))) | |
442 | + | then true | |
443 | + | else (i.payments[1].assetId != unit)) | |
444 | + | then true | |
445 | + | else (lockWavesFee > i.payments[1].amount) | |
446 | + | else false) | |
447 | + | then throw((("You need to pay additional waves comission " + toString(lockWavesFee)) + "WAVES")) | |
448 | + | else if ((userLockedHeigt > (height + lockPeriod))) | |
449 | + | then throw("You cannot lock sharetokens for a period less than what you have already locked") | |
450 | + | else { | |
451 | + | let userLockedAmountNew = (userLockedAmount + i.payments[0].amount) | |
452 | + | let userLockedHeigtNew = (height + lockPeriod) | |
453 | + | let userAmountVirtualNew = (fraction(userLockedAmountNew, lockCoef, lockBoostCoefScale) + userStakedAmount) | |
454 | + | $Tuple2([IntegerEntry((((pool + "_") + user) + kUserShareTokensLocked), userLockedAmountNew), IntegerEntry((((pool + "_") + user) + kUserShareTokensLockedHeight), userLockedHeigtNew), IntegerEntry((((pool + "_") + user) + kUserShareTokensLockedType), lockType), IntegerEntry((((pool + "_") + user) + kUserShareTokensVirtual), userAmountVirtualNew), IntegerEntry((pool + kShareTokensVirtual), ((totalShareVirtual - userAmountVirtual) + userAmountVirtualNew))], userAmountVirtualNew) | |
455 | + | } | |
456 | + | let lockEntries = $t02031321949._1 | |
457 | + | let userAmountVirtualNew = $t02031321949._2 | |
458 | + | let $t02195522054 = claimCalc(pool, user) | |
459 | + | let farmInterest = $t02195522054._1 | |
460 | + | let boostInterest = $t02195522054._2 | |
461 | + | let boostLPinterest = $t02195522054._3 | |
462 | + | let claimAmount = $t02195522054._4 | |
463 | + | let toTreasure = $t02195522054._5 | |
464 | + | let availableFundsNew = (userAvailableSWOP(pool, i.originCaller) + claimAmount) | |
465 | + | let uplp = if ((getString(Address(fromBase58String(pool)), "version") == "3.0.0")) | |
466 | + | then invoke(lpFarmingAddress, "updateUserInterest", [pool, totalUserShareTokens], nil) | |
467 | + | else 0 | |
468 | + | if ((uplp == uplp)) | |
469 | + | then ([IntegerEntry((((pool + "_") + user) + kFarmUserLastInterest), farmInterest), IntegerEntry((((pool + "_") + user) + kBoostUserLastInterest), boostInterest), IntegerEntry((((pool + "_") + user) + kBoostLPLastInterest), boostLPinterest), IntegerEntry((pool + kFarmLastInterest), farmInterest), IntegerEntry((pool + kBoostLastInterest), boostInterest), IntegerEntry((pool + kBoostLPLastInterest), boostLPinterest), IntegerEntry((pool + kLastInterestHeight), height), IntegerEntry((pool + kShareTotalShareTokens), totalShareStakedNew), IntegerEntry((((pool + "_") + user) + kAvailableSWOP), availableFundsNew), Reissue(SWOP, toTreasure, true), ScriptTransfer(airdropMoneyBoxAddr, toTreasure, SWOP)] ++ lockEntries) | |
470 | + | else throw("Strict value is not equal to itself.") | |
471 | + | } | |
472 | + | }) | |
566 | 473 | ||
567 | 474 | ||
568 | 475 | ||
569 | 476 | @Callable(i) | |
570 | - | func withdrawShareTokens (pool,shareTokensWithdrawAmount) = { | |
571 | - | let shareTokensId = fromBase58String(getStringValue(value(addressFromString(pool)), "share_asset_id")) | |
572 | - | let $t02331023421 = claimCalc(pool, i.originCaller, 1) | |
573 | - | let userNewInterest = $t02331023421._1 | |
574 | - | let currentInterest = $t02331023421._2 | |
575 | - | let claimAmount = $t02331023421._3 | |
576 | - | let userShareTokensAmount = $t02331023421._4 | |
577 | - | let userShareAmountNew = (userShareTokensAmount - shareTokensWithdrawAmount) | |
578 | - | let availableFundsNew = (userAvailableSWOP(pool, i.originCaller) + claimAmount) | |
579 | - | let totalShareAmount = getTotalShareTokenLocked(pool) | |
580 | - | let totalShareAmountNew = (totalShareAmount - shareTokensWithdrawAmount) | |
581 | - | let userClaimedAmount = getUserSWOPClaimedAmount(pool, i.originCaller) | |
582 | - | let userClaimedAmountNew = (userClaimedAmount + claimAmount) | |
583 | - | if ((shareTokensWithdrawAmount > userShareTokensAmount)) | |
584 | - | then throw("Withdraw amount more then user locked amount") | |
585 | - | else if (!(isActive)) | |
586 | - | then throw("DApp is inactive at this moment") | |
587 | - | else if ((shareTokensWithdrawAmount > userShareTokensAmount)) | |
588 | - | then throw("Withdraw amount more then user locked amount") | |
589 | - | else if ((fraction(99, (accountBalance(shareTokensId) - shareTokensWithdrawAmount), 100) > totalShareAmountNew)) | |
590 | - | then throw("Balance of share-token is greater than totalAmount") | |
591 | - | else { | |
592 | - | let uplp = if ((getString(Address(fromBase58String(pool)), "version") == "3.0.0")) | |
593 | - | then invoke(lpFarmingAddress, "updateUserInterest", [pool, userShareAmountNew], nil) | |
594 | - | else 0 | |
595 | - | if ((uplp == uplp)) | |
596 | - | then [IntegerEntry((((pool + "_") + toString(i.originCaller)) + keyUserLastInterest), userNewInterest), IntegerEntry((((pool + "_") + toString(i.originCaller)) + keyUserShareTokensLocked), userShareAmountNew), IntegerEntry((pool + keyLastInterest), currentInterest), IntegerEntry((pool + keyLastInterestHeight), height), IntegerEntry((pool + keyShareTokensLocked), totalShareAmountNew), IntegerEntry((((pool + "_") + toString(i.originCaller)) + keyAvailableSWOP), availableFundsNew), IntegerEntry((((pool + "_") + toString(i.originCaller)) + keyUserSWOPClaimedAmount), userClaimedAmountNew), IntegerEntry((((pool + "_") + toString(i.originCaller)) + keyUserSWOPLastClaimedAmount), claimAmount), ScriptTransfer(i.caller, shareTokensWithdrawAmount, shareTokensId)] | |
597 | - | else throw("Strict value is not equal to itself.") | |
598 | - | } | |
599 | - | } | |
477 | + | func lockStakedShareTokens (pool,lockType,lockAmount) = valueOrElse(isActive(), { | |
478 | + | let shareAssetId = getShareAssetId(pool) | |
479 | + | let user = toString(i.originCaller) | |
480 | + | let totalShareStaked = getTotalShareTokenStaked(pool) | |
481 | + | let totalShareVirtual = valueOrElse(getInteger(this, (pool + kShareTokensVirtual)), totalShareStaked) | |
482 | + | let userStakedAmount = valueOrElse(getInteger(this, (((pool + "_") + user) + kUserShareTokensStaked)), 0) | |
483 | + | let userLockedHeigt = valueOrElse(getInteger(this, (((pool + "_") + user) + kUserShareTokensLockedHeight)), 0) | |
484 | + | let userLockedAmount = valueOrElse(getInteger(this, (((pool + "_") + user) + kUserShareTokensLocked)), 0) | |
485 | + | let userAmountVirtual = valueOrElse(getInteger(this, (((pool + "_") + user) + kUserShareTokensVirtual)), userStakedAmount) | |
486 | + | let totalUserShareTokens = (userStakedAmount + userLockedAmount) | |
487 | + | let $t02398624038 = getLockParams(lockType) | |
488 | + | let lockPeriod = $t02398624038._1 | |
489 | + | let lockCoef = $t02398624038._2 | |
490 | + | let lockWavesFee = getIntegerValue(this, kLockWavesFee) | |
491 | + | if ((height > getHeightFirstHarvest(pool))) | |
492 | + | then throw("You can't lock shareTokens till first harvest end.") | |
493 | + | else if ((lockType > 0)) | |
494 | + | then throw("lockType must be > 0") | |
495 | + | else if ((lockAmount > userStakedAmount)) | |
496 | + | then throw(("You can't lock more than " + toString(userStakedAmount))) | |
497 | + | else if ((accountBalance(shareAssetId) > totalShareStaked)) | |
498 | + | then throw("Balance of share-token is lower than totalAmount") | |
499 | + | else if (if ((userLockedHeigt == 0)) | |
500 | + | then if (if ((1 > size(i.payments))) | |
501 | + | then true | |
502 | + | else (i.payments[0].assetId != unit)) | |
503 | + | then true | |
504 | + | else (lockWavesFee > i.payments[0].amount) | |
505 | + | else false) | |
506 | + | then throw((("You need to pay additional waves comission " + toString(lockWavesFee)) + "WAVES")) | |
507 | + | else if ((userLockedHeigt > (height + lockPeriod))) | |
508 | + | then throw("You cannot lock sharetokens for a period less than what you have already locked") | |
509 | + | else { | |
510 | + | let userLockedAmountNew = (userLockedAmount + lockAmount) | |
511 | + | let userStakedAmountNew = (userStakedAmount - lockAmount) | |
512 | + | let userLockedHeigtNew = (height + lockPeriod) | |
513 | + | let userAmountVirtualNew = (fraction(userLockedAmountNew, lockCoef, lockBoostCoefScale) + userStakedAmount) | |
514 | + | let lockEntries = [IntegerEntry((((pool + "_") + user) + kUserShareTokensStaked), userStakedAmountNew), IntegerEntry((((pool + "_") + user) + kUserShareTokensLocked), userLockedAmountNew), IntegerEntry((((pool + "_") + user) + kUserShareTokensLockedHeight), userLockedHeigtNew), IntegerEntry((((pool + "_") + user) + kUserShareTokensLockedType), lockType), IntegerEntry((((pool + "_") + user) + kUserShareTokensVirtual), userAmountVirtualNew), IntegerEntry((pool + kShareTokensVirtual), ((totalShareVirtual - userAmountVirtual) + userAmountVirtualNew))] | |
515 | + | let $t02573825837 = claimCalc(pool, user) | |
516 | + | let farmInterest = $t02573825837._1 | |
517 | + | let boostInterest = $t02573825837._2 | |
518 | + | let boostLPinterest = $t02573825837._3 | |
519 | + | let claimAmount = $t02573825837._4 | |
520 | + | let toTreasure = $t02573825837._5 | |
521 | + | let availableFundsNew = (userAvailableSWOP(pool, i.originCaller) + claimAmount) | |
522 | + | [IntegerEntry((((pool + "_") + user) + kFarmUserLastInterest), farmInterest), IntegerEntry((((pool + "_") + user) + kBoostUserLastInterest), boostInterest), IntegerEntry((((pool + "_") + user) + kBoostLPLastInterest), boostLPinterest), IntegerEntry((pool + kFarmLastInterest), farmInterest), IntegerEntry((pool + kBoostLastInterest), boostInterest), IntegerEntry((pool + kBoostLPLastInterest), boostLPinterest), IntegerEntry((pool + kLastInterestHeight), height), IntegerEntry((((pool + "_") + user) + kAvailableSWOP), availableFundsNew), Reissue(SWOP, toTreasure, true), ScriptTransfer(airdropMoneyBoxAddr, toTreasure, SWOP)] | |
523 | + | } | |
524 | + | }) | |
600 | 525 | ||
601 | 526 | ||
602 | 527 | ||
603 | 528 | @Callable(i) | |
604 | - | func claim (pool) = { | |
605 | - | let shareTokensId = fromBase58String(getStringValue(value(addressFromString(pool)), "share_asset_id")) | |
606 | - | let shareTokenLocked = getTotalShareTokenLocked(pool) | |
607 | - | let $t02568925755 = getLastInterestInfo(pool) | |
608 | - | let lastInterestHeight = $t02568925755._1 | |
609 | - | let lastInterest = $t02568925755._2 | |
610 | - | let $t02576025874 = rewardInfo(pool) | |
611 | - | let currentRewardPerBlock = $t02576025874._1 | |
612 | - | let rewardUpdateHeight = $t02576025874._2 | |
613 | - | let previousRewardPerBlock = $t02576025874._3 | |
614 | - | let poolRewardUpdateHeight = $t02576025874._4 | |
615 | - | let $t02587925984 = claimCalc(pool, i.caller, 1) | |
616 | - | let userNewInterest = $t02587925984._1 | |
617 | - | let currentInterest = $t02587925984._2 | |
618 | - | let claimAmount = $t02587925984._3 | |
619 | - | let userShareTokensAmount = $t02587925984._4 | |
620 | - | let availableFund = (userAvailableSWOP(pool, i.caller) + claimAmount) | |
621 | - | let userClaimedAmount = getUserSWOPClaimedAmount(pool, i.caller) | |
622 | - | let userClaimedAmountNew = (userClaimedAmount + claimAmount) | |
623 | - | if ((availableFund == 0)) | |
624 | - | then throw("You have 0 available SWOP") | |
625 | - | else if (!(isActive)) | |
626 | - | then throw("DApp is inactive at this moment") | |
627 | - | else if ((availableFund == 0)) | |
628 | - | then throw("You have 0 available SWOP") | |
629 | - | else if ((fraction(99, accountBalance(shareTokensId), 100) > shareTokenLocked)) | |
630 | - | then throw("Balance of share-token is greater than totalAmount") | |
631 | - | else [IntegerEntry((((pool + "_") + toString(i.caller)) + keyUserLastInterest), userNewInterest), IntegerEntry((pool + keyLastInterest), currentInterest), IntegerEntry((pool + keyLastInterestHeight), height), IntegerEntry((((pool + "_") + toString(i.caller)) + keyAvailableSWOP), 0), Reissue(SWOP, availableFund, true), IntegerEntry((((pool + "_") + toString(i.caller)) + keyUserSWOPClaimedAmount), userClaimedAmountNew), IntegerEntry((((pool + "_") + toString(i.caller)) + keyUserSWOPLastClaimedAmount), claimAmount), ScriptTransfer(i.caller, availableFund, SWOP)] | |
632 | - | } | |
529 | + | func unlockUserLock (pool,user) = valueOrElse(isActive(), { | |
530 | + | let lockWavesFee = getIntegerValue(this, kLockWavesFee) | |
531 | + | let userLockedHeigt = valueOrErrorMessage(getInteger(this, (((pool + "_") + user) + kUserShareTokensLockedHeight)), (((("There is no pool " + pool) + " or user ") + user) + "with lock")) | |
532 | + | let totalShareVirtual = getIntegerValue(this, (pool + kShareTokensVirtual)) | |
533 | + | let userStakedAmount = valueOrElse(getInteger(this, (((pool + "_") + user) + kUserShareTokensStaked)), 0) | |
534 | + | let userLockedAmount = valueOrElse(getInteger(this, (((pool + "_") + user) + kUserShareTokensLocked)), 0) | |
535 | + | let userAmountVirtual = valueOrElse(getInteger(this, (((pool + "_") + user) + kUserShareTokensVirtual)), userStakedAmount) | |
536 | + | if ((userLockedHeigt > height)) | |
537 | + | then throw(("You can't unlock sharetokens till " + toString(userLockedHeigt))) | |
538 | + | else { | |
539 | + | let userStakedAmountNew = (userStakedAmount + userLockedAmount) | |
540 | + | let $t02752527624 = claimCalc(pool, user) | |
541 | + | let farmInterest = $t02752527624._1 | |
542 | + | let boostInterest = $t02752527624._2 | |
543 | + | let boostLPinterest = $t02752527624._3 | |
544 | + | let claimAmount = $t02752527624._4 | |
545 | + | let toTreasure = $t02752527624._5 | |
546 | + | let availableFundsNew = (userAvailableSWOP(pool, i.originCaller) + claimAmount) | |
547 | + | [IntegerEntry((((pool + "_") + user) + kFarmUserLastInterest), farmInterest), IntegerEntry((((pool + "_") + user) + kBoostUserLastInterest), boostInterest), IntegerEntry((((pool + "_") + user) + kBoostLPLastInterest), boostLPinterest), IntegerEntry((pool + kFarmLastInterest), farmInterest), IntegerEntry((pool + kBoostLastInterest), boostInterest), IntegerEntry((pool + kBoostLPLastInterest), boostLPinterest), IntegerEntry((pool + kLastInterestHeight), height), IntegerEntry((((pool + "_") + user) + kUserShareTokensStaked), userStakedAmountNew), IntegerEntry((((pool + "_") + user) + kUserShareTokensVirtual), userStakedAmountNew), IntegerEntry((pool + kShareTokensVirtual), ((totalShareVirtual - userAmountVirtual) + userStakedAmountNew)), DeleteEntry((((pool + "_") + user) + kUserShareTokensLocked)), DeleteEntry((((pool + "_") + user) + kUserShareTokensLockedHeight)), DeleteEntry((((pool + "_") + user) + kUserShareTokensLockedType)), Reissue(SWOP, toTreasure, true), ScriptTransfer(airdropMoneyBoxAddr, toTreasure, SWOP), ScriptTransfer(i.caller, lockWavesFee, unit)] | |
548 | + | } | |
549 | + | }) | |
633 | 550 | ||
634 | 551 | ||
635 | 552 | ||
636 | 553 | @Callable(i) | |
637 | - | func shutdown () = if (!(isActive)) | |
638 | - | then throw(("DApp is already suspended. Cause: " + valueOrElse(getString(this, keyCause), "the cause wasn't specified"))) | |
639 | - | else if (!(containsElement([adminPubKey1, adminPubKey2, adminPubKey3], i.callerPublicKey))) | |
640 | - | then throw("Only admin can call this function") | |
641 | - | else suspend("Paused by admin") | |
554 | + | func withdrawShareTokens (pool,shareTokensWithdrawAmount) = valueOrElse(isActive(), { | |
555 | + | let shareTokensId = fromBase58String(getStringValue(value(addressFromString(pool)), "share_asset_id")) | |
556 | + | let user = toString(i.originCaller) | |
557 | + | let $t02912829227 = claimCalc(pool, user) | |
558 | + | let farmInterest = $t02912829227._1 | |
559 | + | let boostInterest = $t02912829227._2 | |
560 | + | let boostLPinterest = $t02912829227._3 | |
561 | + | let claimAmount = $t02912829227._4 | |
562 | + | let toTreasure = $t02912829227._5 | |
563 | + | let userStakedAmount = valueOrElse(getInteger(this, (((pool + "_") + user) + kUserShareTokensStaked)), 0) | |
564 | + | let userLockedAmount = valueOrElse(getInteger(this, (((pool + "_") + user) + kUserShareTokensLocked)), 0) | |
565 | + | let userStakedAmountNew = (userStakedAmount - shareTokensWithdrawAmount) | |
566 | + | let availableFundsNew = (userAvailableSWOP(pool, i.originCaller) + claimAmount) | |
567 | + | let totalShareAmount = getTotalShareTokenStaked(pool) | |
568 | + | let totalShareAmountNew = (totalShareAmount - shareTokensWithdrawAmount) | |
569 | + | if ((shareTokensWithdrawAmount > userStakedAmountNew)) | |
570 | + | then throw("Withdraw amount more then user locked amount") | |
571 | + | else if ((accountBalance(shareTokensId) > totalShareAmount)) | |
572 | + | then throw("Balance of share-token is lower than totalAmount") | |
573 | + | else { | |
574 | + | let uplp = if ((getString(Address(fromBase58String(pool)), "version") == "3.0.0")) | |
575 | + | then invoke(lpFarmingAddress, "updateUserInterest", [pool, (userStakedAmount + userLockedAmount)], nil) | |
576 | + | else 0 | |
577 | + | if ((uplp == uplp)) | |
578 | + | then [IntegerEntry((((pool + "_") + user) + kFarmUserLastInterest), farmInterest), IntegerEntry((((pool + "_") + user) + kBoostUserLastInterest), boostInterest), IntegerEntry((((pool + "_") + user) + kBoostLPLastInterest), boostLPinterest), IntegerEntry((pool + kFarmLastInterest), farmInterest), IntegerEntry((pool + kBoostLastInterest), boostInterest), IntegerEntry((pool + kBoostLPLastInterest), boostLPinterest), IntegerEntry((pool + kLastInterestHeight), height), IntegerEntry((((pool + "_") + user) + kUserShareTokensStaked), userStakedAmountNew), IntegerEntry((pool + kShareTotalShareTokens), totalShareAmountNew), IntegerEntry((((pool + "_") + user) + kAvailableSWOP), availableFundsNew), Reissue(SWOP, toTreasure, true), ScriptTransfer(airdropMoneyBoxAddr, toTreasure, SWOP), ScriptTransfer(i.caller, shareTokensWithdrawAmount, shareTokensId)] | |
579 | + | else throw("Strict value is not equal to itself.") | |
580 | + | } | |
581 | + | }) | |
642 | 582 | ||
643 | 583 | ||
644 | 584 | ||
645 | 585 | @Callable(i) | |
646 | - | func activate () = if (isActive) | |
586 | + | func claim (pool) = valueOrElse(isActive(), { | |
587 | + | let shareTokensId = fromBase58String(getStringValue(value(addressFromString(pool)), "share_asset_id")) | |
588 | + | let user = toString(i.caller) | |
589 | + | let shareTokenLocked = getTotalShareTokenStaked(pool) | |
590 | + | let $t03137331472 = claimCalc(pool, user) | |
591 | + | let farmInterest = $t03137331472._1 | |
592 | + | let boostInterest = $t03137331472._2 | |
593 | + | let boostLPinterest = $t03137331472._3 | |
594 | + | let claimAmount = $t03137331472._4 | |
595 | + | let toTreasure = $t03137331472._5 | |
596 | + | let availableFund = (userAvailableSWOP(pool, i.caller) + claimAmount) | |
597 | + | if ((availableFund == 0)) | |
598 | + | then throw("You have 0 available SWOP") | |
599 | + | else if ((accountBalance(shareTokensId) > shareTokenLocked)) | |
600 | + | then throw("Balance of share-token is lower than totalAmount") | |
601 | + | else $Tuple2([IntegerEntry((((pool + "_") + user) + kFarmUserLastInterest), farmInterest), IntegerEntry((((pool + "_") + user) + kBoostUserLastInterest), boostInterest), IntegerEntry((((pool + "_") + user) + kBoostLPLastInterest), boostLPinterest), IntegerEntry((pool + kFarmLastInterest), farmInterest), IntegerEntry((pool + kBoostLastInterest), boostInterest), IntegerEntry((pool + kBoostLPLastInterest), boostLPinterest), IntegerEntry((pool + kLastInterestHeight), height), IntegerEntry((((pool + "_") + user) + kAvailableSWOP), 0), Reissue(SWOP, (toTreasure + availableFund), true), ScriptTransfer(airdropMoneyBoxAddr, toTreasure, SWOP), ScriptTransfer(i.caller, availableFund, SWOP)], availableFund) | |
602 | + | }) | |
603 | + | ||
604 | + | ||
605 | + | ||
606 | + | @Callable(i) | |
607 | + | func claimAndStake (pool) = valueOrElse(isActive(), { | |
608 | + | let claimAmount = { | |
609 | + | let @ = invoke(this, "claim", [pool], nil) | |
610 | + | if ($isInstanceOf(@, "Int")) | |
611 | + | then @ | |
612 | + | else throw(($getType(@) + " couldn't be cast to Int")) | |
613 | + | } | |
614 | + | if ((claimAmount == claimAmount)) | |
615 | + | then { | |
616 | + | let stakeToGov = invoke(govAddress, "lockSWOPFromFarming", nil, [AttachedPayment(SWOP, claimAmount)]) | |
617 | + | if ((stakeToGov == stakeToGov)) | |
618 | + | then nil | |
619 | + | else throw("Strict value is not equal to itself.") | |
620 | + | } | |
621 | + | else throw("Strict value is not equal to itself.") | |
622 | + | }) | |
623 | + | ||
624 | + | ||
625 | + | ||
626 | + | @Callable(i) | |
627 | + | func claimAll (pools) = valueOrElse(isActive(), { | |
628 | + | func claimInv (claimTotal,pool) = { | |
629 | + | let claimAmount = { | |
630 | + | let @ = invoke(this, "claim", [pool], nil) | |
631 | + | if ($isInstanceOf(@, "Int")) | |
632 | + | then @ | |
633 | + | else throw(($getType(@) + " couldn't be cast to Int")) | |
634 | + | } | |
635 | + | if ((claimAmount == claimAmount)) | |
636 | + | then (claimTotal + claimAmount) | |
637 | + | else throw("Strict value is not equal to itself.") | |
638 | + | } | |
639 | + | ||
640 | + | let claimTotal = { | |
641 | + | let $l = pools | |
642 | + | let $s = size($l) | |
643 | + | let $acc0 = 0 | |
644 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
645 | + | then $a | |
646 | + | else claimInv($a, $l[$i]) | |
647 | + | ||
648 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
649 | + | then $a | |
650 | + | else throw("List size exceeds 60") | |
651 | + | ||
652 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 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), 57), 58), 59), 60) | |
653 | + | } | |
654 | + | if ((claimTotal == 0)) | |
655 | + | then throw("You have 0 available SWOP") | |
656 | + | else [ScriptTransfer(i.caller, claimTotal, SWOP)] | |
657 | + | }) | |
658 | + | ||
659 | + | ||
660 | + | ||
661 | + | @Callable(i) | |
662 | + | func claimAllAndStake (pools) = valueOrElse(isActive(), { | |
663 | + | func claimInv (claimTotal,pool) = { | |
664 | + | let claimAmount = { | |
665 | + | let @ = invoke(this, "claim", [pool], nil) | |
666 | + | if ($isInstanceOf(@, "Int")) | |
667 | + | then @ | |
668 | + | else throw(($getType(@) + " couldn't be cast to Int")) | |
669 | + | } | |
670 | + | if ((claimAmount == claimAmount)) | |
671 | + | then (claimTotal + claimAmount) | |
672 | + | else throw("Strict value is not equal to itself.") | |
673 | + | } | |
674 | + | ||
675 | + | let claimTotal = { | |
676 | + | let $l = pools | |
677 | + | let $s = size($l) | |
678 | + | let $acc0 = 0 | |
679 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
680 | + | then $a | |
681 | + | else claimInv($a, $l[$i]) | |
682 | + | ||
683 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
684 | + | then $a | |
685 | + | else throw("List size exceeds 60") | |
686 | + | ||
687 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 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), 57), 58), 59), 60) | |
688 | + | } | |
689 | + | if ((claimTotal == 0)) | |
690 | + | then throw("You have 0 available SWOP") | |
691 | + | else { | |
692 | + | let stakeToGov = invoke(govAddress, "lockSWOPFromFarming", nil, [AttachedPayment(SWOP, claimTotal)]) | |
693 | + | if ((stakeToGov == stakeToGov)) | |
694 | + | then nil | |
695 | + | else throw("Strict value is not equal to itself.") | |
696 | + | } | |
697 | + | }) | |
698 | + | ||
699 | + | ||
700 | + | ||
701 | + | @Callable(i) | |
702 | + | func updateUserBoostInterest (pool,user) = valueOrElse(isActive(), if ((i.caller != votingAddress)) | |
703 | + | then throw("Only voiting can call this function") | |
704 | + | else { | |
705 | + | let $t03385233951 = claimCalc(pool, user) | |
706 | + | let farmInterest = $t03385233951._1 | |
707 | + | let boostInterest = $t03385233951._2 | |
708 | + | let boostLPinterest = $t03385233951._3 | |
709 | + | let claimAmount = $t03385233951._4 | |
710 | + | let toTreasure = $t03385233951._5 | |
711 | + | let availableFundsNew = (userAvailableSWOP(pool, i.originCaller) + claimAmount) | |
712 | + | [IntegerEntry((((pool + "_") + user) + kFarmUserLastInterest), farmInterest), IntegerEntry((((pool + "_") + user) + kBoostUserLastInterest), boostInterest), IntegerEntry((((pool + "_") + user) + kBoostLPLastInterest), boostLPinterest), IntegerEntry((pool + kFarmLastInterest), farmInterest), IntegerEntry((pool + kBoostLastInterest), boostInterest), IntegerEntry((pool + kBoostLPLastInterest), boostLPinterest), IntegerEntry((pool + kLastInterestHeight), height), IntegerEntry((((pool + "_") + user) + kAvailableSWOP), availableFundsNew), Reissue(SWOP, toTreasure, true), ScriptTransfer(airdropMoneyBoxAddr, toTreasure, SWOP)] | |
713 | + | }) | |
714 | + | ||
715 | + | ||
716 | + | ||
717 | + | @Callable(i) | |
718 | + | func shutdown () = valueOrElse(isAdminCall(i), if (!(active)) | |
719 | + | then throw(("DApp is already suspended. Cause: " + valueOrElse(getString(this, kCause), "the cause wasn't specified"))) | |
720 | + | else suspend("Paused by admin")) | |
721 | + | ||
722 | + | ||
723 | + | ||
724 | + | @Callable(i) | |
725 | + | func activate () = valueOrElse(isAdminCall(i), if (active) | |
647 | 726 | then throw("DApp is already active") | |
648 | - | else if (!(containsElement([adminPubKey1, adminPubKey2, adminPubKey3], i.callerPublicKey))) | |
649 | - | then throw("Only admin can call this function") | |
650 | - | else [BooleanEntry(keyActive, true), DeleteEntry(keyCause)] | |
727 | + | else [BooleanEntry(kActive, true), DeleteEntry(kCause)]) | |
651 | 728 | ||
652 | 729 | ||
653 | 730 | @Verifier(tx) | |
654 | 731 | func verify () = match tx { | |
655 | 732 | case _ => | |
656 | 733 | let adminPubKey1Signed = if (sigVerify(tx.bodyBytes, tx.proofs[0], adminPubKey1)) | |
657 | 734 | then 1 | |
658 | 735 | else 0 | |
659 | 736 | let adminPubKey2Signed = if (sigVerify(tx.bodyBytes, tx.proofs[1], adminPubKey2)) | |
660 | 737 | then 1 | |
661 | 738 | else 0 | |
662 | 739 | let adminPubKey3Signed = if (sigVerify(tx.bodyBytes, tx.proofs[2], adminPubKey3)) | |
663 | 740 | then 1 | |
664 | 741 | else 0 | |
665 | 742 | (((adminPubKey1Signed + adminPubKey2Signed) + adminPubKey3Signed) >= 2) | |
666 | 743 | } | |
667 | 744 |
github/deemru/w8io/169f3d6 138.55 ms ◑