tx · EkqQSkPjyG6hpfZJC8JhbxcSjTWURFdkL2qTiB5oGirz

3MqkNfXVeJunXinMimi7HA9F8ANmJETbUxx:  -0.00600000 Waves

2022.12.20 11:05 [2368350] smart account 3MqkNfXVeJunXinMimi7HA9F8ANmJETbUxx > SELF 0.00000000 Waves

{ "type": 13, "id": "EkqQSkPjyG6hpfZJC8JhbxcSjTWURFdkL2qTiB5oGirz", "fee": 600000, "feeAssetId": null, "timestamp": 1671523560921, "version": 2, "chainId": 84, "sender": "3MqkNfXVeJunXinMimi7HA9F8ANmJETbUxx", "senderPublicKey": "8zsP8gYRj6csNvi7rW3BDs4BWXB1Xz8ZQ5DrL9ruSjkY", "proofs": [ "4MpqWbsNdvkd4X8ceDr6pRQzFJvNNbtxUanZWMxYshevHqkMaxhgfSR5UW8xrqY4Vi9PFdJCQGjmAP5k8q7ts1nW" ], "script": "base64:BgIMCAISBAoCCAESABIALAAHa0FjdGl2ZQIGYWN0aXZlAA1rZXlBY3RpdmVHbG9iAhRhY3RpdmVfYWxsX2NvbnRyYWN0cwAGa0NhdXNlAg5zaHV0ZG93bl9jYXVzZQANa1VzZXJQb29sVm90ZQIQX3VzZXJfdm90ZV9nU1dPUAAOa1VzZXJUb3RhbFZvdGUCFl91c2VyX3RvdGFsX3ZvdGVfZ1NXT1AACWtQb29sVm90ZQIQX3Bvb2xfdm90ZV9nU1dPUAAKa1RvdGFsVm90ZQIQdG90YWxfdm90ZV9nU1dPUAAQa0hhcnZlc3RQb29sVm90ZQIYX2hhcnZlc3RfcG9vbF92b3RlX2dTV09QABRrSGFydmVzdFVzZXJQb29sVm90ZQIdX2hhcnZlc3RfdXNlcl9wb29sX3ZvdGVfZ1NXT1AADGtTdGFydEhlaWdodAIMc3RhcnRfaGVpZ2h0AAtrQmFzZVBlcmlvZAILYmFzZV9wZXJpb2QADWtQZXJpb2RMZW5ndGgCDXBlcmlvZF9sZW5ndGgADWtBZG1pblB1YktleTECC2FkbWluX3B1Yl8xAA1rQWRtaW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pbkNhbGwBBQFpAwUGYWN0aXZlCQACAQIWREFwcCBpcyBhbHJlYWR5IGFjdGl2ZQkAzAgCCQEMQm9vbGVhbkVudHJ5AgUHa0FjdGl2ZQYJAMwIAgkBC0RlbGV0ZUVudHJ5AQUGa0NhdXNlBQNuaWwAVkiTrw==", "height": 2368350, "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 kActive = "active"
5+
6+let keyActiveGlob = "active_all_contracts"
7+
8+let kCause = "shutdown_cause"
9+
10+let kUserPoolVote = "_user_vote_gSWOP"
11+
12+let kUserTotalVote = "_user_total_vote_gSWOP"
13+
14+let kPoolVote = "_pool_vote_gSWOP"
15+
16+let kTotalVote = "total_vote_gSWOP"
17+
18+let kHarvestPoolVote = "_harvest_pool_vote_gSWOP"
19+
20+let kHarvestUserPoolVote = "_harvest_user_pool_vote_gSWOP"
21+
22+let kStartHeight = "start_height"
23+
24+let kBasePeriod = "base_period"
25+
26+let kPeriodLength = "period_length"
27+
28+let kAdminPubKey1 = "admin_pub_1"
29+
30+let kAdminPubKey2 = "admin_pub_2"
31+
32+let kAdminPubKey3 = "admin_pub_3"
33+
34+let kFarmingAddr = "farming_address"
35+
36+let kGovAddress = "governance_address"
37+
38+let kPoolFirstHarvestEndHeight = "first_harvest_height"
39+
40+let kPoolStruc = "_pool_struc"
41+
42+let kUserPoolStruc = "_user_pool_struc"
43+
44+let kUserTotalStruc = "_user_total_struc"
45+
46+let kTotalStruc = "total_struc"
47+
48+let kHarvestPoolActiveVoteStruc = "_harvest_pool_activeVote_struc"
49+
50+let kHarvestUserPoolActiveVoteStruc = "_harvest_user_pool_activeVote_struc"
51+
52+let oracle = Address(base58'3PEbqViERCoKnmcSULh6n2aiMvUdSQdCsom')
53+
54+let active = valueOrElse(getBoolean(this, kActive), true)
55+
56+let activeGlob = valueOrElse(getBoolean(oracle, keyActiveGlob), true)
57+
58+let basePeriod = valueOrErrorMessage(getInteger(this, kBasePeriod), "Empty kBasePeriod")
59+
60+let startHeight = valueOrErrorMessage(getInteger(this, kStartHeight), "Empty kStartHeight")
61+
62+let periodLength = valueOrErrorMessage(getInteger(this, kPeriodLength), "Empty kPeriodLength")
63+
64+func getBase58FromOracle (key) = match getString(oracle, key) {
65+ case string: String =>
66+ fromBase58String(string)
67+ case nothing =>
68+ throw((key + "is empty"))
69+}
70+
71+
72+let adminPubKey1 = getBase58FromOracle(kAdminPubKey1)
73+
74+let adminPubKey2 = getBase58FromOracle(kAdminPubKey2)
75+
76+let adminPubKey3 = getBase58FromOracle(kAdminPubKey3)
77+
78+let govAddress = Address(getBase58FromOracle(kGovAddress))
79+
80+let farmingAddr = Address(getBase58FromOracle(kFarmingAddr))
81+
82+let currPeriod = (basePeriod + ((height - startHeight) / periodLength))
83+
84+func isActive () = if (if (active)
85+ then activeGlob
86+ else false)
87+ then unit
88+ else throw("DApp is inactive at this moment")
89+
90+
91+func isAdminCall (i) = if (containsElement([adminPubKey1, adminPubKey2, adminPubKey3], i.callerPublicKey))
92+ then unit
93+ else throw("Only admin can call this function")
94+
95+
96+func isCallerInGovernance (user) = (valueOrElse(getInteger(govAddress, (toString(user) + "_SWOP_amount")), 0) > 0)
97+
98+
99+func isPoolInGovernance (poolAddress) = isDefined(getInteger(govAddress, (poolAddress + "_current_pool_fraction_reward")))
100+
101+
102+func getPoolFirstHarvestStartHeight (poolAddress) = (valueOrElse(getInteger(Address(fromBase58String(poolAddress)), kPoolFirstHarvestEndHeight), 0) - periodLength)
103+
104+
105+func suspend (cause) = [BooleanEntry(kActive, false), StringEntry(kCause, cause)]
106+
107+
108+func calcDeleteEntry (caller,poolAddress) = {
109+ func deleteIfExists (list,key) = if (isDefined(getString(this, key)))
110+ then (list :+ DeleteEntry(key))
111+ else list
112+
113+ deleteIfExists(deleteIfExists(deleteIfExists(deleteIfExists(deleteIfExists(deleteIfExists(nil, (((caller + "_") + poolAddress) + kUserPoolStruc)), (caller + kUserTotalStruc)), (poolAddress + kPoolStruc)), kTotalStruc), (poolAddress + kHarvestPoolActiveVoteStruc)), (((caller + "_") + poolAddress) + kHarvestUserPoolActiveVoteStruc))
114+ }
115+
116+
117+@Callable(i)
118+func votePoolWeight (poolAddress,userPoolVoteNew) = valueOrElse(isActive(), if (!(isPoolInGovernance(poolAddress)))
119+ then throw("This pool is not in Governance dApp")
120+ else {
121+ let userSWOPinGovernance = valueOrErrorMessage(getInteger(govAddress, (toString(i.caller) + "_SWOP_amount")), "Empty _SWOP_amount at gov. address")
122+ let userGSWOPinGovernance = valueOrElse(getInteger(govAddress, (toString(i.caller) + "_GSwop_amount")), userSWOPinGovernance)
123+ let userPoolVote = if (isDefined(getString(this, (((toString(i.caller) + "_") + poolAddress) + kUserPoolStruc))))
124+ then parseIntValue(split(value(getString(this, (((toString(i.caller) + "_") + poolAddress) + kUserPoolStruc))), "_")[0])
125+ else valueOrElse(getInteger(this, (((toString(i.caller) + "_") + poolAddress) + kUserPoolVote)), 0)
126+ let userTotalVote = if (isDefined(getString(this, (toString(i.caller) + kUserTotalStruc))))
127+ then parseIntValue(split(value(getString(this, (toString(i.caller) + kUserTotalStruc))), "_")[0])
128+ else valueOrElse(getInteger(this, (toString(i.caller) + kUserTotalVote)), 0)
129+ let poolVote = if (isDefined(getString(this, (poolAddress + kPoolStruc))))
130+ then parseIntValue(split(value(getString(this, (poolAddress + kPoolStruc))), "_")[0])
131+ else valueOrElse(getInteger(this, (poolAddress + kPoolVote)), 0)
132+ let totalVote = if (isDefined(getString(this, kTotalStruc)))
133+ then parseIntValue(split(value(getString(this, kTotalStruc)), "_")[0])
134+ else valueOrElse(getInteger(this, kTotalVote), 0)
135+ let poolVoteDiff = (userPoolVoteNew - userPoolVote)
136+ let userTotalVoteNew = (userTotalVote + poolVoteDiff)
137+ if ((userTotalVoteNew > userGSWOPinGovernance))
138+ then throw(((((toString(i.caller) + " has ") + toString(userGSWOPinGovernance)) + " GSWOP in governance. New GSWOP in voting ") + toString(userTotalVoteNew)))
139+ else if ((0 > userTotalVoteNew))
140+ then throw("New userTotalVoteSWOPnew < 0")
141+ else if ((0 > userPoolVoteNew))
142+ then throw("New userPoolVoteSWOPnew < 0")
143+ else {
144+ let removePoolVote = -(poolVoteDiff)
145+ let poolVoteNew = if ((userPoolVoteNew >= userPoolVote))
146+ then (poolVote + poolVoteDiff)
147+ else (poolVote - removePoolVote)
148+ let totalVoteNew = if ((userPoolVoteNew >= userPoolVote))
149+ then (totalVote + poolVoteDiff)
150+ else (totalVote - removePoolVote)
151+ if (if ((0 > poolVoteNew))
152+ then true
153+ else (0 > totalVoteNew))
154+ then throw("One or more values are negative")
155+ else {
156+ let harvestEntries = if ((getPoolFirstHarvestStartHeight(poolAddress) > height))
157+ then [IntegerEntry((poolAddress + kHarvestPoolVote), poolVoteNew), IntegerEntry((((toString(i.caller) + "_") + poolAddress) + kHarvestUserPoolVote), userPoolVoteNew)]
158+ else nil
159+ let upUIntr = invoke(farmingAddr, "updateUserBoostInterest", [poolAddress, toString(i.caller)], nil)
160+ if ((upUIntr == upUIntr))
161+ then (([IntegerEntry((((toString(i.caller) + "_") + poolAddress) + kUserPoolVote), userPoolVoteNew), IntegerEntry((toString(i.caller) + kUserTotalVote), userTotalVoteNew), IntegerEntry((poolAddress + kPoolVote), poolVoteNew), IntegerEntry(kTotalVote, totalVoteNew)] ++ calcDeleteEntry(toString(i.caller), poolAddress)) ++ harvestEntries)
162+ else throw("Strict value is not equal to itself.")
163+ }
164+ }
165+ })
166+
167+
168+
169+@Callable(i)
170+func shutdown () = valueOrElse(isAdminCall(i), if (!(active))
171+ then throw(("DApp is already suspended. Cause: " + valueOrElse(getString(this, kCause), "the cause wasn't specified")))
172+ else suspend("Paused by admin"))
173+
174+
175+
176+@Callable(i)
177+func activate () = valueOrElse(isAdminCall(i), if (active)
178+ then throw("DApp is already active")
179+ else [BooleanEntry(kActive, true), DeleteEntry(kCause)])
180+
181+

github/deemru/w8io/169f3d6 
18.66 ms