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