tx · C6QzrANgGxd58EurCxgPRPsJv2M9KeC5XMrYGpL7gjEP

3N2ttTzsgqMt7SLLGt2XeTAg6pvp1Z8bYUP:  -0.01400000 Waves

2021.10.31 12:45 [1770322] smart account 3N2ttTzsgqMt7SLLGt2XeTAg6pvp1Z8bYUP > SELF 0.00000000 Waves

{ "type": 13, "id": "C6QzrANgGxd58EurCxgPRPsJv2M9KeC5XMrYGpL7gjEP", "fee": 1400000, "feeAssetId": null, "timestamp": 1635673571596, "version": 1, "sender": "3N2ttTzsgqMt7SLLGt2XeTAg6pvp1Z8bYUP", "senderPublicKey": "6d6kTEktTc9fA43J2j2n9kjzhX3G19W36tkc9Afe4eLn", "proofs": [ "2oBHuwW9ho4npVZT9KBzV33LvnZZxUZjgDvFZiAiVjyx2yw2FgXfSuCiymykAc9Mwiy132jBqbgPSbTWxXaVVXRZ" ], "script": "base64:AAIFAAAAAAAAABIIAhIAEgASAwoBARIDCgEBEgAAAAAWAAAAAAZvcmFjbGUJAQAAAAdBZGRyZXNzAAAAAQEAAAAaAVSpHA/3It5Iym1Df/6r/XdrKhz2wqVE56sAAAAAB2JhbGFuY2UJAQAAABFAZXh0ck5hdGl2ZSgxMDYyKQAAAAEJAQAAABN2YWx1ZU9yRXJyb3JNZXNzYWdlAAAAAgkABB0AAAACBQAAAAZvcmFjbGUCAAAAD2JhbGFuY2VfYWRkcmVzcwIAAAAYRW1wdHkga2V5IG9yYWNsZV9hZGRyZXNzAAAAABFTV09QZ292ZXJuYW5jZUFkcgkBAAAAEUBleHRyTmF0aXZlKDEwNjIpAAAAAQkBAAAAE3ZhbHVlT3JFcnJvck1lc3NhZ2UAAAACCQAEHQAAAAIFAAAABm9yYWNsZQIAAAAPc3dvcF9nb3Zlcm5hbmNlAgAAABlFbXB0eSBrZXkgc3dvcF9nb3Zlcm5hbmNlAAAAAARTV09QCQACWQAAAAEJAQAAABN2YWx1ZU9yRXJyb3JNZXNzYWdlAAAAAgkABB0AAAACBQAAAAZvcmFjbGUC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AAALdmFsdWVPckVsc2UAAAACCQAEGwAAAAIFAAAABmFkbWluMQIAAAAFdHhTdHIHAAAAAAAAAAABAAAAAAAAAAAABAAAAAxhZG1pbjJTaWduZWQDCQEAAAALdmFsdWVPckVsc2UAAAACCQAEGwAAAAIFAAAABmFkbWluMgIAAAAFdHhTdHIHAAAAAAAAAAABAAAAAAAAAAAABAAAAAxhZG1pbjNTaWduZWQDCQEAAAALdmFsdWVPckVsc2UAAAACCQAEGwAAAAIFAAAABmFkbWluMwIAAAAFdHhTdHIHAAAAAAAAAAABAAAAAAAAAAAACQAAZwAAAAIJAABkAAAAAgkAAGQAAAACBQAAAAxhZG1pbjFTaWduZWQFAAAADGFkbWluMlNpZ25lZAUAAAAMYWRtaW4zU2lnbmVkAAAAAAAAAAACuX+jHQ==", "chainId": 84, "height": 1770322, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
OldNewDifferences
1-# no script
1+{-# STDLIB_VERSION 5 #-}
2+{-# SCRIPT_TYPE ACCOUNT #-}
3+{-# CONTENT_TYPE DAPP #-}
4+let oracle = Address(base58'3N5LFb9VKspdbYuEQ6XFzmmYuVSrou1CgcA')
5+
6+let balance = addressFromStringValue(valueOrErrorMessage(getString(oracle, "balance_address"), "Empty key oracle_address"))
7+
8+let SWOPgovernanceAdr = addressFromStringValue(valueOrErrorMessage(getString(oracle, "swop_governance"), "Empty key swop_governance"))
9+
10+let SWOP = fromBase58String(valueOrErrorMessage(getString(oracle, "SWOP"), "Empty key SWOP"))
11+
12+let consumers = split(valueOrElse(getString(oracle, "consumers"), "Empty key consumer"), ",")
13+
14+let admin1 = addressFromStringValue(valueOrElse(getString(oracle, "admin_1"), "Empty key admin_1"))
15+
16+let admin2 = addressFromStringValue(valueOrElse(getString(oracle, "admin_2"), "Empty key admin_2"))
17+
18+let admin3 = addressFromStringValue(valueOrElse(getString(oracle, "admin_3"), "Empty key admin_3"))
19+
20+let isProtocolActive = valueOrErrorMessage(getBoolean(oracle, "is_protocol_active"), "Empty key is_protocol_active")
21+
22+let keyOwner = "owner"
23+
24+let keyIsDappActive = "is_dapp_active"
25+
26+let owner = addressFromString(valueOrErrorMessage(getString(this, keyOwner), "Empty keyOwner"))
27+
28+let ownerStr = valueOrErrorMessage(getString(this, keyOwner), "Empty keyOwner")
29+
30+let isDappActive = valueOrErrorMessage(getBoolean(this, keyIsDappActive), "Empty key is_dapp_active")
31+
32+let keyLastInterest = "last_interest"
33+
34+let keyUserSWOPLocked = "_SWOP_amount"
35+
36+let keyUserLastInterest = "_last_interest"
37+
38+let scaleValue = 100000000
39+
40+func getLastInterestInfo () = {
41+ let lastInterest = valueOrElse(getInteger(SWOPgovernanceAdr, keyLastInterest), 0)
42+ lastInterest
43+ }
44+
45+
46+func getUserSWOPLocked (user) = valueOrElse(getInteger(SWOPgovernanceAdr, (toString(user) + keyUserSWOPLocked)), 0)
47+
48+
49+func getUserInterestInfo (user,lastInterest) = {
50+ let userSWOPAmount = getUserSWOPLocked(user)
51+ let userLastInterest = getInteger(SWOPgovernanceAdr, (toString(user) + keyUserLastInterest))
52+ let userLastInterestValue = match userLastInterest {
53+ case userLastInterest: Int =>
54+ userLastInterest
55+ case _ =>
56+ lastInterest
57+ }
58+ $Tuple2(userLastInterestValue, userSWOPAmount)
59+ }
60+
61+
62+func claimCalc (caller) = {
63+ let lastInterest = getLastInterestInfo()
64+ let uifo = getUserInterestInfo(caller, lastInterest)
65+ let userLastInterest = uifo._1
66+ let userSWOPLocked = uifo._2
67+ let claimAmount = fraction(userSWOPLocked, (lastInterest - userLastInterest), scaleValue)
68+ let userNewInterest = lastInterest
69+ $Tuple2(userNewInterest, claimAmount)
70+ }
71+
72+
73+@Callable(i)
74+func init () = if (!(isProtocolActive))
75+ then throw("Protol stopped by admin")
76+ else if (isDefined(getString(this, keyOwner)))
77+ then throw("Automate already initialized")
78+ else if ((size(i.payments) == 0))
79+ then [StringEntry(keyOwner, toString(i.caller)), BooleanEntry(keyIsDappActive, true)]
80+ else if ((size(i.payments) == 1))
81+ then {
82+ let $t031433218 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
83+ let pmtAmount = $t031433218._1
84+ let pmtAssetId = $t031433218._2
85+ if ((pmtAssetId != SWOP))
86+ then throw("Only SWOP payment available in init()")
87+ else {
88+ let z = invoke(SWOPgovernanceAdr, "lockSWOP", nil, [AttachedPayment(SWOP, pmtAmount)])
89+ if ((z == z))
90+ then [StringEntry(keyOwner, toString(i.caller)), BooleanEntry(keyIsDappActive, true)]
91+ else throw("Strict value is not equal to itself.")
92+ }
93+ }
94+ else throw("Incorrect paynemt. You should attach SWOP or empty payment")
95+
96+
97+
98+@Callable(i)
99+func governanceLockSWOP () = if (!(if (isProtocolActive)
100+ then isDappActive
101+ else false))
102+ then throw("Protol stopped by admin")
103+ else {
104+ let $t037633838 = $Tuple2(i.payments[0].amount, i.payments[0].assetId)
105+ let pmtAmount = $t037633838._1
106+ let pmtAssetId = $t037633838._2
107+ if ((pmtAssetId != SWOP))
108+ then throw("Only SWOP payment available in governanceLockSWOP()")
109+ else {
110+ let z = invoke(SWOPgovernanceAdr, "lockSWOP", nil, [AttachedPayment(SWOP, pmtAmount)])
111+ if ((z == z))
112+ then nil
113+ else throw("Strict value is not equal to itself.")
114+ }
115+ }
116+
117+
118+
119+@Callable(i)
120+func governanceClaimAndStake (minSWOPreward) = if (!(if (isProtocolActive)
121+ then isDappActive
122+ else false))
123+ then throw("Protol stopped by admin")
124+ else if (if ((i.caller != owner))
125+ then !(containsElement(consumers, toBase58String(i.caller.bytes)))
126+ else false)
127+ then throw("Only owner or admin can call this function")
128+ else {
129+ let claimAmount = claimCalc(this)._2
130+ if ((minSWOPreward > claimAmount))
131+ then throw("Amount to claim is less than minSWOPreward")
132+ else {
133+ let isFeeExtract = if ((i.caller == owner))
134+ then false
135+ else true
136+ let z = invoke(SWOPgovernanceAdr, "claimAndStakeSWOP", nil, nil)
137+ if ((z == z))
138+ then {
139+ let y = invoke(balance, "extractFee", [ownerStr, isFeeExtract], nil)
140+ if ((y == y))
141+ then nil
142+ else throw("Strict value is not equal to itself.")
143+ }
144+ else throw("Strict value is not equal to itself.")
145+ }
146+ }
147+
148+
149+
150+@Callable(i)
151+func governanceWithdraw (amtToWithdraw) = if (!(if (isProtocolActive)
152+ then isDappActive
153+ else false))
154+ then throw("Protol stopped by admin")
155+ else if ((i.caller != owner))
156+ then throw("Only owner can call this function")
157+ else {
158+ let z = invoke(SWOPgovernanceAdr, "withdrawSWOP", [amtToWithdraw], nil)
159+ if ((z == z))
160+ then [ScriptTransfer(i.caller, amtToWithdraw, SWOP)]
161+ else throw("Strict value is not equal to itself.")
162+ }
163+
164+
165+
166+@Callable(i)
167+func shutdownDapp () = if (!(if (isProtocolActive)
168+ then isDappActive
169+ else false))
170+ then throw("Protol stopped by admin")
171+ else if (if (!(containsElement([admin1, admin2, admin3], i.caller)))
172+ then !(containsElement(consumers, toBase58String(i.caller.bytes)))
173+ else false)
174+ then throw("Only admin can call this function")
175+ else [BooleanEntry("is_dapp_active", false)]
176+
177+
178+@Verifier(tx)
179+func verify () = {
180+ let admin1Signed = if (valueOrElse(getBoolean(admin1, "txStr"), false))
181+ then 1
182+ else 0
183+ let admin2Signed = if (valueOrElse(getBoolean(admin2, "txStr"), false))
184+ then 1
185+ else 0
186+ let admin3Signed = if (valueOrElse(getBoolean(admin3, "txStr"), false))
187+ then 1
188+ else 0
189+ (((admin1Signed + admin2Signed) + admin3Signed) >= 2)
190+ }
191+

github/deemru/w8io/026f985 
25.84 ms