tx · Ah854Rvi6f23qwmyUuJnuYWA9PmhVbrHZWS1z9KwkZ4b 3MweDUGicjorwUViyXBcfCM15fQXXEDU3gN: -0.01000000 Waves 2023.09.21 10:30 [2764846] smart account 3MweDUGicjorwUViyXBcfCM15fQXXEDU3gN > SELF 0.00000000 Waves
{ "type": 13, "id": "Ah854Rvi6f23qwmyUuJnuYWA9PmhVbrHZWS1z9KwkZ4b", "fee": 1000000, "feeAssetId": null, "timestamp": 1695281421621, "version": 2, "chainId": 84, "sender": "3MweDUGicjorwUViyXBcfCM15fQXXEDU3gN", "senderPublicKey": "DGFm8ntnNPVthPrdcaZNWKYZi1wYzD3vhJETwHnF2emk", "proofs": [ "3kqxRiTF85HHj6VZ7JmWZfP9HUFHhvqm6hdNUi6RH5KtoFL433b7QTutZe1uddGDmB7G5s8dHBaBjrdtwWt2G3FD" ], "script": "base64:BgIKCAISABIAEgASAA4ACXd4QXNzZXRJZAEgM1Kp0g5+advMxKQnvIKrDTRAE/WbFcGgKo+DMmTBTQkABk1VTFQxMACAyK+gJQADU0VQAgJfXwAGcG9vbElkAAEAEnBvb2xMUFRva2VuQWRkcmVzcwEgM1Kp0g5+advMxKQnvIKrDTRAE/WbFcGgKo+DMmTBTQkAF3N0YWtlYm9vc3RlclJvb3RBZGRyZXNzARoBVIjFcN5G9OJsOhwdJuqY/GjHC7IJwkxSPQAMYWRtaW5BZGRyZXNzARoBVIxhil+sdwu2jS1p0aM0qMpq9rr6QP5z7QAUdG90YWxQb29sTFBTdGFrZWRLZXkCFHRvdGFsX3Bvb2xfbHBfc3Rha2VkABJ0b3RhbFBvb2xFYXJuZWRLZXkCEXRvdGFsX3Bvb2xfZWFybmVkABVwb29sQ3VycmVudENsYWltSWRLZXkCFXBvb2xfY3VycmVudF9jbGFpbV9pZAEJYXNQYXltZW50AQF2BAckbWF0Y2gwBQF2AwkAAQIFByRtYXRjaDACD0F0dGFjaGVkUGF5bWVudAQBcAUHJG1hdGNoMAUBcAkAAgECIWZhaWwg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AZAIFEnBvb2xDdXJyZW50Q2xhaW1JZAABCQDMCAIJAQxJbnRlZ2VyRW50cnkCBRJ0b3RhbFBvb2xFYXJuZWRLZXkJAGQCBQ90b3RhbFBvb2xFYXJuZWQFFmN1cnJlbnRDbGFpbUlkRWFybmluZ3MFA25pbAkAAgECJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgkAAgECJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgECdHgBBnZlcmlmeQAJAPQDAwgFAnR4CWJvZHlCeXRlcwkAkQMCCAUCdHgGcHJvb2ZzAAAIBQJ0eA9zZW5kZXJQdWJsaWNLZXmEqqpm", "height": 2764846, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: DB4H8wS9QkVjdp7M4izFEubZko9m79FqHZ4uijV6SorH Next: ETRoECZU6TLbvmsqXvDkWqnodQdFVX5YLcCPQs5a9rd9 Diff:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let wxAssetId = base58' | |
4 | + | let wxAssetId = base58'4TLuEDo8QjPsxUGjfRPyqqvAk4JtnYMXK1ypGo8uKrb2' | |
5 | 5 | ||
6 | 6 | let MULT10 = 10000000000 | |
7 | 7 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let wxAssetId = base58' | |
4 | + | let wxAssetId = base58'4TLuEDo8QjPsxUGjfRPyqqvAk4JtnYMXK1ypGo8uKrb2' | |
5 | 5 | ||
6 | 6 | let MULT10 = 10000000000 | |
7 | 7 | ||
8 | 8 | let SEP = "__" | |
9 | 9 | ||
10 | 10 | let poolId = 1 | |
11 | 11 | ||
12 | 12 | let poolLPTokenAddress = base58'4TLuEDo8QjPsxUGjfRPyqqvAk4JtnYMXK1ypGo8uKrb2' | |
13 | 13 | ||
14 | 14 | let stakeboosterRootAddress = base58'3N2PGCSexF2nUN9SmgsaLedFix3M67A9reg' | |
15 | 15 | ||
16 | 16 | let adminAddress = base58'3N2iME1bcpy9zdFi2S1rmQDjPvvN5X8t3qW' | |
17 | 17 | ||
18 | 18 | let totalPoolLPStakedKey = "total_pool_lp_staked" | |
19 | 19 | ||
20 | 20 | let totalPoolEarnedKey = "total_pool_earned" | |
21 | 21 | ||
22 | 22 | let poolCurrentClaimIdKey = "pool_current_claim_id" | |
23 | 23 | ||
24 | 24 | func asPayment (v) = match v { | |
25 | 25 | case p: AttachedPayment => | |
26 | 26 | p | |
27 | 27 | case _ => | |
28 | 28 | throw("fail to cast into AttachedPayment") | |
29 | 29 | } | |
30 | 30 | ||
31 | 31 | ||
32 | 32 | func asInt (val) = match val { | |
33 | 33 | case valInt: Int => | |
34 | 34 | valInt | |
35 | 35 | case _ => | |
36 | 36 | throw("fail to cast into Int") | |
37 | 37 | } | |
38 | 38 | ||
39 | 39 | ||
40 | 40 | func asString (val) = match val { | |
41 | 41 | case valString: String => | |
42 | 42 | valString | |
43 | 43 | case _ => | |
44 | 44 | throw("fail to cast into String") | |
45 | 45 | } | |
46 | 46 | ||
47 | 47 | ||
48 | 48 | func isUserHaveUnclaimedRewards (address) = if (!(isDefined(getString(address)))) | |
49 | 49 | then false | |
50 | 50 | else { | |
51 | 51 | let currentPoolClaimId = getIntegerValue(poolCurrentClaimIdKey) | |
52 | 52 | let userData = split(getStringValue(address), SEP) | |
53 | 53 | let userLastClaimedRewardsAtPoolClaimId = asInt(parseInt(userData[2])) | |
54 | 54 | (currentPoolClaimId > userLastClaimedRewardsAtPoolClaimId) | |
55 | 55 | } | |
56 | 56 | ||
57 | 57 | ||
58 | 58 | @Callable(i) | |
59 | 59 | func stakeLP () = if ((size(i.payments) != 1)) | |
60 | 60 | then throw("One Payment expected") | |
61 | 61 | else { | |
62 | 62 | let callerAddress = toBase58String(i.caller.bytes) | |
63 | 63 | let payment = asPayment(i.payments[0]) | |
64 | 64 | if (if ((payment.assetId != poolLPTokenAddress)) | |
65 | 65 | then true | |
66 | 66 | else (0 >= payment.amount)) | |
67 | 67 | then throw("Wrong asset id or negative amount") | |
68 | 68 | else if (isUserHaveUnclaimedRewards(callerAddress)) | |
69 | 69 | then throw("You have unclaimed rewards on contract, claim them first") | |
70 | 70 | else { | |
71 | 71 | let currentTotalPoolClaimId = valueOrElse(getInteger(poolCurrentClaimIdKey), 0) | |
72 | 72 | let currentTotalPoolLPStaked = valueOrElse(getInteger(totalPoolLPStakedKey), 0) | |
73 | 73 | let currentTotalPoolEarned = valueOrElse(getInteger(totalPoolEarnedKey), 0) | |
74 | 74 | let result = invoke(Address(stakeboosterRootAddress), "stakePoolLps", [poolId], [payment]) | |
75 | 75 | if ((result == result)) | |
76 | 76 | then { | |
77 | 77 | let userDataOpt = getString(callerAddress) | |
78 | 78 | let userData = if (isDefined(userDataOpt)) | |
79 | 79 | then { | |
80 | 80 | let userData = split(asString(userDataOpt), SEP) | |
81 | 81 | let userTotalStakedAmount = asInt(parseInt(userData[0])) | |
82 | 82 | let newUserData = [toString((userTotalStakedAmount + payment.amount)), removeByIndex(userData, 0)] | |
83 | 83 | makeString(newUserData, SEP) | |
84 | 84 | } | |
85 | 85 | else makeString([toString(payment.amount), "0", toString(currentTotalPoolClaimId), toString(currentTotalPoolEarned)], SEP) | |
86 | 86 | [StringEntry(callerAddress, userData), IntegerEntry(poolCurrentClaimIdKey, currentTotalPoolClaimId), IntegerEntry(totalPoolEarnedKey, currentTotalPoolEarned), IntegerEntry(totalPoolLPStakedKey, (currentTotalPoolLPStaked + payment.amount))] | |
87 | 87 | } | |
88 | 88 | else throw("Strict value is not equal to itself.") | |
89 | 89 | } | |
90 | 90 | } | |
91 | 91 | ||
92 | 92 | ||
93 | 93 | ||
94 | 94 | @Callable(i) | |
95 | 95 | func withdrawLP () = { | |
96 | 96 | let callerAddress = toBase58String(i.caller.bytes) | |
97 | 97 | if (isUserHaveUnclaimedRewards(callerAddress)) | |
98 | 98 | then throw("You have unclaimed rewards on contract, claim them first") | |
99 | 99 | else nil | |
100 | 100 | } | |
101 | 101 | ||
102 | 102 | ||
103 | 103 | ||
104 | 104 | @Callable(i) | |
105 | 105 | func claimRewards () = { | |
106 | 106 | let callerAddress = toBase58String(i.caller.bytes) | |
107 | 107 | if (!(isUserHaveUnclaimedRewards(callerAddress))) | |
108 | 108 | then throw("Nothing to claim, wait for a while, pool will collect the rewards from WX soon") | |
109 | 109 | else { | |
110 | 110 | let poolCurrentClaimId = getIntegerValue(poolCurrentClaimIdKey) | |
111 | 111 | let totalPoolEarned = getIntegerValue(totalPoolEarnedKey) | |
112 | 112 | let userData = split(getStringValue(callerAddress), SEP) | |
113 | 113 | let userTotalLPStaked = asInt(parseInt(userData[0])) | |
114 | 114 | let userTotalRewardsClaimed = asInt(parseInt(userData[1])) | |
115 | 115 | let userLastClaimPoolClaimId = asInt(parseInt(userData[2])) | |
116 | 116 | let poolEarnedRewardsWithoutUser = asInt(parseInt(userData[3])) | |
117 | 117 | let totalPoolEarningsWithUser = (totalPoolEarned - poolEarnedRewardsWithoutUser) | |
118 | 118 | let unclaimedRewards = (totalPoolEarningsWithUser - (userTotalRewardsClaimed * MULT10)) | |
119 | 119 | let userCurrentClaim = fraction(unclaimedRewards, userTotalLPStaked, MULT10) | |
120 | 120 | let newUserData = makeString([userData[0], toString((userTotalRewardsClaimed + userCurrentClaim)), toString(poolCurrentClaimId), userData[3]], SEP) | |
121 | 121 | [StringEntry(callerAddress, newUserData), ScriptTransfer(i.caller, userCurrentClaim, wxAssetId)] | |
122 | 122 | } | |
123 | 123 | } | |
124 | 124 | ||
125 | 125 | ||
126 | 126 | ||
127 | 127 | @Callable(i) | |
128 | 128 | func claimPoolRewards () = if ((i.caller.bytes != adminAddress)) | |
129 | 129 | then throw("Admin only") | |
130 | 130 | else { | |
131 | 131 | let totalPoolLPStaked = getIntegerValue(totalPoolLPStakedKey) | |
132 | 132 | let totalPoolEarned = getIntegerValue(totalPoolEarnedKey) | |
133 | 133 | let poolCurrentClaimId = getIntegerValue(poolCurrentClaimIdKey) | |
134 | 134 | let currentWxOnContract = assetBalance(this, wxAssetId) | |
135 | 135 | if ((currentWxOnContract == currentWxOnContract)) | |
136 | 136 | then { | |
137 | 137 | let result = invoke(Address(stakeboosterRootAddress), "claimPoolRewards", [poolId], nil) | |
138 | 138 | if ((result == result)) | |
139 | 139 | then { | |
140 | 140 | let newWxOnContract = assetBalance(this, wxAssetId) | |
141 | 141 | let claimedWxAmount = (newWxOnContract - currentWxOnContract) | |
142 | 142 | let currentClaimIdEarnings = fraction(claimedWxAmount, MULT10, totalPoolLPStaked) | |
143 | 143 | [IntegerEntry("CURRENT_WX_ON_CONTRACT", currentWxOnContract), IntegerEntry("NEW_WX_ON_CONTRACT", newWxOnContract), IntegerEntry(poolCurrentClaimIdKey, (poolCurrentClaimId + 1)), IntegerEntry(totalPoolEarnedKey, (totalPoolEarned + currentClaimIdEarnings))] | |
144 | 144 | } | |
145 | 145 | else throw("Strict value is not equal to itself.") | |
146 | 146 | } | |
147 | 147 | else throw("Strict value is not equal to itself.") | |
148 | 148 | } | |
149 | 149 | ||
150 | 150 | ||
151 | 151 | @Verifier(tx) | |
152 | 152 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
153 | 153 |
github/deemru/w8io/169f3d6 30.31 ms ◑