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