tx · CoSnShRbEYaTKsKRLMDT9vzqAy66izyZHP62wyt21Tci

3N2PjXqef29HexCE7PeGZa9eRjS2jVeaFe4:  -0.01500000 Waves

2023.09.05 16:29 [2742138] smart account 3N2PjXqef29HexCE7PeGZa9eRjS2jVeaFe4 > SELF 0.00000000 Waves

{ "type": 13, "id": "CoSnShRbEYaTKsKRLMDT9vzqAy66izyZHP62wyt21Tci", "fee": 1500000, "feeAssetId": null, "timestamp": 1693920578018, "version": 2, "chainId": 84, "sender": "3N2PjXqef29HexCE7PeGZa9eRjS2jVeaFe4", "senderPublicKey": "DU1U4j8FqHUMRr9WgfF3yo67ULEFkjp7dtMWMpjBK1ar", "proofs": [ "2GD8BTwXx4mFZiybjxH4WxKKfdZ8778bh7hxiA3ndqVHpvHkzSTszr6x7qEDY3tZi6Z5wCVwrEgXH4VmW5RzA1h7", "4xskaqrytp1mrgtYc84bdN4SbvP3wPtM84fd1bAZT8Tbrwg3cLwJXEphyoTEzK6XEAXA6X9m7dW8ZZBennHzU9kc" ], "script": "base64:BgIvCAISAwoBCBIHCgUICAgIARIAEgMKAQESABIAEgMKAQgSABIFCgMICAgSABIAEgAhAAZTQ0FMRTgAgMLXLwANUEVSQ0VOVF9TQ0FMRQCQTgAJU0VQQVJBVE9SAgJfXwAJa0ludGVyZXN0AghpbnRlcmVzdAANa1VzZXJJbnRlcmVzdAINX3VzZXJJbnRlcmVzdAAOa1VzZXJBdmFpbGFibGUCE191c2VyQXZhaWxhYmxlQ2xhaW0AEGtVc2VyVG9rZW5TdGFrZWQCEF91c2VyVG9rZW5TdGFrZWQAEWtUb3RhbFRva2VuU3Rha2VkAhB0b3RhbFRva2VuU3Rha2VkAAxrTkZUSW50ZXJlc3QCC05GVEludGVyZXN0ABBrTkZUVXNlckludGVyZXN0AhBfTkZUVXNlckludGVyZXN0ABZrTkZUVXNlckF2YWlsYWJsZUNsYWltAhZfTkZUVXNlckF2YWlsYWJsZUNsYWltAA9rTkZUVG90YWxTdGFrZWQCDk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RzBwYFE211bHRpU2lnbmVkQnlBZG1pbnMFE211bHRpU2lnbmVkQnlBZG1pbnOhtlfi", "height": 2742138, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: BFikV3gGw5x6eVhrTx6y2Fm26S7mSk4gwT8qAGsE5jVM Next: XPeLieLgFx5Htg62rhiuVn2b6WPxHBUJ2Qa2Gf8uZEc Diff:
OldNewDifferences
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let SCALE8 = 100000000
5+
6+let PERCENT_SCALE = 10000
7+
8+let SEPARATOR = "__"
59
610 let kInterest = "interest"
711
2731
2832 let kNFTCreated = "_NFTCreated"
2933
34+let kLastAirdrop = "_lastAirdrop"
35+
3036 let kTokenid = "tokenId"
3137
3238 let kPersentForNFT = "percentForNFT"
39+
40+let kActive = "active"
3341
3442 let kAdmin1PK = "admin_pub_1"
3543
5361 func isSelfCall (i) = if ((i.caller == this))
5462 then unit
5563 else throw("Only contract itself can call this function")
64+
65+
66+func isActive () = if (valueOrElse(getBoolean(this, kActive), true))
67+ then unit
68+ else throw("DApp is inactive at this moment")
5669
5770
5871 func assetIdToStr (assetId) = match assetId {
87100 }
88101
89102
103+func calcTokenApr () = {
104+ let lastAirdrop = valueOrElse(getInteger(this, kLastAirdrop), 0)
105+ let totalTokenStaked = valueOrElse(getInteger(this, kTotalTokenStaked), 0)
106+ let totalNFTStaked = valueOrElse(getInteger(this, kNFTTotalStaked), 0)
107+ let percentForNFT = getIntegerValue(this, kPersentForNFT)
108+ let tokenAirdrop = if ((totalNFTStaked == 0))
109+ then lastAirdrop
110+ else fraction(lastAirdrop, percentForNFT, 100)
111+ (fraction(tokenAirdrop, PERCENT_SCALE, totalTokenStaked) * 52)
112+ }
113+
114+
115+@Callable(i)
116+func getUserStatsREADONLY (user) = {
117+ let apr = calcTokenApr()
118+ let $t035603998 = if ((user == ""))
119+ then $Tuple3(0, 0, 0)
120+ else {
121+ let userAddr = valueOrErrorMessage(addressFromString(user), "Wrong user address")
122+ let $t037693865 = claimCalc(user)
123+ let userNewInterest = $t037693865._1
124+ let claimAmountAvailable = $t037693865._2
125+ let userTokenStaked = $t037693865._3
126+ let totalTokenStaked = $t037693865._4
127+ let userBalance = assetBalance(userAddr, fromBase58String(tokenId))
128+ $Tuple3(userBalance, userTokenStaked, claimAmountAvailable)
129+ }
130+ let userTokenBalance = $t035603998._1
131+ let userTokenStaked = $t035603998._2
132+ let claimAmountAvailable = $t035603998._3
133+ $Tuple2(nil, makeString(["%d%d%d%d", toString(apr), toString(userTokenBalance), toString(userTokenStaked), toString(claimAmountAvailable)], SEPARATOR))
134+ }
135+
136+
137+
90138 @Callable(i)
91139 func init (tokenId,adm1Pub,adm2Pub,adm3Pub,toNFTPercent) = valueOrElse(isSelfCall(i), if (isDefined(getString(this, kTokenid)))
92140 then throw("DApp already inited")
103151
104152
105153 @Callable(i)
106-func stake () = if ((size(i.payments) != 1))
154+func stake () = valueOrElse(isActive(), if ((size(i.payments) != 1))
107155 then throw("One payment expected")
108156 else {
109- let $t036803755 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
110- let pmtAmount = $t036803755._1
111- let pmtAssetId = $t036803755._2
157+ let $t051575232 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
158+ let pmtAmount = $t051575232._1
159+ let pmtAssetId = $t051575232._2
112160 if ((pmtAssetId != fromBase58String(tokenId)))
113161 then throw("Wrong payment asset")
114162 else {
115163 let user = toString(i.caller)
116- let $t038763972 = claimCalc(user)
117- let userNewInterest = $t038763972._1
118- let claimAmountAvailable = $t038763972._2
119- let userTokenStaked = $t038763972._3
120- let totalTokenStaked = $t038763972._4
164+ let $t053535449 = claimCalc(user)
165+ let userNewInterest = $t053535449._1
166+ let claimAmountAvailable = $t053535449._2
167+ let userTokenStaked = $t053535449._3
168+ let totalTokenStaked = $t053535449._4
121169 [IntegerEntry((user + kUserInterest), userNewInterest), IntegerEntry((user + kUserAvailable), claimAmountAvailable), IntegerEntry((user + kUserTokenStaked), (userTokenStaked + pmtAmount)), IntegerEntry(kTotalTokenStaked, (totalTokenStaked + pmtAmount))]
122170 }
123- }
171+ })
124172
125173
126174
127175 @Callable(i)
128-func unstake (amount) = {
176+func unstake (amount) = valueOrElse(isActive(), {
129177 let user = toString(i.caller)
130178 if ((0 >= amount))
131179 then throw("Amount must be greater than 0")
132180 else {
133- let $t043864482 = claimCalc(user)
134- let userNewInterest = $t043864482._1
135- let claimAmountAvailable = $t043864482._2
136- let userTokenStaked = $t043864482._3
137- let totalTokenStaked = $t043864482._4
181+ let $t058875983 = claimCalc(user)
182+ let userNewInterest = $t058875983._1
183+ let claimAmountAvailable = $t058875983._2
184+ let userTokenStaked = $t058875983._3
185+ let totalTokenStaked = $t058875983._4
138186 if ((amount > userTokenStaked))
139187 then throw("You can't unstake more than staked")
140- else [IntegerEntry((user + kUserInterest), userNewInterest), IntegerEntry((user + kUserAvailable), claimAmountAvailable), IntegerEntry((user + kUserTokenStaked), (userTokenStaked - amount)), IntegerEntry(kTotalTokenStaked, (totalTokenStaked - amount))]
188+ else [IntegerEntry((user + kUserInterest), userNewInterest), IntegerEntry((user + kUserAvailable), claimAmountAvailable), IntegerEntry((user + kUserTokenStaked), (userTokenStaked - amount)), IntegerEntry(kTotalTokenStaked, (totalTokenStaked - amount)), ScriptTransfer(i.caller, amount, fromBase58String(tokenId))]
141189 }
142- }
190+ })
143191
144192
145193
146194 @Callable(i)
147-func claim () = {
195+func claim () = valueOrElse(isActive(), {
148196 let user = toString(i.caller)
149- let $t048984994 = claimCalc(user)
150- let userNewInterest = $t048984994._1
151- let claimAmountAvailable = $t048984994._2
152- let userTokenStaked = $t048984994._3
153- let totalTokenStaked = $t048984994._4
197+ let $t064896585 = claimCalc(user)
198+ let userNewInterest = $t064896585._1
199+ let claimAmountAvailable = $t064896585._2
200+ let userTokenStaked = $t064896585._3
201+ let totalTokenStaked = $t064896585._4
154202 if ((claimAmountAvailable == 0))
155203 then throw("Nothing to claim")
156204 else [IntegerEntry((user + kUserInterest), userNewInterest), IntegerEntry((user + kUserAvailable), 0), ScriptTransfer(i.caller, claimAmountAvailable, fromBase58String(tokenId))]
157- }
205+ })
158206
159207
160208
161209 @Callable(i)
162-func stakeNFT () = if ((size(i.payments) != 1))
210+func stakeNFT () = valueOrElse(isActive(), if ((size(i.payments) != 1))
163211 then throw("One payment expected")
164212 else {
165- let $t053595434 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
166- let pmtAmount = $t053595434._1
167- let pmtAssetId = $t053595434._2
213+ let $t069747049 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
214+ let pmtAmount = $t069747049._1
215+ let pmtAssetId = $t069747049._2
168216 let pmtAssetIdStr = assetIdToStr(pmtAssetId)
169217 if (!(isDefined(getString(this, (pmtAssetIdStr + kNFTCreated)))))
170218 then throw("Wrong nft asset")
171219 else {
172220 let user = toString(i.caller)
173- let $t056155710 = claimCalcNft(user)
174- let userNewInterest = $t056155710._1
175- let claimAmountAvailable = $t056155710._2
176- let userNFTStaked = $t056155710._3
177- let totalNFTStaked = $t056155710._4
221+ let $t072307325 = claimCalcNft(user)
222+ let userNewInterest = $t072307325._1
223+ let claimAmountAvailable = $t072307325._2
224+ let userNFTStaked = $t072307325._3
225+ let totalNFTStaked = $t072307325._4
178226 [IntegerEntry((user + kNFTUserInterest), userNewInterest), IntegerEntry((user + kNFTUserAvailableClaim), claimAmountAvailable), IntegerEntry((user + kuserNFTStaked), (userNFTStaked + pmtAmount)), IntegerEntry(kNFTTotalStaked, (totalNFTStaked + pmtAmount)), IntegerEntry((((user + "_") + pmtAssetIdStr) + kuserNFTStakedId), 1)]
179227 }
180- }
228+ })
181229
182230
183231
184232 @Callable(i)
185-func unstakeNFT (id) = {
233+func unstakeNFT (id) = valueOrElse(isActive(), {
186234 let user = toString(i.caller)
187235 if (isDefined(getString(this, (((user + id) + "_") + kuserNFTStakedId))))
188236 then throw("You didn't staked")
189237 else {
190- let $t062356330 = claimCalcNft(user)
191- let userNewInterest = $t062356330._1
192- let claimAmountAvailable = $t062356330._2
193- let userNFTStaked = $t062356330._3
194- let totalNFTStaked = $t062356330._4
238+ let $t078747969 = claimCalcNft(user)
239+ let userNewInterest = $t078747969._1
240+ let claimAmountAvailable = $t078747969._2
241+ let userNFTStaked = $t078747969._3
242+ let totalNFTStaked = $t078747969._4
195243 [IntegerEntry((user + kNFTUserInterest), userNewInterest), IntegerEntry((user + kNFTUserAvailableClaim), claimAmountAvailable), IntegerEntry((user + kuserNFTStaked), (userNFTStaked - 1)), IntegerEntry(kNFTTotalStaked, (totalNFTStaked - 1)), DeleteEntry((((user + "_") + id) + kuserNFTStakedId)), ScriptTransfer(i.caller, 1, fromBase58String(id))]
196244 }
197- }
198-
199-
200-
201-@Callable(i)
202-func claimNFT () = {
203- let user = toString(i.caller)
204- let $t067646859 = claimCalcNft(user)
205- let userNewInterest = $t067646859._1
206- let claimAmountAvailable = $t067646859._2
207- let userNFTStaked = $t067646859._3
208- let totalNFTStaked = $t067646859._4
209- if ((claimAmountAvailable == 0))
210- then throw("Nothing to claim")
211- else [IntegerEntry((user + kNFTUserInterest), userNewInterest), IntegerEntry((user + kNFTUserAvailableClaim), 0), ScriptTransfer(i.caller, claimAmountAvailable, fromBase58String(tokenId))]
212- }
213-
214-
215-
216-@Callable(i)
217-func issueNFT (userAddr,name,descr) = valueOrElse(isAdminCall(i), {
218- let uAddr = valueOrErrorMessage(addressFromString(userAddr), "Wrong user address")
219- let issue = Issue(name, descr, 1, 0, false)
220- let nftId = calculateAssetId(issue)
221-[issue, StringEntry((toBase58String(nftId) + kNFTCreated), userAddr), ScriptTransfer(uAddr, 1, nftId)]
222245 })
223246
224247
225248
226249 @Callable(i)
227-func airdrop () = valueOrElse(isAdminCall(i), if ((size(i.payments) != 1))
250+func claimNFT () = valueOrElse(isActive(), {
251+ let user = toString(i.caller)
252+ let $t084278522 = claimCalcNft(user)
253+ let userNewInterest = $t084278522._1
254+ let claimAmountAvailable = $t084278522._2
255+ let userNFTStaked = $t084278522._3
256+ let totalNFTStaked = $t084278522._4
257+ if ((claimAmountAvailable == 0))
258+ then throw("Nothing to claim")
259+ else [IntegerEntry((user + kNFTUserInterest), userNewInterest), IntegerEntry((user + kNFTUserAvailableClaim), 0), ScriptTransfer(i.caller, claimAmountAvailable, fromBase58String(tokenId))]
260+ })
261+
262+
263+
264+@Callable(i)
265+func issueNFT (userAddr,name,descr) = valueOrElse(isActive(), valueOrElse(isAdminCall(i), {
266+ let uAddr = valueOrErrorMessage(addressFromString(userAddr), "Wrong user address")
267+ let issue = Issue(name, descr, 1, 0, false)
268+ let nftId = calculateAssetId(issue)
269+[issue, StringEntry((toBase58String(nftId) + kNFTCreated), userAddr), ScriptTransfer(uAddr, 1, nftId)]
270+ }))
271+
272+
273+
274+@Callable(i)
275+func airdrop () = valueOrElse(isActive(), valueOrElse(isAdminCall(i), if ((size(i.payments) != 1))
228276 then throw("One payment expected")
229277 else {
230- let $t076597734 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
231- let pmtAmount = $t076597734._1
232- let pmtAssetId = $t076597734._2
278+ let $t093709445 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
279+ let pmtAmount = $t093709445._1
280+ let pmtAssetId = $t093709445._2
233281 if ((pmtAssetId != fromBase58String(tokenId)))
234282 then throw("Wrong payment asset")
235283 else {
238286 let totalNFTStaked = valueOrElse(getInteger(this, kNFTTotalStaked), 0)
239287 let curInterest = valueOrElse(getInteger(this, kInterest), 0)
240288 let curNFTInterest = valueOrElse(getInteger(this, kNFTInterest), 0)
241- let $t081578332 = if ((totalNFTStaked == 0))
289+ let $t0986810043 = if ((totalNFTStaked == 0))
242290 then $Tuple2(0, pmtAmount)
243291 else {
244292 let nftP = fraction(pmtAmount, percentForNFT, 100)
245293 $Tuple2(nftP, (pmtAmount - nftP))
246294 }
247- let pmtNFT = $t081578332._1
248- let pmtToken = $t081578332._2
295+ let pmtNFT = $t0986810043._1
296+ let pmtToken = $t0986810043._2
249297 let interestNew = if ((totalTokenStaked > 0))
250298 then (curInterest + fraction(pmtToken, SCALE8, totalTokenStaked))
251299 else curInterest
252300 let interestNFTNew = if ((totalNFTStaked > 0))
253301 then (curNFTInterest + (pmtNFT / totalNFTStaked))
254302 else curNFTInterest
255-[IntegerEntry(kInterest, interestNew), IntegerEntry(kNFTInterest, interestNFTNew)]
303+[IntegerEntry(kInterest, interestNew), IntegerEntry(kNFTInterest, interestNFTNew), IntegerEntry(kLastAirdrop, pmtAmount)]
256304 }
257- })
305+ }))
306+
307+
308+
309+@Callable(i)
310+func activate () = valueOrElse(isAdminCall(i), if (valueOrElse(getBoolean(this, kActive), true))
311+ then throw("dApp already active")
312+ else [BooleanEntry(kActive, true)])
313+
314+
315+
316+@Callable(i)
317+func shutdown () = valueOrElse(isAdminCall(i), if (!(valueOrElse(getBoolean(this, kActive), true)))
318+ then throw("dApp already shutdown")
319+ else [BooleanEntry(kActive, false)])
258320
259321
260322 @Verifier(tx)
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let SCALE8 = 100000000
5+
6+let PERCENT_SCALE = 10000
7+
8+let SEPARATOR = "__"
59
610 let kInterest = "interest"
711
812 let kUserInterest = "_userInterest"
913
1014 let kUserAvailable = "_userAvailableClaim"
1115
1216 let kUserTokenStaked = "_userTokenStaked"
1317
1418 let kTotalTokenStaked = "totalTokenStaked"
1519
1620 let kNFTInterest = "NFTInterest"
1721
1822 let kNFTUserInterest = "_NFTUserInterest"
1923
2024 let kNFTUserAvailableClaim = "_NFTUserAvailableClaim"
2125
2226 let kNFTTotalStaked = "NFTTotalStaked"
2327
2428 let kuserNFTStaked = "_userNFTStaked"
2529
2630 let kuserNFTStakedId = "_userNFTStakedId"
2731
2832 let kNFTCreated = "_NFTCreated"
2933
34+let kLastAirdrop = "_lastAirdrop"
35+
3036 let kTokenid = "tokenId"
3137
3238 let kPersentForNFT = "percentForNFT"
39+
40+let kActive = "active"
3341
3442 let kAdmin1PK = "admin_pub_1"
3543
3644 let kAdmin2PK = "admin_pub_2"
3745
3846 let kAdmin3PK = "admin_pub_3"
3947
4048 let admin1PK = fromBase58String(valueOrErrorMessage(getString(this, kAdmin1PK), "Can't get admin1PK"))
4149
4250 let admin2PK = fromBase58String(valueOrErrorMessage(getString(this, kAdmin2PK), "Can't get admin2PK"))
4351
4452 let admin3PK = fromBase58String(valueOrErrorMessage(getString(this, kAdmin3PK), "Can't get operatorPK"))
4553
4654 let tokenId = valueOrErrorMessage(getString(this, kTokenid), "Can't get staking token")
4755
4856 func isAdminCall (i) = if (containsElement([admin1PK, admin2PK, admin3PK], i.callerPublicKey))
4957 then unit
5058 else throw("Only admin can call this function")
5159
5260
5361 func isSelfCall (i) = if ((i.caller == this))
5462 then unit
5563 else throw("Only contract itself can call this function")
64+
65+
66+func isActive () = if (valueOrElse(getBoolean(this, kActive), true))
67+ then unit
68+ else throw("DApp is inactive at this moment")
5669
5770
5871 func assetIdToStr (assetId) = match assetId {
5972 case id: ByteVector =>
6073 toBase58String(id)
6174 case waves: Unit =>
6275 "WAVES"
6376 case _ =>
6477 throw("Not Asset id")
6578 }
6679
6780
6881 func claimCalc (user) = {
6982 let totalTokenStaked = valueOrElse(getInteger(this, kTotalTokenStaked), 0)
7083 let curInterest = valueOrElse(getInteger(this, kInterest), 0)
7184 let availableForClaim = valueOrElse(getInteger(this, (user + kUserAvailable)), 0)
7285 let userInterest = valueOrElse(getInteger(this, (user + kUserInterest)), curInterest)
7386 let userTokenStaked = valueOrElse(getInteger(this, (user + kUserTokenStaked)), 0)
7487 let claimAmount = fraction(userTokenStaked, (curInterest - userInterest), SCALE8)
7588 $Tuple4(curInterest, (claimAmount + availableForClaim), userTokenStaked, totalTokenStaked)
7689 }
7790
7891
7992 func claimCalcNft (user) = {
8093 let totalNftStaked = valueOrElse(getInteger(this, kNFTTotalStaked), 0)
8194 let curInterest = valueOrElse(getInteger(this, kNFTInterest), 0)
8295 let availableForClaim = valueOrElse(getInteger(this, (user + kNFTUserAvailableClaim)), 0)
8396 let userInterest = valueOrElse(getInteger(this, (user + kNFTUserInterest)), curInterest)
8497 let userNftStaked = valueOrElse(getInteger(this, (user + kuserNFTStaked)), 0)
8598 let claimAmount = (userNftStaked * (curInterest - userInterest))
8699 $Tuple4(curInterest, (claimAmount + availableForClaim), userNftStaked, totalNftStaked)
87100 }
88101
89102
103+func calcTokenApr () = {
104+ let lastAirdrop = valueOrElse(getInteger(this, kLastAirdrop), 0)
105+ let totalTokenStaked = valueOrElse(getInteger(this, kTotalTokenStaked), 0)
106+ let totalNFTStaked = valueOrElse(getInteger(this, kNFTTotalStaked), 0)
107+ let percentForNFT = getIntegerValue(this, kPersentForNFT)
108+ let tokenAirdrop = if ((totalNFTStaked == 0))
109+ then lastAirdrop
110+ else fraction(lastAirdrop, percentForNFT, 100)
111+ (fraction(tokenAirdrop, PERCENT_SCALE, totalTokenStaked) * 52)
112+ }
113+
114+
115+@Callable(i)
116+func getUserStatsREADONLY (user) = {
117+ let apr = calcTokenApr()
118+ let $t035603998 = if ((user == ""))
119+ then $Tuple3(0, 0, 0)
120+ else {
121+ let userAddr = valueOrErrorMessage(addressFromString(user), "Wrong user address")
122+ let $t037693865 = claimCalc(user)
123+ let userNewInterest = $t037693865._1
124+ let claimAmountAvailable = $t037693865._2
125+ let userTokenStaked = $t037693865._3
126+ let totalTokenStaked = $t037693865._4
127+ let userBalance = assetBalance(userAddr, fromBase58String(tokenId))
128+ $Tuple3(userBalance, userTokenStaked, claimAmountAvailable)
129+ }
130+ let userTokenBalance = $t035603998._1
131+ let userTokenStaked = $t035603998._2
132+ let claimAmountAvailable = $t035603998._3
133+ $Tuple2(nil, makeString(["%d%d%d%d", toString(apr), toString(userTokenBalance), toString(userTokenStaked), toString(claimAmountAvailable)], SEPARATOR))
134+ }
135+
136+
137+
90138 @Callable(i)
91139 func init (tokenId,adm1Pub,adm2Pub,adm3Pub,toNFTPercent) = valueOrElse(isSelfCall(i), if (isDefined(getString(this, kTokenid)))
92140 then throw("DApp already inited")
93141 else if (!(isDefined(assetInfo(fromBase58String(tokenId)))))
94142 then throw("asset id is not correct asset id")
95143 else if ((size(fromBase58String(adm1Pub)) != 32))
96144 then throw("group1Admin1PubKey is not correct")
97145 else if ((size(fromBase58String(adm2Pub)) != 32))
98146 then throw("group1Admin1PubKey is not correct")
99147 else if ((size(fromBase58String(adm3Pub)) != 32))
100148 then throw("group1Admin1PubKey is not correct")
101149 else [StringEntry(kTokenid, tokenId), StringEntry(kAdmin1PK, adm1Pub), StringEntry(kAdmin2PK, adm2Pub), StringEntry(kAdmin3PK, adm3Pub), IntegerEntry(kPersentForNFT, toNFTPercent)])
102150
103151
104152
105153 @Callable(i)
106-func stake () = if ((size(i.payments) != 1))
154+func stake () = valueOrElse(isActive(), if ((size(i.payments) != 1))
107155 then throw("One payment expected")
108156 else {
109- let $t036803755 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
110- let pmtAmount = $t036803755._1
111- let pmtAssetId = $t036803755._2
157+ let $t051575232 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
158+ let pmtAmount = $t051575232._1
159+ let pmtAssetId = $t051575232._2
112160 if ((pmtAssetId != fromBase58String(tokenId)))
113161 then throw("Wrong payment asset")
114162 else {
115163 let user = toString(i.caller)
116- let $t038763972 = claimCalc(user)
117- let userNewInterest = $t038763972._1
118- let claimAmountAvailable = $t038763972._2
119- let userTokenStaked = $t038763972._3
120- let totalTokenStaked = $t038763972._4
164+ let $t053535449 = claimCalc(user)
165+ let userNewInterest = $t053535449._1
166+ let claimAmountAvailable = $t053535449._2
167+ let userTokenStaked = $t053535449._3
168+ let totalTokenStaked = $t053535449._4
121169 [IntegerEntry((user + kUserInterest), userNewInterest), IntegerEntry((user + kUserAvailable), claimAmountAvailable), IntegerEntry((user + kUserTokenStaked), (userTokenStaked + pmtAmount)), IntegerEntry(kTotalTokenStaked, (totalTokenStaked + pmtAmount))]
122170 }
123- }
171+ })
124172
125173
126174
127175 @Callable(i)
128-func unstake (amount) = {
176+func unstake (amount) = valueOrElse(isActive(), {
129177 let user = toString(i.caller)
130178 if ((0 >= amount))
131179 then throw("Amount must be greater than 0")
132180 else {
133- let $t043864482 = claimCalc(user)
134- let userNewInterest = $t043864482._1
135- let claimAmountAvailable = $t043864482._2
136- let userTokenStaked = $t043864482._3
137- let totalTokenStaked = $t043864482._4
181+ let $t058875983 = claimCalc(user)
182+ let userNewInterest = $t058875983._1
183+ let claimAmountAvailable = $t058875983._2
184+ let userTokenStaked = $t058875983._3
185+ let totalTokenStaked = $t058875983._4
138186 if ((amount > userTokenStaked))
139187 then throw("You can't unstake more than staked")
140- else [IntegerEntry((user + kUserInterest), userNewInterest), IntegerEntry((user + kUserAvailable), claimAmountAvailable), IntegerEntry((user + kUserTokenStaked), (userTokenStaked - amount)), IntegerEntry(kTotalTokenStaked, (totalTokenStaked - amount))]
188+ else [IntegerEntry((user + kUserInterest), userNewInterest), IntegerEntry((user + kUserAvailable), claimAmountAvailable), IntegerEntry((user + kUserTokenStaked), (userTokenStaked - amount)), IntegerEntry(kTotalTokenStaked, (totalTokenStaked - amount)), ScriptTransfer(i.caller, amount, fromBase58String(tokenId))]
141189 }
142- }
190+ })
143191
144192
145193
146194 @Callable(i)
147-func claim () = {
195+func claim () = valueOrElse(isActive(), {
148196 let user = toString(i.caller)
149- let $t048984994 = claimCalc(user)
150- let userNewInterest = $t048984994._1
151- let claimAmountAvailable = $t048984994._2
152- let userTokenStaked = $t048984994._3
153- let totalTokenStaked = $t048984994._4
197+ let $t064896585 = claimCalc(user)
198+ let userNewInterest = $t064896585._1
199+ let claimAmountAvailable = $t064896585._2
200+ let userTokenStaked = $t064896585._3
201+ let totalTokenStaked = $t064896585._4
154202 if ((claimAmountAvailable == 0))
155203 then throw("Nothing to claim")
156204 else [IntegerEntry((user + kUserInterest), userNewInterest), IntegerEntry((user + kUserAvailable), 0), ScriptTransfer(i.caller, claimAmountAvailable, fromBase58String(tokenId))]
157- }
205+ })
158206
159207
160208
161209 @Callable(i)
162-func stakeNFT () = if ((size(i.payments) != 1))
210+func stakeNFT () = valueOrElse(isActive(), if ((size(i.payments) != 1))
163211 then throw("One payment expected")
164212 else {
165- let $t053595434 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
166- let pmtAmount = $t053595434._1
167- let pmtAssetId = $t053595434._2
213+ let $t069747049 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
214+ let pmtAmount = $t069747049._1
215+ let pmtAssetId = $t069747049._2
168216 let pmtAssetIdStr = assetIdToStr(pmtAssetId)
169217 if (!(isDefined(getString(this, (pmtAssetIdStr + kNFTCreated)))))
170218 then throw("Wrong nft asset")
171219 else {
172220 let user = toString(i.caller)
173- let $t056155710 = claimCalcNft(user)
174- let userNewInterest = $t056155710._1
175- let claimAmountAvailable = $t056155710._2
176- let userNFTStaked = $t056155710._3
177- let totalNFTStaked = $t056155710._4
221+ let $t072307325 = claimCalcNft(user)
222+ let userNewInterest = $t072307325._1
223+ let claimAmountAvailable = $t072307325._2
224+ let userNFTStaked = $t072307325._3
225+ let totalNFTStaked = $t072307325._4
178226 [IntegerEntry((user + kNFTUserInterest), userNewInterest), IntegerEntry((user + kNFTUserAvailableClaim), claimAmountAvailable), IntegerEntry((user + kuserNFTStaked), (userNFTStaked + pmtAmount)), IntegerEntry(kNFTTotalStaked, (totalNFTStaked + pmtAmount)), IntegerEntry((((user + "_") + pmtAssetIdStr) + kuserNFTStakedId), 1)]
179227 }
180- }
228+ })
181229
182230
183231
184232 @Callable(i)
185-func unstakeNFT (id) = {
233+func unstakeNFT (id) = valueOrElse(isActive(), {
186234 let user = toString(i.caller)
187235 if (isDefined(getString(this, (((user + id) + "_") + kuserNFTStakedId))))
188236 then throw("You didn't staked")
189237 else {
190- let $t062356330 = claimCalcNft(user)
191- let userNewInterest = $t062356330._1
192- let claimAmountAvailable = $t062356330._2
193- let userNFTStaked = $t062356330._3
194- let totalNFTStaked = $t062356330._4
238+ let $t078747969 = claimCalcNft(user)
239+ let userNewInterest = $t078747969._1
240+ let claimAmountAvailable = $t078747969._2
241+ let userNFTStaked = $t078747969._3
242+ let totalNFTStaked = $t078747969._4
195243 [IntegerEntry((user + kNFTUserInterest), userNewInterest), IntegerEntry((user + kNFTUserAvailableClaim), claimAmountAvailable), IntegerEntry((user + kuserNFTStaked), (userNFTStaked - 1)), IntegerEntry(kNFTTotalStaked, (totalNFTStaked - 1)), DeleteEntry((((user + "_") + id) + kuserNFTStakedId)), ScriptTransfer(i.caller, 1, fromBase58String(id))]
196244 }
197- }
198-
199-
200-
201-@Callable(i)
202-func claimNFT () = {
203- let user = toString(i.caller)
204- let $t067646859 = claimCalcNft(user)
205- let userNewInterest = $t067646859._1
206- let claimAmountAvailable = $t067646859._2
207- let userNFTStaked = $t067646859._3
208- let totalNFTStaked = $t067646859._4
209- if ((claimAmountAvailable == 0))
210- then throw("Nothing to claim")
211- else [IntegerEntry((user + kNFTUserInterest), userNewInterest), IntegerEntry((user + kNFTUserAvailableClaim), 0), ScriptTransfer(i.caller, claimAmountAvailable, fromBase58String(tokenId))]
212- }
213-
214-
215-
216-@Callable(i)
217-func issueNFT (userAddr,name,descr) = valueOrElse(isAdminCall(i), {
218- let uAddr = valueOrErrorMessage(addressFromString(userAddr), "Wrong user address")
219- let issue = Issue(name, descr, 1, 0, false)
220- let nftId = calculateAssetId(issue)
221-[issue, StringEntry((toBase58String(nftId) + kNFTCreated), userAddr), ScriptTransfer(uAddr, 1, nftId)]
222245 })
223246
224247
225248
226249 @Callable(i)
227-func airdrop () = valueOrElse(isAdminCall(i), if ((size(i.payments) != 1))
250+func claimNFT () = valueOrElse(isActive(), {
251+ let user = toString(i.caller)
252+ let $t084278522 = claimCalcNft(user)
253+ let userNewInterest = $t084278522._1
254+ let claimAmountAvailable = $t084278522._2
255+ let userNFTStaked = $t084278522._3
256+ let totalNFTStaked = $t084278522._4
257+ if ((claimAmountAvailable == 0))
258+ then throw("Nothing to claim")
259+ else [IntegerEntry((user + kNFTUserInterest), userNewInterest), IntegerEntry((user + kNFTUserAvailableClaim), 0), ScriptTransfer(i.caller, claimAmountAvailable, fromBase58String(tokenId))]
260+ })
261+
262+
263+
264+@Callable(i)
265+func issueNFT (userAddr,name,descr) = valueOrElse(isActive(), valueOrElse(isAdminCall(i), {
266+ let uAddr = valueOrErrorMessage(addressFromString(userAddr), "Wrong user address")
267+ let issue = Issue(name, descr, 1, 0, false)
268+ let nftId = calculateAssetId(issue)
269+[issue, StringEntry((toBase58String(nftId) + kNFTCreated), userAddr), ScriptTransfer(uAddr, 1, nftId)]
270+ }))
271+
272+
273+
274+@Callable(i)
275+func airdrop () = valueOrElse(isActive(), valueOrElse(isAdminCall(i), if ((size(i.payments) != 1))
228276 then throw("One payment expected")
229277 else {
230- let $t076597734 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
231- let pmtAmount = $t076597734._1
232- let pmtAssetId = $t076597734._2
278+ let $t093709445 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
279+ let pmtAmount = $t093709445._1
280+ let pmtAssetId = $t093709445._2
233281 if ((pmtAssetId != fromBase58String(tokenId)))
234282 then throw("Wrong payment asset")
235283 else {
236284 let percentForNFT = getIntegerValue(this, kPersentForNFT)
237285 let totalTokenStaked = valueOrElse(getInteger(this, kTotalTokenStaked), 0)
238286 let totalNFTStaked = valueOrElse(getInteger(this, kNFTTotalStaked), 0)
239287 let curInterest = valueOrElse(getInteger(this, kInterest), 0)
240288 let curNFTInterest = valueOrElse(getInteger(this, kNFTInterest), 0)
241- let $t081578332 = if ((totalNFTStaked == 0))
289+ let $t0986810043 = if ((totalNFTStaked == 0))
242290 then $Tuple2(0, pmtAmount)
243291 else {
244292 let nftP = fraction(pmtAmount, percentForNFT, 100)
245293 $Tuple2(nftP, (pmtAmount - nftP))
246294 }
247- let pmtNFT = $t081578332._1
248- let pmtToken = $t081578332._2
295+ let pmtNFT = $t0986810043._1
296+ let pmtToken = $t0986810043._2
249297 let interestNew = if ((totalTokenStaked > 0))
250298 then (curInterest + fraction(pmtToken, SCALE8, totalTokenStaked))
251299 else curInterest
252300 let interestNFTNew = if ((totalNFTStaked > 0))
253301 then (curNFTInterest + (pmtNFT / totalNFTStaked))
254302 else curNFTInterest
255-[IntegerEntry(kInterest, interestNew), IntegerEntry(kNFTInterest, interestNFTNew)]
303+[IntegerEntry(kInterest, interestNew), IntegerEntry(kNFTInterest, interestNFTNew), IntegerEntry(kLastAirdrop, pmtAmount)]
256304 }
257- })
305+ }))
306+
307+
308+
309+@Callable(i)
310+func activate () = valueOrElse(isAdminCall(i), if (valueOrElse(getBoolean(this, kActive), true))
311+ then throw("dApp already active")
312+ else [BooleanEntry(kActive, true)])
313+
314+
315+
316+@Callable(i)
317+func shutdown () = valueOrElse(isAdminCall(i), if (!(valueOrElse(getBoolean(this, kActive), true)))
318+ then throw("dApp already shutdown")
319+ else [BooleanEntry(kActive, false)])
258320
259321
260322 @Verifier(tx)
261323 func verify () = {
262324 let multiSignedByAdmins = {
263325 let adminPubKey1Signed = if (sigVerify(tx.bodyBytes, tx.proofs[0], admin1PK))
264326 then 1
265327 else 0
266328 let adminPubKey2Signed = if (sigVerify(tx.bodyBytes, tx.proofs[1], admin2PK))
267329 then 1
268330 else 0
269331 let adminPubKey3Signed = if (sigVerify(tx.bodyBytes, tx.proofs[2], admin3PK))
270332 then 1
271333 else 0
272334 (((adminPubKey1Signed + adminPubKey2Signed) + adminPubKey3Signed) >= 2)
273335 }
274336 match tx {
275337 case inv: InvokeScriptTransaction =>
276338 let isSelf = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
277339 let isRightFee = if ((inv.fee == 900000))
278340 then (inv.feeAssetId == unit)
279341 else false
280342 let isInitCall = (inv.function == "init")
281343 let isnoPayments = (size(inv.payments) == 0)
282344 if (if (if (if (isRightFee)
283345 then isInitCall
284346 else false)
285347 then isSelf
286348 else false)
287349 then isnoPayments
288350 else false)
289351 then true
290352 else multiSignedByAdmins
291353 case _ =>
292354 multiSignedByAdmins
293355 }
294356 }
295357

github/deemru/w8io/fabc49c 
59.40 ms