tx · 9mUCrSAnwhkgauXLQrk9oVWBDnA6NVu8yZZzUKDuYThx 3PEVpbeDDkjmKqiMm25MgMZfazR7U1Eivzi: -0.01500000 Waves 2023.10.08 14:45 [3855450] smart account 3PEVpbeDDkjmKqiMm25MgMZfazR7U1Eivzi > SELF 0.00000000 Waves
{ "type": 13, "id": "9mUCrSAnwhkgauXLQrk9oVWBDnA6NVu8yZZzUKDuYThx", "fee": 1500000, "feeAssetId": null, "timestamp": 1696765557670, "version": 2, "chainId": 87, "sender": "3PEVpbeDDkjmKqiMm25MgMZfazR7U1Eivzi", "senderPublicKey": "7kGVvqWtJxnwwNwaepvnSHefn71KaKkgcYrDhYiuXzjj", "proofs": [ "4FBXbQ546hf2w7JNWcj8iLJbMZo9vsT5183qCcZUwTsUBBzzN6KVRgTjNxYorb1tYpxgTb1h2uitHCSbgQg1eWGi" ], "script": "base64:BgI0CAISAwoBCBIDCgEIEggKBggBBAEBARIDCgEEEgASABIAEgMKAQgSBgoECAgBARIECgIICCgAC2tleU1BY2NQS2V5AgltYXN0ZXJfcGsADWtleUJhY2t1cFBLZXkCB2JhY2tfcGsACHdhcnNQS2V5Agd3YXJzX3BrAQZnZXRTdHIBA2tleQQHJG1hdGNoMAkAnQgCBQR0aGlzBQNrZXkDCQABAgUHJG1hdGNoMAIGU3RyaW5nBAFiBQckbWF0Y2gwBQFiAgAADm1BY2NQS2V5U3RyaW5nCQEGZ2V0U3RyAQULa2V5TUFjY1BLZXkAEGJhY2t1cFBLZXlTdHJpbmcJAQZnZXRTdHIBBQ1rZXlCYWNrdXBQS2V5AQxnZXRCYWNrdXBLZXkAAwkAAAIFEGJhY2t1cFBLZXlTdHJpbmcCAAgFBHRoaXMFYnl0ZXMJANkEAQUQYmFja3VwUEtleVN0cmluZwAIbUFjY1BLZXkJANkEAQUObUFjY1BLZXlTdHJpbmcACG1BY2NBZGRyCQCnCAEFCG1BY2NQS2V5AApmZWVQZXJjZW50CQERQGV4dHJOYXRpdmUoMTA1MCkC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GlvbgIUY2FsbE1hcmtldHBsYWNlUHJveHkHAwkA9AMDCAUCdHgJYm9keUJ5dGVzCQCRAwIIBQJ0eAZwcm9vZnMAAAgFAnR4D3NlbmRlclB1YmxpY0tleQYJAPQDAwgFAnR4CWJvZHlCeXRlcwkAkQMCCAUCdHgGcHJvb2ZzAAAJAQxnZXRCYWNrdXBLZXkAAwMJAAACCQCkCAEIBQNpbnYEZEFwcAUOc3Rha2luZ0FkZHJlc3MJAQ9jb250YWluc0VsZW1lbnQCBRRhY2NlcHRlZENhbGxzU3Rha2luZwgFA2ludghmdW5jdGlvbgcDCQD0AwMIBQJ0eAlib2R5Qnl0ZXMJAJEDAggFAnR4BnByb29mcwAACAUCdHgPc2VuZGVyUHVibGljS2V5BgkA9AMDCAUCdHgJYm9keUJ5dGVzCQCRAwIIBQJ0eAZwcm9vZnMAAAkBDGdldEJhY2t1cEtleQAECmRhcHBUb0NhbGwJAKUIAQkApAgBCAUDaW52BGRBcHAED2FsbG93ZWRDb250cmFjdAkBB2dldFN0ckECBQhtQWNjQWRkcgkArAICAhFhbGxvd2VkX2NvbnRyYWN0XwUKZGFwcFRvQ2FsbAMDCQAAAgUPYWxsb3dlZENvbnRyYWN0AgdGQVJNSU5HCQAAAggFA2ludghmdW5jdGlvbgILY2xhaW1SZXdhcmQHBwkBAiE9AgUPYWxsb3dlZENvbnRyYWN0AgADCQABAgUHJG1hdGNoMAIUU2V0U2NyaXB0VHJhbnNhY3Rpb24EAnNzBQckbWF0Y2gwCQD0AwMIBQJ0eAlib2R5Qnl0ZXMJAJEDAggFAnR4BnByb29mcwAABQhtQWNjUEtleQMJAAECBQckbWF0Y2gwAhdNYXNzVHJhbnNmZXJUcmFuc2FjdGlvbgQCbXQFByRtYXRjaDAJAPQDAwgFAnR4CWJvZHlCeXRlcwkAkQMCCAUCdHgGcHJvb2ZzAAAFCG1BY2NQS2V5BzsLFow=", "height": 3855450, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: HBacgcXq2GfwMooZ26fCZqefBkLfqcLEbMKnauo2aGMX Next: 2S9e7hLPDLoegQEJiBCg15MVZ4o7q9LJGfNawNS25Csh Full:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let keyMAccPKey = "master_pk" | |
5 | 5 | ||
6 | 6 | let keyBackupPKey = "back_pk" | |
7 | 7 | ||
8 | 8 | let warsPKey = "wars_pk" | |
9 | 9 | ||
10 | 10 | func getStr (key) = match getString(this, key) { | |
11 | 11 | case b: String => | |
12 | 12 | b | |
13 | 13 | case _ => | |
14 | 14 | "" | |
15 | 15 | } | |
16 | 16 | ||
17 | 17 | ||
18 | 18 | let mAccPKeyString = getStr(keyMAccPKey) | |
19 | 19 | ||
20 | 20 | let backupPKeyString = getStr(keyBackupPKey) | |
21 | 21 | ||
22 | 22 | func getBackupKey () = if ((backupPKeyString == "")) | |
23 | 23 | then this.bytes | |
24 | 24 | else fromBase58String(backupPKeyString) | |
25 | 25 | ||
26 | 26 | ||
27 | 27 | let mAccPKey = fromBase58String(mAccPKeyString) | |
28 | 28 | ||
29 | 29 | let mAccAddr = addressFromPublicKey(mAccPKey) | |
30 | 30 | ||
31 | 31 | let feePercent = getIntegerValue(mAccAddr, (("f_" + toString(this)) + "_fee")) | |
32 | 32 | ||
33 | 33 | let stakingAddress = addressFromStringValue(valueOrErrorMessage(getString(mAccAddr, (("f_" + toString(this)) + "_stake_address")), (("f_" + toString(this)) + "_stake_address not defined"))) | |
34 | 34 | ||
35 | 35 | let wAccPKey = fromBase58String(valueOrErrorMessage(getString(mAccAddr, warsPKey), (warsPKey + " not defined"))) | |
36 | 36 | ||
37 | 37 | let kTotalLiquidity = "total_liquidity" | |
38 | 38 | ||
39 | 39 | let kInitialized = "INITIALIZED" | |
40 | 40 | ||
41 | 41 | let kLiquidityThreshold = "LIQUIDITY_THRESHOLD" | |
42 | 42 | ||
43 | 43 | let kTotalFarmingReward = "total_farming_reward" | |
44 | 44 | ||
45 | 45 | let kShareAssetId = "SHARE_ASSET_ID" | |
46 | 46 | ||
47 | 47 | let kIncubatorDapp = "INCUBATOR_DAPP" | |
48 | 48 | ||
49 | 49 | let kBreederDapp = "BREEDER_DAPP" | |
50 | 50 | ||
51 | 51 | let kFarmingDapp = "FARMING_DAPP" | |
52 | 52 | ||
53 | 53 | let kMarketProxyDapp = "MARKETPLACE_PROXY_DAPP" | |
54 | 54 | ||
55 | 55 | let kAuctionDapp = "AUCTION_DAPP" | |
56 | 56 | ||
57 | 57 | let kLocked = "LOCKED" | |
58 | 58 | ||
59 | 59 | let kCeoCollectedFee = "ceo_collected_fee" | |
60 | 60 | ||
61 | 61 | let kCeoCollectedFeeOverall = "ceo_fee_overall" | |
62 | 62 | ||
63 | 63 | let kLockedInvestments = "locked_investments" | |
64 | 64 | ||
65 | 65 | let keyTotalCompound = "total_compound" | |
66 | 66 | ||
67 | 67 | let keyGlobalStaked = "global_staked" | |
68 | 68 | ||
69 | 69 | func getInt (key) = match getInteger(this, key) { | |
70 | 70 | case b: Int => | |
71 | 71 | b | |
72 | 72 | case _ => | |
73 | 73 | 0 | |
74 | 74 | } | |
75 | 75 | ||
76 | 76 | ||
77 | 77 | func getBool (key) = match getBoolean(this, key) { | |
78 | 78 | case b: Boolean => | |
79 | 79 | b | |
80 | 80 | case _ => | |
81 | 81 | unit | |
82 | 82 | } | |
83 | 83 | ||
84 | 84 | ||
85 | 85 | func getStrA (a,k) = match getString(a, k) { | |
86 | 86 | case b: String => | |
87 | 87 | b | |
88 | 88 | case _ => | |
89 | 89 | "" | |
90 | 90 | } | |
91 | 91 | ||
92 | 92 | ||
93 | 93 | func tryGetBoolean (a,key) = match getBoolean(a, key) { | |
94 | 94 | case b: Boolean => | |
95 | 95 | b | |
96 | 96 | case _ => | |
97 | 97 | false | |
98 | 98 | } | |
99 | 99 | ||
100 | 100 | ||
101 | 101 | func getIntA (address,key) = match getInteger(address, key) { | |
102 | 102 | case b: Int => | |
103 | 103 | b | |
104 | 104 | case _ => | |
105 | 105 | 0 | |
106 | 106 | } | |
107 | 107 | ||
108 | 108 | ||
109 | 109 | func getVoteHeightKey () = "VOTE_HEIGHT_START" | |
110 | 110 | ||
111 | 111 | ||
112 | 112 | func resultVoteKey (height) = ("LIQUIDATED_" + height) | |
113 | 113 | ||
114 | 114 | ||
115 | 115 | func isLiquidated () = { | |
116 | 116 | let voteHeight = getIntA(stakingAddress, getVoteHeightKey()) | |
117 | 117 | if ((voteHeight == 0)) | |
118 | 118 | then false | |
119 | 119 | else tryGetBoolean(stakingAddress, resultVoteKey(toString(voteHeight))) | |
120 | 120 | } | |
121 | 121 | ||
122 | 122 | ||
123 | 123 | func getMarketProxyAddr () = getStrA(mAccAddr, kMarketProxyDapp) | |
124 | 124 | ||
125 | 125 | ||
126 | 126 | func getEggId () = fromBase58String(getStringValue(mAccAddr, "EGG_ASSET_ID")) | |
127 | 127 | ||
128 | 128 | ||
129 | 129 | func getShareAssetId () = fromBase58String(getStr(kShareAssetId)) | |
130 | 130 | ||
131 | 131 | ||
132 | 132 | func asInt (value) = match value { | |
133 | 133 | case int: Int => | |
134 | 134 | int | |
135 | 135 | case _ => | |
136 | 136 | throw("wrong type, expected: Int") | |
137 | 137 | } | |
138 | 138 | ||
139 | 139 | ||
140 | 140 | @Callable(i) | |
141 | 141 | func initMasterKey (publicKey) = if ((i.caller != this)) | |
142 | 142 | then throw("You cannot do this action") | |
143 | 143 | else if ((mAccPKeyString != "")) | |
144 | 144 | then throw("Master public key already set, you can't override!") | |
145 | 145 | else [StringEntry(keyMAccPKey, publicKey)] | |
146 | 146 | ||
147 | 147 | ||
148 | 148 | ||
149 | 149 | @Callable(i) | |
150 | 150 | func initBackupKey (publicKey) = if ((i.caller != addressFromPublicKey(mAccPKey))) | |
151 | 151 | then throw("You cannot do this action") | |
152 | 152 | else [StringEntry(keyBackupPKey, publicKey)] | |
153 | 153 | ||
154 | 154 | ||
155 | 155 | ||
156 | 156 | @Callable(i) | |
157 | 157 | func initCollectiveFarm (name,minimumThreshold,migration,totalFarmingReward,totalLiquidity,totalFarmToken) = if ((mAccPKeyString == "")) | |
158 | 158 | then throw("First initiatie a master public key!") | |
159 | 159 | else if ((i.callerPublicKey != mAccPKey)) | |
160 | 160 | then throw("_1") | |
161 | 161 | else if ((getBool(kInitialized) != unit)) | |
162 | 162 | then throw("_2") | |
163 | 163 | else if (if ((migration == false)) | |
164 | 164 | then if ((i.payments[0].amount != 10000000)) | |
165 | 165 | then true | |
166 | 166 | else (i.payments[0].assetId != getEggId()) | |
167 | 167 | else false) | |
168 | 168 | then throw("_20") | |
169 | 169 | else { | |
170 | 170 | let shareTokens = if (migration) | |
171 | 171 | then totalFarmToken | |
172 | 172 | else 10000000 | |
173 | 173 | let shareToken = Issue(name, (("Team token for the \"" + name) + "\" collective farm"), shareTokens, 8, true) | |
174 | 174 | let totLiquidity = if (migration) | |
175 | 175 | then totalLiquidity | |
176 | 176 | else 10000000 | |
177 | 177 | let totFarmingReward = if (migration) | |
178 | 178 | then [IntegerEntry(kTotalFarmingReward, totalFarmingReward)] | |
179 | 179 | else nil | |
180 | 180 | ([StringEntry(kShareAssetId, toBase58String(calculateAssetId(shareToken))), BooleanEntry(kInitialized, true), IntegerEntry(kTotalLiquidity, totLiquidity), shareToken, ScriptTransfer(i.caller, shareTokens, calculateAssetId(shareToken)), BooleanEntry(kLocked, false), IntegerEntry(kLiquidityThreshold, minimumThreshold)] ++ totFarmingReward) | |
181 | 181 | } | |
182 | 182 | ||
183 | 183 | ||
184 | 184 | ||
185 | 185 | @Callable(i) | |
186 | 186 | func setLock (s) = if ((i.callerPublicKey != mAccPKey)) | |
187 | 187 | then throw("_21") | |
188 | 188 | else [BooleanEntry(kLocked, s)] | |
189 | 189 | ||
190 | 190 | ||
191 | 191 | ||
192 | 192 | @Callable(i) | |
193 | 193 | func lockInvestments () = if ((i.caller != this)) | |
194 | 194 | then throw("You cannot lock this contract") | |
195 | 195 | else [BooleanEntry(kLockedInvestments, true)] | |
196 | 196 | ||
197 | 197 | ||
198 | 198 | ||
199 | 199 | @Callable(i) | |
200 | 200 | func unlockInvestments () = if ((i.caller != this)) | |
201 | 201 | then throw("You cannot lock this contract") | |
202 | 202 | else [BooleanEntry(kLockedInvestments, false)] | |
203 | 203 | ||
204 | 204 | ||
205 | 205 | ||
206 | 206 | @Callable(i) | |
207 | 207 | func provideLiquidity () = if (isLiquidated()) | |
208 | 208 | then throw("CPL: CF is liquidated!") | |
209 | 209 | else { | |
210 | 210 | let eggAssetId = getEggId() | |
211 | 211 | if (if (if ((i.callerPublicKey != wAccPKey)) | |
212 | 212 | then (i.callerPublicKey != mAccPKey) | |
213 | 213 | else false) | |
214 | 214 | then (getBool(kLockedInvestments) == true) | |
215 | 215 | else false) | |
216 | 216 | then throw("Contract is locked for investments by it's CEO. Please invest in another collective farm.") | |
217 | 217 | else if ((getBool(kLocked) == true)) | |
218 | 218 | then throw("_22") | |
219 | 219 | else if ((i.payments[0].assetId != eggAssetId)) | |
220 | 220 | then throw("_4") | |
221 | 221 | else if ((1000000 > i.payments[0].amount)) | |
222 | 222 | then throw("Min amount to invest is 0.01 EGG") | |
223 | 223 | else { | |
224 | 224 | let totalLiquidity = getInt(kTotalLiquidity) | |
225 | 225 | let shareTokensToGive = i.payments[0].amount | |
226 | 226 | let shareTokensId = fromBase58String(getStr(kShareAssetId)) | |
227 | 227 | let reissue = Reissue(getShareAssetId(), shareTokensToGive, true) | |
228 | 228 | let kParticipated = (("account_" + toString(i.caller)) + "_participated") | |
229 | 229 | let alreadyParticipated = getBool(kParticipated) | |
230 | 230 | $Tuple2([reissue, ScriptTransfer(i.caller, shareTokensToGive, shareTokensId), IntegerEntry(kTotalLiquidity, (totalLiquidity + value(i.payments[0].amount))), BooleanEntry(kParticipated, true)], shareTokensToGive) | |
231 | 231 | } | |
232 | 232 | } | |
233 | 233 | ||
234 | 234 | ||
235 | 235 | ||
236 | 236 | @Callable(i) | |
237 | 237 | func claimFarmingRewardProxy (ids) = if (isLiquidated()) | |
238 | 238 | then throw("CCFRP: CF is liquidated!") | |
239 | 239 | else if ((i.callerPublicKey != mAccPKey)) | |
240 | 240 | then throw("_23") | |
241 | 241 | else { | |
242 | 242 | let eggAssetId = getEggId() | |
243 | 243 | let shareAssetId = getShareAssetId() | |
244 | 244 | let farmingDapp = addressFromStringValue(getStrA(mAccAddr, kFarmingDapp)) | |
245 | 245 | func claimReward (accum,nftId) = { | |
246 | 246 | let invRes = invoke(farmingDapp, "claimReward", [nftId], nil) | |
247 | 247 | if ((invRes == invRes)) | |
248 | 248 | then match invRes { | |
249 | 249 | case int: Int => | |
250 | 250 | (accum + int) | |
251 | 251 | case _ => | |
252 | 252 | throw("_5") | |
253 | 253 | } | |
254 | 254 | else throw("Strict value is not equal to itself.") | |
255 | 255 | } | |
256 | 256 | ||
257 | 257 | let nftIds = split(ids, ";") | |
258 | 258 | let foldResult = { | |
259 | 259 | let $l = nftIds | |
260 | 260 | let $s = size($l) | |
261 | 261 | let $acc0 = 0 | |
262 | 262 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
263 | 263 | then $a | |
264 | 264 | else claimReward($a, $l[$i]) | |
265 | 265 | ||
266 | 266 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
267 | 267 | then $a | |
268 | 268 | else throw("List size exceeds 10") | |
269 | 269 | ||
270 | 270 | $f0_2($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) | |
271 | 271 | } | |
272 | 272 | let claimedReward = match foldResult { | |
273 | 273 | case int: Int => | |
274 | 274 | int | |
275 | 275 | case _ => | |
276 | 276 | throw("_6") | |
277 | 277 | } | |
278 | 278 | let totalFarmingReward = getInt(kTotalFarmingReward) | |
279 | 279 | let farmCeoFeeSize = fraction(claimedReward, feePercent, 100) | |
280 | 280 | let currentCeoFee = getInt(kCeoCollectedFee) | |
281 | 281 | let ceoFeeOverall = getInt(kCeoCollectedFeeOverall) | |
282 | 282 | let amountToPay = (claimedReward - farmCeoFeeSize) | |
283 | 283 | let topUp = invoke(stakingAddress, "topUpReward", nil, [AttachedPayment(eggAssetId, amountToPay)]) | |
284 | 284 | if ((topUp == topUp)) | |
285 | 285 | then [IntegerEntry(kTotalFarmingReward, (totalFarmingReward + amountToPay)), IntegerEntry(kCeoCollectedFee, (currentCeoFee + farmCeoFeeSize)), IntegerEntry(kCeoCollectedFeeOverall, (ceoFeeOverall + farmCeoFeeSize))] | |
286 | 286 | else throw("Strict value is not equal to itself.") | |
287 | 287 | } | |
288 | 288 | ||
289 | 289 | ||
290 | 290 | ||
291 | 291 | @Callable(i) | |
292 | 292 | func claimCeoFee (address1,address2,address1Share,address2Share) = if (isLiquidated()) | |
293 | 293 | then throw("CCCF: CF is liquidated!") | |
294 | 294 | else if ((0 > address1Share)) | |
295 | 295 | then throw("Share 1 can't be negative") | |
296 | 296 | else if ((0 > address2Share)) | |
297 | 297 | then throw("Share 2 can't be negative") | |
298 | 298 | else if (((address1Share + address2Share) != 100)) | |
299 | 299 | then throw("Sum of shares should be 100") | |
300 | 300 | else if ((getBool(kLocked) == true)) | |
301 | 301 | then throw("_22") | |
302 | 302 | else if ((i.caller == this)) | |
303 | 303 | then { | |
304 | 304 | let currentCeoCollectedFee = getInt(kCeoCollectedFee) | |
305 | 305 | let address1Reward = if ((address2 == "")) | |
306 | 306 | then currentCeoCollectedFee | |
307 | 307 | else fraction(currentCeoCollectedFee, address1Share, 100) | |
308 | 308 | let address2Reward = if ((address2 == "")) | |
309 | 309 | then 0 | |
310 | 310 | else fraction(currentCeoCollectedFee, address2Share, 100) | |
311 | 311 | let scriptTransferAddress2 = if ((address2 == "")) | |
312 | 312 | then nil | |
313 | 313 | else [ScriptTransfer(addressFromStringValue(address2), address2Reward, getEggId())] | |
314 | 314 | (scriptTransferAddress2 ++ [ScriptTransfer(addressFromStringValue(address1), address1Reward, getEggId()), IntegerEntry(kCeoCollectedFee, 0)]) | |
315 | 315 | } | |
316 | 316 | else throw("Only manager can call the contract") | |
317 | 317 | ||
318 | 318 | ||
319 | 319 | ||
320 | 320 | @Callable(i) | |
321 | 321 | func callUnstakeProxy (function,assetId) = if (isLiquidated()) | |
322 | 322 | then throw("CCUP: CF is liquidated!") | |
323 | 323 | else if ((getBool(kLocked) == true)) | |
324 | 324 | then throw("Contract is locked now") | |
325 | 325 | else if (if ((function != "unstakeNFT")) | |
326 | 326 | then (function != "unstakeJackpot") | |
327 | 327 | else false) | |
328 | 328 | then throw("Bad function name") | |
329 | 329 | else if ((i.caller != this)) | |
330 | 330 | then throw("Can be called only by the account") | |
331 | 331 | else { | |
332 | 332 | let eggAssetId = getEggId() | |
333 | 333 | let shareAssetId = getShareAssetId() | |
334 | 334 | let farmingDappAddress = addressFromStringValue(getStrA(mAccAddr, "FARMING_DAPP")) | |
335 | 335 | let unstakedReward = invoke(farmingDappAddress, function, [assetId], [AttachedPayment(unit, 1000000)]) | |
336 | 336 | if ((unstakedReward == unstakedReward)) | |
337 | 337 | then { | |
338 | 338 | let reward = match unstakedReward { | |
339 | 339 | case int: Int => | |
340 | 340 | int | |
341 | 341 | case _ => | |
342 | 342 | throw("Error during unstaking") | |
343 | 343 | } | |
344 | 344 | let currentCeoFee = getInt(kCeoCollectedFee) | |
345 | 345 | let ceoFeeOverall = getInt(kCeoCollectedFeeOverall) | |
346 | 346 | let farmCeoFeeSize = fraction(reward, feePercent, 100) | |
347 | 347 | let amountToPay = (reward - farmCeoFeeSize) | |
348 | 348 | let topUp = invoke(stakingAddress, "topUpReward", nil, [AttachedPayment(eggAssetId, amountToPay)]) | |
349 | 349 | if ((topUp == topUp)) | |
350 | 350 | then [IntegerEntry(kCeoCollectedFee, (currentCeoFee + farmCeoFeeSize)), IntegerEntry(kCeoCollectedFeeOverall, (ceoFeeOverall + farmCeoFeeSize))] | |
351 | 351 | else throw("Strict value is not equal to itself.") | |
352 | 352 | } | |
353 | 353 | else throw("Strict value is not equal to itself.") | |
354 | 354 | } | |
355 | 355 | ||
356 | 356 | ||
357 | 357 | @Verifier(tx) | |
358 | 358 | func verify () = { | |
359 | 359 | let checkStarted = (getInt(kTotalLiquidity) >= getInt(kLiquidityThreshold)) | |
360 | 360 | match tx { | |
361 | 361 | case inv: InvokeScriptTransaction => | |
362 | 362 | let acceptedCallsStaking = ["stakeFarmTokens", "claimReward", "withdrawFarmTokens", "voteToLiquidate"] | |
363 | 363 | let acceptedCallsThis = ["callUnstakeProxy", "claimCeoFee", "lockInvestments", "unlockInvestments"] | |
364 | 364 | if (if (if ((inv.function == "unstakeNFT")) | |
365 | 365 | then true | |
366 | 366 | else (inv.function == "unstakeJackpot")) | |
367 | 367 | then (addressFromRecipient(inv.dApp) == addressFromStringValue(getStrA(mAccAddr, "FARMING_DAPP"))) | |
368 | 368 | else false) | |
369 | 369 | then throw("You cannot call these functions directly") | |
370 | 370 | else if (if (if ((addressFromRecipient(inv.dApp) == this)) | |
371 | 371 | then (inv.function == "initMasterKey") | |
372 | 372 | else false) | |
373 | 373 | then (mAccPKeyString == "") | |
374 | 374 | else false) | |
375 | 375 | then if (sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)) | |
376 | 376 | then true | |
377 | 377 | else sigVerify(tx.bodyBytes, tx.proofs[0], getBackupKey()) | |
378 | 378 | else if (if ((sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) == false)) | |
379 | 379 | then (sigVerify(tx.bodyBytes, tx.proofs[0], getBackupKey()) == false) | |
380 | 380 | else false) | |
381 | 381 | then throw("_100") | |
382 | 382 | else if ((checkStarted == false)) | |
383 | 383 | then throw("_14") | |
384 | 384 | else if ((getBool(kLocked) == true)) | |
385 | 385 | then throw("_22") | |
386 | 386 | else if (if ((inv.fee > 900000)) | |
387 | 387 | then true | |
388 | 388 | else (inv.feeAssetId != unit)) | |
389 | 389 | then throw("_15: to much fee") | |
390 | 390 | else if ((size(inv.payments) > 4)) | |
391 | 391 | then throw("_17: to big payment size") | |
392 | 392 | else if (if ((addressFromRecipient(inv.dApp) == this)) | |
393 | 393 | then containsElement(acceptedCallsThis, inv.function) | |
394 | 394 | else false) | |
395 | 395 | then if (sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)) | |
396 | 396 | then true | |
397 | 397 | else sigVerify(tx.bodyBytes, tx.proofs[0], getBackupKey()) | |
398 | 398 | else if (if ((addressFromRecipient(inv.dApp) == addressFromStringValue(getMarketProxyAddr()))) | |
399 | 399 | then (inv.function == "callMarketplaceProxy") | |
400 | 400 | else false) | |
401 | 401 | then if (sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)) | |
402 | 402 | then true | |
403 | 403 | else sigVerify(tx.bodyBytes, tx.proofs[0], getBackupKey()) | |
404 | 404 | else if (if ((addressFromRecipient(inv.dApp) == stakingAddress)) | |
405 | 405 | then containsElement(acceptedCallsStaking, inv.function) | |
406 | 406 | else false) | |
407 | 407 | then if (sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)) | |
408 | 408 | then true | |
409 | 409 | else sigVerify(tx.bodyBytes, tx.proofs[0], getBackupKey()) | |
410 | 410 | else { | |
411 | 411 | let dappToCall = toString(addressFromRecipient(inv.dApp)) | |
412 | 412 | let allowedContract = getStrA(mAccAddr, ("allowed_contract_" + dappToCall)) | |
413 | 413 | if (if ((allowedContract == "FARMING")) | |
414 | 414 | then (inv.function == "claimReward") | |
415 | 415 | else false) | |
416 | 416 | then false | |
417 | 417 | else (allowedContract != "") | |
418 | 418 | } | |
419 | 419 | case ss: SetScriptTransaction => | |
420 | 420 | sigVerify(tx.bodyBytes, tx.proofs[0], mAccPKey) | |
421 | 421 | case mt: MassTransferTransaction => | |
422 | 422 | sigVerify(tx.bodyBytes, tx.proofs[0], mAccPKey) | |
423 | 423 | case _ => | |
424 | 424 | false | |
425 | 425 | } | |
426 | 426 | } | |
427 | 427 |
github/deemru/w8io/fabc49c 47.09 ms ◑