tx · B8NCPKbofVgUasFhu77v2CnwaAgB47UTYkEYtH1en5MM

3MvDaiEQAUy7jR36PYAXmJ5fx7bnRn1V9Jw:  -0.01000000 Waves

2023.09.22 14:33 [2766525] smart account 3MvDaiEQAUy7jR36PYAXmJ5fx7bnRn1V9Jw > SELF 0.00000000 Waves

{ "type": 13, "id": "B8NCPKbofVgUasFhu77v2CnwaAgB47UTYkEYtH1en5MM", "fee": 1000000, "feeAssetId": null, "timestamp": 1695382452854, "version": 2, "chainId": 84, "sender": "3MvDaiEQAUy7jR36PYAXmJ5fx7bnRn1V9Jw", "senderPublicKey": "EMZkHNkQMc18obaMg5Un4FEZKKAvLBCE64644JVnSti3", "proofs": [ "3sXVi47aoWhm9RpSRygXRqMVZs6ZZsZaRLhrFNcem9rvySdfCPRMqdsxLHwNn3XVnpDANwQwvhv2SZdpkmtGGuTm" ], "script": "base64:BgITCAISBwoFAQgICAgSABIAEgASAA8ABk1VTFQxMACAyK+gJQADU0VQAgJfXwAJcG9vbElkS2V5Agdwb29sX2lkABBpc0NvbnN0cnVjdGVkS2V5Ag5pc19jb25zdHJ1Y3RlZAAMd3hBc3NldElkS2V5Agt3eF9hc3NldF9pZAAVcG9vbExQVG9rZW5BZGRyZXNzS2V5AhVwb29sX3BsX3Rva2VuX2FkZHJlc3MAGnN0YWtlYm9vc3RlclJvb3RBZGRyZXNzS2V5AhlzdGFrZWJvb3N0ZXJfcm9vdF9hZGRyZXNzAA9hZG1pbkFkZHJlc3NLZXkCEWFkbWluX2FkZHJlc3Nfa2V5ABR0b3RhbFBvb2xMUFN0YWtlZEtleQIUdG90YWxfcG9vbF9scF9zdGFrZWQAEnRvdGFsUG9vbEVhcm5lZEtleQIRdG90YWxfcG9vbF9lYXJuZWQAFXBvb2xDdXJyZW50Q2xhaW1JZEtleQIVcG9vbF9jdXJyZW50X2NsYWltX2lkAQlhc1BheW1lbnQBAXYEByRtYXRjaDAFAXYDCQABAgUHJG1hdGNoMAIPQXR0YWNoZWRQYXlt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IFEnBvb2xDdXJyZW50Q2xhaW1JZAABCQDMCAIJAQxJbnRlZ2VyRW50cnkCBRJ0b3RhbFBvb2xFYXJuZWRLZXkJAGQCBQ90b3RhbFBvb2xFYXJuZWQFFmN1cnJlbnRDbGFpbUlkRWFybmluZ3MFA25pbAkAAgECJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgkAAgECJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgECdHgBBnZlcmlmeQAJAPQDAwgFAnR4CWJvZHlCeXRlcwkAkQMCCAUCdHgGcHJvb2ZzAAAIBQJ0eA9zZW5kZXJQdWJsaWNLZXkmy9M1", "height": 2766525, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
OldNewDifferences
1-# no script
1+{-# STDLIB_VERSION 6 #-}
2+{-# SCRIPT_TYPE ACCOUNT #-}
3+{-# CONTENT_TYPE DAPP #-}
4+let MULT10 = 10000000000
5+
6+let SEP = "__"
7+
8+let poolIdKey = "pool_id"
9+
10+let isConstructedKey = "is_constructed"
11+
12+let wxAssetIdKey = "wx_asset_id"
13+
14+let poolLPTokenAddressKey = "pool_pl_token_address"
15+
16+let stakeboosterRootAddressKey = "stakebooster_root_address"
17+
18+let adminAddressKey = "admin_address_key"
19+
20+let totalPoolLPStakedKey = "total_pool_lp_staked"
21+
22+let totalPoolEarnedKey = "total_pool_earned"
23+
24+let poolCurrentClaimIdKey = "pool_current_claim_id"
25+
26+func asPayment (v) = match v {
27+ case p: AttachedPayment =>
28+ p
29+ case _ =>
30+ throw("fail to cast into AttachedPayment")
31+}
32+
33+
34+func asInt (val) = match val {
35+ case valInt: Int =>
36+ valInt
37+ case _ =>
38+ throw("fail to cast into Int")
39+}
40+
41+
42+func asString (val) = match val {
43+ case valString: String =>
44+ valString
45+ case _ =>
46+ throw("fail to cast into String")
47+}
48+
49+
50+func isUserHaveUnclaimedRewards (address) = if (!(isDefined(getString(address))))
51+ then false
52+ else {
53+ let currentPoolClaimId = getIntegerValue(poolCurrentClaimIdKey)
54+ let userData = split(getStringValue(address), SEP)
55+ let userLastClaimedRewardsAtPoolClaimId = asInt(parseInt(userData[2]))
56+ (currentPoolClaimId > userLastClaimedRewardsAtPoolClaimId)
57+ }
58+
59+
60+@Callable(i)
61+func constructor (poolId,wxAssetId,lpPoolAssetId,stbRootContract,adminContract) = if (isDefined(getBoolean(isConstructedKey)))
62+ then throw("Constructor can be called one time")
63+ else [BooleanEntry(isConstructedKey, true), IntegerEntry(poolIdKey, poolId), StringEntry(wxAssetIdKey, wxAssetId), StringEntry(poolLPTokenAddressKey, lpPoolAssetId), StringEntry(stakeboosterRootAddressKey, stbRootContract), StringEntry(adminAddressKey, adminContract)]
64+
65+
66+
67+@Callable(i)
68+func stakeLP () = if ((size(i.payments) != 1))
69+ then throw("One Payment expected")
70+ else {
71+ let callerAddress = toBase58String(i.caller.bytes)
72+ let payment = asPayment(i.payments[0])
73+ let poolLPTokenAddress = fromBase58String(getStringValue(poolLPTokenAddressKey))
74+ if (if ((payment.assetId != poolLPTokenAddress))
75+ then true
76+ else (0 >= payment.amount))
77+ then throw("Wrong asset id or negative amount")
78+ else if (isUserHaveUnclaimedRewards(callerAddress))
79+ then throw("You have unclaimed rewards on contract, claim them first")
80+ else {
81+ let currentTotalPoolClaimId = valueOrElse(getInteger(poolCurrentClaimIdKey), 0)
82+ let currentTotalPoolLPStaked = valueOrElse(getInteger(totalPoolLPStakedKey), 0)
83+ let currentTotalPoolEarned = valueOrElse(getInteger(totalPoolEarnedKey), 0)
84+ let stakeboosterRootAddress = fromBase58String(getStringValue(stakeboosterRootAddressKey))
85+ let result = invoke(Address(stakeboosterRootAddress), "stakePoolLps", [getIntegerValue(poolIdKey)], [payment])
86+ if ((result == result))
87+ then {
88+ let userDataOpt = getString(callerAddress)
89+ let userData = if (isDefined(userDataOpt))
90+ then {
91+ let userData = split(asString(userDataOpt), SEP)
92+ let userTotalStakedAmount = asInt(parseInt(userData[0]))
93+ let newUserData = [toString((userTotalStakedAmount + payment.amount)), removeByIndex(userData, 0)]
94+ makeString(newUserData, SEP)
95+ }
96+ else makeString([toString(payment.amount), "0", toString(currentTotalPoolClaimId), toString(currentTotalPoolEarned)], SEP)
97+[StringEntry(callerAddress, userData), IntegerEntry(poolCurrentClaimIdKey, currentTotalPoolClaimId), IntegerEntry(totalPoolEarnedKey, currentTotalPoolEarned), IntegerEntry(totalPoolLPStakedKey, (currentTotalPoolLPStaked + payment.amount))]
98+ }
99+ else throw("Strict value is not equal to itself.")
100+ }
101+ }
102+
103+
104+
105+@Callable(i)
106+func withdrawLP () = {
107+ let callerAddress = toBase58String(i.caller.bytes)
108+ if (isUserHaveUnclaimedRewards(callerAddress))
109+ then throw("You have unclaimed rewards on contract, claim them first")
110+ else nil
111+ }
112+
113+
114+
115+@Callable(i)
116+func claimRewards () = {
117+ let callerAddress = toBase58String(i.caller.bytes)
118+ if (!(isUserHaveUnclaimedRewards(callerAddress)))
119+ then throw("Nothing to claim, wait for a while, pool will collect the rewards from WX soon")
120+ else {
121+ let poolCurrentClaimId = getIntegerValue(poolCurrentClaimIdKey)
122+ let totalPoolEarned = getIntegerValue(totalPoolEarnedKey)
123+ let userData = split(getStringValue(callerAddress), SEP)
124+ let userTotalLPStaked = asInt(parseInt(userData[0]))
125+ let userTotalRewardsClaimed = asInt(parseInt(userData[1]))
126+ let userLastClaimPoolClaimId = asInt(parseInt(userData[2]))
127+ let poolEarnedRewardsWithUser = asInt(parseInt(userData[3]))
128+ let totalPoolEarningsWithUser = (totalPoolEarned - poolEarnedRewardsWithUser)
129+ let userClaim = fraction(totalPoolEarningsWithUser, userTotalLPStaked, MULT10, HALFUP)
130+ let currentEarnedRewards = fraction(userClaim, MULT10, userTotalLPStaked, HALFUP)
131+ let newUserData = makeString([userData[0], toString((userTotalRewardsClaimed + userClaim)), toString(poolCurrentClaimId), toString((poolEarnedRewardsWithUser + currentEarnedRewards))], SEP)
132+ let wxAssetId = fromBase58String(getStringValue(wxAssetIdKey))
133+[StringEntry(callerAddress, newUserData), ScriptTransfer(i.caller, userClaim, wxAssetId)]
134+ }
135+ }
136+
137+
138+
139+@Callable(i)
140+func claimPoolRewards () = if ((i.caller.bytes != fromBase58String(getStringValue(adminAddressKey))))
141+ then throw("Admin only")
142+ else {
143+ let totalPoolLPStaked = getIntegerValue(totalPoolLPStakedKey)
144+ let totalPoolEarned = getIntegerValue(totalPoolEarnedKey)
145+ let poolCurrentClaimId = getIntegerValue(poolCurrentClaimIdKey)
146+ let wxAssetId = fromBase58String(getStringValue(wxAssetIdKey))
147+ let stakeboosterRootAddress = fromBase58String(getStringValue(stakeboosterRootAddressKey))
148+ let currentWxOnContract = assetBalance(this, wxAssetId)
149+ if ((currentWxOnContract == currentWxOnContract))
150+ then {
151+ let result = invoke(Address(stakeboosterRootAddress), "claimPoolRewards", [getIntegerValue(poolIdKey)], nil)
152+ if ((result == result))
153+ then {
154+ let newWxOnContract = assetBalance(this, wxAssetId)
155+ let claimedWxAmount = (newWxOnContract - currentWxOnContract)
156+ let currentClaimIdEarnings = fraction(claimedWxAmount, MULT10, totalPoolLPStaked, HALFUP)
157+[IntegerEntry(poolCurrentClaimIdKey, (poolCurrentClaimId + 1)), IntegerEntry(totalPoolEarnedKey, (totalPoolEarned + currentClaimIdEarnings))]
158+ }
159+ else throw("Strict value is not equal to itself.")
160+ }
161+ else throw("Strict value is not equal to itself.")
162+ }
163+
164+
165+@Verifier(tx)
166+func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
167+

github/deemru/w8io/026f985 
17.64 ms