tx · 64f5zkJaF24yPCKzSHp1E3VQGNNzq32NcqAteVbLt1FA 3MqSv5qEvZKapkPQ6hPtUgbZfxdMQexnwqa: -0.01400000 Waves 2024.12.17 12:56 [3418411] smart account 3MqSv5qEvZKapkPQ6hPtUgbZfxdMQexnwqa > SELF 0.00000000 Waves
{ "type": 13, "id": "64f5zkJaF24yPCKzSHp1E3VQGNNzq32NcqAteVbLt1FA", "fee": 1400000, "feeAssetId": null, "timestamp": 1734429290915, "version": 2, "chainId": 84, "sender": "3MqSv5qEvZKapkPQ6hPtUgbZfxdMQexnwqa", "senderPublicKey": "tinwq3CCsobvKT9fhHjTjbxXQdTDmXW9KtgPvR94m1H", "proofs": [ "44FwMi6Zc8iefN8aYmNCVqDve5tdeevCeo1QmJhAgrTwtSrEFGUzkqF4onaqEpW1nvd99pf6KbPSqksuoUTvDNnx" ], "script": "base64:BwJFCAISBAoCCAgSBQoDCAgIEgcKBQgICAgIEgUKAwgICBIJCgcICAgICAgIEgUKAwgICBIGCgQICAgIEgUKAwgICBIDCgEIIQAJU0VQQVJBVE9SAgJfXwAMS0VZX01VTFRJU0lHAghNVUxUSVNJRwAKS0VZX1NUQVRVUwIGU1RBVFVTAAhLRVlfSU5JVAIESU5JVAAUS0VZX0dBVEVXQVlfQ09OVFJBQ1QCEEdBVEVXQVlfQ09OVFJBQ1QAFEtFWV9NQVRDSEVSX0NPTlRSQUNUAhBNQVRDSEVSX0NPTlRSQUNUABBLRVlfVVNFUl9CQUxBTkNFAgxVU0VSX0JBTEFOQ0UAEUtFWV9UT1RBTF9CQUxBTkNFAg1UT1RBTF9CQUxBTkNFAAtTUE9UX1dBTExFVAIEU1BPVAAVU1RBS0lOR19SRVdBUkRfV0FMTEVUAg5TVEFLSU5HX1JFV0FSRAALWkVST19CSUdJTlQJALYCAQAAARBfdmFsaWRhdGVBZGRyZXNzAghhZGRyZXNzXwRlcnJfBAckbWF0Y2gwCQCmCAEFCGFkZHJlc3NfAwkAAQIFByRtYXRjaDACB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IHCQD0AwMIBQJ0eAlib2R5Qnl0ZXMJAJEDAggFAnR4BnByb29mcwAACAUCdHgPc2VuZGVyUHVibGljS2V57unFRA==", "height": 3418411, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: GvhZNZwcJLxtzaYbjVhyWXqoS27XNkDXay2gKpT7yPTv Next: none Diff:
Old | New | Differences | |
---|---|---|---|
271 | 271 | let userSourceBalance = _loadUserBalance(from_, wallet_, currency_) | |
272 | 272 | let userTargetBalance = _loadUserBalance(to_, wallet_, currency_) | |
273 | 273 | let dexTargetBalance = _loadUserBalance(dex_, wallet_, currency_) | |
274 | - | let newUserSourceBalance = ( | |
275 | - | let newUserTargetBalance = (userTargetBalance + amount) | |
274 | + | let newUserSourceBalance = (userSourceBalance - amount) | |
275 | + | let newUserTargetBalance = ((userTargetBalance + amount) - fee) | |
276 | 276 | let newDexTargetBalance = (dexTargetBalance + fee) | |
277 | 277 | let err1 = _validateBigInt(newUserSourceBalance, ZERO_BIGINT, "externalTransfer: insufficient amount") | |
278 | 278 | if ((err1 == err1)) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 7 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let SEPARATOR = "__" | |
5 | 5 | ||
6 | 6 | let KEY_MULTISIG = "MULTISIG" | |
7 | 7 | ||
8 | 8 | let KEY_STATUS = "STATUS" | |
9 | 9 | ||
10 | 10 | let KEY_INIT = "INIT" | |
11 | 11 | ||
12 | 12 | let KEY_GATEWAY_CONTRACT = "GATEWAY_CONTRACT" | |
13 | 13 | ||
14 | 14 | let KEY_MATCHER_CONTRACT = "MATCHER_CONTRACT" | |
15 | 15 | ||
16 | 16 | let KEY_USER_BALANCE = "USER_BALANCE" | |
17 | 17 | ||
18 | 18 | let KEY_TOTAL_BALANCE = "TOTAL_BALANCE" | |
19 | 19 | ||
20 | 20 | let SPOT_WALLET = "SPOT" | |
21 | 21 | ||
22 | 22 | let STAKING_REWARD_WALLET = "STAKING_REWARD" | |
23 | 23 | ||
24 | 24 | let ZERO_BIGINT = toBigInt(0) | |
25 | 25 | ||
26 | 26 | func _validateAddress (address_,err_) = match addressFromString(address_) { | |
27 | 27 | case a: Address => | |
28 | 28 | true | |
29 | 29 | case _ => | |
30 | 30 | throw(err_) | |
31 | 31 | } | |
32 | 32 | ||
33 | 33 | ||
34 | 34 | func _validateBigInt (val_,lowerBoundary_,err_) = if ((lowerBoundary_ > val_)) | |
35 | 35 | then throw(err_) | |
36 | 36 | else true | |
37 | 37 | ||
38 | 38 | ||
39 | 39 | func _validateString (val_,err_) = if (if ((0 >= size(val_))) | |
40 | 40 | then true | |
41 | 41 | else contains(val_, SEPARATOR)) | |
42 | 42 | then throw(err_) | |
43 | 43 | else true | |
44 | 44 | ||
45 | 45 | ||
46 | 46 | func _validateStringEqual (val1_,val2_,err_) = if ((val1_ != val2_)) | |
47 | 47 | then throw(err_) | |
48 | 48 | else true | |
49 | 49 | ||
50 | 50 | ||
51 | 51 | func _loadInit () = match getBoolean(KEY_INIT) { | |
52 | 52 | case a: Boolean => | |
53 | 53 | a | |
54 | 54 | case _ => | |
55 | 55 | false | |
56 | 56 | } | |
57 | 57 | ||
58 | 58 | ||
59 | 59 | func _saveInit (isInit_) = [BooleanEntry(KEY_INIT, isInit_)] | |
60 | 60 | ||
61 | 61 | ||
62 | 62 | func _loadMultisig () = match getString(KEY_MULTISIG) { | |
63 | 63 | case a: String => | |
64 | 64 | addressFromStringValue(a) | |
65 | 65 | case _ => | |
66 | 66 | Address(base58'') | |
67 | 67 | } | |
68 | 68 | ||
69 | 69 | ||
70 | 70 | func _saveMultisig (multisig_) = [StringEntry(KEY_MULTISIG, toString(multisig_))] | |
71 | 71 | ||
72 | 72 | ||
73 | 73 | func _loadGatewayContract () = match getString(KEY_GATEWAY_CONTRACT) { | |
74 | 74 | case a: String => | |
75 | 75 | addressFromStringValue(a) | |
76 | 76 | case _ => | |
77 | 77 | Address(base58'') | |
78 | 78 | } | |
79 | 79 | ||
80 | 80 | ||
81 | 81 | func _saveGatewayContract (gatewayContract_) = [StringEntry(KEY_GATEWAY_CONTRACT, toString(gatewayContract_))] | |
82 | 82 | ||
83 | 83 | ||
84 | 84 | func _loadMatcherContract () = match getString(KEY_MATCHER_CONTRACT) { | |
85 | 85 | case a: String => | |
86 | 86 | addressFromStringValue(a) | |
87 | 87 | case _ => | |
88 | 88 | Address(base58'') | |
89 | 89 | } | |
90 | 90 | ||
91 | 91 | ||
92 | 92 | func _saveMatcherContract (matcherContract_) = [StringEntry(KEY_MATCHER_CONTRACT, toString(matcherContract_))] | |
93 | 93 | ||
94 | 94 | ||
95 | 95 | func _loadUserBalance (user_,wallet_,currency_) = match getString(makeString([KEY_USER_BALANCE, user_, wallet_, currency_], SEPARATOR)) { | |
96 | 96 | case a: String => | |
97 | 97 | parseBigIntValue(a) | |
98 | 98 | case _ => | |
99 | 99 | ZERO_BIGINT | |
100 | 100 | } | |
101 | 101 | ||
102 | 102 | ||
103 | 103 | func _saveUserBalance (user_,wallet_,currency_,balance_) = [StringEntry(makeString([KEY_USER_BALANCE, user_, wallet_, currency_], SEPARATOR), toString(balance_))] | |
104 | 104 | ||
105 | 105 | ||
106 | 106 | func _loadTotalBalance (currency_) = match getString(makeString([KEY_TOTAL_BALANCE, currency_], SEPARATOR)) { | |
107 | 107 | case a: String => | |
108 | 108 | parseBigIntValue(a) | |
109 | 109 | case _ => | |
110 | 110 | ZERO_BIGINT | |
111 | 111 | } | |
112 | 112 | ||
113 | 113 | ||
114 | 114 | func _saveTotalBalance (currency_,balance_) = [StringEntry(makeString([KEY_TOTAL_BALANCE, currency_], SEPARATOR), toString(balance_))] | |
115 | 115 | ||
116 | 116 | ||
117 | 117 | func _onlyThisContract (caller_) = if ((caller_ != this)) | |
118 | 118 | then throw("_onlyThisContract: revert") | |
119 | 119 | else true | |
120 | 120 | ||
121 | 121 | ||
122 | 122 | func _whenMultisigSet () = if ((_loadMultisig() == Address(base58''))) | |
123 | 123 | then throw("_whenMultisigSet: revert") | |
124 | 124 | else true | |
125 | 125 | ||
126 | 126 | ||
127 | 127 | func _whenNotInitialized () = if (_loadInit()) | |
128 | 128 | then throw("_whenNotInitialized: revert") | |
129 | 129 | else true | |
130 | 130 | ||
131 | 131 | ||
132 | 132 | func _whenInitialized () = if (!(_loadInit())) | |
133 | 133 | then throw("_whenInitialized: revert") | |
134 | 134 | else true | |
135 | 135 | ||
136 | 136 | ||
137 | 137 | func _validateGateway (caller,err_) = if ((_loadGatewayContract() != caller)) | |
138 | 138 | then throw(err_) | |
139 | 139 | else true | |
140 | 140 | ||
141 | 141 | ||
142 | 142 | func _validateMatcher (caller,err_) = if ((_loadMatcherContract() != caller)) | |
143 | 143 | then throw(err_) | |
144 | 144 | else true | |
145 | 145 | ||
146 | 146 | ||
147 | 147 | @Callable(i) | |
148 | 148 | func init (gatewayContract_,matcherContract_) = { | |
149 | 149 | let err = if (if (if (if (_onlyThisContract(i.caller)) | |
150 | 150 | then _whenNotInitialized() | |
151 | 151 | else false) | |
152 | 152 | then _whenMultisigSet() | |
153 | 153 | else false) | |
154 | 154 | then _validateAddress(gatewayContract_, "init: invalid gatewayContract") | |
155 | 155 | else false) | |
156 | 156 | then _validateAddress(matcherContract_, "init: invalid matcherContract") | |
157 | 157 | else false | |
158 | 158 | if ((err == err)) | |
159 | 159 | then $Tuple2(((_saveInit(true) ++ _saveGatewayContract(addressFromStringValue(gatewayContract_))) ++ _saveMatcherContract(addressFromStringValue(matcherContract_))), unit) | |
160 | 160 | else throw("Strict value is not equal to itself.") | |
161 | 161 | } | |
162 | 162 | ||
163 | 163 | ||
164 | 164 | ||
165 | 165 | @Callable(i) | |
166 | 166 | func deposit (user_,currency_,amount_) = { | |
167 | 167 | let amount = valueOrErrorMessage(parseBigInt(amount_), "deposit: amount not int") | |
168 | 168 | let err = if (if (if (if (_whenInitialized()) | |
169 | 169 | then _validateString(user_, "deposit: invalid user") | |
170 | 170 | else false) | |
171 | 171 | then _validateString(currency_, "deposit: invalid currency") | |
172 | 172 | else false) | |
173 | 173 | then _validateBigInt(amount, ZERO_BIGINT, "deposit: invalid amount") | |
174 | 174 | else false) | |
175 | 175 | then _validateGateway(i.caller, "deposit: invalid caller") | |
176 | 176 | else false | |
177 | 177 | if ((err == err)) | |
178 | 178 | then { | |
179 | 179 | let userBalance = _loadUserBalance(user_, SPOT_WALLET, currency_) | |
180 | 180 | $Tuple2((_saveUserBalance(user_, SPOT_WALLET, currency_, (userBalance + amount)) ++ _saveTotalBalance(currency_, (_loadTotalBalance(currency_) + amount))), unit) | |
181 | 181 | } | |
182 | 182 | else throw("Strict value is not equal to itself.") | |
183 | 183 | } | |
184 | 184 | ||
185 | 185 | ||
186 | 186 | ||
187 | 187 | @Callable(i) | |
188 | 188 | func internalTransfer (user_,sourceWallet_,targetWallet_,currency_,amount_) = { | |
189 | 189 | let amount = valueOrErrorMessage(parseBigInt(amount_), "internalTransfer: amount not int") | |
190 | 190 | let err = if (if (if (if (if (if (_whenInitialized()) | |
191 | 191 | then _validateString(user_, "internalTransfer: invalid user") | |
192 | 192 | else false) | |
193 | 193 | then _validateString(sourceWallet_, "internalTransfer: invalid sourceWallet") | |
194 | 194 | else false) | |
195 | 195 | then _validateString(targetWallet_, "internalTransfer: invalid targetWallet") | |
196 | 196 | else false) | |
197 | 197 | then _validateString(currency_, "internalTransfer: invalid currency") | |
198 | 198 | else false) | |
199 | 199 | then _validateBigInt(amount, ZERO_BIGINT, "internalTransfer: invalid amount") | |
200 | 200 | else false) | |
201 | 201 | then _validateMatcher(i.caller, "internalTransfer: invalid matcher caller") | |
202 | 202 | else false | |
203 | 203 | if ((err == err)) | |
204 | 204 | then { | |
205 | 205 | let userSourceBalance = _loadUserBalance(user_, sourceWallet_, currency_) | |
206 | 206 | let userTargetBalance = _loadUserBalance(user_, targetWallet_, currency_) | |
207 | 207 | let newUserSourceBalance = (userSourceBalance - amount) | |
208 | 208 | let newUserTargetBalance = (userTargetBalance + amount) | |
209 | 209 | let err1 = _validateBigInt(newUserSourceBalance, ZERO_BIGINT, "internalTransfer: insufficient amount") | |
210 | 210 | if ((err1 == err1)) | |
211 | 211 | then $Tuple2((_saveUserBalance(user_, sourceWallet_, currency_, newUserSourceBalance) ++ _saveUserBalance(user_, targetWallet_, currency_, newUserTargetBalance)), unit) | |
212 | 212 | else throw("Strict value is not equal to itself.") | |
213 | 213 | } | |
214 | 214 | else throw("Strict value is not equal to itself.") | |
215 | 215 | } | |
216 | 216 | ||
217 | 217 | ||
218 | 218 | ||
219 | 219 | @Callable(i) | |
220 | 220 | func withdraw (user_,currency_,amount_) = { | |
221 | 221 | let amount = valueOrErrorMessage(parseBigInt(amount_), "withdraw: amount not int") | |
222 | 222 | let err = if (if (if (if (_whenInitialized()) | |
223 | 223 | then _validateString(user_, "withdraw: invalid user") | |
224 | 224 | else false) | |
225 | 225 | then _validateString(currency_, "withdraw: invalid currency") | |
226 | 226 | else false) | |
227 | 227 | then _validateBigInt(amount, ZERO_BIGINT, "withdraw: invalid amount") | |
228 | 228 | else false) | |
229 | 229 | then _validateGateway(i.caller, "withdraw: invalid caller") | |
230 | 230 | else false | |
231 | 231 | if ((err == err)) | |
232 | 232 | then { | |
233 | 233 | let userBalance = _loadUserBalance(user_, SPOT_WALLET, currency_) | |
234 | 234 | let newUserBalance = (userBalance - amount) | |
235 | 235 | let newTotalBalance = (_loadTotalBalance(currency_) - amount) | |
236 | 236 | let err1 = if (_validateBigInt(newUserBalance, ZERO_BIGINT, "withdraw: insufficient amount")) | |
237 | 237 | then _validateBigInt(newTotalBalance, ZERO_BIGINT, "withdraw: negative total balance") | |
238 | 238 | else false | |
239 | 239 | if ((err1 == err1)) | |
240 | 240 | then $Tuple2((_saveUserBalance(user_, SPOT_WALLET, currency_, newUserBalance) ++ _saveTotalBalance(currency_, newTotalBalance)), unit) | |
241 | 241 | else throw("Strict value is not equal to itself.") | |
242 | 242 | } | |
243 | 243 | else throw("Strict value is not equal to itself.") | |
244 | 244 | } | |
245 | 245 | ||
246 | 246 | ||
247 | 247 | ||
248 | 248 | @Callable(i) | |
249 | 249 | func externalTransfer (wallet_,currency_,from_,to_,amount_,fee_,dex_) = { | |
250 | 250 | let amount = valueOrErrorMessage(parseBigInt(amount_), "externalTransfer: amount not int") | |
251 | 251 | let fee = valueOrErrorMessage(parseBigInt(fee_), "externalTransfer: fee not int") | |
252 | 252 | let err = if (if (if (if (if (if (if (if (_whenInitialized()) | |
253 | 253 | then _validateString(wallet_, "externalTransfer: invalid wallet") | |
254 | 254 | else false) | |
255 | 255 | then _validateString(currency_, "externalTransfer: invalid currency") | |
256 | 256 | else false) | |
257 | 257 | then _validateString(from_, "externalTransfer: invalid from") | |
258 | 258 | else false) | |
259 | 259 | then _validateString(to_, "externalTransfer: invalid to") | |
260 | 260 | else false) | |
261 | 261 | then _validateBigInt(amount, ZERO_BIGINT, "externalTransfer: invalid amount") | |
262 | 262 | else false) | |
263 | 263 | then _validateBigInt(fee, ZERO_BIGINT, "externalTransfer: invalid fee") | |
264 | 264 | else false) | |
265 | 265 | then _validateString(dex_, "externalTransfer: invalid dex") | |
266 | 266 | else false) | |
267 | 267 | then _validateMatcher(i.caller, "externalTransfer: invalid matcher caller") | |
268 | 268 | else false | |
269 | 269 | if ((err == err)) | |
270 | 270 | then { | |
271 | 271 | let userSourceBalance = _loadUserBalance(from_, wallet_, currency_) | |
272 | 272 | let userTargetBalance = _loadUserBalance(to_, wallet_, currency_) | |
273 | 273 | let dexTargetBalance = _loadUserBalance(dex_, wallet_, currency_) | |
274 | - | let newUserSourceBalance = ( | |
275 | - | let newUserTargetBalance = (userTargetBalance + amount) | |
274 | + | let newUserSourceBalance = (userSourceBalance - amount) | |
275 | + | let newUserTargetBalance = ((userTargetBalance + amount) - fee) | |
276 | 276 | let newDexTargetBalance = (dexTargetBalance + fee) | |
277 | 277 | let err1 = _validateBigInt(newUserSourceBalance, ZERO_BIGINT, "externalTransfer: insufficient amount") | |
278 | 278 | if ((err1 == err1)) | |
279 | 279 | then $Tuple2(((_saveUserBalance(from_, wallet_, currency_, newUserSourceBalance) ++ _saveUserBalance(to_, wallet_, currency_, newUserTargetBalance)) ++ _saveUserBalance(dex_, wallet_, currency_, newDexTargetBalance)), unit) | |
280 | 280 | else throw("Strict value is not equal to itself.") | |
281 | 281 | } | |
282 | 282 | else throw("Strict value is not equal to itself.") | |
283 | 283 | } | |
284 | 284 | ||
285 | 285 | ||
286 | 286 | ||
287 | 287 | @Callable(i) | |
288 | 288 | func depositStakingReward (dex_,currency_,amount_) = { | |
289 | 289 | let amount = valueOrErrorMessage(parseBigInt(amount_), "depositStakingReward: amount not int") | |
290 | 290 | let err = if (if (if (if (_whenInitialized()) | |
291 | 291 | then _validateString(dex_, "depositStakingReward: invalid dex") | |
292 | 292 | else false) | |
293 | 293 | then _validateString(currency_, "depositStakingReward: invalid currency") | |
294 | 294 | else false) | |
295 | 295 | then _validateBigInt(amount, ZERO_BIGINT, "depositStakingReward: invalid amount") | |
296 | 296 | else false) | |
297 | 297 | then _validateGateway(i.caller, "depositStakingReward: invalid caller") | |
298 | 298 | else false | |
299 | 299 | if ((err == err)) | |
300 | 300 | then { | |
301 | 301 | let userBalance = _loadUserBalance(dex_, STAKING_REWARD_WALLET, currency_) | |
302 | 302 | $Tuple2((_saveUserBalance(dex_, STAKING_REWARD_WALLET, currency_, (userBalance + amount)) ++ _saveTotalBalance(currency_, (_loadTotalBalance(currency_) + amount))), unit) | |
303 | 303 | } | |
304 | 304 | else throw("Strict value is not equal to itself.") | |
305 | 305 | } | |
306 | 306 | ||
307 | 307 | ||
308 | 308 | ||
309 | 309 | @Callable(i) | |
310 | 310 | func claimReward (dex_,user_,currency_,amount_) = { | |
311 | 311 | let amount = valueOrErrorMessage(parseBigInt(amount_), "claimReward: amount not int") | |
312 | 312 | let err = if (if (if (if (if (_whenInitialized()) | |
313 | 313 | then _validateString(dex_, "claimReward: invalid dex") | |
314 | 314 | else false) | |
315 | 315 | then _validateString(user_, "claimReward: invalid user") | |
316 | 316 | else false) | |
317 | 317 | then _validateString(currency_, "claimReward: invalid currency") | |
318 | 318 | else false) | |
319 | 319 | then _validateBigInt(amount, ZERO_BIGINT, "claimReward: invalid amount") | |
320 | 320 | else false) | |
321 | 321 | then _validateMatcher(i.caller, "claimReward: invalid matcher caller") | |
322 | 322 | else false | |
323 | 323 | if ((err == err)) | |
324 | 324 | then { | |
325 | 325 | let dexSourceBalance = _loadUserBalance(dex_, STAKING_REWARD_WALLET, currency_) | |
326 | 326 | let userTargetBalance = _loadUserBalance(user_, SPOT_WALLET, currency_) | |
327 | 327 | let newDexSourceBalance = (dexSourceBalance - amount) | |
328 | 328 | let newUserTargetBalance = (userTargetBalance + amount) | |
329 | 329 | let err1 = _validateBigInt(newDexSourceBalance, ZERO_BIGINT, "claimReward: insufficient amount") | |
330 | 330 | if ((err1 == err1)) | |
331 | 331 | then $Tuple2((_saveUserBalance(dex_, STAKING_REWARD_WALLET, currency_, newDexSourceBalance) ++ _saveUserBalance(user_, SPOT_WALLET, currency_, newUserTargetBalance)), unit) | |
332 | 332 | else throw("Strict value is not equal to itself.") | |
333 | 333 | } | |
334 | 334 | else throw("Strict value is not equal to itself.") | |
335 | 335 | } | |
336 | 336 | ||
337 | 337 | ||
338 | 338 | ||
339 | 339 | @Callable(i) | |
340 | 340 | func getUserBalance (user_,wallet_,currency_) = $Tuple2(nil, toString(_loadUserBalance(user_, wallet_, currency_))) | |
341 | 341 | ||
342 | 342 | ||
343 | 343 | ||
344 | 344 | @Callable(i) | |
345 | 345 | func setMultisig (multisig_) = { | |
346 | 346 | let err = if (_onlyThisContract(i.caller)) | |
347 | 347 | then _validateAddress(multisig_, "setMultisig: invalid multisig") | |
348 | 348 | else false | |
349 | 349 | if ((err == err)) | |
350 | 350 | then $Tuple2(_saveMultisig(addressFromStringValue(multisig_)), unit) | |
351 | 351 | else throw("Strict value is not equal to itself.") | |
352 | 352 | } | |
353 | 353 | ||
354 | 354 | ||
355 | 355 | @Verifier(tx) | |
356 | 356 | func verify () = match tx { | |
357 | 357 | case _ => | |
358 | 358 | match getString(KEY_MULTISIG) { | |
359 | 359 | case multisig: String => | |
360 | 360 | valueOrElse(getBoolean(addressFromStringValue(multisig), makeString([KEY_STATUS, toString(this), toBase58String(tx.id)], SEPARATOR)), false) | |
361 | 361 | case _ => | |
362 | 362 | sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
363 | 363 | } | |
364 | 364 | } | |
365 | 365 |
github/deemru/w8io/169f3d6 52.00 ms ◑