tx · 4oSjnik2Lg7jFYxa7iEt2YJSfWNBGoSFTBsj5WgYJR91 3MvenppyAqkqbJvpemDnU6P5dvSJ9fvRxRg: -0.01400000 Waves 2020.12.12 16:31 [1305511] smart account 3MvenppyAqkqbJvpemDnU6P5dvSJ9fvRxRg > SELF 0.00000000 Waves
{ "type": 13, "id": "4oSjnik2Lg7jFYxa7iEt2YJSfWNBGoSFTBsj5WgYJR91", "fee": 1400000, "feeAssetId": null, "timestamp": 1607779872340, "version": 1, "sender": "3MvenppyAqkqbJvpemDnU6P5dvSJ9fvRxRg", "senderPublicKey": "38RJPSAs2g6F7P5zT5FJ6BAc1DyReFGja2vkw8rSz3ga", "proofs": [ "2ZSsJD8J5qa5Q6gNQa3QNYHbaX8TCmjgR9kiAEx94HPtew4UowDaaPz4c2WUuuLDKE1N7KSZFMJD72Ejgpcfv6EK" ], "script": "base64:AAIEAAAAAAAAABcIAhIDCgEIEgMKAQgSBAoCCAESAwoBCAAAABsAAAAADGFkbWluUHViS2V5MQEAAAAgELDi6uQgdVvao3EGz2pOOnWzKruRdXrpd4DobbWyZx8AAAAADGFkbWluUHViS2V5MgEAAAAgELDi6uQgdVvao3EGz2pOOnWzKruRdXrpd4DobbWyZx8AAAAADGFkbWluUHViS2V5MwEAAAAgELDi6uQgdVvao3EGz2pOOnWzKruRdXrpd4DobbWyZx8AAAAAFGFkbWluUHViS2V5U3RhcnRTdG9wAQAAACAQsOLq5CB1W9qjcQbPak46dbMqu5F1eul3gOhttbJnHwAAAAASYWRtaW5QdWJLZXlTdGFraW5nAQAAACAQsOLq5CB1W9qjcQbPak46dbMqu5F1eul3gOhttbJnHwAAAAAUa2V5U2hhcmVUb2tlbnNMb2NrZWQCAAAAGl90b3RhbF9zaGFyZV90b2tlbnNfbG9ja2VkAAAAABBrZXlDdXJyZW50UmV3YXJkAgAAAA9fY3VycmVudF9yZXdhcmQAAAAAFWtleVJld2FyZFVwZGF0ZUhlaWdodAIAAAAVX3Jld2FyZF91cGRhdGV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AAAgkAASwAAAACBQAAAARwb29sAgAAAAFfBQAAABVrZXlMYXN0SW50ZXJlc3RIZWlnaHQFAAAABmhlaWdodAkABEwAAAACCQEAAAAHUmVpc3N1ZQAAAAMFAAAABFNXT1AFAAAAC2NsYWltQW1vdW50BgkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADCAUAAAABaQAAAAZjYWxsZXIFAAAAC2NsYWltQW1vdW50BQAAAARTV09QBQAAAANuaWwAAAAAjmnYQg==", "chainId": 84, "height": 1305511, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: GN43WK59YEEtWkjy5zT7apsr9LAKvKScW7Pp2wiQWp4S Next: G1hGBY1RUws1wpec24yn6bk1cy1PPXb6WbpR91Vb6mTq Diff:
Old | New | Differences | |
---|---|---|---|
15 | 15 | ||
16 | 16 | let keyCurrentReward = "_current_reward" | |
17 | 17 | ||
18 | + | let keyRewardUpdateHeight = "_reward_update_height" | |
19 | + | ||
20 | + | let keyPreviousReward = "_previous_reward" | |
21 | + | ||
18 | 22 | let keyLastInterest = "_last_interest" | |
19 | 23 | ||
20 | 24 | let keyLastInterestHeight = "_last_interest_height" | |
23 | 27 | ||
24 | 28 | let keyUserLastInterest = "_last_index" | |
25 | 29 | ||
26 | - | let keyRewardUpdateHeight = "_reward_update_height" | |
27 | - | ||
28 | - | let keyPreviousReward = "_previous_reward" | |
29 | - | ||
30 | 30 | let keyPoolAddress = "_address" | |
31 | 31 | ||
32 | - | let votingAddress = Address(base58' | |
32 | + | let votingAddress = Address(base58'3N5F5DCmWNzT8ZPe1tBfiXaVYzWJriaJZ9E') | |
33 | 33 | ||
34 | 34 | let SWOP = base58'DG2xFkPdDwKUoBkzGAhQtLpSGzfXLiCYPEzeKH2Ad24p' | |
35 | 35 | ||
43 | 43 | func throwIsActive () = throw("DApp is already active") | |
44 | 44 | ||
45 | 45 | ||
46 | - | func getCurrentRewardPerBlock (pool) = valueOrErrorMessage(getIntegerValue(votingAddress, (pool + keyCurrentReward)), (("No data on the key: " + pool) + keyShareTokensLocked)) | |
47 | - | ||
48 | - | ||
49 | 46 | func getShateTokenLocked (pool) = valueOrErrorMessage(getInteger(this, (pool + keyUserShareTokensLocked)), (("No data on the key: " + pool) + keyUserShareTokensLocked)) | |
50 | 47 | ||
51 | 48 | ||
52 | - | func rewardUpdateInfo (pool) = { | |
53 | - | let rewardUpdateHeight = valueOrErrorMessage(getIntegerValue(votingAddress, (pool + keyRewardUpdateHeight)), (("No data on the key: " + pool) + keyRewardUpdateHeight)) | |
54 | - | let rewardPreviousAmount = valueOrErrorMessage(getIntegerValue(votingAddress, (pool + keyRewardUpdateHeight)), (("No data on the key: " + pool) + keyPreviousReward)) | |
55 | - | $Tuple2(rewardUpdateHeight, rewardPreviousAmount) | |
49 | + | func rewardInfo (pool) = { | |
50 | + | let currentReward = valueOrErrorMessage(getInteger(votingAddress, (pool + keyCurrentReward)), (((("No data on the key: " + pool) + keyCurrentReward) + " at address ") + toString(votingAddress))) | |
51 | + | let rewardUpdateHeight = valueOrErrorMessage(getInteger(votingAddress, (pool + keyRewardUpdateHeight)), (((("No data on the key: " + pool) + keyRewardUpdateHeight) + " at address ") + toString(votingAddress))) | |
52 | + | let rewardPreviousAmount = valueOrErrorMessage(getInteger(votingAddress, (pool + keyRewardUpdateHeight)), (((("No data on the key: " + pool) + keyPreviousReward) + " at address ") + toString(votingAddress))) | |
53 | + | $Tuple3(currentReward, rewardUpdateHeight, rewardPreviousAmount) | |
56 | 54 | } | |
57 | 55 | ||
58 | 56 | ||
96 | 94 | ||
97 | 95 | ||
98 | 96 | func ClaimCalc (pool,caller) = { | |
99 | - | let currentRewardPerBlock = getCurrentRewardPerBlock(pool) | |
100 | 97 | let shareTokenLocked = getShateTokenLocked(pool) | |
101 | - | let $t044174482 = getLastInterestInfo(pool) | |
102 | - | let lastInterestHeight = $t044174482._1 | |
103 | - | let lastInterest = $t044174482._2 | |
104 | - | let $t044874559 = rewardUpdateInfo(pool) | |
105 | - | let rewardUpdateHeight = $t044874559._1 | |
106 | - | let previousRewardPerBlock = $t044874559._2 | |
107 | - | let $t045644643 = getUserInterestInfo(pool, caller) | |
108 | - | let userLastInterest = $t045644643._1 | |
109 | - | let userShareTokensAmount = $t045644643._2 | |
98 | + | let $t044394504 = getLastInterestInfo(pool) | |
99 | + | let lastInterestHeight = $t044394504._1 | |
100 | + | let lastInterest = $t044394504._2 | |
101 | + | let $t045094597 = rewardInfo(pool) | |
102 | + | let currentRewardPerBlock = $t045094597._1 | |
103 | + | let rewardUpdateHeight = $t045094597._2 | |
104 | + | let previousRewardPerBlock = $t045094597._3 | |
105 | + | let $t046024681 = getUserInterestInfo(pool, caller) | |
106 | + | let userLastInterest = $t046024681._1 | |
107 | + | let userShareTokensAmount = $t046024681._2 | |
110 | 108 | let currentInterest = calcInterest(lastInterestHeight, rewardUpdateHeight, lastInterest, currentRewardPerBlock, shareTokenLocked, previousRewardPerBlock) | |
111 | 109 | let claimAmount = fraction(userShareTokensAmount, (currentInterest - (userLastInterest * scale8)), scale8) | |
112 | 110 | let userNewInterest = currentInterest | |
127 | 125 | func initPoolShareLocking (pool) = if (!(containsElement([adminPubKey1, adminPubKey2, adminPubKey3], i.callerPublicKey))) | |
128 | 126 | then throw("Only admin can call this function") | |
129 | 127 | else { | |
130 | - | let $t055635635 = rewardUpdateInfo(pool) | |
131 | - | let rewardUpdateHeight = $t055635635._1 | |
132 | - | let previousRewardPerBlock = $t055635635._2 | |
128 | + | let $t056015681 = rewardInfo(pool) | |
129 | + | let currentReward = $t056015681._1 | |
130 | + | let rewardUpdateHeight = $t056015681._2 | |
131 | + | let previousRewardPerBlock = $t056015681._3 | |
133 | 132 | [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)] | |
134 | 133 | } | |
135 | 134 | ||
137 | 136 | ||
138 | 137 | @Callable(i) | |
139 | 138 | func lockShareTokens (pool) = { | |
140 | - | let $ | |
141 | - | let pmtAmount = $ | |
142 | - | let pmtAssetId = $ | |
139 | + | let $t061326207 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
140 | + | let pmtAmount = $t061326207._1 | |
141 | + | let pmtAssetId = $t061326207._2 | |
143 | 142 | if (!(checkPmtAssetIdCorrect(pool, pmtAssetId))) | |
144 | 143 | then throw("Incorrect pmtAssetId") | |
145 | 144 | else { | |
146 | - | let $ | |
147 | - | let userNewInterest = $ | |
148 | - | let currentInterest = $ | |
149 | - | let claimAmount = $ | |
150 | - | let userShareTokensAmount = $ | |
145 | + | let $t063006398 = ClaimCalc(pool, i.caller) | |
146 | + | let userNewInterest = $t063006398._1 | |
147 | + | let currentInterest = $t063006398._2 | |
148 | + | let claimAmount = $t063006398._3 | |
149 | + | let userShareTokensAmount = $t063006398._4 | |
151 | 150 | let userShareAmountNew = (userShareTokensAmount + pmtAmount) | |
152 | 151 | [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)] | |
153 | 152 | } | |
157 | 156 | ||
158 | 157 | @Callable(i) | |
159 | 158 | func withdrawShareTokens (pool,shareTokensWithdrawAmount) = { | |
160 | - | let $ | |
161 | - | let userNewInterest = $ | |
162 | - | let currentInterest = $ | |
163 | - | let claimAmount = $ | |
164 | - | let userShareTokensAmount = $ | |
159 | + | let $t069827080 = ClaimCalc(pool, i.caller) | |
160 | + | let userNewInterest = $t069827080._1 | |
161 | + | let currentInterest = $t069827080._2 | |
162 | + | let claimAmount = $t069827080._3 | |
163 | + | let userShareTokensAmount = $t069827080._4 | |
165 | 164 | if ((shareTokensWithdrawAmount > userShareTokensAmount)) | |
166 | 165 | then throw("Withdraw amount more then user locked amount") | |
167 | 166 | else { | |
175 | 174 | ||
176 | 175 | @Callable(i) | |
177 | 176 | func claim (pool) = { | |
178 | - | let currentRewardPerBlock = getCurrentRewardPerBlock(pool) | |
179 | 177 | let shareTokenLocked = getShateTokenLocked(pool) | |
180 | - | let $t079928057 = getLastInterestInfo(pool) | |
181 | - | let lastInterestHeight = $t079928057._1 | |
182 | - | let lastInterest = $t079928057._2 | |
183 | - | let $t080628134 = rewardUpdateInfo(pool) | |
184 | - | let rewardUpdateHeight = $t080628134._1 | |
185 | - | let previousRewardPerBlock = $t080628134._2 | |
178 | + | let $t079758040 = getLastInterestInfo(pool) | |
179 | + | let lastInterestHeight = $t079758040._1 | |
180 | + | let lastInterest = $t079758040._2 | |
181 | + | let $t080458134 = rewardInfo(pool) | |
182 | + | let currentRewardPerBlock = $t080458134._1 | |
183 | + | let rewardUpdateHeight = $t080458134._2 | |
184 | + | let previousRewardPerBlock = $t080458134._3 | |
186 | 185 | let $t081398208 = getUserInterestInfo(pool, i.caller) | |
187 | 186 | let userLastInterest = $t081398208._1 | |
188 | 187 | let userShare = $t081398208._2 |
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 | + | let keyRewardUpdateHeight = "_reward_update_height" | |
19 | + | ||
20 | + | let keyPreviousReward = "_previous_reward" | |
21 | + | ||
18 | 22 | let keyLastInterest = "_last_interest" | |
19 | 23 | ||
20 | 24 | let keyLastInterestHeight = "_last_interest_height" | |
21 | 25 | ||
22 | 26 | let keyUserShareTokensLocked = "_share_tokens_locked" | |
23 | 27 | ||
24 | 28 | let keyUserLastInterest = "_last_index" | |
25 | 29 | ||
26 | - | let keyRewardUpdateHeight = "_reward_update_height" | |
27 | - | ||
28 | - | let keyPreviousReward = "_previous_reward" | |
29 | - | ||
30 | 30 | let keyPoolAddress = "_address" | |
31 | 31 | ||
32 | - | let votingAddress = Address(base58' | |
32 | + | let votingAddress = Address(base58'3N5F5DCmWNzT8ZPe1tBfiXaVYzWJriaJZ9E') | |
33 | 33 | ||
34 | 34 | let SWOP = base58'DG2xFkPdDwKUoBkzGAhQtLpSGzfXLiCYPEzeKH2Ad24p' | |
35 | 35 | ||
36 | 36 | let scale8 = 100000000 | |
37 | 37 | ||
38 | 38 | let heightRewardUpdate = getIntegerValue(this, "height_reward_update") | |
39 | 39 | ||
40 | 40 | func throwOnlyAdmin () = throw("Only admin can call this function") | |
41 | 41 | ||
42 | 42 | ||
43 | 43 | func throwIsActive () = throw("DApp is already active") | |
44 | 44 | ||
45 | 45 | ||
46 | - | func getCurrentRewardPerBlock (pool) = valueOrErrorMessage(getIntegerValue(votingAddress, (pool + keyCurrentReward)), (("No data on the key: " + pool) + keyShareTokensLocked)) | |
47 | - | ||
48 | - | ||
49 | 46 | func getShateTokenLocked (pool) = valueOrErrorMessage(getInteger(this, (pool + keyUserShareTokensLocked)), (("No data on the key: " + pool) + keyUserShareTokensLocked)) | |
50 | 47 | ||
51 | 48 | ||
52 | - | func rewardUpdateInfo (pool) = { | |
53 | - | let rewardUpdateHeight = valueOrErrorMessage(getIntegerValue(votingAddress, (pool + keyRewardUpdateHeight)), (("No data on the key: " + pool) + keyRewardUpdateHeight)) | |
54 | - | let rewardPreviousAmount = valueOrErrorMessage(getIntegerValue(votingAddress, (pool + keyRewardUpdateHeight)), (("No data on the key: " + pool) + keyPreviousReward)) | |
55 | - | $Tuple2(rewardUpdateHeight, rewardPreviousAmount) | |
49 | + | func rewardInfo (pool) = { | |
50 | + | let currentReward = valueOrErrorMessage(getInteger(votingAddress, (pool + keyCurrentReward)), (((("No data on the key: " + pool) + keyCurrentReward) + " at address ") + toString(votingAddress))) | |
51 | + | let rewardUpdateHeight = valueOrErrorMessage(getInteger(votingAddress, (pool + keyRewardUpdateHeight)), (((("No data on the key: " + pool) + keyRewardUpdateHeight) + " at address ") + toString(votingAddress))) | |
52 | + | let rewardPreviousAmount = valueOrErrorMessage(getInteger(votingAddress, (pool + keyRewardUpdateHeight)), (((("No data on the key: " + pool) + keyPreviousReward) + " at address ") + toString(votingAddress))) | |
53 | + | $Tuple3(currentReward, rewardUpdateHeight, rewardPreviousAmount) | |
56 | 54 | } | |
57 | 55 | ||
58 | 56 | ||
59 | 57 | func getLastInterestInfo (pool) = { | |
60 | 58 | let lastInterest = valueOrErrorMessage(getIntegerValue(this, (pool + keyLastInterest)), (((("No data on the key: " + pool) + "_") + pool) + keyLastInterest)) | |
61 | 59 | let lastInterestHeight = valueOrErrorMessage(getIntegerValue(this, (pool + keyLastInterestHeight)), (("No data on the key: " + pool) + keyLastInterestHeight)) | |
62 | 60 | $Tuple2(lastInterestHeight, lastInterest) | |
63 | 61 | } | |
64 | 62 | ||
65 | 63 | ||
66 | 64 | func getUserInterestInfo (pool,userAddres) = { | |
67 | 65 | let userLastInterest = getInteger(this, (((pool + "_") + toString(userAddres)) + keyUserLastInterest)) | |
68 | 66 | let userShare = getInteger(this, (((pool + "_") + toString(userAddres)) + keyUserShareTokensLocked)) | |
69 | 67 | let userLastInterestValue = match userLastInterest { | |
70 | 68 | case userLastInterest: Int => | |
71 | 69 | userLastInterest | |
72 | 70 | case _ => | |
73 | 71 | 0 | |
74 | 72 | } | |
75 | 73 | let userShareTokensAmount = match userShare { | |
76 | 74 | case userShare: Int => | |
77 | 75 | userShare | |
78 | 76 | case _ => | |
79 | 77 | 0 | |
80 | 78 | } | |
81 | 79 | $Tuple2(userLastInterestValue, userShareTokensAmount) | |
82 | 80 | } | |
83 | 81 | ||
84 | 82 | ||
85 | 83 | func calcInterest (lastInterestHeight,rewardUpdateHeight,lastInterest,currentRewardPerBlock,shareTokenLocked,previousRewardPerBlock) = if ((lastInterestHeight > rewardUpdateHeight)) | |
86 | 84 | then { | |
87 | 85 | let reward = (currentRewardPerBlock * (height - lastInterestHeight)) | |
88 | 86 | ((lastInterest * scale8) + fraction(reward, scale8, shareTokenLocked)) | |
89 | 87 | } | |
90 | 88 | else { | |
91 | 89 | let rewardAfterLastInterestBeforeReawardUpdate = (previousRewardPerBlock * (rewardUpdateHeight - lastInterestHeight)) | |
92 | 90 | let interestAfterUpdate = ((lastInterest * scale8) + fraction(rewardAfterLastInterestBeforeReawardUpdate, scale8, shareTokenLocked)) | |
93 | 91 | let reward = (currentRewardPerBlock * (height - rewardUpdateHeight)) | |
94 | 92 | ((interestAfterUpdate * scale8) + fraction(reward, scale8, shareTokenLocked)) | |
95 | 93 | } | |
96 | 94 | ||
97 | 95 | ||
98 | 96 | func ClaimCalc (pool,caller) = { | |
99 | - | let currentRewardPerBlock = getCurrentRewardPerBlock(pool) | |
100 | 97 | let shareTokenLocked = getShateTokenLocked(pool) | |
101 | - | let $t044174482 = getLastInterestInfo(pool) | |
102 | - | let lastInterestHeight = $t044174482._1 | |
103 | - | let lastInterest = $t044174482._2 | |
104 | - | let $t044874559 = rewardUpdateInfo(pool) | |
105 | - | let rewardUpdateHeight = $t044874559._1 | |
106 | - | let previousRewardPerBlock = $t044874559._2 | |
107 | - | let $t045644643 = getUserInterestInfo(pool, caller) | |
108 | - | let userLastInterest = $t045644643._1 | |
109 | - | let userShareTokensAmount = $t045644643._2 | |
98 | + | let $t044394504 = getLastInterestInfo(pool) | |
99 | + | let lastInterestHeight = $t044394504._1 | |
100 | + | let lastInterest = $t044394504._2 | |
101 | + | let $t045094597 = rewardInfo(pool) | |
102 | + | let currentRewardPerBlock = $t045094597._1 | |
103 | + | let rewardUpdateHeight = $t045094597._2 | |
104 | + | let previousRewardPerBlock = $t045094597._3 | |
105 | + | let $t046024681 = getUserInterestInfo(pool, caller) | |
106 | + | let userLastInterest = $t046024681._1 | |
107 | + | let userShareTokensAmount = $t046024681._2 | |
110 | 108 | let currentInterest = calcInterest(lastInterestHeight, rewardUpdateHeight, lastInterest, currentRewardPerBlock, shareTokenLocked, previousRewardPerBlock) | |
111 | 109 | let claimAmount = fraction(userShareTokensAmount, (currentInterest - (userLastInterest * scale8)), scale8) | |
112 | 110 | let userNewInterest = currentInterest | |
113 | 111 | $Tuple4(userNewInterest, currentInterest, claimAmount, userShareTokensAmount) | |
114 | 112 | } | |
115 | 113 | ||
116 | 114 | ||
117 | 115 | func checkPmtAssetIdCorrect (pool,pmtAssetId) = { | |
118 | 116 | let poolAddres = value(addressFromString(getStringValue(this, (pool + keyPoolAddress)))) | |
119 | 117 | let poolShareAssetId = fromBase58String(getStringValue(poolAddres, "share_asset_id")) | |
120 | 118 | if ((pmtAssetId == poolShareAssetId)) | |
121 | 119 | then true | |
122 | 120 | else false | |
123 | 121 | } | |
124 | 122 | ||
125 | 123 | ||
126 | 124 | @Callable(i) | |
127 | 125 | func initPoolShareLocking (pool) = if (!(containsElement([adminPubKey1, adminPubKey2, adminPubKey3], i.callerPublicKey))) | |
128 | 126 | then throw("Only admin can call this function") | |
129 | 127 | else { | |
130 | - | let $t055635635 = rewardUpdateInfo(pool) | |
131 | - | let rewardUpdateHeight = $t055635635._1 | |
132 | - | let previousRewardPerBlock = $t055635635._2 | |
128 | + | let $t056015681 = rewardInfo(pool) | |
129 | + | let currentReward = $t056015681._1 | |
130 | + | let rewardUpdateHeight = $t056015681._2 | |
131 | + | let previousRewardPerBlock = $t056015681._3 | |
133 | 132 | [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)] | |
134 | 133 | } | |
135 | 134 | ||
136 | 135 | ||
137 | 136 | ||
138 | 137 | @Callable(i) | |
139 | 138 | func lockShareTokens (pool) = { | |
140 | - | let $ | |
141 | - | let pmtAmount = $ | |
142 | - | let pmtAssetId = $ | |
139 | + | let $t061326207 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
140 | + | let pmtAmount = $t061326207._1 | |
141 | + | let pmtAssetId = $t061326207._2 | |
143 | 142 | if (!(checkPmtAssetIdCorrect(pool, pmtAssetId))) | |
144 | 143 | then throw("Incorrect pmtAssetId") | |
145 | 144 | else { | |
146 | - | let $ | |
147 | - | let userNewInterest = $ | |
148 | - | let currentInterest = $ | |
149 | - | let claimAmount = $ | |
150 | - | let userShareTokensAmount = $ | |
145 | + | let $t063006398 = ClaimCalc(pool, i.caller) | |
146 | + | let userNewInterest = $t063006398._1 | |
147 | + | let currentInterest = $t063006398._2 | |
148 | + | let claimAmount = $t063006398._3 | |
149 | + | let userShareTokensAmount = $t063006398._4 | |
151 | 150 | let userShareAmountNew = (userShareTokensAmount + pmtAmount) | |
152 | 151 | [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)] | |
153 | 152 | } | |
154 | 153 | } | |
155 | 154 | ||
156 | 155 | ||
157 | 156 | ||
158 | 157 | @Callable(i) | |
159 | 158 | func withdrawShareTokens (pool,shareTokensWithdrawAmount) = { | |
160 | - | let $ | |
161 | - | let userNewInterest = $ | |
162 | - | let currentInterest = $ | |
163 | - | let claimAmount = $ | |
164 | - | let userShareTokensAmount = $ | |
159 | + | let $t069827080 = ClaimCalc(pool, i.caller) | |
160 | + | let userNewInterest = $t069827080._1 | |
161 | + | let currentInterest = $t069827080._2 | |
162 | + | let claimAmount = $t069827080._3 | |
163 | + | let userShareTokensAmount = $t069827080._4 | |
165 | 164 | if ((shareTokensWithdrawAmount > userShareTokensAmount)) | |
166 | 165 | then throw("Withdraw amount more then user locked amount") | |
167 | 166 | else { | |
168 | 167 | let userShareAmountNew = (userShareTokensAmount - shareTokensWithdrawAmount) | |
169 | 168 | let shareTokensId = fromBase58String(getStringValue(this, (pool + "share_asset_id"))) | |
170 | 169 | [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)] | |
171 | 170 | } | |
172 | 171 | } | |
173 | 172 | ||
174 | 173 | ||
175 | 174 | ||
176 | 175 | @Callable(i) | |
177 | 176 | func claim (pool) = { | |
178 | - | let currentRewardPerBlock = getCurrentRewardPerBlock(pool) | |
179 | 177 | let shareTokenLocked = getShateTokenLocked(pool) | |
180 | - | let $t079928057 = getLastInterestInfo(pool) | |
181 | - | let lastInterestHeight = $t079928057._1 | |
182 | - | let lastInterest = $t079928057._2 | |
183 | - | let $t080628134 = rewardUpdateInfo(pool) | |
184 | - | let rewardUpdateHeight = $t080628134._1 | |
185 | - | let previousRewardPerBlock = $t080628134._2 | |
178 | + | let $t079758040 = getLastInterestInfo(pool) | |
179 | + | let lastInterestHeight = $t079758040._1 | |
180 | + | let lastInterest = $t079758040._2 | |
181 | + | let $t080458134 = rewardInfo(pool) | |
182 | + | let currentRewardPerBlock = $t080458134._1 | |
183 | + | let rewardUpdateHeight = $t080458134._2 | |
184 | + | let previousRewardPerBlock = $t080458134._3 | |
186 | 185 | let $t081398208 = getUserInterestInfo(pool, i.caller) | |
187 | 186 | let userLastInterest = $t081398208._1 | |
188 | 187 | let userShare = $t081398208._2 | |
189 | 188 | let currentInterest = calcInterest(lastInterestHeight, rewardUpdateHeight, lastInterest, currentRewardPerBlock, shareTokenLocked, previousRewardPerBlock) | |
190 | 189 | let claimAmount = fraction(userShare, (currentInterest - (userLastInterest * scale8)), scale8) | |
191 | 190 | let userNewInterest = currentInterest | |
192 | 191 | [IntegerEntry((((pool + "_") + toString(i.caller)) + keyUserLastInterest), userNewInterest), IntegerEntry(((pool + "_") + keyLastInterest), currentInterest), IntegerEntry(((pool + "_") + keyLastInterestHeight), height), Reissue(SWOP, claimAmount, true), ScriptTransfer(i.caller, claimAmount, SWOP)] | |
193 | 192 | } | |
194 | 193 | ||
195 | 194 |
github/deemru/w8io/169f3d6 52.54 ms ◑