tx · 4FmFGJwxneP5Jvrhq4XHJ4uHDpZaHcda9d74Yi4GXjUV 3MxFYk97QYdeHRMTu51rVyHqvFEVB4UtmBX: -0.01700000 Waves 2022.09.15 10:54 [2229937] smart account 3MxFYk97QYdeHRMTu51rVyHqvFEVB4UtmBX > SELF 0.00000000 Waves
{ "type": 13, "id": "4FmFGJwxneP5Jvrhq4XHJ4uHDpZaHcda9d74Yi4GXjUV", "fee": 1700000, "feeAssetId": null, "timestamp": 1663228473768, "version": 2, "chainId": 84, "sender": "3MxFYk97QYdeHRMTu51rVyHqvFEVB4UtmBX", "senderPublicKey": "2panvMtE3s1p1oCdVqRGMuBYaZJV3AZ6zpdmZ6vHkDaL", "proofs": [ "4Draif5HciyvK2KdkihHLiwDdknNcC3pVNxrrSQZqSJXBfJaHcyYFxEBWW4MpfZ54XmqmybCvEZuTWnKHAD59uur", "4dCVT35YjTjzBEnFW9cdxVqsJgVQwQnAtCBLuKHPnZAH7vPSiSZAvgAyup7o6FjxUyHCMzAeWwwW8keZe1ceeTyx" ], "script": "base64:BgITCAISABIECgIIARIDCgEIEgASACEAB2tBY3RpdmUCBmFjdGl2ZQAGa0NhdXNlAg5zaHV0ZG93bl9jYXVzZQAWa0xhc3RQb29sVG9rZW5JbnRlcmVzdAITX3Bvb2xfbGFzdF9pbnRlcmVzdAARa1VzZXJMYXN0SW50ZXJlc3QCE191c2VyX2xhc3RfaW50ZXJlc3QAE2tVc2VyQ2xhaW1BdmFpbGFibGUCGF91c2VyX2F2YWlsYWJsZV90b19jbGFpbQAWa1VzZXJTaGFyZVRva2Vuc0xvY2tlZAIUX3NoYXJlX3Rva2Vuc19sb2NrZWQAEmtTaGFyZVRva2Vuc0xvY2tlZAIaX3RvdGFsX3NoYXJlX3Rva2Vuc19sb2NrZWQAC2tPcmFjbGVQb29sAgVwb29sXwANa1Bvb2xBc3NldElkcwIJYXNzZXRfaWRzAA1rQWRtaW5QdWJLZXkxAgthZG1pbl9wdWJfMQANa0FkbWluUHViS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U2lnbmVkAwkA9AMDCAUCdHgJYm9keUJ5dGVzCQCRAwIIBQJ0eAZwcm9vZnMAAAUMYWRtaW5QdWJLZXkxAAEAAAQSYWRtaW5QdWJLZXkyU2lnbmVkAwkA9AMDCAUCdHgJYm9keUJ5dGVzCQCRAwIIBQJ0eAZwcm9vZnMAAQUMYWRtaW5QdWJLZXkyAAEAAAQSYWRtaW5QdWJLZXkzU2lnbmVkAwkA9AMDCAUCdHgJYm9keUJ5dGVzCQCRAwIIBQJ0eAZwcm9vZnMAAgUMYWRtaW5QdWJLZXkzAAEAAAkAZwIJAGQCCQBkAgUSYWRtaW5QdWJLZXkxU2lnbmVkBRJhZG1pblB1YktleTJTaWduZWQFEmFkbWluUHViS2V5M1NpZ25lZAACVBme3g==", "height": 2229937, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 998GTpcEfvuZn33A2s39oMv81gypA2XgXt7ygiBjT6M5 Next: GtB9EvDXebCq1iVMMCGMpQZ7SAeHqJpDmb5qcBhr4MQZ Diff:
Old | New | Differences | |
---|---|---|---|
149 | 149 | ||
150 | 150 | ||
151 | 151 | @Callable(i) | |
152 | - | func updateUserInterest (newUserShareTokensLocked) = valueOrElse(isActive(), valueOrElse(isFarmingCall(i.caller), { | |
153 | - | let poolAddr = | |
152 | + | func updateUserInterest (pool,newUserShareTokensLocked) = valueOrElse(isActive(), valueOrElse(isFarmingCall(i.caller), { | |
153 | + | let poolAddr = Address(fromBase58String(pool)) | |
154 | 154 | let user = toString(i.originCaller) | |
155 | - | let pool = toString(poolAddr) | |
156 | 155 | let assetIds = split(valueOrErrorMessage(getString(poolAddr, kPoolAssetIds), "Can't find pool assets"), ",") | |
157 | 156 | func calcNewUserInterestAndClaimAmountEtries (acc,assetId) = { | |
158 | - | let $ | |
159 | - | let claimAmount = $ | |
160 | - | let lastInterest = $ | |
157 | + | let $t045784648 = calcClaimAmount(pool, assetId, user) | |
158 | + | let claimAmount = $t045784648._1 | |
159 | + | let lastInterest = $t045784648._2 | |
161 | 160 | (acc :+ [IntegerEntry((((((user + "_") + pool) + "_") + assetId) + kUserClaimAvailable), claimAmount), IntegerEntry((((((user + "_") + pool) + "_") + assetId) + kUserLastInterest), lastInterest)]) | |
162 | 161 | } | |
163 | 162 | ||
183 | 182 | let user = toString(i.caller) | |
184 | 183 | let assetIds = split(valueOrErrorMessage(getString(poolAddr, kPoolAssetIds), "Can't find pool assets"), ",") | |
185 | 184 | func calcClaimAmountEtries (acc,assetId) = { | |
186 | - | let $ | |
187 | - | let entries = $ | |
188 | - | let sum = $ | |
189 | - | let $ | |
190 | - | let claimAmount = $ | |
191 | - | let lastInterest = $ | |
185 | + | let $t053015325 = acc | |
186 | + | let entries = $t053015325._1 | |
187 | + | let sum = $t053015325._2 | |
188 | + | let $t053325402 = calcClaimAmount(pool, assetId, user) | |
189 | + | let claimAmount = $t053325402._1 | |
190 | + | let lastInterest = $t053325402._2 | |
192 | 191 | $Tuple2((entries :+ [ScriptTransfer(i.caller, claimAmount, fromBase58String(assetId)), IntegerEntry((((((user + "_") + pool) + "_") + assetId) + kUserClaimAvailable), 0), IntegerEntry((((((user + "_") + pool) + "_") + assetId) + kUserLastInterest), lastInterest)]), claimAmount) | |
193 | 192 | } | |
194 | 193 | ||
195 | - | let $ | |
194 | + | let $t057025784 = { | |
196 | 195 | let $l = assetIds | |
197 | 196 | let $s = size($l) | |
198 | 197 | let $acc0 = $Tuple2(nil, 0) | |
206 | 205 | ||
207 | 206 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15) | |
208 | 207 | } | |
209 | - | let claimEntries = $ | |
210 | - | let sumTokens = $ | |
208 | + | let claimEntries = $t057025784._1 | |
209 | + | let sumTokens = $t057025784._2 | |
211 | 210 | if ((sumTokens == 0)) | |
212 | 211 | then throw("You have no tokens for claim") | |
213 | 212 | else claimEntries |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let kActive = "active" | |
5 | 5 | ||
6 | 6 | let kCause = "shutdown_cause" | |
7 | 7 | ||
8 | 8 | let kLastPoolTokenInterest = "_pool_last_interest" | |
9 | 9 | ||
10 | 10 | let kUserLastInterest = "_user_last_interest" | |
11 | 11 | ||
12 | 12 | let kUserClaimAvailable = "_user_available_to_claim" | |
13 | 13 | ||
14 | 14 | let kUserShareTokensLocked = "_share_tokens_locked" | |
15 | 15 | ||
16 | 16 | let kShareTokensLocked = "_total_share_tokens_locked" | |
17 | 17 | ||
18 | 18 | let kOraclePool = "pool_" | |
19 | 19 | ||
20 | 20 | let kPoolAssetIds = "asset_ids" | |
21 | 21 | ||
22 | 22 | let kAdminPubKey1 = "admin_pub_1" | |
23 | 23 | ||
24 | 24 | let kAdminPubKey2 = "admin_pub_2" | |
25 | 25 | ||
26 | 26 | let kAdminPubKey3 = "admin_pub_3" | |
27 | 27 | ||
28 | 28 | let kFarmingAddr = "farming_address" | |
29 | 29 | ||
30 | 30 | let scaleValue = 100000000 | |
31 | 31 | ||
32 | 32 | let oracle = Address(base58'3NBBWfzZtZtszaXbitTKnrB2xXwv26Bn7H9') | |
33 | 33 | ||
34 | 34 | func getBase58FromOracle (key) = match getString(oracle, key) { | |
35 | 35 | case string: String => | |
36 | 36 | fromBase58String(string) | |
37 | 37 | case nothing => | |
38 | 38 | throw((key + "is empty")) | |
39 | 39 | } | |
40 | 40 | ||
41 | 41 | ||
42 | 42 | let adminPubKey1 = getBase58FromOracle(kAdminPubKey1) | |
43 | 43 | ||
44 | 44 | let adminPubKey2 = getBase58FromOracle(kAdminPubKey2) | |
45 | 45 | ||
46 | 46 | let adminPubKey3 = getBase58FromOracle(kAdminPubKey3) | |
47 | 47 | ||
48 | 48 | let farmingAddr = Address(getBase58FromOracle(kFarmingAddr)) | |
49 | 49 | ||
50 | 50 | let active = valueOrElse(getBoolean(this, kActive), true) | |
51 | 51 | ||
52 | 52 | func isActive () = if (active) | |
53 | 53 | then unit | |
54 | 54 | else throw("DApp is inactive at this moment") | |
55 | 55 | ||
56 | 56 | ||
57 | 57 | func isPoolCall (caller) = if (isDefined(getString(oracle, (kOraclePool + toString(caller))))) | |
58 | 58 | then unit | |
59 | 59 | else throw("Only pool can call this function") | |
60 | 60 | ||
61 | 61 | ||
62 | 62 | func isFarmingCall (caller) = if ((caller == farmingAddr)) | |
63 | 63 | then unit | |
64 | 64 | else throw("Only farming can call this function") | |
65 | 65 | ||
66 | 66 | ||
67 | 67 | func suspend (cause) = [BooleanEntry(kActive, false), StringEntry(kCause, cause)] | |
68 | 68 | ||
69 | 69 | ||
70 | 70 | func getUserShareTokensLocked (pool,userAddress) = valueOrElse(getInteger(farmingAddr, (((pool + "_") + userAddress) + kUserShareTokensLocked)), 0) | |
71 | 71 | ||
72 | 72 | ||
73 | 73 | func getTotalShareTokensLocked (pool) = valueOrElse(getInteger(farmingAddr, (pool + kShareTokensLocked)), 0) | |
74 | 74 | ||
75 | 75 | ||
76 | 76 | func getUserLastInterest (user,pool,assetId) = valueOrElse(getInteger(this, (((((user + "_") + pool) + "_") + assetId) + kUserLastInterest)), 0) | |
77 | 77 | ||
78 | 78 | ||
79 | 79 | func getPoolTokenLastInterest (pool,assetId) = valueOrElse(getInteger(this, (((pool + "_") + assetId) + kLastPoolTokenInterest)), 0) | |
80 | 80 | ||
81 | 81 | ||
82 | 82 | func getUserClaimAvailable (user,pool,assetId) = valueOrElse(getInteger(this, (((((user + "_") + pool) + "_") + assetId) + kUserClaimAvailable)), 0) | |
83 | 83 | ||
84 | 84 | ||
85 | 85 | func getStrAssetId (assetId) = match assetId { | |
86 | 86 | case id: ByteVector => | |
87 | 87 | toBase58String(id) | |
88 | 88 | case waves: Unit => | |
89 | 89 | "WAVES" | |
90 | 90 | case _ => | |
91 | 91 | throw("Match error") | |
92 | 92 | } | |
93 | 93 | ||
94 | 94 | ||
95 | 95 | func calcClaimAmount (pool,assetId,user) = { | |
96 | 96 | let lastInterest = getPoolTokenLastInterest(pool, assetId) | |
97 | 97 | let userLastInterest = getUserLastInterest(user, pool, assetId) | |
98 | 98 | let userShareTokensLocked = getUserShareTokensLocked(pool, user) | |
99 | 99 | let userClaimAvailable = getUserClaimAvailable(user, pool, assetId) | |
100 | 100 | let newUserClaimAvailable = fraction(userShareTokensLocked, (lastInterest - userLastInterest), scaleValue) | |
101 | 101 | $Tuple2((userClaimAvailable + newUserClaimAvailable), lastInterest) | |
102 | 102 | } | |
103 | 103 | ||
104 | 104 | ||
105 | 105 | func calcClaimAmountEvaluate (pool,user) = { | |
106 | 106 | let poolAddr = Address(fromBase58String(pool)) | |
107 | 107 | let assetIds = split(valueOrErrorMessage(getString(poolAddr, kPoolAssetIds), "Can't find pool assets"), ",") | |
108 | 108 | func calcClaimAmounts (acc,assetId) = { | |
109 | 109 | let $t033323402 = calcClaimAmount(pool, assetId, user) | |
110 | 110 | let claimAmount = $t033323402._1 | |
111 | 111 | let lastInterest = $t033323402._2 | |
112 | 112 | (acc :+ [claimAmount]) | |
113 | 113 | } | |
114 | 114 | ||
115 | 115 | let claimAmounts = { | |
116 | 116 | let $l = assetIds | |
117 | 117 | let $s = size($l) | |
118 | 118 | let $acc0 = nil | |
119 | 119 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
120 | 120 | then $a | |
121 | 121 | else calcClaimAmounts($a, $l[$i]) | |
122 | 122 | ||
123 | 123 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
124 | 124 | then $a | |
125 | 125 | else throw("List size exceeds 15") | |
126 | 126 | ||
127 | 127 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15) | |
128 | 128 | } | |
129 | 129 | $Tuple2(assetIds, claimAmounts) | |
130 | 130 | } | |
131 | 131 | ||
132 | 132 | ||
133 | 133 | @Callable(i) | |
134 | 134 | func airDrop () = valueOrElse(isActive(), valueOrElse(isPoolCall(i.caller), { | |
135 | 135 | let $t036153690 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
136 | 136 | let pmtAmount = $t036153690._1 | |
137 | 137 | let pmtAssetId = $t036153690._2 | |
138 | 138 | let pool = toString(i.caller) | |
139 | 139 | let totalShareTokensLocked = getTotalShareTokensLocked(pool) | |
140 | 140 | let lastInterest = getPoolTokenLastInterest(pool, getStrAssetId(pmtAssetId)) | |
141 | 141 | let interestNew = (lastInterest + (if (if ((totalShareTokensLocked > 0)) | |
142 | 142 | then (pmtAmount > 0) | |
143 | 143 | else false) | |
144 | 144 | then fraction(pmtAmount, scaleValue, totalShareTokensLocked) | |
145 | 145 | else 0)) | |
146 | 146 | [IntegerEntry((((pool + "_") + getStrAssetId(pmtAssetId)) + kLastPoolTokenInterest), interestNew)] | |
147 | 147 | })) | |
148 | 148 | ||
149 | 149 | ||
150 | 150 | ||
151 | 151 | @Callable(i) | |
152 | - | func updateUserInterest (newUserShareTokensLocked) = valueOrElse(isActive(), valueOrElse(isFarmingCall(i.caller), { | |
153 | - | let poolAddr = | |
152 | + | func updateUserInterest (pool,newUserShareTokensLocked) = valueOrElse(isActive(), valueOrElse(isFarmingCall(i.caller), { | |
153 | + | let poolAddr = Address(fromBase58String(pool)) | |
154 | 154 | let user = toString(i.originCaller) | |
155 | - | let pool = toString(poolAddr) | |
156 | 155 | let assetIds = split(valueOrErrorMessage(getString(poolAddr, kPoolAssetIds), "Can't find pool assets"), ",") | |
157 | 156 | func calcNewUserInterestAndClaimAmountEtries (acc,assetId) = { | |
158 | - | let $ | |
159 | - | let claimAmount = $ | |
160 | - | let lastInterest = $ | |
157 | + | let $t045784648 = calcClaimAmount(pool, assetId, user) | |
158 | + | let claimAmount = $t045784648._1 | |
159 | + | let lastInterest = $t045784648._2 | |
161 | 160 | (acc :+ [IntegerEntry((((((user + "_") + pool) + "_") + assetId) + kUserClaimAvailable), claimAmount), IntegerEntry((((((user + "_") + pool) + "_") + assetId) + kUserLastInterest), lastInterest)]) | |
162 | 161 | } | |
163 | 162 | ||
164 | 163 | let $l = assetIds | |
165 | 164 | let $s = size($l) | |
166 | 165 | let $acc0 = nil | |
167 | 166 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
168 | 167 | then $a | |
169 | 168 | else calcNewUserInterestAndClaimAmountEtries($a, $l[$i]) | |
170 | 169 | ||
171 | 170 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
172 | 171 | then $a | |
173 | 172 | else throw("List size exceeds 15") | |
174 | 173 | ||
175 | 174 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15) | |
176 | 175 | })) | |
177 | 176 | ||
178 | 177 | ||
179 | 178 | ||
180 | 179 | @Callable(i) | |
181 | 180 | func claim (pool) = valueOrElse(isActive(), { | |
182 | 181 | let poolAddr = Address(fromBase58String(pool)) | |
183 | 182 | let user = toString(i.caller) | |
184 | 183 | let assetIds = split(valueOrErrorMessage(getString(poolAddr, kPoolAssetIds), "Can't find pool assets"), ",") | |
185 | 184 | func calcClaimAmountEtries (acc,assetId) = { | |
186 | - | let $ | |
187 | - | let entries = $ | |
188 | - | let sum = $ | |
189 | - | let $ | |
190 | - | let claimAmount = $ | |
191 | - | let lastInterest = $ | |
185 | + | let $t053015325 = acc | |
186 | + | let entries = $t053015325._1 | |
187 | + | let sum = $t053015325._2 | |
188 | + | let $t053325402 = calcClaimAmount(pool, assetId, user) | |
189 | + | let claimAmount = $t053325402._1 | |
190 | + | let lastInterest = $t053325402._2 | |
192 | 191 | $Tuple2((entries :+ [ScriptTransfer(i.caller, claimAmount, fromBase58String(assetId)), IntegerEntry((((((user + "_") + pool) + "_") + assetId) + kUserClaimAvailable), 0), IntegerEntry((((((user + "_") + pool) + "_") + assetId) + kUserLastInterest), lastInterest)]), claimAmount) | |
193 | 192 | } | |
194 | 193 | ||
195 | - | let $ | |
194 | + | let $t057025784 = { | |
196 | 195 | let $l = assetIds | |
197 | 196 | let $s = size($l) | |
198 | 197 | let $acc0 = $Tuple2(nil, 0) | |
199 | 198 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
200 | 199 | then $a | |
201 | 200 | else calcClaimAmountEtries($a, $l[$i]) | |
202 | 201 | ||
203 | 202 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
204 | 203 | then $a | |
205 | 204 | else throw("List size exceeds 15") | |
206 | 205 | ||
207 | 206 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15) | |
208 | 207 | } | |
209 | - | let claimEntries = $ | |
210 | - | let sumTokens = $ | |
208 | + | let claimEntries = $t057025784._1 | |
209 | + | let sumTokens = $t057025784._2 | |
211 | 210 | if ((sumTokens == 0)) | |
212 | 211 | then throw("You have no tokens for claim") | |
213 | 212 | else claimEntries | |
214 | 213 | }) | |
215 | 214 | ||
216 | 215 | ||
217 | 216 | ||
218 | 217 | @Callable(i) | |
219 | 218 | func shutdown () = if (!(active)) | |
220 | 219 | then throw(("DApp is already suspended. Cause: " + valueOrElse(getString(this, kCause), "the cause wasn't specified"))) | |
221 | 220 | else if (!(containsElement([adminPubKey1, adminPubKey2, adminPubKey3], i.callerPublicKey))) | |
222 | 221 | then throw("Only admin can call this function") | |
223 | 222 | else suspend("Paused by admin") | |
224 | 223 | ||
225 | 224 | ||
226 | 225 | ||
227 | 226 | @Callable(i) | |
228 | 227 | func activate () = if (active) | |
229 | 228 | then throw("DApp is already active") | |
230 | 229 | else if (!(containsElement([adminPubKey1, adminPubKey2, adminPubKey3], i.callerPublicKey))) | |
231 | 230 | then throw("Only admin can call this function") | |
232 | 231 | else [BooleanEntry(kActive, true), DeleteEntry(kCause)] | |
233 | 232 | ||
234 | 233 | ||
235 | 234 | @Verifier(tx) | |
236 | 235 | func verify () = { | |
237 | 236 | let adminPubKey1Signed = if (sigVerify(tx.bodyBytes, tx.proofs[0], adminPubKey1)) | |
238 | 237 | then 1 | |
239 | 238 | else 0 | |
240 | 239 | let adminPubKey2Signed = if (sigVerify(tx.bodyBytes, tx.proofs[1], adminPubKey2)) | |
241 | 240 | then 1 | |
242 | 241 | else 0 | |
243 | 242 | let adminPubKey3Signed = if (sigVerify(tx.bodyBytes, tx.proofs[2], adminPubKey3)) | |
244 | 243 | then 1 | |
245 | 244 | else 0 | |
246 | 245 | (((adminPubKey1Signed + adminPubKey2Signed) + adminPubKey3Signed) >= 2) | |
247 | 246 | } | |
248 | 247 |
github/deemru/w8io/169f3d6 54.01 ms ◑