tx · 38NHKcJNbSGohjyLEAUM8LDYYKefCsDBxXZRrywBrCFf 3MyUCYHi2Nhkc1AxpRHvUuvkrUhENEwKxRi: -0.01400000 Waves 2022.04.04 16:30 [1993905] smart account 3MyUCYHi2Nhkc1AxpRHvUuvkrUhENEwKxRi > SELF 0.00000000 Waves
{ "type": 13, "id": "38NHKcJNbSGohjyLEAUM8LDYYKefCsDBxXZRrywBrCFf", "fee": 1400000, "feeAssetId": null, "timestamp": 1649079073562, "version": 1, "sender": "3MyUCYHi2Nhkc1AxpRHvUuvkrUhENEwKxRi", "senderPublicKey": "FxELGwsNTxz5DbDYCkefFcETNRQjgHHm5MLhxETyPVnT", "proofs": [ "5bAMVmorUVNC3cg7aZFPhicKvnttAsPYaMhAx9bp4mx4XJPSN2YcCmGPBYJDNHKH9XZpgJTH7QevR3BgShXuCthR" ], "script": "base64:AAIFAAAAAAAAABAIAhIAEgMKAQESAwoBARIAAAAAGAAAAAAGb3JhY2xlCQEAAAAHQWRkcmVzcwAAAAEBAAAAGgFUwRC6DHNrTNPFInvT8Q84A6bvOGl1j/KcAAAAAAdiYWxhbmNlCQEAAAARQGV4dHJOYXRpdmUoMTA2MikAAAABCQEAAAATdmFsdWVPckVycm9yTWVzc2FnZQAAAAIJAAQdAAAAAgUAAAAGb3JhY2xlAgAAAA9iYWxhbmNlX2FkZHJlc3MCAAAAGUVtcHR5IGtleSBiYWxhbmNlX2FkZHJlc3MAAAAAEVNXT1Bnb3Zlcm5hbmNlQWRyCQEAAAARQGV4dHJOYXRpdmUoMTA2MikAAAABCQEAAAATdmFsdWVPckVycm9yTWVzc2FnZQAAAAIJAAQdAAAAAgUAAAAGb3JhY2xlAgAAAA9zd29wX2dvdmVybmFuY2UCAAAAGUVtcHR5IGtleSBzd29wX2dvdmVybmFuY2UAAAAABFNXT1AJAAJZAAAAAQkBAAAAE3ZhbHVlT3JFcnJvck1lc3NhZ2UAAAACCQAEHQAAAAIFAAAABm9yYWNsZQIAAAAEU1dPUAIAA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NhbiBjYWxsIHRoaXMgZnVuY3Rpb24JAARMAAAAAgkBAAAADEJvb2xlYW5FbnRyeQAAAAICAAAADmlzX2RhcHBfYWN0aXZlBwUAAAADbmlsAAAAAQAAAAJ0eAEAAAAGdmVyaWZ5AAAAAAQAAAAMYWRtaW4xU2lnbmVkAwkBAAAAC3ZhbHVlT3JFbHNlAAAAAgkABBsAAAACBQAAAAZhZG1pbjEJAAJYAAAAAQgFAAAAAnR4AAAAAmlkBwAAAAAAAAAAAQAAAAAAAAAAAAQAAAAMYWRtaW4yU2lnbmVkAwkBAAAAC3ZhbHVlT3JFbHNlAAAAAgkABBsAAAACBQAAAAZhZG1pbjIJAAJYAAAAAQgFAAAAAnR4AAAAAmlkBwAAAAAAAAAAAQAAAAAAAAAAAAQAAAAMYWRtaW4zU2lnbmVkAwkBAAAAC3ZhbHVlT3JFbHNlAAAAAgkABBsAAAACBQAAAAZhZG1pbjMJAAJYAAAAAQgFAAAAAnR4AAAAAmlkBwAAAAAAAAAAAQAAAAAAAAAAAAQAAAAMYWRtaW40U2lnbmVkAwkBAAAAC3ZhbHVlT3JFbHNlAAAAAgkABBsAAAACBQAAAAZhZG1pbjQJAAJYAAAAAQgFAAAAAnR4AAAAAmlkBwAAAAAAAAAAAQAAAAAAAAAAAAQAAAAMYWRtaW41U2lnbmVkAwkBAAAAC3ZhbHVlT3JFbHNlAAAAAgkABBsAAAACBQAAAAZhZG1pbjUJAAJYAAAAAQgFAAAAAnR4AAAAAmlkBwAAAAAAAAAAAQAAAAAAAAAAAAkAAGcAAAACCQAAZAAAAAIJAABkAAAAAgkAAGQAAAACCQAAZAAAAAIFAAAADGFkbWluMVNpZ25lZAUAAAAMYWRtaW4yU2lnbmVkBQAAAAxhZG1pbjNTaWduZWQFAAAADGFkbWluNFNpZ25lZAUAAAAMYWRtaW41U2lnbmVkAAAAAAAAAAADOT8SSw==", "chainId": 84, "height": 1993905, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 5 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let oracle = Address(base58'3N7WvE91gUwkV4fyewjrzzAVajRD4kcq8Fd') | |
5 | + | ||
6 | + | let balance = addressFromStringValue(valueOrErrorMessage(getString(oracle, "balance_address"), "Empty key balance_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 admin4 = addressFromStringValue(valueOrElse(getString(oracle, "admin_4"), "Empty key admin_4")) | |
21 | + | ||
22 | + | let admin5 = addressFromStringValue(valueOrElse(getString(oracle, "admin_5"), "Empty key admin_5")) | |
23 | + | ||
24 | + | let isProtocolActive = valueOrErrorMessage(getBoolean(oracle, "is_protocol_active"), "Empty key is_protocol_active") | |
25 | + | ||
26 | + | let keyIsDappActive = "is_dapp_active" | |
27 | + | ||
28 | + | let keyAutomateOwner = "owner" | |
29 | + | ||
30 | + | let isDappActive = valueOrErrorMessage(getBoolean(this, keyIsDappActive), "Empty key is_dapp_active") | |
31 | + | ||
32 | + | let ownerStr = valueOrErrorMessage(getString(this, keyAutomateOwner), "Empty keyAutomateOwner") | |
33 | + | ||
34 | + | let owner = addressFromString(ownerStr) | |
35 | + | ||
36 | + | let keyLastInterest = "last_interest" | |
37 | + | ||
38 | + | let keyUserSWOPLocked = "_SWOP_amount" | |
39 | + | ||
40 | + | let keyUserLastInterest = "_last_interest" | |
41 | + | ||
42 | + | let scaleValue = 100000000 | |
43 | + | ||
44 | + | func getLastInterestInfo () = { | |
45 | + | let lastInterest = valueOrElse(getInteger(SWOPgovernanceAdr, keyLastInterest), 0) | |
46 | + | lastInterest | |
47 | + | } | |
48 | + | ||
49 | + | ||
50 | + | func getUserSWOPLocked (user) = valueOrElse(getInteger(SWOPgovernanceAdr, (toString(user) + keyUserSWOPLocked)), 0) | |
51 | + | ||
52 | + | ||
53 | + | func getUserInterestInfo (user,lastInterest) = { | |
54 | + | let userSWOPAmount = getUserSWOPLocked(user) | |
55 | + | let userLastInterest = getInteger(SWOPgovernanceAdr, (toString(user) + keyUserLastInterest)) | |
56 | + | let userLastInterestValue = match userLastInterest { | |
57 | + | case userLastInterest: Int => | |
58 | + | userLastInterest | |
59 | + | case _ => | |
60 | + | lastInterest | |
61 | + | } | |
62 | + | $Tuple2(userLastInterestValue, userSWOPAmount) | |
63 | + | } | |
64 | + | ||
65 | + | ||
66 | + | func claimCalc (caller) = { | |
67 | + | let lastInterest = getLastInterestInfo() | |
68 | + | let uifo = getUserInterestInfo(caller, lastInterest) | |
69 | + | let userLastInterest = uifo._1 | |
70 | + | let userSWOPLocked = uifo._2 | |
71 | + | let claimAmount = fraction(userSWOPLocked, (lastInterest - userLastInterest), scaleValue) | |
72 | + | let userNewInterest = lastInterest | |
73 | + | $Tuple2(userNewInterest, claimAmount) | |
74 | + | } | |
75 | + | ||
76 | + | ||
77 | + | @Callable(i) | |
78 | + | func governanceLockSWOP () = if (!(if (isProtocolActive) | |
79 | + | then isDappActive | |
80 | + | else false)) | |
81 | + | then throw("Protol stopped by admin") | |
82 | + | else { | |
83 | + | let $t031043179 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
84 | + | let pmtAmount = $t031043179._1 | |
85 | + | let pmtAssetId = $t031043179._2 | |
86 | + | if ((pmtAssetId != SWOP)) | |
87 | + | then throw("Only SWOP payment available in governanceLockSWOP()") | |
88 | + | else { | |
89 | + | let z = invoke(SWOPgovernanceAdr, "lockSWOP", nil, [AttachedPayment(SWOP, pmtAmount)]) | |
90 | + | if ((z == z)) | |
91 | + | then nil | |
92 | + | else throw("Strict value is not equal to itself.") | |
93 | + | } | |
94 | + | } | |
95 | + | ||
96 | + | ||
97 | + | ||
98 | + | @Callable(i) | |
99 | + | func governanceClaimAndStake (minSWOPreward) = if (!(if (isProtocolActive) | |
100 | + | then isDappActive | |
101 | + | else false)) | |
102 | + | then throw("Protol stopped by admin") | |
103 | + | else if (if ((i.caller != owner)) | |
104 | + | then !(containsElement(consumers, toBase58String(i.caller.bytes))) | |
105 | + | else false) | |
106 | + | then throw("Only owner or admin can call this function") | |
107 | + | else { | |
108 | + | let claimAmount = claimCalc(this)._2 | |
109 | + | if ((minSWOPreward > claimAmount)) | |
110 | + | then throw("Amount to claim is less than minSWOPreward") | |
111 | + | else { | |
112 | + | let isFeeExtract = if ((i.caller == owner)) | |
113 | + | then false | |
114 | + | else true | |
115 | + | if (isFeeExtract) | |
116 | + | then { | |
117 | + | let z = invoke(SWOPgovernanceAdr, "claimAndStakeSWOP", nil, nil) | |
118 | + | if ((z == z)) | |
119 | + | then { | |
120 | + | let y = invoke(balance, "extractFee", nil, nil) | |
121 | + | if ((y == y)) | |
122 | + | then nil | |
123 | + | else throw("Strict value is not equal to itself.") | |
124 | + | } | |
125 | + | else throw("Strict value is not equal to itself.") | |
126 | + | } | |
127 | + | else { | |
128 | + | let z = invoke(SWOPgovernanceAdr, "claimAndStakeSWOP", nil, nil) | |
129 | + | if ((z == z)) | |
130 | + | then nil | |
131 | + | else throw("Strict value is not equal to itself.") | |
132 | + | } | |
133 | + | } | |
134 | + | } | |
135 | + | ||
136 | + | ||
137 | + | ||
138 | + | @Callable(i) | |
139 | + | func governanceWithdraw (amtToWithdraw) = if (!(if (isProtocolActive) | |
140 | + | then isDappActive | |
141 | + | else false)) | |
142 | + | then throw("Protol stopped by admin") | |
143 | + | else if ((i.caller != owner)) | |
144 | + | then throw("Only owner can call this function") | |
145 | + | else { | |
146 | + | let z = invoke(SWOPgovernanceAdr, "withdrawSWOP", [amtToWithdraw], nil) | |
147 | + | if ((z == z)) | |
148 | + | then [ScriptTransfer(i.caller, amtToWithdraw, SWOP)] | |
149 | + | else throw("Strict value is not equal to itself.") | |
150 | + | } | |
151 | + | ||
152 | + | ||
153 | + | ||
154 | + | @Callable(i) | |
155 | + | func shutdownDapp () = if (!(if (isProtocolActive) | |
156 | + | then isDappActive | |
157 | + | else false)) | |
158 | + | then throw("Protol stopped by admin") | |
159 | + | else if (if (!(containsElement([admin1, admin2, admin3, admin4, admin5, owner], i.caller))) | |
160 | + | then !(containsElement(consumers, toBase58String(i.caller.bytes))) | |
161 | + | else false) | |
162 | + | then throw("Only admin can call this function") | |
163 | + | else [BooleanEntry("is_dapp_active", false)] | |
164 | + | ||
165 | + | ||
166 | + | @Verifier(tx) | |
167 | + | func verify () = { | |
168 | + | let admin1Signed = if (valueOrElse(getBoolean(admin1, toBase58String(tx.id)), false)) | |
169 | + | then 1 | |
170 | + | else 0 | |
171 | + | let admin2Signed = if (valueOrElse(getBoolean(admin2, toBase58String(tx.id)), false)) | |
172 | + | then 1 | |
173 | + | else 0 | |
174 | + | let admin3Signed = if (valueOrElse(getBoolean(admin3, toBase58String(tx.id)), false)) | |
175 | + | then 1 | |
176 | + | else 0 | |
177 | + | let admin4Signed = if (valueOrElse(getBoolean(admin4, toBase58String(tx.id)), false)) | |
178 | + | then 1 | |
179 | + | else 0 | |
180 | + | let admin5Signed = if (valueOrElse(getBoolean(admin5, toBase58String(tx.id)), false)) | |
181 | + | then 1 | |
182 | + | else 0 | |
183 | + | (((((admin1Signed + admin2Signed) + admin3Signed) + admin4Signed) + admin5Signed) >= 3) | |
184 | + | } | |
185 | + |
github/deemru/w8io/169f3d6 23.11 ms ◑