tx · 6AS5FERdABoAXWfrDfj6B83ux8yAzaoifb4M86qrzB1U 3N1hTyhhE9qNA3tmeL3NgbNxNpfCPAPfCZQ: -0.01000000 Waves 2021.12.03 14:45 [1818051] smart account 3N1hTyhhE9qNA3tmeL3NgbNxNpfCPAPfCZQ > SELF 0.00000000 Waves
{ "type": 13, "id": "6AS5FERdABoAXWfrDfj6B83ux8yAzaoifb4M86qrzB1U", "fee": 1000000, "feeAssetId": null, "timestamp": 1638531976163, "version": 2, "chainId": 84, "sender": "3N1hTyhhE9qNA3tmeL3NgbNxNpfCPAPfCZQ", "senderPublicKey": "C35rdCLB4zCntaUWzb8FPSnZ1E6XzKXCqQsnsoq9rPtf", "proofs": [ "4F7QMz7JKevoASPDgpo7Rx5ebZNyXZBhHFJ7c4pTvyk6MPizh5vEYRau8FyrqzUyqa8yCxTiZWFj3UMEuJVxEWWk" ], "script": "base64:AAIFAAAAAAAAABIIAhIAEgASAwoBARIDCgEBEgAAAAAYAAAAAAZvcmFjbGUJAQAAAAdBZGRyZXNzAAAAAQEAAAAAAAAAAAdiYWxhbmNlCQEAAAARQGV4dHJOYXRpdmUoMTA2MikAAAABCQEAAAATdmFsdWVPckVycm9yTWVzc2FnZQAAAAIJAAQdAAAAAgUAAAAGb3JhY2xlAgAAAA9iYWxhbmNlX2FkZHJlc3MCAAAAGUVtcHR5IGtleSBiYWxhbmNlX2FkZHJlc3MAAAAAEVNXT1Bnb3Zlcm5hbmNlQWRyCQEAAAARQGV4dHJOYXRpdmUoMTA2MikAAAABCQEAAAATdmFsdWVPckVycm9yTWVzc2FnZQAAAAIJAAQdAAAAAgUAAAAGb3JhY2xlAgAAAA9zd29wX2dvdmVybmFuY2UCAAAAGUVtcHR5IGtleSBzd29wX2dvdmVybmFuY2UAAAAABFNXT1AJAAJZAAAAAQkBAAAAE3ZhbHVlT3JFcnJvck1lc3NhZ2UAAAACCQAEHQAAAAIFAAAABm9yYWNsZQIAAAAEU1dPUAIAAAAORW1wdHkga2V5IF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duZWQFAAAADGFkbWluNFNpZ25lZAUAAAAMYWRtaW41U2lnbmVkAAAAAAAAAAADmfvecA==", "height": 1818051, "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'') | |
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 keyOwner = "owner" | |
27 | + | ||
28 | + | let keyIsDappActive = "is_dapp_active" | |
29 | + | ||
30 | + | let isDappActive = valueOrErrorMessage(getBoolean(this, keyIsDappActive), "Empty key is_dapp_active") | |
31 | + | ||
32 | + | let ownerStr = valueOrErrorMessage(getString(this, keyOwner), "Empty keyOwner") | |
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 init () = if (!(isProtocolActive)) | |
79 | + | then throw("Protol stopped by admin") | |
80 | + | else if (isDefined(getString(this, keyOwner))) | |
81 | + | then throw("Automate already initialized") | |
82 | + | else if ((size(i.payments) == 0)) | |
83 | + | then [StringEntry(keyOwner, toString(i.caller)), BooleanEntry(keyIsDappActive, true)] | |
84 | + | else if ((size(i.payments) == 1)) | |
85 | + | then { | |
86 | + | let $t033763451 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
87 | + | let pmtAmount = $t033763451._1 | |
88 | + | let pmtAssetId = $t033763451._2 | |
89 | + | if ((pmtAssetId != SWOP)) | |
90 | + | then throw("Only SWOP payment available in init()") | |
91 | + | else { | |
92 | + | let z = invoke(SWOPgovernanceAdr, "lockSWOP", nil, [AttachedPayment(SWOP, pmtAmount)]) | |
93 | + | if ((z == z)) | |
94 | + | then [StringEntry(keyOwner, toString(i.caller)), BooleanEntry(keyIsDappActive, true)] | |
95 | + | else throw("Strict value is not equal to itself.") | |
96 | + | } | |
97 | + | } | |
98 | + | else throw("Incorrect paymemt. You should attach SWOP or empty payment") | |
99 | + | ||
100 | + | ||
101 | + | ||
102 | + | @Callable(i) | |
103 | + | func governanceLockSWOP () = if (!(if (isProtocolActive) | |
104 | + | then isDappActive | |
105 | + | else false)) | |
106 | + | then throw("Protol stopped by admin") | |
107 | + | else { | |
108 | + | let $t039984073 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
109 | + | let pmtAmount = $t039984073._1 | |
110 | + | let pmtAssetId = $t039984073._2 | |
111 | + | if ((pmtAssetId != SWOP)) | |
112 | + | then throw("Only SWOP payment available in governanceLockSWOP()") | |
113 | + | else { | |
114 | + | let z = invoke(SWOPgovernanceAdr, "lockSWOP", nil, [AttachedPayment(SWOP, pmtAmount)]) | |
115 | + | if ((z == z)) | |
116 | + | then nil | |
117 | + | else throw("Strict value is not equal to itself.") | |
118 | + | } | |
119 | + | } | |
120 | + | ||
121 | + | ||
122 | + | ||
123 | + | @Callable(i) | |
124 | + | func governanceClaimAndStake (minSWOPreward) = if (!(if (isProtocolActive) | |
125 | + | then isDappActive | |
126 | + | else false)) | |
127 | + | then throw("Protol stopped by admin") | |
128 | + | else if (if ((i.caller != owner)) | |
129 | + | then !(containsElement(consumers, toBase58String(i.caller.bytes))) | |
130 | + | else false) | |
131 | + | then throw("Only owner or admin can call this function") | |
132 | + | else { | |
133 | + | let claimAmount = claimCalc(this)._2 | |
134 | + | if ((minSWOPreward > claimAmount)) | |
135 | + | then throw("Amount to claim is less than minSWOPreward") | |
136 | + | else { | |
137 | + | let isFeeExtract = if ((i.caller == owner)) | |
138 | + | then false | |
139 | + | else true | |
140 | + | let z = invoke(SWOPgovernanceAdr, "claimAndStakeSWOP", nil, nil) | |
141 | + | if ((z == z)) | |
142 | + | then { | |
143 | + | let y = invoke(balance, "extractFee", [ownerStr, isFeeExtract], nil) | |
144 | + | if ((y == y)) | |
145 | + | then nil | |
146 | + | else throw("Strict value is not equal to itself.") | |
147 | + | } | |
148 | + | else throw("Strict value is not equal to itself.") | |
149 | + | } | |
150 | + | } | |
151 | + | ||
152 | + | ||
153 | + | ||
154 | + | @Callable(i) | |
155 | + | func governanceWithdraw (amtToWithdraw) = if (!(if (isProtocolActive) | |
156 | + | then isDappActive | |
157 | + | else false)) | |
158 | + | then throw("Protol stopped by admin") | |
159 | + | else if ((i.caller != owner)) | |
160 | + | then throw("Only owner can call this function") | |
161 | + | else { | |
162 | + | let z = invoke(SWOPgovernanceAdr, "withdrawSWOP", [amtToWithdraw], nil) | |
163 | + | if ((z == z)) | |
164 | + | then [ScriptTransfer(i.caller, amtToWithdraw, SWOP)] | |
165 | + | else throw("Strict value is not equal to itself.") | |
166 | + | } | |
167 | + | ||
168 | + | ||
169 | + | ||
170 | + | @Callable(i) | |
171 | + | func shutdownDapp () = if (!(if (isProtocolActive) | |
172 | + | then isDappActive | |
173 | + | else false)) | |
174 | + | then throw("Protol stopped by admin") | |
175 | + | else if (if (!(containsElement([admin1, admin2, admin3, admin4, admin5, owner], i.caller))) | |
176 | + | then !(containsElement(consumers, toBase58String(i.caller.bytes))) | |
177 | + | else false) | |
178 | + | then throw("Only admin can call this function") | |
179 | + | else [BooleanEntry("is_dapp_active", false)] | |
180 | + | ||
181 | + | ||
182 | + | @Verifier(tx) | |
183 | + | func verify () = { | |
184 | + | let admin1Signed = if (valueOrElse(getBoolean(admin1, toBase58String(tx.id)), false)) | |
185 | + | then 1 | |
186 | + | else 0 | |
187 | + | let admin2Signed = if (valueOrElse(getBoolean(admin2, toBase58String(tx.id)), false)) | |
188 | + | then 1 | |
189 | + | else 0 | |
190 | + | let admin3Signed = if (valueOrElse(getBoolean(admin3, toBase58String(tx.id)), false)) | |
191 | + | then 1 | |
192 | + | else 0 | |
193 | + | let admin4Signed = if (valueOrElse(getBoolean(admin4, toBase58String(tx.id)), false)) | |
194 | + | then 1 | |
195 | + | else 0 | |
196 | + | let admin5Signed = if (valueOrElse(getBoolean(admin5, toBase58String(tx.id)), false)) | |
197 | + | then 1 | |
198 | + | else 0 | |
199 | + | (((((admin1Signed + admin2Signed) + admin3Signed) + admin4Signed) + admin5Signed) >= 3) | |
200 | + | } | |
201 | + |
github/deemru/w8io/026f985 34.74 ms ◑