tx · At81sqW6Btc8hgNYyBLZ3bBcMi4VH7LGchD1HQhYCjrX 3N8g272Yu4uyDrof1aK4vVCuYLkab5ki8v5: -0.01000000 Waves 2021.12.06 14:55 [1822366] smart account 3N8g272Yu4uyDrof1aK4vVCuYLkab5ki8v5 > SELF 0.00000000 Waves
{ "type": 13, "id": "At81sqW6Btc8hgNYyBLZ3bBcMi4VH7LGchD1HQhYCjrX", "fee": 1000000, "feeAssetId": null, "timestamp": 1638791720743, "version": 1, "sender": "3N8g272Yu4uyDrof1aK4vVCuYLkab5ki8v5", "senderPublicKey": "CK1DzJrcDSodxy99h6mWF6gnbKKKRH3BRVyXaJj3tFFJ", "proofs": [ "41N64bDenLTWKB8Hqus2WtXN4ZvLztg1Xqfgfb2RbQM75FSRQmDarWq3Qi8sUjAuy2yaEGGyPGqtSvYZFh7FFr6s" ], "script": "base64:AAIFAAAAAAAAA5gIAhIAEgMKAQESAwoBARIAGgwKAmExEgZvcmFjbGUaDQoCYTISB2JhbGFuY2UaFwoCYTMSEVNXT1Bnb3Zlcm5hbmNlQWRyGgoKAmE0EgRTV09QGg8KAmE1Egljb25zdW1lcnMaDAoCYTYSBmFkbWluMRoMCgJhNxIGYWRtaW4yGgwKAmE4EgZhZG1pbjMaDAoCYTkSBmFkbWluNBoMCgJiMRIGYWRtaW41GhYKAmIyEhBpc1Byb3RvY29sQWN0aXZlGhUKAmIzEg9rZXlJc0RhcHBBY3RpdmUaFgoCYjQSEGtleUF1dG9tYXRlT3duZXIaEgoCYjUSDGlzRGFwcEFjdGl2ZRoOCgJiNhIIb3duZXJTdHIaCwoCYjcSBW93bmVyGhUKAmI4Eg9rZXlMYXN0SW50ZXJlc3QaFwoCYjkSEWtleVVzZXJTV09QTG9ja2VkGhkKAmMxEhNrZXlVc2VyTGFzdEludGVyZXN0GhAKAmMyEgpzY2FsZVZhbHVlGhkKAmMzEhNnZXRMYXN0SW50ZXJlc3RJbmZvGhIKAmM0EgxsYXN0SW50ZXJlc3QaFwoCY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bAAAAAgUAAAACYTcJAAJYAAAAAQgFAAAAAnR4AAAAAmlkBwAAAAAAAAAAAQAAAAAAAAAAAAQAAAACZTkDCQEAAAALdmFsdWVPckVsc2UAAAACCQAEGwAAAAIFAAAAAmE4CQACWAAAAAEIBQAAAAJ0eAAAAAJpZAcAAAAAAAAAAAEAAAAAAAAAAAAEAAAAAmYxAwkBAAAAC3ZhbHVlT3JFbHNlAAAAAgkABBsAAAACBQAAAAJhOQkAAlgAAAABCAUAAAACdHgAAAACaWQHAAAAAAAAAAABAAAAAAAAAAAABAAAAAJmMgMJAQAAAAt2YWx1ZU9yRWxzZQAAAAIJAAQbAAAAAgUAAAACYjEJAAJYAAAAAQgFAAAAAnR4AAAAAmlkBwAAAAAAAAAAAQAAAAAAAAAAAAkAAGcAAAACCQAAZAAAAAIJAABkAAAAAgkAAGQAAAACCQAAZAAAAAIFAAAAAmU3BQAAAAJlOAUAAAACZTkFAAAAAmYxBQAAAAJmMgAAAAAAAAAAAz8y1WM=", "chainId": 84, "height": 1822366, "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'3N1TEBibttEvU2xGjSGbgtDbsWYetiKsY5P') | |
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/026f985 45.69 ms ◑