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