tx · 92votuufkWPrPiLdRsmxfSoyeQ2pDX8GxRemzA5mM2sH

3MpQMfcqygL5TqY51peDk3tD4YC35ZtLHDR:  -0.00400000 Waves

2024.04.28 21:41 [3083081] smart account 3MpQMfcqygL5TqY51peDk3tD4YC35ZtLHDR > SELF 0.00000000 Waves

{ "type": 13, "id": "92votuufkWPrPiLdRsmxfSoyeQ2pDX8GxRemzA5mM2sH", "fee": 400000, "feeAssetId": null, "timestamp": 1714329732613, "version": 1, "sender": "3MpQMfcqygL5TqY51peDk3tD4YC35ZtLHDR", "senderPublicKey": "6gZhJH4ky42qJRCmfh8c56C2eeKTB5MRzEKsSZToBtYT", "proofs": [ "4TLETSoNZQww2hdNA42hQ8ftjYr6m8qJSUCj1Lnvh7bpVybHhs9zJdpkTJyRfjjvT6thqEdcQ2zoHFsb5sbhERkV" ], "script": "base64:BgINCAISABIDCgEIEgASAAkABnVzZG5JZAEgD/IcEqzkxDya7EYaqyWosOy6BytGzG2IcvC14pJJAbQACXVzZG5JZFN0cgIsMjVGRXFFalJrcUs2eUNraVQ3THo2U0FZejdnVUZDdHhmQ0NobnJWRkQ1QVQACHB1enpsZUlkASDxGv4l/vaZOPRpKsTf4RLWR7LGyg66Nwmvd20fjqLlYwAFU2NhbGUAgKCUpY0dAQ10cnlHZXRJbnRlZ2VyAQNrZXkEByRtYXRjaDAJAJoIAgUEdGhpcwUDa2V5AwkAAQIFByRtYXRjaDACA0ludAQBYgUHJG1hdGNoMAUBYgAAAQx0cnlHZXRTdHJpbmcBA2tleQQHJG1hdGNoMAkAnQgCBQR0aGlzBQNrZXkDCQABAgUHJG1hdGNoMAIGU3RyaW5nBAFhBQckbWF0Y2gwBQFhAgABEGNsYWltQWxpYXNSZXN1bHQCB2FkZHJlc3MKYXNzZXRJZFN0cgQKYWRkcmVzc1N0cgkApQgBBQdhZGRyZXNzBA9jdXJyZW50SW50ZXJlc3QJAQ10cnlHZXRJbnRlZ2VyAQkArAICCQCsAgICEWdsb2JhbF9sYXN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XRJZFN0cgIJX2Vhcm5pbmdzCQBkAgkBDXRyeUdldEludGVnZXIBCQCsAgIJAKwCAgIHZ2xvYmFsXwUKYXNzZXRJZFN0cgIJX2Vhcm5pbmdzBQZhbW91bnQJAMwIAgkBDEludGVnZXJFbnRyeQIJAKwCAgkArAICAhFnbG9iYWxfbGFzdENoZWNrXwUKYXNzZXRJZFN0cgIJX2ludGVyZXN0CQBkAgUPY3VycmVudEludGVyZXN0BQ1pbnRlcmVzdERlbHRhBQNuaWwBAnR4AQZ2ZXJpZnkACQD0AwMIBQJ0eAlib2R5Qnl0ZXMJAJEDAggFAnR4BnByb29mcwAACAUCdHgPc2VuZGVyUHVibGljS2V5z9r0yw==", "chainId": 84, "height": 3083081, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: HxiTscvZdKWKreKhF6oqun29jxg41dEuXaCdSWavho5o Full:
OldNewDifferences
1-# no script
1+{-# STDLIB_VERSION 6 #-}
2+{-# SCRIPT_TYPE ACCOUNT #-}
3+{-# CONTENT_TYPE DAPP #-}
4+let usdnId = base58'25FEqEjRkqK6yCkiT7Lz6SAYz7gUFCtxfCChnrVFD5AT'
5+
6+let usdnIdStr = "25FEqEjRkqK6yCkiT7Lz6SAYz7gUFCtxfCChnrVFD5AT"
7+
8+let puzzleId = base58'HEB8Qaw9xrWpWs8tHsiATYGBWDBtP2S7kcPALrMu43AS'
9+
10+let Scale = 1000000000000
11+
12+func tryGetInteger (key) = match getInteger(this, key) {
13+ case b: Int =>
14+ b
15+ case _ =>
16+ 0
17+}
18+
19+
20+func tryGetString (key) = match getString(this, key) {
21+ case a: String =>
22+ a
23+ case _ =>
24+ ""
25+}
26+
27+
28+func claimAliasResult (address,assetIdStr) = {
29+ let addressStr = toString(address)
30+ let currentInterest = tryGetInteger((("global_lastCheck_" + assetIdStr) + "_interest"))
31+ let lastCheckInterest = tryGetInteger((((addressStr + "_lastCheck_") + assetIdStr) + "_interest"))
32+ let stakedAmount = if ((assetIdStr == usdnIdStr))
33+ then tryGetInteger((addressStr + "_staked"))
34+ else tryGetInteger((((addressStr + "_") + assetIdStr) + "_staked"))
35+ let reward = if ((lastCheckInterest > 0))
36+ then fraction((currentInterest - lastCheckInterest), stakedAmount, Scale)
37+ else 0
38+[IntegerEntry((((addressStr + "_lastCheck_") + assetIdStr) + "_interest"), currentInterest), IntegerEntry((((addressStr + "_") + assetIdStr) + "_claimed"), (tryGetInteger((((addressStr + "_") + assetIdStr) + "_claimed")) + reward)), ScriptTransfer(address, reward, usdnId)]
39+ }
40+
41+
42+func claimResult (address) = claimAliasResult(address, usdnIdStr)
43+
44+
45+func checkNFTValidity (assetId) = match getString(Address(base58'3N9yxp4gyTCsEtPUzE7CFLnae4YwqRgwUkW'), (("art_" + toBase58String(assetId)) + "_type")) {
46+ case x: String =>
47+ 5
48+ case _ =>
49+ if ((getString(Address(base58'3N7CE8qNvnNNzk1pCxFJ4S8LA4sTyWakczC'), (("nft_" + toBase58String(assetId)) + "_issuer")) == "3N7G3XELPvHrkSrTLzbWQwAxPLcEUhNnsht"))
50+ then 1
51+ else 0
52+}
53+
54+
55+@Callable(i)
56+func stake () = {
57+ let addressStr = toString(i.caller)
58+ let nftId = if ((i.payments[0].amount == 1))
59+ then value(i.payments[0].assetId)
60+ else throw("please attach NFT")
61+ let assetIdStr = toBase58String(usdnId)
62+ let currentInterest = tryGetInteger((("global_lastCheck_" + assetIdStr) + "_interest"))
63+ let totalStakedAmount = tryGetInteger("global_staked")
64+ let assetPower = fraction(10000, checkNFTValidity(nftId), 5)
65+ let NFTName = if ((assetPower == 10000))
66+ then "Eagle NFT"
67+ else "Ania NFT"
68+ if ((assetPower == 0))
69+ then throw("not valid NFT attached")
70+ else (claimResult(i.caller) ++ [IntegerEntry("global_staked", (totalStakedAmount + assetPower)), IntegerEntry((addressStr + "_staked"), (tryGetInteger((addressStr + "_staked")) + assetPower)), StringEntry((toBase58String(nftId) + "_owner"), addressStr), IntegerEntry(((("address_" + toString(i.caller)) + "_nft_") + toBase58String(nftId)), lastBlock.timestamp), StringEntry((toBase58String(nftId) + "_name"), NFTName)])
71+ }
72+
73+
74+
75+@Callable(i)
76+func unStake (nftIdStr) = {
77+ let assetPower = fraction(10000, checkNFTValidity(fromBase58String(nftIdStr)), 5)
78+ let addressStr = toString(i.caller)
79+ let stakedAmount = tryGetInteger((addressStr + "_staked"))
80+ let nftOwner = tryGetString((nftIdStr + "_owner"))
81+ if ((addressStr != nftOwner))
82+ then throw("you don't have NFT available")
83+ else (claimResult(i.caller) ++ [IntegerEntry((addressStr + "_staked"), (stakedAmount - assetPower)), IntegerEntry("global_staked", (tryGetInteger("global_staked") - assetPower)), ScriptTransfer(i.caller, 1, fromBase58String(nftIdStr)), DeleteEntry((nftIdStr + "_owner")), DeleteEntry(((("address_" + toString(i.caller)) + "_nft_") + nftIdStr))])
84+ }
85+
86+
87+
88+@Callable(i)
89+func claimReward () = claimResult(i.caller)
90+
91+
92+
93+@Callable(i)
94+func topUpReward () = {
95+ let amount = i.payments[0].amount
96+ let assetIdStr = usdnIdStr
97+ let currentInterest = tryGetInteger((("global_lastCheck_" + assetIdStr) + "_interest"))
98+ let totalStakedAmount = tryGetInteger("global_staked")
99+ let interestDelta = if ((totalStakedAmount > 0))
100+ then fraction(amount, Scale, totalStakedAmount)
101+ else 0
102+ let currentUltraInterest = tryGetInteger("global_lastCheck_ultra_interest")
103+ let totalUltraStakedAmount = tryGetInteger("global_ultra_staked")
104+ let ultraInterestDelta = if ((totalStakedAmount > 0))
105+ then fraction(amount, Scale, totalStakedAmount)
106+ else 0
107+ if ((i.payments[0].assetId != usdnId))
108+ then throw("wrong asset attached")
109+ else [IntegerEntry((("global_" + assetIdStr) + "_earnings"), (tryGetInteger((("global_" + assetIdStr) + "_earnings")) + amount)), IntegerEntry((("global_lastCheck_" + assetIdStr) + "_interest"), (currentInterest + interestDelta))]
110+ }
111+
112+
113+@Verifier(tx)
114+func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
115+

github/deemru/w8io/026f985 
14.83 ms