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