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