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