tx · EmrQvHWYwi7cMhTtKnNXdEUJnVcXSkNneaWuAWoi16tf 3MvenppyAqkqbJvpemDnU6P5dvSJ9fvRxRg: -0.01400000 Waves 2020.12.12 18:03 [1305602] smart account 3MvenppyAqkqbJvpemDnU6P5dvSJ9fvRxRg > SELF 0.00000000 Waves
{ "type": 13, "id": "EmrQvHWYwi7cMhTtKnNXdEUJnVcXSkNneaWuAWoi16tf", "fee": 1400000, "feeAssetId": null, "timestamp": 1607785494458, "version": 1, "sender": "3MvenppyAqkqbJvpemDnU6P5dvSJ9fvRxRg", "senderPublicKey": "38RJPSAs2g6F7P5zT5FJ6BAc1DyReFGja2vkw8rSz3ga", "proofs": [ "3YsDMvHfUnCditmmF3rX8uGf5Kj3Ztbu5sP11r1X1HWDmRextfKgYgjCwiG2QBBamBMVYFYRJDpfbbcZazbRgHti" ], "script": "base64:AAIEAAAAAAAAABkIAhIAEgMKAQgSAwoBCBIECgIIARIDCgEIAAAAHAAAAAAMYWRtaW5QdWJLZXkxAQAAACAQsOLq5CB1W9qjcQbPak46dbMqu5F1eul3gOhttbJnHwAAAAAMYWRtaW5QdWJLZXkyAQAAACAQsOLq5CB1W9qjcQbPak46dbMqu5F1eul3gOhttbJnHwAAAAAMYWRtaW5QdWJLZXkzAQAAACAQsOLq5CB1W9qjcQbPak46dbMqu5F1eul3gOhttbJnHwAAAAAUYWRtaW5QdWJLZXlTdGFydFN0b3ABAAAAIBCw4urkIHVb2qNxBs9qTjp1syq7kXV66XeA6G21smcfAAAAABJhZG1pblB1YktleVN0YWtpbmcBAAAAIBCw4urkIHVb2qNxBs9qTjp1syq7kXV66XeA6G21smcfAAAAABRrZXlTaGFyZVRva2Vuc0xvY2tlZAIAAAAaX3RvdGFsX3NoYXJlX3Rva2Vuc19sb2NrZWQAAAAAEGtleUN1cnJlbnRSZXdhcmQCAAAAD19jdXJyZW50X3Jld2FyZAAAAAAVa2V5UmV3YXJkVXBkYXRlSGVpZ2h0AgAAABVfcmV3YXJkX3VwZ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BQAAAAxsYXN0SW50ZXJlc3QFAAAAFWN1cnJlbnRSZXdhcmRQZXJCbG9jawUAAAAQc2hhcmVUb2tlbkxvY2tlZAUAAAAWcHJldmlvdXNSZXdhcmRQZXJCbG9jawQAAAALY2xhaW1BbW91bnQJAABrAAAAAwUAAAAJdXNlclNoYXJlCQAAZQAAAAIFAAAAD2N1cnJlbnRJbnRlcmVzdAkAAGgAAAACBQAAABB1c2VyTGFzdEludGVyZXN0BQAAAAZzY2FsZTgFAAAABnNjYWxlOAQAAAAPdXNlck5ld0ludGVyZXN0BQAAAA9jdXJyZW50SW50ZXJlc3QJAARMAAAAAgkBAAAADEludGVnZXJFbnRyeQAAAAIJAAEsAAAAAgkAASwAAAACCQABLAAAAAIFAAAABHBvb2wCAAAAAV8JAAQlAAAAAQgFAAAAAWkAAAAGY2FsbGVyBQAAABNrZXlVc2VyTGFzdEludGVyZXN0BQAAAA91c2VyTmV3SW50ZXJlc3QJAARMAAAAAgkBAAAADEludGVnZXJFbnRyeQAAAAIJAAEsAAAAAgkAASwAAAACBQAAAARwb29sAgAAAAFfBQAAAA9rZXlMYXN0SW50ZXJlc3QFAAAAD2N1cnJlbnRJbnRlcmVzdAkABEwAAAACCQEAAAAMSW50ZWdlckVudHJ5AAAAAgkAASwAAAACCQABLAAAAAIFAAAABHBvb2wCAAAAAV8FAAAAFWtleUxhc3RJbnRlcmVzdEhlaWdodAUAAAAGaGVpZ2h0CQAETAAAAAIJAQAAAAdSZWlzc3VlAAAAAwUAAAAEU1dPUAUAAAALY2xhaW1BbW91bnQGCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAAFpAAAABmNhbGxlcgUAAAALY2xhaW1BbW91bnQFAAAABFNXT1AFAAAAA25pbAAAAAClEIIB", "chainId": 84, "height": 1305602, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: DapCGJNyzvSN7emm6xuqkQqkbBC2Mddx11APR3X4Gbsf Next: 4i56MPrDRjS5SGYxJfBa1e72GQbRRvfaffrCmSZxUs8r Diff:
Old | New | Differences | |
---|---|---|---|
25 | 25 | ||
26 | 26 | let keyUserShareTokensLocked = "_share_tokens_locked" | |
27 | 27 | ||
28 | - | let keyUserLastInterest = "_last_ | |
28 | + | let keyUserLastInterest = "_last_interest" | |
29 | 29 | ||
30 | 30 | let keySWOPid = "SWOP_id" | |
31 | 31 | ||
84 | 84 | ||
85 | 85 | func calcInterest (lastInterestHeight,rewardUpdateHeight,lastInterest,currentRewardPerBlock,shareTokenLocked,previousRewardPerBlock) = if ((lastInterestHeight > rewardUpdateHeight)) | |
86 | 86 | then if ((shareTokenLocked == 0)) | |
87 | - | then | |
87 | + | then throw("11") | |
88 | 88 | else { | |
89 | 89 | let reward = (currentRewardPerBlock * (height - lastInterestHeight)) | |
90 | 90 | ((lastInterest * scale8) + fraction(reward, scale8, shareTokenLocked)) | |
99 | 99 | ||
100 | 100 | func ClaimCalc (pool,caller) = { | |
101 | 101 | let shareTokenLocked = getTotalShateTokenLocked(pool) | |
102 | - | let $ | |
103 | - | let lastInterestHeight = $ | |
104 | - | let lastInterest = $ | |
105 | - | let $ | |
106 | - | let currentRewardPerBlock = $ | |
107 | - | let rewardUpdateHeight = $ | |
108 | - | let previousRewardPerBlock = $ | |
109 | - | let $ | |
110 | - | let userLastInterest = $ | |
111 | - | let userShareTokensAmount = $ | |
102 | + | let $t045574622 = getLastInterestInfo(pool) | |
103 | + | let lastInterestHeight = $t045574622._1 | |
104 | + | let lastInterest = $t045574622._2 | |
105 | + | let $t046274715 = rewardInfo(pool) | |
106 | + | let currentRewardPerBlock = $t046274715._1 | |
107 | + | let rewardUpdateHeight = $t046274715._2 | |
108 | + | let previousRewardPerBlock = $t046274715._3 | |
109 | + | let $t047204799 = getUserInterestInfo(pool, caller) | |
110 | + | let userLastInterest = $t047204799._1 | |
111 | + | let userShareTokensAmount = $t047204799._2 | |
112 | 112 | let currentInterest = calcInterest(lastInterestHeight, rewardUpdateHeight, lastInterest, currentRewardPerBlock, shareTokenLocked, previousRewardPerBlock) | |
113 | 113 | let claimAmount = fraction(userShareTokensAmount, (currentInterest - (userLastInterest * scale8)), scale8) | |
114 | 114 | let userNewInterest = currentInterest | |
140 | 140 | func initPoolShareLocking (pool) = if (!(containsElement([adminPubKey1, adminPubKey2, adminPubKey3], i.callerPublicKey))) | |
141 | 141 | then throw("Only admin can call this function") | |
142 | 142 | else { | |
143 | - | let $ | |
144 | - | let currentReward = $ | |
145 | - | let rewardUpdateHeight = $ | |
146 | - | let previousRewardPerBlock = $ | |
143 | + | let $t061416221 = rewardInfo(pool) | |
144 | + | let currentReward = $t061416221._1 | |
145 | + | let rewardUpdateHeight = $t061416221._2 | |
146 | + | let previousRewardPerBlock = $t061416221._3 | |
147 | 147 | [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)] | |
148 | 148 | } | |
149 | 149 | ||
151 | 151 | ||
152 | 152 | @Callable(i) | |
153 | 153 | func lockShareTokens (pool) = { | |
154 | - | let $ | |
155 | - | let pmtAmount = $ | |
156 | - | let pmtAssetId = $ | |
154 | + | let $t066716746 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
155 | + | let pmtAmount = $t066716746._1 | |
156 | + | let pmtAssetId = $t066716746._2 | |
157 | 157 | if (!(checkPmtAssetIdCorrect(pool, pmtAssetId))) | |
158 | 158 | then throw("Incorrect pmtAssetId") | |
159 | 159 | else { | |
160 | - | let $ | |
161 | - | let userNewInterest = $ | |
162 | - | let currentInterest = $ | |
163 | - | let claimAmount = $ | |
164 | - | let userShareTokensAmount = $ | |
160 | + | let $t068396937 = ClaimCalc(pool, i.caller) | |
161 | + | let userNewInterest = $t068396937._1 | |
162 | + | let currentInterest = $t068396937._2 | |
163 | + | let claimAmount = $t068396937._3 | |
164 | + | let userShareTokensAmount = $t068396937._4 | |
165 | 165 | let userShareAmountNew = (userShareTokensAmount + pmtAmount) | |
166 | 166 | [IntegerEntry((((pool + "_") + toString(i.caller)) + keyUserLastInterest), userNewInterest), IntegerEntry((((pool + "_") + toString(i.caller)) + keyUserShareTokensLocked), userShareAmountNew), IntegerEntry((pool + keyLastInterest), currentInterest), IntegerEntry((pool + keyLastInterestHeight), height), Reissue(SWOP, claimAmount, true), ScriptTransfer(i.caller, claimAmount, SWOP)] | |
167 | 167 | } | |
171 | 171 | ||
172 | 172 | @Callable(i) | |
173 | 173 | func withdrawShareTokens (pool,shareTokensWithdrawAmount) = { | |
174 | - | let $ | |
175 | - | let userNewInterest = $ | |
176 | - | let currentInterest = $ | |
177 | - | let claimAmount = $ | |
178 | - | let userShareTokensAmount = $ | |
174 | + | let $t075217619 = ClaimCalc(pool, i.caller) | |
175 | + | let userNewInterest = $t075217619._1 | |
176 | + | let currentInterest = $t075217619._2 | |
177 | + | let claimAmount = $t075217619._3 | |
178 | + | let userShareTokensAmount = $t075217619._4 | |
179 | 179 | if ((shareTokensWithdrawAmount > userShareTokensAmount)) | |
180 | 180 | then throw("Withdraw amount more then user locked amount") | |
181 | 181 | else { | |
190 | 190 | @Callable(i) | |
191 | 191 | func claim (pool) = { | |
192 | 192 | let shareTokenLocked = getTotalShateTokenLocked(pool) | |
193 | - | let $ | |
194 | - | let lastInterestHeight = $ | |
195 | - | let lastInterest = $ | |
196 | - | let $ | |
197 | - | let currentRewardPerBlock = $ | |
198 | - | let rewardUpdateHeight = $ | |
199 | - | let previousRewardPerBlock = $ | |
200 | - | let $ | |
201 | - | let userLastInterest = $ | |
202 | - | let userShare = $ | |
193 | + | let $t085198584 = getLastInterestInfo(pool) | |
194 | + | let lastInterestHeight = $t085198584._1 | |
195 | + | let lastInterest = $t085198584._2 | |
196 | + | let $t085898678 = rewardInfo(pool) | |
197 | + | let currentRewardPerBlock = $t085898678._1 | |
198 | + | let rewardUpdateHeight = $t085898678._2 | |
199 | + | let previousRewardPerBlock = $t085898678._3 | |
200 | + | let $t086838752 = getUserInterestInfo(pool, i.caller) | |
201 | + | let userLastInterest = $t086838752._1 | |
202 | + | let userShare = $t086838752._2 | |
203 | 203 | let currentInterest = calcInterest(lastInterestHeight, rewardUpdateHeight, lastInterest, currentRewardPerBlock, shareTokenLocked, previousRewardPerBlock) | |
204 | 204 | let claimAmount = fraction(userShare, (currentInterest - (userLastInterest * scale8)), scale8) | |
205 | 205 | let userNewInterest = currentInterest |
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 | - | let keyUserLastInterest = "_last_ | |
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 votingAddress = Address(base58'3N5F5DCmWNzT8ZPe1tBfiXaVYzWJriaJZ9E') | |
35 | 35 | ||
36 | 36 | let SWOP = fromBase58String(getStringValue(this, keySWOPid)) | |
37 | 37 | ||
38 | 38 | let scale8 = 100000000 | |
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 getTotalShateTokenLocked (pool) = valueOrErrorMessage(getInteger(this, (pool + keyShareTokensLocked)), (("No data on the key: " + pool) + keyShareTokensLocked)) | |
49 | 49 | ||
50 | 50 | ||
51 | 51 | func rewardInfo (pool) = { | |
52 | 52 | let currentReward = valueOrErrorMessage(getInteger(votingAddress, (pool + keyCurrentReward)), (((("No data on the key: " + pool) + keyCurrentReward) + " at address ") + toString(votingAddress))) | |
53 | 53 | let rewardUpdateHeight = valueOrErrorMessage(getInteger(votingAddress, (pool + keyRewardUpdateHeight)), (((("No data on the key: " + pool) + keyRewardUpdateHeight) + " at address ") + toString(votingAddress))) | |
54 | 54 | let rewardPreviousAmount = valueOrErrorMessage(getInteger(votingAddress, (pool + keyRewardUpdateHeight)), (((("No data on the key: " + pool) + keyPreviousReward) + " at address ") + toString(votingAddress))) | |
55 | 55 | $Tuple3(currentReward, rewardUpdateHeight, rewardPreviousAmount) | |
56 | 56 | } | |
57 | 57 | ||
58 | 58 | ||
59 | 59 | func getLastInterestInfo (pool) = { | |
60 | 60 | let lastInterest = valueOrErrorMessage(getInteger(this, (pool + keyLastInterest)), (((("No data on the key: " + pool) + "_") + pool) + keyLastInterest)) | |
61 | 61 | let lastInterestHeight = valueOrErrorMessage(getInteger(this, (pool + keyLastInterestHeight)), (("No data on the key: " + pool) + keyLastInterestHeight)) | |
62 | 62 | $Tuple2(lastInterestHeight, lastInterest) | |
63 | 63 | } | |
64 | 64 | ||
65 | 65 | ||
66 | 66 | func getUserInterestInfo (pool,userAddres) = { | |
67 | 67 | let userLastInterest = getInteger(this, (((pool + "_") + toString(userAddres)) + keyUserLastInterest)) | |
68 | 68 | let userShare = getInteger(this, (((pool + "_") + toString(userAddres)) + keyUserShareTokensLocked)) | |
69 | 69 | let userLastInterestValue = match userLastInterest { | |
70 | 70 | case userLastInterest: Int => | |
71 | 71 | userLastInterest | |
72 | 72 | case _ => | |
73 | 73 | 0 | |
74 | 74 | } | |
75 | 75 | let userShareTokensAmount = match userShare { | |
76 | 76 | case userShare: Int => | |
77 | 77 | userShare | |
78 | 78 | case _ => | |
79 | 79 | 0 | |
80 | 80 | } | |
81 | 81 | $Tuple2(userLastInterestValue, userShareTokensAmount) | |
82 | 82 | } | |
83 | 83 | ||
84 | 84 | ||
85 | 85 | func calcInterest (lastInterestHeight,rewardUpdateHeight,lastInterest,currentRewardPerBlock,shareTokenLocked,previousRewardPerBlock) = if ((lastInterestHeight > rewardUpdateHeight)) | |
86 | 86 | then if ((shareTokenLocked == 0)) | |
87 | - | then | |
87 | + | then throw("11") | |
88 | 88 | else { | |
89 | 89 | let reward = (currentRewardPerBlock * (height - lastInterestHeight)) | |
90 | 90 | ((lastInterest * scale8) + fraction(reward, scale8, shareTokenLocked)) | |
91 | 91 | } | |
92 | 92 | else { | |
93 | 93 | let rewardAfterLastInterestBeforeReawardUpdate = (previousRewardPerBlock * (rewardUpdateHeight - lastInterestHeight)) | |
94 | 94 | let interestAfterUpdate = ((lastInterest * scale8) + fraction(rewardAfterLastInterestBeforeReawardUpdate, scale8, shareTokenLocked)) | |
95 | 95 | let reward = (currentRewardPerBlock * (height - rewardUpdateHeight)) | |
96 | 96 | ((interestAfterUpdate * scale8) + fraction(reward, scale8, shareTokenLocked)) | |
97 | 97 | } | |
98 | 98 | ||
99 | 99 | ||
100 | 100 | func ClaimCalc (pool,caller) = { | |
101 | 101 | let shareTokenLocked = getTotalShateTokenLocked(pool) | |
102 | - | let $ | |
103 | - | let lastInterestHeight = $ | |
104 | - | let lastInterest = $ | |
105 | - | let $ | |
106 | - | let currentRewardPerBlock = $ | |
107 | - | let rewardUpdateHeight = $ | |
108 | - | let previousRewardPerBlock = $ | |
109 | - | let $ | |
110 | - | let userLastInterest = $ | |
111 | - | let userShareTokensAmount = $ | |
102 | + | let $t045574622 = getLastInterestInfo(pool) | |
103 | + | let lastInterestHeight = $t045574622._1 | |
104 | + | let lastInterest = $t045574622._2 | |
105 | + | let $t046274715 = rewardInfo(pool) | |
106 | + | let currentRewardPerBlock = $t046274715._1 | |
107 | + | let rewardUpdateHeight = $t046274715._2 | |
108 | + | let previousRewardPerBlock = $t046274715._3 | |
109 | + | let $t047204799 = getUserInterestInfo(pool, caller) | |
110 | + | let userLastInterest = $t047204799._1 | |
111 | + | let userShareTokensAmount = $t047204799._2 | |
112 | 112 | let currentInterest = calcInterest(lastInterestHeight, rewardUpdateHeight, lastInterest, currentRewardPerBlock, shareTokenLocked, previousRewardPerBlock) | |
113 | 113 | let claimAmount = fraction(userShareTokensAmount, (currentInterest - (userLastInterest * scale8)), scale8) | |
114 | 114 | let userNewInterest = currentInterest | |
115 | 115 | $Tuple4(userNewInterest, currentInterest, claimAmount, userShareTokensAmount) | |
116 | 116 | } | |
117 | 117 | ||
118 | 118 | ||
119 | 119 | func checkPmtAssetIdCorrect (pool,pmtAssetId) = { | |
120 | 120 | let poolAddres = value(addressFromString(getStringValue(this, (pool + keyPoolAddress)))) | |
121 | 121 | let poolShareAssetId = fromBase58String(getStringValue(poolAddres, "share_asset_id")) | |
122 | 122 | if ((pmtAssetId == poolShareAssetId)) | |
123 | 123 | then true | |
124 | 124 | else false | |
125 | 125 | } | |
126 | 126 | ||
127 | 127 | ||
128 | 128 | @Callable(i) | |
129 | 129 | func init () = if (!(containsElement([adminPubKey1, adminPubKey2, adminPubKey3], i.callerPublicKey))) | |
130 | 130 | then throw("Only admin can call this function") | |
131 | 131 | else { | |
132 | 132 | let SWOPissue = Issue("SWOP", "SWOP protocol token", 1, 8, true) | |
133 | 133 | let SWOPid = calculateAssetId(SWOPissue) | |
134 | 134 | [Issue("SWOP", "SWOP protocol token", 1, 8, true), StringEntry(keySWOPid, toBase58String(SWOPid))] | |
135 | 135 | } | |
136 | 136 | ||
137 | 137 | ||
138 | 138 | ||
139 | 139 | @Callable(i) | |
140 | 140 | func initPoolShareLocking (pool) = if (!(containsElement([adminPubKey1, adminPubKey2, adminPubKey3], i.callerPublicKey))) | |
141 | 141 | then throw("Only admin can call this function") | |
142 | 142 | else { | |
143 | - | let $ | |
144 | - | let currentReward = $ | |
145 | - | let rewardUpdateHeight = $ | |
146 | - | let previousRewardPerBlock = $ | |
143 | + | let $t061416221 = rewardInfo(pool) | |
144 | + | let currentReward = $t061416221._1 | |
145 | + | let rewardUpdateHeight = $t061416221._2 | |
146 | + | let previousRewardPerBlock = $t061416221._3 | |
147 | 147 | [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)] | |
148 | 148 | } | |
149 | 149 | ||
150 | 150 | ||
151 | 151 | ||
152 | 152 | @Callable(i) | |
153 | 153 | func lockShareTokens (pool) = { | |
154 | - | let $ | |
155 | - | let pmtAmount = $ | |
156 | - | let pmtAssetId = $ | |
154 | + | let $t066716746 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
155 | + | let pmtAmount = $t066716746._1 | |
156 | + | let pmtAssetId = $t066716746._2 | |
157 | 157 | if (!(checkPmtAssetIdCorrect(pool, pmtAssetId))) | |
158 | 158 | then throw("Incorrect pmtAssetId") | |
159 | 159 | else { | |
160 | - | let $ | |
161 | - | let userNewInterest = $ | |
162 | - | let currentInterest = $ | |
163 | - | let claimAmount = $ | |
164 | - | let userShareTokensAmount = $ | |
160 | + | let $t068396937 = ClaimCalc(pool, i.caller) | |
161 | + | let userNewInterest = $t068396937._1 | |
162 | + | let currentInterest = $t068396937._2 | |
163 | + | let claimAmount = $t068396937._3 | |
164 | + | let userShareTokensAmount = $t068396937._4 | |
165 | 165 | let userShareAmountNew = (userShareTokensAmount + pmtAmount) | |
166 | 166 | [IntegerEntry((((pool + "_") + toString(i.caller)) + keyUserLastInterest), userNewInterest), IntegerEntry((((pool + "_") + toString(i.caller)) + keyUserShareTokensLocked), userShareAmountNew), IntegerEntry((pool + keyLastInterest), currentInterest), IntegerEntry((pool + keyLastInterestHeight), height), Reissue(SWOP, claimAmount, true), ScriptTransfer(i.caller, claimAmount, SWOP)] | |
167 | 167 | } | |
168 | 168 | } | |
169 | 169 | ||
170 | 170 | ||
171 | 171 | ||
172 | 172 | @Callable(i) | |
173 | 173 | func withdrawShareTokens (pool,shareTokensWithdrawAmount) = { | |
174 | - | let $ | |
175 | - | let userNewInterest = $ | |
176 | - | let currentInterest = $ | |
177 | - | let claimAmount = $ | |
178 | - | let userShareTokensAmount = $ | |
174 | + | let $t075217619 = ClaimCalc(pool, i.caller) | |
175 | + | let userNewInterest = $t075217619._1 | |
176 | + | let currentInterest = $t075217619._2 | |
177 | + | let claimAmount = $t075217619._3 | |
178 | + | let userShareTokensAmount = $t075217619._4 | |
179 | 179 | if ((shareTokensWithdrawAmount > userShareTokensAmount)) | |
180 | 180 | then throw("Withdraw amount more then user locked amount") | |
181 | 181 | else { | |
182 | 182 | let userShareAmountNew = (userShareTokensAmount - shareTokensWithdrawAmount) | |
183 | 183 | let shareTokensId = fromBase58String(getStringValue(this, (pool + "share_asset_id"))) | |
184 | 184 | [IntegerEntry((((pool + "_") + toString(i.caller)) + keyUserLastInterest), userNewInterest), IntegerEntry((((pool + "_") + toString(i.caller)) + keyUserShareTokensLocked), userShareAmountNew), IntegerEntry((pool + keyLastInterest), currentInterest), IntegerEntry((pool + keyLastInterestHeight), height), Reissue(SWOP, claimAmount, true), ScriptTransfer(i.caller, claimAmount, SWOP), ScriptTransfer(i.caller, shareTokensWithdrawAmount, shareTokensId)] | |
185 | 185 | } | |
186 | 186 | } | |
187 | 187 | ||
188 | 188 | ||
189 | 189 | ||
190 | 190 | @Callable(i) | |
191 | 191 | func claim (pool) = { | |
192 | 192 | let shareTokenLocked = getTotalShateTokenLocked(pool) | |
193 | - | let $ | |
194 | - | let lastInterestHeight = $ | |
195 | - | let lastInterest = $ | |
196 | - | let $ | |
197 | - | let currentRewardPerBlock = $ | |
198 | - | let rewardUpdateHeight = $ | |
199 | - | let previousRewardPerBlock = $ | |
200 | - | let $ | |
201 | - | let userLastInterest = $ | |
202 | - | let userShare = $ | |
193 | + | let $t085198584 = getLastInterestInfo(pool) | |
194 | + | let lastInterestHeight = $t085198584._1 | |
195 | + | let lastInterest = $t085198584._2 | |
196 | + | let $t085898678 = rewardInfo(pool) | |
197 | + | let currentRewardPerBlock = $t085898678._1 | |
198 | + | let rewardUpdateHeight = $t085898678._2 | |
199 | + | let previousRewardPerBlock = $t085898678._3 | |
200 | + | let $t086838752 = getUserInterestInfo(pool, i.caller) | |
201 | + | let userLastInterest = $t086838752._1 | |
202 | + | let userShare = $t086838752._2 | |
203 | 203 | let currentInterest = calcInterest(lastInterestHeight, rewardUpdateHeight, lastInterest, currentRewardPerBlock, shareTokenLocked, previousRewardPerBlock) | |
204 | 204 | let claimAmount = fraction(userShare, (currentInterest - (userLastInterest * scale8)), scale8) | |
205 | 205 | let userNewInterest = currentInterest | |
206 | 206 | [IntegerEntry((((pool + "_") + toString(i.caller)) + keyUserLastInterest), userNewInterest), IntegerEntry(((pool + "_") + keyLastInterest), currentInterest), IntegerEntry(((pool + "_") + keyLastInterestHeight), height), Reissue(SWOP, claimAmount, true), ScriptTransfer(i.caller, claimAmount, SWOP)] | |
207 | 207 | } | |
208 | 208 | ||
209 | 209 |
github/deemru/w8io/169f3d6 66.53 ms ◑