tx · Dc6tVkfcmwork6VoKeYhFCQfrRfj9GrrRwaiiuP1wk5f 3NCN1t9DS51CKN9z5XQk8JEVCoeLuWcB9Ta: -0.01500000 Waves 2023.07.19 14:44 [2672694] smart account 3NCN1t9DS51CKN9z5XQk8JEVCoeLuWcB9Ta > SELF 0.00000000 Waves
{ "type": 13, "id": "Dc6tVkfcmwork6VoKeYhFCQfrRfj9GrrRwaiiuP1wk5f", "fee": 1500000, "feeAssetId": null, "timestamp": 1689767114126, "version": 2, "chainId": 84, "sender": "3NCN1t9DS51CKN9z5XQk8JEVCoeLuWcB9Ta", "senderPublicKey": "51oZnGJdivhLJkVbeVYpbwM47gdGthajooUXKadNJCmv", "proofs": [ "4yjVgqCUXGkZ7QKxL8D37wva2y5rERWAwZ5na6uuu1NQWVa4zQw8sqgqWPDTtnVZufYZco413k6NbtNRq2TYuDZ6" ], "script": "base64:AAIFAAAAAAAAACUIAhIDCgEIEgASBAoCCAESAwoBCBIDCgEIEgASAwoBCBIDCgEIAAAAFgAAAAADU0VQAgAAAAJfXwEAAAATa2V5TWFuYWdlclB1YmxpY0tleQAAAAACAAAAFCVzX19tYW5hZ2VyUHVibGljS2V5AQAAABZrZXlNYW5hZ2VyVmF1bHRBZGRyZXNzAAAAAAIAAAAXJXNfX21hbmFnZXJWYXVsdEFkZHJlc3MBAAAAB2tleVVzZXIAAAABAAAAB2FkZHJlc3MJAAS5AAAAAgkABEwAAAACAgAAAAIlcwkABEwAAAACBQAAAAdhZGRyZXNzBQAAAANuaWwFAAAAA1NFUAEAAAAKa2V5UmV2b2tlZAAAAAEAAAAHYWRkcmVzcwkABLkAAAACCQAETAAAAAICAAAABCVzJXMJAARMAAAAAgIAAAAHcmV2b2tlZAkABEwAAAACBQAAAAdhZGRyZXNzBQAAAANuaWwFAAAAA1NFUAEAAAAPa2V5UmV2b2tlZFRvdGFsAAAAAAkABLkAAAACCQAETAAAAAICAAAAAiVzCQAETAAAAAICAAAADHJldm9rZWRUb3RhbAUAAAADb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kZHJlc3MJAARMAAAAAgkBAAAABXZhbHVlAAAAAQkABB8AAAABCQEAAAARa2V5VXNlclZlc3RpbmdFbmQAAAABBQAAAAdhZGRyZXNzCQAETAAAAAIJAQAAABJnZXRVc2VyVG90YWxBbW91bnQAAAABBQAAAAdhZGRyZXNzCQAETAAAAAIJAQAAABRnZXRVc2VyQ2xhaW1lZEFtb3VudAAAAAEFAAAAB2FkZHJlc3MJAARMAAAAAgkBAAAAFmdldFVzZXJSZW1haW5pbmdBbW91bnQAAAABBQAAAAdhZGRyZXNzCQAETAAAAAIJAQAAABNhdmFpbGFibGVUb0NsYWltTm93AAAAAQUAAAAHYWRkcmVzcwUAAAADbmlsAAAAAQAAAAJ0eAEAAAAGdmVyaWZ5AAAAAAQAAAAPdGFyZ2V0UHVibGljS2V5BAAAAAckbWF0Y2gwCQEAAAAWbWFuYWdlclB1YmxpY0tleU9yVW5pdAAAAAADCQAAAQAAAAIFAAAAByRtYXRjaDACAAAACkJ5dGVWZWN0b3IEAAAAAnBrBQAAAAckbWF0Y2gwBQAAAAJwawMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAEVW5pdAgFAAAAAnR4AAAAD3NlbmRlclB1YmxpY0tleQkAAAIAAAABAgAAAAtNYXRjaCBlcnJvcgkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAFAAAAD3RhcmdldFB1YmxpY0tleRlypHU=", "height": 2672694, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: Aeqkyn2MPJEmnhtmvYzqe6NG17iU6oygrwd6xPfk5C5E Next: none Diff:
Old | New | Differences | |
---|---|---|---|
6 | 6 | func keyManagerPublicKey () = "%s__managerPublicKey" | |
7 | 7 | ||
8 | 8 | ||
9 | - | func | |
9 | + | func keyManagerVaultAddress () = "%s__managerVaultAddress" | |
10 | 10 | ||
11 | 11 | ||
12 | 12 | func keyUser (address) = makeString(["%s", address], SEP) | |
30 | 30 | func keyWxAssetId () = makeString(["%s", "wxAssetId"], SEP) | |
31 | 31 | ||
32 | 32 | ||
33 | + | func getManagerVaultAddressOrThis () = match getString(keyManagerVaultAddress()) { | |
34 | + | case s: String => | |
35 | + | addressFromStringValue(s) | |
36 | + | case _ => | |
37 | + | this | |
38 | + | } | |
39 | + | ||
40 | + | ||
33 | 41 | func throwErr (msg) = throw(makeString(["vesting.ride:", msg], " ")) | |
34 | 42 | ||
35 | 43 | ||
36 | - | func managerPublicKeyOrUnit () = match getString(keyManagerPublicKey()) { | |
37 | - | case s: String => | |
38 | - | fromBase58String(s) | |
39 | - | case _: Unit => | |
40 | - | unit | |
41 | - | case _ => | |
42 | - | throw("Match error") | |
43 | - | } | |
44 | - | ||
45 | - | ||
46 | - | func pendingManagerPublicKeyOrUnit () = match getString(keyPendingManagerPublicKey()) { | |
47 | - | case s: String => | |
48 | - | fromBase58String(s) | |
49 | - | case _: Unit => | |
50 | - | unit | |
51 | - | case _ => | |
52 | - | throw("Match error") | |
53 | - | } | |
44 | + | func managerPublicKeyOrUnit () = { | |
45 | + | let managerVaultAddress = getManagerVaultAddressOrThis() | |
46 | + | match getString(managerVaultAddress, keyManagerPublicKey()) { | |
47 | + | case s: String => | |
48 | + | fromBase58String(s) | |
49 | + | case _: Unit => | |
50 | + | unit | |
51 | + | case _ => | |
52 | + | throw("Match error") | |
53 | + | } | |
54 | + | } | |
54 | 55 | ||
55 | 56 | ||
56 | 57 | func mustManager (i) = { | |
250 | 251 | func stats (address) = $Tuple2(nil, [value(getInteger(keyUserVestingStart(address))), value(getInteger(keyUserVestingEnd(address))), getUserTotalAmount(address), getUserClaimedAmount(address), getUserRemainingAmount(address), availableToClaimNow(address)]) | |
251 | 252 | ||
252 | 253 | ||
253 | - | ||
254 | - | @Callable(i) | |
255 | - | func setManager (pendingManagerPublicKey) = { | |
256 | - | let checkCaller = mustManager(i) | |
257 | - | if ((checkCaller == checkCaller)) | |
258 | - | then { | |
259 | - | let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey) | |
260 | - | if ((checkManagerPublicKey == checkManagerPublicKey)) | |
261 | - | then [StringEntry(keyPendingManagerPublicKey(), pendingManagerPublicKey)] | |
262 | - | else throw("Strict value is not equal to itself.") | |
263 | - | } | |
264 | - | else throw("Strict value is not equal to itself.") | |
265 | - | } | |
266 | - | ||
267 | - | ||
268 | - | ||
269 | - | @Callable(i) | |
270 | - | func confirmManager () = { | |
271 | - | let pm = pendingManagerPublicKeyOrUnit() | |
272 | - | let hasPM = if (isDefined(pm)) | |
273 | - | then true | |
274 | - | else throwErr("no pending manager") | |
275 | - | if ((hasPM == hasPM)) | |
276 | - | then { | |
277 | - | let checkPM = if ((i.callerPublicKey == value(pm))) | |
278 | - | then true | |
279 | - | else throwErr("you are not pending manager") | |
280 | - | if ((checkPM == checkPM)) | |
281 | - | then [StringEntry(keyManagerPublicKey(), toBase58String(value(pm))), DeleteEntry(keyPendingManagerPublicKey())] | |
282 | - | else throw("Strict value is not equal to itself.") | |
283 | - | } | |
284 | - | else throw("Strict value is not equal to itself.") | |
285 | - | } | |
286 | - | ||
287 | - | ||
288 | 254 | @Verifier(tx) | |
289 | 255 | func verify () = { | |
290 | 256 | let targetPublicKey = match managerPublicKeyOrUnit() { |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let SEP = "__" | |
5 | 5 | ||
6 | 6 | func keyManagerPublicKey () = "%s__managerPublicKey" | |
7 | 7 | ||
8 | 8 | ||
9 | - | func | |
9 | + | func keyManagerVaultAddress () = "%s__managerVaultAddress" | |
10 | 10 | ||
11 | 11 | ||
12 | 12 | func keyUser (address) = makeString(["%s", address], SEP) | |
13 | 13 | ||
14 | 14 | ||
15 | 15 | func keyRevoked (address) = makeString(["%s%s", "revoked", address], SEP) | |
16 | 16 | ||
17 | 17 | ||
18 | 18 | func keyRevokedTotal () = makeString(["%s", "revokedTotal"], SEP) | |
19 | 19 | ||
20 | 20 | ||
21 | 21 | func keyUserVestingStart (address) = makeString(["%s%s", "vestingStart", address], SEP) | |
22 | 22 | ||
23 | 23 | ||
24 | 24 | func keyUserVestingEnd (address) = makeString(["%s%s", "vestingEnd", address], SEP) | |
25 | 25 | ||
26 | 26 | ||
27 | 27 | func keyUserAmountPerBlock (address) = makeString(["%s%s", "amountPerBlock", address], SEP) | |
28 | 28 | ||
29 | 29 | ||
30 | 30 | func keyWxAssetId () = makeString(["%s", "wxAssetId"], SEP) | |
31 | 31 | ||
32 | 32 | ||
33 | + | func getManagerVaultAddressOrThis () = match getString(keyManagerVaultAddress()) { | |
34 | + | case s: String => | |
35 | + | addressFromStringValue(s) | |
36 | + | case _ => | |
37 | + | this | |
38 | + | } | |
39 | + | ||
40 | + | ||
33 | 41 | func throwErr (msg) = throw(makeString(["vesting.ride:", msg], " ")) | |
34 | 42 | ||
35 | 43 | ||
36 | - | func managerPublicKeyOrUnit () = match getString(keyManagerPublicKey()) { | |
37 | - | case s: String => | |
38 | - | fromBase58String(s) | |
39 | - | case _: Unit => | |
40 | - | unit | |
41 | - | case _ => | |
42 | - | throw("Match error") | |
43 | - | } | |
44 | - | ||
45 | - | ||
46 | - | func pendingManagerPublicKeyOrUnit () = match getString(keyPendingManagerPublicKey()) { | |
47 | - | case s: String => | |
48 | - | fromBase58String(s) | |
49 | - | case _: Unit => | |
50 | - | unit | |
51 | - | case _ => | |
52 | - | throw("Match error") | |
53 | - | } | |
44 | + | func managerPublicKeyOrUnit () = { | |
45 | + | let managerVaultAddress = getManagerVaultAddressOrThis() | |
46 | + | match getString(managerVaultAddress, keyManagerPublicKey()) { | |
47 | + | case s: String => | |
48 | + | fromBase58String(s) | |
49 | + | case _: Unit => | |
50 | + | unit | |
51 | + | case _ => | |
52 | + | throw("Match error") | |
53 | + | } | |
54 | + | } | |
54 | 55 | ||
55 | 56 | ||
56 | 57 | func mustManager (i) = { | |
57 | 58 | let pd = throwErr("permission denied") | |
58 | 59 | match managerPublicKeyOrUnit() { | |
59 | 60 | case pk: ByteVector => | |
60 | 61 | if ((i.callerPublicKey == pk)) | |
61 | 62 | then true | |
62 | 63 | else pd | |
63 | 64 | case _: Unit => | |
64 | 65 | if ((i.caller == this)) | |
65 | 66 | then true | |
66 | 67 | else pd | |
67 | 68 | case _ => | |
68 | 69 | throw("Match error") | |
69 | 70 | } | |
70 | 71 | } | |
71 | 72 | ||
72 | 73 | ||
73 | 74 | func valueUserS (totalAmount,remainingAmount,claimedWXAmount,lastClaimedHeight) = makeString(["%d%d%d%d%d", totalAmount, remainingAmount, "0", claimedWXAmount, lastClaimedHeight], SEP) | |
74 | 75 | ||
75 | 76 | ||
76 | 77 | func valueUser (totalAmount,remainingAmount,claimedWXAmount,lastClaimedHeight) = valueUserS(toString(totalAmount), toString(remainingAmount), toString(claimedWXAmount), toString(lastClaimedHeight)) | |
77 | 78 | ||
78 | 79 | ||
79 | 80 | func getUserTotalAmount (address) = parseIntValue(split(value(getString(keyUser(address))), SEP)[1]) | |
80 | 81 | ||
81 | 82 | ||
82 | 83 | func getUserRemainingAmount (address) = parseIntValue(split(value(getString(keyUser(address))), SEP)[2]) | |
83 | 84 | ||
84 | 85 | ||
85 | 86 | func getUserClaimedAmount (address) = parseIntValue(split(value(getString(keyUser(address))), SEP)[3]) | |
86 | 87 | ||
87 | 88 | ||
88 | 89 | func getUserLastClaimedHeight (address) = parseIntValue(split(value(getString(keyUser(address))), SEP)[5]) | |
89 | 90 | ||
90 | 91 | ||
91 | 92 | func availableToClaimNow (address) = { | |
92 | 93 | let isRevokedUser = valueOrElse(getBoolean(keyRevoked(address)), false) | |
93 | 94 | if (isRevokedUser) | |
94 | 95 | then getUserRemainingAmount(address) | |
95 | 96 | else { | |
96 | 97 | let lastHeight = getUserLastClaimedHeight(address) | |
97 | 98 | if ((lastHeight >= height)) | |
98 | 99 | then 0 | |
99 | 100 | else { | |
100 | 101 | let end = value(getInteger(keyUserVestingEnd(address))) | |
101 | 102 | if ((height > end)) | |
102 | 103 | then getUserRemainingAmount(address) | |
103 | 104 | else { | |
104 | 105 | let unclaimedPeriod = (height - lastHeight) | |
105 | 106 | (value(getInteger(keyUserAmountPerBlock(address))) * unclaimedPeriod) | |
106 | 107 | } | |
107 | 108 | } | |
108 | 109 | } | |
109 | 110 | } | |
110 | 111 | ||
111 | 112 | ||
112 | 113 | func claimInternal (address) = { | |
113 | 114 | let addr = addressFromStringValue(address) | |
114 | 115 | let wx = fromBase58String(value(getString(keyWxAssetId()))) | |
115 | 116 | let amount = availableToClaimNow(address) | |
116 | 117 | let ensureAmount = if ((amount != 0)) | |
117 | 118 | then true | |
118 | 119 | else throwErr("nothing to claim") | |
119 | 120 | if ((ensureAmount == ensureAmount)) | |
120 | 121 | then { | |
121 | 122 | let totalAmount = getUserTotalAmount(address) | |
122 | 123 | let remainingAmount = getUserRemainingAmount(address) | |
123 | 124 | let claimedWXAmount = getUserClaimedAmount(address) | |
124 | 125 | let isRevokedUser = valueOrElse(getBoolean(keyRevoked(address)), false) | |
125 | 126 | if (isRevokedUser) | |
126 | 127 | then [ScriptTransfer(addr, remainingAmount, wx), StringEntry(keyUser(address), valueUser(totalAmount, 0, (claimedWXAmount + remainingAmount), height))] | |
127 | 128 | else [ScriptTransfer(addr, amount, wx), StringEntry(keyUser(address), valueUser(totalAmount, (remainingAmount - amount), (claimedWXAmount + amount), height))] | |
128 | 129 | } | |
129 | 130 | else throw("Strict value is not equal to itself.") | |
130 | 131 | } | |
131 | 132 | ||
132 | 133 | ||
133 | 134 | @Callable(i) | |
134 | 135 | func constructor (wxAssetId) = { | |
135 | 136 | let check = mustManager(i) | |
136 | 137 | if ((check == check)) | |
137 | 138 | then [StringEntry(keyWxAssetId(), wxAssetId)] | |
138 | 139 | else throw("Strict value is not equal to itself.") | |
139 | 140 | } | |
140 | 141 | ||
141 | 142 | ||
142 | 143 | ||
143 | 144 | @Callable(i) | |
144 | 145 | func withdrawRevoked () = { | |
145 | 146 | let amount = valueOrElse(getInteger(keyRevokedTotal()), 0) | |
146 | 147 | let wx = fromBase58String(value(getString(keyWxAssetId()))) | |
147 | 148 | let checks = [mustManager(i), if ((amount > 0)) | |
148 | 149 | then true | |
149 | 150 | else throwErr("revoked amount is zero, nothing to withdraw")] | |
150 | 151 | if ((checks == checks)) | |
151 | 152 | then [ScriptTransfer(i.caller, amount, wx), IntegerEntry(keyRevokedTotal(), 0)] | |
152 | 153 | else throw("Strict value is not equal to itself.") | |
153 | 154 | } | |
154 | 155 | ||
155 | 156 | ||
156 | 157 | ||
157 | 158 | @Callable(i) | |
158 | 159 | func createDepositFor (address,blocksDuration) = { | |
159 | 160 | let amount = i.payments[0].amount | |
160 | 161 | let endHeight = (height + blocksDuration) | |
161 | 162 | let vestingLen = (endHeight - height) | |
162 | 163 | let amountPerBlock = (amount / vestingLen) | |
163 | 164 | let checks = [if ((endHeight > height)) | |
164 | 165 | then true | |
165 | 166 | else throwErr("endHeight must be more than height"), if ((getString(keyUser(address)) == unit)) | |
166 | 167 | then true | |
167 | 168 | else throwErr("deposit for user already exists"), if ((toBase58String(value(i.payments[0].assetId)) == value(getString(keyWxAssetId())))) | |
168 | 169 | then true | |
169 | 170 | else throwErr("attached payment is not WX"), if ((amountPerBlock != 0)) | |
170 | 171 | then true | |
171 | 172 | else throwErr("attached amount too small or blocksDuration too large — will claimed zero per block")] | |
172 | 173 | if ((checks == checks)) | |
173 | 174 | then [StringEntry(keyUser(address), valueUser(amount, amount, 0, height)), IntegerEntry(keyUserVestingStart(address), height), IntegerEntry(keyUserVestingEnd(address), endHeight), IntegerEntry(keyUserAmountPerBlock(address), amountPerBlock)] | |
174 | 175 | else throw("Strict value is not equal to itself.") | |
175 | 176 | } | |
176 | 177 | ||
177 | 178 | ||
178 | 179 | ||
179 | 180 | @Callable(i) | |
180 | 181 | func increaseDepositFor (address) = { | |
181 | 182 | let availableToClaim = availableToClaimNow(address) | |
182 | 183 | let forceClaim = if ((availableToClaim > 0)) | |
183 | 184 | then claimInternal(address) | |
184 | 185 | else unit | |
185 | 186 | if ((forceClaim == forceClaim)) | |
186 | 187 | then { | |
187 | 188 | let amount = i.payments[0].amount | |
188 | 189 | let endHeight = value(getInteger(keyUserVestingEnd(address))) | |
189 | 190 | let vestingLen = (endHeight - height) | |
190 | 191 | let amountPerBlock = value(getInteger(keyUserAmountPerBlock(address))) | |
191 | 192 | let incAmountPerBlock = (amount / vestingLen) | |
192 | 193 | let userTotalAmount = getUserTotalAmount(address) | |
193 | 194 | let userRemainingAmount = getUserRemainingAmount(address) | |
194 | 195 | let userClaimedAmount = getUserClaimedAmount(address) | |
195 | 196 | let userLastClaimedHeight = getUserLastClaimedHeight(address) | |
196 | 197 | let checks = [if ((valueOrElse(getBoolean(keyRevoked(address)), false) == false)) | |
197 | 198 | then true | |
198 | 199 | else throwErr("deposit for user is revoked"), if ((getString(keyUser(address)) != unit)) | |
199 | 200 | then true | |
200 | 201 | else throwErr("deposit for user doesn't exists"), if ((toBase58String(value(i.payments[0].assetId)) == value(getString(keyWxAssetId())))) | |
201 | 202 | then true | |
202 | 203 | else throwErr("attached payment is not WX"), if ((incAmountPerBlock != 0)) | |
203 | 204 | then true | |
204 | 205 | else throwErr("attached amount too small — increase is zero per block")] | |
205 | 206 | if ((checks == checks)) | |
206 | 207 | then [StringEntry(keyUser(address), valueUser((userTotalAmount + amount), (userRemainingAmount + amount), userClaimedAmount, userLastClaimedHeight)), IntegerEntry(keyUserAmountPerBlock(address), (amountPerBlock + incAmountPerBlock))] | |
207 | 208 | else throw("Strict value is not equal to itself.") | |
208 | 209 | } | |
209 | 210 | else throw("Strict value is not equal to itself.") | |
210 | 211 | } | |
211 | 212 | ||
212 | 213 | ||
213 | 214 | ||
214 | 215 | @Callable(i) | |
215 | 216 | func revokeDepositFor (address) = { | |
216 | 217 | let totalAmount = getUserTotalAmount(address) | |
217 | 218 | let remainingAmount = getUserRemainingAmount(address) | |
218 | 219 | let claimedWXAmount = getUserClaimedAmount(address) | |
219 | 220 | let lastClaimedHeight = getUserLastClaimedHeight(address) | |
220 | 221 | let unclaimedAmountNow = availableToClaimNow(address) | |
221 | 222 | let revokedTotal = valueOrElse(getInteger(keyRevokedTotal()), 0) | |
222 | 223 | let amountToRevoke = (remainingAmount - unclaimedAmountNow) | |
223 | 224 | let newRevokedTotal = (revokedTotal + amountToRevoke) | |
224 | 225 | let checks = [mustManager(i), if ((getString(keyUser(address)) != unit)) | |
225 | 226 | then true | |
226 | 227 | else throwErr("deposit for user is not exists"), if ((newRevokedTotal > revokedTotal)) | |
227 | 228 | then true | |
228 | 229 | else throwErr("newRevokedTotal can't be less or equal than revokedTotal")] | |
229 | 230 | if ((checks == checks)) | |
230 | 231 | then [BooleanEntry(keyRevoked(address), true), IntegerEntry(keyRevokedTotal(), newRevokedTotal), StringEntry(keyUser(address), valueUser(totalAmount, unclaimedAmountNow, claimedWXAmount, lastClaimedHeight))] | |
231 | 232 | else throw("Strict value is not equal to itself.") | |
232 | 233 | } | |
233 | 234 | ||
234 | 235 | ||
235 | 236 | ||
236 | 237 | @Callable(i) | |
237 | 238 | func claim () = claimInternal(toBase58String(i.caller.bytes)) | |
238 | 239 | ||
239 | 240 | ||
240 | 241 | ||
241 | 242 | @Callable(i) | |
242 | 243 | func claimREADONLY (address) = { | |
243 | 244 | let amount = availableToClaimNow(address) | |
244 | 245 | $Tuple2(nil, amount) | |
245 | 246 | } | |
246 | 247 | ||
247 | 248 | ||
248 | 249 | ||
249 | 250 | @Callable(i) | |
250 | 251 | func stats (address) = $Tuple2(nil, [value(getInteger(keyUserVestingStart(address))), value(getInteger(keyUserVestingEnd(address))), getUserTotalAmount(address), getUserClaimedAmount(address), getUserRemainingAmount(address), availableToClaimNow(address)]) | |
251 | 252 | ||
252 | 253 | ||
253 | - | ||
254 | - | @Callable(i) | |
255 | - | func setManager (pendingManagerPublicKey) = { | |
256 | - | let checkCaller = mustManager(i) | |
257 | - | if ((checkCaller == checkCaller)) | |
258 | - | then { | |
259 | - | let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey) | |
260 | - | if ((checkManagerPublicKey == checkManagerPublicKey)) | |
261 | - | then [StringEntry(keyPendingManagerPublicKey(), pendingManagerPublicKey)] | |
262 | - | else throw("Strict value is not equal to itself.") | |
263 | - | } | |
264 | - | else throw("Strict value is not equal to itself.") | |
265 | - | } | |
266 | - | ||
267 | - | ||
268 | - | ||
269 | - | @Callable(i) | |
270 | - | func confirmManager () = { | |
271 | - | let pm = pendingManagerPublicKeyOrUnit() | |
272 | - | let hasPM = if (isDefined(pm)) | |
273 | - | then true | |
274 | - | else throwErr("no pending manager") | |
275 | - | if ((hasPM == hasPM)) | |
276 | - | then { | |
277 | - | let checkPM = if ((i.callerPublicKey == value(pm))) | |
278 | - | then true | |
279 | - | else throwErr("you are not pending manager") | |
280 | - | if ((checkPM == checkPM)) | |
281 | - | then [StringEntry(keyManagerPublicKey(), toBase58String(value(pm))), DeleteEntry(keyPendingManagerPublicKey())] | |
282 | - | else throw("Strict value is not equal to itself.") | |
283 | - | } | |
284 | - | else throw("Strict value is not equal to itself.") | |
285 | - | } | |
286 | - | ||
287 | - | ||
288 | 254 | @Verifier(tx) | |
289 | 255 | func verify () = { | |
290 | 256 | let targetPublicKey = match managerPublicKeyOrUnit() { | |
291 | 257 | case pk: ByteVector => | |
292 | 258 | pk | |
293 | 259 | case _: Unit => | |
294 | 260 | tx.senderPublicKey | |
295 | 261 | case _ => | |
296 | 262 | throw("Match error") | |
297 | 263 | } | |
298 | 264 | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
299 | 265 | } | |
300 | 266 |
github/deemru/w8io/169f3d6 45.73 ms ◑