tx · 2JsLCLr8TAHm522o8DVhYvuosqNLE3aH4L4nVTMzpnVX 3NCCBQA6ADQN4o5mP4UpyWQy3QgAc2f68X8: -0.01400000 Waves 2020.12.17 14:54 [1312669] smart account 3NCCBQA6ADQN4o5mP4UpyWQy3QgAc2f68X8 > SELF 0.00000000 Waves
{ "type": 13, "id": "2JsLCLr8TAHm522o8DVhYvuosqNLE3aH4L4nVTMzpnVX", "fee": 1400000, "feeAssetId": null, "timestamp": 1608206133267, "version": 1, "sender": "3NCCBQA6ADQN4o5mP4UpyWQy3QgAc2f68X8", "senderPublicKey": "7nhhzx1b9hckmwzpZJ7SPQmdrVrDgcfGCgZn9qvMnXCJ", "proofs": [ "5N92i6zSWmnJudwDNvVAUrGsLZ1puFUZsSnJwS9fi2S1D2QkpUd5zVqxekHTWaCDS8EWyu5JkYAB3NkDidPDb2vB" ], "script": "base64:AAIEAAAAAAAAABoIAhIAEgMKAQgSAwoBCBIECgIIARIECgIIAQAAAB8AAAAADGFkbWluUHViS2V5MQEAAAAgELDi6uQgdVvao3EGz2pOOnWzKruRdXrpd4DobbWyZx8AAAAADGFkbWluUHViS2V5MgEAAAAgELDi6uQgdVvao3EGz2pOOnWzKruRdXrpd4DobbWyZx8AAAAADGFkbWluUHViS2V5MwEAAAAgELDi6uQgdVvao3EGz2pOOnWzKruRdXrpd4DobbWyZx8AAAAAFGFkbWluUHViS2V5U3RhcnRTdG9wAQAAACAQsOLq5CB1W9qjcQbPak46dbMqu5F1eul3gOhttbJnHwAAAAASYWRtaW5QdWJLZXlTdGFraW5nAQAAACAQsOLq5CB1W9qjcQbPak46dbMqu5F1eul3gOhttbJnHwAAAAAUa2V5U2hhcmVUb2tlbnNMb2NrZWQCAAAAGl90b3RhbF9zaGFyZV90b2tlbnNfbG9ja2VkAAAAABBrZXlDdXJyZW50UmV3YXJkAgAAAA9fY3VycmVudF9yZXdhcmQAAAAAFWtleVJld2FyZFVwZGF0ZUhlaWdodAIAAAAVX3Jld2FyZF91cGRh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AAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAAFpAAAABmNhbGxlcgUAAAAOY2xhaW1BbW91bnRBc2sFAAAABFNXT1AFAAAAA25pbAAAAAAzku02", "chainId": 84, "height": 1312669, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 4iPcNWCpR5gcSy1PjL2b8fByoQJG8KwYreH6UjLcV1Va Next: none Diff:
Old | New | Differences | |
---|---|---|---|
122 | 122 | } | |
123 | 123 | ||
124 | 124 | ||
125 | - | func | |
125 | + | func claimCalc (pool,caller) = { | |
126 | 126 | let shareAssetId = getShareAssetId(pool) | |
127 | 127 | let scaleValue = calcScaleValue(SWOP, shareAssetId) | |
128 | 128 | let shareTokenLocked = getTotalShareTokenLocked(pool) | |
129 | - | let $ | |
130 | - | let lastInterestHeight = $ | |
131 | - | let lastInterest = $ | |
132 | - | let $ | |
133 | - | let currentRewardPerBlock = $ | |
134 | - | let rewardUpdateHeight = $ | |
135 | - | let previousRewardPerBlock = $ | |
136 | - | let $ | |
137 | - | let userLastInterest = $ | |
138 | - | let userShareTokensAmount = $ | |
129 | + | let $t055375602 = getLastInterestInfo(pool) | |
130 | + | let lastInterestHeight = $t055375602._1 | |
131 | + | let lastInterest = $t055375602._2 | |
132 | + | let $t056075695 = rewardInfo(pool) | |
133 | + | let currentRewardPerBlock = $t056075695._1 | |
134 | + | let rewardUpdateHeight = $t056075695._2 | |
135 | + | let previousRewardPerBlock = $t056075695._3 | |
136 | + | let $t057005779 = getUserInterestInfo(pool, caller) | |
137 | + | let userLastInterest = $t057005779._1 | |
138 | + | let userShareTokensAmount = $t057005779._2 | |
139 | 139 | let currentInterest = calcInterest(lastInterestHeight, rewardUpdateHeight, lastInterest, currentRewardPerBlock, shareTokenLocked, previousRewardPerBlock, shareAssetId, scaleValue) | |
140 | 140 | let claimAmount = fraction(userShareTokensAmount, (currentInterest - userLastInterest), scaleValue) | |
141 | 141 | let userNewInterest = currentInterest | |
167 | 167 | func initPoolShareFarming (pool) = if (!(containsElement([adminPubKey1, adminPubKey2, adminPubKey3], i.callerPublicKey))) | |
168 | 168 | then throw("Only admin can call this function") | |
169 | 169 | else { | |
170 | - | let $ | |
171 | - | let currentReward = $ | |
172 | - | let rewardUpdateHeight = $ | |
173 | - | let previousRewardPerBlock = $ | |
170 | + | let $t071427222 = rewardInfo(pool) | |
171 | + | let currentReward = $t071427222._1 | |
172 | + | let rewardUpdateHeight = $t071427222._2 | |
173 | + | let previousRewardPerBlock = $t071427222._3 | |
174 | 174 | [StringEntry((pool + keyPoolAddress), pool), IntegerEntry((pool + keyShareTokensLocked), 0), IntegerEntry((pool + keyCurrentReward), 0), IntegerEntry((pool + keyLastInterest), 0), IntegerEntry((pool + keyLastInterestHeight), height), IntegerEntry((pool + keyRewardUpdateHeight), rewardUpdateHeight), IntegerEntry((pool + keyPreviousReward), previousRewardPerBlock)] | |
175 | 175 | } | |
176 | 176 | ||
178 | 178 | ||
179 | 179 | @Callable(i) | |
180 | 180 | func lockShareTokens (pool) = { | |
181 | - | let $ | |
182 | - | let pmtAmount = $ | |
183 | - | let pmtAssetId = $ | |
181 | + | let $t076727747 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
182 | + | let pmtAmount = $t076727747._1 | |
183 | + | let pmtAssetId = $t076727747._2 | |
184 | 184 | if (!(checkPmtAssetIdCorrect(pool, pmtAssetId))) | |
185 | 185 | then throw("Incorrect pmtAssetId") | |
186 | 186 | else { | |
187 | - | let $ | |
188 | - | let userNewInterest = $ | |
189 | - | let currentInterest = $ | |
190 | - | let claimAmount = $ | |
191 | - | let userShareTokensAmount = $ | |
187 | + | let $t078407938 = claimCalc(pool, i.caller) | |
188 | + | let userNewInterest = $t078407938._1 | |
189 | + | let currentInterest = $t078407938._2 | |
190 | + | let claimAmount = $t078407938._3 | |
191 | + | let userShareTokensAmount = $t078407938._4 | |
192 | 192 | let userShareAmountNew = (userShareTokensAmount + pmtAmount) | |
193 | 193 | let availableFundsNew = (userAvailableFunds(pool, i.caller) + claimAmount) | |
194 | 194 | let totalShareAmount = getTotalShareTokenLocked(pool) | |
201 | 201 | ||
202 | 202 | @Callable(i) | |
203 | 203 | func withdrawShareTokens (pool,shareTokensWithdrawAmount) = { | |
204 | - | let $ | |
205 | - | let userNewInterest = $ | |
206 | - | let currentInterest = $ | |
207 | - | let claimAmount = $ | |
208 | - | let userShareTokensAmount = $ | |
204 | + | let $t088918989 = claimCalc(pool, i.caller) | |
205 | + | let userNewInterest = $t088918989._1 | |
206 | + | let currentInterest = $t088918989._2 | |
207 | + | let claimAmount = $t088918989._3 | |
208 | + | let userShareTokensAmount = $t088918989._4 | |
209 | 209 | if ((shareTokensWithdrawAmount > userShareTokensAmount)) | |
210 | 210 | then throw("Withdraw amount more then user locked amount") | |
211 | 211 | else { | |
221 | 221 | @Callable(i) | |
222 | 222 | func claim (pool,claimAmountAsk) = { | |
223 | 223 | let shareTokenLocked = getTotalShareTokenLocked(pool) | |
224 | - | let $ | |
225 | - | let lastInterestHeight = $ | |
226 | - | let lastInterest = $ | |
227 | - | let $ | |
228 | - | let currentRewardPerBlock = $ | |
229 | - | let rewardUpdateHeight = $ | |
230 | - | let previousRewardPerBlock = $ | |
231 | - | let $ | |
232 | - | let userNewInterest = $ | |
233 | - | let currentInterest = $ | |
234 | - | let claimAmount = $ | |
235 | - | let userShareTokensAmount = $ | |
224 | + | let $t01000810073 = getLastInterestInfo(pool) | |
225 | + | let lastInterestHeight = $t01000810073._1 | |
226 | + | let lastInterest = $t01000810073._2 | |
227 | + | let $t01007810242 = rewardInfo(pool) | |
228 | + | let currentRewardPerBlock = $t01007810242._1 | |
229 | + | let rewardUpdateHeight = $t01007810242._2 | |
230 | + | let previousRewardPerBlock = $t01007810242._3 | |
231 | + | let $t01024710345 = claimCalc(pool, i.caller) | |
232 | + | let userNewInterest = $t01024710345._1 | |
233 | + | let currentInterest = $t01024710345._2 | |
234 | + | let claimAmount = $t01024710345._3 | |
235 | + | let userShareTokensAmount = $t01024710345._4 | |
236 | 236 | let availableFund = (userAvailableFunds(pool, i.caller) + claimAmount) | |
237 | 237 | if ((claimAmountAsk > availableFund)) | |
238 | 238 | then throw(((("You ask more SWOP then you have. Available SWOP: " + toString(availableFund)) + ". You ask: ") + toString(claimAmountAsk))) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 4 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let adminPubKey1 = base58'289xpUrYrKbLjaKkqH3XNhfecukcYRaDRT3JDrvkvQRU' | |
5 | 5 | ||
6 | 6 | let adminPubKey2 = base58'289xpUrYrKbLjaKkqH3XNhfecukcYRaDRT3JDrvkvQRU' | |
7 | 7 | ||
8 | 8 | let adminPubKey3 = base58'289xpUrYrKbLjaKkqH3XNhfecukcYRaDRT3JDrvkvQRU' | |
9 | 9 | ||
10 | 10 | let adminPubKeyStartStop = base58'289xpUrYrKbLjaKkqH3XNhfecukcYRaDRT3JDrvkvQRU' | |
11 | 11 | ||
12 | 12 | let adminPubKeyStaking = base58'289xpUrYrKbLjaKkqH3XNhfecukcYRaDRT3JDrvkvQRU' | |
13 | 13 | ||
14 | 14 | let keyShareTokensLocked = "_total_share_tokens_locked" | |
15 | 15 | ||
16 | 16 | let keyCurrentReward = "_current_reward" | |
17 | 17 | ||
18 | 18 | let keyRewardUpdateHeight = "_reward_update_height" | |
19 | 19 | ||
20 | 20 | let keyPreviousReward = "_previous_reward" | |
21 | 21 | ||
22 | 22 | let keyLastInterest = "_last_interest" | |
23 | 23 | ||
24 | 24 | let keyLastInterestHeight = "_last_interest_height" | |
25 | 25 | ||
26 | 26 | let keyUserShareTokensLocked = "_share_tokens_locked" | |
27 | 27 | ||
28 | 28 | let keyUserLastInterest = "_last_interest" | |
29 | 29 | ||
30 | 30 | let keySWOPid = "SWOP_id" | |
31 | 31 | ||
32 | 32 | let keyPoolAddress = "_address" | |
33 | 33 | ||
34 | 34 | let keyAvailableFunds = "_available_funds" | |
35 | 35 | ||
36 | 36 | let votingAddress = Address(base58'3N5F5DCmWNzT8ZPe1tBfiXaVYzWJriaJZ9E') | |
37 | 37 | ||
38 | 38 | let SWOP = fromBase58String(getStringValue(this, keySWOPid)) | |
39 | 39 | ||
40 | 40 | let heightRewardUpdate = getIntegerValue(this, "height_reward_update") | |
41 | 41 | ||
42 | 42 | func throwOnlyAdmin () = throw("Only admin can call this function") | |
43 | 43 | ||
44 | 44 | ||
45 | 45 | func throwIsActive () = throw("DApp is already active") | |
46 | 46 | ||
47 | 47 | ||
48 | 48 | func getTotalShareTokenLocked (pool) = valueOrErrorMessage(getInteger(this, (pool + keyShareTokensLocked)), (("No data on the key: " + pool) + keyShareTokensLocked)) | |
49 | 49 | ||
50 | 50 | ||
51 | 51 | func getShareAssetId (pool) = fromBase58String(getStringValue(value(addressFromString(pool)), "share_asset_id")) | |
52 | 52 | ||
53 | 53 | ||
54 | 54 | func calcScaleValue (assetId1,assetId2) = { | |
55 | 55 | let assetId1Decimals = value(assetInfo(assetId1)).decimals | |
56 | 56 | let assetId2Decimals = value(assetInfo(assetId2)).decimals | |
57 | 57 | let sclaeDigits = ((assetId2Decimals - assetId1Decimals) + 8) | |
58 | 58 | pow(10, 0, sclaeDigits, 0, 0, HALFDOWN) | |
59 | 59 | } | |
60 | 60 | ||
61 | 61 | ||
62 | 62 | func userAvailableFunds (pool,user) = { | |
63 | 63 | let availableFunds = getInteger(this, ((((pool + "_") + toString(user)) + "_") + keyAvailableFunds)) | |
64 | 64 | let avbF = match availableFunds { | |
65 | 65 | case avbF: Int => | |
66 | 66 | avbF | |
67 | 67 | case avbF: Unit => | |
68 | 68 | 0 | |
69 | 69 | case _ => | |
70 | 70 | throw("Match error") | |
71 | 71 | } | |
72 | 72 | avbF | |
73 | 73 | } | |
74 | 74 | ||
75 | 75 | ||
76 | 76 | func rewardInfo (pool) = { | |
77 | 77 | let currentReward = valueOrErrorMessage(getInteger(votingAddress, (pool + keyCurrentReward)), (((("No data on the key: " + pool) + keyCurrentReward) + " at address ") + toString(votingAddress))) | |
78 | 78 | let rewardUpdateHeight = valueOrErrorMessage(getInteger(votingAddress, (pool + keyRewardUpdateHeight)), (((("No data on the key: " + pool) + keyRewardUpdateHeight) + " at address ") + toString(votingAddress))) | |
79 | 79 | let rewardPreviousAmount = valueOrErrorMessage(getInteger(votingAddress, (pool + keyRewardUpdateHeight)), (((("No data on the key: " + pool) + keyPreviousReward) + " at address ") + toString(votingAddress))) | |
80 | 80 | $Tuple3(currentReward, rewardUpdateHeight, rewardPreviousAmount) | |
81 | 81 | } | |
82 | 82 | ||
83 | 83 | ||
84 | 84 | func getLastInterestInfo (pool) = { | |
85 | 85 | let lastInterest = valueOrErrorMessage(getInteger(this, (pool + keyLastInterest)), (((("No data on the key: " + pool) + "_") + pool) + keyLastInterest)) | |
86 | 86 | let lastInterestHeight = valueOrErrorMessage(getInteger(this, (pool + keyLastInterestHeight)), (("No data on the key: " + pool) + keyLastInterestHeight)) | |
87 | 87 | $Tuple2(lastInterestHeight, lastInterest) | |
88 | 88 | } | |
89 | 89 | ||
90 | 90 | ||
91 | 91 | func getUserInterestInfo (pool,userAddres) = { | |
92 | 92 | let userLastInterest = getInteger(this, (((pool + "_") + toString(userAddres)) + keyUserLastInterest)) | |
93 | 93 | let userShare = getInteger(this, (((pool + "_") + toString(userAddres)) + keyUserShareTokensLocked)) | |
94 | 94 | let userLastInterestValue = match userLastInterest { | |
95 | 95 | case userLastInterest: Int => | |
96 | 96 | userLastInterest | |
97 | 97 | case _ => | |
98 | 98 | 0 | |
99 | 99 | } | |
100 | 100 | let userShareTokensAmount = match userShare { | |
101 | 101 | case userShare: Int => | |
102 | 102 | userShare | |
103 | 103 | case _ => | |
104 | 104 | 0 | |
105 | 105 | } | |
106 | 106 | $Tuple2(userLastInterestValue, userShareTokensAmount) | |
107 | 107 | } | |
108 | 108 | ||
109 | 109 | ||
110 | 110 | func calcInterest (lastInterestHeight,rewardUpdateHeight,lastInterest,currentRewardPerBlock,shareTokenLocked,previousRewardPerBlock,shareAssetId,scaleValue) = if ((lastInterestHeight > rewardUpdateHeight)) | |
111 | 111 | then if ((shareTokenLocked == 0)) | |
112 | 112 | then 0 | |
113 | 113 | else { | |
114 | 114 | let reward = (currentRewardPerBlock * (height - lastInterestHeight)) | |
115 | 115 | (lastInterest + fraction(reward, scaleValue, shareTokenLocked)) | |
116 | 116 | } | |
117 | 117 | else { | |
118 | 118 | let rewardAfterLastInterestBeforeReawardUpdate = (previousRewardPerBlock * (rewardUpdateHeight - lastInterestHeight)) | |
119 | 119 | let interestAfterUpdate = (lastInterest + fraction(rewardAfterLastInterestBeforeReawardUpdate, scaleValue, shareTokenLocked)) | |
120 | 120 | let reward = (currentRewardPerBlock * (height - rewardUpdateHeight)) | |
121 | 121 | (interestAfterUpdate + fraction(reward, scaleValue, shareTokenLocked)) | |
122 | 122 | } | |
123 | 123 | ||
124 | 124 | ||
125 | - | func | |
125 | + | func claimCalc (pool,caller) = { | |
126 | 126 | let shareAssetId = getShareAssetId(pool) | |
127 | 127 | let scaleValue = calcScaleValue(SWOP, shareAssetId) | |
128 | 128 | let shareTokenLocked = getTotalShareTokenLocked(pool) | |
129 | - | let $ | |
130 | - | let lastInterestHeight = $ | |
131 | - | let lastInterest = $ | |
132 | - | let $ | |
133 | - | let currentRewardPerBlock = $ | |
134 | - | let rewardUpdateHeight = $ | |
135 | - | let previousRewardPerBlock = $ | |
136 | - | let $ | |
137 | - | let userLastInterest = $ | |
138 | - | let userShareTokensAmount = $ | |
129 | + | let $t055375602 = getLastInterestInfo(pool) | |
130 | + | let lastInterestHeight = $t055375602._1 | |
131 | + | let lastInterest = $t055375602._2 | |
132 | + | let $t056075695 = rewardInfo(pool) | |
133 | + | let currentRewardPerBlock = $t056075695._1 | |
134 | + | let rewardUpdateHeight = $t056075695._2 | |
135 | + | let previousRewardPerBlock = $t056075695._3 | |
136 | + | let $t057005779 = getUserInterestInfo(pool, caller) | |
137 | + | let userLastInterest = $t057005779._1 | |
138 | + | let userShareTokensAmount = $t057005779._2 | |
139 | 139 | let currentInterest = calcInterest(lastInterestHeight, rewardUpdateHeight, lastInterest, currentRewardPerBlock, shareTokenLocked, previousRewardPerBlock, shareAssetId, scaleValue) | |
140 | 140 | let claimAmount = fraction(userShareTokensAmount, (currentInterest - userLastInterest), scaleValue) | |
141 | 141 | let userNewInterest = currentInterest | |
142 | 142 | $Tuple4(userNewInterest, currentInterest, claimAmount, userShareTokensAmount) | |
143 | 143 | } | |
144 | 144 | ||
145 | 145 | ||
146 | 146 | func checkPmtAssetIdCorrect (pool,pmtAssetId) = { | |
147 | 147 | let poolAddres = value(addressFromString(getStringValue(this, (pool + keyPoolAddress)))) | |
148 | 148 | let poolShareAssetId = fromBase58String(getStringValue(poolAddres, "share_asset_id")) | |
149 | 149 | if ((pmtAssetId == poolShareAssetId)) | |
150 | 150 | then true | |
151 | 151 | else false | |
152 | 152 | } | |
153 | 153 | ||
154 | 154 | ||
155 | 155 | @Callable(i) | |
156 | 156 | func init () = if (!(containsElement([adminPubKey1, adminPubKey2, adminPubKey3], i.callerPublicKey))) | |
157 | 157 | then throw("Only admin can call this function") | |
158 | 158 | else { | |
159 | 159 | let SWOPissue = Issue("SWOP", "SWOP protocol token", 1, 8, true) | |
160 | 160 | let SWOPid = calculateAssetId(SWOPissue) | |
161 | 161 | [Issue("SWOP", "SWOP protocol token", 1, 8, true), StringEntry(keySWOPid, toBase58String(SWOPid))] | |
162 | 162 | } | |
163 | 163 | ||
164 | 164 | ||
165 | 165 | ||
166 | 166 | @Callable(i) | |
167 | 167 | func initPoolShareFarming (pool) = if (!(containsElement([adminPubKey1, adminPubKey2, adminPubKey3], i.callerPublicKey))) | |
168 | 168 | then throw("Only admin can call this function") | |
169 | 169 | else { | |
170 | - | let $ | |
171 | - | let currentReward = $ | |
172 | - | let rewardUpdateHeight = $ | |
173 | - | let previousRewardPerBlock = $ | |
170 | + | let $t071427222 = rewardInfo(pool) | |
171 | + | let currentReward = $t071427222._1 | |
172 | + | let rewardUpdateHeight = $t071427222._2 | |
173 | + | let previousRewardPerBlock = $t071427222._3 | |
174 | 174 | [StringEntry((pool + keyPoolAddress), pool), IntegerEntry((pool + keyShareTokensLocked), 0), IntegerEntry((pool + keyCurrentReward), 0), IntegerEntry((pool + keyLastInterest), 0), IntegerEntry((pool + keyLastInterestHeight), height), IntegerEntry((pool + keyRewardUpdateHeight), rewardUpdateHeight), IntegerEntry((pool + keyPreviousReward), previousRewardPerBlock)] | |
175 | 175 | } | |
176 | 176 | ||
177 | 177 | ||
178 | 178 | ||
179 | 179 | @Callable(i) | |
180 | 180 | func lockShareTokens (pool) = { | |
181 | - | let $ | |
182 | - | let pmtAmount = $ | |
183 | - | let pmtAssetId = $ | |
181 | + | let $t076727747 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
182 | + | let pmtAmount = $t076727747._1 | |
183 | + | let pmtAssetId = $t076727747._2 | |
184 | 184 | if (!(checkPmtAssetIdCorrect(pool, pmtAssetId))) | |
185 | 185 | then throw("Incorrect pmtAssetId") | |
186 | 186 | else { | |
187 | - | let $ | |
188 | - | let userNewInterest = $ | |
189 | - | let currentInterest = $ | |
190 | - | let claimAmount = $ | |
191 | - | let userShareTokensAmount = $ | |
187 | + | let $t078407938 = claimCalc(pool, i.caller) | |
188 | + | let userNewInterest = $t078407938._1 | |
189 | + | let currentInterest = $t078407938._2 | |
190 | + | let claimAmount = $t078407938._3 | |
191 | + | let userShareTokensAmount = $t078407938._4 | |
192 | 192 | let userShareAmountNew = (userShareTokensAmount + pmtAmount) | |
193 | 193 | let availableFundsNew = (userAvailableFunds(pool, i.caller) + claimAmount) | |
194 | 194 | let totalShareAmount = getTotalShareTokenLocked(pool) | |
195 | 195 | let totalShareAmountNew = (totalShareAmount + pmtAmount) | |
196 | 196 | [IntegerEntry((((pool + "_") + toString(i.caller)) + keyUserLastInterest), userNewInterest), IntegerEntry((((pool + "_") + toString(i.caller)) + keyUserShareTokensLocked), userShareAmountNew), IntegerEntry((pool + keyLastInterest), currentInterest), IntegerEntry((pool + keyLastInterestHeight), height), IntegerEntry((pool + keyShareTokensLocked), totalShareAmountNew), IntegerEntry(((((pool + "_") + toString(i.caller)) + "_") + keyAvailableFunds), availableFundsNew)] | |
197 | 197 | } | |
198 | 198 | } | |
199 | 199 | ||
200 | 200 | ||
201 | 201 | ||
202 | 202 | @Callable(i) | |
203 | 203 | func withdrawShareTokens (pool,shareTokensWithdrawAmount) = { | |
204 | - | let $ | |
205 | - | let userNewInterest = $ | |
206 | - | let currentInterest = $ | |
207 | - | let claimAmount = $ | |
208 | - | let userShareTokensAmount = $ | |
204 | + | let $t088918989 = claimCalc(pool, i.caller) | |
205 | + | let userNewInterest = $t088918989._1 | |
206 | + | let currentInterest = $t088918989._2 | |
207 | + | let claimAmount = $t088918989._3 | |
208 | + | let userShareTokensAmount = $t088918989._4 | |
209 | 209 | if ((shareTokensWithdrawAmount > userShareTokensAmount)) | |
210 | 210 | then throw("Withdraw amount more then user locked amount") | |
211 | 211 | else { | |
212 | 212 | let userShareAmountNew = (userShareTokensAmount - shareTokensWithdrawAmount) | |
213 | 213 | let availableFundsNew = (userAvailableFunds(pool, i.caller) + claimAmount) | |
214 | 214 | let shareTokensId = fromBase58String(getStringValue(value(addressFromString(pool)), "share_asset_id")) | |
215 | 215 | [IntegerEntry((((pool + "_") + toString(i.caller)) + keyUserLastInterest), userNewInterest), IntegerEntry((((pool + "_") + toString(i.caller)) + keyUserShareTokensLocked), userShareAmountNew), IntegerEntry((pool + keyLastInterest), currentInterest), IntegerEntry((pool + keyLastInterestHeight), height), IntegerEntry(((((pool + "_") + toString(i.caller)) + "_") + keyAvailableFunds), availableFundsNew), ScriptTransfer(i.caller, shareTokensWithdrawAmount, shareTokensId)] | |
216 | 216 | } | |
217 | 217 | } | |
218 | 218 | ||
219 | 219 | ||
220 | 220 | ||
221 | 221 | @Callable(i) | |
222 | 222 | func claim (pool,claimAmountAsk) = { | |
223 | 223 | let shareTokenLocked = getTotalShareTokenLocked(pool) | |
224 | - | let $ | |
225 | - | let lastInterestHeight = $ | |
226 | - | let lastInterest = $ | |
227 | - | let $ | |
228 | - | let currentRewardPerBlock = $ | |
229 | - | let rewardUpdateHeight = $ | |
230 | - | let previousRewardPerBlock = $ | |
231 | - | let $ | |
232 | - | let userNewInterest = $ | |
233 | - | let currentInterest = $ | |
234 | - | let claimAmount = $ | |
235 | - | let userShareTokensAmount = $ | |
224 | + | let $t01000810073 = getLastInterestInfo(pool) | |
225 | + | let lastInterestHeight = $t01000810073._1 | |
226 | + | let lastInterest = $t01000810073._2 | |
227 | + | let $t01007810242 = rewardInfo(pool) | |
228 | + | let currentRewardPerBlock = $t01007810242._1 | |
229 | + | let rewardUpdateHeight = $t01007810242._2 | |
230 | + | let previousRewardPerBlock = $t01007810242._3 | |
231 | + | let $t01024710345 = claimCalc(pool, i.caller) | |
232 | + | let userNewInterest = $t01024710345._1 | |
233 | + | let currentInterest = $t01024710345._2 | |
234 | + | let claimAmount = $t01024710345._3 | |
235 | + | let userShareTokensAmount = $t01024710345._4 | |
236 | 236 | let availableFund = (userAvailableFunds(pool, i.caller) + claimAmount) | |
237 | 237 | if ((claimAmountAsk > availableFund)) | |
238 | 238 | then throw(((("You ask more SWOP then you have. Available SWOP: " + toString(availableFund)) + ". You ask: ") + toString(claimAmountAsk))) | |
239 | 239 | else { | |
240 | 240 | let availableFundsNew = (availableFund - claimAmountAsk) | |
241 | 241 | [IntegerEntry((((pool + "_") + toString(i.caller)) + keyUserLastInterest), userNewInterest), IntegerEntry(((pool + "_") + keyLastInterest), currentInterest), IntegerEntry(((pool + "_") + keyLastInterestHeight), height), IntegerEntry(((((pool + "_") + toString(i.caller)) + "_") + keyAvailableFunds), availableFundsNew), Reissue(SWOP, claimAmountAsk, true), ScriptTransfer(i.caller, claimAmountAsk, SWOP)] | |
242 | 242 | } | |
243 | 243 | } | |
244 | 244 | ||
245 | 245 |
github/deemru/w8io/026f985 59.46 ms ◑