tx · 3UKHsdkxXxJbHrvg2UYRqUCd8wu4443LsRP1Fh1mUDjK 3Muw1aRbeKgLqAS264AakECyQAvDsnweHLu: -0.01800000 Waves 2022.06.09 11:19 [2088582] smart account 3Muw1aRbeKgLqAS264AakECyQAvDsnweHLu > SELF 0.00000000 Waves
{ "type": 13, "id": "3UKHsdkxXxJbHrvg2UYRqUCd8wu4443LsRP1Fh1mUDjK", "fee": 1800000, "feeAssetId": null, "timestamp": 1654762877817, "version": 1, "sender": "3Muw1aRbeKgLqAS264AakECyQAvDsnweHLu", "senderPublicKey": "668WwQVaWxezbvLEK3FccCSTbjst4zYAJDPrfLFRj9b9", "proofs": [ "4EPB6sRT4u5QLLseuEaoEU8zzitU87LCqMq1nn5jkczSBnYRGEQrBocr1NkmQuD37LQpkGHbErGHCfNTGHzU7QEM" ], "script": "base64:AAIFAAAAAAAAACwIAhIDCgEIEgASABIFCgMICAgSCQoHCAgICAEIARIAEgQKAggIEgMKAQgSAAAAABcAAAAAA1NFUAIAAAACX18AAAAABUVNUFRZAgAAAAAAAAAACGNvbnRyYWN0AgAAAA9scF9zdGFraW5nX3YyOiABAAAAE2tleU1hbmFnZXJQdWJsaWNLZXkAAAAACQAEuQAAAAIJAARMAAAAAgIAAAACJXMJAARMAAAAAgIAAAAQbWFuYWdlclB1YmxpY0tleQUAAAADbmlsBQAAAANTRVABAAAAGmtleVBlbmRpbmdNYW5hZ2VyUHVibGljS2V5AAAAAAkABLkAAAACCQAETAAAAAICAAAAAiVzCQAETAAAAAICAAAAF3BlbmRpbmdNYW5hZ2VyUHVibGljS2V5BQAAAANuaWwFAAAAA1NFUAEAAAAGa2V5VFZMAAAAAQAAAAdhc3NldElkCQAEuQAAAAIJAARMAAAAAgIAAAAEJXMlcwkABEwAAAACAgAAAAN0dmwJAARMAAAAAgUAAAAHYXNzZXRJZAUAAAADbmlsBQAAAANTRVABAAAADWtleVRWTEhpc3RvcnkAAAACAAAAB2Fzc2V0SWQAAAAGaGVpZ2h0CQA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VyUHVibGljS2V5AAAAAAUAAAADbmlsCQAAAgAAAAECAAAAJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgkAAAIAAAABAgAAACRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4AAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAABAAAAA90YXJnZXRQdWJsaWNLZXkEAAAAByRtYXRjaDAJAQAAABZtYW5hZ2VyUHVibGljS2V5T3JVbml0AAAAAAMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAKQnl0ZVZlY3RvcgQAAAACcGsFAAAAByRtYXRjaDAFAAAAAnBrAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAARVbml0CAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V5CQAAAgAAAAECAAAAC01hdGNoIGVycm9yCQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAUAAAAPdGFyZ2V0UHVibGljS2V5ZxtqPg==", "chainId": 84, "height": 2088582, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 6sPeaTDqUhQpwXGNvnYT6n6xbuAnYxreRmSWLoseSPUw Next: 83rrYT3m2RtbbcvcoNRpRfxW23gZamgXrWz5iLxXbiNk Diff:
Old | New | Differences | |
---|---|---|---|
17 | 17 | ||
18 | 18 | ||
19 | 19 | func keyTVLHistory (assetId,height) = makeString(["%s%s%d", "tvlHistory", assetId, toString(height)], SEP) | |
20 | + | ||
21 | + | ||
22 | + | func keyTopUpHistory (assetId,height) = makeString(["%s%s%d", "topUpHistory", assetId, toString(height)], SEP) | |
20 | 23 | ||
21 | 24 | ||
22 | 25 | func keyPendingWithdrawals (assetId) = makeString(["%s%s", "pendingWithdrawals", assetId], SEP) | |
230 | 233 | then true | |
231 | 234 | else throwErr("zero pendingWithdrawals, nothing to top up"), if ((pendingWithdrawals >= amount)) | |
232 | 235 | then true | |
233 | - | else "amount to top up must be less or equal than pendingWithdrawals"] | |
236 | + | else throwErr("amount to top up must be less or equal than pendingWithdrawals"), if ((getInteger(keyTopUpHistory(assetId, height)) == unit)) | |
237 | + | then true | |
238 | + | else throwErr("already have topUp in current block, wait for next block")] | |
234 | 239 | if ((checks == checks)) | |
235 | - | then [IntegerEntry(keyPendingWithdrawals(assetId), (pendingWithdrawals - amount))] | |
240 | + | then [IntegerEntry(keyPendingWithdrawals(assetId), (pendingWithdrawals - amount)), IntegerEntry(keyTopUpHistory(assetId, height), amount)] | |
236 | 241 | else throw("Strict value is not equal to itself.") | |
237 | 242 | } | |
238 | 243 | ||
242 | 247 | func setTVL (assetId,newStrTVL) = { | |
243 | 248 | let checks = [mustProxyAddress(i, assetId), if (valueOrElse(getBoolean(keyCreated(assetId)), false)) | |
244 | 249 | then true | |
245 | - | else throwErr("asset must be registered in the contract")] | |
250 | + | else throwErr("asset must be registered in the contract"), if ((getInteger(keyTVLHistory(assetId, height)) == unit)) | |
251 | + | then true | |
252 | + | else throwErr("already have setTVL in current block, wait for next block")] | |
246 | 253 | if ((checks == checks)) | |
247 | 254 | then { | |
248 | 255 | let newBigIntTVL = parseBigIntValue(newStrTVL) |
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 | let EMPTY = "" | |
7 | 7 | ||
8 | 8 | let contract = "lp_staking_v2: " | |
9 | 9 | ||
10 | 10 | func keyManagerPublicKey () = makeString(["%s", "managerPublicKey"], SEP) | |
11 | 11 | ||
12 | 12 | ||
13 | 13 | func keyPendingManagerPublicKey () = makeString(["%s", "pendingManagerPublicKey"], SEP) | |
14 | 14 | ||
15 | 15 | ||
16 | 16 | func keyTVL (assetId) = makeString(["%s%s", "tvl", assetId], SEP) | |
17 | 17 | ||
18 | 18 | ||
19 | 19 | func keyTVLHistory (assetId,height) = makeString(["%s%s%d", "tvlHistory", assetId, toString(height)], SEP) | |
20 | + | ||
21 | + | ||
22 | + | func keyTopUpHistory (assetId,height) = makeString(["%s%s%d", "topUpHistory", assetId, toString(height)], SEP) | |
20 | 23 | ||
21 | 24 | ||
22 | 25 | func keyPendingWithdrawals (assetId) = makeString(["%s%s", "pendingWithdrawals", assetId], SEP) | |
23 | 26 | ||
24 | 27 | ||
25 | 28 | func keyDelayInBlocks (assetId) = makeString(["%s%s", "delayInBlocks", assetId], SEP) | |
26 | 29 | ||
27 | 30 | ||
28 | 31 | func keyCreated (assetId) = makeString(["%s%s", "created", assetId], SEP) | |
29 | 32 | ||
30 | 33 | ||
31 | 34 | func keyAssetIdToLPId (assetId) = makeString(["%s%s", "assetIdToLPId", assetId], SEP) | |
32 | 35 | ||
33 | 36 | ||
34 | 37 | func keyLPIdToAssetId (lpId) = makeString(["%s%s", "lpIdToAssetId", lpId], SEP) | |
35 | 38 | ||
36 | 39 | ||
37 | 40 | func keyProxyAddress (assetId) = makeString(["%s%s", "proxyAddress", assetId], SEP) | |
38 | 41 | ||
39 | 42 | ||
40 | 43 | func keyMappingsUserToWithdrawal (assetId,userAddress,txId) = makeString(["%s%s%s%s", "userWithdrawalAmount", assetId, userAddress, txId], SEP) | |
41 | 44 | ||
42 | 45 | ||
43 | 46 | func keyOtherChainAssetDecimals (assetId) = makeString(["%s%s", "otherChainAssetDecimals", assetId], SEP) | |
44 | 47 | ||
45 | 48 | ||
46 | 49 | func keyAssetsStoreContract () = makeString(["%s", "assetsStoreContract"], SEP) | |
47 | 50 | ||
48 | 51 | ||
49 | 52 | func managerPublicKeyOrUnit () = match getString(keyManagerPublicKey()) { | |
50 | 53 | case s: String => | |
51 | 54 | fromBase58String(s) | |
52 | 55 | case _: Unit => | |
53 | 56 | unit | |
54 | 57 | case _ => | |
55 | 58 | throw("Match error") | |
56 | 59 | } | |
57 | 60 | ||
58 | 61 | ||
59 | 62 | func pendingManagerPublicKeyOrUnit () = match getString(keyPendingManagerPublicKey()) { | |
60 | 63 | case s: String => | |
61 | 64 | fromBase58String(s) | |
62 | 65 | case _: Unit => | |
63 | 66 | unit | |
64 | 67 | case _ => | |
65 | 68 | throw("Match error") | |
66 | 69 | } | |
67 | 70 | ||
68 | 71 | ||
69 | 72 | func throwErr (msg) = throw((contract + msg)) | |
70 | 73 | ||
71 | 74 | ||
72 | 75 | func mustManager (i) = { | |
73 | 76 | let pd = throwErr("permission denied") | |
74 | 77 | match managerPublicKeyOrUnit() { | |
75 | 78 | case pk: ByteVector => | |
76 | 79 | if ((i.callerPublicKey == pk)) | |
77 | 80 | then true | |
78 | 81 | else pd | |
79 | 82 | case _: Unit => | |
80 | 83 | if ((i.caller == this)) | |
81 | 84 | then true | |
82 | 85 | else pd | |
83 | 86 | case _ => | |
84 | 87 | throw("Match error") | |
85 | 88 | } | |
86 | 89 | } | |
87 | 90 | ||
88 | 91 | ||
89 | 92 | func assetsStoreContract () = addressFromStringValue(value(getString(keyAssetsStoreContract()))) | |
90 | 93 | ||
91 | 94 | ||
92 | 95 | func mustProxyAddress (i,assetId) = { | |
93 | 96 | let isProxy = (toString(i.caller) == valueOrElse(getString(keyProxyAddress(assetId)), EMPTY)) | |
94 | 97 | if (isProxy) | |
95 | 98 | then true | |
96 | 99 | else { | |
97 | 100 | let checkCaller = mustManager(i) | |
98 | 101 | if ((checkCaller == checkCaller)) | |
99 | 102 | then true | |
100 | 103 | else throw("Strict value is not equal to itself.") | |
101 | 104 | } | |
102 | 105 | } | |
103 | 106 | ||
104 | 107 | ||
105 | 108 | @Callable(i) | |
106 | 109 | func constructor (assetsStoreContract) = { | |
107 | 110 | let checkCaller = mustManager(i) | |
108 | 111 | if ((checkCaller == checkCaller)) | |
109 | 112 | then [StringEntry(keyAssetsStoreContract(), assetsStoreContract)] | |
110 | 113 | else throw("Strict value is not equal to itself.") | |
111 | 114 | } | |
112 | 115 | ||
113 | 116 | ||
114 | 117 | ||
115 | 118 | @Callable(i) | |
116 | 119 | func put () = { | |
117 | 120 | let pmt = value(i.payments[0]) | |
118 | 121 | let asset = value(pmt.assetId) | |
119 | 122 | let assetId = toBase58String(asset) | |
120 | 123 | let checks = [if ((size(i.payments) == 1)) | |
121 | 124 | then true | |
122 | 125 | else throwErr("only one payment must be attached"), if (valueOrElse(getBoolean(keyCreated(assetId)), false)) | |
123 | 126 | then true | |
124 | 127 | else throwErr("attached payment asset must be registered in the contract"), if ((pmt.amount > 0)) | |
125 | 128 | then true | |
126 | 129 | else throwErr("positive amount required")] | |
127 | 130 | if ((checks == checks)) | |
128 | 131 | then { | |
129 | 132 | let tvl = valueOrElse(getInteger(keyTVL(assetId)), 0) | |
130 | 133 | let lpId = value(getString(keyAssetIdToLPId(assetId))) | |
131 | 134 | let lpInfo = value(assetInfo(fromBase58String(assetId))) | |
132 | 135 | let sharesAmount = if ((tvl > 0)) | |
133 | 136 | then ((pmt.amount * lpInfo.quantity) / tvl) | |
134 | 137 | else pmt.amount | |
135 | 138 | [Reissue(lpInfo.id, sharesAmount, true), ScriptTransfer(i.caller, sharesAmount, lpInfo.id)] | |
136 | 139 | } | |
137 | 140 | else throw("Strict value is not equal to itself.") | |
138 | 141 | } | |
139 | 142 | ||
140 | 143 | ||
141 | 144 | ||
142 | 145 | @Callable(i) | |
143 | 146 | func submitGetRequest () = { | |
144 | 147 | let pmt = value(i.payments[0]) | |
145 | 148 | let lp = value(pmt.assetId) | |
146 | 149 | let lpId = toBase58String(lp) | |
147 | 150 | let userAddress = toString(i.caller) | |
148 | 151 | let baseAssetId = value(getString(keyLPIdToAssetId(lpId))) | |
149 | 152 | let shares = pmt.amount | |
150 | 153 | let checks = [if ((size(i.payments) == 1)) | |
151 | 154 | then true | |
152 | 155 | else throwErr("only one payment must be attached"), if (valueOrElse(getBoolean(keyCreated(baseAssetId)), false)) | |
153 | 156 | then true | |
154 | 157 | else throwErr("attached payment asset must be registered in the contract"), if ((shares > 0)) | |
155 | 158 | then true | |
156 | 159 | else throwErr("positive amount to withdrawal required")] | |
157 | 160 | if ((checks == checks)) | |
158 | 161 | then { | |
159 | 162 | let pendingWithdrawals = valueOrElse(getInteger(keyPendingWithdrawals(baseAssetId)), 0) | |
160 | 163 | let tvl = valueOrElse(getInteger(keyTVL(baseAssetId)), 0) | |
161 | 164 | let lpInfo = value(assetInfo(lp)) | |
162 | 165 | let decimals = lpInfo.decimals | |
163 | 166 | let withdrawalAmount = ((shares * tvl) / lpInfo.quantity) | |
164 | 167 | [Burn(lp, shares), IntegerEntry(keyPendingWithdrawals(baseAssetId), (pendingWithdrawals + withdrawalAmount)), IntegerEntry(keyMappingsUserToWithdrawal(baseAssetId, userAddress, toBase58String(i.transactionId)), withdrawalAmount)] | |
165 | 168 | } | |
166 | 169 | else throw("Strict value is not equal to itself.") | |
167 | 170 | } | |
168 | 171 | ||
169 | 172 | ||
170 | 173 | ||
171 | 174 | @Callable(i) | |
172 | 175 | func executeGetRequest (assetId,userAddress,submitTxId) = { | |
173 | 176 | let withdrawalAmount = valueOrElse(getInteger(keyMappingsUserToWithdrawal(assetId, userAddress, submitTxId)), 0) | |
174 | 177 | let checks = [if (valueOrElse(getBoolean(keyCreated(assetId)), false)) | |
175 | 178 | then true | |
176 | 179 | else throwErr("asset must be registered in the contract"), if ((withdrawalAmount > 0)) | |
177 | 180 | then true | |
178 | 181 | else throwErr("no corresponding withdrawal request")] | |
179 | 182 | if ((checks == checks)) | |
180 | 183 | then { | |
181 | 184 | let pendingWithdrawals = valueOrElse(getInteger(keyPendingWithdrawals(assetId)), 0) | |
182 | 185 | [ScriptTransfer(addressFromStringValue(userAddress), withdrawalAmount, fromBase58String(assetId)), DeleteEntry(keyMappingsUserToWithdrawal(assetId, userAddress, submitTxId)), IntegerEntry(keyPendingWithdrawals(assetId), (pendingWithdrawals - withdrawalAmount))] | |
183 | 186 | } | |
184 | 187 | else throw("Strict value is not equal to itself.") | |
185 | 188 | } | |
186 | 189 | ||
187 | 190 | ||
188 | 191 | ||
189 | 192 | @Callable(i) | |
190 | 193 | func registerAsset (assetId,lpName,lpDescription,lpLogo,delayInBlocks,proxyAddress,otherChainAssetDecimals) = { | |
191 | 194 | let checks = [mustManager(i), if ((delayInBlocks >= 0)) | |
192 | 195 | then true | |
193 | 196 | else throwErr("invalid delayInBlocks"), if ((addressFromString(proxyAddress) != unit)) | |
194 | 197 | then true | |
195 | 198 | else throwErr("invalid proxyAddress"), if ((valueOrElse(getBoolean(keyCreated(assetId)), false) == false)) | |
196 | 199 | then true | |
197 | 200 | else throwErr("asset already registered")] | |
198 | 201 | if ((checks == checks)) | |
199 | 202 | then { | |
200 | 203 | let decimals = value(assetInfo(fromBase58String(assetId))).decimals | |
201 | 204 | let lpIssue = Issue(lpName, lpDescription, 1, decimals, true) | |
202 | 205 | let lp = calculateAssetId(lpIssue) | |
203 | 206 | let lpId = toBase58String(lp) | |
204 | 207 | let createOrUpdate = invoke(assetsStoreContract(), "createOrUpdate", [lpId, lpLogo, false], nil) | |
205 | 208 | if ((createOrUpdate == createOrUpdate)) | |
206 | 209 | then { | |
207 | 210 | let addLabel = invoke(assetsStoreContract(), "addLabel", [lpId, "DEFI"], nil) | |
208 | 211 | if ((addLabel == addLabel)) | |
209 | 212 | then [BooleanEntry(keyCreated(assetId), true), IntegerEntry(keyTVL(assetId), 0), IntegerEntry(keyTVLHistory(assetId, height), 0), IntegerEntry(keyDelayInBlocks(assetId), delayInBlocks), StringEntry(keyLPIdToAssetId(lpId), assetId), StringEntry(keyAssetIdToLPId(assetId), lpId), StringEntry(keyProxyAddress(assetId), proxyAddress), IntegerEntry(keyOtherChainAssetDecimals(assetId), otherChainAssetDecimals), lpIssue, Burn(lp, 1)] | |
210 | 213 | else throw("Strict value is not equal to itself.") | |
211 | 214 | } | |
212 | 215 | else throw("Strict value is not equal to itself.") | |
213 | 216 | } | |
214 | 217 | else throw("Strict value is not equal to itself.") | |
215 | 218 | } | |
216 | 219 | ||
217 | 220 | ||
218 | 221 | ||
219 | 222 | @Callable(i) | |
220 | 223 | func topUpBalance () = { | |
221 | 224 | let pmt = valueOrErrorMessage(i.payments[0], (contract + "payment must be attached")) | |
222 | 225 | let assetId = toBase58String(value(pmt.assetId)) | |
223 | 226 | let amount = pmt.amount | |
224 | 227 | let pendingWithdrawals = valueOrElse(getInteger(keyPendingWithdrawals(assetId)), 0) | |
225 | 228 | let checks = [mustProxyAddress(i, assetId), if ((size(i.payments) == 1)) | |
226 | 229 | then true | |
227 | 230 | else throwErr("only one payment must be attached"), if (valueOrElse(getBoolean(keyCreated(assetId)), false)) | |
228 | 231 | then true | |
229 | 232 | else throwErr("attached payment asset must be registered in the contract"), if ((pendingWithdrawals != 0)) | |
230 | 233 | then true | |
231 | 234 | else throwErr("zero pendingWithdrawals, nothing to top up"), if ((pendingWithdrawals >= amount)) | |
232 | 235 | then true | |
233 | - | else "amount to top up must be less or equal than pendingWithdrawals"] | |
236 | + | else throwErr("amount to top up must be less or equal than pendingWithdrawals"), if ((getInteger(keyTopUpHistory(assetId, height)) == unit)) | |
237 | + | then true | |
238 | + | else throwErr("already have topUp in current block, wait for next block")] | |
234 | 239 | if ((checks == checks)) | |
235 | - | then [IntegerEntry(keyPendingWithdrawals(assetId), (pendingWithdrawals - amount))] | |
240 | + | then [IntegerEntry(keyPendingWithdrawals(assetId), (pendingWithdrawals - amount)), IntegerEntry(keyTopUpHistory(assetId, height), amount)] | |
236 | 241 | else throw("Strict value is not equal to itself.") | |
237 | 242 | } | |
238 | 243 | ||
239 | 244 | ||
240 | 245 | ||
241 | 246 | @Callable(i) | |
242 | 247 | func setTVL (assetId,newStrTVL) = { | |
243 | 248 | let checks = [mustProxyAddress(i, assetId), if (valueOrElse(getBoolean(keyCreated(assetId)), false)) | |
244 | 249 | then true | |
245 | - | else throwErr("asset must be registered in the contract")] | |
250 | + | else throwErr("asset must be registered in the contract"), if ((getInteger(keyTVLHistory(assetId, height)) == unit)) | |
251 | + | then true | |
252 | + | else throwErr("already have setTVL in current block, wait for next block")] | |
246 | 253 | if ((checks == checks)) | |
247 | 254 | then { | |
248 | 255 | let newBigIntTVL = parseBigIntValue(newStrTVL) | |
249 | 256 | let ten = parseBigIntValue("10") | |
250 | 257 | let assetDecimals = value(assetInfo(fromBase58String(assetId))).decimals | |
251 | 258 | let otherChainAssetDecimals = value(getInteger(keyOtherChainAssetDecimals(assetId))) | |
252 | 259 | let newTVLWavesDecimals = if ((otherChainAssetDecimals > assetDecimals)) | |
253 | 260 | then { | |
254 | 261 | let diff = parseBigIntValue(toString((otherChainAssetDecimals - assetDecimals))) | |
255 | 262 | (newBigIntTVL / pow(ten, 0, diff, 0, 0, DOWN)) | |
256 | 263 | } | |
257 | 264 | else if ((assetDecimals > otherChainAssetDecimals)) | |
258 | 265 | then { | |
259 | 266 | let diff = parseBigIntValue(toString((assetDecimals - otherChainAssetDecimals))) | |
260 | 267 | (newBigIntTVL * pow(ten, 0, diff, 0, 0, DOWN)) | |
261 | 268 | } | |
262 | 269 | else newBigIntTVL | |
263 | 270 | let newTVL = toInt(newTVLWavesDecimals) | |
264 | 271 | [IntegerEntry(keyTVL(assetId), newTVL), IntegerEntry(keyTVLHistory(assetId, height), newTVL)] | |
265 | 272 | } | |
266 | 273 | else throw("Strict value is not equal to itself.") | |
267 | 274 | } | |
268 | 275 | ||
269 | 276 | ||
270 | 277 | ||
271 | 278 | @Callable(i) | |
272 | 279 | func setManager (pendingManagerPublicKey) = { | |
273 | 280 | let checkCaller = mustManager(i) | |
274 | 281 | if ((checkCaller == checkCaller)) | |
275 | 282 | then { | |
276 | 283 | let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey) | |
277 | 284 | if ((checkManagerPublicKey == checkManagerPublicKey)) | |
278 | 285 | then [StringEntry(keyPendingManagerPublicKey(), pendingManagerPublicKey)] | |
279 | 286 | else throw("Strict value is not equal to itself.") | |
280 | 287 | } | |
281 | 288 | else throw("Strict value is not equal to itself.") | |
282 | 289 | } | |
283 | 290 | ||
284 | 291 | ||
285 | 292 | ||
286 | 293 | @Callable(i) | |
287 | 294 | func confirmManager () = { | |
288 | 295 | let pm = pendingManagerPublicKeyOrUnit() | |
289 | 296 | let hasPM = if (isDefined(pm)) | |
290 | 297 | then true | |
291 | 298 | else throwErr("no pending manager") | |
292 | 299 | if ((hasPM == hasPM)) | |
293 | 300 | then { | |
294 | 301 | let checkPM = if ((i.callerPublicKey == value(pm))) | |
295 | 302 | then true | |
296 | 303 | else throwErr("you are not pending manager") | |
297 | 304 | if ((checkPM == checkPM)) | |
298 | 305 | then [StringEntry(keyManagerPublicKey(), toBase58String(value(pm))), DeleteEntry(keyPendingManagerPublicKey())] | |
299 | 306 | else throw("Strict value is not equal to itself.") | |
300 | 307 | } | |
301 | 308 | else throw("Strict value is not equal to itself.") | |
302 | 309 | } | |
303 | 310 | ||
304 | 311 | ||
305 | 312 | @Verifier(tx) | |
306 | 313 | func verify () = { | |
307 | 314 | let targetPublicKey = match managerPublicKeyOrUnit() { | |
308 | 315 | case pk: ByteVector => | |
309 | 316 | pk | |
310 | 317 | case _: Unit => | |
311 | 318 | tx.senderPublicKey | |
312 | 319 | case _ => | |
313 | 320 | throw("Match error") | |
314 | 321 | } | |
315 | 322 | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
316 | 323 | } | |
317 | 324 |
github/deemru/w8io/026f985 47.93 ms ◑